cowork-flow 1.6.0 → 1.7.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 (129) hide show
  1. package/CHANGELOG.md +213 -213
  2. package/CONTRIBUTING.md +137 -0
  3. package/LICENSE +1 -1
  4. package/README.md +108 -369
  5. package/docs/architecture.md +122 -0
  6. package/docs/hosts.md +290 -0
  7. package/docs/index.md +32 -0
  8. package/docs/release.md +104 -0
  9. package/package.json +37 -7
  10. package/presets/claude-code/.claude-plugin/plugin.json +28 -0
  11. package/presets/claude-code/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  12. package/presets/codex/.codex-plugin/plugin.json +37 -0
  13. package/presets/codex/assets/logo.svg +4 -0
  14. package/presets/codex/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  15. package/presets/dsh/agent.cordis.yml +35 -12
  16. package/presets/dsh/plugins/workflow-state.js +88 -72
  17. package/presets/dsh/preset.yml +1 -1
  18. package/presets/kimi-code/.kimi-plugin/plugin.json +35 -0
  19. package/presets/kimi-code/hooks/cowork-flow-inject.mjs +14 -2
  20. package/presets/kimi-code/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  21. package/presets/opencode/cowork-flow/plugin-core.js +1077 -0
  22. package/presets/opencode/cowork-flow/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  23. package/presets/opencode/plugins/cowork-flow.js +44 -0
  24. package/presets/plugin-meta.json +52 -0
  25. package/presets/qoder/.qoder-plugin/plugin.json +29 -0
  26. package/presets/qoder/agents/cowork-check.md +29 -0
  27. package/presets/qoder/agents/cowork-implement.md +30 -0
  28. package/presets/qoder/agents/cowork-research.md +23 -0
  29. package/presets/qoder/hooks/hooks.json +50 -0
  30. package/presets/qoder/hooks/inject-context.mjs +150 -0
  31. package/presets/qoder/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  32. package/{template/.zcode → presets/zcode}/.zcode-plugin/plugin.json +4 -2
  33. package/{template/.zcode → presets/zcode}/agents/cowork-check.md +4 -4
  34. package/{template/.zcode → presets/zcode}/agents/cowork-implement.md +4 -4
  35. package/{template/.zcode → presets/zcode}/agents/cowork-research.md +1 -1
  36. package/{template/.zcode → presets/zcode}/hooks/inject-context.js +36 -19
  37. package/presets/zcode/skills/cowork-flow-bootstrap/SKILL.md +35 -0
  38. package/src/cli.js +130 -130
  39. package/src/commands/host.js +182 -0
  40. package/src/commands/init.js +28 -43
  41. package/src/commands/install-claude-code-plugin.js +129 -0
  42. package/src/commands/install-codex-plugin.js +312 -0
  43. package/src/commands/install-dsh-hook.js +36 -43
  44. package/src/commands/install-dsh-preset.js +228 -49
  45. package/src/commands/install-kimi-code-plugin.js +142 -0
  46. package/src/commands/install-kimi-hook.js +142 -122
  47. package/src/commands/install-opencode-plugin.js +158 -0
  48. package/src/commands/install-qoder-plugin.js +211 -0
  49. package/src/commands/install-zcode-plugin.js +131 -82
  50. package/src/commands/mcp-state.js +7 -6
  51. package/src/commands/registry.js +345 -0
  52. package/src/commands/source-refresh.js +10 -11
  53. package/src/commands/sync.js +10 -13
  54. package/src/commands/update.js +5 -10
  55. package/src/lib/cli-flags.js +102 -0
  56. package/src/lib/copy-template.js +89 -75
  57. package/src/lib/host-assets.js +192 -57
  58. package/src/lib/install-support.js +50 -0
  59. package/src/lib/platforms.js +0 -15
  60. package/src/lib/plugin-metadata.js +187 -0
  61. package/src/lib/plugin-payload.js +70 -0
  62. package/template/.cowork-flow/.version +1 -1
  63. package/template/.cowork-flow/adapters/claude-code/adapter.yaml +0 -1
  64. package/template/.cowork-flow/adapters/dsh/adapter.yaml +0 -1
  65. package/template/.cowork-flow/adapters/kimi-code/adapter.yaml +0 -1
  66. package/template/.cowork-flow/adapters/qoder/adapter.yaml +32 -0
  67. package/template/.cowork-flow/adapters/zcode/adapter.yaml +2 -2
  68. package/template/.cowork-flow/config.yaml +6 -4
  69. package/template/.cowork-flow/scripts/adapters/cli/batch_mode.py +10 -12
  70. package/template/.cowork-flow/scripts/adapters/cli/spec_check.py +67 -35
  71. package/template/.cowork-flow/scripts/adapters/cli/subagent.py +84 -38
  72. package/template/.cowork-flow/scripts/adapters/cli/task.py +42 -0
  73. package/template/.cowork-flow/scripts/adapters/cli/task_create_command.py +1 -9
  74. package/template/.cowork-flow/scripts/adapters/cli/task_lifecycle_commands.py +6 -0
  75. package/template/.cowork-flow/scripts/adapters/cli/task_navigation.py +13 -10
  76. package/template/.cowork-flow/scripts/adapters/cli/task_next_runner.py +2 -1
  77. package/template/.cowork-flow/scripts/adapters/git/git_context.py +14 -82
  78. package/template/.cowork-flow/scripts/adapters/host/claude_code_policy.py +2 -3
  79. package/template/.cowork-flow/scripts/adapters/host/codex_policy.py +2 -5
  80. package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +122 -10
  81. package/template/.cowork-flow/scripts/adapters/host/inject.py +49 -19
  82. package/template/.cowork-flow/scripts/adapters/host/kimi_code_policy.py +1 -1
  83. package/template/.cowork-flow/scripts/adapters/host/policy_base.py +58 -0
  84. package/template/.cowork-flow/scripts/adapters/host/qoder_policy.py +66 -0
  85. package/template/.cowork-flow/scripts/adapters/host/workflow_state_hook.py +136 -132
  86. package/template/.cowork-flow/scripts/adapters/host/zcode_policy.py +23 -24
  87. package/template/.cowork-flow/scripts/adapters/mcp/state_server.py +41 -56
  88. package/template/.cowork-flow/scripts/adapters/review/test_intent.py +2 -2
  89. package/template/.cowork-flow/scripts/infra/config.py +26 -23
  90. package/template/.cowork-flow/scripts/infra/developer_profile.py +4 -41
  91. package/template/.cowork-flow/scripts/infra/files.py +3 -7
  92. package/template/.cowork-flow/scripts/infra/git_snapshot.py +8 -7
  93. package/template/.cowork-flow/scripts/infra/paths.py +9 -69
  94. package/template/.cowork-flow/scripts/infra/process.py +9 -0
  95. package/template/.cowork-flow/scripts/infra/skill_manifest.py +262 -169
  96. package/template/.cowork-flow/scripts/infra/storage/operation_log.py +2 -0
  97. package/template/.cowork-flow/scripts/infra/storage/state_store.py +0 -2
  98. package/template/.cowork-flow/scripts/infra/storage/unit_of_work.py +163 -18
  99. package/template/.cowork-flow/scripts/kernel/workflow_route.py +6 -16
  100. package/template/.cowork-flow/scripts/run.py +14 -4
  101. package/template/.cowork-flow/scripts/runtime/host_identity.py +33 -15
  102. package/template/.cowork-flow/scripts/runtime/session_state.py +83 -26
  103. package/template/.cowork-flow/scripts/services/context_discovery.py +15 -3
  104. package/template/.cowork-flow/scripts/services/context_paths.py +4 -4
  105. package/template/.cowork-flow/scripts/services/fact_view.py +13 -10
  106. package/template/.cowork-flow/scripts/services/lifecycle_checks.py +47 -13
  107. package/template/.cowork-flow/scripts/services/lifecycle_policy.py +5 -2
  108. package/template/.cowork-flow/scripts/services/readiness.py +8 -3
  109. package/template/.cowork-flow/scripts/services/spec_check.py +23 -33
  110. package/template/.cowork-flow/scripts/services/task_archive.py +76 -41
  111. package/template/.cowork-flow/scripts/services/task_creation.py +90 -34
  112. package/template/.cowork-flow/scripts/services/task_lifecycle.py +210 -50
  113. package/template/.cowork-flow/scripts/services/task_routing.py +0 -8
  114. package/template/.cowork-flow/scripts/services/task_tree.py +181 -29
  115. package/template/.cowork-flow/scripts/services/task_utils.py +3 -20
  116. package/template/.cowork-flow/scripts/services/workflow_runtime.py +39 -22
  117. package/template/.cowork-flow/spec/contracts/context-injection.md +27 -2
  118. package/template/.cowork-flow/spec/contracts/fact-layer-access.md +7 -4
  119. package/template/.cowork-flow/spec/contracts/index.md +4 -0
  120. package/template/.cowork-flow/spec/contracts/spec-checks.md +13 -2
  121. package/template/.cowork-flow/spec/runtime/host-assets.json +155 -18
  122. package/template/.cowork-flow/spec/runtime/index.md +1 -1
  123. package/template/.cowork-flow/spec/schemas/host-assets.schema.json +69 -7
  124. package/template/.dsh/README.md +27 -7
  125. package/template/.opencode/cowork-flow/plugin-core.js +1077 -0
  126. package/template/.opencode/plugins/cowork-flow.js +23 -800
  127. package/template/skills/python-runtime-design/SKILL.md +6 -0
  128. package/template/skills/runtime-health/scripts/doctor.py +725 -14
  129. /package/{template/.zcode → presets/zcode}/hooks/hooks.json +0 -0
