@xulthekl/team-flow 0.22.4 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/.cursor-plugin/marketplace.json +1 -1
  6. package/.cursor-plugin/plugin.json +1 -1
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +3 -2
  9. package/CHANGELOG.md +103 -0
  10. package/GEMINI.md +1 -1
  11. package/HANDOFF.md +123 -98
  12. package/INSTALL.md +1 -1
  13. package/README.md +1 -1
  14. package/docs/README_en.md +1 -1
  15. package/docs/solutions/INDEX.md +5 -0
  16. package/docs/solutions/cross-phase/2026-07-28-no-summary.md +17 -0
  17. package/gemini-extension.json +1 -1
  18. package/hooks/pre-tool-use-guard +9 -9
  19. package/hooks/session-start +2 -2
  20. package/llms.txt +1 -1
  21. package/package.json +1 -1
  22. package/plugin.json +1 -1
  23. package/scripts/guard/checks/arch-design.mjs +79 -0
  24. package/scripts/guard/checks/compound-captured.mjs +70 -0
  25. package/scripts/guard/guard.mjs +6 -2
  26. package/scripts/lib/arch-merge.mjs +459 -0
  27. package/scripts/lib/cmd-state.mjs +5 -0
  28. package/scripts/lib/hash.mjs +18 -0
  29. package/scripts/lib/solutions-promote.mjs +1 -1
  30. package/scripts/lib/state-loader.mjs +16 -0
  31. package/scripts/team-flow.mjs +3 -0
  32. package/skills/architecture-design/SKILL.md +42 -3
  33. package/skills/architecture-design/templates/api.md +71 -0
  34. package/skills/architecture-design/templates/architecture.md +82 -0
  35. package/skills/architecture-design/templates/change-brief.md +29 -0
  36. package/skills/architecture-design/templates/database.md +69 -0
  37. package/skills/architecture-design/templates/index.md +33 -0
  38. package/skills/architecture-design/templates/physical-model.md +93 -0
  39. package/skills/bug-investigator/SKILL.md +1 -1
  40. package/skills/build-executor/SKILL.md +23 -19
  41. package/skills/build-executor/implementer-prompt.md +1 -1
  42. package/skills/build-executor/references/execution-modes.md +6 -6
  43. package/skills/build-executor/task-reviewer-prompt.md +1 -1
  44. package/skills/ce-brainstorm/SKILL.md +6 -0
  45. package/skills/code-reviewer/SKILL.md +6 -2
  46. package/skills/code-reviewer/code-reviewer-prompt.md +1 -1
  47. package/skills/contract-builder/SKILL.md +6 -6
  48. package/skills/need-explorer/SKILL.md +2 -2
  49. package/skills/release-archivist/SKILL.md +25 -12
  50. package/skills/release-archivist/references/closing-procedures.md +8 -8
  51. package/skills/spec-merger/SKILL.md +2 -2
  52. package/skills/spec-writer/SKILL.md +11 -9
  53. package/skills/workflow-bootstrap/SKILL.md +39 -5
  54. package/skills/workflow-bootstrap/references/b1-reconnaissance.md +22 -1
  55. package/skills/workflow-bootstrap/scripts/recon-probe.sh +122 -1
  56. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +1 -1
  57. package/skills/workflow-orchestrator/references/s4-split-validate.md +1 -1
  58. package/skills/workflow-orchestrator/references/s5-monitoring.md +1 -1
  59. package/skills/workflow-start/SKILL.md +44 -16
  60. package/skills/workflow-start/references/routing-rules.md +17 -17
  61. package/templates/api.md +177 -0
  62. package/templates/architecture.md +122 -0
  63. package/templates/change-brief.md +24 -0
  64. package/templates/database.md +114 -0
  65. package/tests/lib/guard-compound-captured.test.mjs +92 -0
  66. package/tests/lib/guard-specs-merged.test.mjs +2 -0
  67. package/tests/lib/guard-tests-passing.test.mjs +2 -0
  68. package/tests/lib/guard.test.mjs +2 -0
  69. package/tests/lib/solutions-capture.test.mjs +108 -0
  70. package/tests/lib/solutions-index-gen.test.mjs +147 -0
  71. package/tests/lib/solutions-inject.test.mjs +115 -0
  72. package/tests/lib/solutions-promote.test.mjs +200 -0
@@ -15,14 +15,14 @@ Do NOT invoke for: general coding tasks outside team-flow changes, casual questi
15
15
 
16
16
  ## States
17
17
 
18
- `exploring` → `specifying` → `bridging` → `approved-for-build` → `executing` → `closing`, with `debugging` side-path from `executing`, and `abandoned` as terminal. If a transition is ambiguous, run `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime asset read docs/state-machine.md`.
18
+ `exploring` → `specifying` → `bridging` → `approved-for-build` → `executing` → `closing`, with `debugging` side-path from `executing`, and `abandoned` as terminal. If a transition is ambiguous, run `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime asset read docs/state-machine.md`.
19
19
 
