cowork-flow 0.0.34 → 0.0.36

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 (63) hide show
  1. package/package.json +1 -1
  2. package/src/commands/install-zcode-plugin.js +14 -0
  3. package/template/.codex/agents/cowork-check.toml +1 -1
  4. package/template/.codex/agents/cowork-implement.toml +1 -1
  5. package/template/.cowork-flow/.version +1 -1
  6. package/template/.cowork-flow/scripts/__init__.py +1 -0
  7. package/template/.cowork-flow/scripts/commands/task.py +35 -29
  8. package/template/.cowork-flow/scripts/common/gates/tdd_evidence.py +10 -1
  9. package/template/.cowork-flow/scripts/common/gates/validate_implementation.py +7 -2
  10. package/template/.cowork-flow/spec/runtime/rules.json +17 -125
  11. package/template/.cowork-flow/spec/schemas/rules.schema.json +2 -2
  12. package/template/.zcode/.zcode-plugin/plugin.json +1 -1
  13. package/template/.zcode/hooks/inject-context.js +32 -2
  14. package/template/.zcode/scaffold/.cowork-flow/.version +1 -1
  15. package/template/.zcode/scaffold/.cowork-flow/run +98 -0
  16. package/template/.zcode/scaffold/.cowork-flow/run.cmd +111 -0
  17. package/template/.zcode/scaffold/.cowork-flow/spec/runtime/rules.json +17 -125
  18. package/template/.zcode/scaffold/.cowork-flow/spec/schemas/rules.schema.json +2 -2
  19. package/template/skills/check/SKILL.md +2 -2
  20. package/template/skills/game-design/SKILL.md +1 -1
  21. package/template/skills/start/SKILL.md +2 -2
  22. package/template/skills/tdd/SKILL.md +2 -2
  23. package/template/skills/writing-plans/SKILL.md +4 -4
  24. package/template/.zcode/hooks/runtime/run +0 -58
  25. package/template/.zcode/hooks/runtime/run.cmd +0 -37
  26. package/template/.zcode/hooks/runtime/scripts/commands/__init__.py +0 -1
  27. package/template/.zcode/hooks/runtime/scripts/commands/_bootstrap.py +0 -10
  28. package/template/.zcode/hooks/runtime/scripts/commands/add_session.py +0 -452
  29. package/template/.zcode/hooks/runtime/scripts/commands/change.py +0 -412
  30. package/template/.zcode/hooks/runtime/scripts/commands/doctor.py +0 -471
  31. package/template/.zcode/hooks/runtime/scripts/commands/get_context.py +0 -20
  32. package/template/.zcode/hooks/runtime/scripts/commands/get_developer.py +0 -30
  33. package/template/.zcode/hooks/runtime/scripts/commands/init_developer.py +0 -55
  34. package/template/.zcode/hooks/runtime/scripts/commands/party_mode_v2.py +0 -1166
  35. package/template/.zcode/hooks/runtime/scripts/commands/resume.py +0 -62
  36. package/template/.zcode/hooks/runtime/scripts/commands/subagent.py +0 -321
  37. package/template/.zcode/hooks/runtime/scripts/commands/task.py +0 -2082
  38. package/template/.zcode/hooks/runtime/scripts/common/__init__.py +0 -79
  39. package/template/.zcode/hooks/runtime/scripts/common/core/__init__.py +0 -1
  40. package/template/.zcode/hooks/runtime/scripts/common/core/config.py +0 -242
  41. package/template/.zcode/hooks/runtime/scripts/common/core/developer.py +0 -205
  42. package/template/.zcode/hooks/runtime/scripts/common/core/execution_context.py +0 -385
  43. package/template/.zcode/hooks/runtime/scripts/common/core/files.py +0 -45
  44. package/template/.zcode/hooks/runtime/scripts/common/core/paths.py +0 -239
  45. package/template/.zcode/hooks/runtime/scripts/common/gates/__init__.py +0 -1
  46. package/template/.zcode/hooks/runtime/scripts/common/gates/anti_rationalization.py +0 -55
  47. package/template/.zcode/hooks/runtime/scripts/common/gates/coding_standards.py +0 -210
  48. package/template/.zcode/hooks/runtime/scripts/common/gates/gates.py +0 -71
  49. package/template/.zcode/hooks/runtime/scripts/common/gates/tdd_evidence.py +0 -369
  50. package/template/.zcode/hooks/runtime/scripts/common/gates/test_intent.py +0 -262
  51. package/template/.zcode/hooks/runtime/scripts/common/gates/validate_coding_standards.py +0 -342
  52. package/template/.zcode/hooks/runtime/scripts/common/gates/validate_implementation.py +0 -268
  53. package/template/.zcode/hooks/runtime/scripts/common/gates/validate_rules.py +0 -462
  54. package/template/.zcode/hooks/runtime/scripts/common/git/__init__.py +0 -1
  55. package/template/.zcode/hooks/runtime/scripts/common/git/git_context.py +0 -765
  56. package/template/.zcode/hooks/runtime/scripts/common/git/git_snapshot.py +0 -83
  57. package/template/.zcode/hooks/runtime/scripts/common/task/__init__.py +0 -1
  58. package/template/.zcode/hooks/runtime/scripts/common/task/active_task.py +0 -403
  59. package/template/.zcode/hooks/runtime/scripts/common/task/archive_utils.py +0 -72
  60. package/template/.zcode/hooks/runtime/scripts/common/task/readiness.py +0 -249
  61. package/template/.zcode/hooks/runtime/scripts/common/task/state_machine.py +0 -56
  62. package/template/.zcode/hooks/runtime/scripts/common/task/task_utils.py +0 -187
  63. package/template/.zcode/hooks/runtime/scripts/run.py +0 -138
