cc-devflow 4.3.0 → 4.4.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 (575) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +64 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +212 -0
  3. package/.claude/skills/cc-act/SKILL.md +322 -0
  4. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +64 -0
  5. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +25 -0
  6. package/.claude/skills/cc-act/references/closure-contract.md +49 -0
  7. package/.claude/skills/cc-act/references/git-commit-guidelines.md +83 -0
  8. package/.claude/skills/cc-act/scripts/archive-requirement.sh +49 -0
  9. package/.claude/skills/cc-act/scripts/cc-act-common.sh +240 -0
  10. package/.claude/skills/cc-act/scripts/detect-ship-target.sh +82 -0
  11. package/.claude/skills/cc-act/scripts/generate-status-report.sh +83 -0
  12. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +195 -0
  13. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +315 -0
  14. package/.claude/skills/cc-act/scripts/verify-act-gate.sh +63 -0
  15. package/.claude/skills/cc-check/CHANGELOG.md +73 -0
  16. package/.claude/skills/cc-check/PLAYBOOK.md +153 -0
  17. package/.claude/skills/cc-check/SKILL.md +345 -0
  18. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +50 -0
  19. package/.claude/skills/cc-check/references/gate-contract.md +29 -0
  20. package/.claude/skills/cc-check/references/review-contract.md +45 -0
  21. package/.claude/skills/cc-check/scripts/render-report-card.js +229 -0
  22. package/.claude/skills/cc-check/scripts/run-quality-gates.sh +86 -0
  23. package/.claude/skills/cc-check/scripts/verify-gate.sh +57 -0
  24. package/.claude/skills/cc-do/CHANGELOG.md +49 -0
  25. package/.claude/skills/cc-do/PLAYBOOK.md +119 -0
  26. package/.claude/skills/cc-do/SKILL.md +216 -0
  27. package/.claude/skills/cc-do/references/execution-recovery.md +86 -0
  28. package/.claude/skills/cc-do/references/parallel-dispatch.md +80 -0
  29. package/.claude/skills/cc-do/scripts/build-task-context.sh +184 -0
  30. package/.claude/skills/cc-do/scripts/cc-do-common.sh +79 -0
  31. package/.claude/skills/cc-do/scripts/check-task-status.sh +92 -0
  32. package/.claude/skills/cc-do/scripts/detect-file-conflicts.sh +87 -0
  33. package/.claude/skills/cc-do/scripts/mark-task-complete.sh +119 -0
  34. package/.claude/skills/cc-do/scripts/record-review-decision.sh +89 -0
  35. package/.claude/skills/cc-do/scripts/recover-workflow.sh +84 -0
  36. package/.claude/skills/cc-do/scripts/run-problem-analysis.sh +70 -0
  37. package/.claude/skills/cc-do/scripts/select-ready-tasks.sh +135 -0
  38. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +94 -0
  39. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +102 -0
  40. package/.claude/skills/cc-investigate/CHANGELOG.md +26 -0
  41. package/.claude/skills/cc-investigate/PLAYBOOK.md +49 -0
  42. package/.claude/skills/cc-investigate/SKILL.md +221 -0
  43. package/.claude/skills/cc-investigate/assets/ANALYSIS_TEMPLATE.md +55 -0
  44. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +52 -0
  45. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +103 -0
  46. package/.claude/skills/cc-investigate/references/investigation-contract.md +28 -0
  47. package/.claude/skills/cc-investigate/scripts/bootstrap-analysis.sh +38 -0
  48. package/.claude/skills/cc-plan/CHANGELOG.md +99 -0
  49. package/.claude/skills/cc-plan/PLAYBOOK.md +106 -0
  50. package/.claude/skills/cc-plan/SKILL.md +325 -0
  51. package/.claude/skills/cc-plan/assets/DESIGN_TEMPLATE.md +155 -0
  52. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +98 -0
  53. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +108 -0
  54. package/.claude/skills/cc-plan/assets/TINY_DESIGN_TEMPLATE.md +79 -0
  55. package/.claude/skills/cc-plan/references/planning-contract.md +82 -0
  56. package/.claude/skills/cc-plan/scripts/bump-skill-version.sh +103 -0
  57. package/.claude/skills/cc-plan/scripts/parse-task-dependencies.js +75 -0
  58. package/.claude/skills/cc-plan/scripts/validate-scope.sh +78 -0
  59. package/.claude/skills/cc-roadmap/CHANGELOG.md +114 -0
  60. package/.claude/skills/cc-roadmap/PLAYBOOK.md +136 -0
  61. package/.claude/skills/cc-roadmap/SKILL.md +259 -0
  62. package/.claude/skills/cc-roadmap/assets/BACKLOG_TEMPLATE.md +45 -0
  63. package/.claude/skills/cc-roadmap/assets/ROADMAP_TEMPLATE.md +153 -0
  64. package/.claude/skills/cc-roadmap/assets/TRACKING_TEMPLATE.json +48 -0
  65. package/.claude/skills/cc-roadmap/references/roadmap-dialogue.md +37 -0
  66. package/.claude/skills/cc-roadmap/scripts/bump-skill-version.sh +103 -0
  67. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/markdown.js +604 -0
  68. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/query.js +63 -0
  69. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/schema.js +245 -0
  70. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/store.js +139 -0
  71. package/.claude/skills/cc-roadmap/scripts/locate-roadmap-item.sh +109 -0
  72. package/.claude/skills/cc-roadmap/scripts/roadmap-tracking.js +153 -0
  73. package/.claude/skills/cc-roadmap/scripts/sync-roadmap-progress.sh +100 -0
  74. package/.claude/skills/cc-simplify/CHANGELOG.md +10 -0
  75. package/.claude/skills/cc-simplify/SKILL.md +55 -0
  76. package/.claude/skills/cc-spec-init/CHANGELOG.md +7 -0
  77. package/.claude/skills/cc-spec-init/PLAYBOOK.md +55 -0
  78. package/.claude/skills/cc-spec-init/SKILL.md +127 -0
  79. package/.claude/skills/cc-spec-init/assets/CAPABILITY_TEMPLATE.md +63 -0
  80. package/.claude/skills/cc-spec-init/assets/CHANGE_META_TEMPLATE.json +25 -0
  81. package/.claude/skills/cc-spec-init/assets/INDEX_TEMPLATE.md +34 -0
  82. package/.claude/skills/cc-spec-init/references/spec-contract.md +22 -0
  83. package/.claude/skills/cc-spec-init/scripts/bootstrap-specs.sh +31 -0
  84. package/.claude/skills/cc-spec-init/scripts/validate-spec-links.sh +45 -0
  85. package/CHANGELOG.md +61 -4
  86. package/README.md +120 -756
  87. package/README.zh-CN.md +119 -756
  88. package/bin/adapt.js +2 -6
  89. package/bin/cc-devflow-cli.js +72 -177
  90. package/config/distributable-skills.json +24 -0
  91. package/docs/CLAUDE.md +10 -6
  92. package/docs/commands/README.md +19 -46
  93. package/docs/commands/README.zh-CN.md +25 -48
  94. package/docs/examples/BY-ARTIFACT.md +7 -0
  95. package/docs/examples/README.md +38 -0
  96. package/docs/examples/START-HERE.md +149 -0
  97. package/docs/examples/example-bindings.json +38 -0
  98. package/docs/examples/full-design-blocked/BACKLOG.md +45 -0
  99. package/docs/examples/full-design-blocked/README.md +55 -0
  100. package/docs/examples/full-design-blocked/ROADMAP.md +53 -0
  101. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +154 -0
  102. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +146 -0
  103. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +78 -0
  104. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +52 -0
  105. package/docs/examples/full-design-blocked/roadmap-tracking.json +50 -0
  106. package/docs/examples/local-handoff/BACKLOG.md +45 -0
  107. package/docs/examples/local-handoff/README.md +56 -0
  108. package/docs/examples/local-handoff/ROADMAP.md +45 -0
  109. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/resume-index.md +39 -0
  110. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/status.md +29 -0
  111. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +71 -0
  112. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +98 -0
  113. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +59 -0
  114. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +44 -0
  115. package/docs/examples/local-handoff/roadmap-tracking.json +48 -0
  116. package/docs/examples/pdca-loop/BACKLOG.md +46 -0
  117. package/docs/examples/pdca-loop/README.md +58 -0
  118. package/docs/examples/pdca-loop/ROADMAP.md +133 -0
  119. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +72 -0
  120. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/status.md +29 -0
  121. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +72 -0
  122. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +201 -0
  123. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +73 -0
  124. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +44 -0
  125. package/docs/examples/pdca-loop/roadmap-tracking.json +114 -0
  126. package/docs/examples/scripts/check-example-bindings.sh +116 -0
  127. package/docs/guides/getting-started.md +94 -129
  128. package/docs/guides/getting-started.zh-CN.md +103 -84
  129. package/docs/skill-runtime-migration.md +46 -0
  130. package/docs/v4.3.0-migration-guide.md +60 -225
  131. package/lib/compiler/CLAUDE.md +55 -84
  132. package/lib/compiler/__tests__/drift.test.js +1 -1
  133. package/lib/compiler/__tests__/errors.test.js +0 -1
  134. package/lib/compiler/__tests__/integration.test.js +49 -3
  135. package/lib/compiler/__tests__/manifest.test.js +0 -156
  136. package/lib/compiler/__tests__/parser.test.js +33 -104
  137. package/lib/compiler/__tests__/schemas.test.js +30 -34
  138. package/lib/compiler/__tests__/skills-registry.test.js +114 -0
  139. package/lib/compiler/__tests__/transformer.test.js +5 -9
  140. package/lib/compiler/emitters/antigravity-emitter.js +5 -213
  141. package/lib/compiler/emitters/base-emitter.js +3 -298
  142. package/lib/compiler/emitters/codex-emitter.js +4 -202
  143. package/lib/compiler/emitters/cursor-emitter.js +3 -287
  144. package/lib/compiler/emitters/qwen-emitter.js +4 -176
  145. package/lib/compiler/index.js +65 -345
  146. package/lib/compiler/manifest.js +6 -68
  147. package/lib/compiler/parser.js +31 -63
  148. package/lib/compiler/platforms.js +32 -277
  149. package/lib/compiler/resource-copier.js +176 -6
  150. package/lib/compiler/rules-emitters/__tests__/antigravity-rules-emitter.test.js +3 -3
  151. package/lib/compiler/rules-emitters/__tests__/cursor-rules-emitter.test.js +14 -4
  152. package/lib/compiler/rules-emitters/__tests__/qwen-rules-emitter.test.js +16 -7
  153. package/lib/compiler/rules-emitters/antigravity-rules-emitter.js +10 -15
  154. package/lib/compiler/rules-emitters/base-rules-emitter.js +5 -5
  155. package/lib/compiler/rules-emitters/cursor-rules-emitter.js +7 -12
  156. package/lib/compiler/rules-emitters/index.js +6 -3
  157. package/lib/compiler/rules-emitters/qwen-rules-emitter.js +7 -7
  158. package/lib/compiler/schemas.js +8 -4
  159. package/lib/compiler/skills-registry.js +213 -15
  160. package/lib/compiler/transformer.js +1 -1
  161. package/lib/skill-runtime/CLAUDE.md +19 -0
  162. package/lib/skill-runtime/__tests__/autopilot.test.js +210 -0
  163. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +181 -0
  164. package/lib/skill-runtime/__tests__/delegation.test.js +97 -0
  165. package/lib/skill-runtime/__tests__/dispatch.test.js +267 -0
  166. package/lib/skill-runtime/__tests__/intent.test.js +219 -0
  167. package/lib/skill-runtime/__tests__/lifecycle.test.js +169 -0
  168. package/lib/skill-runtime/__tests__/paths.test.js +42 -0
  169. package/lib/skill-runtime/__tests__/planner.tdd.test.js +250 -0
  170. package/lib/skill-runtime/__tests__/prepare-pr.test.js +139 -0
  171. package/lib/skill-runtime/__tests__/query.test.js +284 -0
  172. package/lib/skill-runtime/__tests__/runtime.integration.test.js +279 -0
  173. package/lib/skill-runtime/__tests__/schemas.test.js +207 -0
  174. package/lib/skill-runtime/__tests__/team-state.test.js +51 -0
  175. package/lib/skill-runtime/__tests__/worker-run.test.js +253 -0
  176. package/lib/skill-runtime/__tests__/worker.test.js +56 -0
  177. package/lib/skill-runtime/artifacts.js +93 -0
  178. package/lib/skill-runtime/delegation.js +533 -0
  179. package/lib/skill-runtime/index.js +34 -0
  180. package/lib/skill-runtime/intent.js +333 -0
  181. package/lib/skill-runtime/lifecycle.js +294 -0
  182. package/lib/skill-runtime/operations/CLAUDE.md +19 -0
  183. package/lib/skill-runtime/operations/approve.js +66 -0
  184. package/lib/skill-runtime/operations/autopilot-core.js +337 -0
  185. package/lib/skill-runtime/operations/autopilot-execution.js +307 -0
  186. package/lib/skill-runtime/operations/autopilot-shared.js +48 -0
  187. package/lib/skill-runtime/operations/autopilot.js +163 -0
  188. package/lib/skill-runtime/operations/dispatch.js +454 -0
  189. package/lib/skill-runtime/operations/init.js +64 -0
  190. package/lib/{harness → skill-runtime}/operations/janitor.js +9 -6
  191. package/lib/skill-runtime/operations/plan.js +59 -0
  192. package/lib/skill-runtime/operations/prepare-pr.js +25 -0
  193. package/lib/skill-runtime/operations/release.js +96 -0
  194. package/lib/skill-runtime/operations/resume.js +143 -0
  195. package/lib/skill-runtime/operations/snapshot.js +45 -0
  196. package/lib/skill-runtime/operations/verify.js +170 -0
  197. package/lib/skill-runtime/operations/worker-run.js +529 -0
  198. package/lib/skill-runtime/operations/worker.js +33 -0
  199. package/lib/skill-runtime/paths.js +213 -0
  200. package/lib/skill-runtime/planner.js +519 -0
  201. package/lib/skill-runtime/query.js +157 -0
  202. package/lib/skill-runtime/review.js +557 -0
  203. package/lib/skill-runtime/schemas.js +400 -0
  204. package/lib/{harness → skill-runtime}/store.js +45 -30
  205. package/lib/skill-runtime/team-state.js +122 -0
  206. package/package.json +13 -11
  207. package/.claude/CLAUDE.md +0 -125
  208. package/.claude/agents/architecture-designer.md +0 -443
  209. package/.claude/agents/bug-analyzer.md +0 -381
  210. package/.claude/agents/checklist-agent.md +0 -175
  211. package/.claude/agents/clarify-analyst.md +0 -50
  212. package/.claude/agents/code-quality-reviewer.md +0 -205
  213. package/.claude/agents/code-reviewer.md +0 -71
  214. package/.claude/agents/codex-analyzer.md +0 -39
  215. package/.claude/agents/compatibility-checker.md +0 -579
  216. package/.claude/agents/consistency-checker.md +0 -532
  217. package/.claude/agents/dev-implementer.md +0 -195
  218. package/.claude/agents/flow-researcher.md +0 -132
  219. package/.claude/agents/impact-analyzer.md +0 -440
  220. package/.claude/agents/planner.md +0 -230
  221. package/.claude/agents/prd-writer.md +0 -320
  222. package/.claude/agents/project-guidelines-generator.md +0 -1329
  223. package/.claude/agents/qa-tester.md +0 -313
  224. package/.claude/agents/release-manager.md +0 -295
  225. package/.claude/agents/security-reviewer.md +0 -314
  226. package/.claude/agents/spec-reviewer.md +0 -221
  227. package/.claude/agents/style-guide-generator.md +0 -458
  228. package/.claude/agents/tech-architect.md +0 -516
  229. package/.claude/agents/ui-designer.md +0 -485
  230. package/.claude/commands/core/architecture.md +0 -459
  231. package/.claude/commands/core/guidelines.md +0 -511
  232. package/.claude/commands/core/roadmap.md +0 -468
  233. package/.claude/commands/core/style.md +0 -83
  234. package/.claude/commands/flow/CLAUDE.md +0 -24
  235. package/.claude/commands/flow/archive.md +0 -280
  236. package/.claude/commands/flow/constitution.md +0 -82
  237. package/.claude/commands/flow/context.md +0 -150
  238. package/.claude/commands/flow/delta.md +0 -245
  239. package/.claude/commands/flow/dev.md +0 -40
  240. package/.claude/commands/flow/fix.md +0 -217
  241. package/.claude/commands/flow/ideate.md +0 -214
  242. package/.claude/commands/flow/init.md +0 -38
  243. package/.claude/commands/flow/release.md +0 -36
  244. package/.claude/commands/flow/restart.md +0 -97
  245. package/.claude/commands/flow/spec.md +0 -36
  246. package/.claude/commands/flow/status.md +0 -64
  247. package/.claude/commands/flow/update.md +0 -111
  248. package/.claude/commands/flow/upgrade.md +0 -115
  249. package/.claude/commands/flow/verify.md +0 -37
  250. package/.claude/commands/flow/workspace.md +0 -155
  251. package/.claude/commands/util/cancel-ralph.md +0 -60
  252. package/.claude/commands/util/code-review.md +0 -58
  253. package/.claude/commands/util/git-commit.md +0 -422
  254. package/.claude/commands/util/problem-analyzer.md +0 -60
  255. package/.claude/config/quality-gates.yml +0 -305
  256. package/.claude/config/quality-rules.yml +0 -161
  257. package/.claude/docs/SPEC_KIT_CONSTITUTION_ANALYSIS.md +0 -426
  258. package/.claude/docs/design/consistency-conflict-detection-algorithms.md +0 -658
  259. package/.claude/docs/design/intent-driven-input-design.md +0 -380
  260. package/.claude/docs/design/prd-version-management-design.md +0 -437
  261. package/.claude/docs/examples/design-inspiration-pool.md +0 -59
  262. package/.claude/docs/examples/ui-prototype-constitution-checklist.md +0 -75
  263. package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +0 -117
  264. package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +0 -99
  265. package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +0 -188
  266. package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +0 -338
  267. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -312
  268. package/.claude/docs/implementation-summary-v7.md +0 -449
  269. package/.claude/docs/spec-format-guide.md +0 -349
  270. package/.claude/docs/state-consolidation-design.md +0 -323
  271. package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +0 -332
  272. package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +0 -156
  273. package/.claude/docs/templates/BACKLOG_TEMPLATE.md +0 -261
  274. package/.claude/docs/templates/BRAINSTORM_TEMPLATE.md +0 -148
  275. package/.claude/docs/templates/CHECKLIST_TEMPLATE.md +0 -52
  276. package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +0 -206
  277. package/.claude/docs/templates/CODE_REVIEW_TEMPLATE.md +0 -71
  278. package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +0 -91
  279. package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +0 -151
  280. package/.claude/docs/templates/DESIGN_TEMPLATE.md +0 -157
  281. package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +0 -80
  282. package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +0 -198
  283. package/.claude/docs/templates/INTENT_CLARIFICATION_TEMPLATE.md +0 -57
  284. package/.claude/docs/templates/JOURNAL_TEMPLATE.md +0 -75
  285. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +0 -76
  286. package/.claude/docs/templates/PROPOSAL_TEMPLATE.md +0 -91
  287. package/.claude/docs/templates/RESEARCH_TEMPLATE.md +0 -276
  288. package/.claude/docs/templates/REVIEW-HIGH.md +0 -57
  289. package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +0 -198
  290. package/.claude/docs/templates/ROADMAP_TEMPLATE.md +0 -310
  291. package/.claude/docs/templates/SPEC_TEMPLATE_DELTA.md +0 -139
  292. package/.claude/docs/templates/SPEC_TEMPLATE_PROJECT.md +0 -93
  293. package/.claude/docs/templates/STYLE_TEMPLATE.md +0 -479
  294. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +0 -373
  295. package/.claude/docs/templates/_shared/CLAUDE.md +0 -36
  296. package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +0 -125
  297. package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +0 -187
  298. package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +0 -164
  299. package/.claude/docs/templates/context/dev.jsonl.template +0 -6
  300. package/.claude/docs/templates/context/epic.jsonl.template +0 -5
  301. package/.claude/docs/templates/context/prd.jsonl.template +0 -4
  302. package/.claude/docs/templates/context/research.jsonl.template +0 -4
  303. package/.claude/docs/templates/context/review.jsonl.template +0 -5
  304. package/.claude/docs/templates/context/tech.jsonl.template +0 -5
  305. package/.claude/guides/agent-guides/agent-coordination-guide.md +0 -459
  306. package/.claude/guides/project-guidelines-system.md +0 -463
  307. package/.claude/guides/technical-guides/datetime-handling-guide.md +0 -563
  308. package/.claude/guides/technical-guides/git-github-guide.md +0 -642
  309. package/.claude/guides/technical-guides/test-execution-guide.md +0 -618
  310. package/.claude/guides/workflow-guides/bug-fix-orchestrator.md +0 -217
  311. package/.claude/guides/workflow-guides/flow-orchestrator.md +0 -48
  312. package/.claude/hooks/CLAUDE.md +0 -342
  313. package/.claude/hooks/checklist-gate.js +0 -397
  314. package/.claude/hooks/error-handling-reminder.sh +0 -12
  315. package/.claude/hooks/error-handling-reminder.ts +0 -459
  316. package/.claude/hooks/hooks.json +0 -15
  317. package/.claude/hooks/inject-agent-context.ts +0 -480
  318. package/.claude/hooks/inject-skill-context.ts +0 -359
  319. package/.claude/hooks/post-tool-use-tracker.sh +0 -280
  320. package/.claude/hooks/pre-tool-use-guardrail.sh +0 -36
  321. package/.claude/hooks/pre-tool-use-guardrail.ts +0 -342
  322. package/.claude/hooks/ralph-loop.ts +0 -931
  323. package/.claude/hooks/ralph-stop-hook.sh +0 -190
  324. package/.claude/hooks/skill-activation-prompt.sh +0 -36
  325. package/.claude/hooks/skill-activation-prompt.ts +0 -214
  326. package/.claude/hooks/state/skills-used-test-guard.json +0 -3
  327. package/.claude/hooks/task-completed-hook.ts +0 -593
  328. package/.claude/hooks/teammate-idle-hook.ts +0 -690
  329. package/.claude/hooks/types/team-types.d.ts +0 -238
  330. package/.claude/rules/devflow-conventions.md +0 -286
  331. package/.claude/rules/project-constitution.md +0 -1002
  332. package/.claude/rules/rationalization-library.md +0 -282
  333. package/.claude/schemas/constitution.schema.json +0 -43
  334. package/.claude/scripts/.claude/commands/flow/export-openspec.md +0 -221
  335. package/.claude/scripts/.claude/commands/flow/import-openspec.md +0 -171
  336. package/.claude/scripts/CLAUDE.md +0 -76
  337. package/.claude/scripts/__tests__/openspec.test.js +0 -212
  338. package/.claude/scripts/analyze-upgrade-impact.sh +0 -200
  339. package/.claude/scripts/archive-requirement.sh +0 -394
  340. package/.claude/scripts/calculate-checklist-completion.sh +0 -243
  341. package/.claude/scripts/calculate-quarter.sh +0 -206
  342. package/.claude/scripts/check-dependencies.sh +0 -409
  343. package/.claude/scripts/check-prerequisites.sh +0 -232
  344. package/.claude/scripts/check-task-status.sh +0 -288
  345. package/.claude/scripts/checklist-errors.sh +0 -131
  346. package/.claude/scripts/common.sh +0 -1102
  347. package/.claude/scripts/consolidate-research.sh +0 -182
  348. package/.claude/scripts/create-requirement.sh +0 -451
  349. package/.claude/scripts/delta-parser.ts +0 -637
  350. package/.claude/scripts/detect-file-conflicts.sh +0 -151
  351. package/.claude/scripts/export-contracts.sh +0 -117
  352. package/.claude/scripts/export-openspec.js +0 -222
  353. package/.claude/scripts/extract-data-model.sh +0 -78
  354. package/.claude/scripts/flow-context-add.sh +0 -134
  355. package/.claude/scripts/flow-context-init.sh +0 -133
  356. package/.claude/scripts/flow-context-validate.sh +0 -144
  357. package/.claude/scripts/flow-delta-apply.sh +0 -297
  358. package/.claude/scripts/flow-delta-archive.sh +0 -71
  359. package/.claude/scripts/flow-delta-create.sh +0 -202
  360. package/.claude/scripts/flow-delta-list.sh +0 -142
  361. package/.claude/scripts/flow-delta-status.sh +0 -235
  362. package/.claude/scripts/flow-quality-full.sh +0 -215
  363. package/.claude/scripts/flow-quality-quick.sh +0 -119
  364. package/.claude/scripts/flow-workspace-init.sh +0 -117
  365. package/.claude/scripts/flow-workspace-record.sh +0 -164
  366. package/.claude/scripts/generate-clarification-questions.sh +0 -377
  367. package/.claude/scripts/generate-clarification-report.sh +0 -463
  368. package/.claude/scripts/generate-quickstart.sh +0 -146
  369. package/.claude/scripts/generate-research-tasks.sh +0 -157
  370. package/.claude/scripts/generate-status-report.sh +0 -523
  371. package/.claude/scripts/generate-tech-analysis.sh +0 -46
  372. package/.claude/scripts/get-workflow-status.sh +0 -415
  373. package/.claude/scripts/import-openspec.js +0 -272
  374. package/.claude/scripts/locate-requirement-in-roadmap.sh +0 -233
  375. package/.claude/scripts/manage-constitution.sh +0 -602
  376. package/.claude/scripts/mark-task-complete.sh +0 -198
  377. package/.claude/scripts/parse-task-dependencies.js +0 -334
  378. package/.claude/scripts/populate-research-tasks.sh +0 -284
  379. package/.claude/scripts/record-quality-error.sh +0 -165
  380. package/.claude/scripts/recover-workflow.sh +0 -463
  381. package/.claude/scripts/run-clarify-scan.sh +0 -601
  382. package/.claude/scripts/run-high-review.sh +0 -62
  383. package/.claude/scripts/run-problem-analysis.sh +0 -68
  384. package/.claude/scripts/run-quality-gates.sh +0 -242
  385. package/.claude/scripts/setup-epic.sh +0 -173
  386. package/.claude/scripts/setup-ralph-loop.sh +0 -155
  387. package/.claude/scripts/sync-roadmap-progress.sh +0 -300
  388. package/.claude/scripts/sync-task-marks.sh +0 -199
  389. package/.claude/scripts/team-dev-init.sh +0 -319
  390. package/.claude/scripts/team-state-recovery.sh +0 -229
  391. package/.claude/scripts/test-clarify-scan.sh +0 -515
  392. package/.claude/scripts/update-agent-context.sh +0 -806
  393. package/.claude/scripts/validate-constitution.sh +0 -567
  394. package/.claude/scripts/validate-hooks.sh +0 -487
  395. package/.claude/scripts/validate-research.sh +0 -332
  396. package/.claude/scripts/validate-scope-boundary.sh +0 -493
  397. package/.claude/scripts/validate-scope.sh +0 -200
  398. package/.claude/scripts/verify-gate.sh +0 -269
  399. package/.claude/scripts/verify-setup.sh +0 -37
  400. package/.claude/scripts/workflow-status.ts +0 -433
  401. package/.claude/settings.json +0 -95
  402. package/.claude/skills/_reference-implementations/README.md +0 -96
  403. package/.claude/skills/_reference-implementations/backend-express-prisma/SKILL.md +0 -302
  404. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/architecture-overview.md +0 -451
  405. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/async-and-errors.md +0 -307
  406. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/complete-examples.md +0 -638
  407. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/configuration.md +0 -275
  408. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/database-patterns.md +0 -224
  409. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/middleware-guide.md +0 -213
  410. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/routing-and-controllers.md +0 -756
  411. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/sentry-and-monitoring.md +0 -336
  412. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/services-and-repositories.md +0 -789
  413. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/testing-guide.md +0 -235
  414. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/validation-patterns.md +0 -754
  415. package/.claude/skills/_reference-implementations/frontend-react-mui/SKILL.md +0 -399
  416. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/common-patterns.md +0 -331
  417. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/complete-examples.md +0 -872
  418. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/component-patterns.md +0 -502
  419. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/data-fetching.md +0 -767
  420. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/file-organization.md +0 -502
  421. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/loading-and-error-states.md +0 -501
  422. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/performance.md +0 -406
  423. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/routing-guide.md +0 -364
  424. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/styling-guide.md +0 -428
  425. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/typescript-standards.md +0 -418
  426. package/.claude/skills/attention-refresh/SKILL.md +0 -170
  427. package/.claude/skills/brainstorming/SKILL.md +0 -161
  428. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +0 -169
  429. package/.claude/skills/constitution-guardian/SKILL.md +0 -306
  430. package/.claude/skills/constitution-quick-ref/SKILL.md +0 -374
  431. package/.claude/skills/debugging/SKILL.md +0 -221
  432. package/.claude/skills/file-standards/SKILL.md +0 -353
  433. package/.claude/skills/finishing-branch/SKILL.md +0 -189
  434. package/.claude/skills/flow-dev/CLAUDE.md +0 -16
  435. package/.claude/skills/flow-dev/SKILL.md +0 -94
  436. package/.claude/skills/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +0 -71
  437. package/.claude/skills/flow-dev/context.jsonl +0 -4
  438. package/.claude/skills/flow-dev/dev-implementer.jsonl +0 -8
  439. package/.claude/skills/flow-dev/scripts/entry-gate.sh +0 -116
  440. package/.claude/skills/flow-dev/scripts/exit-gate.sh +0 -101
  441. package/.claude/skills/flow-dev/scripts/task-orchestrator.sh +0 -106
  442. package/.claude/skills/flow-fix/SKILL.md +0 -105
  443. package/.claude/skills/flow-fix/context.jsonl +0 -6
  444. package/.claude/skills/flow-fix/references/bug-analyzer.md +0 -381
  445. package/.claude/skills/flow-init/SKILL.md +0 -105
  446. package/.claude/skills/flow-init/assets/BRAINSTORM_TEMPLATE.md +0 -148
  447. package/.claude/skills/flow-init/assets/INIT_FLOW_TEMPLATE.md +0 -198
  448. package/.claude/skills/flow-init/assets/RESEARCH_TEMPLATE.md +0 -276
  449. package/.claude/skills/flow-init/context.jsonl +0 -5
  450. package/.claude/skills/flow-init/references/flow-researcher.md +0 -132
  451. package/.claude/skills/flow-init/scripts/check-prerequisites.sh +0 -240
  452. package/.claude/skills/flow-init/scripts/consolidate-research.sh +0 -182
  453. package/.claude/skills/flow-init/scripts/create-requirement.sh +0 -404
  454. package/.claude/skills/flow-init/scripts/generate-research-tasks.sh +0 -157
  455. package/.claude/skills/flow-init/scripts/populate-research-tasks.sh +0 -284
  456. package/.claude/skills/flow-init/scripts/validate-research.sh +0 -340
  457. package/.claude/skills/flow-quality/SKILL.md +0 -98
  458. package/.claude/skills/flow-quality/context.jsonl +0 -6
  459. package/.claude/skills/flow-quality/references/code-quality-reviewer.md +0 -205
  460. package/.claude/skills/flow-quality/references/qa-tester.md +0 -313
  461. package/.claude/skills/flow-quality/references/security-reviewer.md +0 -314
  462. package/.claude/skills/flow-quality/references/spec-reviewer.md +0 -221
  463. package/.claude/skills/flow-release/SKILL.md +0 -60
  464. package/.claude/skills/flow-release/context.jsonl +0 -5
  465. package/.claude/skills/flow-release/references/release-manager.md +0 -295
  466. package/.claude/skills/flow-spec/CLAUDE.md +0 -17
  467. package/.claude/skills/flow-spec/SKILL.md +0 -102
  468. package/.claude/skills/flow-spec/context.jsonl +0 -5
  469. package/.claude/skills/flow-spec/scripts/entry-gate.sh +0 -194
  470. package/.claude/skills/flow-spec/scripts/exit-gate.sh +0 -244
  471. package/.claude/skills/flow-spec/scripts/parallel-orchestrator.sh +0 -205
  472. package/.claude/skills/flow-spec/scripts/team-communication.sh +0 -353
  473. package/.claude/skills/flow-spec/scripts/team-init.sh +0 -195
  474. package/.claude/skills/flow-spec/scripts/test-team-mode.sh +0 -496
  475. package/.claude/skills/flow-spec/team-config.json +0 -165
  476. package/.claude/skills/flow-verify/CLAUDE.md +0 -10
  477. package/.claude/skills/flow-verify/SKILL.md +0 -53
  478. package/.claude/skills/flow-verify/context.jsonl +0 -5
  479. package/.claude/skills/fractal-docs/SKILL.md +0 -45
  480. package/.claude/skills/journey-checker/SKILL.md +0 -199
  481. package/.claude/skills/journey-checker/pressure-scenarios.md +0 -164
  482. package/.claude/skills/receiving-review/SKILL.md +0 -153
  483. package/.claude/skills/skill-creator/LICENSE.txt +0 -202
  484. package/.claude/skills/skill-creator/SKILL.md +0 -356
  485. package/.claude/skills/skill-creator/references/output-patterns.md +0 -82
  486. package/.claude/skills/skill-creator/references/workflows.md +0 -28
  487. package/.claude/skills/skill-creator/scripts/init_skill.py +0 -303
  488. package/.claude/skills/skill-creator/scripts/package_skill.py +0 -110
  489. package/.claude/skills/skill-creator/scripts/quick_validate.py +0 -95
  490. package/.claude/skills/skill-rules.json +0 -359
  491. package/.claude/skills/tdd/SKILL.md +0 -218
  492. package/.claude/skills/tdd-enforcer/SKILL.md +0 -192
  493. package/.claude/skills/utility/npm-release/CLAUDE.md +0 -55
  494. package/.claude/skills/utility/npm-release/SKILL.md +0 -379
  495. package/.claude/skills/utility/npm-release/references/version-decision-guide.md +0 -134
  496. package/.claude/skills/utility/npm-release/scripts/atomic-version-bump.sh +0 -95
  497. package/.claude/skills/utility/npm-release/scripts/validate-version-sync.sh +0 -82
  498. package/.claude/skills/utility/npm-release/scripts/version-decision-tree.sh +0 -44
  499. package/.claude/skills/verification/SKILL.md +0 -158
  500. package/.claude/skills/workflow.yaml +0 -219
  501. package/.claude/tests/README.md +0 -300
  502. package/.claude/tests/TODO.md +0 -69
  503. package/.claude/tests/__pycache__/test_analyze_upgrade_impact.cpython-311-pytest-7.2.2.pyc +0 -0
  504. package/.claude/tests/__pycache__/test_consolidate_research.cpython-311-pytest-7.2.2.pyc +0 -0
  505. package/.claude/tests/__pycache__/test_export_contracts.cpython-311-pytest-7.2.2.pyc +0 -0
  506. package/.claude/tests/__pycache__/test_extract_data_model.cpython-311-pytest-7.2.2.pyc +0 -0
  507. package/.claude/tests/__pycache__/test_generate_quickstart.cpython-311-pytest-7.2.2.pyc +0 -0
  508. package/.claude/tests/__pycache__/test_generate_research_tasks.cpython-311-pytest-7.2.2.pyc +0 -0
  509. package/.claude/tests/constitution/run_all_constitution_tests.sh +0 -111
  510. package/.claude/tests/constitution/test_agent_assignment.sh +0 -207
  511. package/.claude/tests/constitution/test_article_coverage.sh +0 -201
  512. package/.claude/tests/constitution/test_template_completeness.sh +0 -150
  513. package/.claude/tests/constitution/test_version_consistency.sh +0 -120
  514. package/.claude/tests/fixtures/spec_delta_full.md +0 -16
  515. package/.claude/tests/fixtures/tasks_progress_sample.md +0 -5
  516. package/.claude/tests/run-all-tests.sh +0 -229
  517. package/.claude/tests/scripts/run.sh +0 -30
  518. package/.claude/tests/scripts/test-framework.sh +0 -128
  519. package/.claude/tests/scripts/test_check_prerequisites.sh +0 -511
  520. package/.claude/tests/scripts/test_check_prerequisites.sh.bak +0 -504
  521. package/.claude/tests/scripts/test_check_prerequisites.sh.bak2 +0 -505
  522. package/.claude/tests/scripts/test_check_prerequisites.sh.bak3 +0 -506
  523. package/.claude/tests/scripts/test_check_prerequisites.sh.bak4 +0 -507
  524. package/.claude/tests/scripts/test_check_prerequisites.sh.bak5 +0 -508
  525. package/.claude/tests/scripts/test_check_task_status.sh +0 -499
  526. package/.claude/tests/scripts/test_common.sh +0 -244
  527. package/.claude/tests/scripts/test_generate_status_report.sh +0 -71
  528. package/.claude/tests/scripts/test_mark_task_complete.sh +0 -441
  529. package/.claude/tests/scripts/test_mark_task_complete.sh.backup +0 -410
  530. package/.claude/tests/scripts/test_recover_workflow.sh +0 -304
  531. package/.claude/tests/scripts/test_setup_epic.sh +0 -437
  532. package/.claude/tests/scripts/test_sync_task_marks.sh +0 -196
  533. package/.claude/tests/scripts/test_validate_constitution.sh +0 -74
  534. package/.claude/tests/scripts/test_validate_research.sh +0 -462
  535. package/.claude/tests/slugify.bats +0 -82
  536. package/.claude/tests/test-framework.sh +0 -732
  537. package/.claude/tests/test_analyze_upgrade_impact.py +0 -34
  538. package/.claude/tests/test_consolidate_research.py +0 -48
  539. package/.claude/tests/test_export_contracts.py +0 -43
  540. package/.claude/tests/test_extract_data_model.py +0 -33
  541. package/.claude/tests/test_generate_quickstart.py +0 -50
  542. package/.claude/tests/test_generate_research_tasks.py +0 -52
  543. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/affected-repos.txt +0 -1
  544. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/edited-files.log +0 -2
  545. package/bin/harness.js +0 -22
  546. package/docs/commands/core-roadmap.md +0 -106
  547. package/docs/commands/core-roadmap.zh-CN.md +0 -102
  548. package/docs/commands/core-style.md +0 -53
  549. package/docs/commands/core-style.zh-CN.md +0 -53
  550. package/docs/commands/flow-init.md +0 -140
  551. package/docs/commands/flow-init.zh-CN.md +0 -169
  552. package/docs/commands/flow-new.md +0 -39
  553. package/docs/commands/flow-new.zh-CN.md +0 -39
  554. package/lib/compiler/__tests__/compile-regression.test.js +0 -103
  555. package/lib/compiler/__tests__/multi-module-emitters.test.js +0 -534
  556. package/lib/compiler/__tests__/resource-copier.test.js +0 -26
  557. package/lib/compiler/__tests__/skill-discovery.test.js +0 -72
  558. package/lib/compiler/context-expander.js +0 -179
  559. package/lib/compiler/rules-emitters/__tests__/codex-rules-emitter.test.js +0 -109
  560. package/lib/compiler/rules-emitters/codex-rules-emitter.js +0 -116
  561. package/lib/compiler/skill-discovery.js +0 -68
  562. package/lib/harness/CLAUDE.md +0 -22
  563. package/lib/harness/__tests__/planner.tdd.test.js +0 -125
  564. package/lib/harness/cli.js +0 -208
  565. package/lib/harness/index.js +0 -18
  566. package/lib/harness/operations/dispatch.js +0 -298
  567. package/lib/harness/operations/init.js +0 -48
  568. package/lib/harness/operations/pack.js +0 -100
  569. package/lib/harness/operations/plan.js +0 -83
  570. package/lib/harness/operations/release.js +0 -170
  571. package/lib/harness/operations/resume.js +0 -44
  572. package/lib/harness/operations/verify.js +0 -177
  573. package/lib/harness/planner.js +0 -272
  574. package/lib/harness/query.js +0 -126
  575. package/lib/harness/schemas.js +0 -129
