vibe-coding-master 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +35 -24
  2. package/dist/backend/adapters/filesystem.js +0 -7
  3. package/dist/backend/api/app-settings-routes.js +8 -0
  4. package/dist/backend/api/message-routes.js +3 -1
  5. package/dist/backend/api/session-routes.js +7 -1
  6. package/dist/backend/api/task-routes.js +3 -10
  7. package/dist/backend/api/translation-routes.js +21 -3
  8. package/dist/backend/runtime/terminal-submit.js +20 -0
  9. package/dist/backend/server.js +8 -4
  10. package/dist/backend/services/app-settings-service.js +118 -15
  11. package/dist/backend/services/claude-transcript-service.js +12 -8
  12. package/dist/backend/services/command-dispatcher.js +2 -1
  13. package/dist/backend/services/message-service.js +10 -6
  14. package/dist/backend/services/project-service.js +5 -27
  15. package/dist/backend/services/session-service.js +7 -4
  16. package/dist/backend/services/task-service.js +66 -57
  17. package/dist/backend/services/translation-service.js +264 -77
  18. package/dist/backend/templates/harness/gitignore.js +1 -4
  19. package/dist/shared/types/app-settings.js +1 -0
  20. package/dist-frontend/assets/index-B1vIIwLq.js +88 -0
  21. package/dist-frontend/assets/index-DPyKuEOz.css +32 -0
  22. package/dist-frontend/index.html +2 -2
  23. package/docs/cc-best-practices.md +4 -4
  24. package/docs/product-design.md +71 -31
  25. package/docs/v1-architecture-design.md +90 -56
  26. package/docs/v1-implementation-plan.md +76 -62
  27. package/package.json +3 -1
  28. package/dist/backend/ws/translation-ws.js +0 -35
  29. package/dist-frontend/assets/index-CuiNNOzj.css +0 -32
  30. package/dist-frontend/assets/index-D59GuHCR.js +0 -58
@@ -21,7 +21,7 @@ Runtime shape:
21
21
  ```text
22
22
  browser
23
23
  -> React GUI
24
- -> HTTP API + WebSocket
24
+ -> HTTP API + terminal WebSocket
25
25
  -> Fastify backend
26
26
  -> services
27
27
  -> node-pty
@@ -94,9 +94,9 @@ Responsibilities:
94
94
  - Render repository connect form.
95
95
  - Render repository summary.
96
96
  - Render workflow panel.
97
- - Render settings section with Messages, Events, Auto orchestration.
97
+ - Render settings section with Theme, Messages, Events, Auto orchestration.
98
98
  - Render harness status/actions.
99
- - Render task creation form with one task-name field, a checked non-optional worktree/branch indicator, and generated branch/path previews.
99
+ - Render task creation form with one task-name field, a `Create worktree and branch` checkbox selected by default, and generated branch/path previews when selected.
100
100
  - Render task list.
101
101
  - Render Messages and Events modals.
102
102
 
@@ -140,11 +140,12 @@ File:
140
140
  Responsibilities:
141
141
 
142
142
  - Load translation settings and prompt previews.
143
- - Open translation WebSocket for the current terminal runtime session id.
143
+ - Start backend transcript listening for the current terminal runtime session id.
144
+ - Poll backend translation events with a cursor.
144
145
  - Render dark translation output panel.
145
146
  - Render translation status: `ready`, `translating <elapsed>`, or `error`.
146
147
  - Render preserved tool output as dim one-line rows.
147
- - Render prose source while translating, then translated text after completion.
148
+ - Render prose source while translating, then translated text after completion, using Markdown rendering for prose.
148
149
  - Render user composer.
149
150
  - Translate on `Enter`; newline on `Shift+Enter`.
150
151
  - Replace Chinese input with English draft after translation.
@@ -186,7 +187,6 @@ Fastify registers:
186
187
  - message routes
187
188
  - translation routes
188
189
  - terminal WebSocket
189
- - translation WebSocket
190
190
 
191
191
  ## 5. Repository Connection
192
192
 
@@ -202,7 +202,7 @@ POST /api/projects/connect
202
202
  -> resolve path
203
203
  -> check path exists
204
204
  -> check .git marker directly
205
- -> create .ai/vcm/config.json
205
+ -> create ~/.vcm/projects/<project-id>/config.json
206
206
  -> ensure .ai/vcm state dirs
207
207
  -> read branch and dirty state
208
208
  -> record recent repo path in ~/.vcm/settings.json
@@ -224,12 +224,12 @@ VCM does not require global `safe.directory` configuration.
224
224
 
225
225
  ## 6. Task Worktree Architecture
226
226
 
227
- Task-level worktree management is the current architecture for multi-task parallelism.
227
+ Task-level worktree management is the default architecture for multi-task parallelism.
228
228
 
229
229
  Rule:
230
230
 
231
231
  ```text