@@ -0,0 +1,111 @@
1
+ @echo off
2
+ rem cowork-flow run launcher (ZCode plugin edition)
3
+ rem Delegates to the plugin cache runtime — no local scripts/ required.
4
+ setlocal EnableExtensions
5
+
6
+ set "MIN_PYTHON_LABEL=Python 3.9+"
7
+ set "VERSION_CHECK=import sys; raise SystemExit(0 if sys.version_info >= (3, 9) else 1)"
8
+
9
+ set "VERSION_FILE=%~dp0.version"
10
+ set "VERSION="
11
+ for /f "usebackq delims=" %%A in ("%VERSION_FILE%") do set "VERSION=%%A"
12
+
13
+ if "%VERSION%"=="" (
14
+ echo Error: cannot determine cowork-flow version (.version missing) >&2
15
+ exit /b 127
16
+ )
17
+
18
+ set "ZCODE_BASE=%ZCODE_HOME%"
19
+ if "%ZCODE_BASE%"=="" set "ZCODE_BASE=%USERPROFILE%\.zcode"
20
+
21
+ set "RUNNER=%ZCODE_BASE%\cli\plugins\cache\zcode-plugins-official\cowork-flow\%VERSION%\hooks\runtime\scripts\run.py"
22
+
23
+ if not exist "%RUNNER%" (
24
+ echo Error: cowork-flow plugin runtime not found at: >&2
25
+ echo %RUNNER% >&2
26
+ echo Install the ZCode plugin or run 'cowork-flow init' for standalone. >&2
27
+ exit /b 127
28
+ )
29
+
30
+ rem --- Python interpreter discovery ----------------------------------------
31
+ set "SELECTED_PYTHON="
32
+ set "SELECTED_PYTHON_ARG="
33
+
34
+ call :select_python
35
+ if errorlevel 1 exit /b %ERRORLEVEL%
36
+
37
+ if not "%SELECTED_PYTHON_ARG%"=="" (
38
+ "%SELECTED_PYTHON%" "%SELECTED_PYTHON_ARG%" "%RUNNER%" %*
39
+ ) else (
40
+ "%SELECTED_PYTHON%" "%RUNNER%" %*
41
+ )
42
+ exit /b %ERRORLEVEL%
43
+
44
+ :candidate_is_valid
45
+ set "CANDIDATE_CMD=%~1"
46
+ set "CANDIDATE_ARG=%~2"
47
+
48
+ where "%CANDIDATE_CMD%" >nul 2>nul
49
+ if errorlevel 1 (
50
+ if not exist "%CANDIDATE_CMD%" exit /b 1
51
+ )
52
+
53
+ if not "%CANDIDATE_ARG%"=="" (
54
+ "%CANDIDATE_CMD%" "%CANDIDATE_ARG%" -c "%VERSION_CHECK%" >nul 2>nul
55
+ ) else (
56
+ "%CANDIDATE_CMD%" -c "%VERSION_CHECK%" >nul 2>nul
57
+ )
58
+ exit /b %ERRORLEVEL%
59
+
60
+ :select_explicit_python
61
+ set "ENV_NAME=%~1"
62
+ set "ENV_VALUE=%~2"
63
+
64
+ call :candidate_is_valid "%ENV_VALUE%" ""
65
+ if not errorlevel 1 (
66
+ set "SELECTED_PYTHON=%ENV_VALUE%"
67
+ set "SELECTED_PYTHON_ARG="
68
+ exit /b 0
69
+ )
70
+
71
+ echo Error: %ENV_NAME% does not point to a usable %MIN_PYTHON_LABEL% interpreter: %ENV_VALUE% 1>&2
72
+ echo Set %ENV_NAME% to an executable Python 3.9+ interpreter path. 1>&2
73
+ exit /b 127
74
+
75
+ :select_python
76
+ set "SELECTED_PYTHON="
77
+ set "SELECTED_PYTHON_ARG="
78
+
79
+ if not "%COWORK_FLOW_PYTHON%"=="" (
80
+ call :select_explicit_python "COWORK_FLOW_PYTHON" "%COWORK_FLOW_PYTHON%"
81
+ exit /b %ERRORLEVEL%
82
+ )
83
+
84
+ if not "%PYTHON%"=="" (
85
+ call :select_explicit_python "PYTHON" "%PYTHON%"
86
+ exit /b %ERRORLEVEL%
87
+ )
88
+
89
+ call :candidate_is_valid "python3" ""
90
+ if not errorlevel 1 (
91
+ set "SELECTED_PYTHON=python3"
92
+ exit /b 0
93
+ )
94
+
95
+ call :candidate_is_valid "python" ""
96
+ if not errorlevel 1 (
97
+ set "SELECTED_PYTHON=python"
98
+ exit /b 0
99
+ )
100
+
101
+ call :candidate_is_valid "py" "-3"
102
+ if not errorlevel 1 (
103
+ set "SELECTED_PYTHON=py"
104
+ set "SELECTED_PYTHON_ARG=-3"
105
+ exit /b 0
106
+ )
107
+
108
+ echo Error: %MIN_PYTHON_LABEL% is required, but no usable interpreter was found. 1>&2
109
+ echo Tried: COWORK_FLOW_PYTHON, PYTHON, python3, python, py -3. 1>&2
110
+ echo Set COWORK_FLOW_PYTHON=C:\Path\To\python.exe and retry. 1>&2
111
+ exit /b 127
@@ -61,18 +61,6 @@
61
61
  "source_excerpt": "L2(结构性)",
