@xulthekl/team-flow 0.23.0 → 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 (54) 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/CHANGELOG.md +50 -0
  9. package/GEMINI.md +1 -1
  10. package/INSTALL.md +1 -1
  11. package/README.md +1 -1
  12. package/docs/README_en.md +1 -1
  13. package/docs/solutions/INDEX.md +5 -0
  14. package/docs/solutions/cross-phase/2026-07-28-no-summary.md +17 -0
  15. package/gemini-extension.json +1 -1
  16. package/hooks/pre-tool-use-guard +9 -9
  17. package/hooks/session-start +2 -2
  18. package/llms.txt +1 -1
  19. package/package.json +1 -1
  20. package/plugin.json +1 -1
  21. package/scripts/guard/checks/compound-captured.mjs +70 -0
  22. package/scripts/guard/guard.mjs +3 -1
  23. package/scripts/lib/cmd-state.mjs +2 -0
  24. package/scripts/lib/solutions-promote.mjs +1 -1
  25. package/scripts/lib/state-loader.mjs +5 -0
  26. package/skills/bug-investigator/SKILL.md +1 -1
  27. package/skills/build-executor/SKILL.md +19 -19
  28. package/skills/build-executor/implementer-prompt.md +1 -1
  29. package/skills/build-executor/references/execution-modes.md +6 -6
  30. package/skills/build-executor/task-reviewer-prompt.md +1 -1
  31. package/skills/code-reviewer/SKILL.md +2 -2
  32. package/skills/code-reviewer/code-reviewer-prompt.md +1 -1
  33. package/skills/contract-builder/SKILL.md +6 -6
  34. package/skills/need-explorer/SKILL.md +2 -2
  35. package/skills/release-archivist/SKILL.md +12 -12
  36. package/skills/release-archivist/references/closing-procedures.md +8 -8
  37. package/skills/spec-merger/SKILL.md +2 -2
  38. package/skills/spec-writer/SKILL.md +3 -3
  39. package/skills/workflow-bootstrap/SKILL.md +13 -2
  40. package/skills/workflow-bootstrap/references/b1-reconnaissance.md +13 -7
  41. package/skills/workflow-bootstrap/scripts/recon-probe.sh +122 -1
  42. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +1 -1
  43. package/skills/workflow-orchestrator/references/s4-split-validate.md +1 -1
  44. package/skills/workflow-orchestrator/references/s5-monitoring.md +1 -1
  45. package/skills/workflow-start/SKILL.md +16 -16
  46. package/skills/workflow-start/references/routing-rules.md +17 -17
  47. package/tests/lib/guard-compound-captured.test.mjs +92 -0
  48. package/tests/lib/guard-specs-merged.test.mjs +2 -0
  49. package/tests/lib/guard-tests-passing.test.mjs +2 -0
  50. package/tests/lib/guard.test.mjs +2 -0
  51. package/tests/lib/solutions-capture.test.mjs +108 -0
  52. package/tests/lib/solutions-index-gen.test.mjs +147 -0
  53. package/tests/lib/solutions-inject.test.mjs +115 -0
  54. package/tests/lib/solutions-promote.test.mjs +200 -0
@@ -7,14 +7,14 @@
7
7
  For `full`/`hotfix`, generate proposed waves from the approved contract, then use the recommendation as a decision aid:
8
8
 
9
9
  ```bash
10
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution recommend <change-dir> \
10
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution recommend <change-dir> \
11
11
  --wave <wave-id>:<parallel|serial>:<task,...>[:<depends-on,...>] --json
12
12
  # Show every available mode, the observed facts, and the recommendation to the user.
13
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution plan <change-dir> \
13
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution plan <change-dir> \
14
14
  --mode <selected-mode> --confirm --reason "user-selected execution mode" \
15
15
  --wave <wave-id>:<parallel|serial>:<task,...>[:<depends-on,...>]
16
16
  # Add --acknowledge-recommendation when the selection differs from the recommendation.
17
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution show <change-dir> --json
17
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution show <change-dir> --json
18
18
  ```
19
19
 
20
20
  The optional fourth `--wave` segment names prerequisite wave IDs. `execution show --json` reports `current`, plus each wave's `depends_on`, `receipt`, `blockers`, `retryable`, and `eligible` status.
@@ -37,7 +37,7 @@ Dispatch according to the persisted plan, review each planned wave, and run a fi
37
37
  3. A `serial` wave dispatches one task at a time in listed order.
38
38
  4. After every wave, write a review report, then record one receipt:
39
39
  ```bash
40
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution review <change-dir> \
40
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> \
41
41
  --wave <wave-id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>
42
42
  ```
43
43
  5. Critical/Important findings require a `fail` receipt, focused repair, re-review, then replacement `pass` receipt.
@@ -66,7 +66,7 @@ Per-task: extract brief → write failing test → confirm failure → implement
66
66
  ## Model Selection
67
67
 
68
68
  ```bash
69
- npx --yes --package @xulthekl/team-flow@0.23.0 tf runtime config --resolve-model <profile>
69
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime config --resolve-model <profile>
70
70
  ```
71
71
 
72
72
  | Profile | Role |
@@ -79,7 +79,7 @@ npx --yes --package @xulthekl/team-flow@0.23.0 tf runtime config --resolve-model
79
79
  ## Recovery Checkpoint
80
80
 
81
81
  ```bash
82
- npx --yes --package @xulthekl/team-flow@0.23.0 tf checkpoint save <change-dir> \
82
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf checkpoint save <change-dir> \
83
83
  --task <completed-task-id> --next "<next task>" --completed "<completed work>" \
84
84
  --verification "<verification report path>" --review "<review report path>" \
85
85
  --risk "<open risk or None>" --commit-start <base-sha> --commit-end <head-sha>
@@ -146,7 +146,7 @@ Subagent (general-purpose):
146
146
  command for the controller:
147
147
 
148
148
  ```bash
149
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
149
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
150
150
  ```
151
151
 
152
152
  Use `fail` for any Critical/Important finding. A repair must be re-reviewed
@@ -16,7 +16,7 @@ Two responsibilities: requesting review (dispatching a reviewer subagent) and re
16
16
  1. Get SHAs: `BASE_SHA=$(git rev-parse HEAD~1)` and `HEAD_SHA=$(git rev-parse HEAD)`
17
17
  2. Dispatch `general-purpose` subagent using template at `skills/code-reviewer/code-reviewer-prompt.md`
18
18
  3. Fill placeholders: `[DESCRIPTION]` (what was built), `[PLAN_OR_REQUIREMENTS]` (contract/spec reference), `[BASE_SHA]`, `[HEAD_SHA]`, `[WAVE_ID]`, and a distinct `[REVIEW_REPORT_FILE]`.
19
- 4. Require the reviewer to write a non-empty persisted review report at `[REVIEW_REPORT_FILE]`, then record that exact path in the wave receipt: `npx --yes --package @xulthekl/team-flow@0.23.0 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>`.
19
+ 4. Require the reviewer to write a non-empty persisted review report at `[REVIEW_REPORT_FILE]`, then record that exact path in the wave receipt: `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>`.
20
20
  5. Act on feedback: Critical/Important findings require a `fail` receipt, focused repair, re-review, and replacement `pass` receipt before a dependent wave or closing can proceed. Note Minor for later, push back with reasoning if reviewer is wrong.
21
21
 
22
22
  ### Minimality And Scope
@@ -76,7 +76,7 @@ Suggestion breaks existing functionality, reviewer lacks context, violates YAGNI
76
76
  | Performative agreement | State requirement or just act |
77
77
  | Blind implementation | Verify against codebase first |
78
78
  | Batch without testing | One at a time, test each |
79
- | Proceeding without a wave receipt | Record `pass`/`fail` via `npx --yes --package @xulthekl/team-flow@0.23.0 tf execution review` before the next dependent wave |
79
+ | Proceeding without a wave receipt | Record `pass`/`fail` via `npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review` before the next dependent wave |
80
80
  | Assuming reviewer is right | Check if breaks things |
81
81
  | Avoiding pushback | Technical correctness > comfort |
82
82
  | Partial implementation | Clarify all items first |
@@ -93,7 +93,7 @@ Subagent (general-purpose):
93
93
  report path. End with the exact receipt command:
94
94
 
95
95
  ```bash
96
- npx --yes --package @xulthekl/team-flow@0.23.0 tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
96
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
97
97
  ```
98
98
 
99
99
  Use `fail` when any Critical or Important finding remains. A repair needs
@@ -5,9 +5,9 @@ description: Convert approved planning artifacts into an execution contract. Inv
5
5
 
6
6
  # Contract Builder
7
7
 
8
- Converts planning artifacts into a single execution handshake: `execution-contract.md`. Load the baseline with `npx --yes --package @xulthekl/team-flow@0.23.0 tf runtime asset read templates/execution-contract.md`.
8
+ Converts planning artifacts into a single execution handshake: `execution-contract.md`. Load the baseline with `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime asset read templates/execution-contract.md`.
9
9
 
10
- Read before generating: `proposal.md`, `specs/`, `design.md`, `tasks.md`, then load `docs/artifact-contract.md` with `npx --yes --package @xulthekl/team-flow@0.23.0 tf runtime asset read docs/artifact-contract.md`.
10
+ Read before generating: `proposal.md`, `specs/`, `design.md`, `tasks.md`, then load `docs/artifact-contract.md` with `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime asset read docs/artifact-contract.md`.
11
11
 
12
12
  **Architecture Design Outputs (v0.9 §26)**: 若 `architecture/` 目录存在,同时读取 `architecture/architecture.md` / `database.md` / `api.md`,作为执行契约的架构约束补充输入——确保 execution-contract.md 的 Implementation Constraints 段包含架构设计的关键约束(聚合边界/CQRS 分流/API 契约/schema 变更)。`architecture/` 不存在时跳过。
13
13
 
@@ -38,8 +38,8 @@ Must make obvious: approved behavior, out-of-scope, constraints, batches, test o
38
38
 
39
39
  After drafting: summarize handoff rules, identify ambiguity, flag unmapped requirements, ask user to approve explicitly. After approval:
40
40
  ```bash
41
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_3_result "approved: <summary>"
42
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_3_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
41
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_3_result "approved: <summary>"
42
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_3_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
43
43
  ```
44
44
  DP-3 is a hard gate — no implementation without this record.
45
45
 
@@ -60,9 +60,9 @@ Generate minimal contract: Intent Lock (one sentence), Task List (numbered), App
60
60
 
61
61
  ## Post-Generation
62
62
 
63
- Run `npx --yes --package @xulthekl/team-flow@0.23.0 tf state init <change-dir>` to create `.team-flow.yaml` with hashes.
63
+ Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf state init <change-dir>` to create `.team-flow.yaml` with hashes.
64
64
 
65
- For hotfix, after writing the minimal contract, run `npx --yes --package @xulthekl/team-flow@0.23.0 tf state init <change-dir>` or `npx --yes --package @xulthekl/team-flow@0.23.0 tf state rebuild <change-dir>` so `contract_hash` is recorded. DP-3 remains mandatory before build.
65
+ For hotfix, after writing the minimal contract, run `npx --yes --package @xulthekl/team-flow@0.24.0 tf state init <change-dir>` or `npx --yes --package @xulthekl/team-flow@0.24.0 tf state rebuild <change-dir>` so `contract_hash` is recorded. DP-3 remains mandatory before build.
66
66
 
67
67
  ## Exception Handling
68
68
 
@@ -41,8 +41,8 @@ Restate what you heard: "Here's what I'm hearing: [problem, scope, non-goals, su
41
41
 
42
42
  After user confirms the summary:
43
43
  ```bash
44
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_1_result "confirmed: <one-line summary>"
45
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_1_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
44
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_1_result "confirmed: <one-line summary>"
45
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_1_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
46
46
  ```
47
47
  DP-1 confirms scope, non-goals, and success criteria before artifact creation.
48
48
 
