vibe-coding-master 0.0.17 → 0.2.1

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 (42) hide show
  1. package/README.md +60 -28
  2. package/dist/backend/api/artifact-routes.js +5 -5
  3. package/dist/backend/api/harness-routes.js +8 -0
  4. package/dist/backend/server.js +8 -2
  5. package/dist/backend/services/artifact-service.js +12 -12
  6. package/dist/backend/services/harness-service.js +586 -5
  7. package/dist/backend/services/project-service.js +4 -1
  8. package/dist/backend/services/session-service.js +1 -3
  9. package/dist/backend/services/task-service.js +16 -17
  10. package/dist/backend/templates/handoff.js +64 -26
  11. package/dist/backend/templates/harness/architect-agent.js +42 -12
  12. package/dist/backend/templates/harness/claude-root.js +42 -18
  13. package/dist/backend/templates/harness/coder-agent.js +15 -11
  14. package/dist/backend/templates/harness/known-issues-doc.js +22 -0
  15. package/dist/backend/templates/harness/project-manager-agent.js +66 -16
  16. package/dist/backend/templates/harness/pull-request-template.js +29 -0
  17. package/dist/backend/templates/harness/reviewer-agent.js +40 -12
  18. package/dist/backend/templates/harness/vcm-final-acceptance-skill.js +105 -0
  19. package/dist/backend/templates/harness/vcm-harness-bootstrap-skill.js +78 -0
  20. package/dist/backend/templates/harness/vcm-long-running-validation-skill.js +50 -0
  21. package/dist/backend/templates/harness/vcm-route-message-skill.js +86 -0
  22. package/dist/backend/templates/message-envelope.js +1 -0
  23. package/dist/backend/templates/role-command.js +7 -1
  24. package/dist/shared/validation/artifact-check.js +14 -9
  25. package/dist-frontend/assets/index-BmpJxnNx.css +32 -0
  26. package/dist-frontend/assets/index-CGUkhVAP.js +90 -0
  27. package/dist-frontend/index.html +2 -2
  28. package/docs/cc-best-practices.md +433 -192
  29. package/docs/full-harness-baseline.md +258 -0
  30. package/docs/product-design.md +9 -9
  31. package/docs/v0.2-implementation-plan.md +379 -0
  32. package/docs/vcm-cc-best-practices.md +449 -0
  33. package/package.json +3 -1
  34. package/scripts/harness-tools/generate-module-index +298 -0
  35. package/scripts/harness-tools/generate-public-surface +692 -0
  36. package/scripts/install-vcm-harness.mjs +1690 -0
  37. package/scripts/uninstall-vcm-harness.mjs +490 -0
  38. package/scripts/verify-package.mjs +4 -0
  39. package/dist-frontend/assets/index-D40qaonx.css +0 -32
  40. package/dist-frontend/assets/index-DK2F4LFT.js +0 -90
  41. package/docs/v1-architecture-design.md +0 -1014
  42. package/docs/v1-implementation-plan.md +0 -1379
