@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,207 @@
1
+ # E2E 测试集成进 team-flow 设计方案 v2(吸收双专家评审后修订)
2
+
3
+ > 状态:v2 修订稿,已吸收 E2E 测试架构 + team-flow 架构双专家评审
4
+ > 来源依据:gtmc `acceptance-test` SKILL.md v3.0.0 + `test-verifier.md`;spoko.space《AI & Playwright E2E Testing 2026》;LT的知识库(EXJh01CG7...)已存上述 gtmc 文件
5
+ > 重要更正(v2):经架构评审核实,`ce-proof` 实为 **Proof 协作式 Markdown 编辑器**(发布 proofeditor.ai),**不是**"验证证明"。验收证据聚合归属 `release-archivist`(closing 态 verification gate)+ `build-executor` + `code-reviewer`。v1 草案 §1.1/§8 对 ce-proof 的定性为误读,本版纠正。
6
+ > **整合状态**:本方案已整合进主设计规格 `docs/architecture-api-db-design-enhancement-v0.3.md` **第十六章 E2E 测试集成(v0.4)**;本文件保留为评审过程稿与详细附录,规范以主规格第十六章为准。
7
+
8
+ ---
9
+
10
+ ## 0. 决策记录
11
+
12
+ | 维度 | 决策 | 备注 |
13
+ |---|---|---|
14
+ | 原型框架 | **A:维持 HTML 自包含 + 强化 `data-testid` 契约** | 守住 v0.3 零依赖/可离线 |
15
+ | E2E 挂载 | **A1:新建独立 `e2e` skill** | 17→18;可选 overlay,不进核心状态机 |
16
+ | `data-testid` 规范 | 搬 gtmc 命名;选择器优先级统一 spoko | 元素级仅关键锚点 |
17
+ | 覆盖率门禁 | **分级**:原型期放宽 / 集成期严格照搬 gtmc | 门禁随被测体成熟度递增 |
18
+ | AC 提取 | 门禁按维度条件触发 + 关键字回退 | 解除"可选→强制"陷阱 |
19
+ | 验收证据归属 | `release-archivist`(非 ce-proof) | v2 纠正误读 |
20
+
21
+ > 版本口径:本文件为**设计修订号 v0.4**;已发布插件打包版本为 **0.10.0**(冻结设计基线 v0.3)。两轴独立,勿与 `check-version-consistency` 守卫混淆。
22
+
23
+ ---
24
+
25
+ ## 1. 背景与现状缺口
26
+
27
+ ### 1.1 team-flow 现有测试纪律
28
+ - `build-executor` 的 **TDD Iron Law**(RED→GREEN→REFACTOR)+ **SDD** + review gate + 8 态状态机。
29
+ - `spec.md` 含 `#### Scenario:` 块(验收场景),validation 要求每 Requirement 有 SHALL/MUST + ≥1 Scenario(机器级校验在 `scripts/validate-artifacts` → `dist/index.js` 的 `Validator.validateDeltaSpec`)。
30
+ - `release-archivist` 在 closing 态有 `verification-before-completion` gate(state-machine.md),承担验收证据聚合。
31
+ - `ce-proof` 是 **Proof Markdown 编辑器**(外部托管 proofeditor.ai),与测试/验证无关。
32
+ - 插件自身 `tests/e2e.test.mjs` 是 tf 解析引擎测试,**非产品 UI E2E**。
33
+ - `prototype` skill 产出自包含 HTML,但**不自动生成 Playwright**。
34
+
35
+ ### 1.2 核心缺口
36
+ **spec 场景 / 验收标准 → 可执行 E2E (Playwright) 的桥接未自动化。** gtmc 的 `acceptance-test` + `test-verifier` 是此桥接的完整参考实现(AC 驱动黑盒 + 机械覆盖率 + Playwright 生成)。
37
+
38
+ ---
39
+
40
+ ## 2. 不可破的核心约束
41
+
42
+ | 约束 | 来源 | 对 E2E 方案的含义 |
43
+ |---|---|---|
44
+ | 原型零依赖/可离线 | v0.3 `prototype-design-research.md` + prototype SKILL.md | 原型仍自包含 HTML;`data-testid` 为纯 HTML 属性,不引入 JS/CSS/构建/Playwright。Playwright 仅进**用户项目**,不进插件 |
45
+ | 通用插件不固化框架 | config 设计原则 | E2E 靠 `data-testid` 契约跨框架复用,不假设 Vue/React |
46
+
47
+ > 已否决:原型改 Vue(推翻零依赖 + 背叛通用性)。
48
+
49
+ ---
50
+
51
+ ## 3. `data-testid` 契约规范(搬 gtmc 命名 + spoko 纪律)
52
+
53
+ **原则**:`data-testid` 是"测试—组件"契约层,由 spec/`execution-contract.md` 定义;原型 HTML 与实际 UI 代码**共用同一命名**,使 Playwright 测试脚本高重叠复用。
54
+
55
+ ### 3.1 命名层级(搬 gtmc)
56
+ | 层级 | 格式 | 示例 |
57
+ |---|---|---|
58
+ | 场景级 | `S-{nn}-{slug}` | `data-testid="S-01-create-goal"` |
59
+ | 页面级 | `P-{xx}-{slug}` | `data-testid="P-04-strategy-list"` |
60
+ | 元素级 | `{语义名}` | `data-testid="create-btn"` / `name-input` / `submit` |
61
+
62
+ ### 3.2 选择器优先级(统一 spoko 立场,v2 修正 §3.2/§7 矛盾)
63
+ **`getByRole` > `data-testid` > `id` > `getByLabel` > CSS/XPath(禁用于新测试)**。
64
+ - `data-testid` 仅用于动态/hydration 边界或角色不可达元素,非第一优先。
65
+ - 禁止 `waitForTimeout`(flaky 源),用 web-first 断言。
66
+
67
+ ### 3.3 打标纪律(v2 修正"过度打标")
68
+ - **必带**:场景级、页面级 testid(每个页面/场景根)。
69
+ - **元素级仅关键交互锚点**(提交、主操作、状态切换点)带 testid;内部子元素优先用 `getByRole`/`getByText`。
70
+ - 不"每个交互元素都打"——避免 DOM 膨胀与维护负担(spoko 反模式)。
71
+
72
+ ### 3.4 可选开启 + 零依赖声明
73
+ - 由 config 驱动:仅当 change 选择 E2E 时强制 testid 产出,避免无测试需求项目被迫加。
74
+ - prototype SKILL.md 显式补:"`data-testid` 为纯 HTML 属性,不引入任何依赖"——钉死零依赖约束。
75
+
76
+ ### 3.5 契约治理(v2 新增,防漂移)
77
+ - `execution-contract.md` 记录 UI 契约(testid 命名 + 期望行为)。
78
+ - 提供 **testid checker**:比对原型 HTML 与实际代码两侧 testid 集合,漂移即报警,避免"同名约定"静默失效。
79
+
80
+ ---
81
+
82
+ ## 4. spec `#### Scenario:` → Playwright 映射(v2 修正 fallback)
83
+
84
+ ### 4.1 提取源
85
+ | gtmc 输入 | team-flow 对应 | AC 类型 |
86
+ |---|---|---|
87
+ | 验收标准 checkbox | Requirement `#### Scenario:`(正常路径) | HP |
88
+ | 异常处理 table | spec 可选 `##### Exception:` 子标签 | EX |
89
+ | 状态流转图 | spec 可选 `##### State:` 子标签 | ST |
90
+ | 交互步骤字段 | spec 可选 `##### Boundary:` 子标签 | BND |
91
+
92
+ ### 4.2 解除"可选→强制"陷阱(v2 关键修正)
93
+ 门禁**按维度条件触发** + **关键字回退**双保险:
94
+ 1. **维度条件触发**:仅当 spec 含某维度标签时,才考核该维度覆盖率;未含 → 标 `N/A` 而非 `0%`,不触发 BLOCKER。
95
+ 2. **关键字回退推导**:未打标签时,从 Scenario 文本提取 error/invalid/fail/边界/超时 等信号作为 EX/ST/BND 来源,使存量 spec 仍有覆盖率。
96
+ - 二者至少取一,确保"可选"真正可选、向后兼容。
97
+
98
+ ### 4.3 AC 矩阵公式(搬 gtmc)
99
+ `Total = HP×1 + EX×2 + ST×2 + BND×1`(ST-invalid 若已被 EX 覆盖则去重)。
100
+
101
+ ### 4.4 阶段映射(v2 修正 gtmc 编号)
102
+ 不用 gtmc 的 A-5.7/A-6.5/A-6.7,映射到本插件真实执行模型:
103
+ | team-flow 阶段 | 被测体 | 含义 |
104
+ |---|---|---|
105
+ | bridging / prototype | `prototype/` HTML(http-server 托管) | 验证 spec 可执行性 |
106
+ | executing(batch/wave) | `build-executor` 实际代码 | 集成验证 |
107
+ | closing | 业务完整实现 | 验收(release-archivist gate) |
108
+
109
+ ---
110
+
111
+ ## 5. 门禁分级(v2 修正:原型放宽 / 集成严格)
112
+
113
+ | 指标 | 原型期(验证可执行性,静态 mock) | 集成期(实际代码) |
114
+ |---|---|---|
115
+ | AC 覆盖率 | ≥ 80%(HP 必测) | ≥ 95% |
116
+ | 异常路径 EX | 有则测、无则带说明(不阻断) | ≥ 80% |
117
+ | 状态转换 ST | 有则测、无则带说明(不阻断) | ≥ 90% |
118
+ | 边界值 BND | 有则测、无则带说明(不阻断) | ≥ 75% |
119
+ | 阻断级别 | AC<80% = BLOCKER | AC/EX < 门槛 = BLOCKER;ST/BND = WARNING |
120
+
121
+ > 门禁随被测体成熟度**单调递增**;原型 mock 结构性做不到 EX/ST 全覆盖,强行照搬会产出虚假 BLOCKER(与 spoko"工具不替人类做覆盖决策"一致)。
122
+
123
+ ---
124
+
125
+ ## 6. 新 `e2e` skill 设计(SKILL.md 草案)
126
+
127
+ ```yaml
128
+ name: e2e
129
+ description: 从 spec 验收场景生成 Playwright E2E 测试、执行并审计覆盖率(可选 overlay)。
130
+ 用法: /e2e [原型|集成|验收] [spec路径]
131
+ version: 0.1.0
132
+ user-invocable: true
133
+ ```
134
+
135
+ ### 执行流程(5 步)
136
+ 1. **确定测试类型**:原型(默认)/ 集成 / 验收。
137
+ 2. **AC 提取与分类**:从 spec Scenario(+ 可选子标签 / 关键字回退)机械提取,生成 AC 矩阵。质量门禁:总测试数 ≥ AC×1.5。
138
+ 3. **测试脚本生成**:调用 `test-verifier` 角色,含 AC 矩阵 + 黑盒约束(§3.2 选择器纪律)+ 分级门禁 + 命名规范 + `@regression-source`/`@last-sync` 标记。
139
+ 4. **执行与报告**:跑 Playwright,产出 AC 覆盖率 / 四维覆盖率 / 类型分布 / 未覆盖清单 / 失败根因分类(测试问题 vs 实现问题)。
140
+ 5. **覆盖率审计**:按 §5 分级门槛判定 BLOCKER/WARNING,未达标回退补充。
141
+
142
+ ### 产出物(v2 修正落盘位置)
143
+ | 产物 | 路径 |
144
+ |---|---|
145
+ | 测试脚本 | **统一 `e2e/`**(不放 `prototype/`) |
146
+ | AC 矩阵 | `docs/statistics/AC-coverage-matrix.md` |
147
+ | 测试报告 | `docs/statistics/YYYY-MM-DD-e2e-report.md` |
148
+
149
+ > **复用机制(v2 修正)**:单一 `e2e/` + `playwright.config.ts` 的 `projects`(baseURL 切换)同时服务两个被测体——`prototype` project → http-server 托管 HTML;`integration` project → 真实应用。测试脚本体一致,**仅切目标地址 + 少量选择器/断言适配**(表述为"高重叠复用",非"零触碰";原型绿 ≠ 集成绿)。
150
+
151
+ ---
152
+
153
+ ## 7. 执行层:`test-verifier` 角色(v2 裁剪 MVP 子集)
154
+
155
+ 借 gtmc `test-verifier.md` 作 e2e skill 执行 Agent,**MVP 裁剪**:
156
+ - **保留**:AC 深度分析(4 类提取 + 分级门禁)、选择器纪律、E2E 决策矩阵(轻量)、执行与报告(覆盖率/未覆盖/根因)。
157
+ - **移交 `release-archivist`**:4 级制品验证(L1 存在→L4 数据流;设计→实现追溯本就是 closing gate 缺口)。
158
+ - **DEFER / 归 `prototype-reviewer`**:8 维健康评分(功能/无障碍/UX/控制台/视觉/性能/链接/内容,<60 阻止发布)、每页 7 点视觉走查(需 axe/Lighthouse,不匹配自包含原型 MVP)。
159
+
160
+ > 适配:gtmc 用 `npx playwright test` + Bash;team-flow E2E 在**用户项目目录内**初始化独立 Playwright 工程,不塞进插件自身 `.mjs` 测试。
161
+
162
+ ---
163
+
164
+ ## 8. 对现有 skill 的影响面(v2 纠正事实错误)
165
+
166
+ | Skill | 改动 |
167
+ |---|---|
168
+ | `prototype` | 补 `data-testid` 产出要求(场景/页面级必带 + 关键锚点;config 可选开启;零依赖声明) |
169
+ | `build-executor` | 不改(TDD 管单测;E2E 独立) |
170
+ | `ce-proof` | **不改**(纠正误读:它仍是 Proof 编辑器,与验证无关) |
171
+ | `release-archivist` | 接入 e2e 报告 + 4 级制品比对(closing 验收 gate 的验证维度) |
172
+ | `architecture-design` | API/DB 设计文档供 `release-archivist` 制品比对使用 |
173
+ | `design-system`(=模板/项目 design-system.md,**非 skill**) | 不在 9 段视觉 schema 加测试段;testid 契约只置 `execution-contract.md`(避免双真相源) |
174
+ | `spec-writer` | Validation Checklist 补"可选 Exception/State/Boundary 子标签"说明;补回归用例 |
175
+
176
+ ---
177
+
178
+ ## 9. 实施步骤(Claude Code,拍板后)
179
+
180
+ 1. 新建 `skills/e2e/SKILL.md`(§6 草案)+ `skills/e2e/references/test-verifier.md`(§7 MVP 裁剪)。
181
+ 2. 改 `prototype/SKILL.md`:补 §3.3–3.4 的 data-testid 产出(可选开启 + 零依赖声明)。
182
+ 3. 改 `release-archivist/SKILL.md`:接入 e2e 报告 + 4 级制品比对。
183
+ 4. 改 `spec-writer`:Validation Checklist 补可选子标签说明;补回归用例"含 `##### Exception:` 的 spec 仍能 `npm run validate` 通过"。
184
+ 5. `plugin.json` 第 4 行"17 skills"→"18 skills"(仅文案,守卫不因此失败)。
185
+ 6. 版本两轴:文档标注设计修订 v0.4 vs 打包 0.10.0。
186
+ 7. `check-version-consistency.mjs`:新增 skill 不在守卫枚举内,不会破;人工确保 e2e 不引入错误版本 `npx` 引用。
187
+ 8. `npm test` / `npm run validate` 验证插件不因新增 skill 破损。
188
+
189
+ ---
190
+
191
+ ## 10. 专家评审结论摘要(已采纳)
192
+
193
+ ### E2E 测试架构专家
194
+ - **BLOCKER**:① 测试落盘位置自相矛盾(prototype/tests/ 又宣称仅地址切换);② 门禁照搬全阈值到原型期会系统性虚假 BLOCKER;③ AC 提取依赖可选子标签却驱动强制门禁。
195
+ - **WARNING**:选择器优先级矛盾;过度打标;test-verifier 过度搬运;testid 契约漂移;复用表述夸大;§0/§5.1 内部不一致;18 skill 精简定位。
196
+ - **最担忧**:B②+B③ 叠加 = 门禁在原型期默认失败。
197
+
198
+ ### team-flow 架构专家
199
+ - **BLOCKER**:① ce-proof 职责误定(实为 Proof 编辑器,方案前提错误);② spec 可选标签 vs 强制门禁反向兼容矛盾。
200
+ - **WARNING**:design-system 误标为 skill + 测试契约耦合;影响面表事实错误;validateDeltaSpec 对 `#####` 容忍度未实测;prototype testid 强制偏重;test-verifier 范围过大;gtmc 阶段编号误用;版本口径。
201
+ - **最反对**:ce-proof 误读导致验收证据归属错误。
202
+
203
+ ### v2 已采纳的修订
204
+ ✅ ce-proof 重定位(归 release-archivist)|✅ 门禁分级(原型放宽/集成严格)|✅ AC 提取 fallback(维度条件触发 + 关键字回退)|✅ 落盘统一 `e2e/` + projects(baseURL)|✅ 选择器优先级统一 spoko|✅ 打标纪律(关键锚点)|✅ test-verifier MVP 裁剪(4级/8维移交)|✅ design-system 纠正(非 skill,契约只置 execution-contract)|✅ 阶段映射回 team-flow 模型|✅ 文档内部一致|✅ 版本两轴 + plugin.json 18 文案。
205
+
206
+ ---
207
+ *本方案为 v0.4 设计修订,v2 已吸收双专家评审。须经 LT 拍板后方可进入 Claude Code 实施。*
@@ -0,0 +1,25 @@
1
+ # Examples
2
+
3
+ Example changes and artifact sets live here.
4
+
5
+ ## Included Examples
6
+
7
+ - `add-dark-mode`
8
+ - A net-new UI capability example that shows feature delivery from proposal to execution contract.
9
+ - `refactor-auth-boundary`
10
+ - A brownfield backend refactor example that shows how to stabilize a scattered auth flow without expanding into a full auth redesign.
11
+
12
+ ## Reading Order
13
+
14
+ For any example, read:
15
+
16
+ 1. `README.md`
17
+ 2. `proposal.md`
18
+ 3. `specs/`
19
+ 4. `design.md`
20
+ 5. `tasks.md`
21
+ 6. `execution-contract.md`
22
+
23
+ ## Planned Future Examples
24
+
25
+ - `ship-web-ui-v2`
@@ -0,0 +1,13 @@
1
+ # add-dark-mode Example
2
+
3
+ This example demonstrates a complete `team-flow` change set for a dark mode feature.
4
+
5
+ Included artifacts:
6
+
7
+ - `proposal.md`
8
+ - `specs/ui-theme/spec.md`
9
+ - `design.md`
10
+ - `tasks.md`
11
+ - `execution-contract.md`
12
+
13
+ Read these files in order to see how planning becomes an implementation contract.
@@ -0,0 +1,49 @@
1
+ # Technical Design
2
+
3
+ ## Context
4
+
5
+ - Current state: the UI uses a single default theme and does not expose theme preference controls
6
+ - Constraints: the feature should work without server persistence and should not introduce heavy theming dependencies
7
+ - Stakeholders: end users, frontend engineers, QA reviewers
8
+
9
+ ## Goals
10
+
11
+ - Add reliable light/dark theme switching
12
+ - Follow system preference on first load
13
+ - Persist an explicit user choice locally
14
+ - Minimize the amount of UI code that needs per-component theme branching
15
+
16
+ ## Non-Goals
17
+
18
+ - Shipping multiple branded themes
19
+ - Adding backend preference storage
20
+ - Redesigning unrelated UI components
21
+
22
+ ## Decisions
23
+
24
+ ### Decision 1
25
+
26
+ - Choice: use a single theme state source with a root-level theme attribute and tokenized colors
27
+ - Rationale: centralizing theme state reduces drift and avoids scattered conditional styling
28
+ - Alternatives considered: per-component toggles and duplicated light/dark class logic
29
+
30
+ ### Decision 2
31
+
32
+ - Choice: persist explicit choice in localStorage
33
+ - Rationale: it is simple, browser-native, and enough for a client-side preference
34
+ - Alternatives considered: cookies and backend profile storage
35
+
36
+ ## Risks And Trade-Offs
37
+
38
+ - Theme flash on initial load -> initialize theme as early as possible in the app shell
39
+ - Incomplete dark-mode coverage -> prioritize shared tokens and core surfaces first
40
+
41
+ ## Migration Plan
42
+
43
+ - Rollout steps: add theme provider, add toggle, migrate core tokens, verify contrast
44
+ - Rollback steps: remove toggle entry point and fall back to the existing single-theme token set
45
+
46
+ ## Open Questions
47
+
48
+ - Question: should the toggle live in the header or a settings drawer?
49
+ - Decision owner: product or design owner
@@ -0,0 +1,56 @@
1
+ # Execution Contract
2
+
3
+ ## Intent Lock
4
+
5
+ - Change name: `add-dark-mode`
6
+ - Problem being solved: the product needs a readable dark mode and a stable user-controlled theme choice
7
+ - In scope: system preference detection, manual toggle, local persistence, shared token updates
8
+ - Out of scope: custom theme presets, backend preference sync, unrelated visual redesign
9
+
10
+ ## Approved Behavior
11
+
12
+ - The UI supports both light and dark mode
13
+ - First load follows system preference when no saved choice exists
14
+ - A saved explicit choice overrides system preference
15
+ - The user can toggle theme immediately from the UI
16
+ - Core text and surfaces remain readable in dark mode
17
+
18
+ ## Design Constraints
19
+
20
+ - Theme state must come from one shared source of truth
21
+ - Root theme application should be centralized at app-shell level
22
+ - Local persistence uses browser storage only
23
+ - Shared tokens or variables should drive styling instead of scattered per-component logic
24
+
25
+ ## Task Batches
26
+
27
+ ### Batch 1
28
+
29
+ - Objective: establish theme state, system preference detection, and persistence
30
+ - Inputs: current app shell and client storage access
31
+ - Outputs: working theme state source with persisted choice handling
32
+ - Done when: first-load and returning-user behavior can be tested in isolation
33
+
34
+ ### Batch 2
35
+
36
+ - Objective: apply shared theme tokens and visible UI toggle
37
+ - Inputs: completed theme state source
38
+ - Outputs: active theme styling and user-facing toggle
39
+ - Done when: users can switch theme live and core UI reflects the selected theme
40
+
41
+ ## Test Obligations
42
+
43
+ - Behavior that must start with failing tests: initial theme selection, persisted preference override, manual toggle switching
44
+ - Required edge cases: no stored preference, stored preference exists, system preference differs from saved preference
45
+ - Regression-sensitive areas: root layout, shared tokens, text contrast, toggle state reflection
46
+
47
+ ## Review Gates
48
+
49
+ - Mandatory review points: after Batch 1 foundation, after Batch 2 UI application, before closure
50
+ - Blocker categories: spec mismatch, missing persistence behavior, unreadable dark-mode contrast, no failing test before implementation
51
+
52
+ ## Escalation Rules
53
+
54
+ - Return to `specifying` when: scope expands to multi-theme support or account-synced preferences
55
+ - Return to `bridging` when: theme architecture changes materially or batch boundaries no longer fit the approved design
56
+ - Do not continue implementation if: dark-mode behavior requires unstated product decisions or new behavior not covered by current specs
@@ -0,0 +1,46 @@
1
+ # Change Proposal
2
+
3
+ ## Why
4
+
5
+ Users need a dark mode because the current interface is uncomfortable in low-light environments and visually inconsistent with modern system theme expectations.
6
+
7
+ This matters now because the product is moving beyond internal use and theme mismatch creates immediate usability friction.
8
+
9
+ ## What Changes
10
+
11
+ - Add a user-facing dark mode for the web UI.
12
+ - Respect system preference on first load.
13
+ - Allow manual light/dark switching after first load.
14
+ - Persist the user's explicit theme choice locally.
15
+
16
+ ## Capabilities
17
+
18
+ ### New Capabilities
19
+
20
+ - `ui-theme`
21
+
22
+ ### Modified Capabilities
23
+
24
+ - None
25
+
26
+ ## Scope
27
+
28
+ ### In Scope
29
+
30
+ - Theme state management
31
+ - System preference detection
32
+ - User toggle in the UI
33
+ - Persistent theme preference
34
+ - Core page colors and text contrast updates
35
+
36
+ ### Out of Scope
37
+
38
+ - Custom theme palettes
39
+ - Per-page theme overrides
40
+ - Server-side preference sync
41
+
42
+ ## Impact
43
+
44
+ - Affected code areas: app shell, root layout, shared styling tokens, settings or header UI
45
+ - Affected APIs or interfaces: theme provider or theme hook used by the UI
46
+ - Dependencies or systems touched: browser localStorage and CSS variables or equivalent theme token system
@@ -0,0 +1,35 @@
1
+ # Capability Spec
2
+
3
+ ## ADDED Requirements
4
+
5
+ ### Requirement: User can use dark mode
6
+
7
+ The system SHALL provide a dark theme variant for the primary user interface.
8
+
9
+ #### Scenario: Initial load follows system preference
10
+
11
+ - **WHEN** a first-time visitor opens the application and has no saved theme preference
12
+ - **THEN** the interface uses the operating system color-scheme preference
13
+
14
+ #### Scenario: User manually switches theme
15
+
16
+ - **WHEN** the user activates the theme toggle
17
+ - **THEN** the interface switches between light and dark mode immediately
18
+
19
+ ### Requirement: User preference persists
20
+
21
+ The system SHALL persist an explicit user theme choice across reloads.
22
+
23
+ #### Scenario: Saved choice overrides system preference
24
+
25
+ - **WHEN** a returning user has a saved theme choice
26
+ - **THEN** the application loads using the saved choice instead of the current system preference
27
+
28
+ ### Requirement: Theme maintains readable contrast
29
+
30
+ The system SHALL preserve readable text and UI contrast in both light and dark mode.
31
+
32
+ #### Scenario: Primary content remains readable
33
+
34
+ - **WHEN** the user views text, surfaces, and interactive controls in dark mode
35
+ - **THEN** foreground and background combinations remain readable and distinguishable
@@ -0,0 +1,26 @@
1
+ # Implementation Tasks
2
+
3
+ ## 1. Theme Foundation
4
+
5
+ - [ ] 1.1 Add a centralized theme state source
6
+ - [ ] 1.2 Read system preference when no explicit user preference exists
7
+ - [ ] 1.3 Persist explicit user preference locally
8
+
9
+ ## 2. Theme Application
10
+
11
+ - [ ] 2.1 Add a root-level theme attribute or class
12
+ - [ ] 2.2 Define light and dark color tokens for shared UI surfaces
13
+ - [ ] 2.3 Update core text, background, and control styling to consume shared tokens
14
+
15
+ ## 3. User Interaction
16
+
17
+ - [ ] 3.1 Add a visible theme toggle
18
+ - [ ] 3.2 Ensure the toggle updates theme state immediately
19
+ - [ ] 3.3 Ensure the toggle reflects the active theme state
20
+
21
+ ## 4. Verification
22
+
23
+ - [ ] 4.1 Add failing tests for initial theme selection and persisted preference behavior
24
+ - [ ] 4.2 Add failing tests for manual toggle behavior
25
+ - [ ] 4.3 Run regression checks for readable contrast on primary surfaces
26
+ - [ ] 4.4 Review implementation against the execution contract
@@ -0,0 +1,15 @@
1
+ # refactor-auth-boundary Example
2
+
3
+ This example demonstrates how `team-flow` handles a brownfield backend refactor instead of a net-new UI feature.
4
+
5
+ The scenario is a codebase where authentication checks have drifted across controllers, services, and helpers.
6
+
7
+ Included artifacts:
8
+
9
+ - `proposal.md`
10
+ - `specs/auth-boundary/spec.md`
11
+ - `design.md`
12
+ - `tasks.md`
13
+ - `execution-contract.md`
14
+
15
+ Read these files in order to see how a scattered auth implementation is converted into a stable execution contract without silently expanding scope into a full auth redesign.
@@ -0,0 +1,41 @@
1
+ # Technical Design
2
+
3
+ ## Overview
4
+
5
+ Refactor request authentication behind one explicit boundary so protected routes stop making ad hoc auth decisions.
6
+
7
+ The design focuses on consolidation, not capability expansion.
8
+
9
+ ## Architecture
10
+
11
+ - Introduce an `AuthBoundary` interface or equivalent module responsible for request-level authentication decisions.
12
+ - Return a stable `AuthDecision` or `AuthenticatedRequestContext` shape that downstream handlers can consume directly.
13
+ - Move token parsing, session lookup, and principal assembly behind this boundary.
14
+ - Keep login issuance flows and persistence mechanisms unchanged.
15
+
16
+ ## Data And Control Flow
17
+
18
+ 1. Protected request enters middleware or route guard.
19
+ 2. The guard delegates to `AuthBoundary`.
20
+ 3. The boundary validates credentials and builds the request auth result.
21
+ 4. Success attaches the shared auth context for downstream use.
22
+ 5. Failure maps to standardized unauthorized or forbidden handling.
23
+
24
+ ## Constraints
25
+
26
+ - Preserve externally visible login behavior.
27
+ - Avoid changing the current identity provider or session store.
28
+ - Keep the boundary thin enough to adapt existing helpers instead of forcing a total rewrite.
29
+ - Migrate incrementally so regressions are isolated by route group or middleware layer.
30
+
31
+ ## Trade-Offs
32
+
33
+ - A thin adapter-based boundary is safer for brownfield code than a full auth subsystem rewrite.
34
+ - Centralization may reveal legacy helper inconsistencies that need small compatibility shims.
35
+ - Short-term duplication may exist during migration, but the target state is one request auth entry point.
36
+
37
+ ## Testing Strategy
38
+
39
+ - Add failing tests that prove protected requests stop bypassing the shared boundary.
40
+ - Add failing tests for missing credentials, invalid tokens, and authenticated-but-forbidden outcomes.
41
+ - Run regression tests for existing login and session issuance behavior to confirm no external contract drift.
@@ -0,0 +1,61 @@
1
+ # Execution Contract
2
+
3
+ ## Intent Lock
4
+
5
+ - Change name: `refactor-auth-boundary`
6
+ - Problem being solved: request authentication decisions are scattered and inconsistent, creating regression risk and making protected flows hard to evolve safely
7
+ - In scope: one shared request authentication boundary, standardized auth decisions, migration of protected request paths, consistent unauthorized and forbidden handling
8
+ - Out of scope: new identity providers, new login behavior, permission model redesign, session storage replacement
9
+
10
+ ## Approved Behavior
11
+
12
+ - Approved requirements summary: protected requests must pass through one shared authentication boundary, auth failures must map consistently, and externally approved login behavior must remain unchanged
13
+ - Key scenarios: valid protected request, missing credentials, invalid token, authenticated but forbidden requester, existing login flow remains stable
14
+ - Acceptance checks: migrated protected routes no longer perform ad hoc request auth parsing, unauthorized and forbidden outcomes are standardized, login regression checks still pass
15
+
16
+ ## Design Constraints
17
+
18
+ - Architecture constraints: centralize request auth decisions without rewriting the entire auth subsystem
19
+ - Interface constraints: downstream handlers should consume one stable auth context or decision shape
20
+ - Dependency constraints: keep current token validation and session lookup systems, adapting them behind the boundary
21
+ - Data constraints: preserve existing session and token semantics visible to clients
22
+
23
+ ## Task Batches
24
+
25
+ ### Batch 1
26
+
27
+ - Objective: establish failing tests and identify current request auth entry points
28
+ - Inputs: protected route inventory, current auth helpers, existing login flow behavior
29
+ - Outputs: failing auth-path tests and baseline regression coverage
30
+ - Done when: missing credentials, invalid token, forbidden path, and login regression checks are in place
31
+
32
+ ### Batch 2
33
+
34
+ - Objective: introduce the shared auth boundary and migrate the first protected route group
35
+ - Inputs: batch 1 tests, auth helper inventory, target route group
36
+ - Outputs: boundary module, standardized auth result shape, first migrated route group
37
+ - Done when: migrated routes use the new boundary and pass the relevant tests
38
+
39
+ ### Batch 3
40
+
41
+ - Objective: migrate remaining protected entry points and remove duplicate branching
42
+ - Inputs: established boundary, remaining protected handlers
43
+ - Outputs: consolidated request auth flow across protected routes
44
+ - Done when: duplicate request-level auth branching is removed and all relevant tests pass
45
+
46
+ ## Test Obligations
47
+
48
+ - Behavior that must start with failing tests: missing credentials rejection, invalid token rejection, forbidden access mapping, shared boundary usage on protected routes
49
+ - Required edge cases: no credentials, malformed token, expired or invalid token, authenticated user without required access
50
+ - Regression-sensitive areas: login flow, session continuity, middleware ordering, protected route error mapping
51
+
52
+ ## Review Gates
53
+
54
+ - Mandatory review points: after baseline tests are added, after the first route group migration, and before removing legacy auth branching
55
+ - Blocker categories: changed client-visible login behavior, inconsistent unauthorized or forbidden responses, hidden scope expansion into permission redesign
56
+
57
+ ## Escalation Rules
58
+
59
+ - Return to `specifying` when: preserving existing login behavior is no longer sufficient and externally visible auth behavior needs to change
60
+ - Return to `bridging` when: migration batching, boundary shape, or test obligations change materially
61
+ - Do not continue implementation if: protected routes still depend on incompatible auth result shapes that were not accounted for in the current plan
@@ -0,0 +1,47 @@
1
+ # Change Proposal
2
+
3
+ ## Why
4
+
5
+ Authentication decisions are currently spread across route handlers, service helpers, and ad hoc token parsing utilities.
6
+
7
+ This matters now because inconsistent auth enforcement is creating regression risk, makes tests hard to trust, and slows any work that touches protected endpoints.
8
+
9
+ ## What Changes
10
+
11
+ - Introduce a single authentication boundary for protected request evaluation.
12
+ - Move request-level auth checks behind a stable interface.
13
+ - Standardize unauthorized and forbidden decision handling.
14
+ - Preserve existing externally approved login and session behavior.
15
+
16
+ ## Capabilities
17
+
18
+ ### New Capabilities
19
+
20
+ - None
21
+
22
+ ### Modified Capabilities
23
+
24
+ - `auth-request-gating`
25
+
26
+ ## Scope
27
+
28
+ ### In Scope
29
+
30
+ - Request authentication boundary definition
31
+ - Centralized auth decision object or equivalent
32
+ - Shared token parsing and validation entry point
33
+ - Migration of protected request paths onto the new boundary
34
+ - Standardized unauthorized and forbidden response mapping
35
+
36
+ ### Out of Scope
37
+
38
+ - Changing identity provider integrations
39
+ - Replacing session storage
40
+ - Redesigning roles or permissions
41
+ - Adding single sign-on or multi-factor authentication
42
+
43
+ ## Impact
44
+
45
+ - Affected code areas: route middleware, auth helpers, protected controllers, service entry points
46
+ - Affected APIs or interfaces: request auth context, auth decision interface, protected route entry points
47
+ - Dependencies or systems touched: token verification utilities, session lookup logic, request middleware chain