62
62
  "enforcement": "validate_rules"
63
63
  },
64
- {
65
- "id": "R-WF-006",
66
- "type": "phase_gate",
67
- "severity": "warn",
68
- "scope": "implement",
69
- "condition": "实现前必须有失败测试(行为变化场景)",
70
- "message": "Implementation without failing test for behavior change",
71
- "fix_hint": "先编写失败测试,再实现功能,确保测试在实现后通过",
72
- "source_file": ".cowork-flow/workflow.md",
73
- "source_excerpt": "先写能失败的测试",
74
- "enforcement": "tdd_evidence"
75
- },
76
64
  {
77
65
  "id": "R-WF-007",
78
66
  "type": "phase_gate",
@@ -86,63 +74,39 @@
86
74
  "enforcement": "validate_rules"
87
75
  },
88
76
  {
89
- "id": "R-AG-001",
90
- "type": "forbidden_action",
77
+ "id": "R-WF-008",
78
+ "type": "phase_gate",
91
79
  "severity": "block",
92
- "scope": "all",
93
- "condition": "子代理不派发其他代理",
94
- "message": "Subagent attempted to dispatch another agent",
95
- "fix_hint": "子代理是叶子执行者,不能派发、等待、列出或取消其他代理",
96
- "source_file": "AGENTS.md",
97
- "source_excerpt": "cowork-* 固定代理是叶子执行者",
98
- "enforcement": "host_contract"
80
+ "scope": "task_start",
81
+ "condition": "任务必须有 decision-anchor.md 且包含目标和验收标准章节",
82
+ "message": "Drift prevention: decision-anchor.md is missing or incomplete",
83
+ "fix_hint": "创建 <task-dir>/decision-anchor.md,至少包含 ## 目标和 ## 验收标准",
84
+ "source_file": ".cowork-flow/spec/contracts/decision-anchor.md",
85
+ "source_excerpt": "每个任务必须有决策锚点",
86
+ "enforcement": "validate_rules"
99
87
  },