@@ -0,0 +1,137 @@
1
+ # 参与开发
2
+
3
+ 感谢你参与 cowork-flow。本文只保留开始工作、判断改动范围和提交 PR 需要知道的内容。仓库结构见 [架构与扩展](docs/architecture.md),发布流程见 [开发与发布](docs/release.md)。
4
+
5
+ ## 环境要求
6
+
7
+ | 依赖 | 版本 | 用途 |
8
+ |---|---|---|
9
+ | Node.js | 20 或更高 | CLI 与 Node 测试 |
10
+ | Python | 3.10 | 模板运行时与 Python 测试 |
11
+ | Git | 当前稳定版 | 任务基线、同步和宿主测试 |
12
+
13
+ 仓库没有运行时依赖,也没有 devDependency。`npm ci` 不会安装第三方包;新增依赖前先说明原因并讨论方案。
14
+
15
+ 所有源码和文档使用 UTF-8。Windows 脚本与 POSIX 脚本的行尾契约由 `.gitattributes` 管理,不要手工改写。
16
+
17
+ ## 本地起步
18
+
19
+ ```bash
20
+ git clone https://github.com/fishlikewater/cowork-flow.git
21
+ cd cowork-flow
22
+ npm ci
23
+ npm run source:refresh
24
+ ```
25
+
26
+ `source:refresh` 会从 `template/` 刷新本仓库自己的 `.cowork-flow/`、`.agents/skills/` 和 `.claude/skills/`。改过 `template/` 后必须重跑,否则本地测试和 `./.cowork-flow/run` 仍使用旧副本。
27
+
28
+ 本仓库也使用 cowork-flow。开始修改前先查看当前状态:
29
+
30
+ ```bash
31
+ ./.cowork-flow/run task next --json
32
+ ```
33
+
34
+ `AGENTS.md` 和 `.cowork-flow/spec/` 是实现约束,不要绕开当前任务另建一套流程。
35
+
36
+ ## 先判断改哪里
37
+
38
+ | 改动 | 主要位置 |
39
+ |---|---|
40
+ | 项目初始化后写入的文件 | `template/` |
41
+ | 机器级插件、预设和 hook | `presets/` |
42
+ | CLI 命令与安装器 | `src/commands/`、`src/lib/` |
43
+ | 项目运行时 | `template/.cowork-flow/scripts/` |
44
+ | 宿主、同步和技能声明 | `template/.cowork-flow/spec/runtime/host-assets.json` |
45
+ | Node 测试 | `test/` |
46
+ | Python 测试 | `tests/` |
47
+ | 用户和维护文档 | `README.md`、`docs/`、`CONTRIBUTING.md` |
48
+
49
+ 新增或修改行为时,先补一个能失败的测试,再写最小实现。重构前先固定现有行为,避免顺手改动无关模块。
50
+
51
+ ## 宿主改动
52
+
53
+ 接入或修改宿主时,通常需要同时检查:
54
+
55
+ | 位置 | 内容 |
56
+ |---|---|
57
+ | `template/.<host>/` | 需要随项目落盘的 hook、agents、commands 和配置 |
58
+ | `template/.cowork-flow/adapters/<host>/adapter.yaml` | 适配器与技能发现声明 |
59
+ | `template/.cowork-flow/spec/runtime/host-assets.json` | 平台、载荷、同步策略和迁移清单 |
60
+ | `presets/<host>/` | 插件、预设或机器级 hook |
61
+ | `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` | 安装前提、升级、卸载和排障 |
64
+
65
+ 宿主特化不能进入通用层。需要遵守以下边界:
66
+
67
+ - `template/.cowork-flow/scripts/{services,runtime,infra}` 和 `src/lib/` 的通用模块不写宿主分支。
68
+ - 宿主差异放在 Host Asset Manifest、`scripts/adapters/`、`template/.<host>/` 或明确的宿主命令模块中。
69
+ - 插件只提供宿主确实支持的字段,不复制未知或无效键。
70
+ - 项目技能只由 `template/skills/` 分发;机器级载荷不复制同名项目技能。
71
+ - 修改命令名时,同步更新注册表、README、doctor 提示、Skill 正文和测试。
72
+
73
+ ## 测试
74
+
75
+ | 命令 | 覆盖范围 |
76
+ |---|---|
77
+ | `npm run test:fast` | 核心 Node 套件,等价于 `npm test` |
78
+ | `npm run test:integration` | `project init` / `sync` 关键集成路径 |
79
+ | `npm run test:node:full` | 全部 Node 测试 |
80
+ | `npm run test:template` | 核心模板集成测试 |
81
+ | `npm run test:template:full` | 完整模板 Python 测试 |
82
+ | `npm run test:windows:core` | Windows 路径、换行、宿主和打包检查 |
83
+ | `python -m pytest -q` | 仓库级 Python 测试 |
84
+ | `npm run release:check` | 完整 Node、模板和打包门禁 |
85
+
86
+ `test:fast` 只运行 `package.json` 中列出的核心套件。新增测试文件时,根据影响面决定是否加入该列表。
87
+
88
+ 平台前提不满足时,测试可能明确跳过。PR 描述必须列出跳过项和未验证项,不能把跳过写成通过。
89
+
90
+ ## 提交信息
91
+
92
+ 使用 Conventional Commits:
93
+
94
+ ```text
95
+ <type>(<scope>): <中文描述>
96
+ ```
97
+
98
+ 示例:
99
+
100
+ ```text
101
+ feat(host): 接入 Qoder 宿主
102
+ fix(host): 修正技能发现路径
103
+ refactor(zcode): 将插件载荷迁到 presets/zcode
104
+ ```
105
+
106
+ 常用 `type`:`feat`、`fix`、`refactor`、`docs`、`test`、`chore`、`perf`。描述写清楚做了什么,不写“优化体验”一类无法核对的信息。
107
+
108
+ ## PR 前置检查
109
+
110
+ 至少运行:
111
+
112
+ ```bash
113
+ npm run test:fast
114
+ git diff --check
115
+ ```
116
+
117
+ 按改动范围补充:
118
+
119
+ ```bash
120
+ npm run release:check # template/、presets/、src/commands/
121
+ python -m pytest -q # template/.cowork-flow/、tests/
122
+ npm run test:integration # init / sync
123
+ ./.cowork-flow/run spec-check # 规范声明覆盖的改动
124
+ ```
125
+
126
+ PR 描述需要写明:
127
+
128
+ - 改了什么,以及为什么这样改。
129
+ - 运行过哪些测试及结果。
130
+ - 哪些平台用例跳过或仍未验证。
131
+ - 是否改变安装位置、命令、配置格式或升级步骤。
132
+
133
+ CI 在 Ubuntu 和 Windows 上运行各自的门禁。本地缺少平台前提可以跳过,但必须如实记录。
134
+
135
+ ## 许可
136
+
137
+ 提交代码即表示同意以 [MIT](LICENSE) 授权。
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 fisklikewater
3
+ Copyright (c) 2026 fishlikewater
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal