@xulthekl/team-flow 0.57.0 → 0.59.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 (50) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +3 -3
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +2 -2
  5. package/.cursor-plugin/marketplace.json +2 -2
  6. package/.cursor-plugin/plugin.json +2 -2
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +27 -7
  9. package/CHANGELOG.md +86 -0
  10. package/GEMINI.md +1 -1
  11. package/HANDOFF.md +2 -2
  12. package/INSTALL.md +10 -10
  13. package/README.md +9 -7
  14. package/agents/code-reviewer.md +3 -0
  15. package/agents/cross-change-consistency-checker.md +34 -6
  16. package/agents/release-archivist.md +6 -0
  17. package/docs/README_en.md +1 -1
  18. package/docs/platform-matrix.md +1 -1
  19. package/docs/release-checklist.md +1 -1
  20. package/docs/usage-guide.md +2 -2
  21. package/gemini-extension.json +2 -2
  22. package/hooks/session-start +2 -2
  23. package/llms.txt +1 -1
  24. package/package.json +2 -2
  25. package/plugin.json +2 -2
  26. package/scripts/check-version-consistency.mjs +34 -4
  27. package/scripts/guard/checks/dp3-approved.mjs +1 -1
  28. package/scripts/guard/guard.mjs +7 -1
  29. package/scripts/lib/cmd-state.mjs +9 -6
  30. package/skills/architecture-design/templates/conventions/frontend-patterns.md +7 -0
  31. package/skills/build-executor/SKILL.md +2 -0
  32. package/skills/build-executor/implementer-prompt.md +19 -0
  33. package/skills/build-executor/task-reviewer-prompt.md +51 -5
  34. package/skills/clean-code/SKILL.md +116 -0
  35. package/skills/clean-code/references/judgement-cases.md +83 -0
  36. package/skills/clean-code/references/shared-layer-rules.md +50 -0
  37. package/skills/code-reviewer/SKILL.md +10 -0
  38. package/skills/code-reviewer/code-reviewer-prompt.md +68 -2
  39. package/skills/decision-surrogate/SKILL.md +87 -0
  40. package/skills/decision-surrogate/references/decision-points.md +87 -0
  41. package/skills/decision-surrogate/references/onboarding.md +79 -0
  42. package/skills/decision-surrogate/references/protocols.md +116 -0
  43. package/skills/workflow-orchestrator/references/s5-monitoring.md +8 -4
  44. package/skills/workflow-start/SKILL.md +4 -0
  45. package/templates/conventions/glaf4-compliant/java-testing.md +3 -3
  46. package/templates/conventions/js-testing.md +1 -1
  47. package/templates/conventions/python-testing.md +1 -1
  48. package/.zcode/hooks.json +0 -8
  49. package/.zcode/rules/phase-guard.mdc +0 -33
  50. package/.zcode/skills/workflow-start/SKILL.md +0 -175
