@xulthekl/team-flow 0.22.4

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 (405) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.agents/skills +1 -0
  3. package/.claude/always/phase-guard.md +3 -0
  4. package/.claude-plugin/marketplace.json +20 -0
  5. package/.claude-plugin/plugin.json +31 -0
  6. package/.codex-plugin/plugin.json +45 -0
  7. package/.codexignore +6 -0
  8. package/.cursor-plugin/marketplace.json +17 -0
  9. package/.cursor-plugin/plugin.json +31 -0
  10. package/.github/copilot-instructions.md +15 -0
  11. package/.github/dependabot.yml +10 -0
  12. package/.github/plugin/marketplace.json +42 -0
  13. package/.github/workflows/ci.yml +98 -0
  14. package/.github/workflows/hol-plugin-scanner.yml +17 -0
  15. package/.opencode/INSTALL.md +61 -0
  16. package/.opencode/plugins/team-flow.js +70 -0
  17. package/AGENTS.md +280 -0
  18. package/CHANGELOG.md +635 -0
  19. package/CONTRIBUTING.md +115 -0
  20. package/GEMINI.md +14 -0
  21. package/HANDOFF.md +219 -0
  22. package/INSTALL.md +810 -0
  23. package/LICENSE +21 -0
  24. package/README.md +185 -0
  25. package/SECURITY.md +37 -0
  26. package/agents/bug-investigator.md +180 -0
  27. package/agents/change-split-auditor.md +257 -0
  28. package/agents/code-reviewer.md +171 -0
  29. package/agents/cross-change-consistency-checker.md +215 -0
  30. package/agents/prd-completeness-reviewer.md +197 -0
  31. package/agents/prototype-builder.md +230 -0
  32. package/agents/prototype-env-scout.md +156 -0
  33. package/agents/prototype-reviewer.md +226 -0
  34. package/assets/icon.svg +6 -0
  35. package/dist/index.d.ts +13 -0
  36. package/dist/index.js +5 -0
  37. package/dist/parsing/change-parser.d.ts +12 -0
  38. package/dist/parsing/change-parser.js +54 -0
  39. package/dist/parsing/requirement-blocks.d.ts +31 -0
  40. package/dist/parsing/requirement-blocks.js +192 -0
  41. package/dist/schema/base.d.ts +7 -0
  42. package/dist/schema/base.js +1 -0
  43. package/dist/schema/change.d.ts +25 -0
  44. package/dist/schema/change.js +1 -0
  45. package/dist/schema/index.d.ts +3 -0
  46. package/dist/schema/index.js +1 -0
  47. package/dist/schema/spec.d.ts +11 -0
  48. package/dist/schema/spec.js +1 -0
  49. package/dist/validation/constants.d.ts +42 -0
  50. package/dist/validation/constants.js +42 -0
  51. package/dist/validation/tokenizer.d.ts +17 -0
  52. package/dist/validation/tokenizer.js +173 -0
  53. package/dist/validation/types.d.ts +40 -0
  54. package/dist/validation/types.js +1 -0
  55. package/dist/validation/validator.d.ts +21 -0
  56. package/dist/validation/validator.js +489 -0
  57. package/docs/README_en.md +358 -0
  58. package/docs/artifact-contract.md +96 -0
  59. package/docs/decision-points.md +88 -0
  60. package/docs/e2e-integration-design.md +207 -0
  61. package/docs/examples/README.md +25 -0
  62. package/docs/examples/add-dark-mode/README.md +13 -0
  63. package/docs/examples/add-dark-mode/design.md +49 -0
  64. package/docs/examples/add-dark-mode/execution-contract.md +56 -0
  65. package/docs/examples/add-dark-mode/proposal.md +46 -0
  66. package/docs/examples/add-dark-mode/specs/ui-theme/spec.md +35 -0
  67. package/docs/examples/add-dark-mode/tasks.md +26 -0
  68. package/docs/examples/refactor-auth-boundary/README.md +15 -0
  69. package/docs/examples/refactor-auth-boundary/design.md +41 -0
  70. package/docs/examples/refactor-auth-boundary/execution-contract.md +61 -0
  71. package/docs/examples/refactor-auth-boundary/proposal.md +47 -0
  72. package/docs/examples/refactor-auth-boundary/specs/auth-boundary/spec.md +45 -0
  73. package/docs/examples/refactor-auth-boundary/tasks.md +25 -0
  74. package/docs/plans/2026-07-07-fix-batch-design.md +68 -0
  75. package/docs/plans/2026-07-20-001-refactor-skill-collaboration-protocol-plan.md +128 -0
  76. package/docs/platform-matrix.md +45 -0
  77. package/docs/prototype-design-research.md +206 -0
  78. package/docs/release-checklist.md +96 -0
  79. package/docs/showcase.html +699 -0
  80. package/docs/skill-rename-v0.8.0.md +49 -0
  81. package/docs/state-machine.md +162 -0
  82. package/gemini-extension.json +6 -0
  83. package/hooks/hooks-cursor.json +8 -0
  84. package/hooks/hooks.json +26 -0
  85. package/hooks/pre-tool-use-guard +116 -0
  86. package/hooks/session-start +14 -0
  87. package/llms.txt +51 -0
  88. package/package.json +48 -0
  89. package/plugin.json +27 -0
  90. package/prd/v1/plan.md +443 -0
  91. package/prd/v1/prd.md +580 -0
  92. package/scripts/check-update.mjs +91 -0
  93. package/scripts/check-version-consistency.mjs +345 -0
  94. package/scripts/ensure-branch.mjs +71 -0
  95. package/scripts/get-config +31 -0
  96. package/scripts/guard/checks/artifacts-exist.mjs +36 -0
  97. package/scripts/guard/checks/contract-current.mjs +33 -0
  98. package/scripts/guard/checks/contract-fresh.mjs +17 -0
  99. package/scripts/guard/checks/dp-gate-passed.mjs +35 -0
  100. package/scripts/guard/checks/dp3-approved.mjs +22 -0
  101. package/scripts/guard/checks/execution-plan-ready.mjs +40 -0
  102. package/scripts/guard/checks/execution-reviews-passed.mjs +36 -0
  103. package/scripts/guard/checks/schema-valid.mjs +63 -0
  104. package/scripts/guard/checks/specs-merged.mjs +51 -0
  105. package/scripts/guard/checks/tasks-complete.mjs +31 -0
  106. package/scripts/guard/checks/tests-passing.mjs +31 -0
  107. package/scripts/guard/design-token-guard.mjs +237 -0
  108. package/scripts/guard/guard.mjs +205 -0
  109. package/scripts/infer-workflow.mjs +136 -0
  110. package/scripts/install-amazon-q.mjs +9 -0
  111. package/scripts/install-cline.mjs +9 -0
  112. package/scripts/install-continue.mjs +9 -0
  113. package/scripts/install-cursor.mjs +265 -0
  114. package/scripts/install-git-hooks.mjs +82 -0
  115. package/scripts/install-kiro.mjs +9 -0
  116. package/scripts/install-pi.mjs +9 -0
  117. package/scripts/install-qoder.mjs +9 -0
  118. package/scripts/install-qwen.mjs +9 -0
  119. package/scripts/install-roocode.mjs +9 -0
  120. package/scripts/install-windsurf.mjs +9 -0
  121. package/scripts/install-zcode.mjs +265 -0
  122. package/scripts/lib/cmd-audit.mjs +127 -0
  123. package/scripts/lib/cmd-checkpoint.mjs +118 -0
  124. package/scripts/lib/cmd-config.mjs +88 -0
  125. package/scripts/lib/cmd-doctor.mjs +267 -0
  126. package/scripts/lib/cmd-execution.mjs +206 -0
  127. package/scripts/lib/cmd-handoff.mjs +94 -0
  128. package/scripts/lib/cmd-inject.mjs +310 -0
  129. package/scripts/lib/cmd-install-amazon-q.mjs +11 -0
  130. package/scripts/lib/cmd-install-cline.mjs +11 -0
  131. package/scripts/lib/cmd-install-continue.mjs +11 -0
  132. package/scripts/lib/cmd-install-cursor.mjs +14 -0
  133. package/scripts/lib/cmd-install-kiro.mjs +11 -0
  134. package/scripts/lib/cmd-install-pi.mjs +11 -0
  135. package/scripts/lib/cmd-install-qoder.mjs +11 -0
  136. package/scripts/lib/cmd-install-qwen.mjs +11 -0
  137. package/scripts/lib/cmd-install-roocode.mjs +11 -0
  138. package/scripts/lib/cmd-install-windsurf.mjs +11 -0
  139. package/scripts/lib/cmd-install-workbuddy.mjs +359 -0
  140. package/scripts/lib/cmd-install-zcode.mjs +14 -0
  141. package/scripts/lib/cmd-isolate.mjs +37 -0
  142. package/scripts/lib/cmd-list.mjs +71 -0
  143. package/scripts/lib/cmd-runtime.mjs +85 -0
  144. package/scripts/lib/cmd-solutions.mjs +71 -0
  145. package/scripts/lib/cmd-state.mjs +231 -0
  146. package/scripts/lib/cmd-sync.mjs +102 -0
  147. package/scripts/lib/cmd-validate.mjs +105 -0
  148. package/scripts/lib/cmd-version.mjs +148 -0
  149. package/scripts/lib/config-loader.mjs +107 -0
  150. package/scripts/lib/execution-plan.mjs +492 -0
  151. package/scripts/lib/execution-recommendation.mjs +221 -0
  152. package/scripts/lib/hash.mjs +74 -0
  153. package/scripts/lib/install.mjs +267 -0
  154. package/scripts/lib/platform-runtime-inventory.mjs +27 -0
  155. package/scripts/lib/platforms.mjs +165 -0
  156. package/scripts/lib/prototype-sync.mjs +192 -0
  157. package/scripts/lib/sdd-overlay.mjs +262 -0
  158. package/scripts/lib/shell-quote.mjs +4 -0
  159. package/scripts/lib/solutions-capture.mjs +102 -0
  160. package/scripts/lib/solutions-index-gen.mjs +112 -0
  161. package/scripts/lib/solutions-inject.mjs +77 -0
  162. package/scripts/lib/solutions-promote.mjs +145 -0
  163. package/scripts/lib/spec-paths.mjs +85 -0
  164. package/scripts/lib/state-loader.mjs +154 -0
  165. package/scripts/lint/lint-skills.mjs +149 -0
  166. package/scripts/lint/rules/behavior-consistency.mjs +56 -0
  167. package/scripts/lint/rules/dp-trigger-points.mjs +60 -0
  168. package/scripts/lint/rules/exception-handling.mjs +59 -0
  169. package/scripts/lint/rules/no-contradictory-instructions.mjs +67 -0
  170. package/scripts/lint/rules/no-redundant-checks.mjs +50 -0
  171. package/scripts/lint/rules/token-rules.mjs +122 -0
  172. package/scripts/review-package +44 -0
  173. package/scripts/task-brief +40 -0
  174. package/scripts/team-flow.mjs +164 -0
  175. package/scripts/token-baseline.mjs +158 -0
  176. package/scripts/validate-artifacts +96 -0
  177. package/scripts/verify-marketplace-release.mjs +59 -0
  178. package/skills/architecture-design/SKILL.md +140 -0
  179. package/skills/architecture-design/chapters/ch01-4a-domains.md +27 -0
  180. package/skills/architecture-design/chapters/ch02-change-cascade.md +27 -0
  181. package/skills/architecture-design/chapters/ch03-architecture-outputs.md +25 -0
  182. package/skills/architecture-design/chapters/ch04-entity-to-aggregate.md +27 -0
  183. package/skills/architecture-design/chapters/ch05-cqrs.md +32 -0
  184. package/skills/architecture-design/chapters/ch06-integration.md +54 -0
  185. package/skills/architecture-design/cheatsheet.md +51 -0
  186. package/skills/architecture-design/glossary.md +23 -0
  187. package/skills/architecture-design/patterns.md +32 -0
  188. package/skills/bug-investigator/SKILL.md +77 -0
  189. package/skills/build-executor/SKILL.md +163 -0
  190. package/skills/build-executor/implementer-prompt.md +162 -0
  191. package/skills/build-executor/references/execution-modes.md +86 -0
  192. package/skills/build-executor/task-reviewer-prompt.md +195 -0
  193. package/skills/ce-brainstorm/SKILL.md +415 -0
  194. package/skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
  195. package/skills/ce-brainstorm/references/blindspot-pass.md +70 -0
  196. package/skills/ce-brainstorm/references/brainstorm-sections.md +285 -0
  197. package/skills/ce-brainstorm/references/handoff.md +168 -0
  198. package/skills/ce-brainstorm/references/html-rendering.md +634 -0
  199. package/skills/ce-brainstorm/references/markdown-rendering.md +241 -0
  200. package/skills/ce-brainstorm/references/model-tiers.md +9 -0
  201. package/skills/ce-brainstorm/references/prd-mapping.md +71 -0
  202. package/skills/ce-brainstorm/references/product-pressure-test.md +42 -0
  203. package/skills/ce-brainstorm/references/reasoning-elevation.md +63 -0
  204. package/skills/ce-brainstorm/references/settled-decisions.md +45 -0
  205. package/skills/ce-brainstorm/references/synthesis-summary.md +282 -0
  206. package/skills/ce-brainstorm/references/universal-brainstorming.md +73 -0
  207. package/skills/ce-brainstorm/references/verdict-routing.md +26 -0
  208. package/skills/ce-brainstorm/references/visual-probes.md +158 -0
  209. package/skills/ce-brainstorm/scripts/visual-probe-server.js +418 -0
  210. package/skills/ce-compound/SKILL.md +114 -0
  211. package/skills/ce-compound/assets/resolution-template.md +94 -0
  212. package/skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
  213. package/skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
  214. package/skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
  215. package/skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
  216. package/skills/ce-compound/references/agents/performance-oracle.md +108 -0
  217. package/skills/ce-compound/references/agents/security-sentinel.md +91 -0
  218. package/skills/ce-compound/references/agents/session-historian.md +83 -0
  219. package/skills/ce-compound/references/concepts-vocabulary.md +78 -0
  220. package/skills/ce-compound/references/full-mode-workflow.md +413 -0
  221. package/skills/ce-compound/references/grounding-validation.md +84 -0
  222. package/skills/ce-compound/references/lightweight-mode.md +53 -0
  223. package/skills/ce-compound/references/output-standards.md +182 -0
  224. package/skills/ce-compound/references/promotion-rules.md +38 -0
  225. package/skills/ce-compound/references/schema.yaml +231 -0
  226. package/skills/ce-compound/references/three-tier-index.md +55 -0
  227. package/skills/ce-compound/references/v0.5-upgrade.md +32 -0
  228. package/skills/ce-compound/references/write-flow.md +36 -0
  229. package/skills/ce-compound/references/yaml-schema.md +118 -0
  230. package/skills/ce-compound/scripts/session-history/discover-sessions.sh +130 -0
  231. package/skills/ce-compound/scripts/session-history/extract-errors.py +254 -0
  232. package/skills/ce-compound/scripts/session-history/extract-metadata.py +456 -0
  233. package/skills/ce-compound/scripts/session-history/extract-skeleton.py +575 -0
  234. package/skills/ce-compound/scripts/validate-doc-claims.py +346 -0
  235. package/skills/ce-compound/scripts/validate-frontmatter.py +137 -0
  236. package/skills/ce-ideate/SKILL.md +402 -0
  237. package/skills/ce-ideate/references/agents/issue-intelligence-analyst.md +200 -0
  238. package/skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
  239. package/skills/ce-ideate/references/agents/slack-researcher.md +127 -0
  240. package/skills/ce-ideate/references/agents/web-researcher.md +121 -0
  241. package/skills/ce-ideate/references/divergent-ideation.md +89 -0
  242. package/skills/ce-ideate/references/html-rendering.md +634 -0
  243. package/skills/ce-ideate/references/ideation-sections.md +191 -0
  244. package/skills/ce-ideate/references/markdown-rendering.md +238 -0
  245. package/skills/ce-ideate/references/post-ideation-workflow.md +167 -0
  246. package/skills/ce-ideate/references/universal-ideation.md +107 -0
  247. package/skills/ce-ideate/references/web-research-cache.md +56 -0
  248. package/skills/ce-plan/SKILL.md +137 -0
  249. package/skills/ce-plan/references/agents/agent-native-planning-strategist.md +62 -0
  250. package/skills/ce-plan/references/agents/architecture-strategist.md +46 -0
  251. package/skills/ce-plan/references/agents/best-practices-researcher.md +114 -0
  252. package/skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
  253. package/skills/ce-plan/references/agents/data-migration-reviewer.md +103 -0
  254. package/skills/ce-plan/references/agents/deployment-verification-agent.md +157 -0
  255. package/skills/ce-plan/references/agents/framework-docs-researcher.md +93 -0
  256. package/skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
  257. package/skills/ce-plan/references/agents/learnings-researcher.md +247 -0
  258. package/skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
  259. package/skills/ce-plan/references/agents/performance-oracle.md +108 -0
  260. package/skills/ce-plan/references/agents/repo-research-analyst.md +258 -0
  261. package/skills/ce-plan/references/agents/security-sentinel.md +91 -0
  262. package/skills/ce-plan/references/agents/slack-researcher.md +127 -0
  263. package/skills/ce-plan/references/agents/spec-flow-analyzer.md +80 -0
  264. package/skills/ce-plan/references/agents/web-researcher.md +121 -0
  265. package/skills/ce-plan/references/approach-altitude.md +55 -0
  266. package/skills/ce-plan/references/change-splitting.md +65 -0
  267. package/skills/ce-plan/references/completion-contract.md +33 -0
  268. package/skills/ce-plan/references/core-principles.md +40 -0
  269. package/skills/ce-plan/references/deepening-workflow.md +263 -0
  270. package/skills/ce-plan/references/dependency-graph.md +36 -0
  271. package/skills/ce-plan/references/html-rendering.md +634 -0
  272. package/skills/ce-plan/references/intake-routing.md +189 -0
  273. package/skills/ce-plan/references/markdown-rendering.md +238 -0
  274. package/skills/ce-plan/references/plan-handoff.md +150 -0
  275. package/skills/ce-plan/references/plan-sections.md +427 -0
  276. package/skills/ce-plan/references/plan-structure.md +120 -0
  277. package/skills/ce-plan/references/planning-modes.md +69 -0
  278. package/skills/ce-plan/references/reasoning-elevation.md +63 -0
  279. package/skills/ce-plan/references/research-workflow.md +165 -0
  280. package/skills/ce-plan/references/review-and-write.md +127 -0
  281. package/skills/ce-plan/references/settled-decisions.md +45 -0
  282. package/skills/ce-plan/references/synthesis-summary.md +418 -0
  283. package/skills/ce-plan/references/universal-planning.md +168 -0
  284. package/skills/ce-proof/SKILL.md +346 -0
  285. package/skills/ce-strategy/SKILL.md +97 -0
  286. package/skills/ce-strategy/references/interview.md +143 -0
  287. package/skills/ce-strategy/references/strategy-template.md +89 -0
  288. package/skills/code-reviewer/SKILL.md +84 -0
  289. package/skills/code-reviewer/code-reviewer-prompt.md +195 -0
  290. package/skills/contract-builder/SKILL.md +72 -0
  291. package/skills/design-system/SKILL.md +75 -0
  292. package/skills/design-system/references/agents/design-system-architect.md +138 -0
  293. package/skills/design-system/references/creation-flow.md +170 -0
  294. package/skills/design-system/references/preview-template.html +319 -0
  295. package/skills/design-system/references/token-derivation.md +115 -0
  296. package/skills/design-system/references/variant-schema.md +60 -0
  297. package/skills/e2e/SKILL.md +56 -0
  298. package/skills/e2e/references/test-verifier.md +40 -0
  299. package/skills/need-explorer/SKILL.md +79 -0
  300. package/skills/prototype/SKILL.md +98 -0
  301. package/skills/prototype/references/agents/design-system-architect.md +122 -0
  302. package/skills/prototype/references/checklist.md +82 -0
  303. package/skills/prototype/references/craft/accessibility-baseline.md +71 -0
  304. package/skills/prototype/references/craft/anti-ai-slop.md +87 -0
  305. package/skills/prototype/references/craft/laws-of-ux.md +60 -0
  306. package/skills/prototype/references/craft/state-coverage.md +81 -0
  307. package/skills/prototype/references/craft/typography-hierarchy.md +50 -0
  308. package/skills/prototype/references/layouts.md +223 -0
  309. package/skills/prototype/references/orchestration-flow.md +101 -0
  310. package/skills/prototype/references/prototype-scaffold/assets/design-tokens.css +19 -0
  311. package/skills/prototype/references/prototype-scaffold/components/button.html +3 -0
  312. package/skills/prototype/references/prototype-scaffold/design-system.md +7 -0
  313. package/skills/prototype/references/prototype-scaffold/flow.md +11 -0
  314. package/skills/prototype/references/prototype-scaffold/index.html +20 -0
  315. package/skills/prototype/references/prototype-scaffold/pages/index.html +11 -0
  316. package/skills/prototype/references/template.html +396 -0
  317. package/skills/release-archivist/SKILL.md +166 -0
  318. package/skills/release-archivist/references/closing-procedures.md +81 -0
  319. package/skills/session-handoff/SKILL.md +110 -0
  320. package/skills/session-handoff/references/context-extraction.md +70 -0
  321. package/skills/session-handoff/references/handoff-template.md +90 -0
  322. package/skills/session-handoff/references/skill-recommendation.md +43 -0
  323. package/skills/spec-merger/SKILL.md +66 -0
  324. package/skills/spec-writer/SKILL.md +149 -0
  325. package/skills/workflow-bootstrap/SKILL.md +148 -0
  326. package/skills/workflow-bootstrap/references/agents/codebase-recon-analyst.md +121 -0
  327. package/skills/workflow-bootstrap/references/b1-reconnaissance.md +80 -0
  328. package/skills/workflow-bootstrap/scripts/recon-probe.sh +328 -0
  329. package/skills/workflow-feedback/SKILL.md +120 -0
  330. package/skills/workflow-feedback/references/category-guide.md +121 -0
  331. package/skills/workflow-feedback/references/feedback-template.md +73 -0
  332. package/skills/workflow-feedback/references/review-mode.md +92 -0
  333. package/skills/workflow-orchestrator/SKILL.md +94 -0
  334. package/skills/workflow-orchestrator/references/feedback-loops.md +56 -0
  335. package/skills/workflow-orchestrator/references/s1-path-router.md +81 -0
  336. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +96 -0
  337. package/skills/workflow-orchestrator/references/s3-plan-pipeline.md +50 -0
  338. package/skills/workflow-orchestrator/references/s4-split-validate.md +108 -0
  339. package/skills/workflow-orchestrator/references/s5-monitoring.md +61 -0
  340. package/skills/workflow-orchestrator/references/state-model.md +185 -0
  341. package/skills/workflow-start/SKILL.md +147 -0
  342. package/skills/workflow-start/references/routing-rules.md +155 -0
  343. package/src/index.ts +16 -0
  344. package/src/parsing/change-parser.ts +79 -0
  345. package/src/parsing/requirement-blocks.ts +244 -0
  346. package/src/schema/base.ts +8 -0
  347. package/src/schema/change.ts +29 -0
  348. package/src/schema/index.ts +3 -0
  349. package/src/schema/spec.ts +12 -0
  350. package/src/validation/constants.ts +53 -0
  351. package/src/validation/tokenizer.ts +180 -0
  352. package/src/validation/types.ts +47 -0
  353. package/src/validation/validator.ts +552 -0
  354. package/templates/abandonment-summary.md +29 -0
  355. package/templates/design.md +37 -0
  356. package/templates/execution-contract.md +99 -0
  357. package/templates/plan.md +86 -0
  358. package/templates/prd.md +468 -0
  359. package/templates/proposal.md +37 -0
  360. package/templates/spec.md +31 -0
  361. package/templates/tasks.md +47 -0
  362. package/tests/e2e.test.mjs +266 -0
  363. package/tests/lib/cmd-audit.test.mjs +202 -0
  364. package/tests/lib/cmd-checkpoint.test.mjs +98 -0
  365. package/tests/lib/cmd-config.test.mjs +101 -0
  366. package/tests/lib/cmd-doctor.test.mjs +450 -0
  367. package/tests/lib/cmd-execution.test.mjs +647 -0
  368. package/tests/lib/cmd-handoff.test.mjs +137 -0
  369. package/tests/lib/cmd-inject.test.mjs +218 -0
  370. package/tests/lib/cmd-install-workbuddy.test.mjs +113 -0
  371. package/tests/lib/cmd-install-zcode.test.mjs +42 -0
  372. package/tests/lib/cmd-isolate.test.mjs +68 -0
  373. package/tests/lib/cmd-list.test.mjs +127 -0
  374. package/tests/lib/cmd-runtime.test.mjs +83 -0
  375. package/tests/lib/cmd-state-missing.test.mjs +65 -0
  376. package/tests/lib/cmd-state.test.mjs +365 -0
  377. package/tests/lib/cmd-sync-paths.test.mjs +84 -0
  378. package/tests/lib/cmd-validate-paths.test.mjs +90 -0
  379. package/tests/lib/config-loader.test.mjs +175 -0
  380. package/tests/lib/ensure-branch.test.mjs +59 -0
  381. package/tests/lib/execution-control-plane.test.mjs +168 -0
  382. package/tests/lib/execution-plan.test.mjs +474 -0
  383. package/tests/lib/guard-specs-merged.test.mjs +108 -0
  384. package/tests/lib/guard-tests-passing.test.mjs +112 -0
  385. package/tests/lib/guard-transitions.test.mjs +262 -0
  386. package/tests/lib/guard.test.mjs +611 -0
  387. package/tests/lib/hash.test.mjs +138 -0
  388. package/tests/lib/infer-workflow.test.mjs +161 -0
  389. package/tests/lib/install-git-hooks.test.mjs +20 -0
  390. package/tests/lib/marketplace-release-docs.test.mjs +31 -0
  391. package/tests/lib/minimality-discipline.test.mjs +37 -0
  392. package/tests/lib/model-profiles-docs.test.mjs +33 -0
  393. package/tests/lib/node20-compatibility.test.mjs +73 -0
  394. package/tests/lib/node20-test-entry.test.mjs +17 -0
  395. package/tests/lib/platform-runtime-distribution.test.mjs +150 -0
  396. package/tests/lib/raw-mode-smoke.test.mjs +42 -0
  397. package/tests/lib/sdd-overlay.test.mjs +118 -0
  398. package/tests/lib/spec-paths.test.mjs +80 -0
  399. package/tests/lib/state-loader.test.mjs +251 -0
  400. package/tests/lib/token-baseline.test.mjs +72 -0
  401. package/tests/lib/token-rules.test.mjs +94 -0
  402. package/tests/lib/verify-marketplace-release.test.mjs +128 -0
  403. package/tests/tsconfig.json +12 -0
  404. package/token-baseline.json +95 -0
  405. package/tsconfig.json +14 -0
