cowork-flow 2.2.0 → 2.4.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 (61) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.en.md +46 -22
  3. package/README.md +10 -7
  4. package/docs/architecture.en.md +95 -0
  5. package/docs/architecture.md +7 -3
  6. package/docs/direction.en.md +71 -0
  7. package/docs/direction.md +6 -1
  8. package/docs/hosts.en.md +299 -0
  9. package/docs/hosts.md +5 -1
  10. package/docs/index.en.md +30 -0
  11. package/docs/index.md +2 -0
  12. package/docs/release.en.md +108 -0
  13. package/docs/release.md +2 -0
  14. package/package.json +2 -2
  15. package/presets/claude-code/.claude-plugin/plugin.json +1 -1
  16. package/presets/claude-code/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  17. package/presets/codex/.codex-plugin/plugin.json +1 -1
  18. package/presets/codex/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  19. package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
  20. package/presets/kimi-code/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  21. package/presets/opencode/cowork-flow/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  22. package/presets/qoder/.qoder-plugin/plugin.json +1 -1
  23. package/presets/qoder/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  24. package/presets/zcode/.zcode-plugin/plugin.json +1 -1
  25. package/presets/zcode/skills/cowork-flow-bootstrap/SKILL.md +8 -2
  26. package/src/cli.js +1 -1
  27. package/src/commands/init.js +200 -16
  28. package/src/commands/registry.js +10 -7
  29. package/src/commands/source-refresh.js +5 -1
  30. package/src/commands/sync.js +4 -1
  31. package/src/lib/copy-template.js +23 -5
  32. package/src/lib/host-assets.js +119 -4
  33. package/src/lib/language.js +162 -0
  34. package/template/.cowork-flow/.version +1 -1
  35. package/template/.cowork-flow/config.yaml +8 -0
  36. package/template/.cowork-flow/scripts/adapters/cli/task_create_command.py +5 -3
  37. package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +71 -2
  38. package/template/.cowork-flow/scripts/infra/config.py +85 -0
  39. package/template/.cowork-flow/scripts/services/decision_anchor_schema.py +104 -0
  40. package/template/.cowork-flow/scripts/services/fact_view.py +21 -15
  41. package/template/.cowork-flow/scripts/services/task_context.py +13 -7
  42. package/template/.cowork-flow/scripts/services/task_creation.py +72 -30
  43. package/template/.cowork-flow/scripts/services/task_gate_profiles.py +7 -24
  44. package/template/.cowork-flow/spec/contracts/context-injection.md +5 -4
  45. package/template/.cowork-flow/spec/contracts/decision-anchor.md +21 -14
  46. package/template/.cowork-flow/spec/contracts/plan-binding.md +2 -1
  47. package/template/.cowork-flow/spec/index.md +26 -26
  48. package/template/.cowork-flow/spec/references/definition-of-done.md +26 -26
  49. package/template/.cowork-flow/spec/references/index.md +16 -16
  50. package/template/.cowork-flow/spec/references/orchestration-patterns.md +71 -71
  51. package/template/.cowork-flow/spec/references/security-checklist.md +37 -37
  52. package/template/.cowork-flow/spec/references/testing-checklist.md +32 -32
  53. package/template/.cowork-flow/spec/runtime/host-assets.json +23 -4
  54. package/template/.cowork-flow/spec/runtime/index.md +10 -12
  55. package/template/.cowork-flow/spec/schemas/host-assets.schema.json +31 -0
  56. package/template/.cowork-flow/spec/schemas/index.md +5 -5
  57. package/template/.cowork-flow/templates/plan-template.md +91 -0
  58. package/template/locales/en-US/.cowork-flow/spec/contracts/decision-anchor.md +160 -0
  59. package/template/locales/en-US/.cowork-flow/templates/plan-template.md +91 -0
  60. package/template/skills/runtime-health/scripts/doctor.py +110 -0
  61. package/template/skills/task-planning/SKILL.md +19 -92
