cc-devflow 4.5.3 → 4.5.5

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 (104) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +12 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +28 -5
  3. package/.claude/skills/cc-act/SKILL.md +45 -12
  4. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +39 -0
  5. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +16 -0
  6. package/.claude/skills/cc-act/references/closure-contract.md +3 -0
  7. package/.claude/skills/cc-act/scripts/cc-act-common.sh +48 -0
  8. package/.claude/skills/cc-act/scripts/generate-status-report.sh +3 -0
  9. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +6 -0
  10. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +13 -0
  11. package/.claude/skills/cc-check/CHANGELOG.md +6 -0
  12. package/.claude/skills/cc-check/PLAYBOOK.md +4 -0
  13. package/.claude/skills/cc-check/SKILL.md +15 -2
  14. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +18 -0
  15. package/.claude/skills/cc-do/CHANGELOG.md +12 -0
  16. package/.claude/skills/cc-do/PLAYBOOK.md +13 -10
  17. package/.claude/skills/cc-do/SKILL.md +40 -16
  18. package/.claude/skills/cc-do/references/execution-recovery.md +12 -0
  19. package/.claude/skills/cc-do/references/parallel-dispatch.md +6 -4
  20. package/.claude/skills/cc-do/scripts/detect-file-conflicts.sh +49 -3
  21. package/.claude/skills/cc-investigate/CHANGELOG.md +12 -0
  22. package/.claude/skills/cc-investigate/PLAYBOOK.md +12 -1
  23. package/.claude/skills/cc-investigate/SKILL.md +31 -5
  24. package/.claude/skills/cc-investigate/assets/ANALYSIS_TEMPLATE.md +44 -0
  25. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +1 -0
  26. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +9 -1
  27. package/.claude/skills/cc-investigate/references/investigation-contract.md +2 -0
  28. package/.claude/skills/cc-plan/CHANGELOG.md +29 -0
  29. package/.claude/skills/cc-plan/PLAYBOOK.md +43 -17
  30. package/.claude/skills/cc-plan/SKILL.md +85 -44
  31. package/.claude/skills/cc-plan/assets/DESIGN_TEMPLATE.md +109 -3
  32. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +32 -5
  33. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +85 -4
  34. package/.claude/skills/cc-plan/assets/TINY_DESIGN_TEMPLATE.md +78 -0
  35. package/.claude/skills/cc-plan/references/planning-contract.md +29 -7
  36. package/.claude/skills/cc-roadmap/CHANGELOG.md +12 -0
  37. package/.claude/skills/cc-roadmap/PLAYBOOK.md +15 -9
  38. package/.claude/skills/cc-roadmap/SKILL.md +22 -16
  39. package/.claude/skills/cc-roadmap/assets/BACKLOG_TEMPLATE.md +3 -1
  40. package/.claude/skills/cc-roadmap/assets/ROADMAP_TEMPLATE.md +11 -1
  41. package/.claude/skills/cc-roadmap/assets/TRACKING_TEMPLATE.json +57 -10
  42. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/markdown.js +68 -3
  43. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/schema.js +120 -0
  44. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/store.js +25 -1
  45. package/.claude/skills/cc-roadmap/scripts/locate-roadmap-item.sh +13 -5
  46. package/.claude/skills/cc-roadmap/scripts/roadmap-tracking.js +3 -3
  47. package/.claude/skills/cc-roadmap/scripts/sync-roadmap-progress.sh +3 -3
  48. package/CHANGELOG.md +15 -0
  49. package/README.md +5 -5
  50. package/README.zh-CN.md +5 -5
  51. package/bin/cc-devflow-cli.js +93 -2
  52. package/docs/CLAUDE.md +1 -1
  53. package/docs/examples/START-HERE.md +3 -3
  54. package/docs/examples/example-bindings.json +27 -10
  55. package/docs/examples/full-design-blocked/BACKLOG.md +4 -2
  56. package/docs/examples/full-design-blocked/README.md +4 -4
  57. package/docs/examples/full-design-blocked/ROADMAP.md +16 -2
  58. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +39 -1
  59. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +41 -0
  60. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +8 -1
  61. package/docs/examples/full-design-blocked/roadmap.json +123 -0
  62. package/docs/examples/local-handoff/BACKLOG.md +4 -2
  63. package/docs/examples/local-handoff/README.md +4 -4
  64. package/docs/examples/local-handoff/ROADMAP.md +16 -2
  65. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +19 -1
  66. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +26 -0
  67. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +8 -1
  68. package/docs/examples/local-handoff/roadmap.json +121 -0
  69. package/docs/examples/pdca-loop/BACKLOG.md +4 -2
  70. package/docs/examples/pdca-loop/README.md +4 -4
  71. package/docs/examples/pdca-loop/ROADMAP.md +16 -2
  72. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +19 -1
  73. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +22 -3
  74. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +8 -1
  75. package/docs/examples/pdca-loop/roadmap.json +191 -0
  76. package/docs/examples/scripts/check-example-bindings.sh +7 -4
  77. package/docs/get-shit-done-strategy-audit.md +518 -0
  78. package/docs/guides/getting-started.md +2 -2
  79. package/docs/guides/getting-started.zh-CN.md +2 -2
  80. package/lib/compiler/__tests__/inventory.test.js +51 -0
  81. package/lib/compiler/__tests__/skills-registry.test.js +17 -3
  82. package/lib/compiler/inventory.js +78 -0
  83. package/lib/skill-runtime/__tests__/approve.test.js +92 -0
  84. package/lib/skill-runtime/__tests__/autopilot.test.js +4 -0
  85. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +9 -1
  86. package/lib/skill-runtime/__tests__/planner.tdd.test.js +20 -0
  87. package/lib/skill-runtime/__tests__/query.test.js +147 -1
  88. package/lib/skill-runtime/__tests__/readiness.test.js +53 -0
  89. package/lib/skill-runtime/__tests__/release.test.js +85 -0
  90. package/lib/skill-runtime/__tests__/runtime.integration.test.js +11 -0
  91. package/lib/skill-runtime/__tests__/schemas.test.js +56 -0
  92. package/lib/skill-runtime/__tests__/worker-run.test.js +29 -0
  93. package/lib/skill-runtime/errors.js +39 -0
  94. package/lib/skill-runtime/index.js +8 -0
  95. package/lib/skill-runtime/operations/approve.js +17 -2
  96. package/lib/skill-runtime/operations/release.js +6 -3
  97. package/lib/skill-runtime/operations/worker-run.js +30 -0
  98. package/lib/skill-runtime/planner.js +10 -2
  99. package/lib/skill-runtime/query-registry.js +101 -0
  100. package/lib/skill-runtime/query.js +159 -91
  101. package/lib/skill-runtime/readiness.js +84 -0
  102. package/lib/skill-runtime/schemas.js +28 -3
  103. package/lib/skill-runtime/trace.js +22 -0
  104. package/package.json +1 -1
