cowork-flow 2.4.2 → 2.5.2

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 (46) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/CONTRIBUTING.en.md +115 -0
  3. package/CONTRIBUTING.md +14 -8
  4. package/README.en.md +14 -3
  5. package/README.md +10 -2
  6. package/docs/architecture.en.md +2 -0
  7. package/docs/architecture.md +2 -0
  8. package/docs/hosts.en.md +15 -0
  9. package/docs/hosts.md +15 -0
  10. package/docs/index.en.md +1 -1
  11. package/docs/release.en.md +1 -1
  12. package/package.json +4 -3
  13. package/presets/claude-code/.claude-plugin/plugin.json +1 -1
  14. package/presets/codex/.codex-plugin/plugin.json +1 -1
  15. package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
  16. package/presets/qoder/.qoder-plugin/plugin.json +1 -1
  17. package/presets/zcode/.zcode-plugin/plugin.json +1 -1
  18. package/src/commands/host-inspect.js +86 -0
  19. package/src/commands/host.js +42 -18
  20. package/src/commands/init.js +111 -5
  21. package/src/commands/install-claude-code-plugin.js +53 -2
  22. package/src/commands/install-codex-plugin.js +114 -4
  23. package/src/commands/install-dsh-hook.js +51 -0
  24. package/src/commands/install-dsh-preset.js +56 -9
  25. package/src/commands/install-kimi-code-plugin.js +61 -2
  26. package/src/commands/install-kimi-hook.js +84 -2
  27. package/src/commands/install-opencode-plugin.js +58 -2
  28. package/src/commands/install-qoder-plugin.js +67 -3
  29. package/src/commands/install-zcode-plugin.js +77 -2
  30. package/src/commands/registry.js +20 -5
  31. package/src/lib/dsh-home.js +2 -2
  32. package/template/.cowork-flow/.version +1 -1
  33. package/template/.cowork-flow/scripts/adapters/cli/task_navigation.py +8 -3
  34. package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +4 -0
  35. package/template/.cowork-flow/scripts/adapters/host/workflow_state_hook.py +1 -3
  36. package/template/.cowork-flow/scripts/infra/files.py +0 -13
  37. package/template/.cowork-flow/scripts/services/ac_evidence.py +1 -1
  38. package/template/.cowork-flow/scripts/services/decision_anchor_schema.py +65 -0
  39. package/template/.cowork-flow/scripts/services/fact_view.py +2 -75
  40. package/template/.cowork-flow/scripts/services/lifecycle_checks.py +1 -1
  41. package/template/.cowork-flow/scripts/services/plan_readiness.py +139 -67
  42. package/template/.cowork-flow/spec/contracts/host-install-inspection.md +174 -0
  43. package/template/.cowork-flow/spec/contracts/index.md +1 -0
  44. package/template/.cowork-flow/spec/runtime/contract-registry.json +15 -0
  45. package/template/skills/runtime-health/scripts/doctor.py +538 -489
  46. package/template/skills/task-review/scripts/review_check.py +33 -6
package/CHANGELOG.md CHANGED
@@ -6,6 +6,46 @@
6
6
 
7
7
  ### Changed
8
8
 