@@ -0,0 +1,299 @@
1
+ # Host integration
2
+
3
+ [中文](hosts.md) | English
4
+
5
+ This document explains how to connect cowork-flow to an AI coding host, and how to check, upgrade, and uninstall it after installation. If you only need the first-time install, start with "Finish host setup" in the [README](../README.en.md).
6
+
7
+ ## Two kinds of files to tell apart first
8
+
9
+ | Kind | Written to | Installed by |
10
+ |---|---|---|
11
+ | Project-level files | the current project's `AGENTS.md`, `.cowork-flow/`, and host directories | `cwf project init` / `cwf project sync` |
12
+ | Machine-level components | the host's user configuration directory, such as plugins, presets, or hooks | `cwf host add` / `cwf host remove` |
13
+
14
+ Every project needs at least one `cwf project init`. When `--host` is omitted, init first detects host markers already in the project (such as `.codex/` or `.claude/`), using the same detection as `cwf project sync`; an interactive terminal offers a picker when none is found, while a non-interactive environment must pass `--host` explicitly. `--platform` / `--platforms` remain accepted aliases. Task and plan artifacts default to Chinese; pass `--language en-US` when a non-interactive install needs English artifacts, or edit `language` in `.cowork-flow/config.yaml` and run `cwf project sync` to switch after installation.
15
+
16
+ Whether `cwf host add` is needed depends on the host:
17
+
18
+ | Host | Machine-level component needed after init | Suggested command |
19
+ |---|---|---|
20
+ | Codex | Works in the current project as-is; the global bootstrap entry point is optional | `cwf host add codex` |
21
+ | Claude Code | Works in the current project as-is; the global bootstrap entry point is optional | `cwf host add claude-code` |
22
+ | OpenCode | Works in the current project as-is; the global bootstrap entry point is optional | `cwf host add opencode` |
23
+ | ZCode | Required | `cwf host add zcode` |
24
+ | Qoder | Required | `cwf host add qoder` |
25
+ | DeepSeek Harness | Required | `cwf host add dsh` |
26
+ | Kimi Code | Required | `cwf host add kimi-code` (one command installs both the hook and the plugin) |
27
+
28
+ ## Common commands
29
+
30
+ Preview first, then install:
31
+
32
+ ```bash
33
+ cwf host add <host> --dry-run
34
+ cwf host add <host>
35
+ ```
36
+
37
+ List the hosts the project and the CLI know about:
38
+
39
+ ```bash
40
+ cwf host list .
41
+ cwf host list . --json
42
+ ```
43
+
44
+ Upgrade or reinstall:
45
+
46
+ ```bash
47
+ cwf host add <host> --force
48
+ ```
49
+
50
+ Uninstall the machine-level component:
51
+
52
+ ```bash
53
+ cwf host remove <host>
54
+ ```
55
+
56
+ Use `--force` only once you have confirmed that an existing installation needs to be overwritten. The installer refuses by default to overwrite or delete files it does not own; `--dry-run` runs the same ownership checks.
57
+
58
+ Machine-level hooks and the project runtime upgrade independently, yet a machine-level hook fires in any workspace — including projects whose runtime is older than the hook. The four machine-level injection shims (Qoder, ZCode, Kimi Code, OpenCode) are therefore **fail-open**: when the project runtime fails, they only record the reason in the host's run log and return 0; they do not inject, and they never turn "hook failed" into "your input is rejected". The project-level Edit-time hooks (Claude Code / Codex) have likewise stopped returning a non-zero exit since 2.0.0 and are always advisory. In an old project, injection silently has no effect; run `cwf project sync .` once to restore it.
59
+
60
+ ## Codex
61
+
62
+ ```bash
63
+ cwf host add codex --dry-run
64
+ cwf host add codex
65
+ cwf host remove codex
66
+ ```
67
+
68
+ The installer will:
69
+
70
+ - Prepare a stable plugin source under `$CODEX_HOME/plugins/marketplaces/cowork-flow-local/`; when `CODEX_HOME` is unset, it uses `~/.codex`.
71
+ - Register the marketplace and the plugin through Codex's official CLI; it does not hand-write `config.toml`.
72
+ - When the `codex` command is not found, still prepare the source directory and print the manual commands.
73
+
74
+ The plugin only carries the `cowork-flow-bootstrap` bootstrap Skill; project hooks and the three fixed subagents are still provided by project-level files. Start a new session after installing or upgrading.
75
+
76
+ To upgrade to a new version, run:
77
+
78
+ ```bash
79
+ cwf host add codex --force
80
+ ```
81
+
82
+ ## Claude Code
83
+
84
+ ```bash
85
+ cwf host add claude-code --dry-run
86
+ cwf host add claude-code
87
+ cwf host remove claude-code
88
+ ```
89
+
90
+ The plugin is written to `$CLAUDE_CONFIG_DIR/skills/cowork-flow`, or `~/.claude/skills/cowork-flow` when that variable is unset. Claude Code treats a Skill directory containing `.claude-plugin/plugin.json` as a plugin, so no extra marketplace command is needed.
91
+
92
+ The plugin only provides the bootstrap Skill. Project hooks and agents already live in `.claude/`, which avoids duplicate execution from multiple hook sources. Start a new session after installing.
93
+
94
+ `~/.claude/skills/` is user-maintained: when the target directory is not the cowork-flow plugin, both install and uninstall refuse; use `--force` only after deciding to take over that directory.
95
+
96
+ ## OpenCode
97
+
98
+ ```bash
99
+ cwf host add opencode --dry-run
100
+ cwf host add opencode
101
+ cwf host remove opencode
102
+ ```
103
+
104
+ The install location is `$XDG_CONFIG_HOME/opencode/`, or `~/.config/opencode` when that variable is unset. The installer only writes `plugins/cowork-flow.js` and `cowork-flow/`; it does not modify the user's `opencode.json`.
105
+
106
+ The plugin registers the `cowork-flow-bootstrap` Skill directory shipped in its payload from the `config` hook, so a repository that has not initialized cowork-flow also sees the bootstrap entry point. Start a new session after installing.
107
+
108
+ The plugin itself is only a transport shim: the injected text is rendered by the in-project Python runtime `inject.py --host opencode` (zcode has the same shape). The payload also carries a cached copy of `cowork-flow/runtime/scripts` to render the not-initialized context outside a project; inside a project, the project's own runtime copy always wins.
109
+
110
+ OpenCode may generate `package.json`, `bun.lock`, and `node_modules/` inside the plugin directory. These are host files; the installer neither modifies nor cleans them. The load order of multiple plugins, and the precedence between a global and a project Skill of the same name, have not been measured yet.
111
+
112
+ ## ZCode
113
+
114
+ ```bash
115
+ cwf host add zcode --dry-run
116
+ cwf host add zcode
117
+ cwf host add zcode --force --prune-old
118
+ cwf host remove zcode
119
+ ```
120
+
121
+ The installer maintains a stable marketplace source and the currently active copy; the plugin cache lives under `~/.zcode/cli/plugins/cache/`. The plugin provides hooks, the three fixed subagents, and the bootstrap Skill; project Skills are still provided by `.agents/skills/`.
122
+
123
+ Old version caches are kept by default, so a running session does not suddenly lose the plugin. Use `--prune-old` when you need to clean up old versions. Restart ZCode or start a new session after upgrading.
124
+
125
+ ## Qoder
126
+
127
+ ```bash
128
+ cwf host add qoder --dry-run
129
+ cwf host add qoder
130
+ cwf host add qoder --force
131
+ cwf host remove qoder
132
+ ```
133
+
134
+ The install location is determined by `QODER_CONFIG_DIR`, or `~/.qoder` when that variable is unset. The plugin provides hooks, the three fixed subagents, and the bootstrap Skill; the project-level `init` / `sync` commands only write the adaptation declarations and shared Skills.
135
+
136
+ ## DeepSeek Harness
137
+
138
+ Installs the Cowork Flow preset by default:
139
+
140
+ ```bash
141
+ cwf host add dsh --component preset --dry-run
142
+ cwf host add dsh
143
+ cwf host remove dsh --component preset
144
+ ```
145
+
146
+ The preset writes both delivery lines at once, because the desktop version switched channels:
147
+
148
+ | Location | Applies to | How to enable |
149
+ | --- | --- | --- |
150
+ | `~/.dsh/.agent-presets/cowork-flow/` (or the corresponding directory under `$DSH_HOME`) | DSH 0.1.x / CLI line | Appears directly in the session's preset list; restart and select **Cowork Flow** |
151
+ | `~/.dsh/bundles/cowork-flow/` | DSH 0.2.0+ (desktop) | On the desktop sidebar's Plugins page, enter the absolute path of that directory to install it (the `plugin_manager` tool row is disabled in the desktop host composition and is unavailable in a session), then start a new session |
152
+
153
+ As of 0.2.0 the host no longer reads the `.agent-presets/` directory (its bundled Skill text reads: "Nothing reads that directory any more"), and the preset becomes one declaration line for `@deepseek-ai/dsh-agent-preset` in a bundle patch. The host performs the bundle installation — it runs the package install and writes the profile manifest — so `cwf` only produces the bundle and the installation instructions, and does not rewrite `~/.dsh/profiles/**`. The two lines differ only in the two places where the host API differs: the workflow line (0.1.x `dsh-workflow-worker-thread` / 0.2.0 `dsh-workflow-ptc`) and the persona line's configuration key (0.1.x `text` / 0.2.0 `prefix`), substituted when the bundle is generated; both must match the target line, because a package that cannot be resolved or a configuration key the host rejects makes the host treat the **entire** preset as unavailable. An install without `--force` only adds the missing line and does not overwrite an existing directory.
154
+
155
+ The preset already includes the workflow-state hook, so the hook component does not need to be installed as well. Use it only when debugging the composition layer's configuration:
156
+
157
+ ```bash
158
+ cwf host add dsh --component hook
159
+ cwf host remove dsh --component hook
160
+ ```
161
+
162
+ Whether the hook line enters the agent prompt depends on the version line: in testing, DSH 0.1.1-rc.1 did not collect host-layer sections, so live injection could only come from the preset; 0.2.0-rc.1 (desktop) composes the global-layer sections into every agent prompt (`dsh-scope`'s `layers.merge()` takes the global layer first, and the scope chain then overrides it), so on that version the hook component alone can provide injection. The above is code- and documentation-level evidence; real-session verification still requires one run on the corresponding version.
163
+
164
+ ## Kimi Code
165
+
166
+ The bare command installs both parts in one go: first the context-injection hook (required), then the plugin:
167
+
168
+ ```bash
169
+ cwf host add kimi-code
170
+ cwf host remove kimi-code
171
+ ```
172
+
173
+ Reload the configuration or start a new session after installing or updating. The hook component always rewrites its own hook block and does not write the plugin; the plugin component provides the global bootstrap Skill in uninitialized projects. To install just one half, use `--component`:
174
+
175
+ ```bash
176
+ cwf host add kimi-code --component plugin
177
+ cwf host add kimi-code --component hook
178
+ ```
179
+
180
+ The hook component does not accept `--force` (it always takes over and rewrites its own block); `--force` on the bare command applies only to the plugin part:
181
+
182
+ ```bash
183
+ cwf host add kimi-code --force
184
+ ```
185
+
186
+ The plugin is materialized to `$KIMI_CODE_HOME/plugins/sources/cowork-flow/` (the stable reinstall source) and `$KIMI_CODE_HOME/plugins/managed/cowork-flow/` (the copy the host loads), and writes directly into the host's plugin registry `$KIMI_CODE_HOME/plugins/installed.json`, matching Kimi Code's own on-disk installation format. Restarting Kimi Code is enough to take effect; no manual install in the TUI is needed. Uninstall cleans up both directories and the registry entry in reverse.
187
+
188
+ ## MCP client integration
189
+
190
+ When an MCP client needs to read task facts, registering once globally is recommended:
191
+
192
+ ```bash
193
+ cwf mcp serve
194
+ ```
195
+
196
+ The client searches upward from the current working directory for `.cowork-flow/`, so one registration can serve multiple projects. Common configuration examples:
197
+
198
+ ```toml
199
+ # Codex: ~/.codex/config.toml
200
+ [mcp_servers.cowork-flow]
201
+ command = "cwf"
202
+ args = ["mcp", "serve"]
203
+ ```
204
+
205
+ ```json
206
+ // OpenCode: ~/.config/opencode/opencode.json
207
+ {
208
+ "mcp": {
209
+ "cowork-flow": {
210
+ "type": "local",
211
+ "command": ["cwf", "mcp", "serve"],
212
+ "enabled": true
213
+ }
214
+ }
215
+ }
216
+ ```
217
+
218
+ For Claude Code, run:
219
+
220
+ ```bash
221
+ claude mcp add -s user cowork-flow -- cwf mcp serve
222
+ ```
223
+
224
+ Without a global CLI install, you can also configure the in-project entry point directly:
225
+
226
+ ```bash
227
+ <project>/.cowork-flow/run mcp-state
228
+ ```
229
+
230
+ ## Skill discovery
231
+
232
+ The single source for project Skills is `template/skills/`; `init` / `sync` distributes them as shown in the table below. Host plugins no longer carry copies of project Skills.
233
+
234
+ | Host | Project Skill read root | Host discovery |
235
+ |---|---|---|
236
+ | Codex | `.agents/skills/` | Natively scans `.agents/skills/` |
237
+ | Claude Code | `.claude/skills/` | Natively scans the project's `.claude/skills/` |
238
+ | OpenCode | `.agents/skills/` | Scans `.agents/skills/` and `.opencode/skills/`; cowork-flow only delivers the former |
239
+ | ZCode | `.agents/skills/` | Scans the project's `.zcode/skills/` and `.agents/skills/`; the former wins on a name collision |
240
+ | Qoder | `.agents/skills/` | `loadFromAgentsDirectory` is enabled by default |
241
+ | Kimi Code | `.agents/skills/` | `PROJECT_GENERIC_DIRS` includes `.agents/skills` |
242
+ | DeepSeek Harness | `.agents/skills/` | `skill-filesystem` uses it as the project Skill root |
243
+
244
+ These channels are recorded as `verified:` in the Host Asset Manifest. After a host upgrade, if you observe behavior changes, update the evidence and tests rather than only the documentation.
245
+
246
+ ## Diagnostics
247
+
248
+ Start with:
249
+
250
+ ```bash
251
+ ./.cowork-flow/run doctor --all
252
+ ./.cowork-flow/run doctor --all --json
253
+ ```
254
+
255
+ <details>
256
+ <summary>Common diagnostic codes</summary>
257
+
258
+ | Scope | Diagnostic code | Meaning |
259
+ |---|---|---|
260
+ | General Skills | `SKILL-READROOT-MISSING` | The project is missing a declared Skill read root |
261
+ | General Skills | `PLUGIN-SKILLS-LEGACY` | An old plugin still carries copies of project Skills; reinstall the plugin |
262
+ | General Skills | `SKILL-DISCOVERY-GATED` | The host needs the directory trusted or a restart before it loads Skills |
263
+ | Codex | `PLUGIN-NOT-INSTALLED` / `PLUGIN-PAYLOAD-MISSING` / `PLUGIN-DISABLED` | The plugin is not registered, its payload is missing, or it is not enabled |
264
+ | Claude Code / OpenCode | `PLUGIN-NOT-INSTALLED` / `PLUGIN-PAYLOAD-INCOMPLETE` / `PLUGIN-STALE` | The plugin is not installed, its payload is incomplete, or its version is behind |
265
+ | Qoder | `PLUGIN-NOT-INSTALLED` / `PLUGIN-PAYLOAD-MISSING` / `PLUGIN-PAYLOAD-INCOMPLETE` / `PLUGIN-DISABLED` / `PLUGIN-STALE` | Something is wrong with the plugin's installation, enablement, payload, or version |
266
+ | DSH preset | `PRESET-UNKNOWN-VERSION` / `PRESET-STALE` | The preset lacks a version marker or its version is behind |
267
+ | DSH / Kimi hook | `HOOK-NOT-INSTALLED` / `HOOK-SHIM-MISSING` / `HOOK-UNKNOWN-VERSION` / `HOOK-STALE` | The hook block, script, version marker, or version does not match |
268
+ | Kimi plugin | `PLUGIN-NOT-INSTALLED` / `PLUGIN-DISABLED` / `PLUGIN-PAYLOAD-INCOMPLETE` / `PLUGIN-STALE` / `PLUGIN-SOURCES-MISSING` | The plugin is not registered, is disabled, has an incomplete payload, is behind, or its source directory is missing |
269
+
270
+ `PLUGIN-NOT-INSTALLED` means the registry has no cowork-flow record yet; `cwf host add kimi-code` both installs and registers it in one step.
271
+
272
+ </details>
273
+
274
+ ## Plugin icon fields
275
+
276
+ Hosts support different manifest fields, so do not copy the same set of fields into every manifest.
277
+
278
+ | Host | Supported fields | Requirement |
279
+ |---|---|---|
280
+ | Codex | `interface.logo`, `interface.brandColor` | The logo must be a relative path inside the payload |
281
+ | ZCode | the marketplace entry's `icon` | Must be an `https://` URL |
282
+ | Claude Code, OpenCode, Qoder, DSH, Kimi Code | None | Do not write icon keys |
283
+
284
+ `assets/icon.svg` is the single source for the brand icon, and `presets/plugin-meta.json` stores the brand color. Run `npm run icons:export` at release time to re-export the raster assets.
285
+
286
+ ## Environment variables
287
+
288
+ | Variable | Purpose |
289
+ |---|---|
290
+ | `COWORK_FLOW_HOOKS=0` / `COWORK_FLOW_DISABLE_HOOKS=1` | Disable hook injection for all hosts |
291
+ | `COWORK_FLOW_CONTEXT_ID` | Explicitly set the session identity; use when the host provides no session variable |
292
+ | `COWORK_FLOW_HOST` | Explicitly set the host id |
293
+ | `COWORK_FLOW_CODEX` | Set the Codex CLI executable |
294
+ | `DSH_HOME` | Override the DeepSeek Harness configuration root |
295
+ | `KIMI_CODE_HOME` | Override the Kimi Code configuration root |
296
+ | `CODEX_HOME` | Override the Codex configuration root |
297
+ | `QODER_CONFIG_DIR` | Override the Qoder configuration root |
298
+ | `CLAUDE_CONFIG_DIR` | Override the Claude Code configuration root |
299
+ | `COWORK_FLOW_BROWSER` | Browser executable used by `icons:export` |
package/docs/hosts.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 宿主接入
2
2
 
3
+ [English](hosts.en.md) | 中文
4
+
3
5
  本文说明如何把 cowork-flow 接到 AI 编码宿主,以及安装后如何检查、升级和卸载。只想完成首次安装时,先看 [README](../README.md) 的“完成宿主设置”。
4
6
 
5
7
  ## 先分清两类文件
@@ -9,7 +11,9 @@
9
11
  | 项目级文件 | 当前项目的 `AGENTS.md`、`.cowork-flow/` 和宿主目录 | `cwf project init` / `cwf project sync` |
10
12
  | 机器级组件 | 宿主的用户配置目录,如插件、预设或 hook | `cwf host add` / `cwf host remove` |
11
13
 
12
- 每个项目至少需要执行一次 `cwf project init`。是否需要 `cwf host add`,取决于宿主:
14
+ 每个项目至少需要执行一次 `cwf project init`。省略 `--host` 时,init 先按项目里已有的宿主标记(如 `.codex/`、`.claude/`)自动判定,与 `cwf project sync` 使用同一套探测;没有标记的交互终端会给出选择器,非交互环境则必须显式传 `--host`。`--platform` / `--platforms` 仍是兼容别名。任务与计划产物默认中文;非交互安装需要英文产物时传 `--language en-US`,安装后也可编辑 `.cowork-flow/config.yaml` 的 `language` 并运行 `cwf project sync` 切换。
15
+
16
+ 是否需要 `cwf host add`,取决于宿主:
13
17
 
14
18
  | 宿主 | 初始化后是否需要机器级组件 | 建议命令 |
15
19
  |---|---|---|
@@ -0,0 +1,30 @@
1
+ # cowork-flow documentation
2
+
3
+ [中文](index.md) | English
4
+
5
+ If this is your first time installing and using cowork-flow, read [README](../README.en.md) first. When you need to understand host integration, how it works, or the development workflow, pick a document from the entries below.
6
+
7
+ ## Find by question
8
+
9
+ | What you want to do | Which document to read | What you will find |
10
+ |---|---|---|
11
+ | Install, initialize a project, or start a task | [README](../README.en.md) | The shortest path to get started, day-to-day commands, and common questions |
12
+ | Connect cowork-flow to an AI coding host | [Host integration](hosts.en.md) | Installation components, restart requirements, upgrades, uninstallation, and troubleshooting for each host |
13
+ | Understand how project files are organized | [Architecture and extension](architecture.en.md) | The runtime, `template/`, `presets/`, sync policy, and extension boundaries |
14
+ | Contribute to project development | [Contributing](../CONTRIBUTING.md) (Chinese) | Local setup, code conventions, tests, and PR checks |
15
+ | Understand the test and release process | [Release and maintenance](release.en.md) | Test layers, CI, version releases, and maintainer commands |
16
+ | Understand project direction and version planning | [Direction](direction.en.md) | The positioning statement, settled trade-offs, the version mainline, and open items |
17
+ | See what changed in a given version | [Changelog](../CHANGELOG.md) (Chinese) | Feature changes, fixes, and migration notes recorded by version |
18
+
19
+ ## Common reading paths
20
+
21
+ - **First-time use**: README → Host integration → Start a task.
22
+ - **Submitting code**: README → Contributing → Architecture and extension.
23
+ - **Troubleshooting installation or runtime issues**: Host integration → the "Troubleshooting" section of README.
24
+ - **Preparing a release**: Architecture and extension → Release and maintenance → Changelog.
25
+
26
+ ## Documentation and actual behavior
27
+
28
+ Documentation explains usage; for exact commands and current task state, rely on what the command actually outputs. For the command that shows the current state, see the "Troubleshooting" section of [README](../README.en.md).
29
+
30
+ If command output disagrees with the documentation, trust the current command output and open an [issue](https://github.com/fishlikewater/cowork-flow/issues) to point out where the documentation needs fixing.
package/docs/index.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # cowork-flow 文档
2
2
 
3
+ [English](index.en.md) | 中文
4
+
3
5
  第一次安装和使用请先看 [README](../README.md)。需要了解宿主接入、工作原理或开发流程时,再从下面的入口选择文档。
4
6
 
5
7
  ## 按问题查找
@@ -0,0 +1,108 @@
1
+ # Release and maintenance
2
+
3
+ [中文](release.md) | English
4
+
5
+ This document is for maintainers of the cowork-flow repository. Regular users only need the [README](../README.en.md); before submitting code, read [Contributing](../CONTRIBUTING.md) (Chinese) first.
6
+
7
+ ## Pre-release checks
8
+
9
+ Choose tests according to the scope of the change; you do not have to start from the heaviest command every time.
10
+
11
+ | Command | When to run |
12
+ |---|---|
13
+ | `npm run test:fast` | The minimum check after everyday changes |
14
+ | `npm run test:smoke` | Verifies that the CLI loads and runs a minimal initialization after installation from a real npm tarball |
15
+ | `npm run test:integration` | Changes to `project init` / `project sync` |
16
+ | `npm run test:node:full` | Changes to the Node CLI, installers, or shared modules |
17
+ | `npm run test:template` | Changes to core paths of the project template |
18
+ | `npm run test:template:full` | Changes to the Python runtime, specs, hooks, or host adaptations |
19
+ | `npm run test:windows:core` | Anything involving Windows, paths, line endings, or release behavior |
20
+ | `python -m pytest -q` | Changes to `template/.cowork-flow/`, `tests/`, or Python contracts |
21
+ | `npm run test:all` | The full Node, template, and packaging check when preparing a release |
22
+ | `npm run release:check` | The release confidence gate: `test:all` plus checks that tests cannot express — drift of the self-instance and live-copy assets (`.claude/**`, `.codex/**`, skills) from `template/`, and `error`-level problems from `doctor --all` |
23
+
24
+ When platform prerequisites are not met, tests may skip explicitly. Skips must be recorded as they are and never treated as passes.
25
+
26
+ For stability-related changes, run the template tests repeatedly:
27
+
28
+ ```bash
29
+ COWORK_TEMPLATE_TEST_REPEAT=3 \
30
+ COWORK_TEMPLATE_TEST_SEED=<fixed-value> \
31
+ npm run test:template:full
32
+ ```
33
+
34
+ ## Release commands
35
+
36
+ | Command | Behavior |
37
+ |---|---|
38
+ | `npm run release` | Release a patch version |
39
+ | `npm run release -- minor` | Release a minor version |
40
+ | `npm run release -- --version 0.1.0` | Use the given version number and skip the automatic bump |
41
+ | `npm run release -- minor --no-publish` | Finish the version, commit, and tag, push the commit and tag, but do not run `npm publish`; CI publishes |
42
+ | `npm run release -- --dry-run` | Run the pre-release checks and stop before the version bump |
43
+
44
+ `npm run release` runs `test:all` internally, not `release:check`: before running the tests it executes `source:refresh` and `sync --force`, so drift is already erased and only the `doctor` half is missing. Before releasing, run `release:check` separately as the standard flow requires.
45
+
46
+ `--dry-run` is not a read-only command. It first requires a clean Git worktree and index, then runs `source:refresh` and `sync --force`, so it may refresh ignored runtime copies in the repository and temporarily overwrite and then restore `AGENTS.md`. It does not change version files, commit, tag, or publish; if local changes exist when the check starts, the script stops before any refresh.
47
+
48
+ The target version is only known after the bump, so `--dry-run` does not run the CHANGELOG version-section gate.
49
+
50
+ ## Standard release flow
51
+
52
+ 1. Confirm that the worktree and the changelog are as expected.
53
+ 2. Run `npm run release:check` and `git diff --check`.
54
+ 3. For stability changes, repeat the template tests as described in the previous section.
55
+ 4. Run `npm run release -- <release-type>`; the CI route uses `--no-publish`, which pushes the tag to CI.
56
+ 5. The script syncs `package.json`, the lockfile, `template/.cowork-flow/.version`, and every plugin manifest bundled with the package.
57
+ 6. Check the commit and tag, then publish through the CI route below.
58
+
59
+ `scripts/release.sh` checks after the bump whether `CHANGELOG.md` has a section for the current version. This check happens after the version has already changed; if it fails, restore `package.json`, `package-lock.json`, and `.version` with the rollback commands printed by the script, then run `npm run source:refresh`.
60
+
61
+ ## CI publishing route
62
+
63
+ We recommend letting GitHub Actions run `npm publish`:
64
+
65
+ 1. Run `npm run release -- <release-type> --no-publish` locally. The script completes the checks, the version, the commit, and the tag, then pushes the branch and tag:
66
+
67
+ ```bash
68
+ git push
69
+ git push origin v<v>
70
+ ```
71
+
72
+ 2. Pushing the tag triggers `.github/workflows/publish.yml`. After the Ubuntu and Windows verification jobs pass, the workflow publishes only from the existing `v<version>` tag and verifies that the tag, `package.json`, and `template/.cowork-flow/.version` agree on the version.
73
+
74
+ 3. If you want release notes for this tag, create them manually (not required for publishing):
75
+
76
+ ```bash
77
+ gh release create v<v>
78
+ ```
79
+
80
+ Do not run `gh release create` while the tag does not exist on the remote, or GitHub may create the tag from the latest commit on the default branch and point the release at the wrong commit.
81
+
82
+ Repeated triggers on the same tag are serialized by the concurrency lock, so they never race; if that version is already published to npm, a repeated run is rejected by npm at the `npm publish` stage, which is expected. To publish again after a failed CI run, rerun with `workflow_dispatch` on the same tag.
83
+
84
+ Pull requests and releases use the same core gates.
85
+
86
+ Release credentials use **Trusted Publishing**: the publish job declares `id-token: write`, hands a GitHub OIDC token to npm in exchange for short-lived credentials, and no long-lived token is stored in the repository. Register it on the npm package page (Settings → Trusted Publishers), declaring the repository `fishlikewater/cowork-flow` and the workflow file `publish.yml`.
87
+
88
+ That exchange is implemented by the npm CLI (since 11.5.1), while Node 20 bundles npm 10, so **only the publish job runs on Node 24**; the two verification jobs still use Node 20, matching the `engines` declared in `package.json`.
89
+
90
+ The publish job's `setup-node` **keeps `registry-url`** but supplies no `NODE_AUTH_TOKEN`. npm starts the OIDC exchange only after reading a registry from `.npmrc` — remove it and publishing fails with `ENEEDAUTH` without ever contacting the token endpoint. The `${NODE_AUTH_TOKEN}` placeholder written by `setup-node` is **deliberately left unresolved**: npm first tries the exchange with that empty credential and falls back to it only when the exchange is rejected.
91
+
92
+ Earlier versions used the `NPM_TOKEN` secret. With two-factor authentication enabled on the account, a classic token cannot complete an interactive OTP, so CI publishing failed with `EOTP` — which is also why we switched to Trusted Publishing. The verification jobs (Ubuntu / Windows) touch no release credentials and only run `release:check`.
93
+
94
+ ## Maintainer commands
95
+
96
+ ```bash
97
+ npm run source:refresh:dry-run # Preview refreshing the source repository's runtime copies
98
+ npm run source:refresh # Refresh the root .cowork-flow, .agents/skills, .claude/skills
99
+ npm run icons:export # Re-export PNGs from assets/icon.svg
100
+ ```
101
+
102
+ `source:refresh` treats `template/.cowork-flow/` and `template/skills/` as the only distribution source and does not overwrite tasks, plans, developer identity, project configuration, or custom Skills. After refreshing, run:
103
+
104
+ ```bash
105
+ ./.cowork-flow/run doctor --all --json
106
+ ```
107
+
108
+ `icons:export` requires Edge or Chrome on the machine; `COWORK_FLOW_BROWSER` can point at an executable. When the browser is missing, the command fails rather than treating the old images as updated.
package/docs/release.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 发布与维护
2
2
 
3
+ [English](release.en.md) | 中文
4
+
3
5
  本文面向 cowork-flow 仓库维护者。普通用户只需要 [README](../README.md);提交代码前先看 [参与开发](../CONTRIBUTING.md)。
4
6
 
5
7
  ## 发布前检查
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "CLI for installing and maintaining cowork-flow collaboration templates.",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -49,7 +49,7 @@
49
49
  "scripts": {
50
50
  "test": "npm run test:fast",
51
51
  "test:smoke": "node --test --test-timeout=600000 test/smoke.test.js test/tarball-install.test.js",
52
- "test:fast": "node --test --test-timeout=600000 test/asset-plan.test.js test/cli.test.js test/cli-registry.test.js test/claude-code-plugin.test.js test/codex-plugin.test.js test/compliance-e2e.test.js test/contract-fingerprint.test.js test/copy-template.obsolete-safety.test.js test/docs.test.js test/host-assets.test.js test/host-command.test.js test/kimi-hook.test.js test/kimi-installed-registry.test.js test/kimi-plugin.test.js test/opencode-plugin-installer.test.js test/opencode-plugin.test.js test/package.test.js test/plugin-metadata.test.js test/plugin-payload.test.js test/qoder-plugin.test.js test/smoke.test.js test/stage-contract.test.js test/template-runner.test.js test/update.test.js test/zcode-plugin.test.js",
52
+ "test:fast": "node --test --test-timeout=600000 test/asset-plan.test.js test/cli.test.js test/cli-registry.test.js test/claude-code-plugin.test.js test/codex-plugin.test.js test/compliance-e2e.test.js test/contract-fingerprint.test.js test/copy-template.obsolete-safety.test.js test/docs.test.js test/host-assets.test.js test/host-command.test.js test/kimi-hook.test.js test/localization.test.js test/kimi-installed-registry.test.js test/kimi-plugin.test.js test/opencode-plugin-installer.test.js test/opencode-plugin.test.js test/package.test.js test/plugin-metadata.test.js test/plugin-payload.test.js test/qoder-plugin.test.js test/smoke.test.js test/stage-contract.test.js test/template-runner.test.js test/update.test.js test/zcode-plugin.test.js",
53
53
  "test:integration": "node --test --test-timeout=600000 --test-name-pattern=\"^(init copies the template into a new target directory|sync updates safe template files and preserves protected files)$\" test/init.test.js test/sync.test.js",
54
54
  "test:node:full": "node --test --test-timeout=600000",
55
55
  "test:template": "node scripts/run-template-tests.js --suite core",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Claude Code。",
5
5
  "displayName": "Cowork Flow",
6
6
  "author": {
@@ -17,12 +17,18 @@ workflow entry `./.cowork-flow/run`).
17
17
 
18
18
  ## No runtime: offer the install
19
19
 
20
- Tell the user this repository has no cowork-flow runtime, then offer:
20
+ Tell the user this repository has no cowork-flow runtime, then offer (replace
21
+ `<host>` with the host you are running in: `codex`, `claude-code`, `opencode`,
22
+ `zcode`, `qoder`, `kimi-code`, or `dsh`):
21
23
 
22
24
  ```bash
23
- npx cowork-flow project init .
25
+ npx cowork-flow project init --host <host>
24
26
  ```
25
27
 
28
+ The default artifact language is `zh-CN`. When the user asks for English task or
29
+ plan artifacts, append `--language en-US`. An existing
30
+ `.cowork-flow/config.yaml` remains authoritative.
31
+
26
32
  After init the project carries its own Skills (`.agents/skills/`), the task
27
33
  runtime (`.cowork-flow/`), and the workflow entry `./.cowork-flow/run task next`.
28
34
  Resume the work through that entry.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Codex。",
5
5
  "author": {
6
6
  "name": "fishlikewater",
@@ -17,12 +17,18 @@ workflow entry `./.cowork-flow/run`).
17
17
 
18
18
  ## No runtime: offer the install
19
19
 
20
- Tell the user this repository has no cowork-flow runtime, then offer:
20
+ Tell the user this repository has no cowork-flow runtime, then offer (replace
21
+ `<host>` with the host you are running in: `codex`, `claude-code`, `opencode`,
22
+ `zcode`, `qoder`, `kimi-code`, or `dsh`):
21
23
 
22
24
  ```bash
23
- npx cowork-flow project init .
25
+ npx cowork-flow project init --host <host>
24
26
  ```
25
27
 
28
+ The default artifact language is `zh-CN`. When the user asks for English task or
29
+ plan artifacts, append `--language en-US`. An existing
30
+ `.cowork-flow/config.yaml` remains authoritative.
31
+
26
32
  After init the project carries its own Skills (`.agents/skills/`), the task
27
33
  runtime (`.cowork-flow/`), and the workflow entry `./.cowork-flow/run task next`.
28
34
  Resume the work through that entry.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Kimi Code。",
5
5
  "author": {
6
6
  "name": "fishlikewater",
@@ -17,12 +17,18 @@ workflow entry `./.cowork-flow/run`).
17
17
 
18
18
  ## No runtime: offer the install
19
19
 
20
- Tell the user this repository has no cowork-flow runtime, then offer:
20
+ Tell the user this repository has no cowork-flow runtime, then offer (replace
21
+ `<host>` with the host you are running in: `codex`, `claude-code`, `opencode`,
22
+ `zcode`, `qoder`, `kimi-code`, or `dsh`):
21
23
 
22
24
  ```bash
23
- npx cowork-flow project init .
25
+ npx cowork-flow project init --host <host>
24
26
  ```
25
27
 
28
+ The default artifact language is `zh-CN`. When the user asks for English task or
29
+ plan artifacts, append `--language en-US`. An existing
30
+ `.cowork-flow/config.yaml` remains authoritative.
31
+
26
32
  After init the project carries its own Skills (`.agents/skills/`), the task
27
33
  runtime (`.cowork-flow/`), and the workflow entry `./.cowork-flow/run task next`.
28
34
  Resume the work through that entry.
@@ -17,12 +17,18 @@ workflow entry `./.cowork-flow/run`).
17
17
 
18
18
  ## No runtime: offer the install
19
19
 
20
- Tell the user this repository has no cowork-flow runtime, then offer:
20
+ Tell the user this repository has no cowork-flow runtime, then offer (replace
21
+ `<host>` with the host you are running in: `codex`, `claude-code`, `opencode`,
22
+ `zcode`, `qoder`, `kimi-code`, or `dsh`):
21
23
 
22
24
  ```bash
23
- npx cowork-flow project init .
25
+ npx cowork-flow project init --host <host>
24
26
  ```
25
27
 
28
+ The default artifact language is `zh-CN`. When the user asks for English task or
29
+ plan artifacts, append `--language en-US`. An existing
30
+ `.cowork-flow/config.yaml` remains authoritative.
31
+
26
32
  After init the project carries its own Skills (`.agents/skills/`), the task
27
33
  runtime (`.cowork-flow/`), and the workflow entry `./.cowork-flow/run task next`.
28
34
  Resume the work through that entry.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Qoder。",
5
5
  "displayName": "Cowork Flow",
6
6
  "author": {
@@ -17,12 +17,18 @@ workflow entry `./.cowork-flow/run`).
17
17
 
18
18
  ## No runtime: offer the install
19
19
 
20
- Tell the user this repository has no cowork-flow runtime, then offer:
20
+ Tell the user this repository has no cowork-flow runtime, then offer (replace
21
+ `<host>` with the host you are running in: `codex`, `claude-code`, `opencode`,
22
+ `zcode`, `qoder`, `kimi-code`, or `dsh`):
21
23
 
22
24
  ```bash
23
- npx cowork-flow project init .
25
+ npx cowork-flow project init --host <host>
24
26
  ```
25
27
 
28
+ The default artifact language is `zh-CN`. When the user asks for English task or
29
+ plan artifacts, append `--language en-US`. An existing
30
+ `.cowork-flow/config.yaml` remains authoritative.
31
+
26
32
  After init the project carries its own Skills (`.agents/skills/`), the task
27
33
  runtime (`.cowork-flow/`), and the workflow entry `./.cowork-flow/run task next`.
28
34
  Resume the work through that entry.