100
88
  {
101
89
  "id": "R-AG-002",
102
90
  "type": "forbidden_action",
103
91
  "severity": "block",
104
- "scope": "all",
105
- "condition": "子代理不修改规格文件",
92
+ "scope": "implement",
93
+ "condition": "不修改规格文件",
106
94
  "message": "Subagent attempted to modify spec files",
107
95
  "fix_hint": "规格文件只能由主会话修改,子代理应专注于实现任务",
108
- "source_file": "AGENTS.md",
96
+ "source_file": ".cowork-flow/spec/contracts/subagent-dispatch.md",
109
97
  "source_excerpt": "cowork-* 固定代理是叶子执行者",
110
98
  "enforcement": "validate_implementation"
111
99
  },
112
- {
113
- "id": "R-AG-003",
114
- "type": "forbidden_action",
115
- "severity": "block",
116
- "scope": "all",
117
- "condition": "子代理不操作 Git",
118
- "message": "Subagent attempted to operate Git",
119
- "fix_hint": "Git 操作只能由主会话执行,子代理应专注于代码实现",
120
- "source_file": "AGENTS.md",
121
- "source_excerpt": "cowork-* 固定代理是叶子执行者",
122
- "enforcement": "host_contract"
123
- },
124
- {
125
- "id": "R-AG-004",
126
- "type": "forbidden_action",
127
- "severity": "block",
128
- "scope": "all",
129
- "condition": "子代理不提交/归档",
130
- "message": "Subagent attempted to commit or archive",
131
- "fix_hint": "提交和归档只能由主会话执行,子代理应专注于代码实现",
132
- "source_file": "AGENTS.md",
133
- "source_excerpt": "cowork-* 固定代理是叶子执行者",
134
- "enforcement": "host_contract"
135
- },
136
100
  {
137
101
  "id": "R-AG-005",
138
102
  "type": "forbidden_action",
139
103
  "severity": "block",
140
104
  "scope": "implement",
141
- "condition": "不添加未要求的功能",
142
- "message": "Unrequested feature introduced",
143
- "fix_hint": "只实现 PRD 中明确要求的功能,不添加额外功能",
144
- "source_file": "AGENTS.md",
145
- "source_excerpt": "不添加未要求的功能",
105
+ "condition": "不修改 implement.jsonl 允许范围外的文件",
106
+ "message": "Modified file not in implement.jsonl allowed list",
107
+ "fix_hint": "通过 ./.cowork-flow/run task add-context <dir> implement <path> <reason> 登记所有需要修改的文件",
108
+ "source_file": ".cowork-flow/spec/contracts/decision-anchor.md",
109
+ "source_excerpt": "implement.jsonl 是任务的权威文件白名单",
146
110
  "enforcement": "validate_implementation"
147
111
  },
