cap-pro 1.0.0

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 (275) hide show
  1. package/.claude-plugin/README.md +26 -0
  2. package/.claude-plugin/marketplace.json +24 -0
  3. package/.claude-plugin/plugin.json +24 -0
  4. package/LICENSE +21 -0
  5. package/README.ja-JP.md +834 -0
  6. package/README.ko-KR.md +823 -0
  7. package/README.md +806 -0
  8. package/README.pt-BR.md +452 -0
  9. package/README.zh-CN.md +800 -0
  10. package/agents/cap-architect.md +269 -0
  11. package/agents/cap-brainstormer.md +207 -0
  12. package/agents/cap-curator.md +276 -0
  13. package/agents/cap-debugger.md +365 -0
  14. package/agents/cap-designer.md +246 -0
  15. package/agents/cap-historian.md +464 -0
  16. package/agents/cap-migrator.md +291 -0
  17. package/agents/cap-prototyper.md +197 -0
  18. package/agents/cap-validator.md +308 -0
  19. package/bin/install.js +5433 -0
  20. package/cap/bin/cap-tools.cjs +853 -0
  21. package/cap/bin/lib/arc-scanner.cjs +344 -0
  22. package/cap/bin/lib/cap-affinity-engine.cjs +862 -0
  23. package/cap/bin/lib/cap-anchor.cjs +228 -0
  24. package/cap/bin/lib/cap-annotation-writer.cjs +340 -0
  25. package/cap/bin/lib/cap-checkpoint.cjs +434 -0
  26. package/cap/bin/lib/cap-cluster-detect.cjs +945 -0
  27. package/cap/bin/lib/cap-cluster-display.cjs +52 -0
  28. package/cap/bin/lib/cap-cluster-format.cjs +245 -0
  29. package/cap/bin/lib/cap-cluster-helpers.cjs +295 -0
  30. package/cap/bin/lib/cap-cluster-io.cjs +212 -0
  31. package/cap/bin/lib/cap-completeness.cjs +540 -0
  32. package/cap/bin/lib/cap-deps.cjs +583 -0
  33. package/cap/bin/lib/cap-design-families.cjs +332 -0
  34. package/cap/bin/lib/cap-design.cjs +966 -0
  35. package/cap/bin/lib/cap-divergence-detector.cjs +400 -0
  36. package/cap/bin/lib/cap-doctor.cjs +752 -0
  37. package/cap/bin/lib/cap-feature-map-internals.cjs +19 -0
  38. package/cap/bin/lib/cap-feature-map-migrate.cjs +335 -0
  39. package/cap/bin/lib/cap-feature-map-monorepo.cjs +885 -0
  40. package/cap/bin/lib/cap-feature-map-shard.cjs +315 -0
  41. package/cap/bin/lib/cap-feature-map.cjs +1943 -0
  42. package/cap/bin/lib/cap-fitness-score.cjs +1075 -0
  43. package/cap/bin/lib/cap-impact-analysis.cjs +652 -0
  44. package/cap/bin/lib/cap-learn-review.cjs +1072 -0
  45. package/cap/bin/lib/cap-learning-signals.cjs +627 -0
  46. package/cap/bin/lib/cap-loader.cjs +227 -0
  47. package/cap/bin/lib/cap-logger.cjs +57 -0
  48. package/cap/bin/lib/cap-memory-bridge.cjs +764 -0
  49. package/cap/bin/lib/cap-memory-confidence.cjs +452 -0
  50. package/cap/bin/lib/cap-memory-dir.cjs +987 -0
  51. package/cap/bin/lib/cap-memory-engine.cjs +698 -0
  52. package/cap/bin/lib/cap-memory-extends.cjs +398 -0
  53. package/cap/bin/lib/cap-memory-graph.cjs +790 -0
  54. package/cap/bin/lib/cap-memory-migrate.cjs +2015 -0
  55. package/cap/bin/lib/cap-memory-pin.cjs +183 -0
  56. package/cap/bin/lib/cap-memory-platform.cjs +490 -0
  57. package/cap/bin/lib/cap-memory-prune.cjs +707 -0
  58. package/cap/bin/lib/cap-memory-schema.cjs +812 -0
  59. package/cap/bin/lib/cap-migrate-tags.cjs +309 -0
  60. package/cap/bin/lib/cap-migrate.cjs +540 -0
  61. package/cap/bin/lib/cap-pattern-apply.cjs +1203 -0
  62. package/cap/bin/lib/cap-pattern-pipeline.cjs +1034 -0
  63. package/cap/bin/lib/cap-plugin-manifest.cjs +80 -0
  64. package/cap/bin/lib/cap-realtime-affinity.cjs +399 -0
  65. package/cap/bin/lib/cap-reconcile.cjs +570 -0
  66. package/cap/bin/lib/cap-research-gate.cjs +218 -0
  67. package/cap/bin/lib/cap-scope-filter.cjs +402 -0
  68. package/cap/bin/lib/cap-semantic-pipeline.cjs +1038 -0
  69. package/cap/bin/lib/cap-session-extract.cjs +987 -0
  70. package/cap/bin/lib/cap-session.cjs +445 -0
  71. package/cap/bin/lib/cap-snapshot-linkage.cjs +963 -0
  72. package/cap/bin/lib/cap-stack-docs.cjs +646 -0
  73. package/cap/bin/lib/cap-tag-observer.cjs +371 -0
  74. package/cap/bin/lib/cap-tag-scanner.cjs +1766 -0
  75. package/cap/bin/lib/cap-telemetry.cjs +466 -0
  76. package/cap/bin/lib/cap-test-audit.cjs +1438 -0
  77. package/cap/bin/lib/cap-thread-migrator.cjs +307 -0
  78. package/cap/bin/lib/cap-thread-synthesis.cjs +545 -0
  79. package/cap/bin/lib/cap-thread-tracker.cjs +519 -0
  80. package/cap/bin/lib/cap-trace.cjs +399 -0
  81. package/cap/bin/lib/cap-trust-mode.cjs +336 -0
  82. package/cap/bin/lib/cap-ui-design-editor.cjs +642 -0
  83. package/cap/bin/lib/cap-ui-mind-map.cjs +712 -0
  84. package/cap/bin/lib/cap-ui-thread-nav.cjs +693 -0
  85. package/cap/bin/lib/cap-ui.cjs +1245 -0
  86. package/cap/bin/lib/cap-upgrade.cjs +1028 -0
  87. package/cap/bin/lib/cli/arg-helpers.cjs +49 -0
  88. package/cap/bin/lib/cli/frontmatter-router.cjs +31 -0
  89. package/cap/bin/lib/cli/init-router.cjs +68 -0
  90. package/cap/bin/lib/cli/phase-router.cjs +102 -0
  91. package/cap/bin/lib/cli/state-router.cjs +61 -0
  92. package/cap/bin/lib/cli/template-router.cjs +37 -0
  93. package/cap/bin/lib/cli/uat-router.cjs +29 -0
  94. package/cap/bin/lib/cli/validation-router.cjs +26 -0
  95. package/cap/bin/lib/cli/verification-router.cjs +31 -0
  96. package/cap/bin/lib/cli/workstream-router.cjs +39 -0
  97. package/cap/bin/lib/commands.cjs +961 -0
  98. package/cap/bin/lib/config.cjs +467 -0
  99. package/cap/bin/lib/convention-reader.cjs +258 -0
  100. package/cap/bin/lib/core.cjs +1241 -0
  101. package/cap/bin/lib/feature-aggregator.cjs +423 -0
  102. package/cap/bin/lib/frontmatter.cjs +337 -0
  103. package/cap/bin/lib/init.cjs +1443 -0
  104. package/cap/bin/lib/manifest-generator.cjs +383 -0
  105. package/cap/bin/lib/milestone.cjs +253 -0
  106. package/cap/bin/lib/model-profiles.cjs +69 -0
  107. package/cap/bin/lib/monorepo-context.cjs +226 -0
  108. package/cap/bin/lib/monorepo-migrator.cjs +509 -0
  109. package/cap/bin/lib/phase.cjs +889 -0
  110. package/cap/bin/lib/profile-output.cjs +989 -0
  111. package/cap/bin/lib/profile-pipeline.cjs +540 -0
  112. package/cap/bin/lib/roadmap.cjs +330 -0
  113. package/cap/bin/lib/security.cjs +394 -0
  114. package/cap/bin/lib/session-manager.cjs +292 -0
  115. package/cap/bin/lib/skeleton-generator.cjs +179 -0
  116. package/cap/bin/lib/state.cjs +1032 -0
  117. package/cap/bin/lib/template.cjs +231 -0
  118. package/cap/bin/lib/test-detector.cjs +62 -0
  119. package/cap/bin/lib/uat.cjs +283 -0
  120. package/cap/bin/lib/verify.cjs +889 -0
  121. package/cap/bin/lib/workspace-detector.cjs +371 -0
  122. package/cap/bin/lib/workstream.cjs +492 -0
  123. package/cap/commands/gsd/workstreams.md +63 -0
  124. package/cap/references/arc-standard.md +315 -0
  125. package/cap/references/cap-agent-architecture.md +101 -0
  126. package/cap/references/cap-gitignore-template +9 -0
  127. package/cap/references/cap-zero-deps.md +158 -0
  128. package/cap/references/checkpoints.md +778 -0
  129. package/cap/references/continuation-format.md +249 -0
  130. package/cap/references/contract-test-templates.md +312 -0
  131. package/cap/references/feature-map-template.md +25 -0
  132. package/cap/references/git-integration.md +295 -0
  133. package/cap/references/git-planning-commit.md +38 -0
  134. package/cap/references/model-profiles.md +174 -0
  135. package/cap/references/phase-numbering.md +126 -0
  136. package/cap/references/planning-config.md +202 -0
  137. package/cap/references/property-test-templates.md +316 -0
  138. package/cap/references/security-test-templates.md +347 -0
  139. package/cap/references/session-template.json +8 -0
  140. package/cap/references/tdd.md +263 -0
  141. package/cap/references/user-profiling.md +681 -0
  142. package/cap/references/verification-patterns.md +612 -0
  143. package/cap/templates/UAT.md +265 -0
  144. package/cap/templates/claude-md.md +175 -0
  145. package/cap/templates/codebase/architecture.md +255 -0
  146. package/cap/templates/codebase/concerns.md +310 -0
  147. package/cap/templates/codebase/conventions.md +307 -0
  148. package/cap/templates/codebase/integrations.md +280 -0
  149. package/cap/templates/codebase/stack.md +186 -0
  150. package/cap/templates/codebase/structure.md +285 -0
  151. package/cap/templates/codebase/testing.md +480 -0
  152. package/cap/templates/config.json +44 -0
  153. package/cap/templates/context.md +352 -0
  154. package/cap/templates/continue-here.md +78 -0
  155. package/cap/templates/copilot-instructions.md +7 -0
  156. package/cap/templates/debug-subagent-prompt.md +91 -0
  157. package/cap/templates/discussion-log.md +63 -0
  158. package/cap/templates/milestone-archive.md +123 -0
  159. package/cap/templates/milestone.md +115 -0
  160. package/cap/templates/phase-prompt.md +610 -0
  161. package/cap/templates/planner-subagent-prompt.md +117 -0
  162. package/cap/templates/project.md +186 -0
  163. package/cap/templates/requirements.md +231 -0
  164. package/cap/templates/research-project/ARCHITECTURE.md +204 -0
  165. package/cap/templates/research-project/FEATURES.md +147 -0
  166. package/cap/templates/research-project/PITFALLS.md +200 -0
  167. package/cap/templates/research-project/STACK.md +120 -0
  168. package/cap/templates/research-project/SUMMARY.md +170 -0
  169. package/cap/templates/research.md +552 -0
  170. package/cap/templates/roadmap.md +202 -0
  171. package/cap/templates/state.md +176 -0
  172. package/cap/templates/summary.md +364 -0
  173. package/cap/templates/user-preferences.md +498 -0
  174. package/cap/templates/verification-report.md +322 -0
  175. package/cap/workflows/add-phase.md +112 -0
  176. package/cap/workflows/add-tests.md +351 -0
  177. package/cap/workflows/add-todo.md +158 -0
  178. package/cap/workflows/audit-milestone.md +340 -0
  179. package/cap/workflows/audit-uat.md +109 -0
  180. package/cap/workflows/autonomous.md +891 -0
  181. package/cap/workflows/check-todos.md +177 -0
  182. package/cap/workflows/cleanup.md +152 -0
  183. package/cap/workflows/complete-milestone.md +767 -0
  184. package/cap/workflows/diagnose-issues.md +231 -0
  185. package/cap/workflows/discovery-phase.md +289 -0
  186. package/cap/workflows/discuss-phase-assumptions.md +653 -0
  187. package/cap/workflows/discuss-phase.md +1049 -0
  188. package/cap/workflows/do.md +104 -0
  189. package/cap/workflows/execute-phase.md +846 -0
  190. package/cap/workflows/execute-plan.md +514 -0
  191. package/cap/workflows/fast.md +105 -0
  192. package/cap/workflows/forensics.md +265 -0
  193. package/cap/workflows/health.md +181 -0
  194. package/cap/workflows/help.md +660 -0
  195. package/cap/workflows/insert-phase.md +130 -0
  196. package/cap/workflows/list-phase-assumptions.md +178 -0
  197. package/cap/workflows/list-workspaces.md +56 -0
  198. package/cap/workflows/manager.md +362 -0
  199. package/cap/workflows/map-codebase.md +377 -0
  200. package/cap/workflows/milestone-summary.md +223 -0
  201. package/cap/workflows/new-milestone.md +486 -0
  202. package/cap/workflows/new-project.md +1250 -0
  203. package/cap/workflows/new-workspace.md +237 -0
  204. package/cap/workflows/next.md +97 -0
  205. package/cap/workflows/node-repair.md +92 -0
  206. package/cap/workflows/note.md +156 -0
  207. package/cap/workflows/pause-work.md +176 -0
  208. package/cap/workflows/plan-milestone-gaps.md +273 -0
  209. package/cap/workflows/plan-phase.md +857 -0
  210. package/cap/workflows/plant-seed.md +169 -0
  211. package/cap/workflows/pr-branch.md +129 -0
  212. package/cap/workflows/profile-user.md +449 -0
  213. package/cap/workflows/progress.md +507 -0
  214. package/cap/workflows/quick.md +757 -0
  215. package/cap/workflows/remove-phase.md +155 -0
  216. package/cap/workflows/remove-workspace.md +90 -0
  217. package/cap/workflows/research-phase.md +82 -0
  218. package/cap/workflows/resume-project.md +326 -0
  219. package/cap/workflows/review.md +228 -0
  220. package/cap/workflows/session-report.md +146 -0
  221. package/cap/workflows/settings.md +283 -0
  222. package/cap/workflows/ship.md +228 -0
  223. package/cap/workflows/stats.md +60 -0
  224. package/cap/workflows/transition.md +671 -0
  225. package/cap/workflows/ui-phase.md +298 -0
  226. package/cap/workflows/ui-review.md +161 -0
  227. package/cap/workflows/update.md +323 -0
  228. package/cap/workflows/validate-phase.md +170 -0
  229. package/cap/workflows/verify-phase.md +254 -0
  230. package/cap/workflows/verify-work.md +637 -0
  231. package/commands/cap/annotate.md +165 -0
  232. package/commands/cap/brainstorm.md +393 -0
  233. package/commands/cap/checkpoint.md +106 -0
  234. package/commands/cap/completeness.md +94 -0
  235. package/commands/cap/continue.md +72 -0
  236. package/commands/cap/debug.md +588 -0
  237. package/commands/cap/deps.md +169 -0
  238. package/commands/cap/design.md +479 -0
  239. package/commands/cap/init.md +354 -0
  240. package/commands/cap/iterate.md +249 -0
  241. package/commands/cap/learn.md +459 -0
  242. package/commands/cap/memory.md +275 -0
  243. package/commands/cap/migrate-feature-map.md +91 -0
  244. package/commands/cap/migrate-memory.md +108 -0
  245. package/commands/cap/migrate-tags.md +91 -0
  246. package/commands/cap/migrate.md +131 -0
  247. package/commands/cap/prototype.md +510 -0
  248. package/commands/cap/reconcile.md +121 -0
  249. package/commands/cap/review.md +360 -0
  250. package/commands/cap/save.md +72 -0
  251. package/commands/cap/scan.md +404 -0
  252. package/commands/cap/start.md +356 -0
  253. package/commands/cap/status.md +118 -0
  254. package/commands/cap/test-audit.md +262 -0
  255. package/commands/cap/test.md +394 -0
  256. package/commands/cap/trace.md +133 -0
  257. package/commands/cap/ui.md +167 -0
  258. package/hooks/dist/cap-check-update.js +115 -0
  259. package/hooks/dist/cap-context-monitor.js +185 -0
  260. package/hooks/dist/cap-learn-review-hook.js +114 -0
  261. package/hooks/dist/cap-learning-hook.js +192 -0
  262. package/hooks/dist/cap-memory.js +299 -0
  263. package/hooks/dist/cap-prompt-guard.js +97 -0
  264. package/hooks/dist/cap-statusline.js +157 -0
  265. package/hooks/dist/cap-tag-observer.js +115 -0
  266. package/hooks/dist/cap-version-check.js +112 -0
  267. package/hooks/dist/cap-workflow-guard.js +175 -0
  268. package/hooks/hooks.json +55 -0
  269. package/package.json +58 -0
  270. package/scripts/base64-scan.sh +262 -0
  271. package/scripts/build-hooks.js +93 -0
  272. package/scripts/cap-removal-checklist.md +202 -0
  273. package/scripts/prompt-injection-scan.sh +199 -0
  274. package/scripts/run-tests.cjs +181 -0
  275. package/scripts/secret-scan.sh +227 -0
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: cap:migrate
3
+ description: "Migrate GSD Code-First v1.x projects to CAP v2.0 — converts @gsd-* tags, planning artifacts, and session format. Spawns cap-migrator (MODE: GSD)."
4
+ argument-hint: "[--dry-run] [--apply] [--tags-only] [--rescope] [--force] [--allow-large-diff]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Task
10
+ - Glob
11
+ - Grep
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <!-- @cap-feature(feature:F-MIGRATE) /cap:migrate — thin wrapper around cap-migrator (MODE: GSD). -->
16
+ <!-- @cap-decision Wrapper pattern (mirrors /cap:test → cap-validator). All Plan→Diff→Apply→Verify→Rollback logic lives in cap-migrator; this command parses flags and spawns the agent. -->
17
+ <!-- @cap-decision Argument compat: legacy --dry-run is preserved AND remains the default. New --apply flag opts in to write — required by cap-migrator's safety contract. Passing neither = dry-run. -->
18
+ <!-- @cap-decision Legacy --tags-only is forwarded to the agent prompt (agent will run only the migrateTags sub-plan in MODE: GSD). -->
19
+
20
+ <objective>
21
+ Migrate a GSD Code-First v1.x project to CAP v2.0 format. Converts `@gsd-*` tags to `@cap-*` equivalents, transforms `.planning/*` artifacts into FEATURE-MAP.md entries, and migrates `.planning/SESSION.json` to `.cap/SESSION.json`.
22
+
23
+ This command is a thin wrapper that spawns the `cap-migrator` agent in **MODE: GSD**. The agent owns the atomic Plan→Diff→Apply→Verify pipeline with backup + rollback under `.cap/migrations/<id>/`.
24
+
25
+ **Flags (backwards-compatible):**
26
+ - `--dry-run` — preview only, no writes (default; identical to omitting `--apply`).
27
+ - `--apply` — perform the migration. Without this flag the run is a dry-run, regardless of `--dry-run` presence.
28
+ - `--tags-only` — run only the tag-rewrite sub-plan; skip artifact + session migration.
29
+ - `--rescope` — split the root FEATURE-MAP.md into per-app Feature Maps (monorepo only).
30
+ - `--force` — skip the user-confirmation gate.
31
+ - `--allow-large-diff` — bypass the 100 KB / 500-file safety gate after a clean dry-run review.
32
+ </objective>
33
+
34
+ <context>
35
+ $ARGUMENTS
36
+
37
+ @FEATURE-MAP.md
38
+ </context>
39
+
40
+ <process>
41
+
42
+ ## Step 1: Parse flags
43
+
44
+ From `$ARGUMENTS`:
45
+ - `apply = $ARGUMENTS contains "--apply"` (otherwise dry-run)
46
+ - `tags_only = $ARGUMENTS contains "--tags-only"`
47
+ - `rescope = $ARGUMENTS contains "--rescope"`
48
+ - `force = $ARGUMENTS contains "--force"`
49
+ - `allow_large_diff = $ARGUMENTS contains "--allow-large-diff"`
50
+
51
+ `--dry-run` is the default; mention it in the prompt only if explicitly passed (signals user intent).
52
+
53
+ ## Step 2: Spawn cap-migrator (MODE: GSD)
54
+
55
+ Use the Task tool to spawn `cap-migrator` with the prompt below. Forward `$ARGUMENTS` verbatim so the agent sees every flag.
56
+
57
+ ```
58
+ **MODE: GSD**
59
+
60
+ $ARGUMENTS
61
+
62
+ **Flags resolved by /cap:migrate:**
63
+ - apply: {apply}
64
+ - tags_only: {tags_only}
65
+ - rescope: {rescope}
66
+ - force: {force}
67
+ - allow_large_diff: {allow_large_diff}
68
+
69
+ **Sub-plans to compose (MODE: GSD pipeline):**
70
+ 1. migrateTags — rewrite @gsd-* → @cap-*
71
+ {If NOT tags_only:}
72
+ 2. migrateArtifacts — .planning/* → FEATURE-MAP.md entries
73
+ 3. migrateSession — .planning/SESSION.json → .cap/SESSION.json
74
+ {End if}
75
+ {If rescope:}
76
+ 4. rescopeFeatures — split root FEATURE-MAP.md per workspace package (cap-feature-map.cjs::rescopeFeatures). Abort with a clear message if not a monorepo.
77
+ {End if}
78
+
79
+ **Confirmation:**
80
+ {If apply AND NOT force:}
81
+ Use AskUserQuestion before promoting the staged tree:
82
+ > "Proceed with migration? Plan shows N files, +K bytes. Run with --dry-run first to preview."
83
+ {End if}
84
+
85
+ **Output contract:** emit the standard `=== MIGRATION RESULTS ===` block. Include the GSD-specific sub-plan counters (tagsConverted, tagsRemoved, featuresFound, sessionMigrated, rescope distribution if applicable) so the wrapper can render the legacy summary verbatim.
86
+ ```
87
+
88
+ ## Step 3: Render the legacy summary
89
+
90
+ Parse the agent's `=== MIGRATION RESULTS ===` block plus its sub-plan counters, then print:
91
+
92
+ ```
93
+ Migration {Complete | Plan-only}
94
+ ==================
95
+
96
+ Tags: {tagsConverted} converted, {tagsRemoved} removed
97
+ Artifacts: {featuresFound} features extracted → FEATURE-MAP.md
98
+ Session: {sessionMigrated ? 'migrated to .cap/SESSION.json' : 'no session to migrate'}
99
+ {If rescope:}
100
+ Rescope: {appsCreated} apps, {featuresDistributed} features distributed, {featuresKeptAtRoot} kept at root
101
+ {End if}
102
+
103
+ Backup: {tx_backup_path}
104
+ Verify: {PASS | FAIL — reason}
105
+
106
+ {If NOT apply:}
107
+ NOTE: This was a dry run. No files were modified. Run with --apply to execute.
108
+ {Else if PASS:}
109
+ Next steps:
110
+ 1. Review changes with `git diff`
111
+ 2. Run /cap:scan to verify tag migration
112
+ 3. Run /cap:status to see Feature Map state
113
+ 4. Commit migrated files
114
+ {Else:}
115
+ Migration rolled back. Inspect: {tx_dir}
116
+ {End if}
117
+ ```
118
+
119
+ ## Step 4: Update session (only after a successful apply)
120
+
121
+ ```bash
122
+ node -e "
123
+ const session = require('./cap/bin/lib/cap-session.cjs');
124
+ session.updateSession(process.cwd(), {
125
+ lastCommand: '/cap:migrate',
126
+ lastCommandTimestamp: new Date().toISOString()
127
+ });
128
+ "
129
+ ```
130
+
131
+ </process>
@@ -0,0 +1,510 @@
1
+ ---
2
+ name: cap:prototype
3
+ description: Build code for a FEATURE-MAP.md entry, with @cap-feature/@cap-todo annotations inline (Code-First — code IS the plan). TRIGGER when the user asks to implement, build, scaffold, or start coding a feature that has a FEATURE-MAP.md entry in state `planned`, says "build F-XXX / implement this feature / let's start coding X", or after `/cap:brainstorm` when ACs are written and ready to build. Use --architecture for structure-only scaffold, --annotate for retroactive tagging. DO NOT trigger for one-line edits, refactors, features already in state `prototyped` (use cap:iterate), or **Frontend Sprint** visual tweaks (padding/color/spacing/layout on .tsx/.jsx/.css — edit directly, run cap:annotate at sprint end).
4
+ argument-hint: "[path] [--features NAME] [--architecture] [--annotate] [--interactive] [--non-interactive] [--no-branch] [--research] [--skip-docs]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Task
11
+ - Glob
12
+ - Grep
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ <!-- @cap-context CAP v2.0 prototype command -- reads Feature Map as primary input (not PRD). Spawns cap-prototyper in one of 4 modes. Auto-runs /cap:scan on completion. -->
17
+ <!-- @cap-decision Feature Map replaces PRD as prototype input. Feature Map ACs become @cap-todo(ac:FEATURE/AC-N) tags in generated code. -->
18
+ <!-- @cap-decision Auto-chains to /cap:scan on completion -- keeps Feature Map status in sync after code generation. -->
19
+ <!-- @cap-pattern --features flag scopes prototype to specific Feature Map entries (replaces --phases scoping from GSD) -->
20
+
21
+ <objective>
22
+ <!-- @cap-todo(ref:AC-41) /cap:prototype shall invoke the cap-prototyper agent which operates in four modes: prototype, iterate, architecture, and annotate. -->
23
+
24
+ Reads FEATURE-MAP.md, confirms acceptance criteria with the user, then spawns cap-prototyper in the appropriate mode to build annotated code. Each AC becomes a @cap-todo tag in the prototype.
25
+
26
+ On completion, automatically runs `/cap:scan` to update Feature Map status.
27
+
28
+ **Arguments:**
29
+ - `path` -- target directory for prototype output (defaults to project root)
30
+ - `--features NAME` -- scope prototype to specific Feature Map entries (comma-separated)
31
+ - `--architecture` -- skeleton-only mode (folders, interfaces, config, module boundaries)
32
+ - `--annotate` -- retroactively annotate existing code with @cap-feature tags
33
+ - `--interactive` -- pause after each iteration
34
+ - `--non-interactive` -- skip AC confirmation gate (for CI)
35
+ - `--no-branch` -- stay on current branch (skip auto feature-branch creation)
36
+ - `--research` -- explicitly enable F-024 pitfall research (opt-in as of F-044). Default is research SKIPPED — Opus 4.7 already knows most major libraries, so up-front Context7 fetches are redundant in the common case. Use `--research` when prototyping against an unfamiliar SDK or a known-pitfall service (Supabase RLS, Stripe webhooks, OAuth callbacks, etc.).
37
+ - `--skip-docs` -- bypass the F-059 research-first gate entirely (for scaffolding-only features with no external library surface). Default is to run the gate.
38
+ </objective>
39
+
40
+ <context>
41
+ $ARGUMENTS
42
+
43
+ @FEATURE-MAP.md
44
+ @.cap/SESSION.json
45
+ </context>
46
+
47
+ <process>
48
+
49
+ ## Step 0: Parse flags
50
+
51
+ Check `$ARGUMENTS` for:
52
+ - `--features NAME` -- if present, store as `feature_filter` (comma-separated)
53
+ - `--architecture` -- if present, set `mode = "ARCHITECTURE"`
54
+ - `--annotate` -- if present, set `mode = "ANNOTATE"`
55
+ - `--interactive` -- if present, set `interactive_mode = true`
56
+ - `--non-interactive` -- if present, set `non_interactive = true`
57
+ - `--research` -- if present, set `research_mode = true`. Otherwise `research_mode = false` (opt-in as of F-044).
58
+ - `--no-branch` -- if present, set `skip_branch = true`
59
+ - `--skip-docs` -- if present, set `skip_docs = true` (bypass the F-059 research-first gate).
60
+ - `path` -- target directory (defaults to `.`)
61
+
62
+ If neither `--architecture` nor `--annotate`: set `mode = "PROTOTYPE"`
63
+
64
+ Log: "cap:prototype | mode: {mode} | features: {feature_filter or 'all'} | interactive: {interactive_mode}"
65
+
66
+ ## Step 1: Read Feature Map and load active feature
67
+
68
+ ```bash
69
+ node -e "
70
+ const fm = require('./cap/bin/lib/cap-feature-map.cjs');
71
+ const session = require('./cap/bin/lib/cap-session.cjs');
72
+ // @cap-todo(ac:F-081/AC-4 iter:2) Migrated to {safe: true} opt-in to preserve CLI on duplicate-ID FEATURE-MAP.
73
+ // @cap-decision(F-081/iter2) Warn on parseError; continue with partial map for read-only display.
74
+ const featureMap = fm.readFeatureMap(process.cwd(), undefined, { safe: true });
75
+ if (featureMap && featureMap.parseError) {
76
+ console.warn('cap: prototype — duplicate feature ID detected, target list uses partial map: ' + String(featureMap.parseError.message).trim());
77
+ }
78
+ const s = session.loadSession(process.cwd());
79
+ console.log(JSON.stringify({
80
+ activeFeature: s.activeFeature,
81
+ features: featureMap.features.map(f => ({
82
+ id: f.id, title: f.title, state: f.state,
83
+ acs: f.acs, files: f.files, dependencies: f.dependencies
84
+ }))
85
+ }));
86
+ "
87
+ ```
88
+
89
+ Store as `fm_data`.
90
+
91
+ **Scope features:**
92
+ - If `feature_filter` is set: filter to matching feature IDs
93
+ - Else if `fm_data.activeFeature` is set: use only that feature
94
+ - Else: use all features with state `planned` or `prototyped`
95
+
96
+ Store filtered list as `target_features`.
97
+
98
+ If `target_features` is empty: STOP and report:
99
+ > "No features in scope. Run /cap:brainstorm to discover features, or specify --features."
100
+
101
+ ## Step 1b: Create feature branch (unless --no-branch or --annotate)
102
+
103
+ **Skip if `skip_branch` is true, `mode == "ANNOTATE"`, or already on a feature branch.**
104
+
105
+ When prototyping a new feature on `main`, automatically create a feature branch to keep main clean.
106
+
107
+ ```bash
108
+ CURRENT_BRANCH=$(git branch --show-current 2>/dev/null)
109
+ ```
110
+
111
+ If `CURRENT_BRANCH` is `main` or `master` AND `mode` is `PROTOTYPE` or `ARCHITECTURE`:
112
+
113
+ 1. Derive branch name from the first target feature:
114
+ - Take feature ID + title slug: `feature/F-031-conversation-thread-tracking`
115
+ - Slugify: lowercase, replace spaces/special chars with hyphens, max 60 chars
116
+
117
+ ```bash
118
+ git checkout -b "feature/{feature_id}-{slug}" 2>/dev/null
119
+ ```
120
+
121
+ 2. Log: `Created branch: feature/{feature_id}-{slug}`
122
+
123
+ If `CURRENT_BRANCH` is already a `feature/` branch: stay on it, log: `Already on feature branch: {CURRENT_BRANCH}`
124
+
125
+ If git is not available or not a git repo: skip silently.
126
+
127
+ ## Step 1c: Research-First Gate (F-059)
128
+
129
+ <!-- @cap-todo(ac:F-059/AC-1) Scope AC descriptions to target_features and parse library mentions against package.json. -->
130
+ <!-- @cap-todo(ac:F-059/AC-2) Check .cap/stack-docs/{library}.md mtime vs 30-day threshold. -->
131
+ <!-- @cap-todo(ac:F-059/AC-4) --skip-docs bypasses the gate entirely for scaffolding-only features. -->
132
+ <!-- @cap-todo(ac:F-059/AC-5) Gate never hard-blocks — default flow is warning + user prompt. -->
133
+
134
+ **Skip this step** if any of:
135
+ - `skip_docs` is true (`--skip-docs` flag)
136
+ - `non_interactive` is true (CI flow cannot prompt)
137
+ - `mode == "ANNOTATE"` (retrofitting tags, not building against libs)
138
+
139
+ Otherwise, run the gate against the AC descriptions of `target_features`:
140
+
141
+ ```bash
142
+ node -e "
143
+ const gate = require('./cap/bin/lib/cap-research-gate.cjs');
144
+ const target = JSON.parse(process.env.CAP_TARGET_FEATURES || '[]');
145
+ const acs = target.flatMap(f => (f.acs || []).map(a => a.description || ''));
146
+ const result = gate.runGate({ projectRoot: process.cwd(), acDescriptions: acs });
147
+ const warning = gate.formatWarning(result);
148
+ console.log(JSON.stringify({ result, warning }));
149
+ "
150
+ ```
151
+
152
+ where `CAP_TARGET_FEATURES` is the JSON-encoded `target_features` array from Step 1.
153
+
154
+ Parse the JSON output. If `warning` is a non-empty string:
155
+
156
+ 1. Print `warning` verbatim to the user.
157
+ 2. Ask the user: "Proceed anyway? [y/N]"
158
+ 3. On `y` / `yes`: continue to Step 2.
159
+ 4. On anything else (including empty input / `N` / Ctrl+C): STOP with message "Aborted by research-first gate. Run `npx ctx7@latest docs <lib> ...` to refresh, or retry with `--skip-docs`." Do not spawn the prototyper.
160
+
161
+ Regardless of whether the gate fired or was skipped, log the outcome:
162
+
163
+ ```bash
164
+ node -e "
165
+ const gate = require('./cap/bin/lib/cap-research-gate.cjs');
166
+ const r = JSON.parse(process.env.CAP_GATE_RESULT || '{}');
167
+ gate.logGateCheck(process.cwd(), {
168
+ skipped: process.env.CAP_GATE_SKIPPED === '1',
169
+ libsChecked: (r.libraries || []).length,
170
+ missing: (r.missing || []).length,
171
+ stale: (r.stale || []).length,
172
+ });
173
+ "
174
+ ```
175
+
176
+ <!-- @cap-todo(ac:F-059/AC-3) Warning includes ctx7 refresh recommendation + y/N prompt — emitted by formatWarning. -->
177
+ <!-- @cap-todo(ac:F-059/AC-6) logGateCheck appends a JSONL event with libsChecked + missing counts to .cap/session-log.jsonl. -->
178
+
179
+ ## Step 2: Present ACs for confirmation
180
+
181
+ **Skip if `non_interactive` or `mode == "ANNOTATE"`.**
182
+
183
+ <!-- @cap-todo(ref:AC-42) In prototype mode, the agent shall build a working prototype for a feature, annotating code with @cap-feature and @cap-todo tags as it builds. -->
184
+ <!-- @cap-todo(ref:AC-44) In architecture mode, the agent shall analyze and refactor system-level structure without changing feature behavior. -->
185
+ <!-- @cap-todo(ref:AC-45) In annotate mode, the agent shall retroactively annotate existing code with @cap-feature and @cap-todo tags. -->
186
+
187
+ Collect all ACs from target_features:
188
+
189
+ ```
190
+ Features to prototype ({target_features.length}):
191
+
192
+ {For each feature:}
193
+ {feature.id}: {feature.title} [{feature.state}]
194
+ {For each AC:}
195
+ {ac.id}: {ac.description} [{ac.status}]
196
+ {End for}
197
+ {End for}
198
+
199
+ Total ACs: {total_ac_count}
200
+ ```
201
+
202
+ Use AskUserQuestion:
203
+ > "Review the {total_ac_count} acceptance criteria above. Proceed with {mode} mode? [yes / provide corrections]"
204
+
205
+ - If `yes`: proceed to Step 3
206
+ - If corrections: incorporate and re-display
207
+
208
+ ## Step 2b: Pitfall Research (only when --research is set)
209
+
210
+ <!-- @cap-feature(feature:F-024) Pre-Work Pitfall Research -->
211
+ <!-- @cap-feature(feature:F-044) Audit and Right-Size Agent Behaviors for Opus 4.7 -->
212
+ <!-- @cap-todo(ac:F-024/AC-1) Detect technologies/services from package.json, ACs, code context -->
213
+ <!-- @cap-todo(ac:F-024/AC-2) Research known pitfalls via Context7 and web search -->
214
+ <!-- @cap-todo(ac:F-044/AC-2) Pitfall research is now opt-in via --research instead of always-on -->
215
+ <!-- @cap-decision(F-044/AC-2) Flipped from always-on (--skip-research opt-out) to opt-in (--research). -->
216
+ <!-- Opus 4.7 already knows most major libraries; up-front Context7 fetches were redundant in the common case. -->
217
+ <!-- The `research_mode` flag from Step 0 gates this entire step. -->
218
+
219
+ **Skip this step if `research_mode` is false (default) or `mode == "ANNOTATE"`.**
220
+
221
+ **Only run this block when `research_mode` is true (set by --research flag).**
222
+
223
+ **Detect technologies involved:**
224
+
225
+ ```bash
226
+ node -e "
227
+ const fs = require('node:fs');
228
+ const path = require('node:path');
229
+ const cwd = process.cwd();
230
+ const techs = new Set();
231
+
232
+ // From package.json dependencies
233
+ const pkgPath = path.join(cwd, 'package.json');
234
+ if (fs.existsSync(pkgPath)) {
235
+ try {
236
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
237
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
238
+ for (const dep of Object.keys(allDeps)) {
239
+ // Major frameworks and services that have known pitfalls
240
+ const known = ['supabase','firebase','prisma','drizzle','next','nuxt','react','vue','svelte','express','fastify','stripe','auth0','clerk','passport','redis','postgres','mongodb','docker','kubernetes','vercel','netlify','aws-sdk','@aws-sdk','googleapis','twilio','sendgrid','socket.io','trpc','graphql','apollo'];
241
+ if (known.some(k => dep.includes(k))) techs.add(dep);
242
+ }
243
+ } catch(_) {}
244
+ }
245
+
246
+ // From AC descriptions
247
+ const targetACs = ${JSON.stringify([])}; // placeholder — filled by command layer
248
+ console.log(JSON.stringify([...techs]));
249
+ "
250
+ ```
251
+
252
+ Also scan the AC descriptions for technology keywords:
253
+
254
+ Extract technology names from the target features' ACs by matching common service/framework names (Supabase, Firebase, Stripe, OAuth, SSO, Redis, Docker, etc.).
255
+
256
+ Store combined list as `detected_techs`.
257
+
258
+ **If detected_techs is not empty:**
259
+
260
+ <!-- @cap-todo(ac:F-024/AC-3) Present pitfall briefing to user -->
261
+ <!-- @cap-todo(ac:F-024/AC-4) Prioritize critical pitfalls at top -->
262
+
263
+ For each detected technology, run Context7 docs fetch if not cached:
264
+
265
+ ```bash
266
+ npx ctx7@latest docs {library_id} "common pitfalls problems gotchas migration issues" 2>/dev/null | head -200
267
+ ```
268
+
269
+ Also search for known issues:
270
+
271
+ ```bash
272
+ npx ctx7@latest library {tech_name} "known issues pitfalls" 2>/dev/null | head -50
273
+ ```
274
+
275
+ **Compile the Pitfall Briefing** from research results. Categorize findings:
276
+
277
+ ```
278
+ 🔍 Pitfall Research: {comma-separated tech names}
279
+
280
+ ⚠️ CRITICAL (likely to cause hours of debugging):
281
+ {N}. {pitfall description + workaround}
282
+
283
+ 📋 COMMON MISTAKES:
284
+ {N}. {pitfall description + workaround}
285
+
286
+ 💡 GOOD TO KNOW:
287
+ {N}. {tip or best practice}
288
+ ```
289
+
290
+ Display the briefing to the user.
291
+
292
+ <!-- @cap-todo(ac:F-024/AC-6) Persist briefing in .cap/pitfalls/ -->
293
+
294
+ **Save the briefing:**
295
+
296
+ Write `.cap/pitfalls/{feature_id}.md` using the Write tool with the pitfall briefing content.
297
+
298
+ ```bash
299
+ mkdir -p .cap/pitfalls
300
+ ```
301
+
302
+ <!-- @cap-todo(ac:F-024/AC-5) Agent receives briefing as context -->
303
+
304
+ Store as `pitfall_briefing` — this will be passed to the cap-prototyper agent in Step 3.
305
+
306
+ **If detected_techs is empty:**
307
+
308
+ Log: "No known-pitfall technologies detected. Skipping research."
309
+
310
+ ## Step 3: Derive project context and spawn cap-prototyper
311
+
312
+ <!-- @cap-todo(ref:AC-47) cap-prototyper shall derive project context (language, framework, conventions) from actual code on first invocation. -->
313
+ <!-- @cap-todo(ref:AC-48) cap-prototyper shall follow deviation rules via a shared reference document. -->
314
+
315
+ Detect project conventions:
316
+
317
+ ```bash
318
+ node -e "
319
+ const fs = require('node:fs');
320
+ const path = require('node:path');
321
+ const cwd = process.cwd();
322
+ const conventions = {};
323
+
324
+ // Package.json conventions
325
+ if (fs.existsSync(path.join(cwd, 'package.json'))) {
326
+ const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
327
+ conventions.type = pkg.type || 'commonjs';
328
+ conventions.scripts = Object.keys(pkg.scripts || {});
329
+ }
330
+
331
+ // Check for config files
332
+ conventions.hasEslint = fs.existsSync(path.join(cwd, '.eslintrc.json')) || fs.existsSync(path.join(cwd, '.eslintrc.js'));
333
+ conventions.hasPrettier = fs.existsSync(path.join(cwd, '.prettierrc'));
334
+ conventions.hasTsconfig = fs.existsSync(path.join(cwd, 'tsconfig.json'));
335
+
336
+ // Detect naming patterns from existing files
337
+ const entries = fs.readdirSync(path.join(cwd, 'cap/bin/lib')).filter(f => f.endsWith('.cjs'));
338
+ conventions.namingPattern = entries.length > 0 ? 'kebab-case.cjs' : 'unknown';
339
+
340
+ console.log(JSON.stringify(conventions));
341
+ "
342
+ ```
343
+
344
+ Store as `conventions`.
345
+
346
+ Load .cap/stack-docs/ if available:
347
+
348
+ ```bash
349
+ ls .cap/stack-docs/*.md 2>/dev/null | head -10 || echo "no stack docs"
350
+ ```
351
+
352
+ Spawn `cap-prototyper` via Task tool:
353
+
354
+ **MODE: PROTOTYPE prompt:**
355
+ ```
356
+ $ARGUMENTS
357
+
358
+ **MODE: {mode}**
359
+
360
+ **Target features:**
361
+ {For each target_feature:}
362
+ Feature: {feature.id} - {feature.title} [{feature.state}]
363
+ Dependencies: {feature.dependencies.join(', ') or 'none'}
364
+ {For each AC:}
365
+ {ac.id}: {ac.description}
366
+ {End for}
367
+ {End for}
368
+
369
+ **Project conventions:**
370
+ {JSON.stringify(conventions)}
371
+
372
+ **Tag obligations:**
373
+ - Every significant function/class/module gets @cap-feature(feature:{ID}) linking to FEATURE-MAP.md
374
+ - Every AC gets @cap-todo(ac:{FEATURE-ID}/AC-N) placed where the implementation happens
375
+ - Risk areas get @cap-risk tags
376
+ - Design decisions get @cap-decision tags
377
+
378
+ **Deviation rules:**
379
+ If you need to deviate from the Feature Map specification (e.g., an AC is impractical, dependencies changed), document the deviation with:
380
+ // @cap-decision Deviated from {FEATURE-ID}/AC-N: {reason}
381
+ Do not silently skip ACs. Every AC must have either an implementation tag or a deviation tag.
382
+
383
+ {If mode == "ARCHITECTURE":}
384
+ Generate ONLY structural artifacts:
385
+ 1. Folder structure with index/barrel files at module boundaries
386
+ 2. Config files matching existing project conventions
387
+ 3. Typed interfaces and type definitions for module boundaries
388
+ 4. Entry point stubs
389
+ 5. @cap-decision tags at every module boundary
390
+ ZERO feature implementation code.
391
+ {End if}
392
+
393
+ {If mode == "ANNOTATE":}
394
+ Do NOT create new files. Only EDIT existing files to add @cap-feature and @cap-todo tags.
395
+ Scan the target directory for source files, read each, and add appropriate tags.
396
+ {End if}
397
+
398
+ {If stack docs available:}
399
+ **Stack documentation available in .cap/stack-docs/:**
400
+ {list of available docs}
401
+ Read these before generating code that uses those libraries.
402
+ {End if}
403
+
404
+ {If pitfall_briefing:}
405
+ **⚠️ PITFALL BRIEFING — Read before writing code:**
406
+ {pitfall_briefing}
407
+ You MUST account for these known pitfalls in your implementation.
408
+ If an AC conflicts with a pitfall workaround, document the deviation with @cap-decision.
409
+ {End if}
410
+ ```
411
+
412
+ Wait for cap-prototyper to complete.
413
+
414
+ ## Step 4: Update Feature Map state
415
+
416
+ <!-- @cap-todo(ref:AC-46) cap-prototyper shall update the feature state in FEATURE-MAP.md from planned to prototyped upon completing a prototype. -->
417
+
418
+ If `mode == "PROTOTYPE"`:
419
+
420
+ ```bash
421
+ node -e "
422
+ const fm = require('./cap/bin/lib/cap-feature-map.cjs');
423
+ const targetIds = {JSON.stringify(target_feature_ids)};
424
+ for (const id of targetIds) {
425
+ const result = fm.updateFeatureState(process.cwd(), id, 'prototyped');
426
+ console.log(id + ': ' + (result ? 'updated to prototyped' : 'state unchanged'));
427
+ }
428
+ "
429
+ ```
430
+
431
+ ## Step 5: Auto-run /cap:scan
432
+
433
+ <!-- @cap-todo(ref:AC-43) In iterate mode, the agent shall refine an existing prototype based on feedback, updating tags and Feature Map state. -->
434
+
435
+ ```bash
436
+ node -e "
437
+ const scanner = require('./cap/bin/lib/cap-tag-scanner.cjs');
438
+ const fm = require('./cap/bin/lib/cap-feature-map.cjs');
439
+ const tags = scanner.scanDirectory(process.cwd());
440
+ const updated = fm.enrichFromTags(process.cwd(), tags);
441
+ const groups = scanner.groupByFeature(tags);
442
+ console.log(JSON.stringify({
443
+ totalTags: tags.length,
444
+ featuresEnriched: updated.features.filter(f => f.files.length > 0).length,
445
+ featureGroups: Object.keys(groups).length
446
+ }));
447
+ "
448
+ ```
449
+
450
+ ## Step 6: Update session and report
451
+
452
+ ```bash
453
+ node -e "
454
+ const session = require('./cap/bin/lib/cap-session.cjs');
455
+ session.updateSession(process.cwd(), {
456
+ lastCommand: '/cap:prototype',
457
+ lastCommandTimestamp: new Date().toISOString(),
458
+ step: 'prototype-complete'
459
+ });
460
+ "
461
+ ```
462
+
463
+ ```
464
+ cap:prototype complete ({mode} mode).
465
+
466
+ Features processed: {target_features.length}
467
+ ```
468
+
469
+ <!-- @cap-feature(feature:F-023) Emoji-Enhanced AC Status -->
470
+ <!-- @cap-todo(ac:F-023/AC-1) Display AC table with emoji status after prototype -->
471
+ <!-- @cap-todo(ac:F-023/AC-6) Emojis in terminal output only, not in stored files -->
472
+
473
+ **Display the AC status table with emojis (terminal output only):**
474
+
475
+ Load the current Feature Map and display each AC for the target features:
476
+
477
+ ```bash
478
+ node -e "
479
+ const fm = require('./cap/bin/lib/cap-feature-map.cjs');
480
+ // @cap-todo(ac:F-081/AC-4 iter:2) Migrated to {safe: true} opt-in to preserve CLI on duplicate-ID FEATURE-MAP.
481
+ // @cap-decision(F-081/iter2) Warn on parseError; continue with partial map for read-only display.
482
+ const featureMap = fm.readFeatureMap(process.cwd(), undefined, { safe: true });
483
+ if (featureMap && featureMap.parseError) {
484
+ console.warn('cap: prototype AC-table — duplicate feature ID detected, table uses partial map: ' + String(featureMap.parseError.message).trim());
485
+ }
486
+ const targetIds = {JSON.stringify(target_feature_ids)};
487
+ for (const id of targetIds) {
488
+ const f = featureMap.features.find(feat => feat.id === id);
489
+ if (!f) continue;
490
+ console.log('\n ' + f.id + ': ' + f.title + ' [' + f.state + ']');
491
+ for (const ac of f.acs) {
492
+ const emoji = ac.status === 'tested' ? '✅' : ac.status === 'prototyped' ? '🔨' : ac.status === 'partial' ? '⚠️' : '📋';
493
+ console.log(' ' + emoji + ' ' + ac.id + ': ' + ac.description);
494
+ }
495
+ }
496
+ "
497
+ ```
498
+
499
+ ```
500
+ Tag scan results:
501
+ Total @cap-* tags: {scan_result.totalTags}
502
+ Features with file refs: {scan_result.featuresEnriched}
503
+
504
+ Next steps:
505
+ - Run /cap:iterate to refine the prototype
506
+ - Run /cap:test to write tests against the ACs
507
+ - Run /cap:scan for detailed tag report
508
+ ```
509
+
510
+ </process>