232
- one VCM task = one branch + one git worktree + one handoff directory + one role-session set
232
+ default VCM task = one branch + one git worktree + one handoff directory + one role-session set
233
233
  ```
234
234
 
235
235
  Branch name:
@@ -244,7 +244,15 @@ Worktree path:
244
244
  <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
245
245
  ```
246
246
 
247
- VCM does not support switching a task to another branch or worktree after creation. If the user needs a different branch/worktree, they should create a new task.
247
+ VCM does not support switching a task to another branch or worktree mode after creation. If the user needs a different branch/worktree choice, they should create a new task.
248
+
249
+ When `Create worktree and branch` is cleared, the task uses:
250
+
251
+ ```text
252
+ branch: current connected-repo branch
253
+ runtime repo root: <baseRepoRoot>
254
+ worktreePath: undefined
255
+ ```
248
256
 
249
257
  VCM does not create worktrees by role. All four role sessions for a task share the same task worktree:
250
258
 
@@ -265,24 +273,33 @@ VCM distinguishes:
265
273
  - `branch`: `feature/<taskSlug>`.
266
274
  - `worktreePath`: same as `taskRepoRoot`.
267
275
 
268
- Project-level VCM control state stays under the base repo:
276
+ Base repo state is only the task index and the container for nested task worktrees:
269
277
 
270
278
  ```text
271
- <baseRepoRoot>/.ai/vcm/config.json
272
279
  <baseRepoRoot>/.ai/vcm/tasks/<task>.json
273
- <baseRepoRoot>/.ai/vcm/sessions/<task>.json
274
- <baseRepoRoot>/.ai/vcm/messages/<task>.jsonl
275
- <baseRepoRoot>/.ai/vcm/orchestration/<task>.json
276
280
  <baseRepoRoot>/.ai/vcm/worktrees/<task>/
277
281
  ```
278
282
 
279
- Task source changes and handoff artifacts live in the task worktree:
283
+ Project configuration is app-local and stored outside the repository:
284
+
285
+ ```text
286
+ ~/.vcm/projects/<project-id>/config.json
287
+ ~/.vcm/projects/index.json
288
+ ```
289
+
290
+ Task runtime state, source changes, and handoff artifacts live in the task runtime repo. For worktree-backed tasks this is the nested task worktree:
280
291
 
281
292
  ```text
293
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/vcm/sessions/<task>.json
294
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/vcm/messages/<task>.jsonl
295
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/vcm/orchestration/<task>.json
296
+ <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/vcm/translation/<task>/
282
297
  <baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/handoffs/<task>/
283
298
  ```
284
299
 
285
- This central base-state model lets VCM list and manage multiple tasks while each task's code changes happen in a separate worktree.
300
+ For inline tasks, `taskRepoRoot` is the connected base repo, so these same runtime paths resolve under the connected repo's `.ai/vcm/`.
301
+
302
+ This split lets VCM list tasks from the base repo after worktrees are created, while each task's runtime state follows the same root as the role sessions.
286
303
 
287
304
  ### 6.2 Git Ignore Requirement
288
305
 
@@ -301,37 +318,36 @@ The VCM harness manages a `.gitignore` block that ignores `.ai/vcm/` before task
301
318
  ```text
302
319
  POST /api/tasks
303
320
  -> validate taskSlug
304
- -> compute branch feature/<taskSlug>
305
- -> compute worktreePath <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
306
- -> assert branch does not already exist
307
- -> assert worktreePath does not already exist
308
321
  -> assert .ai/vcm/ is ignored by Git
309
- -> assert base repo has no uncommitted changes
310
- -> git worktree add -b feature/<taskSlug> <worktreePath> <baseRef>
322
+ -> if createWorktree is not false:
323
+ -> compute branch feature/<taskSlug>
324
+ -> compute worktreePath <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
325
+ -> assert branch does not already exist
326
+ -> assert worktreePath does not already exist
327
+ -> assert base repo has no uncommitted changes
328
+ -> git worktree add -b feature/<taskSlug> <worktreePath> <baseRef>
329
+ -> otherwise:
330
+ -> read current base repo branch
331
+ -> leave worktreePath undefined
311
332
  -> create handoff structure in taskRepoRoot
312
333
  -> write central task metadata under baseRepoRoot/.ai/vcm/tasks/<task>.json
313
334
  ```
314
335
 
315
336
  The default `baseRef` is the connected repo's current `HEAD`.
316
337
 
317
- ### 6.4 Task Cleanup Flow
338
+ ### 6.4 Task Close Flow
318
339
 
319
340
  ```text
320
341
  POST /api/tasks/:taskSlug/cleanup
321
- -> require no running role sessions
322
342
  -> load task metadata
323
- -> verify worktree path belongs under <baseRepoRoot>/.ai/vcm/worktrees/
324
- -> check worktree status
325
- -> refuse cleanup when uncommitted work exists unless force is explicitly requested
326
- -> git worktree remove <worktreePath>
327
- -> delete central task/session/message/orchestration metadata
343
+ -> when worktreePath exists, verify it belongs under <baseRepoRoot>/.ai/vcm/worktrees/
344
+ -> when worktreePath exists, git worktree remove --force <worktreePath>
345
+ -> when worktreePath exists, delete the task branch by default
346
+ -> delete base task metadata
347
+ -> delete task runtime session/message/orchestration/translation metadata
328
348
  ```
329
349
 
330
- Branch deletion is intentionally separate:
331
-
332
- - Keep `feature/<taskSlug>` by default.
333
- - Allow branch deletion only with explicit confirmation.
334
- - Prefer allowing deletion only when the branch has been merged, or when the user force-confirms.
350
+ Close Task is intentionally destructive after user confirmation. It does not preflight running role sessions or uncommitted worktree changes. Tasks created without a worktree remove VCM metadata only because there is no VCM-owned branch/worktree to delete.
335
351
 
336
352
  ## 7. Task And Artifact Model
337
353
 
@@ -474,7 +490,7 @@ Permission flags:
474
490
  Session persistence:
475
491
 
476
492
  ```text
477
- <baseRepoRoot>/.ai/vcm/sessions/<task>.json
493
+ <taskRepoRoot>/.ai/vcm/sessions/<task>.json
478
494
  ```
479
495
 
480
496
  The persisted record includes:
@@ -539,9 +555,9 @@ Files:
539
555
  State:
540
556
 
541
557
  ```text
542
- .ai/vcm/messages/<task>.jsonl
543
- .ai/vcm/orchestration/<task>.json
544
- .ai/handoffs/<task>/messages/<message-id>.md
558
+ <taskRepoRoot>/.ai/vcm/messages/<task>.jsonl
559
+ <taskRepoRoot>/.ai/vcm/orchestration/<task>.json
560
+ <taskRepoRoot>/.ai/handoffs/<task>/messages/<message-id>.md
545
561
  ```
546
562
 
547
563
  Policy:
@@ -570,11 +586,12 @@ Auto mode:
570
586
  send -> delivered
571
587
  ```
572
588
 
573
- The backend writes a `[VCM MESSAGE]` envelope to the target terminal and appends Enter.
589
+ The backend pastes a `[VCM MESSAGE]` envelope into the target terminal, then sends Enter as a separate terminal input event.
574
590
 
575
591
  The backend still exposes pause/resume orchestration API routes and stores `paused` for compatibility. The current GUI only toggles `mode` between `manual` and `auto`.
576
592
 
577
- Messages and orchestration snapshots are central project state under `baseRepoRoot/.ai/vcm`. Message body markdown lives in the task worktree handoff directory.
593
+ Messages and orchestration snapshots are task runtime state under `taskRepoRoot/.ai/vcm`. Message body markdown also lives in the task worktree handoff directory.
594
+ Messages and orchestration snapshots are task runtime state under `taskRepoRoot/.ai/vcm`. Message body markdown also lives in the task worktree handoff directory.
578
595
 
579
596
  ## 12. Role Command Compatibility
580
597
 
@@ -602,7 +619,7 @@ The dispatcher:
602
619
  2. Reads the role command artifact.
603
620
  3. Rejects missing, empty, or placeholder role commands.
604
621
  4. Resolves primary command path `role-commands/<role>.md`, with legacy fallback `<role>-command.md`.
605
- 5. Writes `Please read and execute the role command at: <path>` to the target terminal and submits Enter.
622
+ 5. Pastes `Please read and execute the role command at: <path>` to the target terminal, then sends Enter as a separate terminal input event.
606
623
 
607
624
  This is a compatibility path. The preferred V1 coordination path is `vcmctl` message bus.
608
625
 
@@ -636,7 +653,6 @@ Managed block:
636
653
  ```gitignore
