cowork-flow 0.0.28 → 0.0.30
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.
- package/README.md +46 -12
- package/package.json +2 -1
- package/src/commands/init.js +1 -1
- package/src/commands/update.js +2 -4
- package/src/lib/copy-template.js +55 -5
- package/src/lib/platforms.js +0 -3
- package/template/.agents/skills/before-dev/SKILL.md +132 -20
- package/template/.agents/skills/check/SKILL.md +10 -5
- package/template/.agents/skills/game-design/SKILL.md +39 -0
- package/template/.claude/agents/cowork-check.md +31 -21
- package/template/.claude/agents/cowork-implement.md +31 -170
- package/template/.claude/agents/cowork-research.md +18 -14
- package/template/.claude/hooks/inject-workflow-state.py +3 -14
- package/template/.claude/settings.json +2 -2
- package/template/.claude/skills/before-dev/SKILL.md +132 -20
- package/template/.claude/skills/check/SKILL.md +10 -5
- package/template/.claude/skills/game-design/SKILL.md +39 -0
- package/template/.codex/hooks/inject-workflow-state.py +3 -12
- package/template/.cowork-flow/.developer +2 -0
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/adapters/claude-code/adapter.yaml +1 -2
- package/template/.cowork-flow/adapters/codex/adapter.yaml +0 -1
- package/template/.cowork-flow/adapters/opencode/adapter.yaml +0 -1
- package/template/.cowork-flow/scripts/commands/__init__.py +1 -0
- package/template/.cowork-flow/scripts/commands/_bootstrap.py +10 -0
- package/template/.cowork-flow/scripts/{add_session.py → commands/add_session.py} +8 -10
- package/template/.cowork-flow/scripts/{change.py → commands/change.py} +6 -2
- package/template/.cowork-flow/scripts/{doctor.py → commands/doctor.py} +14 -44
- package/template/.cowork-flow/scripts/{get_context.py → commands/get_context.py} +5 -1
- package/template/.cowork-flow/scripts/{get_developer.py → commands/get_developer.py} +6 -2
- package/template/.cowork-flow/scripts/{init_developer.py → commands/init_developer.py} +6 -2
- package/template/.cowork-flow/scripts/{party_mode_v2.py → commands/party_mode_v2.py} +6 -2
- package/template/.cowork-flow/scripts/{resume.py → commands/resume.py} +6 -2
- package/template/.cowork-flow/scripts/{subagent.py → commands/subagent.py} +36 -9
- package/template/.cowork-flow/scripts/{task.py → commands/task.py} +112 -62
- package/template/.cowork-flow/scripts/common/__init__.py +1 -1
- package/template/.cowork-flow/scripts/common/core/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/{config.py → core/config.py} +10 -2
- package/template/.cowork-flow/scripts/common/{developer.py → core/developer.py} +1 -1
- package/template/.cowork-flow/scripts/common/core/files.py +37 -0
- package/template/.cowork-flow/scripts/common/gates/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/{coding_standards.py → gates/coding_standards.py} +3 -2
- package/template/.cowork-flow/scripts/common/{tdd_evidence.py → gates/tdd_evidence.py} +78 -12
- package/template/.cowork-flow/scripts/common/{test_intent.py → gates/test_intent.py} +2 -1
- package/template/.cowork-flow/scripts/common/{validate_coding_standards.py → gates/validate_coding_standards.py} +1 -1
- package/template/.cowork-flow/scripts/common/{validate_rules.py → gates/validate_rules.py} +2 -2
- package/template/.cowork-flow/scripts/common/git/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/{git_context.py → git/git_context.py} +3 -3
- package/template/.cowork-flow/scripts/common/task/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/{active_task.py → task/active_task.py} +24 -7
- package/template/.cowork-flow/scripts/common/{readiness.py → task/readiness.py} +1 -1
- package/template/.cowork-flow/scripts/common/{state_machine.py → task/state_machine.py} +1 -2
- package/template/.cowork-flow/scripts/common/{task_utils.py → task/task_utils.py} +2 -2
- package/template/.cowork-flow/scripts/run.py +32 -25
- package/template/.cowork-flow/spec/backend/encoding-guidelines.md +27 -0
- package/template/.cowork-flow/spec/backend/index.md +1 -0
- package/template/.cowork-flow/spec/contracts/index.md +0 -1
- package/template/.cowork-flow/spec/contracts/workflow-state-templates.md +13 -7
- package/template/.cowork-flow/spec/game/asset-pipeline.md +53 -0
- package/template/.cowork-flow/spec/game/engine-guidelines.md +43 -0
- package/template/.cowork-flow/spec/game/index.md +23 -0
- package/template/.cowork-flow/spec/game/multiplayer-guidelines.md +44 -0
- package/template/.cowork-flow/spec/game/performance-guidelines.md +58 -0
- package/template/.cowork-flow/spec/runtime/contract-registry.json +13 -12
- package/template/.cowork-flow/spec/runtime/rules.json +17 -17
- package/template/.cowork-flow/spec/schemas/adapter.schema.json +1 -5
- package/template/.cowork-flow/workflow.md +8 -8
- package/template/.opencode/agents/cowork-check.md +3 -3
- package/template/.opencode/agents/cowork-implement.md +3 -3
- package/template/.opencode/agents/cowork-research.md +3 -3
- package/template/.opencode/plugins/cowork-flow.js +0 -9
- package/template/AGENTS.md +86 -61
- package/template/.cowork-flow/scripts/common/files.py +0 -24
- package/template/.cowork-flow/scripts/project_context.py +0 -230
- package/template/.cowork-flow/spec/contracts/entry-contract.md +0 -45
- /package/template/.cowork-flow/scripts/common/{execution_context.py → core/execution_context.py} +0 -0
- /package/template/.cowork-flow/scripts/common/{paths.py → core/paths.py} +0 -0
- /package/template/.cowork-flow/scripts/common/{gates.py → gates/gates.py} +0 -0
- /package/template/.cowork-flow/scripts/common/{validate_implementation.py → gates/validate_implementation.py} +0 -0
- /package/template/.cowork-flow/scripts/common/{git_snapshot.py → git/git_snapshot.py} +0 -0
- /package/template/.cowork-flow/scripts/common/{archive_utils.py → task/archive_utils.py} +0 -0
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ OpenCode 项目级固定 agent、slash command 和系统上下文注入插件。
|
|
|
99
99
|
npx cowork-flow init ./my-project --platform codex
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
`init` 会显式要求平台和开发者身份。平台可选 `codex`、`opencode`、`claude-code`、`all
|
|
102
|
+
`init` 会显式要求平台和开发者身份。平台可选 `codex`、`opencode`、`claude-code`、`all`。交互式终端会提示输入;脚本或 CI 请传入:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
105
|
npx cowork-flow init ./my-project --platform codex --developer <your-name>
|
|
@@ -134,7 +134,7 @@ npx cowork-flow --help
|
|
|
134
134
|
cowork-flow init ./my-project --platform codex
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
`init` 会直接复制模板中的通用 `.cowork-flow/`,并按 `--platform` 只复制对应 host 资产:`codex` 复制 `.codex/`、`.agents/skills/` 与 `.cowork-flow/adapters/codex/`,`opencode` 复制 `.opencode/`、`.agents/skills/` 与 `.cowork-flow/adapters/opencode/`,`claude-code` 复制 `CLAUDE.md`、`.claude/`(含 `.claude/settings.json`、`.claude/hooks/`、`.claude/skills/`)与 `.cowork-flow/adapters/claude-code/`,不复制 `.agents/skills/`。`all` 或 `--platform codex,opencode,claude-code` 同时复制三者和 `.agents/skills
|
|
137
|
+
`init` 会直接复制模板中的通用 `.cowork-flow/`,并按 `--platform` 只复制对应 host 资产:`codex` 复制 `.codex/`、`.agents/skills/` 与 `.cowork-flow/adapters/codex/`,`opencode` 复制 `.opencode/`、`.agents/skills/` 与 `.cowork-flow/adapters/opencode/`,`claude-code` 复制 `CLAUDE.md`、`.claude/`(含 `.claude/settings.json`、`.claude/hooks/`、`.claude/skills/`)与 `.cowork-flow/adapters/claude-code/`,不复制 `.agents/skills/`。`all` 或 `--platform codex,opencode,claude-code` 同时复制三者和 `.agents/skills/`。它还会初始化 `.cowork-flow/.developer` 与 `.cowork-flow/workspace/<developer>/`。交互式终端会先显示 checkbox 多选界面选择平台,再提示开发者名称;非交互式环境必须传入 `--platform <codex|opencode|claude-code|all>` 与 `--developer <name>`。`init` 不会复制额外技能包。
|
|
138
138
|
|
|
139
139
|
初始化到当前项目:
|
|
140
140
|
|
|
@@ -185,6 +185,16 @@ cowork-flow sync . --dry-run
|
|
|
185
185
|
下面示例使用 macOS / Linux 写法;Windows 原生命令行中把
|
|
186
186
|
`./.cowork-flow/run` 替换为 `.\.cowork-flow\run.cmd`。
|
|
187
187
|
|
|
188
|
+
当前主流程以 `.cowork-flow/workflow.md` 为准。默认路径是:
|
|
189
|
+
|
|
190
|
+
```text
|
|
191
|
+
changes -> brainstorming -> read spec -> plan -> tasks -> implement -> check -> complete
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
L0 文档、格式、小范围重构或测试补充可简化为
|
|
195
|
+
`brainstorming -> read spec -> implement -> check -> complete`;L1/L2 在完成后继续
|
|
196
|
+
`archive -> add session`。
|
|
197
|
+
|
|
188
198
|
初始化或查看开发者身份:
|
|
189
199
|
|
|
190
200
|
```bash
|
|
@@ -196,7 +206,6 @@ cowork-flow sync . --dry-run
|
|
|
196
206
|
|
|
197
207
|
```bash
|
|
198
208
|
./.cowork-flow/run get-context
|
|
199
|
-
./.cowork-flow/run project-context refresh
|
|
200
209
|
./.cowork-flow/run task list
|
|
201
210
|
./.cowork-flow/run task next
|
|
202
211
|
```
|
|
@@ -216,18 +225,35 @@ cowork-flow sync . --dry-run
|
|
|
216
225
|
./.cowork-flow/run task start <task-dir>
|
|
217
226
|
```
|
|
218
227
|
|
|
219
|
-
`task next`
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
`project-context refresh` 会创建或刷新 `.cowork-flow/project-context.md`。生成块由
|
|
224
|
-
本地项目文件确定,`Manual Notes` 区保留人工补充;该文件是项目索引,不替代
|
|
225
|
-
`AGENTS.md`、`.cowork-flow/workflow.md` 或 `.cowork-flow/spec/`。
|
|
228
|
+
`task next` 只读,不推进状态。它根据当前会话任务和 `task.json.status`
|
|
229
|
+
报告当前任务、阻塞项和下一条安全命令;主会话在启动工作、派发固定代理、
|
|
230
|
+
进入检查、归档或记录 session 前都应先看它。
|
|
226
231
|
|
|
227
232
|
L2 任务的 readiness gate 会在 `task start` 前阻塞缺失的 proposal/spec/design、
|
|
228
233
|
计划、任务链接、边界、假设、验收标准或 verification commands;同一 blocker
|
|
229
234
|
会出现在 `task next` 输出中。
|
|
230
235
|
|
|
236
|
+
任务状态流转:
|
|
237
|
+
|
|
238
|
+
```mermaid
|
|
239
|
+
stateDiagram-v2
|
|
240
|
+
[*] --> NoTask
|
|
241
|
+
state "无当前任务" as NoTask
|
|
242
|
+
state "planning" as Planning
|
|
243
|
+
state "in_progress" as InProgress
|
|
244
|
+
state "review" as Review
|
|
245
|
+
state "completed" as Completed
|
|
246
|
+
state "已归档" as Archived
|
|
247
|
+
|
|
248
|
+
NoTask --> Planning: task create
|
|
249
|
+
Planning --> InProgress: task start
|
|
250
|
+
InProgress --> Review: task review
|
|
251
|
+
Review --> Completed: task complete
|
|
252
|
+
Completed --> Archived: task archive
|
|
253
|
+
Completed --> NoTask: task finish
|
|
254
|
+
Archived --> [*]
|
|
255
|
+
```
|
|
256
|
+
|
|
231
257
|
任务状态由阶段命令推进,`task next` 只读取状态:
|
|
232
258
|
|
|
233
259
|
| 阶段 | 命令 | `task.json.status` |
|
|
@@ -236,11 +262,13 @@ L2 任务的 readiness gate 会在 `task start` 前阻塞缺失的 proposal/spec
|
|
|
236
262
|
| 开始执行 | `task start <task-dir>` | `in_progress` |
|
|
237
263
|
| 进入检查 | `task review [task-dir]` | `review` |
|
|
238
264
|
| 检查完成 | `task complete [task-dir]` | `completed` |
|
|
265
|
+
| 归档任务 | `task archive <task-name>` | 归档副本保持 `completed` |
|
|
239
266
|
| 清会话指针 | `task finish` | 不改变状态 |
|
|
240
267
|
|
|
241
268
|
执行 plan 时使用固定 cowork agents:
|
|
242
269
|
|
|
243
|
-
|
|
270
|
+
主会话负责创建/启动任务、维护计划与收口验证;实现和检查默认通过当前 Host Adapter
|
|
271
|
+
派发给固定角色 agent。固定 agent 是叶子执行者,不能再派发其他 agent,也不能替代主会话完成归档、记录 session 或提交。
|
|
244
272
|
|
|
245
273
|
```text
|
|
246
274
|
./.cowork-flow/run subagent init --role implement --agent-type cowork-implement --execution-task-dir <task-dir> --title "<title>"
|
|
@@ -255,7 +283,7 @@ cowork_host_context_key: <host_context_key>
|
|
|
255
283
|
|
|
256
284
|
子代理首步执行 `./.cowork-flow/run subagent bind <runtime_context_id> <host_context_key>`;主会话验收前必须确认 runtime context 中 `status=bound` 且 `bound_context_key` 匹配。默认角色为 `cowork-research`、`cowork-implement`、`cowork-check`,任务上下文来自已绑定 runtime context,而不是 prompt 形状。
|
|
257
285
|
|
|
258
|
-
|
|
286
|
+
Host hook/plugin 启用后,每轮会自动注入 workflow state,其中包含入口分类、当前任务、状态来源和下一步流程提示。状态文本来自 `.cowork-flow/spec/contracts/workflow-state-templates.md`;`workflow.md` 只描述流程,不内联状态片段。hook 不替代主会话验收;它只负责把 task 状态和 workflow gate 放进上下文。
|
|
259
287
|
|
|
260
288
|
记录 session:
|
|
261
289
|
|
|
@@ -314,3 +342,9 @@ npm run release -- prerelease
|
|
|
314
342
|
```
|
|
315
343
|
|
|
316
344
|
脚本会在任一步骤失败时停止后续发布动作。CI 仍会运行 Node CLI 测试、npm pack 内容检查和现有 Python 模板测试;GitHub Actions 的 `Publish npm Package` workflow 仍需要在仓库 secrets 中配置 `NPM_TOKEN`。
|
|
345
|
+
|
|
346
|
+
可选集成测试位于 `tests/integration/`,依赖 Python 环境中的 `pytest`。它不属于默认发布链;需要验证时运行:
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
npm run test:integration
|
|
350
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cowork-flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "CLI for installing and maintaining cowork-flow collaboration templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "node --test",
|
|
19
19
|
"test:template": "node scripts/run-template-tests.js",
|
|
20
|
+
"test:integration": "node scripts/run-integration-tests.js",
|
|
20
21
|
"pack:check": "node scripts/pack-check.js",
|
|
21
22
|
"test:all": "npm test && npm run test:template && npm run pack:check",
|
|
22
23
|
"release": "sh scripts/release.sh"
|
package/src/commands/init.js
CHANGED
|
@@ -195,7 +195,7 @@ function initialIndexContent(name) {
|
|
|
195
195
|
- Sessions are appended to the journal file
|
|
196
196
|
- A new journal file is created automatically after the current file exceeds 2000 lines
|
|
197
197
|
- Use \`add_session.py\` to record sessions
|
|
198
|
-
- New records use English text;
|
|
198
|
+
- New records use English text; existing records can remain as they are
|
|
199
199
|
`;
|
|
200
200
|
}
|
|
201
201
|
|
package/src/commands/update.js
CHANGED
|
@@ -6,10 +6,8 @@ import {
|
|
|
6
6
|
} from '../lib/package-info.js';
|
|
7
7
|
|
|
8
8
|
function validateUpdateArgs(args) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new Error(`Unknown update option: ${arg}`);
|
|
12
|
-
}
|
|
9
|
+
if (args.length > 0) {
|
|
10
|
+
throw new Error(`Unknown update option: ${args[0]}`);
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
|
package/src/lib/copy-template.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { constants } from 'node:fs';
|
|
2
|
-
import { access, chmod, copyFile, mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { access, chmod, copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join, relative } from 'node:path';
|
|
4
4
|
|
|
5
5
|
import { templateRoot } from './paths.js';
|
|
@@ -47,14 +47,17 @@ export async function buildInitPlan(targetDir, options = {}) {
|
|
|
47
47
|
continue;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const templatePath = toTemplatePath(file);
|
|
51
|
+
if (templatePath === '.cowork-flow/.version') {
|
|
51
52
|
continue;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const source = join(templateRoot, file);
|
|
55
56
|
const destination = join(targetDir, file);
|
|
56
57
|
const exists = await pathExists(destination);
|
|
57
|
-
const action = exists
|
|
58
|
+
const action = exists
|
|
59
|
+
? (options.force && templatePath !== '.cowork-flow/.developer' ? 'update' : 'skip')
|
|
60
|
+
: 'create';
|
|
58
61
|
actions.push({ action, source, destination, relativePath: file });
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -99,6 +102,41 @@ const SAFE_SYNC_FILES = new Set([
|
|
|
99
102
|
'.cowork-flow/spec/contracts/workflow-state-templates.md'
|
|
100
103
|
]);
|
|
101
104
|
|
|
105
|
+
const OBSOLETE_SYNC_FILES = new Set([
|
|
106
|
+
'.cowork-flow/project-context.md',
|
|
107
|
+
'.cowork-flow/scripts/add_session.py',
|
|
108
|
+
'.cowork-flow/scripts/change.py',
|
|
109
|
+
'.cowork-flow/scripts/doctor.py',
|
|
110
|
+
'.cowork-flow/scripts/get_context.py',
|
|
111
|
+
'.cowork-flow/scripts/get_developer.py',
|
|
112
|
+
'.cowork-flow/scripts/init_developer.py',
|
|
113
|
+
'.cowork-flow/scripts/party_mode_v2.py',
|
|
114
|
+
'.cowork-flow/scripts/project_context.py',
|
|
115
|
+
'.cowork-flow/scripts/resume.py',
|
|
116
|
+
'.cowork-flow/scripts/subagent.py',
|
|
117
|
+
'.cowork-flow/scripts/task.py',
|
|
118
|
+
'.cowork-flow/scripts/common/active_task.py',
|
|
119
|
+
'.cowork-flow/scripts/common/archive_utils.py',
|
|
120
|
+
'.cowork-flow/scripts/common/coding_standards.py',
|
|
121
|
+
'.cowork-flow/scripts/common/config.py',
|
|
122
|
+
'.cowork-flow/scripts/common/developer.py',
|
|
123
|
+
'.cowork-flow/scripts/common/execution_context.py',
|
|
124
|
+
'.cowork-flow/scripts/common/files.py',
|
|
125
|
+
'.cowork-flow/scripts/common/gates.py',
|
|
126
|
+
'.cowork-flow/scripts/common/git_context.py',
|
|
127
|
+
'.cowork-flow/scripts/common/git_snapshot.py',
|
|
128
|
+
'.cowork-flow/scripts/common/paths.py',
|
|
129
|
+
'.cowork-flow/scripts/common/readiness.py',
|
|
130
|
+
'.cowork-flow/scripts/common/state_machine.py',
|
|
131
|
+
'.cowork-flow/scripts/common/task_utils.py',
|
|
132
|
+
'.cowork-flow/scripts/common/tdd_evidence.py',
|
|
133
|
+
'.cowork-flow/scripts/common/test_intent.py',
|
|
134
|
+
'.cowork-flow/scripts/common/validate_coding_standards.py',
|
|
135
|
+
'.cowork-flow/scripts/common/validate_implementation.py',
|
|
136
|
+
'.cowork-flow/scripts/common/validate_rules.py',
|
|
137
|
+
'.cowork-flow/spec/contracts/entry-contract.md'
|
|
138
|
+
]);
|
|
139
|
+
|
|
102
140
|
const COWORK_FLOW_START = '<!-- COWORK-FLOW:START -->';
|
|
103
141
|
const COWORK_FLOW_END = '<!-- COWORK-FLOW:END -->';
|
|
104
142
|
|
|
@@ -200,6 +238,13 @@ export async function buildSyncPlan(targetDir, options = {}) {
|
|
|
200
238
|
}
|
|
201
239
|
}
|
|
202
240
|
|
|
241
|
+
for (const file of OBSOLETE_SYNC_FILES) {
|
|
242
|
+
const destination = join(targetDir, file);
|
|
243
|
+
if (await pathExists(destination)) {
|
|
244
|
+
actions.push({ action: 'delete', source: null, destination, relativePath: file });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
203
248
|
actions.push({
|
|
204
249
|
action: 'update',
|
|
205
250
|
source: null,
|
|
@@ -226,7 +271,7 @@ export async function detectInstalledPlatforms(targetDir) {
|
|
|
226
271
|
}
|
|
227
272
|
|
|
228
273
|
export function summarizePlan(actions, dryRun = false) {
|
|
229
|
-
const counts = { create: 0, update: 0, skip: 0, protected: 0 };
|
|
274
|
+
const counts = { create: 0, update: 0, skip: 0, protected: 0, delete: 0 };
|
|
230
275
|
for (const action of actions) {
|
|
231
276
|
counts[action.action] += 1;
|
|
232
277
|
}
|
|
@@ -234,7 +279,8 @@ export function summarizePlan(actions, dryRun = false) {
|
|
|
234
279
|
const prefix = dryRun ? 'dry-run ' : '';
|
|
235
280
|
const createLabel = dryRun ? 'would-create' : 'created';
|
|
236
281
|
const updateLabel = dryRun ? 'would-update' : 'updated';
|
|
237
|
-
|
|
282
|
+
const deleteLabel = dryRun ? 'would-delete' : 'deleted';
|
|
283
|
+
return `${prefix}${createLabel}=${counts.create} ${updateLabel}=${counts.update} ${deleteLabel}=${counts.delete} skipped=${counts.skip} protected=${counts.protected}\n`;
|
|
238
284
|
}
|
|
239
285
|
|
|
240
286
|
export async function applyPlan(actions, options = {}) {
|
|
@@ -246,6 +292,10 @@ export async function applyPlan(actions, options = {}) {
|
|
|
246
292
|
if (item.action === 'skip' || item.action === 'protected') {
|
|
247
293
|
continue;
|
|
248
294
|
}
|
|
295
|
+
if (item.action === 'delete') {
|
|
296
|
+
await rm(item.destination, { force: true });
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
249
299
|
|
|
250
300
|
await mkdir(dirname(item.destination), { recursive: true });
|
|
251
301
|
if (item.content !== undefined) {
|
package/src/lib/platforms.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export const SUPPORTED_PLATFORMS = ['codex', 'opencode', 'claude-code'];
|
|
2
2
|
|
|
3
|
-
const LEGACY_BOTH_PLATFORMS = ['codex', 'opencode'];
|
|
4
|
-
|
|
5
3
|
const PLATFORM_ALIASES = new Map([
|
|
6
4
|
['all', SUPPORTED_PLATFORMS],
|
|
7
|
-
['both', LEGACY_BOTH_PLATFORMS],
|
|
8
5
|
['codex', ['codex']],
|
|
9
6
|
['opencode', ['opencode']],
|
|
10
7
|
['claude', ['claude-code']],
|
|
@@ -1,32 +1,144 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: before-dev
|
|
3
|
-
description:
|
|
3
|
+
description: MANDATORY GATE — call before ANY code change, file edit, or subagent dispatch. Checks workflow state and either allows or blocks the action.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Before Dev
|
|
6
|
+
# Before Dev — 编码前工作流门禁
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
This skill is the enforcement point for the cowork-flow workflow. You MUST invoke it
|
|
9
|
+
before any file edit, code change, or subagent dispatch. It reads the current
|
|
10
|
+
`<workflow-state>` block and decides whether to allow or block.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
This skill is NOT a checklist or context loader — it is a gate. Do not proceed to
|
|
13
|
+
code changes without passing through this gate.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
3. Active task `prd.md`
|
|
15
|
-
4. Active task `implement.jsonl`
|
|
16
|
-
5. Relevant `.cowork-flow/spec/*/index.md`
|
|
17
|
-
6. Any exact files named by the task, plan, or user
|
|
18
|
-
7. If the task changes behavior, locate or create `tdd.jsonl` evidence before implementation.
|
|
15
|
+
**豁免**: 只读问答、纯查询命令(`git status`、`task next`、`task current`)、
|
|
16
|
+
用户明确说"直接改,跳过流程"。
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 1: 读取当前 workflow 状态
|
|
21
|
+
|
|
22
|
+
从上下文中读取 `<workflow-state>` 块。关注 `Status` 和 `Source` 字段。
|
|
23
|
+
|
|
24
|
+
如果上下文中**没有** `<workflow-state>` 块,说明当前平台的 hook/plugin 未向此上下文注入状态。
|
|
25
|
+
此时检查用户 prompt 中是否包含 `cowork_runtime_context_id`:
|
|
26
|
+
|
|
27
|
+
- **有 `cowork_runtime_context_id`** → 你是通过 prompt transport 接收 runtime context 的子代理,但平台 hook 未注入 workflow-state。直接进入下方的 `delegated_subtask` 分支,执行 bind、加载任务、完成叶子工作。
|
|
28
|
+
- **无 `cowork_runtime_context_id`** → 无法判断当前上下文身份。
|
|
29
|
+
|
|
30
|
+
回复:
|
|
31
|
+
```
|
|
32
|
+
无法从上下文中确定 workflow 状态(无 <workflow-state> 块,无 runtime context ID)。
|
|
33
|
+
请运行 resume 恢复任务状态,或运行 task start 创建新任务。
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
这是 fail-closed 回退——只在 Codex/OpenCode hook 正常工作时永不触发。
|
|
37
|
+
|
|
38
|
+
## Step 2: 按状态执行
|
|
39
|
+
|
|
40
|
+
### Status = `no_task`
|
|
41
|
+
|
|
42
|
+
**⛔ 阻断。** 当前没有活动任务。
|
|
43
|
+
|
|
44
|
+
你必须**拒绝**执行任何代码变更、文件编辑、子代理派发。回复用户:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
当前没有活动任务。实现、重构或行为变更必须先创建任务。
|
|
48
|
+
|
|
49
|
+
建议:
|
|
50
|
+
1. 新需求方向不明确 → 先 brainstorming 明确方向
|
|
51
|
+
2. 需求已明确 → writing-plans → task create → task start
|
|
52
|
+
3. 恢复已有任务 → continue
|
|
53
|
+
|
|
54
|
+
要走哪个方向?
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
只读问答可以直接回答,但不要修改任何文件。
|
|
58
|
+
|
|
59
|
+
### Status = `delegated_subtask`
|
|
60
|
+
|
|
61
|
+
你是子代理。按 bound runtime context 执行:
|
|
62
|
+
- 运行 `./.cowork-flow/run subagent bind <runtime_context_id> <host_context_key>` 绑定
|
|
63
|
+
- 加载任务目录和分配内容
|
|
64
|
+
- 不要执行 start/resume/task start/task archive/commit/spawn
|
|
65
|
+
- 完成分配的叶子工作
|
|
66
|
+
|
|
67
|
+
### Status = `planning`
|
|
68
|
+
|
|
69
|
+
**⛔ 阻断实现。** 任务在计划阶段,尚未就绪。
|
|
70
|
+
|
|
71
|
+
回复用户:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
任务仍在计划阶段,尚未就绪进入实现。
|
|
75
|
+
|
|
76
|
+
需要先:
|
|
77
|
+
1. 完善 prd.md(目标、范围、验收标准)
|
|
78
|
+
2. 整理 implement.jsonl 和 check.jsonl
|
|
79
|
+
3. 运行 task next 确认准备状态
|
|
80
|
+
4. 运行 task start 进入实现阶段
|
|
81
|
+
|
|
82
|
+
现在继续计划工作?
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**例外**: 如果用户明确要求做的是"计划工作"(写 prd.md、整理 jsonl),可以继续,
|
|
86
|
+
但只能编辑任务计划文件,不能开始实现代码。
|
|
87
|
+
|
|
88
|
+
### Status = `in_progress`
|
|
89
|
+
|
|
90
|
+
**✅ 放行。** 任务正在执行中。
|
|
91
|
+
|
|
92
|
+
加载任务上下文后继续:
|
|
93
|
+
1. 读取 `<task>/prd.md`
|
|
94
|
+
2. 读取 `<task>/implement.jsonl`
|
|
95
|
+
3. 读取相关 spec 文件
|
|
96
|
+
4. 行为变更任务:确认 `<task>/tdd.jsonl` red evidence 存在
|
|
97
|
+
5. 声明确认的假设、成功标准、涉及文件、验证命令
|
|
98
|
+
6. 继续实现
|
|
99
|
+
|
|
100
|
+
主会话派发固定代理时,必须使用 runtime context dispatch 协议。
|
|
101
|
+
|
|
102
|
+
### Status = `review`
|
|
103
|
+
|
|
104
|
+
**⚠️ 任务在检查阶段。** 实现应已完成。
|
|
105
|
+
|
|
106
|
+
回复用户:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
任务在检查阶段,实现应已完成。
|
|
110
|
+
|
|
111
|
+
建议:
|
|
112
|
+
1. 运行 cowork-check 验证
|
|
113
|
+
2. 检查通过后 task complete
|
|
114
|
+
3. 如果需要小修复,在 check 范围内直接修
|
|
115
|
+
|
|
116
|
+
当前需要执行检查还是修复?
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
不要开始新的实现工作,除非是小修复。
|
|
120
|
+
|
|
121
|
+
### Status = `completed`
|
|
122
|
+
|
|
123
|
+
**⛔ 阻断。** 任务已完成。
|
|
124
|
+
|
|
125
|
+
回复用户:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
任务已完成。不要针对已完成任务派发新的实现工作。
|
|
129
|
+
|
|
130
|
+
如果发现遗漏:
|
|
131
|
+
1. task archive 归档旧任务
|
|
132
|
+
2. 创建新任务
|
|
133
|
+
3. 走完整流程
|
|
21
134
|
|
|
22
|
-
|
|
135
|
+
需要创建新任务吗?
|
|
136
|
+
```
|
|
23
137
|
|
|
24
|
-
|
|
138
|
+
### Status = `stale` 或 `unknown`
|
|
25
139
|
|
|
26
|
-
|
|
27
|
-
- Success criteria.
|
|
28
|
-
- Files or modules likely to change.
|
|
29
|
-
- Verification command you expect to run.
|
|
30
|
-
- Whether fixed agents or inline work are appropriate.
|
|
140
|
+
任务状态异常。回复用户:
|
|
31
141
|
|
|
32
|
-
|
|
142
|
+
```
|
|
143
|
+
任务状态异常 (<status>)。请运行 task next 和 resume 确认当前状态后再继续。
|
|
144
|
+
```
|
|
@@ -12,11 +12,16 @@ Use this after implementation and before `finish-work`.
|
|
|
12
12
|
1. Read active task PRD, plan, and `check.jsonl`.
|
|
13
13
|
2. Review `git diff --name-only` and `git diff`.
|
|
14
14
|
3. Check contracts across caller/callee, command output, persisted state, templates, and docs.
|
|
15
|
-
4.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
4. Verify spec compliance:
|
|
16
|
+
- Read each spec file listed in `check.jsonl`.
|
|
17
|
+
- For each guideline in the spec, check the diff for violations (naming, structure, encoding, error handling, quality gates).
|
|
18
|
+
- Spec files not listed in `check.jsonl` do not apply to this check.
|
|
19
|
+
5. Confirm `.cowork-flow/spec/` is updated or explicitly unchanged.
|
|
20
|
+
6. Review test intent: reject shallow tests that do not fail for meaningful behavior breaks.
|
|
21
|
+
7. Run focused tests that would fail if the changed behavior broke.
|
|
22
|
+
8. Run broader validation when the change touches shared runtime, templates, packaging, or public workflow.
|
|
23
|
+
9. Report `test_intent_review` with the key tests that defend PRD acceptance behavior.
|
|
24
|
+
10. Report spec compliance: for each spec/ file checked, state pass/fail with evidence from the diff.
|
|
20
25
|
|
|
21
26
|
## Report
|
|
22
27
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: game-design
|
|
3
|
+
description: Use when working on game development tasks — architecture, engine selection, asset pipelines, performance analysis, or multiplayer networking.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Game Design
|
|
7
|
+
|
|
8
|
+
Use this skill when the task involves game development: engine selection, game architecture, asset pipeline configuration, performance tuning, or multiplayer networking. It provides domain-specific guidelines that complement the general `cowork-implement` workflow.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Engine architecture decisions (ECS vs OOP, scene organization)
|
|
13
|
+
- Asset pipeline setup or optimization
|
|
14
|
+
- Performance profiling and optimization
|
|
15
|
+
- Multiplayer networking and synchronization
|
|
16
|
+
- Any task that references `.cowork-flow/spec/game/` guides
|
|
17
|
+
|
|
18
|
+
## Domain Guidelines
|
|
19
|
+
|
|
20
|
+
The following guidelines live in `.cowork-flow/spec/game/` and should be read before implementing game-related code:
|
|
21
|
+
|
|
22
|
+
| File | Covers |
|
|
23
|
+
|------|--------|
|
|
24
|
+
| `engine-guidelines.md` | ECS vs OOP, scene/level organization, plugin strategy |
|
|
25
|
+
| `asset-pipeline.md` | Asset directory layout, build stages, LOD policy, Git LFS |
|
|
26
|
+
| `performance-guidelines.md` | FPS targets, memory budgets, GC, draw calls, profiling workflow |
|
|
27
|
+
| `multiplayer-guidelines.md` | Network models, sync strategies, lag compensation, matchmaking |
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
1. Read the relevant spec/game/ guide(s) first.
|
|
32
|
+
2. Read the task PRD and implement.jsonl context.
|
|
33
|
+
3. Proceed with implementation through `cowork-implement` or directly (depending on scope).
|
|
34
|
+
|
|
35
|
+
## When NOT to use
|
|
36
|
+
|
|
37
|
+
- Pure backend/CRUD work with no game domain concerns
|
|
38
|
+
- Frontend UI that doesn't involve game-specific rendering or input
|
|
39
|
+
- General infrastructure tasks
|
|
@@ -1,41 +1,51 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cowork-check
|
|
3
3
|
description: Cowork-flow check fixed subagent.
|
|
4
|
-
tools: Read, Write, Edit,
|
|
4
|
+
tools: Read, Write, Edit, Grep, Glob, LS, Bash, Skill
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
You are the `cowork-check`
|
|
8
|
-
You are a leaf executor and must not invoke other agents.
|
|
7
|
+
You are the `cowork-check` subagent.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
You are a leaf executor. Do not coordinate other agents.
|
|
10
|
+
|
|
11
|
+
Formal `cowork-check` work requires runtime-context dispatch. The prompt or
|
|
12
|
+
host metadata must provide:
|
|
12
13
|
|
|
13
14
|
```text
|
|
14
15
|
cowork_runtime_context_id: <runtime_context_id>
|
|
15
16
|
cowork_host_context_key: <host_context_key>
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
The hook may bind that id to
|
|
19
|
-
|
|
20
|
-
state is injected. The first child step must still run:
|
|
19
|
+
The hook may bind that id to `.cowork-flow/.runtime/subagents/<runtime_context_id>.json`
|
|
20
|
+
before workflow state is injected. The first child step must still run:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
./.cowork-flow/run subagent bind <runtime_context_id> <host_context_key>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
or names another agent type, report `needs_context` and stop. Do not use
|
|
28
|
-
`COWORK_ENTRY_CONTRACT_V1` to infer subagent identity; that contract classifies
|
|
29
|
-
main-session prompts only.
|
|
26
|
+
On Windows (cmd/PowerShell), use:
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
```cmd
|
|
29
|
+
.\.cowork-flow\run.cmd subagent bind <runtime_context_id> <host_context_key>
|
|
30
|
+
```
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
If the explicit bind fails, or if the bound runtime context is missing, closed,
|
|
33
|
+
invalid, or names another agent type, report `needs_context` and do not execute
|
|
34
|
+
the task.
|
|
35
|
+
|
|
36
|
+
Load context before checking:
|
|
37
|
+
1. Read the task directory from the bound runtime context.
|
|
38
|
+
2. Read `<task>/prd.md`.
|
|
39
|
+
3. Read `<task>/check.jsonl`.
|
|
40
|
+
4. Read `git diff`.
|
|
41
|
+
5. Include `test_intent_review` in the review output for meaningful behavior
|
|
42
|
+
breaks coverage and shallow tests rejection.
|
|
43
|
+
|
|
44
|
+
Rules:
|
|
45
|
+
- Fix issues directly when they are clearly in scope.
|
|
39
46
|
- Do not use the Task tool or invoke subagents.
|
|
40
|
-
-
|
|
41
|
-
|
|
47
|
+
- MUST NOT spawn, wait for, list, or close other agents.
|
|
48
|
+
- MUST NOT commit, archive, or mutate cowork-flow task state.
|
|
49
|
+
- Report findings, changed files, and exact verification commands.
|
|
50
|
+
- Include test intent findings that map tests back to PRD acceptance or
|
|
51
|
+
regression behavior.
|