S200 Handoff Prompt
Context and instructions for the next agent continuing platform code generation work
S200 Handoff Prompt — Perfecting Platform Code Generation
Who You Are
You are continuing work on GoGrab Space's Generate → Edit → Deploy pipeline. Session 200 built the backend infrastructure. Your job is to perfect the platform code generation process and close the remaining gaps so the full pipeline works end-to-end.
What Was Built in S199 (6 Commits)
| Commit | What | Key Files |
|---|---|---|
| S199.1 | Scaffold generator rewrite — models extend BaseEntity, services extend BaseCrudApiService, components use composables, authGuard on routes, domain events, .vitto/instructions.json | APIs/backend-vitto-api/.../module-gen-phase.executor.ts (generateScaffoldFiles method ~line 1209), APIs/backend-ai-api/.../module-code-generator.service.ts (generateEntityModel method) |
| S199.2 | App shell generator — produces complete Angular app wrapping all modules | APIs/backend-vitto-api/.../generators/app-shell-generator.service.ts (new file) |
| S199.3 | GitLab-backed Studio — StudioRepoController proxies file ops to GitLab | APIs/backend-ai-api/.../module-files/studio-repo.controller.ts (new file), libs/libs-structural/vitto-studio/.../studio-api.service.ts (new GitLab methods) |
| S199.4 | Draft MR — createDraftMR replaces auto-merge, emits MR URL via SSE | APIs/backend-vitto-api/.../module-gen-phase.executor.ts (~line 580), APIs/backend-vitto-api/.../universe-git.service.ts (createDraftMR method) |
| S199.5 | edit_module_file tool — commits code changes to GitLab from Vitto chat | APIs/backend-vitto-api/.../tools/tool-registry.service.ts (~line 1440) |
| S199.6 | SSE reconnection — getActiveSessionBySpace + poll endpoint | APIs/backend-vitto-api/.../session/module-gen-session.manager.ts, APIs/backend-vitto-api/.../module-generation.controller.ts (GET /active/:spaceId) |
The Full Plan
Read: docs/english/Plans/perfecting-platform-code-gen.plan.md
This has the complete gap analysis with 17 tasks across 5 phases. Phase 1 is your priority.
Your Priority: Phase 1 — Frontend Wiring
These 4 tasks connect the S199 backend infrastructure to the frontend. Without them, the backend work is invisible to users.
Task 1.1: VfsSyncService — Load from GitLab Instead of Disk
File: libs/libs-structural/vitto-studio/src/lib/services/vfs-sync.service.ts
What to do:
- The method
refreshAllModulesFromDisk()currently callsapi.listModulesOnDisk()which reads local filesystem - Add a parallel method
refreshAllModulesFromRepo(spaceSlug, universeSlug)that calls the new GitLab-backed API:api.listModulesFromRepo(spaceSlug, universeSlug)→ get module slugsapi.getModuleStructureFromRepo(spaceSlug, universeSlug, slug)→ get file treeapi.getFileFromRepo(spaceSlug, universeSlug, filePath)→ get content
- Modify
hydrateModuleFiles()to detect whether to use GitLab or disk mode - The API methods already exist on
StudioApiService(added in S199.3)
How to detect mode: If the project has a spaceSlug and universeSlug in its context, use GitLab. Otherwise fall back to disk.
Task 1.2: Edit → GitLab Auto-Commit
File: libs/libs-structural/vitto-studio/src/lib/services/vfs-sync.service.ts
What to do:
- When a user edits a file in Studio, the existing debounce logic syncs to backend
- Extend it to call
api.commitFileToRepo(spaceSlug, universeSlug, filePath, content, 'edit: filename')after the 1s debounce - Show commit status (saved/saving/error) in the editor — update the VFS node's metadata
Task 1.3: Chat SSE Reconnection
File: libs/libs-ai/vitto-chat/src/lib/services/vitto-chat-engine.service.ts
What to do:
- On service initialization, call
GET {VITTO_API_URL}/module-generation/active/{spaceId} - If response has
active: true, resubscribe to the SSE stream using the returnedsessionId - Show a "Reconnected to generation in progress" message in chat
- The endpoint already exists (S199.6) and the ReplaySubject(50) already buffers events
Task 1.4: MR URL Display in Chat
File: libs/libs-ai/vitto-chat/src/lib/services/vitto-chat-engine.service.ts
What to do:
- Add a handler for
module-gen.mr-createdSSE event type (alongside existingtool.starting,tool.progresshandlers from S197) - Display: "Draft merge request created: View in GitLab" as a chat message
- The event data has:
{ mrUrl, mrId, branch, target, draft }
Key Architecture Context
- GitLab is the source of truth for all generated code. Not local disk, not R2.
- Studio reads from GitLab, edits commit to GitLab, deploys from GitLab.
- Vitto chat has the
edit_module_filetool that commits to GitLab directly. - UniverseGitService on backend-vitto-api wraps GitLab REST API v4 (no git binary).
- StudioRepoController on backend-ai-api proxies to backend-api's GitLabProviderService.
Existing Infrastructure You Can Use
| Service | Port | What It Does |
|---|---|---|
StudioApiService (frontend) |
→ 3001 | Has both disk-based and GitLab-backed file methods |
StudioRepoController (backend-ai-api) |
3001 | Proxies GitLab file operations |
UniverseGitService (backend-vitto-api) |
3003 | Direct GitLab API calls (branches, commits, MRs) |
GitLabProviderService (backend-api) |
3000 | Full GitLab REST API wrapper (1343 lines) |
CloudflarePagesService (backend-api) |
3000 | Direct upload to Cloudflare Pages |
DirectCloudflareDeployService (backend-ai-api) |
3001 | Collects files + uploads to Cloudflare |
What NOT to Do
- Do NOT manually edit generated module files (modules/structural/*). Fix the generator instead.
- Do NOT edit tsconfig.base.json for @module/* paths. Use
config/tsconfig-paths/modules/generated.paths.json+yarn paths:merge. - Do NOT hardcode ports. Use env vars from
.env.local. - Do NOT pass
--portto backend serve commands (causes WebSocket 400 errors). - Do NOT use Promises or async/await in Angular code. Use RxJS Observables exclusively.
Testing
- Backend-vitto-api auto-restarts on file changes (NestJS watch mode)
- Backend-ai-api auto-restarts on file changes
- Frontend:
yarn serve:space(port 6200) — but rebuilding large NX apps is slow. Prefer building only the specific library you changed:npx nx build vitto-studio --skip-nx-cache - To test generation: use the Vitto chat in gograb-space on port 6200, ask to generate a platform
Environment
- Branch:
session-200(create fromsession-199) - GitLab credentials: in
.env.local(GITLAB_URL, GITLAB_API_TOKEN) - Cloudflare credentials: in
.env.local(CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKEN) - R2 credentials: in
.env.local(R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY)
Commit Convention
[S200.N] type: description
Example: [S200.1] feat: VfsSyncService loads modules from GitLab repo