148
112
  {
@@ -156,78 +120,6 @@
156
120
  "source_file": "AGENTS.md",
157
121
  "source_excerpt": "不为一次性代码做抽象",
158
122
  "enforcement": "validate_implementation"
159
- },
160
- {
161
- "id": "R-AG-007",
162
- "type": "forbidden_action",
163
- "severity": "block",
164
- "scope": "implement",
165
- "condition": "不顺手重构无关模块",
166
- "message": "Unrelated module refactored during implementation",
167
- "fix_hint": "只修改与当前任务直接相关的代码,不扩大改动范围",
168
- "source_file": "AGENTS.md",
169
- "source_excerpt": "不顺手重构无关模块",
170
- "enforcement": "host_contract"
171
- },
172
- {
173
- "id": "R-WF-008",
174
- "type": "phase_gate",
175
- "severity": "warn",
176
- "scope": "task_start",
177
- "condition": "L2 任务的关键决策应有 doubt-review 记录",
178
- "message": "Missing doubt-review for L2 non-trivial decision",
179
- "fix_hint": "在 <task>/doubt-review.md 中为每个非平凡决策完成 5-step doubt cycle",
180
- "source_file": ".cowork-flow/spec/contracts/subagent-dispatch.md",
181
- "source_excerpt": "doubt-review is a mandatory sub-step of before-dev gate for L2",
182
- "enforcement": "validate_rules"
183
- },
184
- {
185
- "id": "R-WF-009",
186
- "type": "phase_gate",
187
- "severity": "warn",
188
- "scope": "check",
189
- "condition": "Bug fix must have regression test that fails without the fix",
190
- "message": "Bug fix lacks regression test or modifies existing test to pass",
191
- "fix_hint": "Record red-green evidence in tdd.jsonl; test must fail without the fix and pass with the fix",
192
- "source_file": ".cowork-flow/workflow.md",
193
- "source_excerpt": "先写能失败的测试",
194
- "enforcement": "tdd_evidence"
195
- },
196
- {
197
- "id": "R-WF-010",
198
- "type": "phase_gate",
199
- "severity": "block",
200
- "scope": "all",
201
- "condition": "Batch mode requires explicit user approval before starting",
202
- "message": "Batch mode started without explicit user approval",
203
- "fix_hint": "用户必须在 writing-plans 结束时明确说 'approved' + 'auto' 才能进入批模式",
204
- "source_file": ".cowork-flow/workflow.md",
205
- "source_excerpt": "用户是流程的最终决策者",
206
- "enforcement": "host_contract"
207
- },
208
- {
209
- "id": "R-AG-008",
210
- "type": "forbidden_action",
211
- "severity": "warn",
212
- "scope": "check",
213
- "condition": "Simplification must preserve observable behavior",
214
- "message": "Simplification appears to change observable behavior",
215
- "fix_hint": "简化不应改变测试结果。如果测试需要修改才能通过,行为已变——还原或重写测试",
216
- "source_file": ".cowork-flow/workflow.md",
217
- "source_excerpt": "外科手术式改动: 只改必须改的",
218
- "enforcement": "metadata_only"
219
- },
220
- {
221
- "id": "R-WF-011",
222
- "type": "phase_gate",
223
- "severity": "warn",
224
- "scope": "all",
225
- "condition": "Archive should happen before final commit to avoid committing unreviewed code",
226
- "message": "Uncommitted changes detected. Archive the task first, then commit the archived result.",
227
- "fix_hint": "Run './.cowork-flow/run task archive <name>' first. Then commit the archive result.",
228
- "source_file": ".cowork-flow/workflow.md",
229
- "source_excerpt": "归档后再提交",
230
- "enforcement": "validate_rules"
231
123
  }
232
124
  ]
233
125
  }
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "enforcement": {
69
69
  "type": "string",
70
- "enum": ["validate_rules", "validate_implementation", "tdd_evidence", "host_contract", "metadata_only"],
71
- "description": "Runtime or contract surface responsible for enforcing or carrying this rule"
70
+ "enum": ["validate_rules", "validate_implementation"],
71
+ "description": "Runtime surface responsible for enforcing this rule. Must have a corresponding validator module."
72
72
  }
73
73
  },
74
74
  "additionalProperties": false
@@ -20,7 +20,7 @@ Use this after implementation and before `finish-work`.
20
20
 
21
21
  ## Steps
22
22
 
23
- 1. Read active task PRD, plan, and `check.jsonl`.
23
+ 1. Read active task decision-anchor.md, plan, and `check.jsonl`.
24
24
  2. Review `git diff --name-only` and `git diff`.