@@ -0,0 +1,518 @@
1
+ # Get Shit Done Strategy Migration Blueprint
2
+
3
+ 本蓝图覆盖 `/Users/dimon/001Area/80-CodeWorld/002-devflow/get-shit-done`
4
+ 当前源码里的公开功能面。目标不是复制 GSD 的命令、agent、hook 和
5
+ workflow 表面积,而是把其中能增强 cc-devflow 的机制迁移为原生
6
+ `cc-*` SKILL contract、runtime typed reads、compiler/publish gate 和测试证据。
7
+
8
+ 核心原则:**GSD 是输入,cc-devflow contract 才是输出。**
9
+
10
+ ## Source Facts
11
+
12
+ - Package: `get-shit-done-cc@1.39.0-rc.4`
13
+ - Public command surface: `commands/gsd/*.md` 共 86 个命令
14
+ - Agent surface: `agents/gsd-*.md` 共 33 个专用 agent
15
+ - Workflow surface: `get-shit-done/workflows/*.md` 共 84 个顶层 workflow,另有
16
+ `discuss-phase/` 和 `execute-phase/steps/` 的拆分子文件
17
+ - Runtime helpers: `get-shit-done/bin/lib/*.cjs` 共 31 个 CLI module,SDK 查询层
18
+ 位于 `sdk/src/query/`
19
+ - Safety hooks: `hooks/` 共 11 个
20
+
21
+ cc-devflow 当前公开表面保持不变:
22
+
23
+ ```text
24
+ cc-roadmap
25
+
26
+ PDCA: cc-plan -> cc-do -> cc-check -> cc-act
27
+ IDCA: cc-investigate -> cc-do -> cc-check -> cc-act
28
+ ```
29
+
30
+ 维护型能力继续归入 `cc-spec-init`、`cc-simplify`、`docs-sync`、
31
+ `npm-release` 和 internal runtime/compiler。禁止新增一套平行命令森林。
32
+
33
+ ## Target Architecture
34
+
35
+ ```text
36
+ GSD source evidence
37
+ |
38
+ v
39
+ Strategy extraction
40
+ |
41
+ v
42
+ cc-devflow native contract map
43
+ |
44
+ +--> cc-plan ambiguity gate / trust boundary / bounded review
45
+ +--> cc-do wave scheduling / touched paths / quick lane
46
+ +--> cc-investigate debug session / forensics / diagnose-only
47
+ +--> cc-check UAT / named errors / review facets
48
+ +--> cc-act ship preflight / rollback / learning extraction
49
+ +--> runtime/compiler typed reads / inventory / drift gates
50
+ ```
51
+
52
+ Runtime 边界必须保持克制:
53
+
54
+ ```text
55
+ Public SKILL contract
56
+ cc-plan / cc-do / cc-investigate / cc-check / cc-act
57
+ |
58
+ | declares required artifact fields / gates / reroutes
59
+ v
60
+ Skill-local scripts
61
+ |
62
+ | call shared helpers only for schema/query/io
63
+ v
64
+ lib/skill-runtime
65
+ query-registry.js read-only derived views
66
+ errors.js named runtime errors
67
+ trace.js event refs + next action shape
68
+ |
69
+ v
70
+ durable artifacts
71
+ task-manifest.json / report-card.json / change-state.json / analysis.md
72
+ ```
73
+
74
+ SKILL/PLAYBOOK 拥有 workflow 语义。`lib/skill-runtime` 只拥有 typed reads、
75
+ schema validation、named errors、trace shape 和 IO helper。不要把 runtime 做成
76
+ 隐藏 workflow engine。
77
+
78
+ ## Core Diagnosis
79
+
80
+ GSD 的优势在三个地方:
81
+
82
+ 1. 上下文工程:命令只是薄入口,重活交给 workflow、agent、SDK query 和文件状态。
83
+ 2. 显式 lifecycle:project/phase/quick/debug/thread/workstream 到 PR ship 都有可恢复状态。
84
+ 3. 防腐层:context budget、read guard、prompt-injection scan、inventory parity、SDK golden parity 防止长流程腐烂。
85
+
86
+ cc-devflow 的优势更克制:少入口、强文档、capability truth、report-card gate。
87
+ 迁移策略是吸收机制,不吸收表面。
88
+
89
+ ## Accepted Scope
90
+
91
+ ### P0
92
+
93
+ - `cc-plan`: spec ambiguity gate、assumptions preview、bounded review loop、external doc conflict buckets、trust boundary。
94
+ - `cc-do`: wave scheduling、per-task touched-path conflict、submodule-aware worktree gate、quick-lane mini manifest。
95
+ - `cc-investigate`: persistent debug session、diagnose-only report、workflow forensics。
96
+ - `cc-check`: named error evidence、human UAT、security/ui/ai-eval facets、hostile fixture gates。
97
+ - `cc-act`: structured ship preflight、rollback guard、learning extraction、PR branch hygiene。
98
+ - Runtime/compiler: typed query registry、named errors、operational trace、inventory parity、drift gate、scale budget。
99
+
100
+ ### P1
101
+
102
+ - `docs-sync`: spike/sketch/research wrap-up 变成 durable project learning。
103
+ - `cc-roadmap`: import backlog/roadmap cleanup guard、urgent insertion semantics、deferred triggers。
104
+ - Config/runtime: provider-neutral effort/profile hints,只作为 advisory preference。
105
+ - Adapter: prompt-injection/read-before-edit/context warnings 作为 opt-in capability。
106
+
107
+ ### Optional Lane
108
+
109
+ Codebase Map 七件套只作为按需缓存:
110
+
111
+ - stack
112
+ - architecture
113
+ - structure
114
+ - conventions
115
+ - testing
116
+ - integrations
117
+ - concerns
118
+
119
+ 触发条件:陌生仓库、大型 brownfield、跨模块/跨技术栈改造。它不能成为默认产物,
120
+ 不能高于 `devflow/specs/`、roadmap/backlog、planning artifacts 和 machine truth。
121
+
122
+ ## Contract-First Migration Plan
123
+
124
+ ### `cc-plan`
125
+
126
+ | Contract | Artifact owner | Gate | Tests |
127
+ | --- | --- | --- | --- |
128
+ | WHAT/WHY ambiguity score | `task-manifest.json.planningMeta` + `planning/design.md` | score above threshold blocks task manifest approval | unit fixture: ambiguous input blocks; clear input passes |
129
+ | Assumptions preview | `planning/design.md` decision log | user-visible assumptions before approval | fixture: hidden assumption fails review |
130
+ | Bounded review loop | `task-manifest.json.planningMeta.reviewLoop` | max attempts and stall detection reroute to `cc-roadmap` or user question | hostile fixture: repeated issue count blocks |
131
+ | External doc conflict buckets | `task-manifest.json.languageAndDecisions` | imported docs classified as auto-resolved, competing, unresolved | fixture: conflicting ADR/PRD creates blocker |
132
+ | Trust boundary | `task-manifest.json.sourceEvidence[]` | external text is evidence/source only, never instruction | hostile fixture: prompt injection remains evidence-only |
133
+
134
+ `cc-plan` must keep design decisions readable in Markdown and machine truth in JSON.
135
+ No separate GSD-style `.planning/` tree.
136
+
137
+ ### `cc-do`
138
+
139
+ | Contract | Artifact owner | Gate | Tests |
140
+ | --- | --- | --- | --- |
141
+ | Wave scheduling | `task-manifest.json.tasks[].phase/parallel/dependsOn/touches` | parallel only when dependencies and touches do not conflict | schema fixture: shared touches rejected |
142
+ | Submodule-aware worktree gate | `task-manifest.json.tasks[].touches` + runtime submodule scan | only tasks touching submodule paths lose isolation | hostile fixture: repo with `.gitmodules` but unrelated touches still parallel |
143
+ | Quick lane mini manifest | `task-manifest.json.metadata.lane=quick` | small work still has checkpoint, verification, handoff | fixture: quick lane without verification blocks |
144
+ | Thread/pause/resume | `change-state.json` + one final handoff file | resume query returns stable next action | integration: stale checkpoint restores to pending |
145
+
146
+ `cc-do` should not invent new task state outside `task-manifest.json` and checkpoints.
147
+
148
+ ### `cc-investigate`
149
+
150
+ | Contract | Artifact owner | Gate | Tests |
151
+ | --- | --- | --- | --- |
152
+ | Persistent debug session | `planning/analysis.md` session block, optional machine summary in `task-manifest.json` | hypotheses, probes, symptom match, cleanup recorded | fixture: missing cleanup blocks freeze |
153
+ | Diagnose-only report | `planning/analysis.md` | no code edits required; root cause and next action explicit | fixture: diagnose-only does not mark implementation complete |
154
+ | Workflow forensics | `planning/analysis.md` + trace refs | git/artifact/state failures classified before fixes | hostile fixture: corrupt manifest produces named failure |
155
+
156
+ Prefer extending `planning/analysis.md` over adding `planning/debug-session.md`.
157
+ Only add a new file if the debug transcript becomes too large and has a single owner.
158
+
159
+ ### `cc-check`
160
+
161
+ | Contract | Artifact owner | Gate | Tests |
162
+ | --- | --- | --- | --- |
163
+ | Human UAT | `report-card.json.qa.humanUat` | failed UAT reroutes to `cc-investigate` or `cc-do` | fixture: UAT fail blocks pass |
164
+ | Named error evidence | `report-card.json.runtime.failureOwnership` | every runtime failure has error name, artifact refs, rescue action | hostile fixture: invalid JSON is not silent |
165
+ | Specialist facets | `report-card.json.review.specialistReviews[]` | security/ui/ai-eval facet either passes or has skip reason | fixture: missing required facet blocks |
166
+ | Review-fix loop | `report-card.json.review.findings[]` | finding fingerprint/action/status drives reroute | fixture: unresolved blocking finding prevents `cc-act` |
167
+
168
+ Prior learning applied: verification is a zero-trust pre-claim gate. A passing
169
+ statement needs fresh command output, exit status, and key observation.
170
+
171
+ ### `cc-act`
172
+
173
+ | Contract | Artifact owner | Gate | Tests |
174
+ | --- | --- | --- | --- |
175
+ | Ship-ready preflight | structured output from `detect-ship-target.sh` or successor | branch/base/remote/auth/clean tree/review freshness explicit | shell fixture: missing auth produces `ShipPreflightError` |
176
+ | Rollback guard | `handoff/pr-brief.md` or release note | rollback command and safe state recorded before publish | fixture: release without rollback note blocks |
177
+ | Learning extraction | roadmap/backlog/spec follow-up | follow-up is behavior contract, not chat TODO | fixture: file-only TODO rejected |
178
+ | PR branch hygiene | `handoff/pr-brief.md` | planning-only commits and release commits classified | fixture: duplicate PR branch action blocked |
179
+
180
+ `cc-act` owns landing and closeout, not late feature development. Any new implementation
181
+ inside `cc-act` returns to `cc-check` after verification changes.
182
+
183
+ ### Runtime And Compiler
184
+
185
+ | Contract | Artifact owner | Gate | Tests |
186
+ | --- | --- | --- | --- |
187
+ | Typed query registry | `lib/skill-runtime/query-registry.js` | query ids dispatch to typed read-only handlers | unit: unknown id returns named error |
188
+ | Named errors | `lib/skill-runtime/errors.js` | no `null`/`false` for failure states that need action | hostile fixtures: missing/invalid/stale artifacts |
189
+ | Operational trace | `lib/skill-runtime/trace.js` | every query/doctor/preflight result has eventId, artifact refs, next action | unit: trace shape required |
190
+ | Inventory parity | `lib/compiler/inventory.js` + publish gate | managed skills/scripts/templates/docs/mirrors match manifest | integration: drifted mirror fails |
191
+ | Scale budget | tests or smoke output | `adapt:check`, `verify:publish`, inventory and query stay within budget | smoke: record baseline and fail only on large regression |
192
+
193
+ Existing baseline on 2026-04-29:
194
+
195
+ - `.claude/skills`: 672K
196
+ - `.codex/skills`: 632K
197
+ - `docs`: 236K
198
+ - `lib`: 688K
199
+ - `config`: 20K
200
+ - Relevant files scanned: 313
201
+ - `npm run adapt:check`: 3.207s
202
+ - `npm run verify:publish`: 4.757s
203
+
204
+ Budgets should prevent avoidable full-repo scans. Optional codebase map never runs in the
205
+ default planning path.
206
+
207
+ ## Artifact Ownership Table
208
+
209
+ | Data | Owner | Human view | Machine truth |
210
+ | --- | --- | --- | --- |
211
+ | Ambiguity and assumptions | `cc-plan` | `planning/design.md` | `task-manifest.json.planningMeta` |
212
+ | Imported doc trust classification | `cc-plan` | `planning/design.md` | `task-manifest.json.sourceEvidence[]` |
213
+ | Task graph and waves | `cc-plan` / `cc-do` | `planning/tasks.md` | `task-manifest.json.tasks[]` |
214
+ | Quick lane state | `cc-do` | checkpoint summary | `task-manifest.json.metadata`, `checkpoint.json` |
215
+ | Debug hypotheses and probes | `cc-investigate` | `planning/analysis.md` | optional `task-manifest.json.investigation` |
216
+ | Verification/UAT/facets | `cc-check` | review summary | `report-card.json` |
217
+ | Runtime failures | `cc-check` | review summary | `report-card.json.runtime.failureOwnership[]` |
218
+ | Ship target and rollback | `cc-act` | `handoff/pr-brief.md` / `release-note.md` | structured preflight output |
219
+ | Inventory parity | compiler/docs-sync | publish report | compiler inventory manifest |
220
+ | Query state | runtime | CLI/doctor output | typed derived view from existing artifacts |
221
+
222
+ ## Named Error And Rescue Contract
223
+
224
+ Every new query, gate, preflight, inventory check, and debug path must name failures.
225
+
226
+ | Error name | Trigger | Rescue action | User sees |
227
+ | --- | --- | --- | --- |
228
+ | `MissingArtifactError` | required artifact is absent | show artifact path and owner skill | blocked with next action |
229
+ | `InvalidJsonError` | JSON parse fails | show path and parse excerpt | blocked, repair artifact |
230
+ | `SchemaValidationError` | Zod/schema check fails | show schema path and failing field | blocked, reroute owner skill |
231
+ | `NoActiveChangeError` | no change selected | ask for change key or query list | clear prompt |
232
+ | `InvalidTaskGraphError` | missing dependency, cycle, invalid active phase | reroute `cc-plan` or `cc-do` | blocked graph summary |
233
+ | `InventoryDriftError` | managed file missing, extra, or hash drifted | run adapt or update inventory | publish blocked |
234
+ | `TrustBoundaryError` | external source tries to become instruction | classify as evidence-only and block if unresolved | planning blocked |
235
+ | `ShipPreflightError` | branch/base/auth/clean tree/review freshness fails | show failed preflight item | act blocked |
236
+
237
+ Catch-all logging is not sufficient. Every rescued error must provide an artifact ref,
238
+ owner skill, and next action.
239
+
240
+ ## Shadow Path Matrix
241
+
242
+ | Flow | Nil/missing | Empty | Invalid | Conflict | Stale | Partial |
243
+ | --- | --- | --- | --- | --- | --- | --- |
244
+ | external docs -> `cc-plan` | block with missing source | skip with reason | `TrustBoundaryError` | conflict bucket | mark stale source | partial import warning |
245
+ | `tasks.md` -> `task-manifest.json` | block | block | schema error | dependency conflict | plan version mismatch | no manifest approval |
246
+ | manifest -> wave scheduling | block | no runnable task | `InvalidTaskGraphError` | serialize or block | stale checkpoint rejected | reroute resume |
247
+ | debug session -> analysis | block freeze | require note | schema/narrative mismatch | competing hypotheses | stale symptom | diagnose-only |
248
+ | query registry -> next action | `MissingArtifactError` | no next action with reason | named parse/schema error | blocked graph | stale state warning | degraded output |
249
+ | inventory -> publish gate | missing inventory blocks | empty inventory blocks | schema error | drift blocks | stale hash blocks | publish blocked |
250
+ | ship preflight -> `cc-act` | missing remote/base handled | local handoff path | `ShipPreflightError` | branch/PR conflict | stale review blocks | handoff fallback |
251
+
252
+ ## Trust Boundary Contract
253
+
254
+ External text includes imported PRDs, ADRs, specs, repo docs, web pages, compressed memory,
255
+ issues, and PR comments. These inputs can become evidence, constraints, or questions.
256
+ They cannot directly become workflow instructions.
257
+
258
+ Required classifications:
259
+
260
+ - `source`: where the text came from
261
+ - `trust`: `internal-contract` / `repo-evidence` / `external-evidence` / `untrusted-text`
262
+ - `allowedUse`: evidence, term proposal, constraint candidate, blocker, or follow-up
263
+ - `instructionUse`: always false unless the source is a cc-devflow SKILL/PLAYBOOK/config contract
264
+ - `finding`: optional prompt-injection/security note
265
+
266
+ Prompt-injection scanning is best placed at import and planning boundaries. Adapter hooks
267
+ remain opt-in safety aids, not default blockers.
268
+
269
+ ## Migration Test Matrix
270
+
271
+ | Area | Unit | Integration | Publish/adapt gate | Hostile fixture |
272
+ | --- | --- | --- | --- | --- |
273
+ | `cc-plan` ambiguity/trust | score and bucket parser | plan artifact fixture | example binding if public docs change | injection doc stays evidence-only |
274
+ | `cc-do` waves/touches | schema conflict | dispatch/resume | none | stale plan version rejected |
275
+ | `cc-investigate` debug session | session block parser | diagnose-only fixture | example fixture if template changes | missing probe cleanup blocks freeze |
276
+ | `cc-check` UAT/errors/facets | report-card schema | verify gate fixture | `verify:examples` | invalid artifact blocks pass |
277
+ | `cc-act` preflight/rollback | preflight parser | shell fixture | `verify:publish` | missing auth/dirty tree explicit |
278
+ | Runtime query registry | dispatch and errors | full-state fixture | none | missing/invalid/stale artifacts |
279
+ | Compiler inventory | manifest schema | drift fixture | `adapt:check`, `verify:publish` | drifted mirror blocks |
280
+
281
+ Test framework: Jest. Existing tests already cover schema, query, dispatch, compiler drift,
282
+ config, adapter security, and publish validation. New work must add negative fixtures before
283
+ claiming the contract is migrated.
284
+
285
+ ## Module Boundary Plan
286
+
287
+ Do not grow existing large files unless the change is a local extension of their current job.
288
+
289
+ | Module | Responsibility |
290
+ | --- | --- |
291
+ | `lib/skill-runtime/errors.js` | named runtime error classes and formatting |
292
+ | `lib/skill-runtime/query-registry.js` | typed read-only query dispatch |
293
+ | `lib/skill-runtime/trace.js` | eventId, artifact refs, next action shape |
294
+ | `lib/skill-runtime/query.js` | compatibility facade over query registry |
295
+ | `lib/compiler/inventory.js` | managed inventory, hashes, parity rules |
296
+ | `scripts/validate-publish.js` | invoke inventory validation, not own all logic |
297
+ | SKILL-local scripts | owner-specific gate logic and human output |
298
+
299
+ Large-file guardrails:
300
+
301
+ - Keep `schemas.js` for schemas only.
302
+ - Keep `query.js` as facade, not new business logic.
303
+ - Keep `validate-publish.js` as orchestrator, not inventory implementation.
304
+ - Split commits by module and SKILL owner.
305
+
306
+ ## Phased Rollout Plan
307
+
308
+ ### Phase 1: Contract-first document and first executable seam
309
+
310
+ - Rewrite this blueprint into SKILL-owned sections.
311
+ - Add artifact ownership, named errors, shadow paths, test matrix, module boundary, scale budget.
312
+ - First implementation targets `cc-plan` and `cc-do` only where existing schema/query tests already support validation.
313
+ - Required proof: hostile fixtures for missing/invalid/stale/conflict states.
314
+
315
+ ### Phase 2: Runtime query and named error foundation
316
+
317
+ - Add `errors.js`, `query-registry.js`, `trace.js`.
318
+ - Keep SKILL semantics outside runtime.
319
+ - Required proof: typed query unit tests and missing/invalid/stale artifact fixtures.
320
+
321
+ ### Phase 3: `cc-investigate` debug session and forensics
322
+
323
+ - Extend `planning/analysis.md` and optional machine summary.
324
+ - Required proof: diagnose-only and missing cleanup fixtures.
325
+
326
+ ### Phase 4: `cc-check` and `cc-act` consumers
327
+
328
+ - Add human UAT, named error ownership, ship preflight, rollback guard.
329
+ - Required proof: report-card and preflight fixtures.
330
+
331
+ ### Phase 5: Compiler inventory and publish gate
332
+
333
+ - Add inventory parity and drift checks.
334
+ - Required proof: `adapt:check`, `verify:examples`, `verify:publish`, and drifted mirror fixture.
335
+
336
+ Rollback should be per phase: revert the SKILL version and the module/gate introduced in that phase.
337
+ Do not ship all phases as one undifferentiated release.
338
+
339
+ ## Anti-GSD Drift Charter
340
+
341
+ These rules protect cc-devflow's identity:
342
+
343
+ 1. Do not add GSD command aliases as public entry points.
344
+ 2. Do not add manager UI or default runtime dashboard before typed query and artifacts are stable.
345
+ 3. Do not default-enable hooks; adapter safety remains opt-in unless the platform requires it.
346
+ 4. Do not create a competing `.planning/` tree.
347
+ 5. Do not make codebase map a default artifact.
348
+ 6. Do not hide workflow decisions inside runtime helpers.
349
+ 7. Do not add a new durable truth source when an existing artifact can own the field.
350
+ 8. Every migrated mechanism must name its SKILL owner, artifact owner, test gate, and rollback path.
351
+
352
+ ## What Already Exists
353
+
354
+ | Existing cc-devflow asset | Reuse |
355
+ | --- | --- |
356
+ | `lib/skill-runtime/query.js` | current progress/next/full-state facade |
357
+ | `lib/skill-runtime/schemas.js` | manifest/report/checkpoint schema boundary |
358
+ | `lib/skill-runtime/config.js` | layered config and doctor pattern |
359
+ | `lib/compiler/manifest.js` | hash and drift detection foundation |
360
+ | `scripts/validate-publish.js` | publish validation orchestrator |
361
+ | `docs/examples/scripts/check-example-bindings.sh` | example/version drift gate |
362
+ | `npm run adapt:check` | platform mirror drift check |
363
+ | `npm run verify:publish` | package and public skill contract validation |
364
+
365
+ Reuse these before adding new systems.
366
+
367
+ ## NOT In Scope
368
+
369
+ - Copying GSD's 86 command surface.
370
+ - Copying GSD's 33-agent surface as named cc-devflow agents.
371
+ - Copying Claude-specific `ultraplan-phase`.
372
+ - Adding community/marketing commands such as `join-discord`.
373
+ - Making `graphify` a default project capability.
374
+ - Building a manager/autonomous UI.
375
+ - Default-enabling safety hooks.
376
+ - Replacing `devflow/changes/<change-key>` with GSD `.planning/`.
377
+ - Treating model/provider profile as a required workflow contract.
378
+
379
+ ## Appendix A: Command Coverage
380
+
381
+ The table below proves the GSD command surface was reviewed. It is coverage evidence,
382
+ not the cc-devflow implementation order.
383
+
384
+ ### Core Workflow
385
+
386
+ | GSD command | Decision |
387
+ | --- | --- |
388
+ | `new-project` | migrate bootstrap checklist into `cc-roadmap` / `cc-spec-init` |
389
+ | `new-workspace` | partial: multi-repo/worktree execution isolation |
390
+ | `list-workspaces` | low priority runtime query |
391
+ | `remove-workspace` | `cc-act` cleanup guard |
392
+ | `discuss-phase` | migrate assumptions/batch/text mechanisms only |
393
+ | `spec-phase` | P0: WHAT/WHY ambiguity gate |
394
+ | `ui-phase` | conditional UI contract template |
395
+ | `ai-integration-phase` | conditional AI scope review/eval plan |
396
+ | `plan-phase` | P0 bounded review loop |
397
+ | `plan-review-convergence` | high-concern convergence only |
398
+ | `ultraplan-phase` | skip, Claude-specific |
399
+ | `spike` | prototype exception + evidence |
400
+ | `sketch` | design exploration evidence, no command |
401
+ | `research-phase` | source authority in Context Sweep |
402
+ | `execute-phase` | P0 wave scheduling |
403
+ | `verify-work` | UAT + auto reroute |
404
+ | `ship` | structured ship preflight |
405
+ | `next` | runtime query `route.next-action` |
406
+ | `fast` | TDD exception / quick lane rule |
407
+ | `quick` | mini manifest + checkpoint |
408
+ | `ui-review` | conditional frontend `cc-check` facet |
409
+ | `code-review` | finding schema |
410
+ | `code-review-fix` | fix loop and return to `cc-check` |
411
+ | `eval-review` | conditional AI eval facet |
412
+
413
+ ### Phase And Milestone Management
414
+
415
+ | GSD command | Decision |
416
+ | --- | --- |
417
+ | `add-phase` | roadmap append helper |
418
+ | `edit-phase` | roadmap edit semantics |
419
+ | `insert-phase` | urgent insertion semantics, no decimal numbering |
420
+ | `remove-phase` | backlog/roadmap cleanup guard |
421
+ | `add-tests` | coverage gap task generation |
422
+ | `list-phase-assumptions` | assumptions preview |
423
+ | `analyze-dependencies` | roadmap graph and task deps |
424
+ | `validate-phase` | report-card gap closure |
425
+ | `secure-phase` | conditional security facet |
426
+ | `audit-milestone` | post-merge/closeout audit |
427
+ | `audit-uat` | human feedback debt audit |
428
+ | `audit-fix` | classification only, no auto big-rewrite |
429
+ | `plan-milestone-gaps` | roadmap/plan gap writeback |
430
+ | `complete-milestone` | partial: archive/version/tag via `cc-act` / `npm-release` |
431
+ | `new-milestone` | stage reset |
432
+ | `milestone-summary` | release/handoff summary |
433
+ | `cleanup` | low priority cleanup |
434
+ | `manager` | skip UI |
435
+ | `workstreams` | active pointer only |
436
+ | `autonomous` | smart-discuss/checkpoint guard only |
437
+ | `undo` | rollback guard |
438
+
439
+ ### Session And Navigation
440
+
441
+ | GSD command | Decision |
442
+ | --- | --- |
443
+ | `progress` | runtime query |
444
+ | `stats` | low priority runtime query |
445
+ | `session-report` | partial `cc-act` summary |
446
+ | `pause-work` | lightweight pause |
447
+ | `resume-work` | query-backed resume |
448
+ | `explore` | pre-roadmap exploration mode |
449
+ | `do` | natural-language route query, no new public command |
450
+ | `note` | roadmap/backlog note |
451
+ | `add-todo` | durable follow-up |
452
+ | `check-todos` | backlog promotion |
453
+ | `add-backlog` | parking lot without 999.x numbering |
454
+ | `review-backlog` | backlog promotion |
455
+ | `plant-seed` | deferred trigger |
456
+ | `thread` | lightweight resume/thread entry |
457
+
458
+ ### Codebase Intelligence
459
+
460
+ | GSD command | Decision |
461
+ | --- | --- |
462
+ | `map-codebase` | optional lane only |
463
+ | `scan` | lightweight Context Sweep |
464
+ | `intel` | medium-priority query/cache |
465
+ | `graphify` | skip default capability |
466
+ | `extract_learnings` | post-closeout learning extraction |
467
+
468
+ ### Review, Debug, Recovery
469
+
470
+ | GSD command | Decision |
471
+ | --- | --- |
472
+ | `review` | optional reviewer command/config |
473
+ | `debug` | P0 persistent investigation session |
474
+ | `forensics` | workflow failure mode |
475
+ | `health` | `cc-devflow doctor` direction |
476
+ | `import` | external plan conflict detection |
477
+ | `from-gsd2` | skip migration-only command |
478
+ | `inbox` | optional remote lane |
479
+
480
+ ### Docs, Profile, Utilities
481
+
482
+ | GSD command | Decision |
483
+ | --- | --- |
484
+ | `docs-update` | docs-sync fact check |
485
+ | `ingest-docs` | import conflict buckets |
486
+ | `spike-wrap-up` | project learning mechanism |
487
+ | `sketch-wrap-up` | project learning mechanism |
488
+ | `profile-user` | not a main workflow |
489
+ | `settings` | config profile support |
490
+ | `settings-advanced` | partial config support |
491
+ | `settings-integrations` | partial with secrets masking |
492
+ | `set-profile` | provider-neutral hints only |
493
+ | `pr-branch` | branch hygiene guard |
494
+ | `sync-skills` | adapt drift report |
495
+ | `update` | npm/update docs already cover |
496
+ | `reapply-patches` | low priority |
497
+ | `help` | existing docs/CLI |
498
+ | `join-discord` | skip |
499
+
500
+ ## Appendix B: Agent And Hook Coverage
501
+
502
+ | GSD area | Migration decision |
503
+ | --- | --- |
504
+ | Research agents | optional evidence lanes; write artifacts, do not add agent surface |
505
+ | Planning agents | producer/checker separation; no new agent names |
506
+ | Execution agents | mechanism only; no agent count migration |
507
+ | Verification agents | facets with PASS/PARTIAL/ESCALATE |
508
+ | Knowledge/docs agents | docs-sync and query support |
509
+ | Profile agents | config advisory only |
510
+ | Context/status/update hooks | skip or existing npm/update docs |
511
+ | Prompt/read/workflow guards | opt-in adapter safety and trust boundary |
512
+ | Commit/phase hooks | migrate checks, not hooks |
513
+
514
+ ## Taste Check
515
+
516
+ - Good strategy: make state, gates, context budget, trust boundaries, and parallelism machine-checkable.
517
+ - Bad strategy: turn every scenario into a command and make users learn the source system's shape.
518
+ - Correct cc-devflow path: few entry points, strong SKILL contracts, typed runtime reads, hostile fixtures, publish gates.
@@ -83,7 +83,7 @@ Use the skills in this order:
83
83
 