@@ -1,175 +0,0 @@
1
- ---
2
- name: workflow-start
3
- description: Primary entry point for the team-flow state-machine workflow. Invoke when the user is inside an active team-flow change directory (look for .team-flow.yaml, changes/<name>/, proposal.md, specs/, design.md, tasks.md, or execution-contract.md) and asks to start, continue, resume, implement, plan, or figure out the next workflow step. Also invoke when the user explicitly asks to start a new team-flow change or route through the team-flow workflow. Do not invoke for unrelated coding tasks that happen to use words like start, continue, implement, or plan.
4
- ---
5
-
6
- # Workflow Start
7
-
8
- Primary entry point for `team-flow`. Jobs: inspect change context, check for updates, confirm DP-0, determine state, route to correct skill, block invalid transitions.
9
-
10
- ## Use This Skill When
11
-
12
- Only invoke when team-flow context is present: `.team-flow.yaml` exists, artifacts like `proposal.md`/`specs/`/`design.md`/`tasks.md`/`execution-contract.md` are present, or user explicitly invokes team-flow by name. When in doubt, check for `.team-flow.yaml` first.
13
-
14
- Do NOT invoke for: general coding tasks outside team-flow changes, casual questions, unrelated work.
15
-
16
- ## States
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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' runtime asset read docs/state-machine.md`.
19
-
20
- ## Initialization
21
-
22
- 1. **Update check**: Run `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' runtime check-update`. Exit 0 → continue. Exit 1 → non-blocking upgrade reminder. Exit 2 → skip.
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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' handoff list <change-dir> --json` and `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' checkpoint list <change-dir> --json`. A `result-ready` handoff requires explicit review and `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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
-
27
- ## DP-0: User Confirmation Gate
28
-
29
- Run DP-0 when: change folder doesn't exist, planning artifacts missing/empty, or `dp_0_confirmed` ≠ `true`. Skip if `dp_0_confirmed` is `true`.
30
-
31
- ### Upstream Inheritance (v0.9)
32
-
33
- 若 `change-brief.md` 存在且 `upstream_source == orchestrator`(本 change 由 orchestrator S4 分发),**继承** brief 的 scope/约束/AC 为默认值,DP-0 从"从零问"改为"一次确认继承或修正",**不**重新问"你想做什么"。否则(手动新建 / hotfix / 单 change 快速通道 / 存量 change 无 brief)照常 DP-0。**主信号 = brief 文件存在**(非 yaml 字段——可天然排除无 brief 的快速通道,且对存量手动 change 零误伤);双源冲突以 `requirement/vN/plan.md` 为准并触发 Brief drift(见「Staleness Detection」)。完整判定伪代码与主信号理由见 `references/routing-rules.md`「DP-0」。
34
-
35
- Ask (manual path): change name + one-sentence intent, known constraints, related optimizations (include or stay focused?), communication preference (ask per decision or draft for review).
36
-
37
- After confirmation:
38
- ```bash
39
- node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' state set <change-dir> dp_0_decisions "<summary>"
40
- node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' state set <change-dir> dp_0_result confirmed
41
- node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' state set <change-dir> dp_0_confirmed true
42
- node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' state set <change-dir> dp_0_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
43
- ```
44
-
45
- Config-aware routing: check `artifacts.order` and `artifacts.skip` from project config.
46
-
47
- ## Mode Detection
48
-
49
- If workflow is `auto`/`null`/unset: run `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' state set <dir> workflow <mode>`.
50
-
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
-
53
- ## Routing Rules
54
-
55
- ### Route to need-explorer
56
- Change is fuzzy, scope unclear, comparing options, no stable change name.
57
-
58
- ### Route to architecture-design (v0.9 §26)
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
-
61
- ### Route to spec-writer
62
- Guard: `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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
-
64
- ### Route to contract-builder
65
- Guard: `... check <dir> specifying bridging --json` → fail = BLOCK. Artifacts exist, implementation requested, contract missing/stale. Include `DP-3: 契约批准`.
66
-
67
- ### Route to build-executor
68
- Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' 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
-
70
- ### Route to bug-investigator
71
- Execution hit blockage: test failure, unexpected behavior, build error, task cannot proceed. After debugging, route back to build-executor.
72
-
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 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>` receipt before any dependent wave or closing transition.
75
-
76
- ### Route to release-archivist
77
- Guard: `... check <dir> executing closing --json` → fail = BLOCK. Implementation complete, verification complete/nearly complete. Include `DP-7: 归档确认`.
78
-
79
- ### Route to spec-merger
80
- Delta specs exist that need merging, change closing with ADDED/MODIFIED/REMOVED/RENAMED specs.
81
-
82
- ### Route to abandoned
83
- User explicitly requests, bug-investigator escalates after 3+ failures AND user chooses, scope change makes change no longer worthwhile AND user confirms. Block from `closing` or `abandoned`.
84
-
85
- ### Optional Prototype Handoff
86
-
87
- When the user's brief explicitly contains UI, screen, interaction, layout, UX,
88
- or product-experience uncertainty, ask once whether a prototype would reduce
89
- uncertainty. Do not create a prototype handoff or enter a prototype worktree
90
- until the user confirms. After confirmation:
91
-
92
- ```bash
93
- node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' handoff create <change-dir> \
94
- --type prototype --objective "<confirmed objective>" \
95
- --expected-output "<expected evidence>" --acceptance "<completion criterion>"
96
- tf isolate <change-dir> prototype-<handoff-id>
97
- ```
98
-
99
- Never suggest or enter this route automatically for backend, CLI, configuration,
100
- or internal-refactor work. Never pass `--force` to `tf isolate` for prototype
101
- work.
102
-
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
-
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 可能正是架构缺陷导致)
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 子代理判断门
109
-
110
- Post-transition: 💡 `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' inject <change-dir>` to update phase-guard artifacts.
111
-
112
- ## Staleness Detection
113
-
114
- Use content inspection, not timestamps.
115
-
116
- **Stale contract**: proposal scope expanded beyond contract scope fence, or contract references capabilities no longer in proposal → route back to `contract-builder`.
117
-
118
- **Stale planning artifacts**: capability in proposal has no spec file, or spec exists for capability not in proposal → drift detected.
119
-
120
- **Stale tasks**: requirement in specs has no corresponding task → stale tasks.
121
-
122
- **Brief drift (advisory, v0.9, 不阻断)**: change-brief.md 是上游输入(非 team-flow 产物),**不**混入上述三条产物互查、**不**进入 `artifacts_hash`。当 brief 的 `plan_hash` 与当前 `requirement/vN/plan.md` 不一致,或 brief AC 列表与 PRD 功能清单明显出入 → 提示"产品层已变更,brief 可能过期,建议回 orchestrator 重新分发(S4→S3 环路)",**不**触发产物重审。
123
-
124
- ## Guardrails
125
-
126
- - No implementation before planning artifacts or contract exist
127
- - No implementation for full/hotfix without a current `node '/Users/litong/Documents/work/code/practice/team-flow-workspace/team-flow/.zcode/team-flow/scripts/team-flow.mjs' execution plan`; no state transition based on an unverified DP-4 string
128
- - No "continue" without state inspection
129
- - No implementation past stale contract
130
- - No implementation past bug without investigation
131
- - No closure without all planned wave review receipts recorded as `pass`
132
- - No closure with unsynced delta specs
133
- - No transitions from `abandoned` (terminal)
134
- - No transition to `abandoned` from `closing` or `abandoned`
135
- - No auto-abandon without user confirmation
136
- - No merging delta specs from abandoned change
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 不豁免
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
-
164
- ## Output Standard
165
-
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.
167
-
168
- Decision point references when routing:
169
- - architecture-design → DP-A(架构设计判断门,v0.9 §26), contract-builder → DP-3, build-executor → DP-4, bug-investigator (escalation) → DP-5, release-archivist (verification failure) → DP-6, release-archivist → DP-7
170
-
171
- ## Exception Handling
172
-
173
- - **Parse failures**: Fall back to content-level detection if `.team-flow.yaml` is malformed
174
- - **Missing files**: Route to the skill that generates the missing files
175
- - **User interruption**: Re-inspect change directory content (not cached state) on resume