20
20
  ## Initialization
21
21
 
22
- 1. **Update check**: Run `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime check-update`. Exit 0 → continue. Exit 1 → non-blocking upgrade reminder. Exit 2 → skip.
22
+ 1. **Update check**: Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime check-update`. Exit 0 → continue. Exit 1 → non-blocking upgrade reminder. Exit 2 → skip.
23
23
  2. **Inspect change folder**: Check for `proposal.md`, `specs/`, `design.md`, `tasks.md`, `execution-contract.md`. Answer: Is the change fuzzy? Artifacts missing/unstable? Contract exist? User approved contract? Execution in progress or blocked? In verification/wrap-up?
24
- 3. **Overlay recovery scan**: Run `npx --yes --package @xulthekl/team-flow@0.22.4 tf handoff list <change-dir> --json` and `npx --yes --package @xulthekl/team-flow@0.22.4 tf checkpoint list <change-dir> --json`. A `result-ready` handoff requires explicit review and `npx --yes --package @xulthekl/team-flow@0.22.4 tf handoff resolve` before resuming the affected work. An `active` handoff is non-blocking side work. Show a non-stale checkpoint as recovery context; show a stale checkpoint only as historical evidence.
25
- 4. **Execution-control recovery scan**: For `approved-for-build`, `executing`, `debugging`, or `closing`, run `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution show <change-dir> --json`. Treat only `current: true` plus `waves[].eligible: true` as permission to start a wave; report plan revision, mode, next eligible wave, and every wave's receipt/blockers. A missing, invalid, or stale plan blocks implementation and routes to `build-executor`; do not infer progress from chat history.
24
+ 3. **Overlay recovery scan**: Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf handoff list <change-dir> --json` and `npx --yes --package @xulthekl/team-flow@0.24.0 tf checkpoint list <change-dir> --json`. A `result-ready` handoff requires explicit review and `npx --yes --package @xulthekl/team-flow@0.24.0 tf handoff resolve` before resuming the affected work. An `active` handoff is non-blocking side work. Show a non-stale checkpoint as recovery context; show a stale checkpoint only as historical evidence.
25
+ 4. **Execution-control recovery scan**: For `approved-for-build`, `executing`, `debugging`, or `closing`, run `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution show <change-dir> --json`. Treat only `current: true` plus `waves[].eligible: true` as permission to start a wave; report plan revision, mode, next eligible wave, and every wave's receipt/blockers. A missing, invalid, or stale plan blocks implementation and routes to `build-executor`; do not infer progress from chat history.
26
26
 
27
27
  ## DP-0: User Confirmation Gate
28
28
 
@@ -36,17 +36,17 @@ Ask (manual path): change name + one-sentence intent, known constraints, related
36
36
 
37
37
  After confirmation:
38
38
  ```bash
39
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_decisions "<summary>"
40
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_result confirmed
41
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_confirmed true
42
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
39
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_decisions "<summary>"
40
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_result confirmed
41
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_confirmed true
42
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
43
43
  ```
44
44
 
45
45
  Config-aware routing: check `artifacts.order` and `artifacts.skip` from project config.
46
46
 
47
47
  ## Mode Detection
48
48
 
49
- If workflow is `auto`/`null`/unset: run `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime infer <change-dir>`. Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **tweak** (≤4 tasks, config/doc only), **full** (anything larger). Persist with `npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <dir> workflow <mode>`.
49
+ If workflow is `auto`/`null`/unset: run `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime infer <change-dir>`. Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **tweak** (≤4 tasks, config/doc only), **full** (anything larger). Persist with `npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <dir> workflow <mode>`.
50
50
 
51
51
  Validate mode against artifact content. If hotfix/tweak criteria not met → upgrade to `full` and output reason. Don't overwrite explicit mode unless user asks.
52
52
 
@@ -59,19 +59,19 @@ Change is fuzzy, scope unclear, comparing options, no stable change name.
59
59
  Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before spec-writer. Dispatch `architecture-design` as sub-agent; after return, run reasonableness check and write yaml. Full protocol in `references/routing-rules.md`「Route to architecture-design」.
60
60
 
61
61
  ### Route to spec-writer
62
- Guard: `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK. **arch_design_decision must not be null** → fail = BLOCK (v0.9 §26). User knows what they want, artifacts missing/incomplete.
62
+ Guard: `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK. **arch_design_decision must not be null** → fail = BLOCK (v0.9 §26). User knows what they want, artifacts missing/incomplete.
63
63
 
64
64
  ### Route to contract-builder
65
65
  Guard: `... check <dir> specifying bridging --json` → fail = BLOCK. Artifacts exist, implementation requested, contract missing/stale. Include `DP-3: 契约批准`.
66
66
 
67
67
  ### Route to build-executor