25
25
  3. Check contracts across caller/callee, command output, persisted state, templates, and docs.
26
26
  4. Verify spec compliance:
@@ -31,7 +31,7 @@ Use this after implementation and before `finish-work`.
31
31
  6. Review test intent: reject shallow tests that do not fail for meaningful behavior breaks.
32
32
  7. Run focused tests that would fail if the changed behavior broke.
33
33
  8. Run broader validation when the change touches shared runtime, templates, packaging, or public workflow.
34
- 9. Report `test_intent_review` with the key tests that defend PRD acceptance behavior.
34
+ 9. Report `test_intent_review` with the key tests that defend decision-anchor.md acceptance behavior.
35
35
  10. Report spec compliance: for each spec/ file checked, state pass/fail with evidence from the diff.
36
36
 
37
37
  ## Report
@@ -29,7 +29,7 @@ The following guidelines live in `.cowork-flow/spec/game/` and should be read be
29
29
  ## Usage
30
30
 
31
31
  1. Read the relevant spec/game/ guide(s) first.
32
- 2. Read the task PRD and implement.jsonl context.
32
+ 2. Read the task decision-anchor.md and implement.jsonl context.
33
33
  3. Proceed with implementation through `cowork-implement` or directly (depending on scope).
34
34
 
35
35
  ## When NOT to use
@@ -19,7 +19,7 @@ child must run the explicit shim bind before formal work.
19
19
  2. Read `.cowork-flow/workflow.md`.
20
20
  3. Read `.cowork-flow/config.yaml` for Codex dispatch hints and lifecycle hooks.
21
21
  4. Run `.cowork-flow/run resume` or `.\.cowork-flow\run.cmd resume` on Windows.
22
- 5. Read the active task PRD and JSONL indexes only when a task is active.
22
+ 5. Read the active task decision-anchor.md and JSONL indexes only when a task is active.
23
23
  6. Read relevant `.cowork-flow/spec/*/index.md` files before code changes.
24
24
 
25
25
  Report active task, workflow state, blockers, and the next phase.
@@ -32,7 +32,7 @@ state is loaded, apply the requirement clarification gate from
32
32
  `.cowork-flow/workflow.md`, then route to the next workflow phase; clear
33
33
  multi-step implementation uses `writing-plans` before fixed-agent dispatch.
34
34
 
35
- New requirements that are unclear, boundary-unclear, multi-approach, behavior-changing, or missing acceptance criteria use `brainstorming` before PRD, planning, or fixed-agent dispatch. Small repository changes proceed directly only when the goal, scope boundary, and acceptance criteria are already clear.
35
+ New requirements that are unclear, boundary-unclear, multi-approach, behavior-changing, or missing acceptance criteria use `brainstorming` before writing decision-anchor.md, planning, or fixed-agent dispatch. Small repository changes proceed directly only when the goal, scope boundary, and acceptance criteria are already clear.
36
36
 
37
37
  - Question-only work: answer directly.
38
38
  - Small repository change with clear goal/scope/acceptance: classify by `.cowork-flow/workflow.md`, create/start a task if required, then proceed.
@@ -9,7 +9,7 @@ Use this before editing behavior-changing code.
9
9
 
10
10
  ## Red-Green-Refactor
11
11
 
12
- 1. Map the task PRD acceptance criteria to stable IDs such as `AC-001`.
12
+ 1. Map the task decision-anchor.md acceptance criteria to stable IDs such as `AC-001`.
13
13
  2. Write the smallest meaningful failing test first.
14
14
  3. Run the red command and confirm it fails because the target behavior is missing or wrong.
15
15
  4. Implement the smallest change that makes the behavior pass.
@@ -38,7 +38,7 @@ Record TDD proof in `<task>/tdd.jsonl`. Each evidence line is one JSON object:
38
38
  }