9
+ ## [2.5.2] - 2026-11-03
10
+
11
+ ### Fixed
12
+
13
+ - **发布工作流**:`publish.yml` 的 `verify-ubuntu` 与 `verify-windows` 在 `release:check` 前安装 pytest。2.5.1 起 `test:all` 纳入 `python -m pytest`,而干净 runner 默认没有 pytest,两个 verify job 会在发布前失败并跳过 publish。
14
+
15
+ ## [2.5.1] - 2026-11-03
16
+
17
+ ### Added
18
+
19
+ - **首次旅程引导**:`cwf project init` 完成后的 `Next:` 提示改为“打开宿主、新开会话、描述需求”,并在需要机器级组件时提示 `cwf host add <host>`;`task next` 无任务时保留 `create a planned task` 与携带 `--from-plan .cowork-flow/plans/YYYY-MM-DD-<task-name>.md` 的创建命令;文本 `Source:` 只显示会话类别,不再暴露进程级 session key;README 中英文补充第一个任务“说清目标 → 确认计划 → 再改代码 → 验收归档”的四步说明。
20
+ - **根级 CONTRIBUTING 与 SECURITY 英文对页**:新增 `CONTRIBUTING.en.md` 与 `SECURITY.en.md`,中文源同步环境要求、仓库位置、宿主测试模式与支持版本;`README.en.md`、`docs/index.en.md`、`docs/release.en.md` 改指英文对页,`test/docs.test.js` 覆盖两份新文档,npm 随包清单纳入 `CONTRIBUTING.en.md`(`SECURITY.en.md` 与中文版一样只在仓库分发)。
21
+
22
+ ### Changed
23
+
24
+ - **测试信号与 CI 矩阵**:`test:all` 纳入 `python -m pytest -q`;修正 4 处时间依赖测试(归档目录跨月、`completedAt`、任务目录日期前缀);新增 Node 24 与 Python 3.13 兼容 job,核心 job 增加 45 分钟超时。
25
+
26
+ ### Fixed
27
+
28
+ - **发布通道**:发布前查询 npm 已存在版本,避免重复 `npm publish` 红叉;`pack:check` 在打包前拦截交付树中的 `__pycache__`/`.pyc`;修正归档 e2e 对 `archive/2026-10` 的硬编码。
29
+ - **DSH 桌面预设**:0.2.x bundle 的 persona 去掉未注册的 `{{cwd}}` 变量(0.2.1 的 persona section 只注册 `provider`/`model`,工作目录由 `dsh-working-directory` 注入),修复桌面版加载预设时报 `Unknown prompt variable`;0.1.x legacy 目录保持原文案。
30
+ - **测试隔离**:JS hook 测试共享 scrub 清除宿主 session 变量(`ZCODE_SESSION_ID` 等)并让 zcode 探针显式传 fixture `cwd`;Python 测试基类在 `setUp` 清除 `COWORK_FLOW_*` 与宿主 session 变量并在 cleanup 还原,避免在已绑定会话内读到开发者的真实活动任务。
31
+
32
+ ## [2.5.0] - 2026-10-26
33
+
34
+ ### Added
35
+
36
+ - **`cwf host inspect` 机器级安装态读模型**:新增只读命令 `cwf host inspect [host] [--json]`,按宿主组件输出 `schemaVersion: 1` 的 `status`、`version`、`payloadPath`、`detailPath`、`registeredSource`、`enabled` 与 `reason` 行;各安装器在自身布局内提供 installed-state facts,doctor 的宿主检查改为消费该模型,Python 不再解析宿主注册表、TOML、设置文件或载荷清单。读取不可用时 doctor 报 `HOST-INSPECT-UNAVAILABLE`,不会把“读不到”误判为未安装。
37
+ - **安装前置与实例级测试补齐**:`project init` 探测 Python 3.10+ 并给出缺失或过旧告警;新增 EOL 门禁并重物化 CRLF 工作区文件;补齐 zcode 宿主契约断言、manifest 能力错配测试与安装→doctor→移除的实例级 e2e。
38
+
39
+ ### Changed
40
+
41
+ - **anchor 解析与文档事实收敛**:`parse_decision_anchor` 迁入 `decision_anchor_schema`,`fact_view` 保留 re-export;文档宿主清单从 `host-assets.json` 派生并覆盖中英文;新增 Node/Python 共享语言配置夹具,锁定 YAML 读取事实。
42
+ - **`review-check` 路径解析统一**:复用 `TaskRepository` 的 slug、相对路径与绝对路径解析,不再依赖调用方传入的任务目录形状;统一别名到期口径并删除零引用工具函数。
43
+
44
+ ### Fixed
45
+
46
+ - **inspect 诊断路径与宿主噪音**:inspect 行新增 `detailPath` 并让 doctor 直接消费;codex broken 指向缺失的 `.codex-plugin/plugin.json`,文本输出优先显示 `detailPath`;未选用 DSH/Kimi 的项目不再出现 `HOST-INSPECT-UNAVAILABLE`,无已选平台时跳过 inspect;补齐 zcode/kimi 的路径与版本回归测试。
47
+ - **doctor TOML 行内注释解析**:修正 Codex 配置读取对行内注释的处理,避免带注释的注册值被误读。
48
+
9
49
  ## [2.4.2] - 2026-10-23
10
50
 
11
51
  ### Added
@@ -445,7 +485,10 @@
445
485
 