84
84
  Typical outputs:
85
85
 
86
- - `cc-roadmap` writes `devflow/ROADMAP.md` and `devflow/BACKLOG.md`; helper sync can also maintain `devflow/roadmap-tracking.json` as the shared roadmap/backlog truth source
86
+ - `cc-roadmap` writes `devflow/roadmap.json` as the editable roadmap truth, then generates `devflow/ROADMAP.md` and deprecated `devflow/BACKLOG.md`
87
87
  - `cc-spec-init` writes `devflow/specs/INDEX.md`, capability specs, and `change-meta.json`
88
88
  - `cc-plan` writes `planning/design.md`, `planning/tasks.md`, `task-manifest.json`, and `change-meta.json`
89
89
  - `cc-investigate` writes `planning/analysis.md`, `planning/tasks.md`, `task-manifest.json`, and `change-meta.json`
@@ -94,7 +94,7 @@ Capability truth lives in `devflow/specs/`.
94
94
  Change truth lives in `devflow/changes/<change>/`.
95
95
 
96
96
  - Keep `INDEX.md` plus capability markdown under `devflow/specs/`.
97
- - Name new change directories as `REQ-<number>-<description>` for requirements or `FIX-<number>-<description>` for bug fixes; old lowercase directories are compatibility reads only.
97
+ - Name new change directories as `REQ-<number>-<description>` for requirements or `FIX-<number>-<description>` for bug fixes. `REQ` and `FIX` are separate number sequences; old lowercase directories are compatibility reads only.
98
98
  - Keep `change-state.json`, `change-meta.json`, planning docs, `task-manifest.json`, optional `team-state.json`, task `checkpoint.json`, `report-card.json`, and one final handoff file under each `devflow/changes/<change>/`.