@@ -0,0 +1,25 @@
1
+ # ch03 · 架构产出三层 + 治理三支柱
2
+
3
+ ## 架构产出三层(管理从元素层抓起)
4
+ 乐高类比:元素=积木、制品=图纸、交付件=成品。
5
+ | 层 | 定位 | 例子 | 4A 映射 |
6
+ |---|---|---|---|
7
+ | 元素 | 最小构建单元 | 活动/数据实体/功能/技术服务 | 跨四域的一等元素 |
8
+ | 制品 | 元素按规则组合 | 流程图/数据模型/架构蓝图 | Context Map、CQRS 模型 |
9
+ | 交付件 | 面向受众的完整输出 | 评审报告/选型书 | 系统架构设计文档 |
10
+
11
+ - 元素是"积木",制品是"图纸"(一份功能规格说明书引用多个功能元素,但功能元素≠制品)。
12
+ - 治理从**标准化元素层**抓起:建立命名注册表,避免语义漂移。
13
+
14
+ ## 治理三支柱(保障非束缚)
15
+ | 支柱 | 类比 | 核心机制 |
16
+ |---|---|---|
17
+ | 生命周期管理 | 红绿灯 | 资产六态:草稿→评审中→已发布→已退役→已归档→已废弃 |
18
+ | 审批流程 | 驾照考试 | 影响分析→方案评审→批准发布(三步才进"已发布") |
19
+ | 成熟度评估 | 年检 | 五级:初始→可重复→已定义→已管理→优化;维度=覆盖率/一致性达标率/变更响应速度 |
20
+
21
+ > 三支柱缺一不可:只红绿灯无驾照=乱;只驾照无年检=坏;只年检无红绿灯=瘫。
22
+
23
+ ## 应用提示(一人创业适配)
24
+ - 全局 ARCHITECTURE.md 用"三层"组织:元素层(实体/聚合/技术服务清单)、制品层(Context Map/CQRS)、交付件层(评审文档,可**生成视图**而非手写巨著)。
25
+ - 一人创业不必跑完整委员会审批;用"当前态视图 + 演进日志"替代重审批(见 ch06),成熟度评估降级为自查清单。
@@ -0,0 +1,27 @@
1
+ # ch04 · 业务实体→聚合→限界上下文
2
+
3
+ ## 业务实体(识别起点)
4
+ - 定义:BA 流程中的**表证单书**(订单/合同/工单/客户档案/库存记录),是业务概念而非数据库表。
5
+ - 全生命周期:创建→变更→归档(如订单:提交→状态流转→可查历史)。
6
+
7
+ ## 活动对象矩阵(实体发现+合并)
8
+ - 横轴=BA 的 L5 活动,纵轴=初步筛出的业务对象;交叉格符号:●主对象 ◐从对象 ○被关联 △新产生。
9
+ - 用途:① 出现任何符号的列即业务实体;② 两对象符号模式重叠度 **>70% 应合并**(如"车辆"与"库存车辆")。
10
+
11
+ ## DDD 聚合四要素(核心框架 F4)
12
+ - 实体:唯一标识(订单号),属性可变标识不变。
13
+ - 值对象:无独立标识(如地址),属性变即另一对象。
14
+ - 聚合根:外部唯一入口,通过根访问内部对象。
15
+ - 事务边界:聚合内所有操作须在一个事务完成(如创建订单同时建头/行项目/算总价)。
16
+ - **硬规则**:聚合仅存在于业务服务;数据服务(跨聚合查询分析)、技术服务(消息队列)**无聚合**。
17
+
18
+ ## 限界上下文 / Context Map(核心框架 F5)
19
+ - 限界上下文=语义边界,对应 L3 应用服务;相关聚合组成上下文。
20
+ - 同术语异义须显式映射(映射类型):
21
+ - **Shared Kernel(共享内核)**:两上下文共享部分模型。
22
+ - **Anti-Corruption Layer(防腐层)**:下游翻译上游模型,防止概念泄漏。
23
+ - **Open Host Service(开放主机)**:上游暴露标准协议供多下游消费。
24
+
25
+ ## 应用提示
26
+ - 每变更设计先画"涉及实体的活动对象矩阵";再定聚合根与事务边界;最后落到全局 Context Map。
27
+ - 全局 ARCHITECTURE.md 的"元素层"须显式列出四域一等元素:BA 活动 / IA 数据实体 / AA 功能与聚合 / TA 技术服务。
@@ -0,0 +1,32 @@
1
+ # ch05 · 写/读模型(CQRS)、指令分流、三维判定
2
+
3
+ ## 两类业务对象(性质决定模型)
4
+ | 类型 | 判断 | 映射 | 特征 |
5
+ |---|---|---|---|
6
+ | 事务型 | 操作它时业务世界发生变化?有 | 写模型(聚合) | 有生命周期,事务边界,不可重复计算 |
7
+ | 分析型 | 能否重复计算(跑两遍结果一致)?能 | 读模型 | 派生洞察,无事务,按维度组织 |
8
+
9
+ > 同一业务名词可能既是事务型又是分析型("订单"记交易,"订单汇总"是分析)——同一数据源的两个投影,即 CQRS 本质。
10
+
11
+ ## L6 指令与两类聚合(核心框架 F6)
12
+ - **Command** → 写模型:改变聚合状态(创建订单、扣库存)。
13
+ - **Read** → 写模型:有业务逻辑但**不改**状态(校验优惠券适用性)。
14
+ - **Query** → 需分流(见阻断测试):纯查询。
15
+ - **CRUDL**:C/U/D/L = Command → 业务服务;R 判 Read/Query。
16
+
17
+ ## 阻断测试(Query 分流核心判据)
18
+ > 将此服务**阻断(延迟)1 小时**,下游业务操作能否继续?
19
+ > - 不能继续 → **业务服务**(支撑主干流程,如查可点菜品、跨聚合宽表)
20
+ > - 能继续 → **数据服务**(分析决策支撑,如销售报表、经营分析)
21
+
22
+ **关键洞察**:分流依据是"它在业务流程中扮演什么角色",不是"它是读还是写"。把支撑流程的 Query(只读但阻断)误归数据服务,会导致异步加载、体验崩溃。
23
+
24
+ ## 三维判定(验证工具,核心框架 F7)
25
+ 决策树:
26
+ 1. **失忆测试**:清空业务记忆还能工作?能→技术服务(TA),结束;不能→进入 2。
27
+ 2. **阻断测试**:阻断 1h 下游能继续?不能→业务服务;能→数据服务。
28
+ 3. **孤岛测试**:谁在调用?私有层 / 领域共通层 / 企业共通层(定层级)。
29
+
30
+ ## 应用提示
31
+ - API 设计(api.md)须对每个端点标 Command/Read/Query,Query 标注经阻断测试的服务归属。
32
+ - 全局 DATABASE.md 记录读写模型派生机理:读模型派生自写模型(CQRS)。
@@ -0,0 +1,54 @@
1
+ # ch06 · 与 team-flow / compound-engineering 的集成
2
+
3
+ 本章把 F1–F7 落到两个工作流:team-flow(开发过程,change-centric)+ compound-engineering(全局产物+复利)。融合四方专家会审的硬伤修正。
4
+
5
+ ## 产物布局
6
+ ```
7
+ 项目根/
8
+ ├── STRATEGY.md # 产品/BA 锚点(compound,不动)
9
+ ├── CONCEPTS.md # 领域词汇(追加 DDD 术语,复利累积)
10
+ ├── docs/architecture/ # 【技术锚点层,独立于 STRATEGY.md】
11
+ │ ├── ARCHITECTURE.md # 全局架构(瘦锚点:Context Map+聚合清单+关键决策)
12
+ │ └── DATABASE.md # 全局 DB(实体+读写模型+OLTP/OLAP)
13
+
14
+ changes/<name>/ # change 容器
15
+ ├── change-brief.md # 上游交接物(orchestrator S4)
16
+ ├── proposal.md # spec-writer:why + scope
17
+ ├── design.md # spec-writer:decisions + trade-offs
18
+ ├── tasks.md # spec-writer:implementation steps
19
+ ├── execution-contract.md # contract-builder:execution handshake
20
+ ├── specs/ # 行为规格(spec-writer)
21
+ │ └── <cap>.md # SHALL/MUST + Scenario + WHEN/THEN
22
+ ├── architecture/ # ★ 架构设计(architecture-design,独立一等产物)
23
+ │ ├── architecture.md # 每变更 DDD 增量(聚合/限界上下文/CQRS)
24
+ │ ├── database.md # 每变更 DB 增量(实体/读写模型变更)
25
+ │ └── api.md # 每变更 API 设计(Command/Read/Query 分流)
26
+ └── prototype/ # 原型(prototype skill)
27
+ ```
28
+
29
+ > **语义分离**:架构产出独立 `architecture/` 目录,不混入 `specs/`(行为规格)。目录存在 = 有架构产出,目录不存在 = 判定为不需要。下游消费方(spec-writer / release-archivist)显式读取此目录。
30
+
31
+ ## 每变更增量设计(SOP 步骤)
32
+ 1. (LLM) 读全局 ARCHITECTURE.md 作 grounding;用活动对象矩阵识别限界上下文/聚合。
33
+ 2. (LLM) 出 To-Be:新增/调整聚合、Context Map 关系、CQRS 读写模型、4A 跨域对齐。
34
+ 3. **As-Is 冻结**(核心修正):复制全局相关章节**当前原文** + 记版本锚点(`ARCHITECTURE.md@<change_id>#<章节>`),变更内不可变——杜绝活引用漂移。
35
+ 4. (脚本) 填 frontmatter 并校验:`cap_id/date/change_type/bounded_contexts/aggregates_affected/cqrs`。
36
+ 5. (LLM) 写 ADR 理由;API 标 Command/Read/Query + 阻断测试归属。
37
+ 6. (脚本) 回写全局 + 生成 API 索引。
38
+
39
+ ## 复利回写(借鉴 ce-compound,已正名)
40
+ - **one change per run**:一次回写一个变更 delta,可追溯、不混杂。
41
+ - 全局 ARCHITECTURE.md 维护双视图:`## 当前态`(覆盖式,每 BC/聚合仅留最新有效定义)+ `## 演进日志`(append-only,含 change_id+来源)。
42
+ - **架构一致性/漂移检查**(独立于 Discoverability):①结构冲突(重复 BC/聚合 key)②语义冲突(同义异名,如客户vs用户)③跨域一致性门禁(AA≥1 IA 实体,反之亦然)。
43
+ - **Discoverability 正名**:在 AGENTS.md/CLAUDE.md 暴露 `docs/architecture/`,使代理设计前"发现并查阅"(存在/结构/何时检索)——这是 compound 原义,勿与内容冲突检查混淆。
44
+ - 下游检索复用:下一 change 设计前从 `docs/architecture/` 检索相关上下文/聚合(grounding 用 CONCEPTS.md)。
45
+
46
+ ## 集成纪律(来自 team-flow 源码事实)
47
+ - **design.md 不可变**:原型覆盖层 never mutate design.md/tasks.md。原型结论走 `handoff --type prototype` → 新 requirement delta → 正常 `specifying→closing→spec-merger` 闭环,不得直接改 design.md。
48
+ - **guard 软集成**:三份增量文档为推荐产出、非阻断;全局回写经独立 `arch-compound` skill/overlay,不进状态机硬矩阵;frontmatter 校验仅 advisory 脚本(正则提取 key,不引第三方 YAML 依赖),保全零依赖。
49
+ - **术语正名**:IA/AA 非"技术架构"(仅 TA 是);4A 是四域非三层;技术架构对 STRATEGY.md 是"补位 compound 缺位"而非"修正其错误",且 ARCHITECTURE.md 是 anchor 而非评审巨著。
50
+
51
+ ## 第二大脑整合(ima「LT的知识库」)
52
+ - 方法层(kb):存 4A/DDD 方法 skill + 每限界上下文一个 `architecture-anchor`(frontmatter 索引)。
53
+ - 项目层(repo):`docs/architecture/` 为权威源;设计前检索 kb skill + 读全局 ARCHITECTURE.md;回写后**批量**同步 Context Map 索引入 kb,避免每 delta 双写。
54
+ - API 留债:脚本化 `API-INDEX.md`(扫描所有 `changes/*/architecture/api.md` 抽取端点/方法/错误码/幂等),反对手写全局 API 文档。
@@ -0,0 +1,51 @@
1
+ # Cheatsheet · 速查
2
+
3
+ ## 4A 分叉公式
4
+ `BA → (IA ∥ AA) → TA` — BA 先稳,再并行 IA/AA 双向对齐,最后汇聚 TA。定义不可逆。
5
+
6
+ ## 跨域一致性检查(发布门禁)
7
+ - [ ] 每个 AA 功能有 ≥1 IA 数据实体? (结构)
8
+ - [ ] 每个 IA 实体被 ≥1 AA 功能消费? (结构)
9
+ - [ ] 命名统一?用户/客户/consumer 不并存 (语义)
10
+
11
+ ## 变更影响三层次(逐项打勾)
12
+ - [ ] 直接依赖 (BA→AA/IA)
13
+ - [ ] 间接依赖 (AA/IA→TA, IA↔AA 对齐)
14
+ - [ ] 隐式依赖 (表面无关却牵动) ← 最危险
15
+
16
+ ## 聚合识别四要素
17
+ 实体(唯一标识) + 值对象(无标识) + 聚合根(唯一入口) + 事务边界(一事务)。
18
+ 仅业务服务有聚合。
19
+
20
+ ## 三维判定决策树
21
+ ```
22
+ 失忆测试: 清空业务记忆还能工作? ──能──> TA(技术服务)
23
+ │否
24
+ 阻断测试: 阻断1h下游能继续? ──不能──> 业务服务(写模型)
25
+ │能
26
+ └──> 数据服务(读模型)
27
+ 孤岛测试: 谁调用? 私有 / 领域共通 / 企业共通 (定层级)
28
+ ```
29
+
30
+ ## CQRS 指令分流
31
+ | 指令 | 模型 | 服务 |
32
+ |---|---|---|
33
+ | Command | 写模型 | 业务服务 |
34
+ | Read | 写模型 | 业务服务 |
35
+ | Query | 需分流 | 阻断测试: 不能→业务 / 能→数据 |
36
+
37
+ ## 每变更架构设计 SOP
38
+ 1. 读全局 ARCHITECTURE.md grounding
39
+ 2. 活动对象矩阵 → 聚合/限界上下文
40
+ 3. **As-Is 冻结**(版本锚点) — 防漂移
41
+ 4. To-Be: 聚合+Context Map+CQRS+4A 对齐
42
+ 5. 填 frontmatter + ADR
43
+ 6. 回写全局(当前态+演进日志) + 生成 API-INDEX
44
+
45
+ ## 反模式警示
46
+ - ✗ 先选技术再补流程(定义反)
47
+ - ✗ IA/AA 统称"技术架构"(仅 TA 是)
48
+ - ✗ As-Is 用活引用全局章节(会漂移 → 必须冻结复制)
49
+ - ✗ 把支撑流程的 Query 误归数据服务(阻断测试判)
50
+ - ✗ 直接改 design.md 回写原型(必须 handoff→delta 闭环)
51
+ - ✗ 全局回写进 team-flow 硬 guard(破零依赖 → 软 overlay)
@@ -0,0 +1,23 @@
1
+ # Glossary · 架构设计术语表
2
+
3
+ - **BA / IA / AA / TA**:业务/信息(数据)/应用(功能)/技术 架构四域。仅 TA 是技术架构。
4
+ - **分叉依赖**:`BA→(IA∥AA)→TA`,BA 先行、IA/AA 并行双向对齐、TA 最后。
5
+ - **跨域一致性(双对齐)**:AA 功能≥1 IA 实体支撑,IA 实体≥1 AA 功能消费;结构+语义双对齐。
6
+ - **架构产出三层**:元素(积木)/制品(图纸)/交付件(成品)。
7
+ - **业务实体**:BA 流程中的表证单书,有全生命周期。
8
+ - **活动对象矩阵**:横轴 L5 活动、纵轴业务对象,用符号标注操作关系,重叠>70% 合并。
9
+ - **聚合(Aggregate)**:实体+值对象+聚合根+事务边界;仅存业务服务。
10
+ - **聚合根(Aggregate Root)**:聚合外部唯一入口。
11
+ - **值对象(Value Object)**:无独立标识,属性变即另一对象。
12
+ - **限界上下文(Bounded Context)**:语义边界,对应 L3 应用服务。
13
+ - **Context Map**:限界上下文间关系图;映射类型 Shared Kernel / Anti-Corruption Layer / Open Host Service。
14
+ - **CQRS**:写模型(事务型,聚合)与读模型(分析型,查询模型)分离建模。
15
+ - **写模型(Write Model)**:事务型对象在 AA 的表达,有聚合根/事务边界,Command/Read 操作。
16
+ - **读模型(Read Model)**:分析型对象在 AA 的表达,无事务,Query 操作,派生自写模型。
17
+ - **L6 指令**:Command(改状态)/Read(有逻辑不改状态)/Query(纯查询)。
18
+ - **阻断测试**:阻断 1h 下游能否继续?不能→业务服务,能→数据服务。
19
+ - **三维判定**:失忆(归属 AA/TA)+阻断(类型 业务/数据)+孤岛(层级 私有/领域共通/企业共通)。
20
+ - **As-Is 冻结**:每变更设计时复制全局相关章节当前原文+版本锚点,变更内不可变。
21
+ - **瘦锚点**:ARCHITECTURE.md 作为短稳的技术 anchor(Context Map+聚合清单+关键决策),非评审巨著。
22
+ - **Discoverability Check**:在 AGENTS.md 暴露 docs/architecture/,使代理设计前发现并查阅(compound 原义)。
23
+ - **架构一致性/漂移检查**:回写前的结构+语义+跨域一致性门禁(独立于 Discoverability)。
@@ -0,0 +1,32 @@
1
+ # Patterns · 技术与模式
2
+
3
+ ## P1 · 活动对象矩阵(实体发现)
4
+ 横轴 L5 活动、纵轴业务对象;符号 ●主 ◐从 ○关联 △新。出现任何符号=实体;重叠>70% 合并。→ 产出实体清单供聚合设计。
5
+
6
+ ## P2 · 聚合识别(四要素落位)
7
+ 对每个实体:定聚合根(唯一入口)、拆值对象、画事务边界(一事务内完成的操作集)。硬规则:仅业务服务有聚合;数据/技术服务无。
8
+
9
+ ## P3 · Context Map 映射选型
10
+ - 两团队共享模型 → **Shared Kernel**
11
+ - 下游需隔离上游概念泄漏 → **Anti-Corruption Layer**
12
+ - 上游供多下游标准消费 → **Open Host Service**
13
+
14
+ ## P4 · CQRS 读写模型划分
15
+ 事务型对象→写模型(聚合);分析型对象→读模型(查询模型)。Command/Read→写模型;Query 经阻断测试分流到业务/数据服务。读模型派生自写模型。
16
+
17
+ ## P5 · 增量设计 + 复利回写(工作流衔接)
18
+ 每变更:As-Is 冻结复制(版本锚点 change_id+章节+commit) → To-Be(DDD) → 全局 ARCHITECTURE.md(当前态覆盖+演进日志追加)。one change per run。回写前跑架构一致性检查(结构+语义+跨域)。
19
+
20
+ ## P6 · 架构 frontmatter(脚本可校验)
21
+ 每变更 architecture.md/database.md 头部:
22
+ ```
23
+ cap_id / date / change_type(new|modify) /
24
+ bounded_contexts / aggregates_affected / cqrs(write/read_model)
25
+ ```
26
+ 用正则提取 key 做 advisory 校验,不引第三方 YAML 依赖(保全 team-flow 零依赖)。
27
+
28
+ ## P7 · API 指令映射(每变更 api.md)
29
+ 对每个端点标 Command/Read/Query;Query 标注阻断测试归属(业务/数据服务)。下游脚本扫所有 api.md 生成 API-INDEX.md。
30
+
31
+ ## P8 · 全局锚点暴露(Discoverability)
32
+ 在 AGENTS.md 追加一节:存在 docs/architecture/;其结构(Context Map/聚合/DB);何时检索(每变更设计前)。使代理自动 grounding。
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: bug-investigator
3
+ description: Use when encountering any bug, test failure, or unexpected behavior during team-flow execution, before proposing fixes. Invoked automatically when build-executor hits a blockage.
4
+ ---
5
+
6
+ # Bug Investigator
7
+
8
+ **Core principle:** Find root cause before attempting fixes. Symptom fixes are failure.
9
+
10
+ ## The Iron Law
11
+
12
+ No fixes without root cause investigation first. If you haven't completed Phase 1, you cannot propose fixes.
13
+
14
+ ## When to Use
15
+
16
+ Use for ANY technical issue: test failures, bugs, unexpected behavior, performance problems, build failures, integration issues. Especially when under time pressure, "one quick fix" seems obvious, you've already tried multiple fixes, or you don't fully understand the issue.
17
+
18
+ Don't skip because issue "seems simple" or you're "in a hurry" — systematic debugging is faster than thrashing.
19
+
20
+ ## The Four Phases
21
+
22
+ Complete each phase before proceeding.
23
+
24
+ ### Phase 1: Root Cause Investigation
25
+
26
+ 1. **Read error messages carefully**: stack traces, line numbers, file paths, error codes — they often contain the exact solution
27
+ 2. **Reproduce consistently**: exact steps, every time? If not reproducible → gather more data, don't guess
28
+ 3. **Check recent changes**: git diff, recent commits, new dependencies, config changes, environment differences
29
+ 4. **Multi-component systems**: add diagnostic instrumentation at each component boundary. Log what enters and exits each layer. Run once to gather evidence, then analyze which component fails
30
+ 5. **Trace data flow**: backward tracing — where does the bad value originate? Keep tracing up until you find the source. Fix at source, not symptom
31
+
32
+ ### Phase 2: Pattern Analysis
33
+
34
+ 1. Find working examples of similar code in the same codebase
35
+ 2. Compare against references — read reference implementation completely
36
+ 3. Identify every difference between working and broken, however small
37
+ 4. Understand dependencies: other components, settings, config, environment, assumptions
38
+
39
+ ### Phase 3: Hypothesis and Testing
40
+
41
+ Scientific method: form a single hypothesis ("I think X is the root cause because Y"), test with the smallest possible change (one variable at a time), verify before continuing. If it didn't work, form a NEW hypothesis — don't add more fixes. When you don't know, say so and ask for help.
42
+
43
+ ### Phase 4: Implementation
44
+
45
+ 1. **Create failing test case** — simplest reproduction, automated if possible. Follow TDD rules from build-executor
46
+ 2. **Implement single fix** — address root cause, one change at a time, no "while I'm here" improvements
47
+ 3. **Verify fix** — test passes? no regressions? issue resolved?
48
+ 4. **If fix doesn't work**: count attempts. < 3 → return to Phase 1. **≥ 3 → STOP and question architecture (DP-5)**
49
+
50
+ ### DP-5: Debug Escalation (3+ Failures)
51
+
52
+ 3+ failed fixes = architectural problem. Each fix revealing new problems elsewhere = wrong architecture. Record: `npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_5_result <decision>`. Discuss with user before attempting more fixes.
53
+
54
+ ## Red Flags — Return to Phase 1
55
+
56
+ "Quick fix, investigate later" / "Just try changing X" / "Skip the test, I'll verify manually" / "It's probably X, let me fix that" / "I don't fully understand but this might work" / "One more fix attempt" (after 2+) / Proposing solutions before tracing data flow.
57
+
58
+ **All of these mean: STOP. Return to Phase 1.** If 3+ fixes failed, question the architecture.
59
+
60
+ ## Quick Reference
61
+
62
+ | Phase | Key Activities | Success Criteria |
63
+ |-------|---------------|------------------|
64
+ | 1. Root Cause | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
65
+ | 2. Pattern | Find working examples, compare | Identify differences |
66
+ | 3. Hypothesis | Form theory, test minimally | Confirmed or new hypothesis |
67
+ | 4. Implementation | Create test, fix, verify | Bug resolved, tests pass |
68
+
69
+ ## When No Root Cause Found
70
+
71
+ If truly environmental/timing-dependent/external: document what you investigated, implement appropriate handling (retry, timeout, error message), add monitoring. But 95% of "no root cause" cases are incomplete investigation.
72
+
73
+ ## Exception Handling
74
+
75
+ - **Parse failures**: Report raw output, ask for clarification — don't guess
76
+ - **Missing files**: Escalate immediately — not a normal debugging scenario
77
+ - **User interruption**: Re-read investigation report on resume, continue from last completed phase
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: build-executor
3
+ description: Govern implementation from an approved execution contract. Invoke when execution-contract.md is approved and the user wants disciplined build work, TDD execution, or guarded batch-by-batch implementation.
4
+ ---
5
+
6
+ # Build Executor
7
+
8
+ Controls the implementation phase. Uses `execution-contract.md` as the workflow authority.
9
+
10
+ ## Required Inputs
11
+
12
+ Read: `execution-contract.md`, `tasks.md`, relevant `specs/`, relevant `design.md`. (Skip contract/spec requirements when workflow is `tweak`.)
13
+
14
+ Check workflow mode first: `npx --yes --package @xulthekl/team-flow@0.22.4 tf state get <change-dir> workflow`. If `tweak` → direct edit mode. If `hotfix` or `full` → standard contract-first discipline.
15
+
16
+ Branch/worktree preflight before ANY implementation edit (mandatory — do not skip):
17
+ 1. Run the isolation check:
18
+ ```bash
19
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf isolate <change-dir>
20
+ ```
21
+ This script enforces git isolation: if you are on `main`/`master` it creates a
22
+ git worktree (preferred) or a new branch, and exits non-zero if it cannot and you
23
+ have not approved `--force`.
24
+ 2. If `npx --yes --package @xulthekl/team-flow@0.22.4 tf isolate` exits non-zero: STOP. Do not edit `main`/`master` in place.
25
+ Ask the user for explicit approval (and re-run with `npx --yes --package @xulthekl/team-flow@0.22.4 tf isolate <change-dir> --force`
26
+ only after they approve).
27
+ 3. If it succeeds, report the chosen branch/worktree and make all implementation
28
+ edits there.
29
+
30
+ ## Core Laws
31
+
32
+ ### Law 1: Contract First
33
+ The execution contract is the approved handoff artifact, not chat history.
34
+
35
+ ### Law 2: TDD Iron Law — No Production Code Without a Failing Test First
36
+ RED (write test, see it fail) → GREEN (write minimal code, see it pass) → REFACTOR (clean up, suite stays green).
37
+
38
+ **Red Flags**: "Quick implementation first, test later" / "Skip the test, manually verify" / "I already know it works" / "Just this one time without tests." ALL mean STOP and write the test first.
39
+
40
+ ### Law 3: Review Before Drift
41
+ Block on: logic defects, spec violations, missing required tests, unintended scope expansion.
42
+
43
+ ### Law 4: Rewind on Contract Break
44
+ Return to `specifying` or `bridging` if: new behavior appears, interfaces change materially, design assumptions fail, artifacts no longer define intended implementation.
45
+
46
+ ## Execution Mode Selection
47
+
48
+ For `full`/`hotfix`, generate proposed waves from the approved contract, then use the recommendation as a decision aid rather than silently defaulting a mode:
49
+
50
+ ```bash
51
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf execution recommend <change-dir> \
52
+ --wave <wave-id>:<parallel|serial>:<task,...>[:<depends-on,...>] --json
53
+ # Show every available mode, the observed facts, and the recommendation to the user.
54
+ # The command writes a receipt tied to the artifacts, contract, and waves. After the user chooses, record that explicit confirmation:
55
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan <change-dir> \
56
+ --mode <selected-mode> --confirm --reason "user-selected execution mode" \
57
+ --wave <wave-id>:<parallel|serial>:<task,...>[:<depends-on,...>]
58
+ # Add --acknowledge-recommendation when the selection differs from the recommendation.
59
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf execution show <change-dir> --json
60
+ ```
61
+
62
+ The optional fourth `--wave` segment names prerequisite wave IDs. `execution show --json` reports `current`, plus each wave's `depends_on`, `receipt`, `blockers`, `retryable`, and `eligible` status. A wave with `retryable: true` has a current `fail` receipt and is eligible only for its focused repair and re-review; its dependents remain blocked until its replacement `pass` receipt. Report the saved plan revision, selected mode, ordered waves, dependencies, and whether every `parallel` wave can actually be dispatched concurrently on the current platform. If concurrency is unavailable, state the capability and reason plainly; retain the planned `parallel` strategy and do not silently execute it as a serial or Batch Inline plan.
63
+
64
+ The recommendation uses task count, configured `execution.inlineThreshold`, and declared wave strategy. It never auto-selects: present every available mode and the recommendation to the user. `--confirm` records any user-selected mode; a choice that differs from the recommendation requires `--acknowledge-recommendation` so the plan captures an informed risk decision.
65
+
66
+ | Mode | Criteria |
67
+ |------|----------|
68
+ | **SDD** | Recommended for parallel waves, multiple waves, or work beyond the inline threshold |
69
+ | **Inline** | Recommended for a single sequential task; always available for a user-confirmed choice |
70
+ | **Batch Inline** | Recommended for a bounded sequential batch; it remains serial and is never presented as parallel |
71
+
72
+ Do not transition to `executing` until `execution show` reports `current: true` and the phase guard passes. A revised plan must repeat `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution recommend` and use `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution revise --confirm`; it creates a new revision and invalidates receipts from the prior revision.
73
+
74
+ ## Batch Inline Execution
75
+
76
+ Only when the user explicitly confirms `batch-inline` after seeing the recommendation. Current agent executes directly and serially. TDD Iron Law still applies.
77
+
78
+ Procedure: announce mode → write failing test → confirm failure → implement → run suite → refactor → lightweight checkpoint (files exist, no placeholders, test passed, no unintended changes) → report.
79
+
80
+ Boundaries: if any task touches >1 module, involves schema/API/config changes, or has open questions → downgrade to Inline or SDD.
81
+
82
+ ## SDD Workflow
83
+
84
+ For full/hotfix by default. Dispatch according to the persisted plan, review each planned wave, and run a final broad review after all waves.
85
+
86
+ ### Planned-Wave Loop
87
+ 1. Read the current plan with `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution show <change-dir> --json`; only waves shown with `current: true` and `eligible: true` may start. A `retryable: true` wave may only be repaired and re-reviewed; do not dispatch its dependents until its replacement receipt is `pass`. The CLI encodes dependencies in `--wave <id>:<strategy>:<tasks>[:<depends-on,...>]` and rejects a review receipt for a wave whose prerequisites lack current `pass` receipts.
88
+ 2. A `parallel` wave may dispatch independent tasks simultaneously only when the platform supports concurrent dispatch. If it does not, disclose the unavailable capability and execute the same wave one task at a time without changing its stored strategy.
89
+ 3. A `serial` wave dispatches one task at a time in listed order.
90
+ 4. After every wave, write a non-empty persisted regular-file review report (separate from the implementer's report), then record exactly one receipt that names that review report:
91
+ ```bash
92
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf execution review <change-dir> \
93
+ --wave <wave-id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>
94
+ ```
95
+ Do not begin a dependent wave until its predecessor receipt is `pass`.
96
+ 5. Critical/Important findings require a `fail` receipt, a focused repair, re-review, then a replacement `pass` receipt. Never advance or close with a missing or failed receipt.
97
+
98
+ ### Per-Task Loop
99
+ 1. **Dispatch implementer**: Load the template with `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime asset read skills/build-executor/implementer-prompt.md`. Extract task brief with `scripts/task-brief PLAN_FILE N`. Include: where task fits, brief path, interfaces from prior tasks, report file path.
100
+ 2. **Handle response**: DONE → generate review package + dispatch reviewer. DONE_WITH_CONCERNS → assess. NEEDS_CONTEXT → provide context. BLOCKED → re-dispatch with better model or escalate.
101
+ 3. **Review**: Load `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime asset read skills/build-executor/task-reviewer-prompt.md`. Reviewer returns spec compliance + code quality verdicts with the wave ID, git range, report path, and `pass`/`fail` receipt command.
102
+ 4. **Fix**: If Critical or Important issues, write the `fail` receipt, dispatch fix subagent, re-review, and write the replacement `pass` receipt.
103
+ 5. **Mark complete**: Append to `.superpowers/sdd/progress.md`: `Task N: complete (commits <base7>..<head7>, review clean)`
104
+
105
+ ### Model Selection
106
+ Use the configured profile that matches the task role. Resolve it before dispatch:
107
+
108
+ ```bash
109
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime config --resolve-model <profile>
110
+ ```
111
+
112
+ | Profile | Role |
113
+ |---|---|
114
+ | `mechanical` | Cheap, routine edits |
115
+ | `standard` | Integration and judgment work |
116
+ | `strong` | Architecture, design, and final review |
117
+ | `review` | Review that matches the diff |
118
+
119
+ For platforms whose dispatch supports a `model` field, explicitly pass the resolved `model` value. If the result is `configured: false`, automatic selection is unavailable: do not invent a provider model and do not bypass the existing requirement to specify `model` explicitly. Resolution only reads configuration; it does not switch models.
120
+
121
+ ### Progress Ledger
122
+ Track in `.superpowers/sdd/progress.md`. Check for existing ledger — completed tasks are done. After each batch: `npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> batches_completed <N>`.
123
+
124
+ ## Inline Execution Mode
125
+
126
+ Only after a user-confirmed `inline` selection is recorded by `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan --confirm`; a non-recommended selection also records `--acknowledge-recommendation`. Executes in the current session and still writes one review receipt per planned wave.
127
+
128
+ Per-task: extract brief → write failing test → confirm failure → implement → confirm green → checkpoint review (done-when criteria, SHALL/MUST verification) → commit → save a task-level recovery checkpoint when another task remains → append to progress ledger.
129
+
130
+ After a task is committed and reviewed, when another task remains, save the
131
+ recovery context with real evidence:
132
+
133
+ ```bash
134
+ npx --yes --package @xulthekl/team-flow@0.22.4 tf checkpoint save <change-dir> \
135
+ --task <completed-task-id> --next "<next task>" --completed "<completed work>" \
136
+ --verification "<verification report path>" --review "<review report path>" \
137
+ --risk "<open risk or None>" --commit-start <base-sha> --commit-end <head-sha>
138
+ ```
139
+
140
+ This augments `.superpowers/sdd/progress.md`; it does not replace the progress
141
+ ledger or add a new core workflow state. Do not claim a checkpoint is current
142
+ when `npx --yes --package @xulthekl/team-flow@0.22.4 tf checkpoint list` reports it as stale.
143
+
144
+ If task hits BLOCKED (3+ fix failures or changes outside declared scope), escalate to SDD.
145
+
146
+ ## Tweak Mode
147
+
148
+ Skip TDD. Apply changes directly. Verify file integrity (exists, non-empty, valid syntax). No batch execution — sequential changes.
149
+
150
+ ## DP Records
151
+
152
+ DP-4 is written by `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan`; do not write it with raw `state set`.
153
+ DP-5 (debug escalation): `npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_5_result "<resolution>"` + timestamp.
154
+
155
+ ## Completion Standard
156
+
157
+ Don't report completion until: tests pass, contract obligations satisfied, review blockers resolved, every planned wave has a current `pass` receipt, final review is complete, and workflow is ready for `release-archivist`.
158
+
159
+ ## Exception Handling
160
+
161
+ - **Parse failures**: Stop and report exact line/format issue. Route back to `contract-builder`.
162
+ - **Missing artifacts**: Route back to appropriate upstream skill. Don't guess.
163
+ - **User interruption**: Progress ledger enables recovery. Check ledger on resume.