@@ -72,12 +72,12 @@ If an `e2e/` suite exists for the change, fold its report into verification (see
72
72
  - Scope added without artifact updates?
73
73
  - Unresolved blockers or known risks?
74
74
  - Delta specs exist that need merging?
75
- - Run `npx --yes --package @xulthekl/team-flow@0.23.0 tf audit <change-dir>` — include `decision-point-audit.md` in archive
75
+ - Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf audit <change-dir>` — include `decision-point-audit.md` in archive
76
76
 
77
77
  ### DP-6 (Verification Outcome)
78
78
  ```bash
79
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_6_result "<pass|conditional|fail>: <summary>"
80
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
79
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_6_result "<pass|conditional|fail>: <summary>"
80
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
81
81
  ```
82
82
  If FAIL, do NOT proceed to DP-7. Route back or ask about abandonment.
83
83
 
@@ -85,13 +85,13 @@ After recording a PASS outcome, also record it as the verification gate so the
85
85
  `executing → closing` transition is allowed (the guard accepts either
86
86
  `test_result: pass` or a `dp_6_result` starting with `pass`):
87
87
  ```bash
88
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> test_result pass
88
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> test_result pass
89
89
  ```
90
90
 
91
91
  ### DP-7 (Archive Confirmation)
92
92
  ```bash
93
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_7_result "confirmed: <archive summary>"
94
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_7_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
93
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_7_result "confirmed: <archive summary>"
94
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_7_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
95
95
  ```
96
96
  Verify DP-0 through DP-6 are recorded before DP-7.
97
97
 
@@ -101,14 +101,14 @@ If implementation diverged from the contract, return to `bridging` before closur
101
101
 
102
102
  ## Post-Verification
103
103
 
104
- Run `npx --yes --package @xulthekl/team-flow@0.23.0 tf state transition <change-dir> closing`. If delta specs exist, route to `spec-merger`.
104
+ Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf state transition <change-dir> closing`. If delta specs exist, route to `spec-merger`.
105
105
 
106
106
  ### Architecture Merge (v0.10 §28-§31) — MUST run first
107
107
 
108
108
  Merge change-level architecture artifacts to the global `docs/architecture/` baseline **before** any other post-verification step:
109
109
 
110
110
  ```bash
111
- npx --yes --package @xulthekl/team-flow@0.23.0 tf arch-merge <change-dir>
111
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf arch-merge <change-dir>
112
112
  ```
113
113
 
114
114
  This merges `architecture/{architecture,database,api}.md` and `architecture/sql/` into the global architecture docs. Skip silently when `architecture/` does not exist (architecture-design was `skipped`).
@@ -120,7 +120,7 @@ This merges `architecture/{architecture,database,api}.md` and `architecture/sql/
120
120
  After `arch-merge` completes, run prototype-sync to merge UX deltas back to the global prototype:
121
121
 
122
122
  ```bash
123
- npx --yes --package @xulthekl/team-flow@0.23.0 tf prototype-sync <change-dir>
123
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf prototype-sync <change-dir>
124
124
  ```
125
125
 
126
126
  **Write-back order (mandatory)**: `arch-merge` → `prototype-sync` → `compound promotion` must be executed **sequentially** within the same change closing. Do not run them in parallel — the global `docs/architecture/` and `prototype/` must not be in a half-updated state when the next change grounds on them.
@@ -132,7 +132,7 @@ If `prototype-sync` reports conflicts, list them in the closing summary and flag
132
132
  During closing, promote change-level learnings to the global solutions library:
133
133
 
134
134
  ```bash
135
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions promote <change-dir>
135
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions promote <change-dir>
136
136
  ```
137
137
 
138
138
  This checks `specs/<cap>/learnings.md` for entries meeting promotion criteria:
@@ -152,7 +152,7 @@ Before finalizing the closing, check if this change produced any learnable momen
152
152
 
153
153
  If any of the above occurred, capture the learning:
154
154
  ```bash
155
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions capture \
155
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions capture \
156
156
  --phase cross-phase --domain <domain> --type pitfall \
157
157
  --severity medium --summary "<what happened and how to prevent it>"
158
158
  ```
@@ -174,6 +174,6 @@ Verify files exist and are non-empty, run `node --check` on code files, skip 5-s
174
174
  ## Exception Handling
175
175
 
176
176
  - **Parse failures**: Report exact file and section
177
- - **Missing files**: If audit can't generate, run `npx --yes --package @xulthekl/team-flow@0.23.0 tf audit` manually
177
+ - **Missing files**: If audit can't generate, run `npx --yes --package @xulthekl/team-flow@0.24.0 tf audit` manually
178
178
  - **User interruption**: Re-run verification from the beginning on resume
179
179
  - **DP gaps**: Flag missing DPs during DP-6; ask user whether to proceed or return
@@ -7,7 +7,7 @@
7
7
  After `arch-merge` completes, run prototype-sync to merge UX deltas back to the global prototype:
8
8
 
9
9
  ```bash
10
- npx --yes --package @xulthekl/team-flow@0.23.0 tf prototype-sync <change-dir>
10
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf prototype-sync <change-dir>
11
11
  ```
12
12
 
13
13
  **Write-back order (mandatory)**: `arch-merge` → `prototype-sync` must be executed **sequentially** within the same change closing. Do not run them in parallel.
@@ -19,7 +19,7 @@ If `prototype-sync` reports conflicts, list them in the closing summary and flag
19
19
  During closing, promote change-level learnings to the global solutions library:
20
20
 
21
21
  ```bash
22
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions promote <change-dir>
22
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions promote <change-dir>
23
23
  ```
24
24
 
25
25
  Promotion criteria:
@@ -39,7 +39,7 @@ Before finalizing the closing, check if this change produced any learnable momen
39
39
 
40
40
  If any occurred, capture the learning:
41
41
  ```bash
42
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions capture \
42
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions capture \
43
43
  --phase cross-phase --domain <domain> --type pitfall \
44
44
  --severity medium --summary "<what happened and how to prevent it>"
45
45
  ```
@@ -49,22 +49,22 @@ Advisory — skip silently if no learnable moments detected.
49
49
  ## DP-6 (Verification Outcome)
50
50
 
51
51
  ```bash
52
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_6_result "<pass|conditional|fail>: <summary>"
53
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
52
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_6_result "<pass|conditional|fail>: <summary>"
53
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
54
54
  ```
55
55
 
56
56
  If FAIL, do NOT proceed to DP-7. Route back or ask about abandonment.
57
57
 
58
58
  After PASS, also record the verification gate:
59
59
  ```bash
60
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> test_result pass
60
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> test_result pass
61
61
  ```
62
62
 
63
63
  ## DP-7 (Archive Confirmation)
64
64
 
65
65
  ```bash
66
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_7_result "confirmed: <archive summary>"
67
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_7_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
66
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_7_result "confirmed: <archive summary>"
67
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_7_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
68
68
  ```
69
69
 
70
70
  Verify DP-0 through DP-6 are recorded before DP-7.
@@ -10,7 +10,7 @@ After a change completes, delta specs (ADDED/MODIFIED/REMOVED/RENAMED) must be m
10
10
  ## Pre-Flight Checks
11
11
 
12
12
  ### Conflict Detection
13
- Run `npx --yes --package @xulthekl/team-flow@0.23.0 tf sync <change-dir>`. If conflicts are detected (same requirement modified by multiple changes), present the conflict list to the user for resolution order.
13
+ Run `npx --yes --package @xulthekl/team-flow@0.24.0 tf sync <change-dir>`. If conflicts are detected (same requirement modified by multiple changes), present the conflict list to the user for resolution order.
14
14
 
15
15
  ### Abandoned Change Guard
16
16
  Check if the change is `abandoned`. If so → STOP: "Abandoned changes cannot be synced. Delta specs are preserved for reference but must not be merged."
@@ -55,7 +55,7 @@ Output sync report table: Capability, ADDED/MODIFIED/REMOVED/RENAMED counts, Sta
55
55
  2. Change folder (including deltas) remains for traceability.
56
56
  3. Record that merging is complete so the `executing → closing` guard allows closure:
57
57
  ```bash
58
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> spec_merged true
58
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> spec_merged true
59
59
  ```
60
60
  (If the change had no delta sections, still set `spec_merged true` — there was nothing to merge.)
61
61
 
@@ -55,7 +55,7 @@ Read `docs/solutions/INDEX.md` if it exists. Filter entries where `phase = spec
55
55
 
56
56
  ## Config Check
57
57
 
58
- Run: `npx --yes --package @xulthekl/team-flow@0.23.0 tf runtime config --get artifacts.order` — generate in configured order (default: proposal → specs → design → tasks). Run with `artifacts.skip` — skip any listed artifacts.
58
+ Run: `npx --yes --package @xulthekl/team-flow@0.24.0 tf runtime config --get artifacts.order` — generate in configured order (default: proposal → specs → design → tasks). Run with `artifacts.skip` — skip any listed artifacts.
59
59
 
60
60
  ## Artifact Roles
61
61
 
@@ -135,8 +135,8 @@ Generate one at a time. Confirm each before next. This prevents scope drift —
135
135
 
136
136
  Present summary of all 4 artifacts (2-3 sentences each). Ask user for adjustments. After approval:
137
137
  ```bash
138
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_2_result "approved: <summary>"
139
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state set <change-dir> dp_2_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
138
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_2_result "approved: <summary>"
139
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state set <change-dir> dp_2_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
140
140
  ```
141
141
 
142
142
  ## Handoff Rule
@@ -66,9 +66,19 @@ Do NOT invoke for:
66
66
 
67
67
  **条件**:如果 B1 侦察发现项目有一定复杂度(≥5 个模块或 ≥10 个源文件),执行此阶段。否则跳过。
68
68
 
69
- **B2 成果物导入(v0.23.0 新增)**:
69
+ **B2 成果物导入(v0.23.0 新增,v0.24.0 模板初始化补强)**:
70
70
 
71
71
  ```
72
+ Step 0: 目录+模板初始化(v0.24.0 新增)
73
+ ├── mkdir -p docs/architecture/
74
+ ├── 从 ${CLAUDE_PLUGIN_ROOT}/skills/architecture-design/templates/ 复制模板:
75
+ │ architecture.md → docs/architecture/ARCHITECTURE.md
76
+ │ database.md → docs/architecture/DATABASE.md
77
+ │ physical-model.md → docs/architecture/PHYSICAL-MODEL.md
78
+ │ api.md → docs/architecture/API-INDEX.md
79
+ │ index.md → docs/architecture/INDEX.md
80
+ └── 已存在的文件不覆盖(只补缺失)
81
+
72
82
  Step 1: 询问用户是否有既有成果物
73
83
  ├── 有 SQL DDL 脚本 → 导入到 docs/architecture/schema-baseline.sql
74
84
  ├── 有物理模型文档 → 转换为 docs/architecture/PHYSICAL-MODEL.md(对齐标准格式)
@@ -76,7 +86,8 @@ Step 1: 询问用户是否有既有成果物
76
86
  └── 无既有成果物 → Step 2 兜底
77
87
 
78
88
  Step 2: 确定性提取(兜底)
79
- ├── recon-probe.sh 增加 DDL 提取能力(解析 Entity / SHOW CREATE TABLE)
89
+ ├── recon-probe.sh DDL 提取能力(v0.24.0 已实现:SQL 文件 / Java Entity / 占位)
90
+ │ bash scripts/recon-probe.sh --root <根> --ddl-out docs/architecture/schema-baseline.sql
80
91
  ├── 从 schema-baseline.sql 反向生成 PHYSICAL-MODEL.md
81
92
  └── 扫描 Controller/Router 类 → 生成 API-INDEX.md
82
93
 
@@ -15,16 +15,22 @@ bash scripts/recon-probe.sh --root <项目根> --out /tmp/recon-<slug>.json
15
15
 
16
16
  固定采集(不依赖 LLM,两次接入结果一致):目录树(限深 4 层)、依赖清单(pom/package.json/requirements/go.mod/build.gradle)、LOC 与文件类型分布、测试文件计数(含 `.test.mjs`/`.spec.mjs`)、DB 迁移文件清单、README/docs 探测。输出结构化 JSON 供子代理消费。脚本只做确定性机械采集(§17.8 第四类载体),语义判断交给子代理 LLM。
17
17
 
18
- ## B1.1a DDL 提取能力(v0.23.0 新增)
18
+ ## B1.1a DDL 提取能力(v0.23.0 设计,v0.24.0 已实现)
19
19
 
20
- `recon-probe.sh` 需增加 DDL 提取能力,用于 B2 成果物导入阶段的兜底提取:
20
+ `recon-probe.sh` 已实现 DDL 提取能力(v0.24.0),用于 B2 成果物导入阶段的兜底提取:
21
21
 
22
- - **Entity 类解析**:扫描 `@Entity`、`@Table` 注解的 Java 类,或 ORM 模型定义文件,提取表名、字段名、字段类型、索引信息
23
- - **SHOW CREATE TABLE**:当项目配置了数据库连接时,执行 `SHOW CREATE TABLE` 导出各表 DDL
24
- - **迁移文件解析**:解析 Flyway / Liquibase / Alembic 等迁移脚本,提取最终态 schema
25
- - **输出**:将提取结果写入 `docs/architecture/schema-baseline.sql`,格式为标准 DDL(CREATE TABLE 语句)
22
+ - **策略 1:SQL 文件提取**(优先级最高):扫描 `*.sql` 文件中的 `CREATE TABLE` 语句,直接提取完整 DDL
23
+ - **策略 2:Java Entity 类解析**:扫描 `@Entity`、`@Table` 注解的 Java 类,提取表名、字段名、字段类型(正则映射:String→varchar(255)、Long/int→bigint、Boolean→tinyint(1)、LocalDateTime→datetime、BigDecimal→decimal(15,4))
24
+ - **策略 3:占位兜底**:以上均无时生成带注释的空 `schema-baseline.sql`,提示用户手动补充
26
25
 
27
- 此能力为 B2 Step 2 兜底提取的前置依赖。当用户无既有 DDL 脚本时,由 recon-probe.sh 自动从代码/数据库中提取 schema 基线。
26
+ **用法**:
27
+ ```bash
28
+ bash scripts/recon-probe.sh --root <根> --ddl-out docs/architecture/schema-baseline.sql --out /tmp/recon-<slug>.json
29
+ ```
30
+
31
+ **JSON 输出字段**:`ddl_extraction.source`(sql_files / java_entity / none)、`ddl_extraction.table_count`、`ddl_extraction.tables[]`、`ddl_extraction.ddl_statements`
32
+
33
+ **未实现**:SHOW CREATE TABLE(需数据库连接,留待用户手动配置)、Flyway/Liquibase 迁移脚本解析(需语义判断,由侦察子代理处理)。
28
34
 
29
35
  ## B1.2 并行派发侦察子代理(语义增强)
30
36
 
@@ -36,6 +36,7 @@ set -u # 未定义变量报错;不用 -e(单条采集失败不应中断整
36
36
  # ----------------------------------------------------------------------------
37
37
  ROOT="."
38
38
  OUT=""
39
+ DDL_OUT="" # v0.24.0: DDL 输出文件路径(默认不写,仅含在 JSON 中)
39
40
  MAX_FILES=50000 # LOC 统计文件数上限(保护超大仓库)
40
41
  TREE_DEPTH=4 # 目录树限深
41
42
 
@@ -51,6 +52,8 @@ while [ $# -gt 0 ]; do
51
52
  --root=*) ROOT="${1#*=}"; shift ;;
52
53
  --out) OUT="${2:-}"; shift 2 ;;
53
54
  --out=*) OUT="${1#*=}"; shift ;;
55
+ --ddl-out) DDL_OUT="${2:-}"; shift 2 ;;
56
+ --ddl-out=*) DDL_OUT="${1#*=}"; shift ;;
54
57
  -h|--help) print_help; exit 0 ;;
55
58
  *) echo "[recon-probe] warn: unknown arg '$1' (ignored)" >&2; shift ;;
56
59
  esac
@@ -260,6 +263,111 @@ pruned_find -maxdepth 2 -type f \
260
263
  -print 2>/dev/null | sed "s#^$ROOT_ABS/##" | sort > "$TMP/doc_files.txt"
261
264
  if [ -d "$ROOT_ABS/docs" ]; then DOCS_DIR=true; else DOCS_DIR=false; fi
262
265
 
266
+ # ============================================================================
267
+ # ⑦ DDL 提取(v0.24.0:schema-baseline 兜底采集)
268
+ # ----------------------------------------------------------------------------
269
+ # 策略(优先级):
270
+ # 1. 既有 .sql 中的 CREATE TABLE 语句 → 直接提取
271
+ # 2. Java Entity 类(@Entity / @Table 注解)→ 正则提取表名+字段
272
+ # 3. 以上均无 → 输出空 schema-baseline.sql + 提示手动补充
273
+ # 设计契约:只做确定性机械采集(regex),语义推断交给侦察子代理。
274
+ # ============================================================================
275
+
276
+ : > "$TMP/ddl_statements.sql"
277
+ : > "$TMP/ddl_tables.txt"
278
+ DDL_SOURCE="none"
279
+ DDL_TABLE_COUNT=0
280
+
281
+ # --- 策略 1:从既有 .sql 文件提取 CREATE TABLE ----------------------------------
282
+ if [ -s "$TMP/sql_files.txt" ]; then
283
+ while IFS= read -r sql_rel; do
284
+ sql_abs="$ROOT_ABS/$sql_rel"
285
+ [ -f "$sql_abs" ] || continue
286
+ # 提取 CREATE TABLE 语句(多行匹配,到第一个 ; 结束)
287
+ # 兼容:CREATE TABLE / CREATE TABLE IF NOT EXISTS / 大小写不敏感
288
+ awk '
289
+ BEGIN { IGNORECASE=1; in_stmt=0; stmt="" }
290
+ /CREATE[[:space:]]+TABLE/ { in_stmt=1; stmt="" }
291
+ in_stmt {
292
+ stmt = stmt $0 "\n"
293
+ if (/;/) {
294
+ printf "%s-- Source: %s\n\n", stmt, sql_file
295
+ in_stmt=0; stmt=""
296
+ }
297
+ }
298
+ ' sql_file="$sql_rel" "$sql_abs" 2>/dev/null >> "$TMP/ddl_statements.sql" || true
299
+ done < "$TMP/sql_files.txt"
300
+ if [ -s "$TMP/ddl_statements.sql" ]; then
301
+ DDL_SOURCE="sql_files"
302
+ # 提取表名(用于计数和 JSON)
303
+ grep -ioE 'CREATE[[:space:]]+TABLE[[:space:]]+(IF[[:space:]]+NOT[[:space:]]+EXISTS[[:space:]]+)?[`"]?([a-zA-Z_][a-zA-Z0-9_.]*)[`"]?' \
304
+ "$TMP/ddl_statements.sql" 2>/dev/null \
305
+ | grep -ioE '[`"]?[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*[`"]?|[a-zA-Z_][a-zA-Z0-9_]*[`"]?$' \
306
+ | sed -E 's/[`"]//g' | sort -u > "$TMP/ddl_tables.txt" || true
307
+ DDL_TABLE_COUNT=$(wc -l < "$TMP/ddl_tables.txt" | tr -d ' ')
308
+ fi
309
+ fi
310
+
311
+ # --- 策略 2:从 Java Entity 类提取(@Entity / @Table 注解)-----------------------
312
+ if [ "$DDL_TABLE_COUNT" -eq 0 ]; then
313
+ : > "$TMP/entity_files.txt"
314
+ pruned_find -type f -name '*.java' -print 2>/dev/null \
315
+ | while IFS= read -r jf; do
316
+ if grep -qlE '@(Entity|Table|Document|TableName)' "$jf" 2>/dev/null; then
317
+ echo "$jf"
318
+ fi
319
+ done | sort > "$TMP/entity_files.txt"
320
+
321
+ ENTITY_COUNT=$(wc -l < "$TMP/entity_files.txt" | tr -d ' ')
322
+ if [ "$ENTITY_COUNT" -gt 0 ]; then
323
+ DDL_SOURCE="java_entity"
324
+ while IFS= read -r ef; do
325
+ ef_rel="${ef#"$ROOT_ABS"/}"
326
+ # 提取 @Table(name="xxx") 或类名作为表名
327
+ table_name=""
328
+ tn="$(grep -oE '@Table\([^)]*name[[:space:]]*=[[:space:]]*"[^"]+"' "$ef" 2>/dev/null | head -1 \
329
+ | grep -oE '"[^"]+"' | tr -d '"')" || true
330
+ if [ -n "$tn" ]; then
331
+ table_name="$tn"
332
+ else
333
+ # 降级:用类名转 snake_case 作为表名
334
+ table_name="$(grep -oE 'class[[:space:]]+[A-Z][a-zA-Z0-9]*' "$ef" 2>/dev/null | head -1 \
335
+ | sed -E 's/class[[:space:]]+//' \
336
+ | sed -E 's/([A-Z])/_\1/g' | tr '[:upper:]' '[:lower:]' | sed 's/^_//')" || true
337
+ fi
338
+ [ -z "$table_name" ] && continue
339
+
340
+ # 攒完整 DDL 到临时文件再一次性追加(避免多次 >> 缓冲问题)
341
+ : > "$TMP/_entity_ddl.tmp"
342
+ echo "-- Entity: $ef_rel" >> "$TMP/_entity_ddl.tmp"
343
+ echo "CREATE TABLE $table_name (" >> "$TMP/_entity_ddl.tmp"
344
+ # 机械提取 private 字段声明:private Type fieldName;
345
+ grep -E '^[[:space:]]*private[[:space:]]+' "$ef" 2>/dev/null \
346
+ | grep -vE 'static[[:space:]]|final[[:space:]]|Logger|log|serialVersionUID' \
347
+ | sed -E 's/^[[:space:]]*private[[:space:]]+([A-Za-z0-9_<>, ]+)[[:space:]]+([a-zA-Z_][a-zA-Z0-9_]*)[[:space:]]*(=|;).*/ \2 \1,/' \
348
+ | sed -E 's/String|varchar|text/varchar(255)/g; s/Long|Integer|int|long/bigint/g; s/Boolean|boolean/tinyint(1)/g; s/Date|LocalDateTime|Timestamp/datetime/g; s/BigDecimal|Double|Float/decimal(15,4)/g' \
349
+ >> "$TMP/_entity_ddl.tmp" 2>/dev/null || true
350
+ echo " create_time datetime," >> "$TMP/_entity_ddl.tmp"
351
+ echo " update_time datetime," >> "$TMP/_entity_ddl.tmp"
352
+ echo " del_flag tinyint(1) DEFAULT 0" >> "$TMP/_entity_ddl.tmp"
353
+ echo ");" >> "$TMP/_entity_ddl.tmp"
354
+ echo "" >> "$TMP/_entity_ddl.tmp"
355
+ cat "$TMP/_entity_ddl.tmp" >> "$TMP/ddl_statements.sql"
356
+ echo "$table_name" >> "$TMP/ddl_tables.txt"
357
+ done < "$TMP/entity_files.txt"
358
+ sort -u "$TMP/ddl_tables.txt" -o "$TMP/ddl_tables.txt"
359
+ DDL_TABLE_COUNT=$(wc -l < "$TMP/ddl_tables.txt" | tr -d ' ')
360
+ fi
361
+ fi
362
+
363
+ # --- 策略 3:生成占位 schema-baseline.sql ---------------------------------------
364
+ if [ "$DDL_TABLE_COUNT" -eq 0 ]; then
365
+ DDL_SOURCE="none"
366
+ printf -- '-- schema-baseline.sql (auto-generated placeholder)\n' > "$TMP/ddl_statements.sql"
367
+ printf -- '-- No CREATE TABLE statements or Java Entity classes detected.\n' >> "$TMP/ddl_statements.sql"
368
+ printf -- '-- Please populate manually with your database schema.\n\n' >> "$TMP/ddl_statements.sql"
369
+ fi
370
+
263
371
  # ============================================================================