637
654
  # VCM:BEGIN version=1
638
655
  .ai/vcm/
639
- .vcm/
640
656
  # VCM:END
641
657
  ```
642
658
 
@@ -659,7 +675,6 @@ Files:
659
675
  - `src/backend/services/translation-prompts.ts`
660
676
  - `src/backend/services/claude-transcript-service.ts`
661
677
  - `src/backend/adapters/translation-provider.ts`
662
- - `src/backend/ws/translation-ws.ts`
663
678
  - `src/backend/api/translation-routes.ts`
664
679
  - `src/frontend/components/translation-panel.tsx`
665
680
  - `src/frontend/components/translation-settings-modal.tsx`
@@ -678,15 +693,11 @@ Storage:
678
693
 
679
694
  Stored data:
680
695
 
696
+ - UI theme preference: `system`, `light`, or `dark`
681
697
  - translation settings
682
698
  - translation secrets
683
699
  - recent repository paths, max 5
684
700
 
685
- Legacy migration:
686
-
687
- - `~/.vibe-coding-master/settings.json`
688
- - `~/.vibe-coding-master/translation.json`
689
-
690
701
  ### Provider
691
702
 
692
703
  Provider type:
@@ -718,8 +729,11 @@ Tailer:
718
729
  - validates file exists
719
730
  - can replay history since session start minus a grace window
720
731
  - uses `fs.watch`
721
- - also polls every 500ms
732
+ - also polls every 200ms
722
733
  - parses only complete newline-delimited JSON records
734
+ - is owned by the backend translation service, not the frontend panel
735
+ - stays running after the panel closes
736
+ - stops only when the role session is stopped/restarted or the task is closed
723
737
 
724
738
  Parsed transcript events:
725
739
 
@@ -736,9 +750,21 @@ Translation service behavior:
736
750
  - ignores thinking
737
751
  - translates text/question/todo/agent as prose
738
752
  - preserves tool_use/tool_result as tool-output
739
- - queues translation per runtime session id
740
- - emits WebSocket `translation-entry`
741
- - emits WebSocket `translation-status`
753
+ - queues provider translation per runtime session id
754
+ - pushes prose entries before provider translation starts
755
+ - pushes tool_use/tool_result immediately without entering the translation queue
756
+ - writes translation events to `<taskRepoRoot>/.ai/vcm/translation/<task>/<role>/<session-id>.jsonl`
757
+ - exposes HTTP polling for frontend rendering
758
+
759
+ Polling protocol:
760
+
761
+ - `seq` starts at 1 for each translation session cache.
762
+ - the frontend calls `GET /api/translation/sessions/:sessionId/events?after=<cursor>`.
763
+ - `after` is the next expected seq, not the last displayed seq.
764
+ - `after=18` lets the backend delete cached events with `seq < 18` and return events with `seq >= 18`.
765
+ - if `after` is older than the retained cache, the backend returns whatever newer events still exist.
766
+ - no snapshot mismatch error is used.
767
+ - translated prose replacement is a later `entry` event with the same translation entry id and a newer `seq`.
742
768
 
743
769
  ### User Input Path
744
770
 
@@ -749,10 +775,10 @@ textarea -> POST translation/input -> provider -> English draft in the same text
749
775
  Send path:
750
776
 
751
777
  ```text
752
- POST translation/send -> runtime.write(session.id, englishText + "\r")
778
+ POST translation/send -> bracketed paste English text -> short delay -> runtime.write(session.id, "\r")
753
779
  ```
754
780
 
755
- The backend strips trailing newlines before appending `\r`.
781
+ The backend strips trailing newlines before pasting and sends Enter separately. This avoids Claude Code TUI cases where a single large PTY write containing both text and `\r` fills the input line but does not submit it.
756
782
 
757
783
  ## 15. API Surface
758
784
 
@@ -819,6 +845,13 @@ POST /api/tasks/:taskSlug/orchestration/pause
819
845
  POST /api/tasks/:taskSlug/orchestration/resume
820
846
  ```
821
847
 
848
+ App settings:
849
+
850
+ ```text
851
+ GET /api/settings/preferences
852
+ PUT /api/settings/preferences
853
+ ```
854
+
822
855
  Translation:
823
856
 
824
857
  ```text
@@ -826,6 +859,8 @@ GET /api/translation/settings
826
859
  PUT /api/translation/settings
827
860
  GET /api/translation/prompts
828
861
  POST /api/translation/test
862
+ POST /api/tasks/:taskSlug/sessions/:role/translation/start
863
+ GET /api/translation/sessions/:sessionId/events?after=<cursor>&limit=<n>
829
864
  POST /api/tasks/:taskSlug/sessions/:role/translation/input
830
865
  POST /api/tasks/:taskSlug/sessions/:role/translation/send
831
866
  POST /api/translation/sessions/:sessionId/clear
@@ -836,7 +871,6 @@ WebSockets:
836
871
 
837
872
  ```text
838
873
  /ws/terminal/:sessionId
839
- /ws/translation/:sessionId
840
874
  ```
841
875
 
842
876
  ## 16. Error Handling
@@ -17,7 +17,7 @@ V1 is implemented as a local GUI app with:
17
17
  - API-driven message bus.
18
18
  - Translation panel based on Claude transcript JSONL tailing.
19
19
  - npm packaging with built `dist` and `dist-frontend` output.
20
- - Task creation creates one `feature/<task>` branch and one `.ai/vcm/worktrees/<task>` git worktree.
20
+ - Task creation creates one `feature/<task>` branch and one `.ai/vcm/worktrees/<task>` git worktree by default; users may clear `Create worktree and branch` to create an inline task in the connected repository/current branch.
21
21
 
22
22
  ## 2. Package And Build
23
23
 
@@ -187,16 +187,16 @@ Defines:
187
187
  - `TaskRecord`
188
188
  - `CreateTaskRequest`
189
189
 
190
- Current UI sends only `taskSlug`, although the API type still permits optional `title` and `specPath`.
190
+ Current UI sends `taskSlug` and `createWorktree`; the API type still permits optional `title` and `specPath`.
191
191
 
192
192
  Worktree fields:
193
193
 
194
- - `worktreePath: string`
195
- - `branch: feature/<taskSlug>`
194
+ - `worktreePath?: string`
195
+ - `branch: feature/<taskSlug>` when worktree creation is selected, otherwise the connected repo's current branch
196
196
  - `cleanupStatus?: "active" | "cleaned"`
197
197
  - `cleanedAt?: string`
198
198
 
199
- `CreateTaskRequest` creates a worktree and branch by default. The UI shows a checked `Create worktree and branch` indicator, but task worktree creation is the normal VCM task path and does not require a separate later action or a user-visible off switch.
199
+ `CreateTaskRequest` supports `createWorktree?: boolean`. It creates a worktree and branch by default, and skips both when `createWorktree === false`.
200
200
 
201
201
  ### `src/shared/types/session.ts`
202
202
 
@@ -244,7 +244,10 @@ Defines:
244
244
  - `SendTranslatedInputRequest`
245
245
  - `TranslationProviderTestResult`
246
246
  - `TranslationPromptPreview`
247
- - `TranslationWsMessage`
247
+ - `TranslationSessionStatus`
248
+ - `TranslationSessionEvent`
249
+ - `StartTranslationSessionResult`
250
+ - `PollTranslationSessionResult`
248
251
 
249
252
  Prompt keys:
250
253
 
@@ -484,7 +487,7 @@ Responsibilities:
484
487
  - connect repo
485
488
  - store current project in process memory
486
489
  - record recent repo paths in app settings
487
- - create `.ai/vcm/config.json`
490
+ - create `~/.vcm/projects/<project-id>/config.json`
488
491
  - ensure base state directories
489
492
  - ensure `.ai/vcm/` is ignored by Git before task-worktree creation
490
493
  - expose base repo as the project control root
@@ -520,39 +523,41 @@ Create flow:
520
523
  ```text
521
524
  createTask(baseRepoRoot, { taskSlug })
522
525
  -> assertValidTaskSlug(taskSlug)
523
- -> branch = feature/<taskSlug>
524
- -> worktreePath = <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
525
526
  -> assert .ai/vcm/ is ignored