99
99
  - Worker prompts, journals, assignments, and session logs belong under `devflow/workspaces/<change>/` as ephemeral scratch.
100
100
 
@@ -83,7 +83,7 @@ find .codex/skills -mindepth 2 -maxdepth 2 -name SKILL.md | sort
83
83
 
84
84
  常见产物:
85
85
 
86
- - `cc-roadmap` 产出 `devflow/ROADMAP.md` 和 `devflow/BACKLOG.md`;如果使用内置同步脚本,还会维护 `devflow/roadmap-tracking.json` 作为 roadmap/backlog 的共享真相源
86
+ - `cc-roadmap` 产出可编辑真相 `devflow/roadmap.json`,再生成 `devflow/ROADMAP.md` 和 deprecated `devflow/BACKLOG.md`
87
87
  - `cc-spec-init` 产出 `devflow/specs/INDEX.md`、capability spec 和 `change-meta.json`
88
88
  - `cc-plan` 产出 `planning/design.md`、`planning/tasks.md`、`task-manifest.json` 和 `change-meta.json`
89
89
  - `cc-investigate` 产出 `planning/analysis.md`、`planning/tasks.md`、`task-manifest.json` 和 `change-meta.json`
@@ -93,7 +93,7 @@ find .codex/skills -mindepth 2 -maxdepth 2 -name SKILL.md | sort
93
93
  durable truth 分两层:
94
94
 
95
95
  - `devflow/specs/`:capability 真相,保留 `INDEX.md` 与 `capabilities/*.md`
96
- - 新 change 目录必须命名为 `REQ-<number>-<description>`(需求)或 `FIX-<number>-<description>`(修复);旧小写目录只作为历史兼容读取。
96
+ - 新 change 目录必须命名为 `REQ-<number>-<description>`(需求)或 `FIX-<number>-<description>`(修复);`REQ` 和 `FIX` 分别维护自己的递增编号,旧小写目录只作为历史兼容读取。
97
97
  - `devflow/changes/<change>/`:变更真相,保留 `change-state.json`、`change-meta.json`、planning 文档、`task-manifest.json`、可选 `team-state.json`、任务级 `checkpoint.json`、`report-card.json` 和唯一的最终 handoff 文件。
98
98
  - worker prompt、journal、assignment、session log 统一放到 `devflow/workspaces/<change>/`,作为 ephemeral scratch。
99
99
 
@@ -0,0 +1,51 @@
1
+ const fs = require('fs');
2
+ const os = require('os');
3
+ const path = require('path');
4
+
5
+ const { validateSkillInventory } = require('../inventory');
6
+
7
+ function writeFile(filePath, content = '') {
8
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
9
+ fs.writeFileSync(filePath, content);
10
+ }
11
+
12
+ function makeSkill(root, name, files = ['SKILL.md']) {
13
+ for (const file of files) {
14
+ writeFile(path.join(root, '.claude/skills', name, file), `# ${name}\n`);
15
+ }
16
+ }
17
+
18
+ describe('compiler inventory parity', () => {
19
+ test('rejects unconfigured managed skill directories', () => {
20
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-devflow-inventory-extra-'));
21
+ makeSkill(root, 'cc-plan', ['SKILL.md', 'PLAYBOOK.md']);
22
+ makeSkill(root, 'mystery-skill');
23
+
24
+ const errors = validateSkillInventory({
25
+ root,
26
+ publicSkills: ['cc-plan'],
27
+ distributedSkills: ['cc-plan'],
28
+ internalSkills: []
29
+ });
30
+
31
+ expect(errors).toContain('Unconfigured skill directory: mystery-skill');
32
+ });
33
+
34
+ test('requires public mirrors to match public skill inventory when present', () => {
35
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-devflow-inventory-mirror-'));
36
+ makeSkill(root, 'cc-plan', ['SKILL.md', 'PLAYBOOK.md']);
37
+ writeFile(path.join(root, '.codex/skills/cc-roadmap/SKILL.md'), '# cc-roadmap\n');
38
+
39
+ const errors = validateSkillInventory({
40
+ root,
41
+ publicSkills: ['cc-plan'],
42
+ distributedSkills: ['cc-plan'],
43
+ internalSkills: []
44
+ });
45
+
46
+ expect(errors).toEqual(expect.arrayContaining([
47
+ 'Codex mirror missing public skill: cc-plan',
48
+ 'Codex mirror has unconfigured public skill: cc-roadmap'
49
+ ]));
50
+ });
51
+ });
@@ -195,7 +195,7 @@ describe('Skills Registry Generator', () => {
195
195
  );
196
196
  });