68
- Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution recommend <change-dir> [--wave ...]`, show the user every available mode plus evidence and the recommendation, then obtain a clear selection. The command saves a current receipt; before the first implementation edit, `build-executor` must run `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan <change-dir> --mode <selected> --confirm ...` (and `--acknowledge-recommendation` when the selected mode differs from the recommendation) using matching artifacts, contract, and waves, then `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution show <change-dir> --json`; report the saved revision, selected mode, recommendation alignment, ordered waves, and actual concurrent-dispatch capability. A revision must repeat recommend and confirmation. Do not transition to `executing` until `show` reports `current: true`; then run `... check <dir> approved-for-build executing --json` → fail = BLOCK.
68
+ Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution recommend <change-dir> [--wave ...]`, show the user every available mode plus evidence and the recommendation, then obtain a clear selection. The command saves a current receipt; before the first implementation edit, `build-executor` must run `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution plan <change-dir> --mode <selected> --confirm ...` (and `--acknowledge-recommendation` when the selected mode differs from the recommendation) using matching artifacts, contract, and waves, then `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution show <change-dir> --json`; report the saved revision, selected mode, recommendation alignment, ordered waves, and actual concurrent-dispatch capability. A revision must repeat recommend and confirmation. Do not transition to `executing` until `show` reports `current: true`; then run `... check <dir> approved-for-build executing --json` → fail = BLOCK.
69
69
 
70
70
  ### Route to bug-investigator
71
71
  Execution hit blockage: test failure, unexpected behavior, build error, task cannot proceed. After debugging, route back to build-executor.
72
72
 
73
73
  ### Route to code-reviewer
74
- The current planned wave is implemented and ready for spec-compliance + code-quality verification. A reviewer must write an `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>` receipt before any dependent wave or closing transition.
74
+ The current planned wave is implemented and ready for spec-compliance + code-quality verification. A reviewer must write an `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>` receipt before any dependent wave or closing transition.
75
75
 
76
76
  ### Route to release-archivist
77
77
  Guard: `... check <dir> executing closing --json` → fail = BLOCK. Implementation complete, verification complete/nearly complete. Include `DP-7: 归档确认`.
@@ -90,10 +90,10 @@ uncertainty. Do not create a prototype handoff or enter a prototype worktree
90
90
  until the user confirms. After confirmation:
91
91
 
92
92
  ```bash
93
- npx --yes --package @xulthekl/team-flow@0.22.4 tf handoff create <change-dir> \
93
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf handoff create <change-dir> \
94
94
  --type prototype --objective "<confirmed objective>" \
95
95
  --expected-output "<expected evidence>" --acceptance "<completion criterion>"
96
- npx --yes --package @xulthekl/team-flow@0.22.4 tf isolate <change-dir> prototype-<handoff-id>
96
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf isolate <change-dir> prototype-<handoff-id>
97
97
  ```
98
98
 
99
99
  Never suggest or enter this route automatically for backend, CLI, configuration,
@@ -101,10 +101,13 @@ or internal-refactor work. Never pass `--force` to `tf isolate` for prototype
101
101
  work.
102
102
 
103
103
  ### Fast-Path Routing
104
+
105
+ **DP-0 处理**(v0.22.5 F03 修复):hotfix/tweak 路径隐式跳过 DP-0(`dp_0_confirmed` 保持 `null`),因为意图已明确(修复/微调),无需从零探索。contract-builder 的 DP-3 审批成为唯一门禁。
106
+
104
107
  - **Hotfix**: Route to contract-builder (minimal), skip need-explorer + spec-writer, guard check `exploring bridging --workflow hotfix`, then `bridging -> approved-for-build`, after DP-3 → build-executor (recommend, show, and confirm an execution mode), after → release-archivist (lightweight). Hotfix may skip `proposal.md`, `design.md`, `tasks.md`, and `specs/`, but it still requires a fresh minimal `execution-contract.md`, DP-3 approval, and a current execution plan before build. **architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门,快速判定是否涉及架构变更(hotfix 可能正是架构缺陷导致)
105
108
  - **Tweak**: Route to build-executor (direct edit), skip need-explorer + spec-writer + contract-builder, guard check `exploring approved-for-build --workflow tweak`, after → release-archivist (lightweight). **architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门
106
109
 
107
- Post-transition: 💡 `npx --yes --package @xulthekl/team-flow@0.22.4 tf inject <change-dir>` to update phase-guard artifacts.
110
+ Post-transition: 💡 `npx --yes --package @xulthekl/team-flow@0.24.0 tf inject <change-dir>` to update phase-guard artifacts.
108
111
 
109
112
  ## Staleness Detection
110
113
 
@@ -121,7 +124,7 @@ Use content inspection, not timestamps.
121
124
  ## Guardrails
122
125
 
123
126
  - No implementation before planning artifacts or contract exist
124
- - No implementation for full/hotfix without a current `npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan`; no state transition based on an unverified DP-4 string
127
+ - No implementation for full/hotfix without a current `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution plan`; no state transition based on an unverified DP-4 string
125
128
  - No "continue" without state inspection