526
- -> assert base repo has no uncommitted changes
527
- -> assert branch does not exist
528
- -> assert worktree path does not exist
529
- -> git.createWorktree({ baseRepoRoot, branch, worktreePath, baseRef: HEAD })
530
- -> artifactService.ensureHandoffStructure({ repoRoot: worktreePath, handoffDir })
531
- -> artifactService.createArtifactTemplates({ repoRoot: worktreePath, handoffDir })
527
+ -> if createWorktree is not false:
528
+ -> branch = feature/<taskSlug>
529
+ -> worktreePath = <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
530
+ -> assert base repo has no uncommitted changes
531
+ -> assert branch does not exist
532
+ -> assert worktree path does not exist
533
+ -> git.createWorktree({ baseRepoRoot, branch, worktreePath, baseRef: HEAD })
534
+ -> taskRepoRoot = worktreePath
535
+ -> otherwise:
536
+ -> branch = current base repo branch
537
+ -> worktreePath = undefined
538
+ -> taskRepoRoot = baseRepoRoot
539
+ -> artifactService.ensureHandoffStructure({ repoRoot: taskRepoRoot, handoffDir })
540
+ -> artifactService.createArtifactTemplates({ repoRoot: taskRepoRoot, handoffDir })
541
+ -> ensure task runtime state dirs under <taskRepoRoot>/.ai/vcm/
532
542
  -> write central task record under <baseRepoRoot>/.ai/vcm/tasks/<task>.json
533
543
  ```
534
544
 
535
- Cleanup flow:
545
+ Close Task flow:
536
546
 
537
547
  ```text
538
548
  cleanupTask(baseRepoRoot, taskSlug, options)
539
- -> require all role sessions stopped
540
549
  -> load central task record
541
- -> verify worktreePath is under <baseRepoRoot>/.ai/vcm/worktrees/
542
- -> inspect git status in worktree
543
- -> refuse uncommitted changes unless options.force
544
- -> git.removeWorktree(baseRepoRoot, worktreePath)
545
- -> delete .ai/vcm/tasks/<task>.json
546
- -> delete .ai/vcm/sessions/<task>.json
547
- -> delete .ai/vcm/messages/<task>.jsonl
548
- -> delete .ai/vcm/orchestration/<task>.json
550
+ -> if worktreePath exists, verify it is under <baseRepoRoot>/.ai/vcm/worktrees/
551
+ -> if worktreePath exists, git.removeWorktree(baseRepoRoot, worktreePath, force=true)
552
+ -> if worktreePath exists, git.deleteBranch(baseRepoRoot, task.branch, force=true) by default
553
+ -> delete <baseRepoRoot>/.ai/vcm/tasks/<task>.json
554
+ -> delete <taskRepoRoot>/.ai/vcm/sessions/<task>.json
555
+ -> delete <taskRepoRoot>/.ai/vcm/messages/<task>.jsonl
556
+ -> delete <taskRepoRoot>/.ai/vcm/orchestration/<task>.json
557
+ -> delete <taskRepoRoot>/.ai/vcm/translation/<task>/
549
558
  ```
550
559
 
551
- Branch cleanup:
552
-
553
- - keep `feature/<taskSlug>` by default
554
- - optional `deleteBranch` only with explicit confirmation
555
- - prefer requiring merged branch unless force-confirmed
560
+ The UI labels this operation `Close Task`, styles it as a red destructive action, and shows a browser confirmation that names the worktree, branch, and metadata that will be deleted. VCM does not check running sessions or uncommitted changes before closing. Tasks created without a worktree remove VCM metadata only.
556
561
 
557
562
  ### `src/backend/services/artifact-service.ts`
558
563
 
@@ -621,7 +626,7 @@ Responsibilities:
621
626
  Persistence:
622
627
 
623
628
  ```text