197
197
 
198
- test('should publish roadmap outputs under devflow', async () => {
198
+ test('should publish unified roadmap state outputs under devflow', async () => {
199
199
  const { generateSkillsRegistryV2 } = require('../skills-registry');
200
200
 
201
201
  const result = await generateSkillsRegistryV2('.claude/skills');
@@ -204,14 +204,28 @@ describe('Skills Registry Generator', () => {
204
204
  expect(roadmap).toBeDefined();
205
205
  expect(roadmap.writes).toEqual(
206
206
  expect.arrayContaining([
207
- expect.objectContaining({ path: 'devflow/ROADMAP.md' }),
208
- expect.objectContaining({ path: 'devflow/BACKLOG.md' })
207
+ expect.objectContaining({
208
+ path: 'devflow/roadmap.json',
209
+ durability: 'durable',
210
+ required: true
211
+ }),
212
+ expect.objectContaining({
213
+ path: 'devflow/ROADMAP.md',
214
+ durability: 'durable',
215
+ required: true
216
+ }),
217
+ expect.objectContaining({
218
+ path: 'devflow/BACKLOG.md',
219
+ durability: 'durable',
220
+ required: false
221
+ })
209
222
  ])
210
223
  );
211
224
  expect(roadmap.writes).not.toEqual(
212
225
  expect.arrayContaining([
213
226
  expect.objectContaining({ path: 'ROADMAP.md' }),
214
227
  expect.objectContaining({ path: 'BACKLOG.md' }),
228
+ expect.objectContaining({ path: 'devflow/roadmap-tracking.json', required: true }),
215
229
  expect.objectContaining({ path: 'devflow/roadmap/roadmap.md' }),
216
230
  expect.objectContaining({ path: 'devflow/roadmap/backlog.md' })
217
231
  ])