126
129
  - No implementation past stale contract
127
130
  - No implementation past bug without investigation
@@ -133,6 +136,31 @@ Use content inspection, not timestamps.
133
136
  - No merging delta specs from abandoned change
134
137
  - **No routing to spec-writer without architecture-design gate pass** (v0.9 §26): `arch_design_decision` must be `required` or `skipped` (not `null`). hotfix/tweak 不豁免
135
138
 
139
+ ## State Writes (v0.22.5 F06 修复)
140
+
141
+ workflow-start 负责写入以下字段到 `.team-flow.yaml`:
142
+
143
+ **核心状态字段**:
144
+ - `state`:当前状态(exploring/specifying/bridging/approved-for-build/executing/debugging/closing/abandoned)
145
+ - `workflow`:工作流类型(auto/full/hotfix/tweak)
146
+
147
+ **决策点字段**(各阶段确认后写入):
148
+ - `dp_0_*`:need-explorer 完成后的需求澄清决策
149
+ - `dp_1_*`:spec-writer 完成后的规格决策
150
+ - `dp_2_*`:contract-builder 完成后的契约决策
151
+ - `dp_3_*`:build-executor 完成后的执行决策
152
+ - `dp_5_*`:code-reviewer 完成后的审查决策
153
+ - `dp_6_*`:release-archivist 完成后的发布决策
154
+ - `dp_7_*`:其他决策点
155
+
156
+ **架构设计门控字段**(v0.9 §26,v0.22.5 F02 修复):
157
+ - `arch_design_decision`:`required` | `skipped`(architecture-design 子代理返回,workflow-start 经 reasonableness check 后写入)
158
+ - `arch_design_reason`:判断理由
159
+ - `arch_design_timestamp`:ISO 8601 时间戳(UTC)
160
+ - `arch_design_artifacts`:产出路径列表(required 时必填,skipped 时为空)
161
+
162
+ **职责边界**:architecture-design 负责判断+产出,workflow-start 负责 reasonableness check + 状态写入。详细写入命令见 `references/routing-rules.md`「Route to architecture-design」。
163
+
136
164
  ## Output Standard
137
165
 
138
166
  Always state: (1) current detected state, (2) why (cite file/content/condition), (3) which skill should run next. If blocking, explain missing artifact/approval.
@@ -32,17 +32,17 @@ artifacts: # required 时必填
32
32
  - `null`(未判定)→ **BLOCK**
33
33
 
34
34
  ```bash
35
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> arch_design_decision "<required|skipped>"
36
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> arch_design_reason "<reason>"
37
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> arch_design_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
35
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> arch_design_decision "<required|skipped>"
36
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> arch_design_reason "<reason>"
37
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> arch_design_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
38
38
  # if required:
39
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> arch_design_artifacts "architecture/architecture.md,architecture/database.md,architecture/api.md"
39
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> arch_design_artifacts "architecture/architecture.md,architecture/database.md,architecture/api.md"
40
40
  ```
41
41
 
42
42
  **hotfix / tweak 不豁免**:同样过 architecture-design 子代理判断门。
43
43
 
44
44
  ## Route to spec-writer
45
- Guard: `npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK.
45
+ Guard: `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK.
46
46
  **arch_design_decision must not be null** → fail = BLOCK(architecture-design gate not passed,v0.9 §26)。
47
47
  User knows what they want, artifacts missing/incomplete.
48
48
 
@@ -55,12 +55,12 @@ Contract exists and approved, contract matches artifacts. Include DP-4: 执行
55
55
 
56
56
  Propose waves, run:
57
57
  ```bash
58
- npx --yes --package @xulthekl/team-flow@0.22.4 tf execution recommend <change-dir> [--wave ...]
58
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution recommend <change-dir> [--wave ...]
59
59
  ```
60
60
  Show every available mode plus evidence and recommendation, obtain clear selection. Then:
61
61
  ```bash
62
- npx --yes --package @xulthekl/team-flow@0.22.4 tf execution plan <change-dir> --mode <selected> --confirm ...
63
- npx --yes --package @xulthekl/team-flow@0.22.4 tf execution show <change-dir> --json
62
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution plan <change-dir> --mode <selected> --confirm ...
63
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution show <change-dir> --json
64
64
  ```
65
65
  Do not transition to `executing` until `show` reports `current: true`.
66
66
  Guard: `... check <dir> approved-for-build executing --json` → fail = BLOCK.
@@ -71,7 +71,7 @@ Execution hit blockage: test failure, unexpected behavior, build error. After de
71
71
  ## Route to code-reviewer
72
72
  Current planned wave implemented and ready for review. Reviewer must write:
73
73
  ```bash
74
- npx --yes --package @xulthekl/team-flow@0.22.4 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>
74
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>
75
75
  ```
76
76
 
77
77
  ## Route to release-archivist
@@ -93,10 +93,10 @@ User explicitly requests, bug-investigator escalates after 3+ failures AND user
93
93
 