624
- <baseRepoRoot>/.ai/vcm/sessions/<task>.json
629
+ <taskRepoRoot>/.ai/vcm/sessions/<task>.json
625
630
  ```
626
631
 
627
632
  Environment passed to Claude Code:
@@ -634,7 +639,7 @@ Environment passed to Claude Code:
634
639
  In task-worktree mode:
635
640
 
636
641
  - session cwd is `task.worktreePath`
637
- - session persistence remains central under `baseRepoRoot/.ai/vcm/sessions`
642
+ - session persistence is written under `task.worktreePath/.ai/vcm/sessions`
638
643
  - raw logs and handoff artifacts are written under the task worktree
639
644
 
640
645
  ### `src/backend/services/message-service.ts`
@@ -658,7 +663,8 @@ Responsibilities:
658
663
 
659
664
  In task-worktree mode:
660
665
 
661
- - message snapshots remain central under `baseRepoRoot/.ai/vcm/messages`
666
+ - message snapshots live under `task.worktreePath/.ai/vcm/messages`
667
+ - orchestration state lives under `task.worktreePath/.ai/vcm/orchestration`
662
668
  - message body files live under `task.worktreePath/.ai/handoffs/<task>/messages`
663
669
  - terminal delivery uses the runtime session for the role, whose cwd is the task worktree
664
670
 
@@ -700,17 +706,16 @@ Exports:
700
706
  - `AppSettingsServiceDeps`
701
707
  - `createAppSettingsService(deps)`
702
708
 
703
- Storage:
709
+ Settings responsibilities:
704
710
 
705
- ```text
706
- ~/.vcm/settings.json
707
- ```
711
+ - persist UI theme mode: `system`, `light`, or `dark`
712
+ - persist translation settings and translation secrets
713
+ - persist up to five recent repository paths
708
714
 
709
- Also migrates legacy:
715
+ Storage:
710
716
 
711
717
  ```text
712
- ~/.vibe-coding-master/settings.json
713
- ~/.vibe-coding-master/translation.json
718
+ ~/.vcm/settings.json
714
719
  ```
715
720
 
716
721
  ### `src/backend/services/translation-prompts.ts`
@@ -777,10 +782,12 @@ Responsibilities:
777
782
  - load/update translation settings
778
783
  - expose prompt previews
779
784
  - test provider
785
+ - start backend transcript listening for a role session
786
+ - poll cached translation events by cursor
780
787
  - translate user input
781
788
  - send English text to active terminal
782
- - subscribe to session translation events
783
- - clear session entries
789
+ - clear session entries and cached events
790
+ - stop session/task translation listeners
784
791
  - retry failed output translation
785
792
  - subscribe to Claude transcript service
786
793
  - translate prose output and preserve tool output
@@ -799,17 +806,17 @@ Exports:
799
806
  - `createDefaultServerDeps(options)`
800
807
  - `getDefaultStaticDir()`
801
808
 
802
- Registers all routes and WebSockets.
809
+ Registers HTTP routes and the terminal WebSocket.
803
810
 
804
811
  ### Route files
805
812
 
806
813
  - `src/backend/api/project-routes.ts`: health, recent paths, connect/current project
807
814
  - `src/backend/api/harness-routes.ts`: harness status/apply
808
- - `src/backend/api/task-routes.ts`: tasks, task status, task cleanup
815
+ - `src/backend/api/task-routes.ts`: tasks, task status, and Close Task cleanup endpoint
809
816
  - `src/backend/api/session-routes.ts`: session lifecycle and dispatch compatibility endpoint
810
817
  - `src/backend/api/artifact-routes.ts`: artifact, role command, and log reads/writes
811
818
  - `src/backend/api/message-routes.ts`: messages and orchestration
812
- - `src/backend/api/translation-routes.ts`: settings, prompt previews, provider test, input/send, clear/retry
819
+ - `src/backend/api/translation-routes.ts`: settings, prompt previews, provider test, start/poll, input/send, clear/retry
813
820
 
814
821
  Worktree task API:
815
822
 
@@ -822,11 +829,10 @@ Do not add a "switch task worktree" endpoint. Worktree assignment happens only d
822
829
  ### WebSocket files
823
830
 
824
831
  - `src/backend/ws/terminal-ws.ts`
825
- - `src/backend/ws/translation-ws.ts`
826
832
 
827
833
  Terminal WebSocket forwards PTY output/input/resize.
828
834
 
829
- Translation WebSocket subscribes to translation entries/status for a runtime session id.
835
+ Translation does not use WebSocket. The backend writes cached translation events under `<taskRepoRoot>/.ai/vcm/translation/<task>/<role>/<session-id>.jsonl`; the frontend polls `GET /api/translation/sessions/:sessionId/events?after=<cursor>`. The cursor is the next expected seq, so `after=18` means seq `1..17` can be removed and seq `18+` should be returned.
830
836
 
831
837
  ## 10. Backend Templates
832
838
 
@@ -938,9 +944,9 @@ Responsibilities:
938
944
  - messages modal
939
945
  - events modal
940
946
  - harness panel
941
- - task creation with one task-name field, checked non-optional worktree/branch indicator, branch preview, and worktree path preview
947
+ - task creation with one task-name field, `Create worktree and branch` checkbox selected by default, branch preview, and worktree path preview
942
948
  - task navigation
943
- - completed-task cleanup action
949
+ - red `Close Task` action with destructive confirmation
944
950
 
945
951
  ### `src/frontend/routes/task-workspace.tsx`
946
952
 
@@ -1075,6 +1081,7 @@ Important current behavior:
1075
1081
  - no `Original` buttons
1076
1082
  - tool output is preserved, dim, one-line
1077
1083
  - prose source is replaced by translated text after completion
1084
+ - prose renders Markdown with GFM support
1078
1085
  - no separate translated-English textarea
1079
1086
 
1080
1087
  ### `src/frontend/components/translation-settings-modal.tsx`
@@ -1086,18 +1093,15 @@ Exports:
1086
1093
 
1087
1094
  Settings:
1088
1095
 
1089
- - enable translation
1090
1096
  - base URL
1091
1097
  - API key as text input
1092
1098
  - model
1093
1099
  - target language
1094
- - input mode
1095
1100
  - context
1096
- - translate output
1097
- - translate user input
1098
1101
  - timeout
1099
1102
  - temperature
1100
- - prompt slot overrides
1103
+ - direct editors for `zh-to-en`, `zh-to-en-with-context`, and `en-to-zh`
1104
+ - reset prompts to built-in defaults
1101
1105
  - provider test
1102
1106
 
1103
1107
  ### `src/frontend/components/status-badge.tsx`
@@ -1121,7 +1125,8 @@ Sidebar:
1121
1125
 
1122
1126
  - all groups default collapsed
1123
1127
  - `Repository Path` default open only when no task is selected
1124
- - `Settings` includes `Messages`, `Events`, and `Auto orchestration`
1128
+ - `Settings` includes `Theme`, `Messages`, `Events`, and `Auto orchestration`
1129
+ - `Theme` cycles through `System`, `Light`, and `Dark`; `System` follows the browser/OS color-scheme preference
1125
1130
 
1126
1131
  Task workspace:
1127
1132
 
@@ -1146,35 +1151,44 @@ App settings:
1146
1151
  ~/.vcm/settings.json
1147
1152
  ```