39
39
  ```
40
40
 
41
- Every evidence record must map to a PRD `acceptanceId`. The red failure must be about the target behavior, not syntax, import, environment, fixture, or setup failure.
41
+ Every evidence record must map to a decision-anchor.md `acceptanceId`. The red failure must be about the target behavior, not syntax, import, environment, fixture, or setup failure.
42
42
 
43
43
  `testName` must resolve to the exact behavior test in `testFile`. Use one of:
44
44
  `test_method`, `ClassName.test_method`, or `module.ClassName.test_method`.
@@ -13,7 +13,7 @@ Before writing a plan, confirm the request has an executable scope, acceptance c
13
13
 
14
14
  Read:
15
15
 
16
- - Active task PRD.
16
+ - Active task decision-anchor.md.
17
17
  - Relevant change spec/design files.
18
18
  - Relevant `.cowork-flow/spec/` indexes and target specs.
19
19
  - Files that define the contracts being changed.
@@ -64,7 +64,7 @@ Start with:
64
64
  - Include a failing test before implementation when behavior can be tested.
65
65
  - Do not add shallow tests just to satisfy process. Avoid tests that only assert existence, mirror implementation details, count mocks without behavior, or snapshot empty structure.
66
66
  - For complex problems, test depth first: cover invariants, cross-layer contracts, state transitions, error boundaries, and real regression paths before narrow unit cases.
67
- - Map each behavior-changing test to a stable PRD acceptance ID and note where `tdd.jsonl` will record the red-green evidence.
67
+ - Map each behavior-changing test to a stable decision-anchor.md acceptance ID and note where `tdd.jsonl` will record the red-green evidence.
68
68
  - Avoid placeholders such as TODO, TBD, "handle edge cases", or "write tests".
69
69
  - Keep root/template parity explicit when both copies exist.
70
70
 
@@ -74,7 +74,7 @@ Start with:
74
74
  |---|---|
75
75
  | "这个 task 太小了,可以合并" | task 粒度由 acceptance criteria 决定,不由行数决定。AC 不可拆分时应合并,否则独立。 |
76
76
  | "先写个粗 plan,实现时再细化" | 粗 plan = 实现时没有约束。没有约束的实现 = 范围蔓延或返工。 |
77
- | "跳过 plan 直接开始反正有了 PRD" | PRD 定义"做什么",plan 定义"怎么做和按什么顺序做"。缺少 plan 的任务在 midway 发现依赖错误时返工成本翻倍。 |
77
+ | "跳过 plan 直接开始反正有了 decision-anchor" | decision-anchor.md 定义"做什么",plan 定义"怎么做和按什么顺序做"。缺少 plan 的任务在 midway 发现依赖错误时返工成本翻倍。 |
78
78
  | "这个 task 不需要 verify 命令" | 没有 verify = 没有完成信号。每个 task 必须有可运行的验证命令。 |
79
79
 
80
80
  ## Plan Approval Gate
@@ -110,7 +110,7 @@ Execution strategy guide:
110
110
 
111
111
  Before handoff:
112
112
 
113
- 1. Confirm every PRD acceptance criterion maps to a plan step.
113
+ 1. Confirm every decision-anchor.md acceptance criterion maps to a plan step.
114
114
  2. Search the plan for placeholders.
115
115
  3. Check names, paths, command syntax, and expected outputs.
116
116
  4. Record remaining risks or blockers.
@@ -1,58 +0,0 @@
1
- #!/bin/sh
2
- # cowork-flow run launcher (ZCode plugin edition)
3
- # Runs commands using the plugin's bundled Python runtime.
4
- set -u
5
-
6
- MIN_PYTHON_LABEL="Python 3.9+"
7
- VERSION_CHECK='import sys; raise SystemExit(0 if sys.version_info >= (3, 9) else 1)'
8
- WORKFLOW_DIR=$(CDPATH= cd "$(dirname "$0")" && pwd) || exit 1
9
-
10
- # Plugin cache runtime (resolved relative to this script)
11
- # Path: hooks/runtime/run -> hooks/runtime/scripts/run.py
12
- RUNTIME_SCRIPTS="$WORKFLOW_DIR/scripts"
13
-
14
- if [ ! -d "$RUNTIME_SCRIPTS" ]; then
15
- echo "Error: cowork-flow runtime not found. Expected at: $RUNTIME_SCRIPTS" >&2
16
- exit 127
17
- fi
18
-
19
- RUNNER_SCRIPT="$RUNTIME_SCRIPTS/run.py"
20
- if [ ! -f "$RUNNER_SCRIPT" ]; then
21
- echo "Error: run.py not found in runtime: $RUNTIME_SCRIPTS" >&2
22
- exit 127
23
- fi
24
-
25
- candidate_is_valid() {
26
- command -v "$1" >/dev/null 2>&1 || return 1
27
- "$1" -c "$VERSION_CHECK" >/dev/null 2>&1
28
- }
29
-
30
- select_python() {
31
- if candidate_is_valid "python3"; then
32
- SELECTED_PYTHON=python3
33
- return 0
34
- fi
35
- if candidate_is_valid "python"; then
36
- SELECTED_PYTHON=python
37
- return 0
38
- fi
39
- if candidate_is_valid "py"; then
40
- SELECTED_PYTHON=py
41
- SELECTED_PYTHON_ARG=-3
42
- return 0
43
- fi
44
- echo "Error: $MIN_PYTHON_LABEL required but not found." >&2
45
- exit 127
46
- }
47
-
48
- select_python
49
-
50
- SELECTED_PYTHON_ARG=${SELECTED_PYTHON_ARG:-}
51
-
52
- if [ -n "$SELECTED_PYTHON_ARG" ]; then
53
- export PYTHONPATH="$RUNTIME_SCRIPTS${PYTHONPATH:+:$PYTHONPATH}"
54
- exec "$SELECTED_PYTHON" "$SELECTED_PYTHON_ARG" "$RUNNER_SCRIPT" "$@"
55
- fi
56
-
57
- export PYTHONPATH="$RUNTIME_SCRIPTS${PYTHONPATH:+:$PYTHONPATH}"
58
- exec "$SELECTED_PYTHON" "$RUNNER_SCRIPT" "$@"
@@ -1,37 +0,0 @@
1
- @echo off
2
- setlocal EnableExtensions
3
-
4
- set "MIN_PYTHON_LABEL=Python 3.9+"
5
- set "VERSION_CHECK=import sys; raise SystemExit(0 if sys.version_info >= (3, 9) else 1)"
6
- set "WORKFLOW_DIR=%~dp0"
7
-
8
- set "RUNTIME_SCRIPTS=%WORKFLOW_DIR%scripts"
9
-
10
- if not exist "%RUNTIME_SCRIPTS%\run.py" (
11
- echo Error: cowork-flow runtime not found. >&2
12
- exit /b 127
13
- )
14
-
15
- where python3 >nul 2>nul
16
- if not errorlevel 1 (
17
- set "PYTHONPATH=%RUNTIME_SCRIPTS%;%PYTHONPATH%"
18
- python3 "%RUNTIME_SCRIPTS%\run.py" %*
19
- exit /b %ERRORLEVEL%
20
- )
21
-
22
- where python >nul 2>nul
23
- if not errorlevel 1 (
24
- set "PYTHONPATH=%RUNTIME_SCRIPTS%;%PYTHONPATH%"
25
- python "%RUNTIME_SCRIPTS%\run.py" %*
26
- exit /b %ERRORLEVEL%
27
- )
28
-
29
- where py >nul 2>nul
30
- if not errorlevel 1 (
31
- set "PYTHONPATH=%RUNTIME_SCRIPTS%;%PYTHONPATH%"
32
- py -3 "%RUNTIME_SCRIPTS%\run.py" %*
33
- exit /b %ERRORLEVEL%
34
- )
35
-
36
- echo Error: %MIN_PYTHON_LABEL% required but not found. >&2
37
- exit /b 127
@@ -1 +0,0 @@
1
- """Command entrypoints for cowork-flow."""
@@ -1,10 +0,0 @@
1
- """Allow command scripts to import the sibling common package when run directly."""
2
-
3
- from __future__ import annotations
4
-
5
- import sys
6
- from pathlib import Path
7
-
8
- SCRIPTS_DIR = Path(__file__).resolve().parents[1]
9
- if str(SCRIPTS_DIR) not in sys.path:
10
- sys.path.insert(0, str(SCRIPTS_DIR))