94
94
  When the user's brief explicitly contains UI/screen/interaction/layout/UX uncertainty, ask once whether a prototype would reduce uncertainty. After confirmation:
95
95
  ```bash
96
- npx --yes --package @xulthekl/team-flow@0.22.4 tf handoff create <change-dir> \
96
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf handoff create <change-dir> \
97
97
  --type prototype --objective "<confirmed objective>" \
98
98
  --expected-output "<expected evidence>" --acceptance "<completion criterion>"
99
- npx --yes --package @xulthekl/team-flow@0.22.4 tf isolate <change-dir> prototype-<handoff-id>
99
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf isolate <change-dir> prototype-<handoff-id>
100
100
  ```
101
101
  Never suggest for backend/CLI/config/internal-refactor work. Never pass `--force`.
102
102
 
@@ -130,17 +130,17 @@ else:
130
130
 
131
131
  After confirmation:
132
132
  ```bash
133
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_decisions "<summary>"
134
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_result confirmed
135
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_confirmed true
136
- npx --yes --package @xulthekl/team-flow@0.22.4 tf state set <change-dir> dp_0_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
133
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_decisions "<summary>"
134
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_result confirmed
135
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_confirmed true
136
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_0_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
137
137
  ```
138
138
 
139
139
  ## Mode Detection
140
140
 
141
141
  If workflow is `auto`/`null`/unset:
142
142
  ```bash
143
- npx --yes --package @xulthekl/team-flow@0.22.4 tf runtime infer <change-dir>
143
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime infer <change-dir>
144
144
  ```
145
145
  Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **tweak** (≤4 tasks, config/doc only), **full** (anything larger).
146
146
 
@@ -152,4 +152,4 @@ Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **twe
152
152
  - **Brief drift (advisory, v0.9)**: change-brief.md 的 `plan_hash` 与当前 plan.md 不一致 → 提示回 orchestrator 重新分发;**不**阻断、**不**进 artifacts_hash、**不**混入上述三条产物互查
153
153
 
154
154
  ## Post-transition