264
372
  # 组装 JSON
265
373
  # ============================================================================
@@ -288,8 +396,13 @@ if [ -d "$ROOT_ABS/docs" ]; then DOCS_DIR=true; else DOCS_DIR=false; fi
288
396
  "$(json_array_from_file "$TMP/migration_dirs.txt")" \
289
397
  "$(json_array_from_file "$TMP/sql_samples.txt")"
290
398
  # ⑥ docs
291
- printf ' "docs": {"docs_dir": %s, "doc_files": %s}\n' \
399
+ printf ' "docs": {"docs_dir": %s, "doc_files": %s},\n' \
292
400
  "$DOCS_DIR" "$(json_array_from_file "$TMP/doc_files.txt")"
401
+ # ⑦ DDL 提取(v0.24.0)
402
+ printf ' "ddl_extraction": {"source": "%s", "table_count": %s, "tables": %s, "ddl_statements": "%s"}\n' \
403
+ "$(json_escape "$DDL_SOURCE")" "$DDL_TABLE_COUNT" \
404
+ "$(json_array_from_file "$TMP/ddl_tables.txt")" \
405
+ "$(json_escape "$(cat "$TMP/ddl_statements.sql" 2>/dev/null)")"
293
406
  printf '}\n'
294
407
  } > "$TMP/out.json"