446
486
  此版本未保留本地条目正文,详情见 [GitHub Release](https://github.com/fishlikewater/cowork-flow/releases/tag/v0.0.47)。
447
487
 
448
- [Unreleased]: https://github.com/fishlikewater/cowork-flow/compare/v2.4.2...HEAD
488
+ [Unreleased]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.2...HEAD
489
+ [2.5.2]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.1...v2.5.2
490
+ [2.5.1]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.0...v2.5.1
491
+ [2.5.0]: https://github.com/fishlikewater/cowork-flow/compare/v2.4.2...v2.5.0
449
492
  [2.4.2]: https://github.com/fishlikewater/cowork-flow/compare/v2.4.1...v2.4.2
450
493
  [2.4.1]: https://github.com/fishlikewater/cowork-flow/compare/v2.4.0...v2.4.1
451
494
  [2.4.0]: https://github.com/fishlikewater/cowork-flow/compare/v2.3.0...v2.4.0
@@ -0,0 +1,115 @@
1
+ # Contributing
2
+
3
+ [中文](CONTRIBUTING.md) | English
4
+
5
+ Thanks for contributing to cowork-flow. This document covers only what you need to start work, decide the scope of a change, and open a pull request. For repository structure, see [Architecture and extension](docs/architecture.en.md); for the release process, see [Release and maintenance](docs/release.en.md).
6
+
7
+ ## Requirements
8
+
9
+ | Dependency | Version | Purpose |
10
+ |---|---|---|
11
+ | Node.js | 20 or later | CLI and Node tests |
12
+ | Python | 3.10 or later | Template runtime and Python tests |
13
+ | Git | Current stable | Task baseline, sync, and host tests |
14
+
15
+ The repository has no runtime dependencies and no devDependencies. `npm ci` installs no third-party packages; explain the reason and discuss the approach before adding a dependency.
16
+
17
+ All source code and documentation use UTF-8. The line-ending contract for Windows and POSIX scripts is managed by `.gitattributes`; do not rewrite it by hand.
18
+
19
+ ## Getting started locally
20
+
21
+ ```bash
22
+ git clone https://github.com/fishlikewater/cowork-flow.git
23
+ cd cowork-flow
24
+ npm ci
25
+ npm run source:refresh
26
+ ```
27
+
28
+ `source:refresh` refreshes this repository's own `.cowork-flow/`, `.agents/skills/`, and `.claude/skills/` from `template/`. Rerun it after changing `template/`; otherwise local tests and `./.cowork-flow/run` keep using the old copies.
29
+
30
+ This repository also uses cowork-flow. Check the current state before you start changing things:
31
+
32
+ ```bash
33
+ ./.cowork-flow/run task next --json
34
+ ```
35
+
36
+ `AGENTS.md` and `.cowork-flow/spec/` are implementation constraints; do not build a second process beside the current task.
37
+
38
+ ## Decide what to change first
39
+
40
+ | Change | Main location |
41
+ |---|---|
42
+ | Files written after project initialization | `template/` |
43
+ | Machine-level plugins, presets, and hooks | `presets/` |
44
+ | CLI commands and installers | `src/commands/`, `src/lib/` |
45
+ | Project runtime | `template/.cowork-flow/scripts/` |
46
+ | Host, sync, and skill declarations | `template/.cowork-flow/spec/runtime/host-assets.json` |
47
+ | Release, packaging, and test entry scripts | `scripts/` |
48
+ | Node tests | `test/` |
49
+ | Python tests | `tests/` |
50
+ | CI, issue/PR templates, and dependency updates | `.github/` |
51
+ | User and maintainer documentation | `README.md`, `README.en.md`, `docs/`, `CONTRIBUTING.md`, `CONTRIBUTING.en.md`, `SECURITY.md`, `SECURITY.en.md` |
52
+
53
+ When adding or changing behavior, write a test that fails first, then the smallest implementation. Before refactoring, pin the existing behavior so unrelated modules do not change by accident. The root `CONTRIBUTING` and `SECURITY` documents are kept as Chinese/English pairs: change the Chinese source first, then sync the English page.
54
+
55
+ ## Host changes
56
+
57
+ When integrating or changing a host, usually check all of these:
58
+
59
+ | Location | Contents |
60
+ |---|---|
61
+ | `template/.<host>/` | Hooks, agents, commands, and configuration that must be written into the project |
62
+ | `template/.cowork-flow/adapters/<host>/adapter.yaml` | Adapter and skill discovery declarations |
63
+ | `template/.cowork-flow/spec/runtime/host-assets.json` | Platforms, payloads, sync policy, and migration list |
64
+ | `presets/<host>/` | Plugins, presets, or machine-level hooks |
65
+ | `src/commands/install-<host>-*.js`, `src/commands/registry.js` | Installation, uninstallation, and command registration |
66
+ | `test/host-assets.test.js`, `test/host-command.test.js`, `test/host-inspect.test.js`, `test/<host>-*.test.js`, `tests/test_host_*.py` | Behavior and regression gates |
67
+ | `docs/hosts.md`, `docs/hosts.en.md` | Installation prerequisites, upgrades, uninstallation, and troubleshooting |
68
+
69
+ The table shows where to change things. Host-specific code must not enter the shared layer — see "Extension rules" in [Architecture and extension](docs/architecture.en.md) for the boundary.
70
+
71
+ ## Commit messages
72
+
73
+ Use Conventional Commits:
74
+
75
+ ```text
76
+ <type>(<scope>): <description>
77
+ ```
78
+
79
+ Examples:
80
+
81
+ ```text
82
+ feat(host): add cwf host inspect
83
+ fix(host): correct skill discovery path
84
+ refactor(zcode): move the plugin payload to presets/zcode
85
+ ```
86
+
87
+ Common types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `perf`. Descriptions may be Chinese or English, matching the repository's existing style; say what changed, not an unverifiable phrase such as "improve the experience".
88
+
89
+ ## Tests and pre-PR checks
90
+
91
+ Minimum:
92
+
93
+ ```bash
94
+ npm run test:fast
95
+ git diff --check
96
+ ```
97
+
98
+ For which commands to add based on the change scope and what each covers, see "Pre-release checks" in [Release and maintenance](docs/release.en.md) — that is the only list of commands and their applicable scenarios; this document does not repeat it.
99
+
100
+ `test:fast` runs only the core suites listed in `package.json`. When adding a test file, decide based on the impact whether to add it to that list.
101
+
102
+ Run `test:fast` for documentation changes too: `test/docs.test.js` validates relative links, each language's index, and the Chinese/English page pairing under `docs/`.
103
+
104
+ When platform prerequisites are not met, tests may skip explicitly. CI runs its gates on Ubuntu and Windows; a local machine without the prerequisites may skip, but record it honestly — never report a skip as a pass.
105
+
106
+ A PR description should state:
107
+
108
+ - What changed and why.
109
+ - Which tests ran and their results.
110
+ - Which platform cases were skipped or remain unverified.
111
+ - Whether installation locations, commands, configuration formats, or upgrade steps changed.
112
+
113
+ ## License
114
+
115
+ By submitting code you agree to license it under [MIT](LICENSE).
package/CONTRIBUTING.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 参与开发
2
2
 
3
+ [English](CONTRIBUTING.en.md) | 中文
4
+
3
5
  感谢你参与 cowork-flow。本文只保留开始工作、判断改动范围和提交 PR 需要知道的内容。仓库结构见 [架构与扩展](docs/architecture.md),发布流程见 [发布与维护](docs/release.md)。
4
6
 
5
7
  ## 环境要求
@@ -7,7 +9,7 @@
7
9
  | 依赖 | 版本 | 用途 |
8
10
  |---|---|---|
9
11
  | Node.js | 20 或更高 | CLI 与 Node 测试 |
10
- | Python | 3.10 | 模板运行时与 Python 测试 |
12
+ | Python | 3.10 或更高 | 模板运行时与 Python 测试 |
11
13
  | Git | 当前稳定版 | 任务基线、同步和宿主测试 |
12
14
 
13
15
  仓库没有运行时依赖,也没有 devDependency。`npm ci` 不会安装第三方包;新增依赖前先说明原因并讨论方案。
@@ -42,11 +44,13 @@ npm run source:refresh
42
44
  | CLI 命令与安装器 | `src/commands/`、`src/lib/` |
43
45
  | 项目运行时 | `template/.cowork-flow/scripts/` |
44
46
  | 宿主、同步和技能声明 | `template/.cowork-flow/spec/runtime/host-assets.json` |
47
+ | 发布、打包与测试入口脚本 | `scripts/` |
45
48
  | Node 测试 | `test/` |
46
49
  | Python 测试 | `tests/` |
47
- | 用户和维护文档 | `README.md`、`docs/`、`CONTRIBUTING.md` |
50
+ | CI、Issue/PR 模板与依赖更新 | `.github/` |
51
+ | 用户和维护文档 | `README.md`、`README.en.md`、`docs/`、`CONTRIBUTING.md`、`CONTRIBUTING.en.md`、`SECURITY.md`、`SECURITY.en.md` |
48
52
 
49
- 新增或修改行为时,先补一个能失败的测试,再写最小实现。重构前先固定现有行为,避免顺手改动无关模块。
53
+ 新增或修改行为时,先补一个能失败的测试,再写最小实现。重构前先固定现有行为,避免顺手改动无关模块。根级 `CONTRIBUTING` 与 `SECURITY` 保持中英对页:事实先改中文源,再同步英文。
50
54
 
51
55
  ## 宿主改动
52
56
 
@@ -59,8 +63,8 @@ npm run source:refresh
59
63
  | `template/.cowork-flow/spec/runtime/host-assets.json` | 平台、载荷、同步策略和迁移清单 |
60
64
  | `presets/<host>/` | 插件、预设或机器级 hook |
61
65
  | `src/commands/install-<host>-*.js`、`src/commands/registry.js` | 安装、卸载和命令注册 |
62
- | `test/host-assets.test.js`、`test/host-command.test.js`、`test/<host>-plugin.test.js`、`tests/test_host_*.py` | 行为与回归门禁 |
63
- | `docs/hosts.md` | 安装前提、升级、卸载和排障 |
66
+ | `test/host-assets.test.js`、`test/host-command.test.js`、`test/host-inspect.test.js`、`test/<host>-*.test.js`、`tests/test_host_*.py` | 行为与回归门禁 |
67
+ | `docs/hosts.md`、`docs/hosts.en.md` | 安装前提、升级、卸载和排障 |
64
68
 
65
69
  上表说明改哪里。宿主特化不能进入通用层——具体边界见 [架构与扩展](docs/architecture.md) 的“扩展规则”。
66
70
 
@@ -69,18 +73,18 @@ npm run source:refresh
69
73
  使用 Conventional Commits:
70
74
 
71
75
  ```text
72
- <type>(<scope>): <中文描述>
76
+ <type>(<scope>): <描述>
73
77
  ```
74
78
 
75
79
  示例:
76
80
 
77
81
  ```text
78
- feat(host): 接入 Qoder 宿主
82
+ feat(host): add cwf host inspect
79
83
  fix(host): 修正技能发现路径
80
84
  refactor(zcode): 将插件载荷迁到 presets/zcode
81
85
  ```
82
86
 
83
- 常用 `type`:`feat`、`fix`、`refactor`、`docs`、`test`、`chore`、`perf`。描述写清楚做了什么,不写“优化体验”一类无法核对的信息。
87
+ 常用 `type`:`feat`、`fix`、`refactor`、`docs`、`test`、`chore`、`perf`。描述可以用中文或英文,保持仓库现有风格;写清楚做了什么,不写“优化体验”一类无法核对的信息。
84
88
 
85
89
  ## 测试与 PR 前置检查
86
90
 
@@ -95,6 +99,8 @@ git diff --check
95
99
 
96
100
  `test:fast` 只运行 `package.json` 中列出的核心套件。新增测试文件时,根据影响面决定是否加入该列表。
97
101
 
102
+ 改动 `README.md`、`docs/`、`CONTRIBUTING.md` 或 `SECURITY.md` 时同样跑 `test:fast`:其中的 `test/docs.test.js` 会校验相对链接、中英文索引和 `docs/` 的中英对页结构。
103
+
98
104
  平台前提不满足时,测试可能明确跳过。CI 在 Ubuntu 和 Windows 上运行各自的门禁,本地缺少平台前提可以跳过,但必须如实记录,不能把跳过写成通过。
99
105
 
100
106
  PR 描述需要写明:
package/README.en.md CHANGED
@@ -33,7 +33,7 @@ system, read up first and decide whether to adopt it.
33
33
 
34
34
  ## Getting started
35
35
 
36
- Node.js 20 or later is required.
36
+ Node.js 20 or later is required. Python 3.10 or later is also required: the generated `./.cowork-flow/run` and its diagnostics run on Python, and `cwf project init` warns when no suitable interpreter is found.
37
37
 
38
38
  ### 1. Install the CLI
39
39
 
@@ -109,7 +109,17 @@ requirements, the plan, and the change scope first, and wait for confirmation be
109
109
  editing code.
110
110
  ```
111
111
 
112
- To inspect progress by hand, run this in the project root:
112
+ On your first task, walk through the whole sequence:
113
+
114
+ 1. **State the goal**: describe the problem and what counts as done.
115
+ 2. **Confirm the plan**: the assistant writes the goal into a plan, lists the files it
116
+ may change, and waits for your approval.
117
+ 3. **Edit code only after that**: implementation starts after the plan is approved; the
118
+ assistant self-checks, then you review.
119
+ 4. **Archive the task**: once accepted, the task is archived and its state stays in the
120
+ project.
121
+
122
+ At any step, run the command below to see the current stage and next action:
113
123
 
114
124
  ```bash
115
125
  ./.cowork-flow/run task next
@@ -162,6 +172,7 @@ how the project is organized, see [architecture and extension](docs/architecture
162
172
  | `cwf host add <host> [--component <name>] [--dry-run] [--force] [--prune-old] [--uninstall]` | Install a machine-level host component |
163
173
  | `cwf host remove <host> [--component <name>] [--dry-run] [--force]` | Remove a machine-level host component |
164
174
  | `cwf host list [target] [--json]` | List supported hosts and what the project selected |
175
+ | `cwf host inspect [host] [--json]` | Read machine-level host install state (the model doctor consumes) |
165
176
  | `cwf self update [--dry-run]` | Update the globally installed CLI |
166
177
  | `cwf dev refresh [target] [--dry-run]` | Refresh the self-instance while maintaining the cowork-flow repo |
167
178
  | `cwf mcp serve [args...]` | Serve task facts to an MCP client |
@@ -196,7 +207,7 @@ counterpart at the top.
196
207
  | [Host integration](docs/hosts.en.md) | Install, restart, troubleshoot, and uninstall for each host |
197
208
  | [Release and maintenance](docs/release.en.md) | Tests, CI, and maintainer commands |
198
209
  | [Direction](docs/direction.en.md) | Positioning, settled trade-offs, version line, and open items |
199
- | [Contributing](CONTRIBUTING.md) | Local setup, commit conventions, and PR checks (Chinese) |
210
+ | [Contributing](CONTRIBUTING.en.md) | Local setup, commit conventions, and PR checks |
200
211
  | [Changelog](CHANGELOG.md) | What changed in each version (Chinese) |
201
212
 
202
213
  ## License
package/README.md CHANGED
@@ -28,7 +28,7 @@ cowork-flow 不绑定技术栈,也不会用脚手架改写现有项目。它
28
28
 
29
29
  ## 开始使用
30
30
 
31
- 需要 Node.js 20 或更高版本。
31
+ 需要 Node.js 20 或更高版本。还需要 Python 3.10 或更高版本:项目里的 `./.cowork-flow/run` 与诊断脚本由 Python 运行;`cwf project init` 检测不到合适版本时会给出警告。
32
32
 
33
33
  ### 1. 安装命令
34
34
 
@@ -81,7 +81,14 @@ cwf host add <host>
81
81
  请用 cowork-flow 完成“订单列表按状态筛选”。先把需求、计划和改动范围说清楚,确认后再改代码。
82
82
  ```
83
83
 
84
- 需要手动查看当前进度时,在项目根目录运行:
84
+ 第一次使用时,建议完整走一遍这个顺序:
85
+
86
+ 1. **说清目标**:描述要解决的问题,以及怎样算完成。
87
+ 2. **确认计划**:助手先把目标写成计划,列出允许修改的文件,等你确认。
88
+ 3. **再改代码**:计划确认后才开始实现;完成后先自查,再由你验收。
89
+ 4. **归档任务**:验收通过后任务归档,状态保存在项目里。
90
+
91
+ 每一步都可以运行下面的命令查看当前阶段和下一步:
85
92
 
86
93
  ```bash
87
94
  ./.cowork-flow/run task next
@@ -124,6 +131,7 @@ cwf project sync .
124
131
  | `cwf host add <host> [--component <name>] [--dry-run] [--force] [--prune-old] [--uninstall]` | 安装机器级宿主组件 |
125
132
  | `cwf host remove <host> [--component <name>] [--dry-run] [--force]` | 卸载机器级宿主组件 |
126
133
  | `cwf host list [target] [--json]` | 查看支持的宿主和项目选择情况 |
134
+ | `cwf host inspect [host] [--json]` | 只读查看机器级宿主安装态(doctor 消费同一读模型) |
127
135
  | `cwf self update [--dry-run]` | 更新全局安装的 CLI |
128
136
  | `cwf dev refresh [target] [--dry-run]` | 维护 cowork-flow 仓库时刷新自实例 |
129
137
  | `cwf mcp serve [args...]` | 向 MCP 客户端提供任务事实 |
@@ -44,6 +44,8 @@ The content in `template/` that directly relates to a user project includes:
44
44
 
45
45
  Machine-level installers may write into host configuration directories only through `cwf host add` / `cwf host remove`, and must not hard-code user home directory paths into `template/`.
46
46
 
47
+ Reading machine-level install state has one path too: each installer exports `inspectInstalledState` describing the layout it writes, `cwf host inspect` normalizes those facts into read-only `schemaVersion: 1` rows, and the doctor consumes only that model. The Python runtime does not parse host registries, TOML, settings, or payload manifests; when the read is unavailable the doctor reports `HOST-INSPECT-UNAVAILABLE` instead of mistaking "could not read" for "not installed". See `spec/contracts/host-install-inspection.md`.
48
+
47
49
  ## Runtime layers
48
50
 
49
51
  Runtime code lives in `template/.cowork-flow/scripts/`. The repository root `scripts/` only handles building and releasing.
@@ -44,6 +44,8 @@
44
44
 
45
45
  机器级安装器只能通过 `cwf host add` / `cwf host remove` 写入宿主配置目录,不应把用户主目录路径硬编码到 `template/`。
46
46
 
47
+ 机器级安装态的读取同样只有一条路径:各安装器导出 `inspectInstalledState` 描述自己写下的布局,`cwf host inspect` 把它归一化为 `schemaVersion: 1` 的只读行,`doctor` 只消费这份事实。Python 运行时不解析宿主注册表、TOML、设置文件或载荷清单;读取不可用时 doctor 报 `HOST-INSPECT-UNAVAILABLE`,不会把“读不到”误判为“未安装”。契约见 `spec/contracts/host-install-inspection.md`。
48
+
47
49
  ## 运行时分层
48
50
 
49
51
  运行时代码位于 `template/.cowork-flow/scripts/`。仓库根的 `scripts/` 只负责构建和发布。
package/docs/hosts.en.md CHANGED
@@ -57,6 +57,20 @@ Use `--force` only once you have confirmed that an existing installation needs t
57
57
 
58
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
59
 
60
+ ## Install-state inspection
61
+
62
+ `cwf host list` only answers "which hosts are declared and which did the project select"; to see what is actually installed on the machine, use the read-only `cwf host inspect`:
63
+
64
+ ```bash
65
+ cwf host inspect
66
+ cwf host inspect qoder
67
+ cwf host inspect --json
68
+ ```
69
+
70
+ One row per installable component, with status `installed`, `missing`, `stale`, `broken`, or `unsupported`. `stale` means the installed payload version differs from the running CLI version; `broken` means the host knows about cowork-flow but a required payload artifact is absent. The doctor then compares that same version with the project's `.cowork-flow/.version`: a CLI newer than the project with a payload that still matches the project's runtime stays silent, while a payload that lags a synced project is still `PLUGIN-STALE`. `kimi-code`'s `all` is only a command composition and never appears as a row. The command is read-only and never repairs, installs, or uninstalls; an unhealthy install is data, not a command failure, and only usage errors such as an unknown host exit with 2.
71
+
72
+ The doctor's host checks consume the same read model (`cwf host inspect --json`) and no longer parse host directories, registries, settings, or TOML themselves. When the CLI is not on `PATH`, exits non-zero, times out, or reports an unexpected `schemaVersion`, the doctor emits `HOST-INSPECT-UNAVAILABLE` with an upgrade hint instead of falsely reporting `PLUGIN-NOT-INSTALLED` — "could not read" and "read as not installed" are different facts. See `spec/contracts/host-install-inspection.md` for the full contract.
73
+
60
74
  ## Codex
61
75
 
62
76
  ```bash
@@ -291,6 +305,7 @@ Hosts support different manifest fields, so do not copy the same set of fields i
291
305
  | `COWORK_FLOW_CONTEXT_ID` | Explicitly set the session identity; use when the host provides no session variable |
292
306
  | `COWORK_FLOW_HOST` | Explicitly set the host id |
293
307
  | `COWORK_FLOW_CODEX` | Set the Codex CLI executable |
308
+ | `COWORK_FLOW_CLI` | Set the cowork-flow CLI the doctor uses to read install state; a `.js`, `.mjs` or `.cjs` path runs through node |
294
309
  | `DSH_HOME` | Override the DeepSeek Harness configuration root |
295
310
  | `KIMI_CODE_HOME` | Override the Kimi Code configuration root |
296
311
  | `CODEX_HOME` | Override the Codex configuration root |
package/docs/hosts.md CHANGED
@@ -57,6 +57,20 @@ cwf host remove <host>
57
57
 
58
58
  机器级 hook 与项目运行时各自升级,而它会在任何工作区触发——包括运行时比它旧的项目。四个机器级注入 shim(Qoder、ZCode、Kimi Code、OpenCode)因此是 **fail-open** 的:项目运行时失败时只在宿主运行日志留原因并返回 0,不注入,也不把「hook 失败」变成「拒绝你的输入」;项目级 Edit 期 hook(Claude Code / Codex)自 2.0.0 起同样不再返回非零退出,一律 advisory。旧项目上注入会静默不生效,跑一次 `cwf project sync .` 即可恢复。
59
59
 
60
+ ## 安装态检查
61
+
62
+ `cwf host list` 只回答“声明了哪些宿主、项目选了哪些”;机器上实际装了什么,用只读的 `cwf host inspect`:
63
+
64
+ ```bash
65
+ cwf host inspect
66
+ cwf host inspect qoder
67
+ cwf host inspect --json
68
+ ```
69
+
70
+ 每个可安装组件一行,状态为 `installed`、`missing`、`stale`、`broken` 或 `unsupported`。`stale` 表示已装载荷版本与当前 CLI 版本不同;`broken` 表示宿主有注册但载荷缺件。doctor 会再拿同一版本与本项目 `.cowork-flow/.version` 比较:CLI 比项目新、但插件仍匹配项目运行时不报;项目已 sync 到新版本、插件落后时仍报 `PLUGIN-STALE`。`kimi-code` 的 `all` 只是命令组合,不会单独出现。命令只读,不修复、不安装、不卸载;安装态异常是数据,不是命令失败,只有未知宿主等用法错误才返回 2。
71
+
72
+ `run doctor` 的宿主检查消费同一份读模型(`cwf host inspect --json`),不再自己解析宿主目录、注册表、设置文件或 TOML。CLI 不在 PATH、退出码非 0、超时或 `schemaVersion` 不匹配时,doctor 报 `HOST-INSPECT-UNAVAILABLE` 并给出升级提示,而不是误报 `PLUGIN-NOT-INSTALLED`——“读不到”和“读到没装”是两件事。完整契约见 `spec/contracts/host-install-inspection.md`。
73
+
60
74
  ## Codex
61
75
 
62
76
  ```bash
@@ -291,6 +305,7 @@ claude mcp add -s user cowork-flow -- cwf mcp serve
291
305
  | `COWORK_FLOW_CONTEXT_ID` | 显式指定会话身份;宿主不提供会话变量时使用 |
292
306
  | `COWORK_FLOW_HOST` | 显式指定宿主 id |
293
307
  | `COWORK_FLOW_CODEX` | 指定 Codex CLI 可执行文件 |
308
+ | `COWORK_FLOW_CLI` | 指定 doctor 读取安装态时调用的 cowork-flow CLI;`.js`/`.mjs`/`.cjs` 路径用 node 执行 |
294
309
  | `DSH_HOME` | 覆盖 DeepSeek Harness 配置根目录 |
295
310
  | `KIMI_CODE_HOME` | 覆盖 Kimi Code 配置根目录 |
296
311
  | `CODEX_HOME` | 覆盖 Codex 配置根目录 |
package/docs/index.en.md CHANGED
@@ -11,7 +11,7 @@ If this is your first time installing and using cowork-flow, read [README](../RE
11
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
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
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 |
14
+ | Contribute to project development | [Contributing](../CONTRIBUTING.en.md) | Local setup, code conventions, tests, and PR checks |
15
15
  | Understand the test and release process | [Release and maintenance](release.en.md) | Test layers, CI, version releases, and maintainer commands |
16
16
  | Understand project direction and version planning | [Direction](direction.en.md) | The positioning statement, settled trade-offs, the version mainline, and open items |
17
17
  | See what changed in a given version | [Changelog](../CHANGELOG.md) (Chinese) | Feature changes, fixes, and migration notes recorded by version |
@@ -2,7 +2,7 @@
2
2
 
3
3
  [中文](release.md) | English
4
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.
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.en.md) first.
6
6
 
7
7
  ## Pre-release checks
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "CLI for installing and maintaining cowork-flow collaboration templates.",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -43,13 +43,14 @@
43
43
  "README.en.md",
44
44
  "CHANGELOG.md",
45
45
  "CONTRIBUTING.md",
46
+ "CONTRIBUTING.en.md",
46
47
  "!template/**/__pycache__/**",
47
48
  "!template/**/*.pyc"
48
49
  ],
49
50
  "scripts": {
50
51
  "test": "npm run test:fast",
51
52
  "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/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
+ "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/eol.test.js test/host-assets.test.js test/host-command.test.js test/host-inspect.test.js test/installed-state-e2e.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
54
  "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
55
  "test:node:full": "node --test --test-timeout=600000",
55
56
  "test:template": "node scripts/run-template-tests.js --suite core",
@@ -58,7 +59,7 @@
58
59
  "icons:export": "node scripts/export-icons.mjs",
59
60
  "source:refresh:dry-run": "node bin/cowork-flow.js dev refresh --dry-run",
60
61
  "source:refresh": "node bin/cowork-flow.js dev refresh",
61
- "test:all": "npm run test:node:full && npm run test:template:full && npm run pack:check",
62
+ "test:all": "npm run test:node:full && npm run test:template:full && python -m pytest -q && npm run pack:check",
62
63
  "release:check": "npm run test:all && node scripts/release-gates.js",
63
64
  "release": "sh scripts/release.sh",
64
65
  "test:windows:core": "npm run test:fast && npm run test:integration && node --test --test-timeout=600000 test/dsh-home-patch.test.js test/dsh-hook.test.js test/dsh-preset.test.js test/dsh-preset-bundle.test.js test/mcp-client-matrix.test.js test/mcp-state-command.test.js test/tarball-install.test.js && node --test --test-timeout=600000 test/init.test.js test/sync.test.js && npm run pack:check && npm run test:template"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Claude Code。",
5
5
  "displayName": "Cowork Flow",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Codex。",
5
5
  "author": {
6
6
  "name": "fishlikewater",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Kimi Code。",
5
5
  "author": {
6
6
  "name": "fishlikewater",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 Qoder。",
5
5
  "displayName": "Cowork Flow",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.2",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 ZCode。",
5
5
  "author": {
6
6
  "name": "fishlikewater",
@@ -0,0 +1,86 @@
1
+ import { hostRegistry } from '../lib/host-assets.js';
2
+ import { readPackageInfo } from '../lib/package-info.js';
3
+
4
+ export const INSPECT_SCHEMA_VERSION = 1;
5
+
6
+ export const INSPECT_STATUSES = Object.freeze([
7
+ 'installed',
8
+ 'missing',
9
+ 'stale',
10
+ 'broken',
11
+ 'unsupported'
12
+ ]);
13
+
14
+
15
+ function normalizedRow(facts, cliVersion) {
16
+ const installed = facts.status === 'installed';
17
+ const stale = installed && facts.version !== null && facts.version !== cliVersion;
18
+ return {
19
+ status: stale ? 'stale' : facts.status,
20
+ version: facts.version ?? null,
21
+ payloadPath: facts.payloadPath ?? null,
22
+ detailPath: facts.detailPath ?? null,
23
+ registeredSource: facts.registeredSource ?? null,
24
+ enabled: facts.enabled ?? null,
25
+ reason: stale
26
+ ? `installed ${facts.version} but the CLI runs ${cliVersion}`
27
+ : facts.reason ?? null
28
+ };
29
+ }
30
+
31
+
32
+ function unsupportedRow(hostId, componentName) {
33
+ return {
34
+ status: 'unsupported',
35
+ version: null,
36
+ payloadPath: null,
37
+ detailPath: null,
38
+ registeredSource: null,
39
+ enabled: null,
40
+ reason: `${hostId} component ${componentName} does not expose an installed-state reader`
41
+ };
42
+ }
43
+
44
+
45
+ // Read-only aggregation. Each component owns its installation layout and
46
+ // exposes the facts; this module only normalizes them against the running CLI.
47
+ export async function inspectHosts(components, hostIds, { env = process.env } = {}) {
48
+ const { version: cliVersion } = await readPackageInfo();
49
+ const hosts = [];
50
+ for (const hostId of hostIds) {
51
+ const platform = hostRegistry.platform(hostId);
52
+ const host = components[hostId];
53
+ for (const [componentName, component] of Object.entries(host.components)) {
54
+ // `all` is a composition of the components below it, not a separate
55
+ // installed artifact.
56
+ if (componentName === 'all') {
57
+ continue;
58
+ }
59
+ const facts = typeof component.inspect === 'function'
60
+ ? await component.inspect({ env })
61
+ : unsupportedRow(hostId, componentName);
62
+ hosts.push({
63
+ id: hostId,
64
+ displayName: platform.displayName,
65
+ component: componentName,
66
+ ...normalizedRow(facts, cliVersion)
67
+ });
68
+ }
69
+ }
70
+ return {
71
+ schemaVersion: INSPECT_SCHEMA_VERSION,
72
+ cliVersion,
73
+ hosts
74
+ };
75
+ }
76
+
77
+
78
+ export function renderInspectLine(row) {
79
+ const detail = [
80
+ row.version ? `version ${row.version}` : null,
81
+ row.detailPath || row.payloadPath,
82
+ row.enabled === false ? 'not enabled' : null,
83
+ row.reason
84
+ ].filter(Boolean).join('; ');
85
+ return `${row.id} (${row.displayName}, ${row.component}): ${row.status}${detail ? ` - ${detail}` : ''}\n`;
86
+ }