@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,164 @@
1
+ #!/usr/bin/env node
2
+ // team-flow CLI — zero-dependency CLI for spec management
3
+ // Usage: tf <command> [options]
4
+
5
+ import { parseArgs } from 'node:util';
6
+
7
+ const COMMANDS = {
8
+ list: () => import('./lib/cmd-list.mjs'),
9
+ validate: () => import('./lib/cmd-validate.mjs'),
10
+ doctor: () => import('./lib/cmd-doctor.mjs'),
11
+ version: () => import('./lib/cmd-version.mjs'),
12
+ sync: () => import('./lib/cmd-sync.mjs'),
13
+ config: () => import('./lib/cmd-config.mjs'),
14
+ state: () => import('./lib/cmd-state.mjs'),
15
+ inject: () => import('./lib/cmd-inject.mjs'),
16
+ audit: () => import('./lib/cmd-audit.mjs'),
17
+ checkpoint: () => import('./lib/cmd-checkpoint.mjs'),
18
+ handoff: () => import('./lib/cmd-handoff.mjs'),
19
+ isolate: () => import('./lib/cmd-isolate.mjs'),
20
+ execution: () => import('./lib/cmd-execution.mjs'),
21
+ runtime: () => import('./lib/cmd-runtime.mjs'),
22
+ solutions: () => import('./lib/cmd-solutions.mjs'),
23
+ 'install-cursor': () => import('./lib/cmd-install-cursor.mjs'),
24
+ 'install-workbuddy': () => import('./lib/cmd-install-workbuddy.mjs'),
25
+ 'install-cline': () => import('./lib/cmd-install-cline.mjs'),
26
+ 'install-kiro': () => import('./lib/cmd-install-kiro.mjs'),
27
+ 'install-windsurf': () => import('./lib/cmd-install-windsurf.mjs'),
28
+ 'install-qwen': () => import('./lib/cmd-install-qwen.mjs'),
29
+ 'install-amazon-q': () => import('./lib/cmd-install-amazon-q.mjs'),
30
+ 'install-roocode': () => import('./lib/cmd-install-roocode.mjs'),
31
+ 'install-continue': () => import('./lib/cmd-install-continue.mjs'),
32
+ 'install-pi': () => import('./lib/cmd-install-pi.mjs'),
33
+ 'install-qoder': () => import('./lib/cmd-install-qoder.mjs'),
34
+ 'install-zcode': () => import('./lib/cmd-install-zcode.mjs'),
35
+ 'prototype-sync': () => import('./lib/prototype-sync.mjs'),
36
+ };
37
+
38
+ const HELP = `team-flow (tf) — Unified workflow plugin CLI
39
+
40
+ Usage: tf <command> [options]
41
+
42
+ Commands:
43
+ list List all changes and their status
44
+ validate <dir> Validate artifacts in a change directory
45
+ doctor Health check (versions, hooks, skills, docs)
46
+ version <semver> Sync version to all manifest files
47
+ sync <change-dir> Merge delta specs into main specs
48
+ prototype-sync <change-dir> [--source <path>] [--prototype-dir <path>]
49
+ Merge UX delta into global prototype/ + design-system.md
50
+ config [options] Display or modify configuration
51
+ config --resolve-model <profile> Resolve a configured model profile without switching models
52
+ state <sub> <dir> Manage .team-flow.yaml state (init|check|transition|get|rebuild)
53
+ inject <dir> Generate phase-guard artifacts; use --platforms <name|all> when platform is ambiguous
54
+ audit <dir> Generate decision-point-audit.md from .team-flow.yaml
55
+ checkpoint save <change-dir> --task <id> --next <text>
56
+ Save a task-level recovery checkpoint
57
+ checkpoint list <change-dir>
58
+ List checkpoints and stale status
59
+ checkpoint show <change-dir> <id>
60
+ Show one recovery checkpoint
61
+ handoff create <change-dir> --type <type> --objective <text> --expected-output <text> --acceptance <text>
62
+ Create an explicit prototype/research/experiment handoff
63
+ handoff list <change-dir>
64
+ List active and completed handoffs
65
+ handoff finish <change-dir> <id>
66
+ Validate a handoff result
67
+ handoff resolve <change-dir> <id> --decision <accept|reject|defer>
68
+ Record the explicit handoff decision
69
+ execution recommend <change-dir> [--wave <id>:<strategy>:<task,...>]
70
+ List execution modes and an evidence-based recommendation
71
+ execution plan <change-dir> --mode <mode> --confirm --reason <text> --wave <id>:<strategy>:<task,...> [--acknowledge-recommendation]
72
+ Record a user-confirmed guarded execution plan
73
+ execution show <change-dir> [--json]
74
+ Show and validate the current execution plan
75
+ execution revise <change-dir> --mode sdd --confirm --reason <text> --wave <id>:<strategy>:<task,...> [--acknowledge-recommendation]
76
+ Upgrade inline/batch to SDD, or replan existing SDD waves, as a new revision
77
+ execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict pass|fail
78
+ Record one review receipt for a planned wave
79
+ runtime check-update Run a portable update check for canonical skills
80
+ runtime infer <dir> Infer workflow mode without a plugin-root path
81
+ runtime guard ... Run a portable phase-transition guard
82
+ runtime config ... Read effective configuration (writes are rejected)
83
+ runtime asset read <path>
84
+ Read one allowlisted package asset for a skill
85
+ solutions index-gen [--dir <solutions-dir>]
86
+ Rebuild docs/solutions/INDEX.md (v0.5 compound-learning)
87
+ solutions inject --phase <p> [--domain <d>] [--dir <solutions-dir>]
88
+ Emit top-5 filtered solution summaries for skill context injection
89
+ solutions capture --phase <p> --domain <d> --type <t> --severity <s> --summary "<text>" [--source <src>] [--dir <solutions-dir>]
90
+ Capture one learning into docs/solutions/ + INDEX.md
91
+ solutions promote <change-dir> [--dir <solutions-dir>]
92
+ Promote qualifying change learnings into global docs/solutions/
93
+ install-cursor Deploy skills/scripts/docs to .cursor/ (local Cursor setup)
94
+ install-workbuddy Deploy skills to WorkBuddy marketplace and enable them
95
+ install-cline Deploy to .cline/ + .clinerules/ (Cline)
96
+ install-kiro Deploy to .kiro/ + .kiro/steering/ (Kiro)
97
+ install-windsurf Deploy to .windsurf/ + .windsurf/rules/ (Windsurf)
98
+ install-qwen Deploy to .qwen/ + .qwen/rules/ (Qwen Code)
99
+ install-amazon-q Deploy to .amazonq/ + .amazonq/rules/ (Amazon Q Developer)
100
+ install-roocode Deploy to .roo/ + .roo/rules/ (Roo Code)
101
+ install-continue Deploy to .continue/ + .continue/rules/ (Continue)
102
+ install-pi Deploy to .pi/skills/ (Pi agent; no rules dir)
103
+ install-qoder Deploy to .qoder/ + .qoder/rules/ (Qoder)
104
+
105
+ Options:
106
+ --help, -h Show this help message
107
+ --version, -v Show CLI version
108
+
109
+ Examples:
110
+ tf list
111
+ tf validate changes/v0.4.0-platform-evolution/
112
+ tf doctor
113
+ tf version 0.4.0
114
+ tf sync changes/v0.3.0-workflow-enhancements/
115
+ tf config --get execution.inlineThreshold
116
+ tf config --resolve-model mechanical
117
+ tf config --set verification.language=zh
118
+ tf state init changes/my-change/
119
+ tf state check changes/my-change/
120
+ tf state transition changes/my-change/ approved-for-build
121
+ tf state get changes/my-change/ batches_completed
122
+ tf checkpoint save changes/my-change/ --task 1.1 --next "Run focused tests"
123
+ tf checkpoint list changes/my-change/
124
+ tf handoff create changes/my-change/ --type research --objective "Compare approaches" --expected-output "Recommendation" --acceptance "Evidence recorded"
125
+ tf install-cursor
126
+ tf install-workbuddy
127
+ tf install-cline --local /path/to/team-flow
128
+ `;
129
+
130
+ async function main() {
131
+ const args = process.argv.slice(2);
132
+
133
+ if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
134
+ console.log(HELP);
135
+ process.exit(0);
136
+ }
137
+
138
+ if (args.includes('--version') || args.includes('-v')) {
139
+ const pkg = JSON.parse(
140
+ (await import('node:fs')).readFileSync(
141
+ new URL('../package.json', import.meta.url), 'utf-8'
142
+ )
143
+ );
144
+ console.log(pkg.version);
145
+ process.exit(0);
146
+ }
147
+
148
+ const command = args[0];
149
+ const commandArgs = args.slice(1);
150
+
151
+ if (!COMMANDS[command]) {
152
+ console.error(`Unknown command: ${command}`);
153
+ console.error(`Run "tf --help" for available commands.`);
154
+ process.exit(2);
155
+ }
156
+
157
+ const mod = await COMMANDS[command]();
158
+ await mod.run(commandArgs);
159
+ }
160
+
161
+ main().catch(err => {
162
+ console.error(`Error: ${err.message}`);
163
+ process.exit(1);
164
+ });
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+ // token-baseline.mjs — Token measurement baseline tool
3
+ // Measures lines, characters, and estimated tokens for injection components.
4
+
5
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
6
+ import { resolve } from 'node:path';
7
+
8
+ const REPO_ROOT = resolve(import.meta.dirname, '..');
9
+
10
+ const TARGETS = [
11
+ { path: 'hooks/session-start', label: 'hooks/session-start' },
12
+ { path: '.claude/always/phase-guard.md', label: 'phase-guard (claude)' },
13
+ { path: 'GEMINI.md', label: 'phase-guard (gemini)' },
14
+ { path: 'skills/workflow-start/SKILL.md', label: 'skill: workflow-start' },
15
+ { path: 'skills/need-explorer/SKILL.md', label: 'skill: need-explorer' },
16
+ { path: 'skills/spec-writer/SKILL.md', label: 'skill: spec-writer' },
17
+ { path: 'skills/contract-builder/SKILL.md', label: 'skill: contract-builder' },
18
+ { path: 'skills/build-executor/SKILL.md', label: 'skill: build-executor' },
19
+ { path: 'skills/bug-investigator/SKILL.md', label: 'skill: bug-investigator' },
20
+ { path: 'skills/code-reviewer/SKILL.md', label: 'skill: code-reviewer' },
21
+ { path: 'skills/release-archivist/SKILL.md', label: 'skill: release-archivist' },
22
+ { path: 'skills/spec-merger/SKILL.md', label: 'skill: spec-merger' },
23
+ ];
24
+
25
+ /**
26
+ * Count Chinese characters in a string.
27
+ */
28
+ function countChineseChars(text) {
29
+ return (text.match(/[一-鿿㐀-䶿]/g) || []).length;
30
+ }
31
+
32
+ /**
33
+ * Estimate tokens from text.
34
+ * English: ~4 chars per token, Chinese: ~1.5 chars per token.
35
+ */
36
+ function estimateTokens(text) {
37
+ const chinese = countChineseChars(text);
38
+ const other = text.length - chinese;
39
+ return Math.ceil(chinese / 1.5) + Math.ceil(other / 4);
40
+ }
41
+
42
+ /**
43
+ * Measure a single file.
44
+ * @returns {{ path: string, label: string, lines: number, chars: number, estimatedTokens: number, error?: string }}
45
+ */
46
+ function measureFile(target) {
47
+ const fullPath = resolve(REPO_ROOT, target.path);
48
+ if (!existsSync(fullPath)) {
49
+ return { path: target.path, label: target.label, lines: 0, chars: 0, estimatedTokens: 0, error: 'file not found' };
50
+ }
51
+ try {
52
+ const content = readFileSync(fullPath, 'utf-8');
53
+ const lines = content.split('\n').length;
54
+ const chars = content.length;
55
+ return {
56
+ path: target.path,
57
+ label: target.label,
58
+ lines,
59
+ chars,
60
+ estimatedTokens: estimateTokens(content),
61
+ };
62
+ } catch (e) {
63
+ return { path: target.path, label: target.label, lines: 0, chars: 0, estimatedTokens: 0, error: e.message };
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Measure all targets.
69
+ * @param {{ files?: string }} options
70
+ * @returns {{ timestamp: string, version: string, components: Array, totals: { lines: number, chars: number, estimatedTokens: number } }}
71
+ */
72
+ export function measureAll(options = {}) {
73
+ const targets = options.files
74
+ ? TARGETS.filter(t => options.files.split(',').some(f => t.path.includes(f.trim())))
75
+ : TARGETS;
76
+
77
+ const components = targets.map(measureFile);
78
+ const totals = components.reduce(
79
+ (acc, c) => ({
80
+ lines: acc.lines + c.lines,
81
+ chars: acc.chars + c.chars,
82
+ estimatedTokens: acc.estimatedTokens + c.estimatedTokens,
83
+ }),
84
+ { lines: 0, chars: 0, estimatedTokens: 0 }
85
+ );
86
+
87
+ return {
88
+ timestamp: new Date().toISOString(),
89
+ components,
90
+ totals,
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Compare current measurements against a baseline file.
96
+ * @param {string} baselinePath
97
+ * @returns {{ current: object, baseline: object, changes: Array }}
98
+ */
99
+ export function compareWithBaseline(baselinePath) {
100
+ const current = measureAll();
101
+ const baselineJson = JSON.parse(readFileSync(baselinePath, 'utf-8'));
102
+ const baselineMap = new Map(baselineJson.components.map(c => [c.path, c]));
103
+
104
+ const changes = current.components.map(c => {
105
+ const b = baselineMap.get(c.path);
106
+ if (!b) return { ...c, change: 'new', deltaTokens: c.estimatedTokens };
107
+ const deltaTokens = c.estimatedTokens - b.estimatedTokens;
108
+ const pct = b.estimatedTokens > 0 ? ((deltaTokens / b.estimatedTokens) * 100).toFixed(1) : 'N/A';
109
+ return { ...c, change: deltaTokens < 0 ? 'decreased' : deltaTokens > 0 ? 'increased' : 'unchanged', deltaTokens, pct };
110
+ });
111
+
112
+ const totalDelta = current.totals.estimatedTokens - baselineJson.totals.estimatedTokens;
113
+ const totalPct = baselineJson.totals.estimatedTokens > 0
114
+ ? ((totalDelta / baselineJson.totals.estimatedTokens) * 100).toFixed(1)
115
+ : 'N/A';
116
+
117
+ return {
118
+ current,
119
+ baseline: baselineJson,
120
+ changes,
121
+ summary: {
122
+ totalDelta,
123
+ totalPct,
124
+ previousTotal: baselineJson.totals.estimatedTokens,
125
+ currentTotal: current.totals.estimatedTokens,
126
+ },
127
+ };
128
+ }
129
+
130
+ // CLI
131
+ function parseArgs(argv) {
132
+ const args = { compare: null, output: null, files: null };
133
+ for (let i = 2; i < argv.length; i++) {
134
+ if (argv[i] === '--compare' && argv[i + 1]) args.compare = argv[++i];
135
+ else if (argv[i] === '--output' && argv[i + 1]) args.output = argv[++i];
136
+ else if (argv[i] === '--files' && argv[i + 1]) args.files = argv[++i];
137
+ }
138
+ return args;
139
+ }
140
+
141
+ if (process.argv[1] === decodeURIComponent(new URL(import.meta.url).pathname) || process.argv[1] === import.meta.filename) {
142
+ const args = parseArgs(process.argv);
143
+ let result;
144
+
145
+ if (args.compare) {
146
+ result = compareWithBaseline(args.compare);
147
+ } else {
148
+ result = measureAll({ files: args.files });
149
+ }
150
+
151
+ const output = JSON.stringify(result, null, 2);
152
+ if (args.output) {
153
+ writeFileSync(args.output, output, 'utf-8');
154
+ console.log(`Baseline saved to ${args.output}`);
155
+ } else {
156
+ console.log(output);
157
+ }
158
+ }
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ // validate-artifacts - Validate team-flow artifacts
3
+ // Usage: node scripts/validate-artifacts <change-dir>
4
+ //
5
+ // Reads a change directory and validates all artifacts found:
6
+ // - proposal.md (change content validation)
7
+ // - specs/*/spec.md (delta spec validation)
8
+
9
+ import { readFileSync, existsSync, statSync } from 'fs';
10
+ import { join, basename } from 'path';
11
+ import { Validator } from '../dist/index.js';
12
+ import { validateSpecPathLayout, relativeSpecPath } from './lib/spec-paths.mjs';
13
+
14
+ function printReport(label, report) {
15
+ console.log(`\n 📋 ${label}`);
16
+ if (report.valid) {
17
+ console.log(` ✅ valid (${report.summary.errors} errors, ${report.summary.warnings} warnings, ${report.summary.info} info)`);
18
+ } else {
19
+ console.log(` ❌ invalid (${report.summary.errors} errors, ${report.summary.warnings} warnings, ${report.summary.info} info)`);
20
+ }
21
+ for (const issue of report.issues) {
22
+ const icon = issue.level === 'ERROR' ? '🔴' : issue.level === 'WARNING' ? '🟡' : '🔵';
23
+ const lineInfo = issue.line ? `:${issue.line}` : '';
24
+ console.log(` ${icon} [${issue.level}] ${issue.path}${lineInfo}: ${issue.message}`);
25
+ }
26
+ }
27
+
28
+ function main() {
29
+ const args = process.argv.slice(2);
30
+ if (args.length < 1) {
31
+ console.error('Usage: node scripts/validate-artifacts <change-dir>');
32
+ process.exit(2);
33
+ }
34
+
35
+ const changeDir = args[0];
36
+ if (!existsSync(changeDir) || !statSync(changeDir).isDirectory()) {
37
+ console.error(`Error: "${changeDir}" is not a valid directory`);
38
+ process.exit(2);
39
+ }
40
+
41
+ const changeName = basename(changeDir);
42
+ const validator = new Validator(false);
43
+
44
+ console.log(`🔍 Validating artifacts in: ${changeDir}`);
45
+ console.log(` Change: ${changeName}`);
46
+
47
+ let hasErrors = false;
48
+
49
+ const proposalPath = join(changeDir, 'proposal.md');
50
+ if (existsSync(proposalPath)) {
51
+ try {
52
+ const content = readFileSync(proposalPath, 'utf-8');
53
+ const report = validator.validateChangeContent(changeName, content);
54
+ printReport('proposal.md (change content)', report);
55
+ if (!report.valid) hasErrors = true;
56
+ } catch (e) {
57
+ console.log(`\n 📋 proposal.md`);
58
+ console.log(` ❌ Error reading file: ${e instanceof Error ? e.message : 'Unknown error'}`);
59
+ hasErrors = true;
60
+ }
61
+ } else {
62
+ console.log(`\n ⚠️ proposal.md not found`);
63
+ }
64
+
65
+ const specLayout = validateSpecPathLayout(changeDir, { requireSpecs: true });
66
+ for (const failure of specLayout.failures) {
67
+ console.log(`\n ❌ ${failure}`);
68
+ hasErrors = true;
69
+ }
70
+
71
+ for (const specFile of specLayout.specFiles) {
72
+ try {
73
+ const content = readFileSync(specFile, 'utf-8');
74
+ const report = validator.validateDeltaSpec(content);
75
+ const relative = relativeSpecPath(changeDir, specFile);
76
+ printReport(`${relative} (delta spec)`, report);
77
+ if (!report.valid) hasErrors = true;
78
+ } catch (e) {
79
+ const relative = relativeSpecPath(changeDir, specFile);
80
+ console.log(`\n 📋 ${relative}`);
81
+ console.log(` ❌ Error reading file: ${e instanceof Error ? e.message : 'Unknown error'}`);
82
+ hasErrors = true;
83
+ }
84
+ }
85
+
86
+ console.log('');
87
+ if (hasErrors) {
88
+ console.log('❌ Validation failed with errors.');
89
+ process.exit(1);
90
+ } else {
91
+ console.log('✅ All artifacts validated successfully.');
92
+ process.exit(0);
93
+ }
94
+ }
95
+
96
+ main();
@@ -0,0 +1,59 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ const SEMVER = /^\d+\.\d+\.\d+$/;
4
+
5
+ export function parseReleaseCheckArgs(args) {
6
+ if (args.length !== 4 || args[0] !== '--manifest-url' || args[2] !== '--expected-version') {
7
+ throw new Error('Usage: verify-marketplace-release --manifest-url <https-url> --expected-version <x.y.z>');
8
+ }
9
+ const parsedUrl = new URL(args[1]);
10
+ if (parsedUrl.protocol !== 'https:') throw new Error('manifest URL must use HTTPS');
11
+ if (!SEMVER.test(args[3])) throw new Error('expected version must use x.y.z semver');
12
+ return { manifestUrl: parsedUrl.href, expectedVersion: args[3] };
13
+ }
14
+
15
+ export async function verifyMarketplaceRelease({
16
+ manifestUrl,
17
+ expectedVersion,
18
+ fetchImpl = globalThis.fetch,
19
+ }) {
20
+ let response;
21
+ try {
22
+ response = await fetchImpl(manifestUrl);
23
+ } catch (error) {
24
+ throw new Error('marketplace network request failed: ' + error.message);
25
+ }
26
+ if (!response.ok) throw new Error('marketplace manifest request failed: HTTP ' + response.status);
27
+ let manifest;
28
+ try {
29
+ manifest = await response.json();
30
+ } catch (error) {
31
+ throw new Error('marketplace manifest is not valid JSON: ' + error.message);
32
+ }
33
+ if (typeof manifest.version !== 'string') throw new Error('marketplace manifest is missing a string version');
34
+ if (manifest.version !== expectedVersion) {
35
+ throw new Error('marketplace version mismatch: expected ' + expectedVersion + ', found ' + manifest.version);
36
+ }
37
+ return { manifestUrl, expectedVersion, actualVersion: manifest.version };
38
+ }
39
+
40
+ export async function main(
41
+ args,
42
+ { fetchImpl = globalThis.fetch, stdout = process.stdout, stderr = process.stderr } = {},
43
+ ) {
44
+ try {
45
+ const { manifestUrl, expectedVersion } = parseReleaseCheckArgs(args);
46
+ const result = await verifyMarketplaceRelease({ manifestUrl, expectedVersion, fetchImpl });
47
+ stdout.write(`Marketplace manifest verified: ${result.actualVersion} (${result.manifestUrl})\n`);
48
+ return 0;
49
+ } catch (error) {
50
+ stderr.write(`Error: ${error.message}\n`);
51
+ return 1;
52
+ }
53
+ }
54
+
55
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
56
+ main(process.argv.slice(2)).then((exitCode) => {
57
+ process.exitCode = exitCode;
58
+ });
59
+ }
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: architecture-design
3
+ description: 基于 4A 企业架构 + DDD 领域驱动设计的架构/API/DB 设计 skill。当用户需要做架构设计、识别聚合与限界上下文、划分写/读模型(CQRS)、设计 API 指令映射,或在 team-flow / compound-engineering 工作流中做每变更架构增量设计与全局复利回写时使用。在 workflow-start 编排中作为子代理调用,承担判断+执行一体化职责(五项检查判定是否涉及架构变更,涉及则执行完整增量设计,不涉及则返回 skip)。不适用于:纯业务逻辑编码、与架构无关的需求分析、非 DDD 语境的数据库建模。
4
+ ---
5
+
6
+ # Architecture Design (4A + DDD)
7
+
8
+ 把企业架构(4A)与领域驱动设计(DDD)的 crystallized 方法,转化为每变更可执行的架构/API/DB 设计动作,并与 team-flow(开发过程) + compound-engineering(全局复利) 衔接。
9
+
10
+ ## Core Frameworks
11
+
12
+ ### F1 · 4A 分叉依赖
13
+ `BA → (IA ∥ AA) → TA`。BA 先行且未稳前不并行;IA 与 AA 同步并行、双向对齐;二者共同汇聚 TA。定义不可逆(先选技术再补流程是反模式)。
14
+
15
+ ### F2 · 跨域一致性(双对齐,质量门禁)
16
+ 每个 AA 功能 ≥1 个 IA 数据实体支撑;每个 IA 实体 ≥1 个 AA 功能消费(多对多,无孤立节点)。检查两类缺一不可:结构一致("有没有")+ 语义一致("对不对",命名统一,用户/客户/consumer 不能并存)。
17
+
18
+ ### F3 · 变更分叉级联(三层次必覆盖)
19
+ 直接依赖(BA→AA/IA 同变)→ 间接依赖(AA/IA→TA、IA↔AA 对齐调整)→ 隐式依赖(表面无关却牵动,最危险)。无架构管理=上线才暴露(10×成本)。
20
+
21
+ ### F4 · DDD 聚合四要素
22
+ 实体(唯一标识)+值对象(无标识)+聚合根(唯一入口)+事务边界(聚合内一事务)。聚合仅存于业务服务;数据服务/技术服务无聚合。
23
+
24
+ ### F5 · 限界上下文(Context Map)
25
+ 语义边界=L3 应用服务;同术语异义须显式映射(Shared Kernel / Anti-Corruption Layer / Open Host Service)。
26
+
27
+ ### F6 · CQRS 写读模型
28
+ 事务型对象→写模型(聚合,Command/Read 操作);分析型对象→读模型(查询模型,Query 派生,无事务)。Command/Read→写模型;Query 经阻断测试分流。
29
+
30
+ ### F7 · 三维判定(验证工具)
31
+ 失忆测试(清空业务记忆还能工作?→TA) → 阻断测试(阻断1h下游能继续?不能→业务服务/能→数据服务) → 孤岛测试(谁调用? 私有/领域共通/企业共通)。
32
+
33
+ ### F8 · 增量设计 + 复利回写闭环(工作流衔接)
34
+ 每变更:As-Is 冻结复制+版本锚点(change_id+章节+commit)→ To-Be(DDD)+ 全局 ARCHITECTURE.md 锚点。复利回写:one change per run,append 当前态+演进日志,Discoverability 在 AGENTS.md 暴露 docs/architecture/,下游检索复用。API 仅每变更内设计;技术架构(IA/AA/TA)与产品策略(BA/STRATEGY.md)分离对齐。
35
+
36
+ ## Chapter Index
37
+ - ch01-4a-domains — 4A 四域定义与分叉依赖
38
+ - ch02-change-cascade — 变更级联与跨域一致性门禁
39
+ - ch03-architecture-outputs — 架构产出三层 + 治理三支柱
40
+ - ch04-entity-to-aggregate — 业务实体→聚合→限界上下文
41
+ - ch05-cqrs — 写/读模型、指令分流、三维判定
42
+ - ch06-integration — 与 team-flow / compound-engineering 的集成
43
+
44
+ ## Topic Index
45
+ - 4A / BA / IA / AA / TA → ch01
46
+ - 分叉依赖 / 跨域一致性 → ch01, ch02
47
+ - 变更级联(直接/间接/隐式) → ch02
48
+ - 架构产出三层(元素/制品/交付件) → ch03
49
+ - 治理三支柱 → ch03
50
+ - 业务实体 / 活动对象矩阵 → ch04
51
+ - 聚合 / 聚合根 / 值对象 / 事务边界 → ch04
52
+ - 限界上下文 / Context Map → ch04
53
+ - 写模型 / 读模型 / CQRS → ch05
54
+ - Command / Read / Query → ch05
55
+ - 阻断测试 / 三维判定 → ch05
56
+ - 增量设计 / As-Is 冻结 / 复利回写 / 全局锚点 → ch06
57
+
58
+ ## Workflow Integration: 判断+执行一体化(v0.9 §26)
59
+
60
+ 本 skill 在 workflow-start 编排下作为子代理调用,承担**判断+执行一体化**职责。
61
+
62
+ ### 调用入口
63
+
64
+ 由 workflow-start 在 `exploring` 完成后、`specifying` 之前调用。
65
+
66
+ ### 输入
67
+
68
+ - `change-brief.md`(scope / AC / 技术方向)
69
+ - `prd/vN/plan.md` 高阶技术设计段(模块边界/技术选型/数据流/关键聚合划分)
70
+ - 现有 `specs/`(若有)
71
+ - 全局 `docs/architecture/`(As-Is 基线)
72
+
73
+ ### 五项检查(架构变更判定)
74
+
75
+ 依次检查以下五项,**全部为否** → `decision: skipped`;**任一为是** → `decision: required`:
76
+
77
+ 1. **聚合变更**:是否新增/修改聚合(aggregate)或聚合根
78
+ 2. **限界上下文变更**:是否涉及限界上下文(bounded context)边界变化或新增上下文映射关系
79
+ 3. **读写模型变更**:是否涉及 CQRS 写模型或读模型变化
80
+ 4. **API 变更**:是否涉及 API 新增/变更(端点、方法签名、请求响应 schema)
81
+ 5. **DB schema 变更**:是否涉及数据库表结构、字段、索引变更
82
+
83
+ ### 执行流程
84
+
85
+ ```
86
+ 1. 读取输入(brief + plan + specs + 全局 ARCHITECTURE.md)
87
+ 2. 执行五项检查
88
+ 3. 全部为否:
89
+ → decision: skipped
90
+ → reason: 简述不涉及架构变更的理由
91
+ → 返回结构化输出
92
+ 4. 任一为是:
93
+ → decision: required
94
+ → reason: 简述涉及的架构变更项
95
+ → 执行完整 4A+DDD 增量设计(F1-F8)
96
+ → 产出 architecture/architecture.md + database.md + api.md
97
+ → artifacts: 产出路径列表
98
+ → 返回结构化输出
99
+ ```
100
+
101
+ ### 结构化输出契约
102
+
103
+ 返回给 workflow-start 的结果**必须**包含以下字段:
104
+
105
+ ```yaml
106
+ decision: required | skipped
107
+ reason: "..." # skipped 时:不涉及架构变更的理由
108
+ # required 时:涉及的变更项摘要
109
+ artifacts: # required 时必填,skipped 时为空
110
+ - architecture/architecture.md
111
+ - architecture/database.md
112
+ - architecture/api.md
113
+ ```
114
+
115
+ ### 产出目录
116
+
117
+ 架构设计产出放在 change 目录下的独立 `architecture/` 子目录:
118
+
119
+ ```
120
+ changes/<name>/
121
+ └── architecture/ # ★ 架构设计独立一等产物
122
+ ├── architecture.md # DDD 增量(聚合/限界上下文/CQRS/Context Map)
123
+ ├── database.md # DB 增量(实体/读写模型/schema 变更)
124
+ └── api.md # API 增量(Command/Read/Query 分流 + 端点设计)
125
+ ```
126
+
127
+ **语义分离**:架构设计与行为规格(`specs/`)是不同专业领域,独立目录避免混杂。
128
+
129
+ **下游消费**:
130
+ - `architecture/architecture.md` → spec-writer:design.md Decisions 约束
131
+ - `architecture/database.md` → spec-writer:design.md + tasks.md 数据层约束
132
+ - `architecture/api.md` → spec-writer:tasks.md 接口定义约束
133
+ - 全部 → release-archivist → arch-merge → 全局 `docs/architecture/` 回写
134
+
135
+ ### 独立调用
136
+
137
+ 除 workflow-start 编排调用外,本 skill 仍支持用户显式独立调用(`/team-flow:architecture-design`),此时不走五项检查判定门,直接执行完整 4A+DDD 设计。
138
+
139
+ ## Scope & Limits
140
+ 本 skill 覆盖 4A+DDD 架构设计方法及其与 team-flow/compound-engineering 的衔接。落地实现结合项目具体工具;超出本范围见相关 skill 或直接问 agent。
@@ -0,0 +1,27 @@
1
+ # ch01 · 4A 四域定义与分叉依赖
2
+
3
+ ## 四域定义(每域回答一个问题)
4
+ | 域 | 问题 | 核心资产 | 主责角色 |
5
+ |---|---|---|---|
6
+ | BA 业务架构 | 做什么业务? | 流程/价值流/能力 | 业务分析师 |
7
+ | IA 信息架构 | 管什么数据? | 数据实体/指标体系 | 数据架构师 |
8
+ | AA 应用架构 | 用什么功能? | 功能/服务/领域模型 | 应用架构师 |
9
+ | TA 技术架构 | 用什么技术? | 选型/标准/基础设施 | 技术架构师 |
10
+
11
+ > 精确性:仅 **TA** 是技术架构。IA(数据)、AA(功能)常被误统称"技术架构"——这是术语硬伤,会误导建模(如把数据实体当技术选型)。
12
+
13
+ ## 分叉依赖(核心框架 F1)
14
+ 结构本质不是线性串行,而是**分叉的多米诺骨牌**:
15
+ 1. **BA 先行**,是起点与前提;
16
+ 2. BA 稳定后 **IA 与 AA 同步并行**开展,且双向输入、随时对齐(如 AA 按客户等级筛,IA 就加对应字段);
17
+ 3. IA 与 AA 输出**共同汇聚 TA**,TA 最后落地。
18
+
19
+ 公式:`BA → (IA ∥ AA) → TA`
20
+
21
+ **约束**
22
+ - 分叉是有条件的:先稳 BA,再并行 IA/AA;BA 未稳时并行是白费力气。
23
+ - 顺序可迭代,但**定义不能反**(反模式:先买大数据平台再补流程 → 平台闲置)。
24
+
25
+ ## 应用提示
26
+ - 设计架构前先确认 BA 是否已稳;不稳则先把 BA 落到 STRATEGY.md/PRD,再动 IA/AA/TA。
27
+ - 把"技术锚点(ARCHITECTURE.md)"与"产品策略(STRATEGY.md)"分离——前者管 IA/AA/TA,后者管 BA;二者对齐而非混写(见 ch06)。
@@ -0,0 +1,27 @@
1
+ # ch02 · 变更级联与跨域一致性门禁
2
+
3
+ ## 变更分叉级联(核心框架 F3)
4
+ 每一层输出是下一层输入;分叉下 BA 一变,IA 与 AA 同时倒、互拉,再汇聚 TA。
5
+ 案例标尺:加"拼车"功能 → BA 改 3、AA 改 5、IA 改 5、TA 改 4,共 17 项。
6
+
7
+ **三层次影响必须全覆盖:**
8
+ | 层 | 名称 | 说明 | 风险 |
9
+ |---|---|---|---|
10
+ | 1 | 直接依赖 | BA 变→AA/IA 同时直接变 | 可见,不易漏 |
11
+ | 2 | 间接依赖 | AA/IA 变→TA 变;IA↔AA 对齐调整 | 链条长,易忽略 |
12
+ | 3 | 隐式依赖 | 表面无关却牵动(如报表 SQL 仍按老表结构) | 最危险,特征"看不出关联" |
13
+
14
+ > 无架构管理=被动发现(测试/上线才暴露,成本 10×);有架构管理=系统提示受影响域,事前规划。
15
+
16
+ ## 跨域一致性(核心框架 F2,质量门禁)
17
+ **硬规则**:AA 定义的功能,IA 必须有对应数据实体支撑;反之 IA 定义的数据实体,AA 必须有功能使用。无数据的功能是空壳,无功能的数据是死数据。
18
+
19
+ **两类检查缺一不可:**
20
+ 1. **结构一致("有没有")**:每个 AA 功能至少 1 个 IA 数据实体;可拉清单自动查孤儿。
21
+ 2. **语义一致("对不对")**:命名与术语统一(前端"用户"、后端"客户"、库里"consumer" 并存=反模式);靠命名规范+术语表保障。
22
+
23
+ **易错点**:一致性非一一对应,而是**多对多**——每功能≥1 实体、每实体≥1 功能,两端无孤立节点。这是架构发布的质量门禁,过不了不能发布。
24
+
25
+ ## 应用提示
26
+ - 每变更做影响分析时,用三层次清单逐项打勾,重点补"隐式依赖"。
27
+ - 回写全局架构文档时,"架构一致性/漂移检查"须覆盖结构+语义双对齐(见 ch06 的 Discoverability 正名)。