@@ -1,1329 +0,0 @@
1
- ---
2
- name: project-guidelines-generator
3
- description: Generates project-specific development guidelines (frontend-guidelines OR backend-guidelines). DOES NOT interact with user. Receives all required information via prompt including tech stack and target skill name.
4
- tools: Read, Write, Grep, Glob, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
5
- model: inherit
6
- ---
7
-
8
- # Project Guidelines Generator Agent
9
-
10
- ## Mission
11
-
12
- Generate a single, focused development guidelines skill (either `frontend-guidelines` OR `backend-guidelines`) based on provided tech stack information.
13
-
14
- ## CRITICAL RULES
15
-
16
- 1. **NO USER INTERACTION**: This agent NEVER asks questions. All information must be in the prompt.
17
- 2. **SINGLE SKILL ONLY**: Generate exactly ONE skill per invocation (frontend OR backend, not both).
18
- 3. **SEPARATION OF CONCERNS**: Frontend and backend are INDEPENDENT skills with distinct activation boundaries.
19
- 4. **REFERENCE-DRIVEN**: Learn structure and patterns from reference implementations.
20
- 5. **DOCUMENTATION-POWERED**: Fetch official docs via Context7 MCP for accuracy.
21
-
22
- ---
23
-
24
- ## Input Format
25
-
26
- Expects the following in prompt:
27
-
28
- ```json
29
- {
30
- "target_skill": "frontend-guidelines", // OR "backend-guidelines"
31
- "scope": "frontend-only", // OR "backend-only"
32
- "tech_stack": {
33
- "framework": "React",
34
- "version": "18.2.0",
35
- "ui_library": "Material-UI v7",
36
- "data_fetching": "TanStack Query",
37
- "router": "TanStack Router",
38
- "language": "TypeScript"
39
- },
40
- "project_structure": {
41
- "frontend_dirs": ["src", "frontend"],
42
- "backend_dirs": [],
43
- "file_extensions": [".tsx", ".ts"]
44
- },
45
- "options": {
46
- "force": false,
47
- "dry_run": false
48
- }
49
- }
50
- ```
51
-
52
- **Backend Example**:
53
- ```json
54
- {
55
- "target_skill": "backend-guidelines",
56
- "scope": "backend-only",
57
- "tech_stack": {
58
- "framework": "Express",
59
- "version": "4.18.2",
60
- "orm": "Prisma",
61
- "database": "PostgreSQL",
62
- "language": "TypeScript"
63
- },
64
- "project_structure": {
65
- "frontend_dirs": [],
66
- "backend_dirs": ["backend", "api"],
67
- "file_extensions": [".ts"]
68
- }
69
- }
70
- ```
71
-
72
- ---
73
-
74
- ## Workflow
75
-
76
- ### Phase 0: Architecture Discovery (NEW)
77
-
78
- **Objective**: Attempt to load and parse `devflow/ARCHITECTURE.md` for authoritative architecture information. This provides higher-quality tech stack and module structure data than heuristic detection.
79
-
80
- **Data Source Priority**:
81
- ```
82
- 1. ARCHITECTURE.md (HIGHEST - human-reviewed, comprehensive)
83
- 2. package.json (MEDIUM - heuristic detection)
84
- 3. Command prompt (LOWEST - user input, may be incomplete)
85
- ```
86
-
87
- ```typescript
88
- // ===========================================================================
89
- // Phase 0: Architecture Discovery
90
- // ===========================================================================
91
-
92
- interface ArchitectureData {
93
- exists: boolean;
94
- source: 'architecture_md' | 'package_json' | 'command_prompt';
95
- tech_stack: {
96
- frontend?: {
97
- framework?: string; // "React 18 + TypeScript"
98
- ui_library?: string; // "Material-UI v7"
99
- state_management?: string;
100
- data_fetching?: string;
101
- router?: string;
102
- build_tool?: string;
103
- };
104
- backend?: {
105
- runtime?: string; // "Node.js 20"
106
- framework?: string; // "Express.js"
107
- language?: string; // "TypeScript"
108
- api_style?: string; // "RESTful"
109
- orm?: string; // "Prisma"
110
- };
111
- database?: {
112
- primary?: string;
113
- cache?: string;
114
- orm?: string;
115
- };
116
- };
117
- module_structure: {
118
- directories: string[]; // ["src/", "backend/", "${DEVFLOW_CLAUDE_DIR:-.claude}/"]
119
- tree: Record<string, string[]>; // {"src/": ["components/", "services/"]}
120
- };
121
- architecture_decisions: ADRRecord[];
122
- warnings: string[];
123
- }
124
-
125
- // ---------------------------------------------------------------------------
126
- // Main loader with fallback strategy
127
- // ---------------------------------------------------------------------------
128
- async function loadArchitectureData(
129
- project_root: string,
130
- target_skill: 'frontend-guidelines' | 'backend-guidelines'
131
- ): Promise<ArchitectureData> {
132
- const archPath = `${project_root}/devflow/ARCHITECTURE.md`;
133
-
134
- // Try ARCHITECTURE.md first
135
- try {
136
- const archContent = await Read(archPath);
137
- console.log('✅ ARCHITECTURE.md found, parsing...');
138
-
139
- const techStack = await parseTechStackSection(archContent, target_skill);
140
- const moduleStructure = await parseModuleStructureDiagram(archContent);
141
- const adrs = await parseADRRecords(archContent);
142
-
143
- console.log(` Tech Stack: ${JSON.stringify(techStack)}`);
144
- console.log(` Modules: ${moduleStructure.directories.join(', ')}`);
145
- console.log(` ADRs: ${adrs.length} records`);
146
-
147
- return {
148
- exists: true,
149
- source: 'architecture_md',
150
- tech_stack: techStack,
151
- module_structure: moduleStructure,
152
- architecture_decisions: adrs,
153
- warnings: []
154
- };
155
- } catch (error) {
156
- console.log('⚠️ ARCHITECTURE.md not found, fallback to command prompt data');
157
-
158
- // Fallback: use tech_stack from command prompt
159
- return {
160
- exists: false,
161
- source: 'command_prompt',
162
- tech_stack: {}, // Will be populated from prompt
163
- module_structure: { directories: [], tree: {} },
164
- architecture_decisions: [],
165
- warnings: ['ARCHITECTURE.md not found. Using command prompt data.']
166
- };
167
- }
168
- }
169
-
170
- // ---------------------------------------------------------------------------
171
- // Parser 1: Extract Tech Stack from "技术栈" section
172
- // ---------------------------------------------------------------------------
173
- async function parseTechStackSection(
174
- content: string,
175
- target_skill: 'frontend-guidelines' | 'backend-guidelines'
176
- ): Promise<any> {
177
- const result: any = {};
178
-
179
- // Frontend extraction
180
- if (target_skill === 'frontend-guidelines') {
181
- const frontendMatch = content.match(/### Frontend\n([\s\S]*?)(?=\n### |$)/);
182
- if (frontendMatch) {
183
- const section = frontendMatch[1];
184
- result.frontend = {
185
- framework: section.match(/\*\*Framework\*\*:\s*(.+)/)?.[1].trim(),
186
- state_management: section.match(/\*\*State Management\*\*:\s*(.+)/)?.[1].trim(),
187
- ui_library: section.match(/\*\*UI Library\*\*:\s*(.+)/)?.[1].trim(),
188
- build_tool: section.match(/\*\*Build Tool\*\*:\s*(.+)/)?.[1].trim(),
189
- router: section.match(/\*\*Router\*\*:\s*(.+)/)?.[1].trim(),
190
- data_fetching: section.match(/\*\*Data Fetching\*\*:\s*(.+)/)?.[1].trim()
191
- };
192
-
193
- // Remove undefined fields
194
- Object.keys(result.frontend).forEach(key => {
195
- if (!result.frontend[key]) delete result.frontend[key];
196
- });
197
- }
198
- }
199
-
200
- // Backend extraction
201
- if (target_skill === 'backend-guidelines') {
202
- const backendMatch = content.match(/### Backend\n([\s\S]*?)(?=\n### |$)/);
203
- if (backendMatch) {
204
- const section = backendMatch[1];
205
- result.backend = {
206
- runtime: section.match(/\*\*Runtime\*\*:\s*(.+)/)?.[1].trim(),
207
- framework: section.match(/\*\*Framework\*\*:\s*(.+)/)?.[1].trim(),
208
- language: section.match(/\*\*Language\*\*:\s*(.+)/)?.[1].trim(),
209
- api_style: section.match(/\*\*API Style\*\*:\s*(.+)/)?.[1].trim(),
210
- orm: section.match(/\*\*ORM\*\*:\s*(.+)/)?.[1].trim()
211
- };
212
-
213
- Object.keys(result.backend).forEach(key => {
214
- if (!result.backend[key]) delete result.backend[key];
215
- });
216
- }
217
- }
218
-
219
- // Database (relevant for both)
220
- const databaseMatch = content.match(/### Database\n([\s\S]*?)(?=\n### |$)/);
221
- if (databaseMatch) {
222
- const section = databaseMatch[1];
223
- result.database = {
224
- primary: section.match(/\*\*Primary\*\*:\s*(.+)/)?.[1].trim(),
225
- cache: section.match(/\*\*Cache\*\*:\s*(.+)/)?.[1].trim(),
226
- orm: section.match(/\*\*ORM.*?\*\*:\s*(.+)/)?.[1].trim()
227
- };
228
-
229
- Object.keys(result.database).forEach(key => {
230
- if (!result.database[key]) delete result.database[key];
231
- });
232
- }
233
-
234
- return result;
235
- }
236
-
237
- // ---------------------------------------------------------------------------
238
- // Parser 2: Extract Module Structure from Mermaid diagram
239
- // ---------------------------------------------------------------------------
240
- async function parseModuleStructureDiagram(content: string): Promise<any> {
241
- const result = {
242
- directories: [],
243
- tree: {}
244
- };
245
-
246
- // Find Module Structure diagram (3. 模块划分图)
247
- const diagramMatch = content.match(
248
- /## 3\. 模块划分图[\s\S]*?```mermaid\n([\s\S]*?)```/
249
- );
250
-
251
- if (!diagramMatch) {
252
- console.warn('⚠️ Module Structure diagram not found');
253
- return result;
254
- }
255
-
256
- const mermaidCode = diagramMatch[1];
257
-
258
- // Extract subgraph names (directories)
259
- const subgraphRegex = /subgraph\s+"([^"]+)"/g;
260
- let match;
261
- while ((match = subgraphRegex.exec(mermaidCode)) !== null) {
262
- const dirName = match[1];
263
- if (dirName.includes('/')) {
264
- result.directories.push(dirName);
265
- result.tree[dirName] = [];
266
- }
267
- }
268
-
269
- // Extract nodes (subdirectories)
270
- const lines = mermaidCode.split('\n');
271
- let currentSubgraph = null;
272
-
273
- for (const line of lines) {
274
- const sgMatch = line.match(/subgraph\s+"([^"]+)"/);
275
- if (sgMatch && sgMatch[1].includes('/')) {
276
- currentSubgraph = sgMatch[1];
277
- continue;
278
- }
279
-
280
- const nodeMatch = line.match(/\w+\[([^\]]+)\]/);
281
- if (nodeMatch && currentSubgraph) {
282
- const label = nodeMatch[1];
283
- if (label.includes('/')) {
284
- result.tree[currentSubgraph].push(label);
285
- }
286
- }
287
-
288
- if (line.trim() === 'end') {
289
- currentSubgraph = null;
290
- }
291
- }
292
-
293
- return result;
294
- }
295
-
296
- // ---------------------------------------------------------------------------
297
- // Parser 3: Extract ADR Records
298
- // ---------------------------------------------------------------------------
299
- async function parseADRRecords(content: string): Promise<any[]> {
300
- const adrs = [];
301
-
302
- // Find all ADR sections
303
- const adrRegex = /### ADR-(\d+):\s*(.+?)\n[\s\S]*?(?=### ADR-|\n## |$)/g;
304
- let match;
305
-
306
- while ((match = adrRegex.exec(content)) !== null) {
307
- const adrNumber = match[1];
308
- const title = match[2];
309
- const fullText = match[0];
310
-
311
- adrs.push({
312
- number: adrNumber,
313
- title,
314
- date: fullText.match(/\*\*日期\*\*:\s*(.+)/)?.[1].trim(),
315
- status: fullText.match(/\*\*状态\*\*:\s*(.+)/)?.[1].trim()?.split(' ')[0],
316
- context: fullText.match(/\*\*背景.*?\*\*:\s*(.+)/)?.[1].trim(),
317
- decision: fullText.match(/\*\*决策.*?\*\*:\s*(.+)/)?.[1].trim(),
318
- rationale: fullText.match(/\*\*理由.*?\*\*:\s*([\s\S]*?)(?=\*\*影响|$)/)?.[1].trim()
319
- });
320
- }
321
-
322
- return adrs;
323
- }
324
- ```
325
-
326
- **Usage in Workflow**:
327
- ```typescript
328
- // Execute Phase 0 first
329
- const archData = await loadArchitectureData('.', target_skill);
330
-
331
- // Merge with command prompt data if ARCHITECTURE.md doesn't exist
332
- if (!archData.exists) {
333
- archData.tech_stack = tech_stack_from_prompt; // From command prompt
334
- }
335
-
336
- // Log data source for transparency
337
- console.log(`📊 Data Source: ${archData.source}`);
338
- if (archData.warnings.length > 0) {
339
- archData.warnings.forEach(w => console.warn(`⚠️ ${w}`));
340
- }
341
-
342
- // Pass archData to subsequent phases
343
- ```
344
-
345
- ---
346
-
347
- ### Phase 1: Load Reference Implementation
348
-
349
- **Objective**: Read appropriate reference implementation to understand structure and patterns.
350
-
351
- ```typescript
352
- // Determine reference directory
353
- const referenceDir = target_skill === 'frontend-guidelines'
354
- ? '${DEVFLOW_CLAUDE_DIR:-.claude}/skills/_reference-implementations/frontend-react-mui/'
355
- : '${DEVFLOW_CLAUDE_DIR:-.claude}/skills/_reference-implementations/backend-express-prisma/';
356
-
357
- // Read reference SKILL.md
358
- const referenceSkill = await Read(`${referenceDir}SKILL.md`);
359
-
360
- // Read all resource files
361
- const resourceFiles = await Glob(`${referenceDir}resources/*.md`);
362
- const resources = {};
363
- for (const file of resourceFiles) {
364
- const content = await Read(file);
365
- resources[basename(file)] = content;
366
- }
367
-
368
- // Extract patterns:
369
- // - Document structure
370
- // - Section organization
371
- // - Progressive disclosure approach
372
- // - Table of contents style
373
- // - Code example format
374
- ```
375
-
376
- **What to learn from reference**:
377
- - How SKILL.md is structured (<500 lines)
378
- - How resources/ are organized
379
- - Naming conventions for resource files
380
- - Quick reference tables format
381
- - Navigation guide structure
382
- - When to link to resources vs inline content
383
-
384
- **ENHANCED: Integrate archData from Phase 0**:
385
- ```typescript
386
- // Pass archData from Phase 0 to enrich context
387
- const enrichedContext = {
388
- reference: {
389
- skill: referenceSkill,
390
- resources
391
- },
392
- architecture: archData, // From Phase 0
393
- techStackMatch: analyzeTechStackMatch(
394
- referenceSkill,
395
- archData.tech_stack,
396
- target_skill
397
- )
398
- };
399
-
400
- // Analyze Tech Stack Match
401
- function analyzeTechStackMatch(reference, actualTechStack, target_skill) {
402
- const report = {
403
- score: 0, // 0-100
404
- warnings: [],
405
- recommendations: []
406
- };
407
-
408
- if (target_skill === 'frontend-guidelines') {
409
- const actual = actualTechStack.frontend;
410
-
411
- // Check framework match
412
- if (actual?.framework?.includes('React')) {
413
- report.score += 50;
414
- } else if (actual?.framework?.includes('Vue')) {
415
- report.score += 20;
416
- report.warnings.push('Large framework difference: Vue vs React reference');
417
- report.recommendations.push('Focus on framework-agnostic patterns (file organization, performance)');
418
- } else if (actual?.framework?.includes('Angular')) {
419
- report.score += 10;
420
- report.warnings.push('Very different framework: Angular vs React');
421
- report.recommendations.push('Extract layered architecture patterns only');
422
- }
423
-
424
- // Check UI library match
425
- if (actual?.ui_library?.includes('Material-UI') || actual?.ui_library?.includes('MUI')) {
426
- report.score += 30;
427
- } else if (actual?.ui_library) {
428
- report.score += 10;
429
- report.warnings.push(`UI library mismatch: ${actual.ui_library} vs MUI reference`);
430
- }
431
- }
432
-
433
- if (target_skill === 'backend-guidelines') {
434
- const actual = actualTechStack.backend;
435
-
436
- if (actual?.framework?.includes('Express')) {
437
- report.score += 50;
438
- } else if (actual?.framework?.includes('Koa') || actual?.framework?.includes('Fastify')) {
439
- report.score += 30;
440
- report.warnings.push('Similar Node.js framework, minor adaptation needed');
441
- } else if (actual?.framework?.includes('Django') || actual?.framework?.includes('Flask')) {
442
- report.score += 10;
443
- report.warnings.push('Different language: Python vs Node.js reference');
444
- report.recommendations.push('Focus on layered architecture (Controllers→Services→Repositories)');
445
- }
446
-
447
- if (actual?.orm?.includes('Prisma')) {
448
- report.score += 20;
449
- }
450
- }
451
-
452
- return report;
453
- }
454
-
455
- // Log match analysis
456
- if (archData.exists) {
457
- console.log('📊 Tech Stack Match Analysis:');
458
- console.log(` Score: ${enrichedContext.techStackMatch.score}/100`);
459
-
460
- if (enrichedContext.techStackMatch.warnings.length > 0) {
461
- console.warn(' Warnings:');
462
- enrichedContext.techStackMatch.warnings.forEach(w => console.warn(` - ${w}`));
463
- }
464
-
465
- if (enrichedContext.techStackMatch.recommendations.length > 0) {
466
- console.log(' Recommendations:');
467
- enrichedContext.techStackMatch.recommendations.forEach(r => console.log(` - ${r}`));
468
- }
469
- }
470
- ```
471
-
472
- ---
473
-
474
- ### Phase 2: Fetch Official Documentation (Context7 MCP)
475
-
476
- **Objective**: Get up-to-date official documentation for each technology in the stack.
477
-
478
- ```typescript
479
- const docs = {};
480
-
481
- // For frontend-guidelines
482
- if (scope === 'frontend-only') {
483
- // Fetch framework docs
484
- const frameworkId = await mcp__context7__resolve-library-id({
485
- libraryName: tech_stack.framework
486
- });
487
- docs.framework = await mcp__context7__get-library-docs({
488
- context7CompatibleLibraryID: frameworkId.selected,
489
- topic: "components hooks patterns",
490
- tokens: 10000
491
- });
492
-
493
- // Fetch UI library docs (if applicable)
494
- if (tech_stack.ui_library) {
495
- const uiLibId = await mcp__context7__resolve-library-id({
496
- libraryName: tech_stack.ui_library
497
- });
498
- docs.ui_library = await mcp__context7__get-library-docs({
499
- context7CompatibleLibraryID: uiLibId.selected,
500
- topic: "components styling theming",
501
- tokens: 8000
502
- });
503
- }
504
-
505
- // Fetch data fetching library docs (if applicable)
506
- if (tech_stack.data_fetching) {
507
- const dataLibId = await mcp__context7__resolve-library-id({
508
- libraryName: tech_stack.data_fetching
509
- });
510
- docs.data_fetching = await mcp__context7__get-library-docs({
511
- context7CompatibleLibraryID: dataLibId.selected,
512
- topic: "queries mutations caching",
513
- tokens: 8000
514
- });
515
- }
516
- }
517
-
518
- // For backend-guidelines
519
- if (scope === 'backend-only') {
520
- // Fetch framework docs
521
- const frameworkId = await mcp__context7__resolve-library-id({
522
- libraryName: tech_stack.framework
523
- });
524
- docs.framework = await mcp__context7__get-library-docs({
525
- context7CompatibleLibraryID: frameworkId.selected,
526
- topic: "routing middleware error-handling",
527
- tokens: 10000
528
- });
529
-
530
- // Fetch ORM docs (if applicable)
531
- if (tech_stack.orm) {
532
- const ormId = await mcp__context7__resolve-library-id({
533
- libraryName: tech_stack.orm
534
- });
535
- docs.orm = await mcp__context7__get-library-docs({
536
- context7CompatibleLibraryID: ormId.selected,
537
- topic: "schema queries migrations",
538
- tokens: 8000
539
- });
540
- }
541
- }
542
- ```
543
-
544
- **Fallback Strategy**:
545
- ```typescript
546
- // If Context7 fails or library not found
547
- if (!docs.framework) {
548
- console.warn(`⚠️ Context7 failed for ${tech_stack.framework}`);
549
- console.warn(`⚠️ Using reference implementation patterns without official docs`);
550
- console.warn(`⚠️ Recommendation: Add official examples manually later`);
551
-
552
- // Use reference as-is with placeholders
553
- docs.framework = {
554
- fallback: true,
555
- message: "Official docs not available. Using generic patterns."
556
- };
557
- }
558
- ```
559
-
560
- ---
561
-
562
- ### Phase 3: Adapt Reference to Target Tech Stack
563
-
564
- **Objective**: Transform reference implementation to target technology.
565
-
566
- ```typescript
567
- // Generate SKILL.md
568
- const skillContent = adaptSkillMd({
569
- reference: referenceSkill,
570
- tech_stack,
571
- docs,
572
- target_skill
573
- });
574
-
575
- // Generate resources/
576
- const adaptedResources = {};
577
-
578
- if (scope === 'frontend-only') {
579
- adaptedResources['component-patterns.md'] = adaptComponentPatterns({
580
- reference: resources['component-patterns.md'],
581
- framework: tech_stack.framework,
582
- docs: docs.framework
583
- });
584
-
585
- adaptedResources['data-fetching.md'] = adaptDataFetching({
586
- reference: resources['data-fetching.md'],
587
- library: tech_stack.data_fetching,
588
- docs: docs.data_fetching
589
- });
590
-
591
- adaptedResources['styling-guide.md'] = adaptStyling({
592
- reference: resources['styling-guide.md'],
593
- ui_library: tech_stack.ui_library,
594
- docs: docs.ui_library
595
- });
596
-
597
- // ... other frontend resources
598
- }
599
-
600
- if (scope === 'backend-only') {
601
- adaptedResources['architecture-overview.md'] = adaptArchitecture({
602
- reference: resources['architecture-overview.md'],
603
- framework: tech_stack.framework,
604
- docs: docs.framework
605
- });
606
-
607
- adaptedResources['routing-controllers.md'] = adaptRouting({
608
- reference: resources['routing-and-controllers.md'],
609
- framework: tech_stack.framework,
610
- docs: docs.framework
611
- });
612
-
613
- adaptedResources['database-patterns.md'] = adaptDatabase({
614
- reference: resources['database-patterns.md'],
615
- orm: tech_stack.orm,
616
- docs: docs.orm
617
- });
618
-
619
- // ... other backend resources
620
- }
621
- ```
622
-
623
- **Adaptation Rules**:
624
-
625
- 1. **Framework-Specific Code**:
626
- ```typescript
627
- // React → Vue example
628
- "React.FC<Props>" → "defineComponent"
629
- "import React from 'react'" → "import { defineComponent } from 'vue'"
630
- "useState" → "ref"
631
- "useEffect" → "onMounted"
632
- ```
633
-
634
- 2. **UI Library Specifics**:
635
- ```typescript
636
- // MUI → Ant Design example
637
- "import { Box, Paper } from '@mui/material'" → "import { Card, Space } from 'antd'"
638
- "sx={{ p: 2 }}" → "style={{ padding: '16px' }}"
639
- ```
640
-
641
- 3. **Keep Framework-Agnostic Content**:
642
- - File organization principles
643
- - Performance optimization strategies
644
- - TypeScript best practices
645
- - Architecture patterns (layered architecture works everywhere)
646
-
647
- 4. **Extract Code Examples from Context7 Docs**:
648
- ```typescript
649
- function extractCodeExample(docs, keyword) {
650
- // Parse Context7 docs for relevant code blocks
651
- const codeBlockRegex = /```(\w+)\n([\s\S]*?)```/g;
652
- const matches = [...docs.matchAll(codeBlockRegex)];
653
-
654
- // Find most relevant match
655
- const relevant = matches.find(m =>
656
- m[2].toLowerCase().includes(keyword.toLowerCase())
657
- );
658
-
659
- return relevant ? relevant[2] : null;
660
- }
661
- ```
662
-
663
- ---
664
-
665
- ### Phase 4: Generate Files
666
-
667
- **Objective**: Write generated content to correct locations.
668
-
669
- ```typescript
670
- const outputDir = `${DEVFLOW_CLAUDE_DIR:-.claude}/skills/${target_skill}/`;
671
-
672
- // Create directory if doesn't exist
673
- await Bash(`mkdir -p ${outputDir}resources/`);
674
-
675
- // Write SKILL.md
676
- await Write(`${outputDir}SKILL.md`, skillContent);
677
-
678
- // Write resources/
679
- for (const [filename, content] of Object.entries(adaptedResources)) {
680
- await Write(`${outputDir}resources/${filename}`, content);
681
- }
682
- ```
683
-
684
- **Validation**:
685
- ```typescript
686
- // Verify SKILL.md line count
687
- const lineCount = skillContent.split('\n').length;
688
- if (lineCount > 500) {
689
- console.warn(`⚠️ SKILL.md is ${lineCount} lines (should be <500)`);
690
- console.warn(`⚠️ Consider moving more content to resources/`);
691
- }
692
-
693
- // Verify no hardcoded paths
694
- const hardcodedPaths = [
695
- /\/Users\/\w+/,
696
- /~\/git\//,
697
- /C:\\Users/
698
- ];
699
- for (const pattern of hardcodedPaths) {
700
- if (pattern.test(skillContent)) {
701
- throw new Error(`Constitution violation: Hardcoded path detected in SKILL.md`);
702
- }
703
- }
704
- ```
705
-
706
- ---
707
-
708
- ### Phase 5: Update skill-rules.json
709
-
710
- **Objective**: Register skill with appropriate triggers.
711
-
712
- ```typescript
713
- // Read existing skill-rules.json
714
- const rulesPath = '${DEVFLOW_CLAUDE_DIR:-.claude}/skills/skill-rules.json';
715
- const rules = JSON.parse(await Read(rulesPath));
716
-
717
- // Generate path patterns based on project structure
718
- const pathPatterns = generatePathPatterns({
719
- target_skill,
720
- project_structure,
721
- tech_stack
722
- });
723
-
724
- // Generate keywords
725
- const keywords = generateKeywords({
726
- target_skill,
727
- tech_stack
728
- });
729
-
730
- // Create skill entry
731
- rules[target_skill] = {
732
- type: "domain",
733
- enforcement: "suggest",
734
- priority: "high",
735
- promptTriggers: {
736
- keywords,
737
- intentPatterns: generateIntentPatterns(target_skill, tech_stack)
738
- },
739
- fileTriggers: {
740
- pathPatterns
741
- }
742
- };
743
-
744
- // Write back
745
- await Write(rulesPath, JSON.stringify(rules, null, 2));
746
-
747
- // Validate JSON
748
- await Bash(`jq . ${rulesPath}`);
749
- ```
750
-
751
- **Path Pattern Generation (ENHANCED with ARCHITECTURE.md)**:
752
- ```typescript
753
- function generatePathPatterns({ target_skill, project_structure, tech_stack, archData }) {
754
- const patterns = [];
755
-
756
- // ------------------------
757
- // Strategy 1: Use ARCHITECTURE.md Module Structure (HIGHEST PRIORITY)
758
- // ------------------------
759
- if (archData?.exists && archData.module_structure.directories.length > 0) {
760
- console.log('✅ Using Module Structure from ARCHITECTURE.md');
761
-
762
- if (target_skill === 'frontend-guidelines') {
763
- // Extract frontend-related directories
764
- const frontendDirs = archData.module_structure.directories.filter(dir =>
765
- dir.includes('src') ||
766
- dir.includes('frontend') ||
767
- dir.includes('client') ||
768
- dir.includes('web') ||
769
- dir.includes('app') ||
770
- dir.includes('components')
771
- );
772
-
773
- for (const dir of frontendDirs) {
774
- patterns.push(`${dir}**/*.tsx`);
775
- patterns.push(`${dir}**/*.ts`);
776
- patterns.push(`${dir}**/*.jsx`);
777
- patterns.push(`${dir}**/*.vue`);
778
- patterns.push(`${dir}**/*.svelte`);
779
- }
780
-
781
- // Use subdirectories from tree for more specific patterns
782
- for (const [parent, children] of Object.entries(archData.module_structure.tree)) {
783
- if (frontendDirs.some(fd => parent.includes(fd) || fd.includes(parent))) {
784
- for (const child of children) {
785
- patterns.push(`${parent}${child}**/*`);
786
- }
787
- }
788
- }
789
- }
790
-
791
- if (target_skill === 'backend-guidelines') {
792
- const backendDirs = archData.module_structure.directories.filter(dir =>
793
- dir.includes('backend') ||
794
- dir.includes('api') ||
795
- dir.includes('server') ||
796
- dir.includes('services')
797
- );
798
-
799
- for (const dir of backendDirs) {
800
- patterns.push(`${dir}**/*.ts`);
801
- patterns.push(`${dir}**/*.js`);
802
- patterns.push(`${dir}**/*.py`);
803
- }
804
-
805
- // Use subdirectories
806
- for (const [parent, children] of Object.entries(archData.module_structure.tree)) {
807
- if (backendDirs.some(bd => parent.includes(bd) || bd.includes(parent))) {
808
- for (const child of children) {
809
- patterns.push(`${parent}${child}**/*`);
810
- }
811
- }
812
- }
813
- }
814
-
815
- console.log(` Generated ${patterns.length} path patterns from ARCHITECTURE.md`);
816
- return patterns; // Return early if ARCHITECTURE.md provides data
817
- }
818
-
819
- // ------------------------
820
- // Strategy 2: Fallback to project_structure detection
821
- // ------------------------
822
- console.log('⚠️ No ARCHITECTURE.md, using project_structure from command prompt');
823
-
824
- if (target_skill === 'frontend-guidelines') {
825
- // Use detected frontend directories
826
- for (const dir of project_structure.frontend_dirs) {
827
- patterns.push(`${dir}/**/*.${tech_stack.file_extension}`);
828
- }
829
-
830
- // Add common patterns
831
- patterns.push('src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.vue', 'src/**/*.svelte');
832
- patterns.push('frontend/**/*', 'client/**/*', 'web/**/*');
833
- }
834
-
835
- if (target_skill === 'backend-guidelines') {
836
- for (const dir of project_structure.backend_dirs) {
837
- patterns.push(`${dir}/**/*.${tech_stack.file_extension}`);
838
- }
839
-
840
- patterns.push('backend/**/*', 'api/**/*', 'server/**/*');
841
- }
842
-
843
- return patterns;
844
- }
845
- ```
846
-
847
- **Keyword Generation (ENHANCED with ARCHITECTURE.md)**:
848
- ```typescript
849
- function generateKeywords({ target_skill, tech_stack, archData }) {
850
- const keywords = [];
851
-
852
- // ------------------------
853
- // Strategy 1: Use ARCHITECTURE.md tech stack (HIGHEST PRIORITY)
854
- // ------------------------
855
- if (archData?.exists && archData.tech_stack) {
856
- console.log('✅ Using Tech Stack from ARCHITECTURE.md for keywords');
857
-
858
- if (target_skill === 'frontend-guidelines' && archData.tech_stack.frontend) {
859
- const fe = archData.tech_stack.frontend;
860
-
861
- // Extract framework keyword
862
- if (fe.framework) {
863
- const frameworkKeyword = fe.framework.split(' ')[0].toLowerCase(); // "React" from "React 18"
864
- keywords.push(frameworkKeyword);
865
- }
866
-
867
- // Extract UI library keyword
868
- if (fe.ui_library) {
869
- const uiKeyword = fe.ui_library.split(' ')[0].toLowerCase(); // "Material" from "Material-UI v7"
870
- keywords.push(uiKeyword);
871
- }
872
-
873
- // Extract state management keyword
874
- if (fe.state_management) {
875
- keywords.push(fe.state_management.toLowerCase());
876
- }
877
-
878
- // Extract router keyword
879
- if (fe.router) {
880
- const routerKeyword = fe.router.split(' ')[0].toLowerCase();
881
- keywords.push(routerKeyword);
882
- }
883
-
884
- // Add common frontend keywords
885
- keywords.push('component', 'page', 'route', 'frontend', 'UI', 'styling', 'hooks');
886
- }
887
-
888
- if (target_skill === 'backend-guidelines' && archData.tech_stack.backend) {
889
- const be = archData.tech_stack.backend;
890
-
891
- // Extract framework keyword
892
- if (be.framework) {
893
- const frameworkKeyword = be.framework.split(/\s|\./)[0].toLowerCase(); // "Express" from "Express.js"
894
- keywords.push(frameworkKeyword);
895
- }
896
-
897
- // Extract ORM keyword
898
- if (be.orm) {
899
- keywords.push(be.orm.toLowerCase());
900
- }
901
-
902
- // Extract API style keyword
903
- if (be.api_style) {
904
- keywords.push(be.api_style.toLowerCase()); // "restful"
905
- }
906
-
907
- // Add common backend keywords
908
- keywords.push('controller', 'service', 'repository', 'backend', 'API', 'endpoint', 'middleware');
909
- }
910
-
911
- // Add database keywords if available
912
- if (archData.tech_stack.database?.primary) {
913
- const dbKeyword = archData.tech_stack.database.primary.split(' ')[0].toLowerCase();
914
- keywords.push(dbKeyword);
915
- }
916
-
917
- console.log(` Generated ${keywords.length} keywords from ARCHITECTURE.md`);
918
- return keywords;
919
- }
920
-
921
- // ------------------------
922
- // Strategy 2: Fallback to tech_stack from command prompt
923
- // ------------------------
924
- console.log('⚠️ No ARCHITECTURE.md, using tech_stack from command prompt');
925
-
926
- if (target_skill === 'frontend-guidelines') {
927
- keywords.push('component', 'page', 'route', 'frontend', 'UI', 'styling');
928
- keywords.push(tech_stack.framework.toLowerCase());
929
- if (tech_stack.ui_library) {
930
- keywords.push(tech_stack.ui_library.toLowerCase().split(' ')[0]);
931
- }
932
- }
933
-
934
- if (target_skill === 'backend-guidelines') {
935
- keywords.push('controller', 'service', 'repository', 'backend', 'API', 'endpoint');
936
- keywords.push(tech_stack.framework.toLowerCase());
937
- if (tech_stack.orm) {
938
- keywords.push(tech_stack.orm.toLowerCase());
939
- }
940
- }
941
-
942
- return keywords;
943
- }
944
- ```
945
-
946
- ---
947
-
948
- ### Phase 6: Return Result
949
-
950
- **Objective**: Provide comprehensive summary to command layer.
951
-
952
- ```json
953
- {
954
- "status": "success",
955
- "skill_name": "frontend-guidelines",
956
- "scope": "frontend-only",
957
- "tech_stack": {
958
- "framework": "React",
959
- "ui_library": "Material-UI v7",
960
- "data_fetching": "TanStack Query"
961
- },
962
- "files_created": [
963
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/SKILL.md",
964
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/component-patterns.md",
965
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/data-fetching.md",
966
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/styling-guide.md",
967
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/routing-guide.md",
968
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/performance.md",
969
- "${DEVFLOW_CLAUDE_DIR:-.claude}/skills/frontend-guidelines/resources/typescript-standards.md"
970
- ],
971
- "skill_rules_updated": true,
972
- "triggers": {
973
- "file_patterns": [
974
- "src/**/*.tsx",
975
- "src/**/*.ts",
976
- "frontend/**/*.tsx"
977
- ],
978
- "keywords": [
979
- "component",
980
- "React",
981
- "MUI",
982
- "styling",
983
- "hooks",
984
- "page",
985
- "route"
986
- ]
987
- },
988
- "context7_status": {
989
- "React": "success",
990
- "Material-UI": "success",
991
- "TanStack Query": "success"
992
- },
993
- "validation": {
994
- "skill_md_line_count": 487,
995
- "constitution_compliant": true,
996
- "skill_rules_valid_json": true
997
- },
998
- "warnings": [],
999
- "recommendations": [
1000
- "Try editing src/components/App.tsx - skill should activate",
1001
- "Customize resources/ with project-specific patterns",
1002
- "Run /core-guidelines --force to regenerate if tech stack changes"
1003
- ]
1004
- }
1005
- ```
1006
-
1007
- ---
1008
-
1009
- ## Error Handling
1010
-
1011
- ### Context7 Library Not Found
1012
-
1013
- ```typescript
1014
- try {
1015
- const libId = await mcp__context7__resolve-library-id({ libraryName: "Vuetify" });
1016
- } catch (error) {
1017
- console.warn(`⚠️ Context7: Library "Vuetify" not found`);
1018
- console.warn(`⚠️ Fallback: Using reference implementation patterns`);
1019
- console.warn(`⚠️ Recommendation: Visit https://vuetifyjs.com for official patterns`);
1020
-
1021
- // Use reference with generic placeholders
1022
- docs.ui_library = {
1023
- fallback: true,
1024
- library: "Vuetify",
1025
- recommendation_url: "https://vuetifyjs.com"
1026
- };
1027
- }
1028
- ```
1029
-
1030
- ### Tech Stack Mismatch
1031
-
1032
- ```typescript
1033
- // If user specifies tech stack but reference is very different
1034
- if (tech_stack.framework === "Angular" && referenceDir.includes("react")) {
1035
- console.warn(`⚠️ Large tech stack difference: Angular vs React reference`);
1036
- console.warn(`⚠️ Generated guidelines may need manual review`);
1037
- console.warn(`⚠️ Focus on framework-agnostic patterns`);
1038
- }
1039
- ```
1040
-
1041
- ### Constitution Violations
1042
-
1043
- ```typescript
1044
- // Check for hardcoded paths
1045
- const violations = [];
1046
- if (/\/Users\/\w+/.test(content)) {
1047
- violations.push("Hardcoded user path detected");
1048
- }
1049
- if (/secret|password|api_key/i.test(content)) {
1050
- violations.push("Potential secret detected");
1051
- }
1052
-
1053
- if (violations.length > 0) {
1054
- throw new Error(`Constitution violations: ${violations.join(', ')}`);
1055
- }
1056
- ```
1057
-
1058
- ---
1059
-
1060
- ## Adaptation Examples
1061
-
1062
- ### React → Vue Component Pattern
1063
-
1064
- **React Reference**:
1065
- ```typescript
1066
- import React from 'react';
1067
-
1068
- interface MyComponentProps {
1069
- userId: number;
1070
- }
1071
-
1072
- export const MyComponent: React.FC<MyComponentProps> = ({ userId }) => {
1073
- return <div>User: {userId}</div>;
1074
- };
1075
-
1076
- export default MyComponent;
1077
- ```
1078
-
1079
- **Adapted to Vue**:
1080
- ```typescript
1081
- <script setup lang="ts">
1082
- interface Props {
1083
- userId: number;
1084
- }
1085
-
1086
- const props = defineProps<Props>();
1087
- </script>
1088
-
1089
- <template>
1090
- <div>User: {{ userId }}</div>
1091
- </template>
1092
- ```
1093
-
1094
- ### Express → Django Routing
1095
-
1096
- **Express Reference**:
1097
- ```typescript
1098
- router.get('/users/:id', userController.getUser);
1099
- ```
1100
-
1101
- **Adapted to Django**:
1102
- ```python
1103
- path('users/<int:id>/', views.get_user, name='get_user'),
1104
- ```
1105
-
1106
- ---
1107
-
1108
- ## Constitution Compliance Checklist
1109
-
1110
- Before returning success:
1111
- - [ ] SKILL.md < 500 lines
1112
- - [ ] No hardcoded paths (no /Users/, ~/git/, C:\)
1113
- - [ ] No secrets or credentials
1114
- - [ ] skill-rules.json is valid JSON
1115
- - [ ] All resources/ files have clear purpose
1116
- - [ ] Progressive disclosure implemented (SKILL.md → resources/)
1117
- - [ ] Code examples are syntactically correct for target framework
1118
- - [ ] File patterns match actual project structure
1119
-
1120
- ---
1121
-
1122
- ## Edge Case Handling
1123
-
1124
- ### Case 1: ARCHITECTURE.md Exists But Outdated
1125
-
1126
- ```typescript
1127
- async function detectOutdatedArchitecture(archData, project_root) {
1128
- const warnings = [];
1129
-
1130
- if (!archData.exists) {
1131
- return { is_outdated: false, warnings: [] };
1132
- }
1133
-
1134
- // Check 1: Module Structure mismatch
1135
- const actualDirs = await listTopLevelDirectories(project_root);
1136
- const declaredDirs = archData.module_structure.directories.map(d => d.replace(/\/$/, ''));
1137
-
1138
- const missingInArch = actualDirs.filter(d => !declaredDirs.some(dd => dd.includes(d) || d.includes(dd)));
1139
- const missingInCode = declaredDirs.filter(d => !actualDirs.some(ad => ad.includes(d) || d.includes(ad)));
1140
-
1141
- if (missingInArch.length > 0) {
1142
- warnings.push({
1143
- type: 'missing_in_architecture',
1144
- message: `Directories exist but not in ARCHITECTURE.md: ${missingInArch.join(', ')}`,
1145
- recommendation: 'Run /core-architecture to update ARCHITECTURE.md'
1146
- });
1147
- }
1148
-
1149
- if (missingInCode.length > 0) {
1150
- warnings.push({
1151
- type: 'missing_in_codebase',
1152
- message: `ARCHITECTURE.md mentions directories that don't exist: ${missingInCode.join(', ')}`,
1153
- recommendation: 'Remove stale entries from ARCHITECTURE.md or create missing directories'
1154
- });
1155
- }
1156
-
1157
- // Check 2: Tech Stack mismatch (if package.json exists)
1158
- try {
1159
- const packageJson = JSON.parse(await Read(`${project_root}/package.json`));
1160
- const declaredFrontend = archData.tech_stack.frontend?.framework;
1161
-
1162
- if (declaredFrontend?.includes('React') && !packageJson.dependencies?.react) {
1163
- warnings.push({
1164
- type: 'tech_stack_mismatch',
1165
- message: 'ARCHITECTURE.md declares React but package.json does not have it',
1166
- recommendation: 'Update ARCHITECTURE.md or install React'
1167
- });
1168
- }
1169
-
1170
- if (declaredFrontend?.includes('Vue') && !packageJson.dependencies?.vue) {
1171
- warnings.push({
1172
- type: 'tech_stack_mismatch',
1173
- message: 'ARCHITECTURE.md declares Vue but package.json does not have it',
1174
- recommendation: 'Update ARCHITECTURE.md or install Vue'
1175
- });
1176
- }
1177
- } catch (error) {
1178
- // package.json doesn't exist or can't be read, skip this check
1179
- }
1180
-
1181
- return {
1182
- is_outdated: warnings.length > 0,
1183
- warnings
1184
- };
1185
- }
1186
-
1187
- // Usage in Phase 0
1188
- async function loadArchitectureDataWithValidation(project_root, target_skill) {
1189
- const archData = await loadArchitectureData(project_root, target_skill);
1190
-
1191
- if (archData.exists) {
1192
- const outdateReport = await detectOutdatedArchitecture(archData, project_root);
1193
-
1194
- if (outdateReport.is_outdated) {
1195
- console.warn('⚠️ ARCHITECTURE.md may be outdated:');
1196
- for (const warning of outdateReport.warnings) {
1197
- console.warn(` - ${warning.message}`);
1198
- console.warn(` Recommendation: ${warning.recommendation}`);
1199
- }
1200
- console.warn('⚠️ Proceeding with available data, but results may be inaccurate.');
1201
-
1202
- // Add warnings to archData
1203
- archData.warnings.push(...outdateReport.warnings.map(w => w.message));
1204
- }
1205
- }
1206
-
1207
- return archData;
1208
- }
1209
- ```
1210
-
1211
- ### Case 2: ARCHITECTURE.md Exists But No Tech Stack Info
1212
-
1213
- ```typescript
1214
- function handleMissingTechStack(archData, tech_stack_from_prompt) {
1215
- if (archData.exists && !archData.tech_stack.frontend && !archData.tech_stack.backend) {
1216
- console.warn('⚠️ ARCHITECTURE.md exists but contains no tech stack information');
1217
- console.warn('⚠️ Using tech stack from command prompt');
1218
-
1219
- // Merge with command prompt data
1220
- archData.tech_stack = tech_stack_from_prompt;
1221
- archData.source = 'architecture_md + command_prompt';
1222
- archData.warnings.push('ARCHITECTURE.md has no tech stack info. Using command prompt data.');
1223
- }
1224
-
1225
- return archData;
1226
- }
1227
- ```
1228
-
1229
- ### Case 3: Monorepo Detection
1230
-
1231
- ```typescript
1232
- function detectMonorepo(archData) {
1233
- if (!archData.exists || archData.module_structure.directories.length === 0) {
1234
- return null;
1235
- }
1236
-
1237
- // Check for multiple app directories
1238
- const appPatterns = ['apps/', 'packages/'];
1239
- const detectedApps = archData.module_structure.directories.filter(dir =>
1240
- appPatterns.some(pattern => dir.includes(pattern))
1241
- );
1242
-
1243
- if (detectedApps.length >= 2) {
1244
- return {
1245
- type: 'monorepo',
1246
- apps: detectedApps,
1247
- message: `Monorepo detected with ${detectedApps.length} apps: ${detectedApps.join(', ')}`,
1248
- recommendation: 'Specify target app in command prompt or generate separate guidelines for each app'
1249
- };
1250
- }
1251
-
1252
- // Check for multiple tech stacks in same layer
1253
- const hasMixedFrontend = archData.module_structure.directories.some(d => d.includes('react')) &&
1254
- archData.module_structure.directories.some(d => d.includes('vue'));
1255
-
1256
- if (hasMixedFrontend) {
1257
- return {
1258
- type: 'mixed_tech_stack',
1259
- message: 'Multiple frontend frameworks detected in directory structure',
1260
- recommendation: 'Generate separate guidelines for each framework or choose primary framework'
1261
- };
1262
- }
1263
-
1264
- return null;
1265
- }
1266
-
1267
- // Usage in Phase 0
1268
- const monorepoInfo = detectMonorepo(archData);
1269
- if (monorepoInfo) {
1270
- console.warn(`⚠️ ${monorepoInfo.message}`);
1271
- console.warn(`⚠️ ${monorepoInfo.recommendation}`);
1272
-
1273
- archData.warnings.push(monorepoInfo.message);
1274
- // Note: Don't throw error, just warn. Let command layer decide how to handle.
1275
- }
1276
- ```
1277
-
1278
- ### Case 4: ARCHITECTURE.md Parsing Errors
1279
-
1280
- ```typescript
1281
- function handleParsingError(error, section) {
1282
- console.error(`❌ Failed to parse ${section} from ARCHITECTURE.md: ${error.message}`);
1283
-
1284
- // Return empty/fallback data
1285
- if (section === 'tech_stack') {
1286
- return {};
1287
- }
1288
-
1289
- if (section === 'module_structure') {
1290
- return { directories: [], tree: {} };
1291
- }
1292
-
1293
- if (section === 'adrs') {
1294
- return [];
1295
- }
1296
- }
1297
-
1298
- // Usage in parsers
1299
- async function parseTechStackSection(content, target_skill) {
1300
- try {
1301
- // ... parsing logic ...
1302
- } catch (error) {
1303
- return handleParsingError(error, 'tech_stack');
1304
- }
1305
- }
1306
- ```
1307
-
1308
- ---
1309
-
1310
- ## Summary of Responsibilities
1311
-
1312
- **This agent**:
1313
- - ✅ Reads reference implementations
1314
- - ✅ Fetches official documentation via Context7
1315
- - ✅ Adapts content to target tech stack
1316
- - ✅ Generates SKILL.md + resources/
1317
- - ✅ Updates skill-rules.json
1318
- - ✅ Validates output
1319
- - ✅ Returns comprehensive result
1320
-
1321
- **This agent DOES NOT**:
1322
- - ❌ Ask user questions
1323
- - ❌ Make assumptions (all info in prompt)
1324
- - ❌ Generate both frontend and backend in one call
1325
- - ❌ Modify files outside ${DEVFLOW_CLAUDE_DIR:-.claude}/skills/
1326
-
1327
- ---
1328
-
1329
- Now execute the workflow above based on the tech stack provided in the prompt!