155
- 💡 `npx --yes --package @xulthekl/team-flow@0.22.4 tf inject <change-dir>` to update phase-guard artifacts.
155
+ 💡 `npx --yes --package @xulthekl/team-flow@0.24.0 tf inject <change-dir>` to update phase-guard artifacts.
@@ -0,0 +1,177 @@
1
+ # API Design (Command/Read/Query 增量)
2
+
3
+ > **变更 ID**: <change-id>
4
+ > **基线版本**: <commit-hash>
5
+ > **设计日期**: YYYY-MM-DD
6
+
7
+ ## 1. As-Is 基线(冻结复制)
8
+
9
+ > 从全局 `docs/architecture/API-INDEX.md`(若有)复制当前状态,标注版本锚点。
10
+
11
+ ### 1.1 现有 Command API
12
+ <列出本 change 涉及的现有 Command API,若无则写"无">
13
+
14
+ ### 1.2 现有 Read API
15
+ <列出本 change 涉及的现有 Read API,若无则写"无">
16
+
17
+ ### 1.3 现有 Query API
18
+ <列出本 change 涉及的现有 Query API,若无则写"无">
19
+
20
+ ---
21
+
22
+ ## 2. To-Be 增量设计
23
+
24
+ ### 2.1 Command API(写操作)
25
+
26
+ > **五项检查 #4**: 是否涉及 API 新增/变更(端点、方法签名、请求响应 schema)?
27
+
28
+ #### 新增 Command
29
+ | 端点 | 方法 | 所属聚合 | 事务边界 | 说明 |
30
+ |------|------|---------|---------|------|
31
+ | `<endpoint>` | `POST` / `PUT` / `DELETE` | `<Aggregate>` | `<boundary>` | `<description>` |
32
+
33
+ #### 修改 Command
34
+ <列出修改的 Command 及变更内容,若无则写"无">
35
+
36
+ #### 删除 Command
37
+ <列出删除的 Command,若无则写"无">
38
+
39
+ ### 2.2 Read API(读操作)
40
+
41
+ #### 新增 Read
42
+ | 端点 | 方法 | 所属聚合 | 数据来源 | 说明 |
43
+ |------|------|---------|---------|------|
44
+ | `<endpoint>` | `GET` | `<Aggregate>` | `<source>` | `<description>` |
45
+
46
+ #### 修改 Read
47
+ <列出修改的 Read 及变更内容,若无则写"无">
48
+
49
+ #### 删除 Read
50
+ <列出删除的 Read,若无则写"无">
51
+
52
+ ### 2.3 Query API(查询操作)
53
+
54
+ > **阻断测试分流**: Query API 经阻断测试判断是否属于数据服务
55
+
56
+ #### 新增 Query
57
+ | 端点 | 方法 | 查询模型 | 阻断测试结果 | 说明 |
58
+ |------|------|---------|--------------|------|
59
+ | `<endpoint>` | `GET` / `POST` | `<QueryModel>` | `业务服务` / `数据服务` | `<description>` |
60
+
61
+ #### 修改 Query
62
+ <列出修改的 Query 及变更内容,若无则写"无">
63
+
64
+ #### 删除 Query
65
+ <列出删除的 Query,若无则写"无">
66
+
67
+ ---
68
+
69
+ ## 3. 端点详细设计
70
+
71
+ ### 3.1 Command API 详细设计
72
+
73
+ #### `<METHOD> <endpoint>`
74
+ **说明**: `<description>`
75
+
76
+ **请求 Schema**:
77
+ ```json
78
+ {
79
+ "field1": "<type>",
80
+ "field2": "<type>"
81
+ }
82
+ ```
83
+
84
+ **响应 Schema**:
85
+ ```json
86
+ {
87
+ "success": true,
88
+ "data": {
89
+ "id": "<type>"
90
+ }
91
+ }
92
+ ```
93
+
94
+ **错误码**:
95
+ | 错误码 | 说明 | 处理方式 |
96
+ |--------|------|---------|
97
+ | `<code>` | `<description>` | `<handling>` |
98
+
99
+ ### 3.2 Read API 详细设计
100
+
101
+ #### `GET <endpoint>`
102
+ **说明**: `<description>`
103
+
104
+ **查询参数**:
105
+ | 参数名 | 类型 | 必填 | 说明 |
106
+ |--------|------|------|------|
107
+ | `<param>` | `<type>` | `是` / `否` | `<description>` |
108
+
109
+ **响应 Schema**:
110
+ ```json
111
+ {
112
+ "items": [
113
+ {
114
+ "id": "<type>",
115
+ "field": "<type>"
116
+ }
117
+ ],
118
+ "total": "<int>"
119
+ }
120
+ ```
121
+
122
+ ### 3.3 Query API 详细设计
123
+
124
+ #### `<METHOD> <endpoint>`
125
+ **说明**: `<description>`
126
+
127
+ **请求 Schema**:
128
+ ```json
129
+ {
130
+ "filters": {
131
+ "field1": "<type>"
132
+ },
133
+ "pagination": {
134
+ "page": "<int>",
135
+ "pageSize": "<int>"
136
+ }
137
+ }
138
+ ```
139
+
140
+ **响应 Schema**:
141
+ ```json
142
+ {
143
+ "items": [
144
+ {
145
+ "id": "<type>",
146
+ "field": "<type>"
147
+ }
148
+ ],
149
+ "total": "<int>",
150
+ "page": "<int>",
151
+ "pageSize": "<int>"
152
+ }
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 4. 跨域一致性检查
158
+
159
+ > **F2 · 跨域一致性**
160
+
161
+ ### 4.1 API ↔ 数据实体对齐
162
+ | API 端点 | 支撑的数据实体 | 一致性 |
163
+ |---------|---------------|--------|
164
+ | `<endpoint>` | `<entity>` | ✅ / ❌ |
165
+
166
+ ### 4.2 术语命名统一性
167
+ | 术语 | 定义位置 | 命名统一性 |
168
+ |------|---------|-----------|
169
+ | `<term>` | `<location>` | ✅ / ❌ |
170
+
171
+ ---
172
+
173
+ ## 5. 演进日志
174
+
175
+ | 日期 | 变更 ID | 变更内容 | 影响范围 |
176
+ |------|---------|---------|---------|
177
+ | YYYY-MM-DD | `<change-id>` | `<summary>` | `<scope>` |
@@ -0,0 +1,122 @@
1
+ # Architecture Design (4A + DDD 增量)
2
+
3
+ > **变更 ID**: <change-id>
4
+ > **基线版本**: <commit-hash>
5
+ > **设计日期**: YYYY-MM-DD
6
+
7
+ ## 1. As-Is 基线(冻结复制)
8
+
9
+ > 从全局 `docs/architecture/ARCHITECTURE.md` 复制当前状态,标注版本锚点。
10
+
11
+ ### 1.1 现有聚合
12
+ <列出本 change 涉及的现有聚合,若无则写"无">
13
+
14
+ ### 1.2 现有限界上下文
15
+ <列出本 change 涉及的现有限界上下文,若无则写"无">
16
+
17
+ ### 1.3 现有 Context Map
18
+ <列出本 change 涉及的现有上下文映射关系,若无则写"无">
19
+
20
+ ---
21
+
22
+ ## 2. To-Be 增量设计(DDD)
23
+
24
+ ### 2.1 聚合变更
25
+
26
+ > **五项检查 #1**: 是否新增/修改聚合或聚合根?
27
+
28
+ #### 新增聚合
29
+ | 聚合名称 | 聚合根 | 实体/值对象 | 事务边界 | 所属限界上下文 |
30
+ |---------|--------|------------|---------|---------------|
31
+ | `<Aggregate>` | `<Root>` | `<Entity1>`, `<VO1>` | `<boundary>` | `<BC>` |
32
+
33
+ #### 修改聚合
34
+ <列出修改的聚合及变更内容,若无则写"无">
35
+
36
+ #### 删除聚合
37
+ <列出删除的聚合,若无则写"无">
38
+
39
+ ### 2.2 限界上下文变更
40
+
41
+ > **五项检查 #2**: 是否涉及限界上下文边界变化或新增上下文映射关系?
42
+
43
+ #### 新增限界上下文
44
+ | 上下文名称 | 职责描述 | 包含聚合 | 语言类型 |
45
+ |-----------|---------|---------|---------|
46
+ | `<BC>` | `<responsibility>` | `<aggregates>` | `<ubiquitous language>` |
47
+
48
+ #### 修改限界上下文
49
+ <列出修改的限界上下文及变更内容,若无则写"无">
50
+
51
+ #### 删除限界上下文
52
+ <列出删除的限界上下文,若无则写"无">
53
+
54
+ ### 2.3 Context Map 变更
55
+
56
+ > **五项检查 #2(续)**: 新增上下文映射关系
57
+
58
+ #### 新增映射
59
+ | 上游上下文 | 下游上下文 | 映射类型 | 说明 |
60
+ |-----------|-----------|---------|------|
61
+ | `<upstream>` | `<downstream>` | `Shared Kernel` / `ACL` / `OHS` | `<description>` |
62
+
63
+ #### 修改映射
64
+ <列出修改的映射关系,若无则写"无">
65
+
66
+ #### 删除映射
67
+ <列出删除的映射关系,若无则写"无">
68
+
69
+ ### 2.4 CQRS 写/读模型变更
70
+
71
+ > **五项检查 #3**: 是否涉及 CQRS 写模型或读模型变化?
72
+
73
+ #### 写模型变更(事务型对象)
74
+ | 聚合 | 操作类型 | 命令/查询 | 事务边界 |
75
+ |------|---------|----------|---------|
76
+ | `<Aggregate>` | `Command` / `Read` | `<operation>` | `<boundary>` |
77
+
78
+ #### 读模型变更(分析型对象)
79
+ | 查询模型 | 数据来源 | 派生逻辑 | 用途 |
80
+ |---------|---------|---------|------|
81
+ | `<QueryModel>` | `<source>` | `<derivation>` | `<usage>` |
82
+
83
+ ---
84
+
85
+ ## 3. 变更分叉级联分析
86
+
87
+ > **F3 · 变更分叉级联(三层次必覆盖)**
88
+
89
+ ### 3.1 直接依赖
90
+ <BA→AA/IA 同变:列出直接依赖的架构变更>
91
+
92
+ ### 3.2 间接依赖
93
+ <AA/IA→TA、IA↔AA 对齐调整:列出间接依赖>
94
+
95
+ ### 3.3 隐式依赖
96
+ <表面无关却牵动的变更:列出隐式依赖>
97
+
98
+ ---
99
+
100
+ ## 4. 跨域一致性检查(双对齐,质量门禁)
101
+
102
+ > **F2 · 跨域一致性**
103
+
104
+ ### 4.1 结构一致性检查
105
+ | AA 功能 | 支撑的 IA 数据实体 | 一致性 |
106
+ |---------|-------------------|--------|
107
+ | `<function>` | `<entity>` | ✅ / ❌ |
108
+
109
+ ### 4.2 语义一致性检查
110
+ | 术语 | 定义位置 | 命名统一性 |
111
+ |------|---------|-----------|
112
+ | `<term>` | `<location>` | ✅ / ❌ |
113
+
114
+ ---
115
+
116
+ ## 5. 演进日志
117
+
118
+ > **F8 · 增量设计 + 复利回写闭环**
119
+
120
+ | 日期 | 变更 ID | 变更内容 | 影响范围 |
121
+ |------|---------|---------|---------|
122
+ | YYYY-MM-DD | `<change-id>` | `<summary>` | `<scope>` |
@@ -0,0 +1,24 @@
1
+ ---
2
+ upstream_source: orchestrator # orchestrator | manual | null
3
+ upstream_req_id: <req-id> # 对应 .team-flow/requirements/<req-id>/
4
+ upstream_plan_ref: prd/vN/plan.md # hotfix/快速通道为 null
5
+ upstream_change_id: C2 # 对应 change_dag.id
6
+ plan_hash: sha256:<plan.md 内容摘要> # 检测产品层改动后变更层未同步
7
+ ---
8
+ # Change Brief: <change-name>
9
+
10
+ ## Scope
11
+ <用户故事/功能模块级 scope 描述,与 plan.md 该 change 的 Scope 一致>
12
+
13
+ ## 约束
14
+ <来自 plan.md 的全局约束 / 该 change 的已知约束>
15
+
16
+ ## AC 列表
17
+ <取自 auditor 报告 Dim1 覆盖矩阵中映射到本 change 的 AC,逐条列出>
18
+
19
+ ## 全局技术方向
20
+ <取自 plan.md 高阶技术设计段的要点指针:模块边界/技术选型/数据流方向,供 spec-writer 作 design.md 约束>
21
+
22
+ ## PRD & plan 引用
23
+ - PRD: prd/vN/prd.md §<相关章节>
24
+ - Plan: prd/vN/plan.md ### <C-ID>
@@ -0,0 +1,114 @@
1
+ # Database Design (CQRS 增量)
2
+
3
+ > **变更 ID**: <change-id>
4
+ > **基线版本**: <commit-hash>
5
+ > **设计日期**: YYYY-MM-DD
6
+
7
+ ## 1. As-Is 基线(冻结复制)
8
+
9
+ > 从全局 `docs/architecture/DATABASE.md` 复制当前状态,标注版本锚点。
10
+
11
+ ### 1.1 现有写模型
12
+ <列出本 change 涉及的现有写模型(聚合对应的事务型表),若无则写"无">
13
+
14
+ ### 1.2 现有读模型
15
+ <列出本 change 涉及的现有读模型(查询模型对应的表/视图),若无则写"无">
16
+
17
+ ---
18
+
19
+ ## 2. To-Be 增量设计
20
+
21
+ ### 2.1 写模型变更(事务型对象)
22
+
23
+ > **五项检查 #5**: 是否涉及数据库表结构、字段、索引变更?
24
+
25
+ #### 新增表
26
+ | 表名 | 所属聚合 | 主键类型 | 事务边界 | 说明 |
27
+ |------|---------|---------|---------|------|
28
+ | `<table>` | `<Aggregate>` | `<pk-type>` | `<boundary>` | `<description>` |
29
+
30
+ #### 修改表
31
+ | 表名 | 变更类型 | 变更内容 |
32
+ |------|---------|---------|
33
+ | `<table>` | `ADD COLUMN` / `MODIFY COLUMN` / `DROP COLUMN` / `ADD INDEX` | `<details>` |
34
+
35
+ #### 删除表
36
+ <列出删除的表,若无则写"无">
37
+
38
+ ### 2.2 读模型变更(分析型对象)
39
+
40
+ #### 新增查询模型
41
+ | 查询模型 | 数据来源 | 派生逻辑 | 用途 |
42
+ |---------|---------|---------|------|
43
+ | `<QueryModel>` | `<source tables>` | `<derivation>` | `<usage>` |
44
+
45
+ #### 修改查询模型
46
+ <列出修改的查询模型及变更内容,若无则写"无">
47
+
48
+ #### 删除查询模型
49
+ <列出删除的查询模型,若无则写"无">
50
+
51
+ ---
52
+
53
+ ## 3. Schema 变更详情
54
+
55
+ ### 3.1 新增表 DDL
56
+ ```sql
57
+ CREATE TABLE <table_name> (
58
+ id BIGINT PRIMARY KEY,
59
+ -- 字段定义
60
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
61
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
62
+ );
63
+ ```
64
+
65
+ ### 3.2 修改表 DDL
66
+ ```sql
67
+ ALTER TABLE <table_name> ADD COLUMN <column> <type>;
68
+ ALTER TABLE <table_name> ADD INDEX idx_<name> (<columns>);
69
+ ```
70
+
71
+ ### 3.3 索引变更
72
+ | 表名 | 索引名 | 索引类型 | 字段 | 说明 |
73
+ |------|--------|---------|------|------|
74
+ | `<table>` | `idx_<name>` | `PRIMARY` / `UNIQUE` / `INDEX` | `<columns>` | `<description>` |
75
+
76
+ ---
77
+
78
+ ## 4. 实体关系变更
79
+
80
+ ### 4.1 新增实体
81
+ | 实体名称 | 所属聚合 | 实体类型 | 唯一标识 | 说明 |
82
+ |---------|---------|---------|---------|------|
83
+ | `<Entity>` | `<Aggregate>` | `实体` / `值对象` | `<identifier>` | `<description>` |
84
+
85
+ ### 4.2 修改实体
86
+ <列出修改的实体及变更内容,若无则写"无">
87
+
88
+ ### 4.3 删除实体
89
+ <列出删除的实体,若无则写"无">
90
+
91
+ ---
92
+
93
+ ## 5. 数据迁移脚本
94
+
95
+ > 若涉及数据迁移,提供迁移脚本(幂等、可回滚)
96
+
97
+ ### 5.1 迁移脚本
98
+ ```sql
99
+ -- 迁移描述:<description>
100
+ -- 执行顺序:<order>
101
+ -- 回滚方式:<rollback>
102
+
103
+ BEGIN;
104
+ -- 迁移逻辑
105
+ COMMIT;
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 6. 演进日志
111
+
112
+ | 日期 | 变更 ID | 变更内容 | 影响范围 |
113
+ |------|---------|---------|---------|
114
+ | YYYY-MM-DD | `<change-id>` | `<summary>` | `<scope>` |