295
408
 
@@ -311,6 +424,13 @@ else
311
424
  emit_json
312
425
  fi
313
426
 
427
+ # v0.24.0: DDL 独立输出文件(--ddl-out)
428
+ if [ -n "$DDL_OUT" ] && [ -s "$TMP/ddl_statements.sql" ]; then
429
+ mkdir -p "$(dirname "$DDL_OUT")" 2>/dev/null || true
430
+ cp "$TMP/ddl_statements.sql" "$DDL_OUT" 2>/dev/null || true
431
+ echo "[recon-probe] DDL baseline written to: $DDL_OUT" >&2
432
+ fi
433
+
314
434
  # 人类可读摘要 → stderr
315
435
  {
316
436
  echo "================ recon-probe 摘要 ================"
@@ -322,6 +442,7 @@ fi
322
442
  echo "SQL 迁移 : $SQL_COUNT 个"
323
443
  echo "docs/ 目录 : $DOCS_DIR"
324
444
  echo "README 等 : $(wc -l < "$TMP/doc_files.txt" | tr -d ' ') 个"
445
+ echo "DDL 提取 : source=$DDL_SOURCE, tables=$DDL_TABLE_COUNT"
325
446
  echo "================================================="
326
447
  } >&2
327
448
 
@@ -54,7 +54,7 @@
54
54
  检测可复利时刻(需求矛盾、原型返工、自动评审发现不一致并修正等)。每次自动评审发现不一致并修正后触发:
55
55
 
56
56
  ```bash
57
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions capture --phase prd --domain <domain> --type pitfall --severity <sev> --summary "<summary>"
57
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions capture --phase prd --domain <domain> --type pitfall --severity <sev> --summary "<summary>"
58
58
  ```
59
59
 
60
60
  ### 6. 反馈环路检查点
@@ -38,7 +38,7 @@ verdict = FAIL → 必须回退 S3 调整拆分后重新审计,不可绕过直
38
38
 
39
39
  ```bash
40
40
  mkdir -p changes/<change-name>
41
- npx --yes --package @xulthekl/team-flow@0.23.0 tf state init changes/<change-name>
41
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf state init changes/<change-name>
42
42
  ```
43
43
 
44
44
  > ⚠️ **路径约束**:change 脚手架目录固定为项目根 `changes/<change-name>/`。
@@ -34,7 +34,7 @@
34
34
  change closing 时检查经验晋升(change 内经验 → 产品级经验):
35
35
 
36
36
  ```bash
37
- npx --yes --package @xulthekl/team-flow@0.23.0 tf solutions promote <change-dir>
37
+ npx --yes --package @xulthekl/team-flow@0.24.0 tf solutions promote <change-dir>
38
38
  ```
39
39
 
40
40
  ### 4. 动态重规划触发