1148
1153
 
1154
+ Contains UI theme preference, translation settings/secrets, and recent repository paths.
1155
+
1149
1156
  Project config:
1150
1157
 
1151
1158
  ```text
1152
- .ai/vcm/config.json
1159
+ ~/.vcm/projects/<project-id>/config.json
1160
+ ~/.vcm/projects/index.json
1153
1161
  ```
1154
1162
 
1155
1163
  Task state:
1156
1164
 
1157
1165
  ```text
1158
- .ai/vcm/tasks/<task>.json
1166
+ <baseRepoRoot>/.ai/vcm/tasks/<task>.json
1159
1167
  ```
1160
1168
 
1161
1169
  Session state:
1162
1170
 
1163
1171
  ```text
1164
- .ai/vcm/sessions/<task>.json
1172
+ <taskRepoRoot>/.ai/vcm/sessions/<task>.json
1165
1173
  ```
1166
1174
 
1167
1175
  Messages:
1168
1176
 
1169
1177
  ```text
1170
- .ai/vcm/messages/<task>.jsonl
1171
- .ai/handoffs/<task>/messages/<message-id>.md
1178
+ <taskRepoRoot>/.ai/vcm/messages/<task>.jsonl
1179
+ <taskRepoRoot>/.ai/handoffs/<task>/messages/<message-id>.md
1172
1180
  ```
1173
1181
 
1174
1182
  Orchestration:
1175
1183
 
1176
1184
  ```text
1177
- .ai/vcm/orchestration/<task>.json
1185
+ <taskRepoRoot>/.ai/vcm/orchestration/<task>.json
1186
+ ```
1187
+
1188
+ Translation cache:
1189
+
1190
+ ```text
1191
+ <taskRepoRoot>/.ai/vcm/translation/<task>/
1178
1192
  ```
1179
1193
 
1180
1194
  Task worktrees:
@@ -1223,7 +1237,7 @@ For frontend layout changes, also verify manually:
1223
1237
  - Auto orchestration toggles on/off
1224
1238
  - `Enter` in translation composer translates/sends
1225
1239
  - `Shift+Enter` inserts newline
1226
- - mark task complete and verify cleanup removes the worktree and central task metadata
1240
+ - close a worktree-backed task and verify it removes the worktree, deletes the task branch, and removes central task metadata
1227
1241
 
1228
1242
  ## 17. V1 Boundaries To Preserve
1229
1243