@@ -0,0 +1,449 @@
1
+ # VCM Claude Code Best Practices
2
+
3
+ Last updated: 2026-06-08
4
+
5
+ This is the current VCM-specific Claude Code / AI coding best-practices guide.
6
+ It is based on the latest `example/rust-layered` harness baseline.
7
+
8
+ Do not install this document into target repositories. Target repositories should
9
+ receive a concise root `CLAUDE.md` VCM block, four role agents, repo-local VCM
10
+ skills, harness tools, and project-owned durable docs.
11
+
12
+ `docs/cc-best-practices.md` is archived as the old generic baseline. Current VCM
13
+ implementation should use this document and `docs/full-harness-baseline.md`.
14
+
15
+ ## 1. Core Principle
16
+
17
+ VCM separates three concerns:
18
+
19
+ - Harness-managed files: VCM owns, upgrades, repairs, audits, and can uninstall
20
+ these through `.ai/vcm-harness-manifest.json`.
21
+ - Project-owned durable docs: VCM bootstrap may create or initialize these, but
22
+ they become project truth and are not VCM-owned harness.
23
+ - Runtime state: VCM writes these during task execution and cleans them up after
24
+ durable facts are promoted.
25
+
26
+ Temporary documents should be deleted. Durable documents should be updated.
27
+ Completed routine plans, task-local handoffs, logs, and job state should not pile
28
+ up as permanent repository history.
29
+
30
+ ## 2. Current Repo Harness Baseline
31
+
32
+ The current baseline is represented by `example/rust-layered`.
33
+
34
+ Fixed installer files:
35
+
36
+ ```text
37
+ CLAUDE.md
38
+ .gitignore
39
+ .claude/settings.json
40
+ .claude/agents/project-manager.md
41
+ .claude/agents/architect.md
42
+ .claude/agents/coder.md
43
+ .claude/agents/reviewer.md
44
+ .claude/skills/vcm-route-message/SKILL.md
45
+ .claude/skills/vcm-final-acceptance/SKILL.md
46
+ .claude/skills/vcm-long-running-validation/SKILL.md
47
+ .claude/skills/vcm-harness-bootstrap/SKILL.md
48
+ .ai/vcm-harness-manifest.json
49
+ .ai/tools/generate-module-index
50
+ .ai/tools/generate-public-surface
51
+ .ai/tools/run-long-check
52
+ .ai/tools/watch-job
53
+ .github/pull_request_template.md
54
+ ```
55
+
56
+ Derived bootstrap artifacts:
57
+
58
+ ```text
59
+ .ai/generated/module-index.json
60
+ .ai/generated/public-surface.json
61
+ ```
62
+
63
+ The generated artifacts are tracked in the manifest as derived artifacts so VCM
64
+ can clean or refresh them, but they are produced by generator tools during
65
+ bootstrap or later maintenance work. They are not hand-authored fixed templates.
66
+
67
+ Runtime roots:
68
+
69
+ ```text
70
+ .ai/vcm/
71
+ .claude/worktrees/
72
+ ```
73
+
74
+ Not part of the current baseline:
75
+
76
+ ```text
77
+ .claude/commands/
78
+ .claude/agents/optional/
79
+ .ai/task-specs/
80
+ .ai/vcm/tasks/
81
+ .ai/vcm/handoffs/role-commands/
82
+ docs/plans/active/
83
+ docs/plans/completed/
84
+ docs/MODULE_MAP.md
85
+ docs/SECURITY.md
86
+ docs/DEPENDENCY_RULES.md
87
+ docs/AI_WORKFLOW.md
88
+ .ai/generated/test-map.json
89
+ .ai/tools/check-fast
90
+ .ai/tools/check-changed
91
+ .ai/tools/check-module
92
+ .ai/tools/check-boundaries
93
+ .ai/tools/check-agent-rules
94
+ .ai/tools/check-docs-freshness
95
+ .ai/tools/find-owner
96
+ .ai/tools/find-callers
97
+ .ai/tools/find-tests
98
+ ```
99
+
100
+ Do not reintroduce these unless there is a current VCM requirement.
101
+
102
+ ## 3. Harness Manifest
103
+
104
+ `.ai/vcm-harness-manifest.json` is a VCM harness ownership and lifecycle record.
105
+ It is not a project-document index.
106
+
107
+ It should record:
108
+
109
+ - VCM-managed files and directories
110
+ - managed-block marker type and boundaries
111
+ - JSON merge ownership, especially `.claude/settings.json` hooks
112
+ - VCM agent and skill files
113
+ - harness tools under `.ai/tools/`
114
+ - generated context artifacts under `.ai/generated/`
115
+ - PR template managed blocks
116
+ - lifecycle labels
117
+ - runtime roots
118
+ - uninstall actions
119
+
120
+ It should not record:
121
+
122
+ - project-owned durable docs such as `docs/ARCHITECTURE.md`,
123
+ `docs/TESTING.md`, `docs/known-issues.md`, `docs/plans/`, or module-level
124
+ `ARCHITECTURE.md`
125
+ - `.ai/vcm/**` runtime files
126
+ - `.claude/worktrees/**` task worktrees
127
+ - placeholder `.gitkeep` files
128
+
129
+ VCM uninstall should remove only VCM-owned managed blocks or unchanged VCM-owned
130
+ whole files. User-authored project docs must not be deleted by harness uninstall.
131
+
132
+ ## 4. Project-Owned Durable Docs
133
+
134
+ The current Rust layered example uses:
135
+
136
+ ```text
137
+ docs/ARCHITECTURE.md
138
+ <module>/ARCHITECTURE.md
139
+ docs/TESTING.md
140
+ docs/known-issues.md
141
+ docs/plans/
142
+ ```
143
+
144
+ Ownership:
145
+
146
+ - Architect owns `docs/ARCHITECTURE.md`, module-level `ARCHITECTURE.md`, and
147
+ promotion of unresolved durable issues to `docs/known-issues.md`.
148
+ - Reviewer owns `docs/TESTING.md`, validation strategy, test adequacy, and final
149
+ validation confidence.
150
+ - `docs/plans/` is for durable plans only when a large task needs one.
151
+ Completed routine plans should be deleted after durable facts are promoted.
152
+
153
+ Project-owned durable docs are not VCM harness entries. VCM bootstrap may draft
154
+ or initialize them, but after creation they belong to the project.
155
+
156
+ ## 5. Runtime State
157
+
158
+ Task runtime state lives under `.ai/vcm/` in the task worktree or connected repo.
159
+ It is task-local and temporary.
160
+
161
+ Current runtime files and directories:
162
+
163
+ ```text
164
+ .ai/vcm/handoffs/
165
+ .ai/vcm/handoffs/messages/
166
+ .ai/vcm/handoffs/logs/
167
+ .ai/vcm/handoffs/architecture-plan.md
168
+ .ai/vcm/handoffs/review-report.md
169
+ .ai/vcm/handoffs/docs-sync-report.md
170
+ .ai/vcm/handoffs/final-acceptance.md
171
+ .ai/vcm/handoffs/known-issues.md
172
+ .ai/vcm/jobs/<job-id>/
173
+ .ai/vcm/bootstrap/session.json
174
+ .ai/vcm/bootstrap/bootstrap.log
175
+ ```
176
+
177
+ App-local VCM task records live outside the connected repository:
178
+
179
+ ```text
180
+ ~/.vcm/projects/<project-id>/tasks/<task-slug>.json
181
+ ```
182
+
183
+ Runtime state is deleted during task cleanup after useful facts are promoted to
184
+ code, tests, durable docs, PR text, or commit history.
185
+
186
+ ## 6. Role Model
187
+
188
+ VCM uses four core roles:
189
+
190
+ - `project-manager`: user-facing flow manager. It routes work, tracks gates,
191
+ asks the user for product or approval decisions, and performs final evidence
192
+ acceptance. It does not perform technical analysis.
193
+ - `architect`: technical planner and docs-sync owner. It defines module/file
194
+ responsibilities, public contracts, phase boundaries, risks, and durable docs
195
+ updates.
196
+ - `coder`: implementation owner. It changes production code and baseline unit
197
+ tests within the approved plan. It does not change architecture or durable
198
+ docs.
199
+ - `reviewer`: independent validation owner. It reads code as needed, writes or
200
+ updates tests, owns `docs/TESTING.md`, and decides validation sufficiency.
201
+ Production fixes go back to coder; design conflicts go back to architect.
202
+
203
+ Roles work sequentially in one task worktree. If `git status` shows uncommitted
204
+ changes, commit them before handing off to another role.
205
+
206
+ ## 7. Task Flow
207
+
208
+ Default code-change route:
209
+
210
+ ```text
211
+ project-manager
212
+ -> architect
213
+ -> coder
214
+ -> reviewer
215
+ -> architect docs sync
216
+ -> project-manager final acceptance
217
+ ```
218
+
219
+ Shorter routes:
220
+
221
+ - Docs-only work: `project-manager -> architect -> project-manager final acceptance`
222
+ - Test-only or validation-only work:
223
+ `project-manager -> reviewer -> project-manager final acceptance`
224
+
225
+ If a docs/test/validation-only task reveals required code, architecture, public
226
+ contract, dependency, durable-doc, or validation-strategy changes, route back
227
+ through the full code-change flow.
228
+
229
+ Complex tasks may be split by architect into phases. PM dispatches one
230
+ architect-defined phase at a time and must not split, merge, reorder, or redefine
231
+ phases. A role may return partial completed work and ask PM for continuation, but
232
+ workload or context size is not a valid reason to change the architect plan.
233
+
234
+ ## 8. Route Messages
235
+
236
+ Use the `vcm-route-message` skill whenever a VCM role hands off work, asks a
237
+ question, reports a result, reports a blocker, or raises a finding.
238
+
239
+ Current route file path:
240
+
241
+ ```text
242
+ .ai/vcm/handoffs/messages/<from-role>-<to-role>.md
243
+ ```
244
+
245
+ The skill is a route-file writing protocol. It should not encode the full role
246
+ policy; role permissions belong in root and role `CLAUDE.md` files.
247
+
248
+ The route file name is authoritative for source and target. Do not duplicate
249
+ `from` or `to` in frontmatter.
250
+
251
+ After writing or updating a route file, end the current Claude Code turn. Do not
252
+ poll route files, loop, wait for another role, paste directly into another role
253
+ terminal, or use Claude Code Task/Subagent to replace VCM role routing.
254
+
255
+ ## 9. Validation
256
+
257
+ Validation is role-owned, not wrapper-owned.
258
+
259
+ VCM defines validation levels in root `CLAUDE.md`:
260
+
261
+ - L0: fast format/lint/typecheck/boundary/dependency/project checks
262
+ - L1: coder unit checks for changed behavior and direct regressions
263
+ - L2: module or integration checks
264
+ - L3: smoke E2E checks
265
+ - L4: release/full regression checks
266
+
267
+ The current Rust example does not use fixed `check-fast`, `check-changed`, or
268
+ `check-module` wrappers. Coder and reviewer use native Rust commands such as
269
+ `cargo test`, `cargo test -p <crate>`, `cargo check`, or project-specific
270
+ commands documented in `docs/TESTING.md`.
271
+
272
+ Long-running commands use `vcm-long-running-validation`, backed by:
273
+
274
+ ```text
275
+ .ai/tools/run-long-check
276
+ .ai/tools/watch-job
277
+ ```
278
+
279
+ This skill is role-independent. It only handles long-running command execution,
280
+ bounded waiting, file-backed status, timeout, and log summaries. The caller
281
+ decides where to record command evidence.
282
+
283
+ ## 10. Generated Context
284
+
285
+ The current example has two generated artifacts:
286
+
287
+ ```text
288
+ .ai/generated/module-index.json
289
+ .ai/generated/public-surface.json
290
+ ```
291
+
292
+ `module-index.json` helps agents find layers, modules, manifests, module docs,
293
+ source files, test files, and workspace dependencies.
294
+
295
+ `public-surface.json` indexes crate-external Rust public APIs. It is a machine
296
+ index, not an architecture document.
297
+
298
+ Current generated-context support is Rust-only. The fixed installer provides
299
+ Rust generator tools as the default baseline, but it does not generate trusted
300
+ context by itself. Non-Rust projects must use project-specific generators before
301
+ `.ai/generated/*` is considered reliable.
302
+
303
+ There is no `test-map.json`. Rust unit tests live with source where appropriate;
304
+ integration tests use Cargo's normal test layout. Test files are discoverable
305
+ through `module-index.json`.
306
+
307
+ Generated artifacts are derived context. They must be regenerated by tools after
308
+ relevant source, manifest, module, or public API changes. They should not be
309
+ hand-edited as durable truth.
310
+
311
+ ## 11. Harness Bootstrap
312
+
313
+ `vcm-harness-bootstrap` is the AI-assisted project understanding and refresh
314
+ procedure. It is not the deterministic installer.
315
+
316
+ It may read the repository and create or refresh project-specific content such
317
+ as:
318
+
319
+ - `CLAUDE.md` project context outside the VCM managed block
320
+ - `docs/ARCHITECTURE.md`
321
+ - module-level `ARCHITECTURE.md`
322
+ - `docs/TESTING.md`
323
+ - `docs/known-issues.md`
324
+ - `.ai/generated/module-index.json`
325
+ - `.ai/generated/public-surface.json`
326
+
327
+ It must not edit product source, product tests, package manifests, lockfiles,
328
+ deployment config, or secrets. It must not create new validation wrapper tools
329
+ during bootstrap.
330
+
331
+ Important claims should be marked as verified, inferred, unknown, or needing
332
+ human confirmation.
333
+
334
+ VCM should launch bootstrap as a visible temporary Claude Code terminal, not as
335
+ an invisible background task:
336
+
337
+ - run the deterministic fixed installer first
338
+ - start Claude Code in the connected repository root without a role agent
339
+ - set `VCM_TASK_REPO_ROOT`, `VCM_HARNESS_BOOTSTRAP=1`, `VCM_SESSION_ID`, and
340
+ `VCM_API_URL`
341
+ - send a prompt that explicitly requires using `vcm-harness-bootstrap`
342
+ - log terminal output under `.ai/vcm/bootstrap/bootstrap.log`
343
+ - persist session metadata under `.ai/vcm/bootstrap/session.json`
344
+ - mark bootstrap complete only when project context, generated context,
345
+ project architecture docs, module architecture docs, and testing docs are
346
+ present and non-empty
347
+
348
+ The UI should expose both stages: fixed install status and bootstrap completion
349
+ status. A failed or disconnected bootstrap terminal should be restartable
350
+ without treating project-owned durable docs as VCM-owned manifest entries.
351
+
352
+ ## 12. Final Acceptance
353
+
354
+ `vcm-final-acceptance` is PM's final evidence audit. PM must not use it for
355
+ technical design review, implementation review, source-code analysis, or test
356
+ adequacy analysis.
357
+
358
+ It checks whether required evidence exists and has clear decisions:
359
+
360
+ - architect plan or docs-sync decision when needed
361
+ - reviewer decision and validation evidence when needed
362
+ - known-issues disposition
363
+ - explicit user approval for high-risk exceptions
364
+ - file-scope explanation at changed-file-list level
365
+
366
+ Do not accept when required role evidence is missing, reviewer findings are
367
+ unresolved, docs sync is missing for durable changes, known-issues disposition is
368
+ missing, or unexplained high-risk files remain.
369
+
370
+ ## 13. Documentation Lifecycle
371
+
372
+ Temporary files should be deleted after the task:
373
+
374
+ - route messages
375
+ - handoff artifacts
376
+ - job logs and status files
377
+ - raw terminal logs
378
+ - app-local task records
379
+ - routine completed plans
380
+
381
+ Durable facts should be moved into:
382
+
383
+ - code
384
+ - tests
385
+ - `docs/ARCHITECTURE.md`
386
+ - module-level `ARCHITECTURE.md`
387
+ - `docs/TESTING.md`
388
+ - `docs/known-issues.md`
389
+ - PR text
390
+ - commit history
391
+
392
+ Do not keep completed task notes as a permanent docs archive unless they remain
393
+ valuable durable planning knowledge.
394
+
395
+ ## 14. Embedded Terminal
396
+
397
+ The embedded terminal should run through backend-managed PTY/session services,
398
+ not as front-end-only command execution. Frontend code displays and controls
399
+ session streams; process ownership, logs, task routing, and terminal safety belong
400
+ to backend services.
401
+
402
+ High-risk terminal work includes process lifecycle, cross-device control,
403
+ gateway-submitted prompts, and command authorization.
404
+
405
+ ## 15. Mobile Gateway
406
+
407
+ VCM 0.2 gateway should expose a conservative mobile command surface through
408
+ Tencent iLink Bot API / Weixin DM.
409
+
410
+ Gateway settings and secrets live in app-local state:
411
+
412
+ ```text
413
+ ~/.vcm/settings.json
414
+ ```
415
+
416
+ Gateway audit logs live outside connected repositories:
417
+
418
+ ```text
419
+ ~/.vcm/gateway/audit.jsonl
420
+ ```
421
+
422
+ Rules:
423
+
424
+ - do not expose the full embedded terminal over Weixin
425
+ - do not store gateway credentials in connected repositories
426
+ - authenticate and authorize allowed Weixin users
427
+ - confirmation-gate state-changing or destructive commands
428
+ - audit state-changing commands
429
+ - treat gateway authorization and command parsing as high-risk code
430
+
431
+ ## 16. Minimum VCM Rules
432
+
433
+ 1. Manifest records harness ownership only.
434
+ 2. Project durable docs are project-owned.
435
+ 3. Runtime state under `.ai/vcm/**` is temporary.
436
+ 4. No `.claude/commands/` by default.
437
+ 5. No optional agents by default.
438
+ 6. No role-command files.
439
+ 7. No `.ai/vcm/tasks/` in connected repos.
440
+ 8. No `docs/plans/active` or `docs/plans/completed`.
441
+ 9. No `test-map.json` by default.
442
+ 10. No fixed `check-*` wrappers by default.
443
+ 11. Use native project commands for validation.
444
+ 12. Use generated context only when it has a real generator.
445
+ 13. Coder owns implementation and baseline unit checks.
446
+ 14. Reviewer owns independent validation and `docs/TESTING.md`.
447
+ 15. Architect owns architecture planning and durable architecture docs.
448
+ 16. PM owns routing and final evidence acceptance, not technical analysis.
449
+ 17. Temporary documents are deleted; durable documents are updated.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-coding-master",
3
- "version": "0.0.17",
3
+ "version": "0.2.1",
4
4
  "description": "Local GUI session cockpit for Claude Code role sessions.",
5
5
  "type": "module",
6
6
  "files": [
@@ -24,6 +24,8 @@
24
24
  "fix:node-pty": "node scripts/fix-node-pty-spawn-helper.mjs",
25
25
  "postinstall": "node scripts/fix-node-pty-spawn-helper.mjs",
26
26
  "verify:package": "node scripts/verify-package.mjs",
27
+ "harness:install": "node scripts/install-vcm-harness.mjs",
28
+ "harness:uninstall": "node scripts/uninstall-vcm-harness.mjs",
27
29
  "prepack": "npm run build && npm run verify:package",
28
30
  "dev": "tsx src/main.ts --dev",
29
31
  "build": "npm run clean && tsc -p tsconfig.node.json && vite build",