tianshu-mcp 0.3.0 → 0.3.1
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/CHANGELOG.en.md +42 -1
- package/CHANGELOG.md +35 -1
- package/README.en.md +5 -1
- package/README.md +5 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +85 -83
- package/scripts/gitee-release.mjs +110 -0
- package/scripts/release-body.mjs +142 -0
- package/skills/tianshu-mcp/SKILL.md +43 -35
- package/skills/tianshu-mcp/usage-examples.md +108 -24
package/CHANGELOG.en.md
CHANGED
|
@@ -19,6 +19,43 @@ Chinese version: [CHANGELOG.md](CHANGELOG.md)
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## [0.3.1] — 2026-09-12
|
|
23
|
+
|
|
24
|
+
Post-v0.3.0 housekeeping for docs and release automation: **no source-level behavior changes**.
|
|
25
|
+
The focus is a full rewrite of the self-installed skill docs plus GitHub/Gitee release-body
|
|
26
|
+
composition and link fixes.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **Skill docs (`skills/tianshu-mcp/`) fully rewritten to match the actual v0.3.0 tool surface**:
|
|
31
|
+
- Corrected the `codex` description from "headless CLI" to the ChatGPT desktop GUI adapter
|
|
32
|
+
(MSIX + COM activation + CDP); documents the required `model`, optional `reasoningLevel` /
|
|
33
|
+
`planDoc` / `designSystem`, and that `mode` is not supported;
|
|
34
|
+
- Documented the `run_task` `context` parameter and the send-time validation of path references
|
|
35
|
+
inside task/context; corrected the `autoFixRounds` default precedence
|
|
36
|
+
(call argument > codex 5 / zcode 2 > server default 0);
|
|
37
|
+
- Added usage for `list_tasks`, `query_task(tailLines)`, `get_task_report(round)` and
|
|
38
|
+
`verify_task` (`extraChecks` / `checksMode` / `baselineRef`) plus the four-level acceptance
|
|
39
|
+
command precedence;
|
|
40
|
+
- Documented the four `needs_user` kinds and meta fields such as `needsUserKind` /
|
|
41
|
+
`pendingQuestion` / `errorType` / `reportRound` / `verificationSource`;
|
|
42
|
+
- Added `continue_task` to the approval list; replaced emoji status markers with plain text
|
|
43
|
+
(PASS / warning) in the usage examples.
|
|
44
|
+
- **Release automation fixes (exposed by the v0.3.0 tag)**:
|
|
45
|
+
- The release body is now composed bilingually from `docs/release-v<version>.md` and `.en.md`,
|
|
46
|
+
with in-document relative links rewritten to tag-absolute links; a missing doc fails the
|
|
47
|
+
workflow loudly instead of producing a shell-only body;
|
|
48
|
+
- `Full Changelog` resolves the previous tag via `git describe` into a `compare/<prev>...<tag>`
|
|
49
|
+
link instead of degrading to a commits link;
|
|
50
|
+
- The body's `CI` link resolves the CI run for the same SHA instead of pointing at the Release run;
|
|
51
|
+
- Gitee releases are automated in `release.yml`: `scripts/gitee-release.mjs` idempotently
|
|
52
|
+
creates/updates the mirrored release (requires the `GITEE_TOKEN` secret; skipped loudly when unset).
|
|
53
|
+
- `.gitignore` now ignores npm pack artifacts and local temporary verification directories.
|
|
54
|
+
- Added the missing `[0.1.10]` / `[0.2.0]` / `[0.3.0]` / `[0.3.1]` compare links at the bottom of
|
|
55
|
+
this file and its Chinese counterpart.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
22
59
|
## [0.3.0] — 2026-09-12
|
|
23
60
|
|
|
24
61
|
The Codex desktop app now runs through a **GUI driver**: a new `codex-gui` adapter uses MSIX COM activation
|
|
@@ -401,7 +438,11 @@ project → pick model and reasoning level → send instructions → run detecti
|
|
|
401
438
|
|
|
402
439
|
---
|
|
403
440
|
|
|
404
|
-
[Unreleased]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1
|
|
441
|
+
[Unreleased]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.1...HEAD
|
|
442
|
+
[0.3.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.0...v0.3.1
|
|
443
|
+
[0.3.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.2.0...v0.3.0
|
|
444
|
+
[0.2.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.10...v0.2.0
|
|
445
|
+
[0.1.10]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.9...v0.1.10
|
|
405
446
|
[0.1.9]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.8...v0.1.9
|
|
406
447
|
[0.1.8]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.7...v0.1.8
|
|
407
448
|
[0.1.7]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.6...v0.1.7
|
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,36 @@
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## [0.3.1] — 2026-09-12
|
|
22
|
+
|
|
23
|
+
v0.3.0 发布后的文档与发布自动化收口:**无源码行为变更**,重点是技能自检安装文档全面重写、
|
|
24
|
+
GitHub/Gitee 发行版正文合成与链接修复。
|
|
25
|
+
|
|
26
|
+
### 变更
|
|
27
|
+
|
|
28
|
+
- **技能文档(`skills/tianshu-mcp/`)全面重写并对齐 v0.3.0 实际工具面**:
|
|
29
|
+
- 修正 `codex` 描述:由「无头 CLI」更正为 ChatGPT 桌面端 GUI adapter(MSIX + COM 激活 + CDP),
|
|
30
|
+
标注 `model` 必填、`reasoningLevel` / `planDoc` / `designSystem` 用法、不支持 `mode`;
|
|
31
|
+
- 补齐 `run_task` 的 `context` 参数语义与 task/context 路径引用发送前校验说明;
|
|
32
|
+
修正 `autoFixRounds` 默认值优先级(调用参数 > codex 5 / zcode 2 > server 默认 0);
|
|
33
|
+
- 补齐 `list_tasks`、`query_task(tailLines)`、`get_task_report(round)` 与
|
|
34
|
+
`verify_task`(`extraChecks` / `checksMode` / `baselineRef`)的用法与验收命令四级优先级;
|
|
35
|
+
- 补充 `needs_user` 四种等待类型与 meta 块 `needsUserKind` / `pendingQuestion` / `errorType` /
|
|
36
|
+
`reportRound` / `verificationSource` 等字段解读;
|
|
37
|
+
- 审批清单补上 `continue_task`;使用示例中的 emoji 状态标记改为文字(PASS / 告警)。
|
|
38
|
+
- **发布自动化修复(v0.3.0 tag 实测暴露)**:
|
|
39
|
+
- Release 正文改为由 `docs/release-v<版本>.md` 与 `.en.md` 双语合成,文档内相对链接改写为
|
|
40
|
+
该 tag 的绝对链接,缺文档时工作流明确报错(不再产出空壳正文);
|
|
41
|
+
- `Full Changelog` 经 `git describe` 解析上一 tag,生成 `compare/<prev>...<tag>` 比较链接,
|
|
42
|
+
不再退化为 commits 链接;
|
|
43
|
+
- 正文 `CI` 链接解析同 SHA 的 CI 运行,避免误指 Release 自身运行;
|
|
44
|
+
- Gitee 发行版纳入 `release.yml` 自动化:`scripts/gitee-release.mjs` 幂等创建/更新
|
|
45
|
+
(需仓库 Secret `GITEE_TOKEN`,未配置时明确提示并跳过)。
|
|
46
|
+
- `.gitignore` 忽略 npm pack 产物与本地临时校验目录。
|
|
47
|
+
- 补齐本文件与英文版底部缺失的 `[0.1.10]` / `[0.2.0]` / `[0.3.0]` / `[0.3.1]` 比较链接。
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
21
51
|
## [0.3.0] — 2026-09-12
|
|
22
52
|
|
|
23
53
|
Codex 桌面端改为 **GUI 驱动**:新增 `codex-gui` adapter,通过 MSIX COM 激活 + CDP 接管,
|
|
@@ -356,7 +386,11 @@ Codex 桌面端改为 **GUI 驱动**:新增 `codex-gui` adapter,通过 MSIX
|
|
|
356
386
|
|
|
357
387
|
---
|
|
358
388
|
|
|
359
|
-
[未发布]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1
|
|
389
|
+
[未发布]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.1...HEAD
|
|
390
|
+
[0.3.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.0...v0.3.1
|
|
391
|
+
[0.3.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.2.0...v0.3.0
|
|
392
|
+
[0.2.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.10...v0.2.0
|
|
393
|
+
[0.1.10]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.9...v0.1.10
|
|
360
394
|
[0.1.9]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.8...v0.1.9
|
|
361
395
|
[0.1.8]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.7...v0.1.8
|
|
362
396
|
[0.1.7]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.6...v0.1.7
|
package/README.en.md
CHANGED
|
@@ -182,6 +182,7 @@ Use `server.log` when troubleshooting connections; do not treat stderr output it
|
|
|
182
182
|
| [docs/zcode-windows-smoke.en.md](docs/zcode-windows-smoke.en.md) | ZCode Windows hardware record for development, same-session repair, and question continuation |
|
|
183
183
|
| [docs/codex-gui-cdp.en.md](docs/codex-gui-cdp.en.md) | Codex desktop GUI driver: MSIX COM activation, CDP attach, selectors, run detection, verify/repair |
|
|
184
184
|
| [docs/codex-windows-smoke.en.md](docs/codex-windows-smoke.en.md) | Codex Windows hardware record (incl. verify-fail → auto plan → repair-pass loop) |
|
|
185
|
+
| [docs/release-v0.3.1.en.md](docs/release-v0.3.1.en.md) | v0.3.1 release notes (skill docs rewrite + release automation fixes) |
|
|
185
186
|
| [docs/release-v0.3.0.en.md](docs/release-v0.3.0.en.md) | v0.3.0 release notes (Codex desktop GUI adapter, incl. BREAKING) |
|
|
186
187
|
| [docs/release-v0.2.0.en.md](docs/release-v0.2.0.en.md) | v0.2.0 release notes (unified ZCode GUI loop) |
|
|
187
188
|
| [docs/acceptance-config.en.md](docs/acceptance-config.en.md) | Project-level `.tianshu-mcp/acceptance.json` acceptance config spec |
|
|
@@ -254,6 +255,9 @@ Use `server.log` when troubleshooting connections; do not treat stderr output it
|
|
|
254
255
|
- Hardware-verified: full loop for a registered project, full loop for an unregistered project after automatic registration, and the verify-fail → generated plan → repair-pass loop
|
|
255
256
|
- Real business acceptance: drove Codex to build a "Fruit Ninja" mini-game, passed acceptance, verified playable in a headless browser; [acceptance record](docs/codex-windows-smoke.en.md)
|
|
256
257
|
- macOS unverified; built-in status `research`
|
|
258
|
+
- **M13 — Skill docs alignment + release automation fixes + v0.3.1** (2026-09-12, see [release-v0.3.1.en.md](docs/release-v0.3.1.en.md))
|
|
259
|
+
- Self-installed skill docs (SKILL.md / usage-examples.md) rewritten item by item against the v0.3.0 tool surface (codex GUI params, needs_user handling, verify/list usage)
|
|
260
|
+
- Bilingual release bodies, Full Changelog & CI link fixes, and automated Gitee releases
|
|
257
261
|
|
|
258
262
|
## Agent support status
|
|
259
263
|
|
|
@@ -276,7 +280,7 @@ Use `server.log` when troubleshooting connections; do not treat stderr output it
|
|
|
276
280
|
|
|
277
281
|
| Document | Content |
|
|
278
282
|
|---|---|
|
|
279
|
-
| [CHANGELOG.en.md](CHANGELOG.en.md) | Version history (v0.1.0 → v0.3.
|
|
283
|
+
| [CHANGELOG.en.md](CHANGELOG.en.md) | Version history (v0.1.0 → v0.3.1) |
|
|
280
284
|
| [CONTRIBUTING.en.md](CONTRIBUTING.en.md) | Dev setup, conventions, commit/release flow, adding an agent |
|
|
281
285
|
| [SECURITY.en.md](SECURITY.en.md) | Security model (zero credentials / command whitelist / process & desktop-automation boundaries) and private reporting |
|
|
282
286
|
| [CODE_OF_CONDUCT.en.md](CODE_OF_CONDUCT.en.md) | Contributor Code of Conduct |
|
package/README.md
CHANGED
|
@@ -180,6 +180,7 @@ ZCode 提问或需要用户处理登录、旧实例、系统权限时进入 `nee
|
|
|
180
180
|
| [docs/zcode-windows-smoke.md](docs/zcode-windows-smoke.md) | ZCode Windows 真机开发、同会话返修与提问续跑验收记录 |
|
|
181
181
|
| [docs/codex-gui-cdp.md](docs/codex-gui-cdp.md) | Codex 桌面端 GUI 驱动:MSIX COM 激活、CDP 接管、选择器、运行检测、验收返修 |
|
|
182
182
|
| [docs/codex-windows-smoke.md](docs/codex-windows-smoke.md) | Codex Windows 真机验收记录(含验收失败→自动生成计划→返修通过闭环) |
|
|
183
|
+
| [docs/release-v0.3.1.md](docs/release-v0.3.1.md) | v0.3.1 发布说明(技能文档重写 + 发布自动化修复) |
|
|
183
184
|
| [docs/release-v0.3.0.md](docs/release-v0.3.0.md) | v0.3.0 发布说明(Codex 桌面端 GUI 适配,含 BREAKING) |
|
|
184
185
|
| [docs/release-v0.2.0.md](docs/release-v0.2.0.md) | v0.2.0 发布说明(ZCode GUI 统一闭环) |
|
|
185
186
|
| [docs/acceptance-config.md](docs/acceptance-config.md) | 项目级 `.tianshu-mcp/acceptance.json` 验收配置规范 |
|
|
@@ -254,6 +255,9 @@ ZCode 提问或需要用户处理登录、旧实例、系统权限时进入 `nee
|
|
|
254
255
|
- 真机通过:已登记项目全链路、未登记项目自动登记全链路、验收失败→自动生成计划→返修通过闭环
|
|
255
256
|
- 真实业务验收:驱动 Codex 开发「切水果小游戏」并通过验收,无头浏览器实测可玩;[验收记录](docs/codex-windows-smoke.md)
|
|
256
257
|
- macOS 未验证,内置状态 `research`
|
|
258
|
+
- **M13 — 技能文档对齐 + 发布自动化修复 + v0.3.1**(2026-09-12,见 [release-v0.3.1.md](docs/release-v0.3.1.md))
|
|
259
|
+
- 技能自检安装文档(SKILL.md / usage-examples.md)对照 v0.3.0 工具面逐项重写(codex GUI 参数、needs_user 处理、verify/list 用法)
|
|
260
|
+
- Release 正文双语合成、Full Changelog 与 CI 链接修复、Gitee 发行版纳入自动化
|
|
257
261
|
|
|
258
262
|
## Agent 适配现状
|
|
259
263
|
|
|
@@ -277,7 +281,7 @@ ZCode 提问或需要用户处理登录、旧实例、系统权限时进入 `nee
|
|
|
277
281
|
| 文档 | 内容 |
|
|
278
282
|
|---|---|
|
|
279
283
|
| [HANDOFF.md](HANDOFF.md) | 项目交接文档:当前状态快照、架构导览、硬性红线、已知限制、接手建议 |
|
|
280
|
-
| [CHANGELOG.md](CHANGELOG.md) | 版本变更日志(v0.1.0 → v0.3.
|
|
284
|
+
| [CHANGELOG.md](CHANGELOG.md) | 版本变更日志(v0.1.0 → v0.3.1) |
|
|
281
285
|
| [CONTRIBUTING.md](CONTRIBUTING.md) | 开发环境、工程规范、提交与发布流程、如何新增 agent |
|
|
282
286
|
| [SECURITY.md](SECURITY.md) | 安全模型(凭证零管理/命令白名单/进程与桌面自动化边界)与私密报告渠道 |
|
|
283
287
|
| [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) | 贡献者行为准则 |
|
package/package.json
CHANGED
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tianshu-mcp",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "天枢 × AI-Agent 编排 MCP server —— 驱动 Codex CLI、TraeWork GUI 与 ZCode GUI 完成项目开发、验收、失败返修与再验收闭环。",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/lanlan0811/tianshu-mcp.git"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/lanlan0811/tianshu-mcp#readme",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/lanlan0811/tianshu-mcp/issues"
|
|
14
|
-
},
|
|
15
|
-
"bin": {
|
|
16
|
-
"tianshu-mcp": "dist/index.js"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"skills",
|
|
21
|
-
"assets",
|
|
22
|
-
"scripts/probe-zcode.mjs",
|
|
23
|
-
"scripts/probe-codex.mjs",
|
|
24
|
-
"scripts/smoke-zcode.mjs",
|
|
25
|
-
"scripts/prepare-zcode-fixture.mjs",
|
|
26
|
-
"README.md",
|
|
27
|
-
"README.en.md",
|
|
28
|
-
"CHANGELOG.md",
|
|
29
|
-
"CHANGELOG.en.md",
|
|
30
|
-
"LICENSE"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"eslint": "^8.
|
|
66
|
-
"eslint
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "tianshu-mcp",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "天枢 × AI-Agent 编排 MCP server —— 驱动 Codex CLI、TraeWork GUI 与 ZCode GUI 完成项目开发、验收、失败返修与再验收闭环。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/lanlan0811/tianshu-mcp.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/lanlan0811/tianshu-mcp#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lanlan0811/tianshu-mcp/issues"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"tianshu-mcp": "dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"skills",
|
|
21
|
+
"assets",
|
|
22
|
+
"scripts/probe-zcode.mjs",
|
|
23
|
+
"scripts/probe-codex.mjs",
|
|
24
|
+
"scripts/smoke-zcode.mjs",
|
|
25
|
+
"scripts/prepare-zcode-fixture.mjs",
|
|
26
|
+
"README.md",
|
|
27
|
+
"README.en.md",
|
|
28
|
+
"CHANGELOG.md",
|
|
29
|
+
"CHANGELOG.en.md",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"scripts/gitee-release.mjs",
|
|
32
|
+
"scripts/release-body.mjs"
|
|
33
|
+
],
|
|
34
|
+
"main": "dist/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"sync-version": "node scripts/sync-version.mjs",
|
|
43
|
+
"build": "npm run sync-version && tsc -p tsconfig.build.json",
|
|
44
|
+
"dev": "tsx src/index.ts",
|
|
45
|
+
"start": "node dist/index.js",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest",
|
|
48
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
49
|
+
"lint": "eslint . --max-warnings 0",
|
|
50
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
51
|
+
"check:stdio": "node scripts/check-stdio.mjs --entry dist/index.js",
|
|
52
|
+
"check:stdio:src": "node scripts/check-stdio.mjs --entry src/index.ts --tsx",
|
|
53
|
+
"smoke:zcode": "node scripts/smoke-zcode.mjs",
|
|
54
|
+
"fixture:zcode": "node scripts/prepare-zcode-fixture.mjs",
|
|
55
|
+
"pack:check": "npm pack --dry-run"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
59
|
+
"cross-spawn": "^7.0.6",
|
|
60
|
+
"zod": "^3.24.1"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/cross-spawn": "^6.0.6",
|
|
64
|
+
"@types/node": "^22.10.2",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
66
|
+
"@typescript-eslint/parser": "^8.18.1",
|
|
67
|
+
"eslint": "^8.57.1",
|
|
68
|
+
"eslint-config-prettier": "^9.1.0",
|
|
69
|
+
"prettier": "^3.4.2",
|
|
70
|
+
"tsx": "^4.19.2",
|
|
71
|
+
"typescript": "^5.7.2",
|
|
72
|
+
"vite": "^6.4.3",
|
|
73
|
+
"vitest": "^4.1.11"
|
|
74
|
+
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"mcp",
|
|
77
|
+
"model-context-protocol",
|
|
78
|
+
"ai-agent",
|
|
79
|
+
"orchestration",
|
|
80
|
+
"codex",
|
|
81
|
+
"zcode",
|
|
82
|
+
"traework",
|
|
83
|
+
"tianshu"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 创建/更新 Gitee 发行版(Release)——镜像仓库补齐。
|
|
4
|
+
*
|
|
5
|
+
* 背景:GitHub Actions 的 release 工作流只作用于 GitHub;Gitee 作为镜像仓库需要单独创建发行版,
|
|
6
|
+
* 否则会出现「只有 tag、没有发行版」的不一致。本脚本用 Gitee OpenAPI 幂等补齐:
|
|
7
|
+
* 已存在同 tag 发行版则更新正文,不存在则创建。
|
|
8
|
+
*
|
|
9
|
+
* 正文由 scripts/release-body.mjs 合成(双语发布说明 + 绝对链接 + npm/Changelog),
|
|
10
|
+
* 链接指向 gitee.com,确保在 Gitee 页面可点。
|
|
11
|
+
*
|
|
12
|
+
* 用法:
|
|
13
|
+
* GITEE_TOKEN=<私人令牌> node scripts/gitee-release.mjs <version> [previousVersion]
|
|
14
|
+
* # 例:GITEE_TOKEN=xxx node scripts/gitee-release.mjs 0.3.0 0.2.0
|
|
15
|
+
*
|
|
16
|
+
* 环境变量:
|
|
17
|
+
* GITEE_TOKEN 必填(也可用 GITEE_ACCESS_TOKEN;两者都无则跳过并以 0 退出)
|
|
18
|
+
* GITEE_OWNER 可选,默认 Lan0811
|
|
19
|
+
* GITEE_REPO 可选,默认 tianshu-mcp
|
|
20
|
+
* GITEE_BRANCH 可选,默认 master(创建发行版时的目标分支)
|
|
21
|
+
*
|
|
22
|
+
* 令牌获取:Gitee → 设置 → 私人令牌 → 生成新令牌(至少勾选 projects 权限)。
|
|
23
|
+
*/
|
|
24
|
+
import { composeReleaseBody, repoRoot } from "./release-body.mjs";
|
|
25
|
+
|
|
26
|
+
const token = (process.env.GITEE_TOKEN || process.env.GITEE_ACCESS_TOKEN || "").trim();
|
|
27
|
+
const owner = (process.env.GITEE_OWNER || "Lan0811").trim();
|
|
28
|
+
const repo = (process.env.GITEE_REPO || "tianshu-mcp").trim();
|
|
29
|
+
const branch = (process.env.GITEE_BRANCH || "master").trim();
|
|
30
|
+
void repoRoot;
|
|
31
|
+
|
|
32
|
+
const version = (process.argv[2] || "").replace(/^v/, "").trim();
|
|
33
|
+
const previousVersion = (process.argv[3] || "").replace(/^v/, "").trim() || undefined;
|
|
34
|
+
if (!/^\d+\.\d+\.\d+/.test(version)) {
|
|
35
|
+
console.error("用法: node scripts/gitee-release.mjs <version> [previousVersion](version 形如 0.3.0)");
|
|
36
|
+
process.exit(2);
|
|
37
|
+
}
|
|
38
|
+
const tag = `v${version}`;
|
|
39
|
+
|
|
40
|
+
if (!token) {
|
|
41
|
+
console.log(
|
|
42
|
+
"未设置 GITEE_TOKEN / GITEE_ACCESS_TOKEN,跳过 Gitee 发行版(设置令牌后重跑本脚本或由 CI 自动补齐)。",
|
|
43
|
+
);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 合成正文:双语 + 指向 gitee.com 的绝对链接
|
|
48
|
+
let body;
|
|
49
|
+
try {
|
|
50
|
+
body = composeReleaseBody({
|
|
51
|
+
version,
|
|
52
|
+
host: "gitee",
|
|
53
|
+
ownerRepo: `${owner}/${repo}`,
|
|
54
|
+
npmPackage: "tianshu-mcp",
|
|
55
|
+
previousVersion,
|
|
56
|
+
});
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.error(`合成发布正文失败:${e.message || e}`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
console.log(`发布正文已合成(${body.length} 字符,双语 + gitee 绝对链接)`);
|
|
62
|
+
|
|
63
|
+
const api = `https://gitee.com/api/v5/repos/${owner}/${repo}`;
|
|
64
|
+
const q = new URLSearchParams({ access_token: token }).toString();
|
|
65
|
+
const name = `tianshu-mcp ${tag}`;
|
|
66
|
+
|
|
67
|
+
async function getExisting() {
|
|
68
|
+
const r = await fetch(`${api}/releases/tags/${tag}?${q}`);
|
|
69
|
+
if (r.status === 404) return null;
|
|
70
|
+
if (!r.ok) throw new Error(`查询发行版失败 HTTP ${r.status}: ${(await r.text()).slice(0, 200)}`);
|
|
71
|
+
return r.json();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function create() {
|
|
75
|
+
const r = await fetch(`${api}/releases`, {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: { "Content-Type": "application/json" },
|
|
78
|
+
body: JSON.stringify({ access_token: token, tag_name: tag, name, body, target_commitish: branch }),
|
|
79
|
+
});
|
|
80
|
+
const text = await r.text();
|
|
81
|
+
if (!r.ok) throw new Error(`创建发行版失败 HTTP ${r.status}: ${text.slice(0, 300)}`);
|
|
82
|
+
return JSON.parse(text);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function update(id) {
|
|
86
|
+
const r = await fetch(`${api}/releases/${id}`, {
|
|
87
|
+
method: "PATCH",
|
|
88
|
+
headers: { "Content-Type": "application/json" },
|
|
89
|
+
body: JSON.stringify({ access_token: token, tag_name: tag, name, body }),
|
|
90
|
+
});
|
|
91
|
+
const text = await r.text();
|
|
92
|
+
if (!r.ok) throw new Error(`更新发行版失败 HTTP ${r.status}: ${text.slice(0, 300)}`);
|
|
93
|
+
return JSON.parse(text);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const existing = await getExisting();
|
|
98
|
+
if (existing) {
|
|
99
|
+
console.log(`已存在 ${tag} 发行版(id=${existing.id}),更新正文…`);
|
|
100
|
+
const updated = await update(existing.id);
|
|
101
|
+
console.log(`更新成功: ${updated.name} | https://gitee.com/${owner}/${repo}/releases/${tag}`);
|
|
102
|
+
} else {
|
|
103
|
+
console.log(`未找到 ${tag} 发行版,创建中…`);
|
|
104
|
+
const created = await create();
|
|
105
|
+
console.log(`创建成功: ${created.name} | https://gitee.com/${owner}/${repo}/releases/${tag}`);
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
console.error(String(e.message || e));
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 组合发布正文(GitHub / Gitee 发行版共用)。
|
|
4
|
+
*
|
|
5
|
+
* 目的:把每个版本的双语发布说明文档(docs/release-v<版本>.md 与 .en.md)合成为发行版正文,并:
|
|
6
|
+
* 1) 把文档里的**相对链接**改写为指向该 tag 的**绝对链接**(否则 Release 页上会 404);
|
|
7
|
+
* 2) 末尾追加 npm 包链接、CI 链接(可选)与 Full Changelog 比较链接。
|
|
8
|
+
*
|
|
9
|
+
* 用法(CLI):
|
|
10
|
+
* node scripts/release-body.mjs <version> <github|gitee> [ownerRepo] [npmPackage] [ciRunId] [previousVersion]
|
|
11
|
+
* 例:node scripts/release-body.mjs 0.3.0 github lanlan0811/tianshu-mcp tianshu-mcp 34661265199 0.2.0
|
|
12
|
+
*/
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
|
+
|
|
17
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
export const repoRoot = path.resolve(here, "..");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* host 标识 → 站点域名(避免把 "gitee" 当成域名拼出 `https://gitee/...`)。
|
|
22
|
+
* @param {"github"|"gitee"} host
|
|
23
|
+
*/
|
|
24
|
+
export function hostDomain(host) {
|
|
25
|
+
return host === "gitee" ? "gitee.com" : "github.com";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 把文档中的相对 markdown 链接改写为该 tag 的绝对链接。
|
|
30
|
+
* 仅改写形如 `](name.md)` / `](name.en.md)` 的文档内相对链接;已是 http(s) 的保持原样。
|
|
31
|
+
* @param {string} text
|
|
32
|
+
* @param {{host: "github"|"gitee", ownerRepo: string, tag: string}} ctx
|
|
33
|
+
*/
|
|
34
|
+
export function absolutizeDocLinks(text, { host, ownerRepo, tag }) {
|
|
35
|
+
const base = `https://${hostDomain(host)}/${ownerRepo}/blob/${tag}/docs/`;
|
|
36
|
+
return text.replace(/\]\((?!https?:\/\/)([^)\s]+\.md)(#[^)]*)?\)/g, (_m, file, anchor) => {
|
|
37
|
+
return `](${base}${file}${anchor ?? ""})`;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 读取发布说明文档;缺失时返回 null。
|
|
43
|
+
* @param {string} version
|
|
44
|
+
* @param {"zh"|"en"} lang
|
|
45
|
+
*/
|
|
46
|
+
export function readReleaseDoc(version, lang) {
|
|
47
|
+
const suffix = lang === "en" ? ".en.md" : ".md";
|
|
48
|
+
const p = path.join(repoRoot, "docs", `release-v${version}${suffix}`);
|
|
49
|
+
return fs.existsSync(p) ? fs.readFileSync(p, "utf8").trim() : null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {Object} ComposeOptions
|
|
54
|
+
* @property {string} version
|
|
55
|
+
* @property {"github"|"gitee"} host
|
|
56
|
+
* @property {string} ownerRepo 形如 lanlan0811/tianshu-mcp 或 Lan0811/tianshu-mcp
|
|
57
|
+
* @property {string} [npmPackage]
|
|
58
|
+
* @property {string|number} [ciRunId]
|
|
59
|
+
* @property {string} [previousVersion] 用于 Full Changelog 的上一版本 tag(不含 v)
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 合成双语发布正文。
|
|
64
|
+
* @param {ComposeOptions} opts
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
export function composeReleaseBody(opts) {
|
|
68
|
+
const version = String(opts.version).replace(/^v/, "");
|
|
69
|
+
const tag = `v${version}`;
|
|
70
|
+
const { host, ownerRepo } = opts;
|
|
71
|
+
const npmPackage = opts.npmPackage ?? "tianshu-mcp";
|
|
72
|
+
|
|
73
|
+
const zh = readReleaseDoc(version, "zh");
|
|
74
|
+
const en = readReleaseDoc(version, "en");
|
|
75
|
+
if (!zh && !en) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`未找到发布说明文档 docs/release-v${version}.md / .en.md;请先写好发布说明再发布。`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @type {string[]} */
|
|
82
|
+
const parts = [];
|
|
83
|
+
if (zh) parts.push(absolutizeDocLinks(zh, { host, ownerRepo, tag }));
|
|
84
|
+
if (en) {
|
|
85
|
+
parts.push("---");
|
|
86
|
+
parts.push(absolutizeDocLinks(en, { host, ownerRepo, tag }));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @type {string[]} */
|
|
90
|
+
const footer = ["---", ""];
|
|
91
|
+
footer.push(`**npm**: https://www.npmjs.com/package/${npmPackage}/v/${version}`);
|
|
92
|
+
if (opts.ciRunId) footer.push(`**CI**: https://github.com/${ownerRepo}/actions/runs/${opts.ciRunId}`);
|
|
93
|
+
const prev = opts.previousVersion ? `v${String(opts.previousVersion).replace(/^v/, "")}` : "";
|
|
94
|
+
if (host === "github") {
|
|
95
|
+
footer.push(
|
|
96
|
+
prev
|
|
97
|
+
? `**Full Changelog**: https://github.com/${ownerRepo}/compare/${prev}...${tag}`
|
|
98
|
+
: `**Full Changelog**: https://github.com/${ownerRepo}/commits/${tag}`,
|
|
99
|
+
);
|
|
100
|
+
} else {
|
|
101
|
+
// Gitee 的比较页路径与 GitHub 不同,指向该 tag 的提交列表更稳
|
|
102
|
+
footer.push(`**Full Changelog**: https://gitee.com/${ownerRepo}/commits/${tag}`);
|
|
103
|
+
}
|
|
104
|
+
parts.push(footer.join("\n"));
|
|
105
|
+
|
|
106
|
+
return parts.join("\n\n").trimEnd() + "\n";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// CLI 入口(跨平台判断:比较解析后的文件路径)
|
|
110
|
+
const invokedDirectly =
|
|
111
|
+
process.argv[1] &&
|
|
112
|
+
pathToFileURL(path.resolve(process.argv[1])).href === import.meta.url;
|
|
113
|
+
|
|
114
|
+
if (invokedDirectly) {
|
|
115
|
+
const [, , version, host, ownerRepo, npmPackage, ciRunId, previousVersion] = process.argv;
|
|
116
|
+
if (!version || !host) {
|
|
117
|
+
console.error(
|
|
118
|
+
"用法: node scripts/release-body.mjs <version> <github|gitee> [ownerRepo] [npmPackage] [ciRunId] [previousVersion]",
|
|
119
|
+
);
|
|
120
|
+
process.exit(2);
|
|
121
|
+
}
|
|
122
|
+
if (host !== "github" && host !== "gitee") {
|
|
123
|
+
console.error("host 必须是 github 或 gitee");
|
|
124
|
+
process.exit(2);
|
|
125
|
+
}
|
|
126
|
+
const repo = ownerRepo || (host === "github" ? "lanlan0811/tianshu-mcp" : "Lan0811/tianshu-mcp");
|
|
127
|
+
try {
|
|
128
|
+
process.stdout.write(
|
|
129
|
+
composeReleaseBody({
|
|
130
|
+
version,
|
|
131
|
+
host,
|
|
132
|
+
ownerRepo: repo,
|
|
133
|
+
npmPackage: npmPackage || "tianshu-mcp",
|
|
134
|
+
ciRunId: ciRunId || undefined,
|
|
135
|
+
previousVersion: previousVersion || undefined,
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.error(String(e.message || e));
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tianshu-mcp
|
|
3
|
-
description: 让外部 AI-Agent(codex/zcode/traework)做项目开发并自动验收、失败返修的编排方法。当任务需要"叫一个 AI-Agent 去开发/改代码/补测试并验收,不行就返修"时先加载本技能:按它用 mcp__tianshu-
|
|
4
|
-
triggers: '
|
|
3
|
+
description: 让外部 AI-Agent(codex/zcode/traework)做项目开发并自动验收、失败返修的编排方法。当任务需要"叫一个 AI-Agent 去开发/改代码/补测试并验收,不行就返修"时先加载本技能:按它用 mcp__tianshu-mcp__ 的 9 个工具(run_task/continue_task/query_task/list_tasks/get_task_report/verify_task/rework_task/cancel_task/get_profiles)派活、暂停继续、轮询、查历史、读验收报告、驱动返修。小改动或纯问答不需要。
|
|
4
|
+
triggers: '开发|编码|写代码|改代码|实现功能|加功能|修复|重构|补测试|写测试|验收|返修|返工|重做|自动验收|自动返修|任务书|ai.?agent|子代理|外部.?agent|agent|codex|zcode|traework|claude|编排|项目开发|派活|派单'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# tianshu-mcp 编排技能:叫外部 AI-Agent 开发并验收
|
|
8
8
|
|
|
9
|
-
**首行强指令**:你正处理"派外部 AI-Agent 开发并验收、失败返修"
|
|
9
|
+
**首行强指令**:你正处理"派外部 AI-Agent 开发并验收、失败返修"类任务。动手前先通读本技能全文;任务书模板、三种 agent 派活示例、meta 块字段解读、返修提示语模板在同目录 `usage-examples.md`,需要时用读取文件工具查看,长方法论不必背。
|
|
10
10
|
|
|
11
11
|
## 何时不要用(边界)
|
|
12
12
|
|
|
13
13
|
- 小改动 / 纯问答 / 只读代码分析:不需要本技能与 MCP,直接做。
|
|
14
14
|
- 本 MCP 未连接:工具面里看不到 `mcp__tianshu-mcp__*` 时,先提示用户按天枢 `config.json → mcp.servers.tianshu-mcp` 接入(见项目 docs/tianshu-integration.md),**不要空转**,更不要假装调用。
|
|
15
15
|
|
|
16
|
-
## 1. 选 agent
|
|
16
|
+
## 1. 选 agent(三者均为 GUI 驱动:CDP 控制桌面端,非 CLI)
|
|
17
17
|
|
|
18
|
-
- `codex
|
|
19
|
-
- `zcode`:ZCode
|
|
20
|
-
- `traework`:TraeWork(TRAE SOLO CN
|
|
21
|
-
- 不确定时问用户,或读项目 `projects.json` 的 `defaultAgentId
|
|
18
|
+
- `codex`(默认,推荐先试):ChatGPT 桌面端(MSIX 商店包,COM 激活 + CDP,复用 `~/.codex` 登录态)。Windows 已就绪,macOS 未验证前为 `research`。**model 必填**(面板可选模型名,如 `GPT-5.6 Sol`);可选 `reasoningLevel`(低/中/高 或 low/medium/high)、`planDoc`(计划文档路径)、`designSystem`(设计系统目录路径);**不支持 `mode`**。冷启动实测 60–90 秒,首轮等待偏慢属正常。
|
|
19
|
+
- `zcode`:ZCode 桌面端(Electron CDP)。要求已安装、已登录;**model 必填**且格式为 `供应商/模型`(如 `DeepSeek/deepseek-flash`);**不支持 `mode`**;发送前确认「完全访问」权限模式。macOS 真机证据补齐前 profile 为 `research`,用 `get_profiles` 读取当前机器实际探测结果。
|
|
20
|
+
- `traework`:TraeWork(TRAE SOLO CN)桌面端。要求已登录、窗口保持可见。`model` 可选;`mode` 可选(`Work`/`Code`/`Design`;不传时从任务书文本识别「切换 X 模式」,识别不到保持 `Work`;实现顺序为「新建会话 → 切模式 → 在目标模式内绑定项目」)。
|
|
21
|
+
- 不确定时问用户,或读项目 `projects.json` 的 `defaultAgentId`;用 `get_profiles` 看当前实际可用性(含可执行探测与未安装提示)。
|
|
22
22
|
|
|
23
23
|
## 2. 派活:run_task
|
|
24
24
|
|
|
@@ -26,47 +26,55 @@ triggers: '开发|编码|写代码|改代码|实现功能|加功能|修复|重
|
|
|
26
26
|
|
|
27
27
|
- `projectPath`:**必须**是项目绝对路径(如 `D:\repo\my-app`)。
|
|
28
28
|
- `task`:自然语言任务书。要写清 **目标 / 验收要点 / 约束 / 相关文件 / 上下文**,模板见 usage-examples.md。
|
|
29
|
-
- `agentId`:默认取项目 default 或 codex。
|
|
30
|
-
- `
|
|
31
|
-
- `mode`:可选,仅 GUI 类 agent(`traework`)生效,指定面板模式 `Work` / `Code` / `Design`;不传时从任务书文本识别(如「切换到 Code 模式」),识别不到则保持 `Work`。实现顺序为「新建会话 → 切模式 → 在目标模式内绑定项目」。
|
|
29
|
+
- `agentId`:默认取项目 default 或 codex;`model`/`mode`/`reasoningLevel` 等约束见 §1。
|
|
30
|
+
- `context`:补充上下文/约束文本,会以【上下文与约束】拼进 agent 初始指令。task/context 中反引号包裹或路径形态的引用会在发送前校验(必须存在且在项目内),写错立即报错。
|
|
32
31
|
- `autoVerify: true`:跑完自动验收(命令检查 + 代码分析)。
|
|
33
|
-
- `autoFixRounds: N
|
|
34
|
-
- `taskTimeoutMs
|
|
32
|
+
- `autoFixRounds: N`(0–10):>0 才开启失败自动返修。优先级:调用参数 > agent 缺省(codex 5、zcode 2)> server 默认 0(不开启)。
|
|
33
|
+
- `taskTimeoutMs`:任务级超时;缺省 30 分钟。
|
|
35
34
|
|
|
36
35
|
返回立刻给 `taskId`(异步契约)。**不要把任务书当同步调用等结果。**
|
|
37
36
|
|
|
38
|
-
## 3.
|
|
37
|
+
## 3. 轮询与查询
|
|
39
38
|
|
|
40
|
-
- `query_task(taskId)` 间隔约 5–10 秒,看 agent
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
- `needs_user` 表示 ZCode 正在等待问题回答、关闭旧实例、登录或系统权限;按提示处理后调用 `continue_task(taskId, message)`,禁止新开会话冒充恢复;
|
|
45
|
-
- 终态见下。
|
|
39
|
+
- `query_task(taskId, tailLines?)` 间隔约 5–10 秒,看 agent 日志尾与状态(tailLines 缺省返回日志末 40 行)。
|
|
40
|
+
- 查历史任务用 `list_tasks(projectPath?, status?, limit?)`(limit 缺省 50,上限 200)。
|
|
41
|
+
- 同一项目勿重复派单:每项目串行 + 全局并发(默认 2),重复派会排队,反而更慢。
|
|
42
|
+
- 状态语义:`queued` 排队中 / `running` 开发中 / `verify_start` 验收中 / `fixing` 返修中;`needs_user` 表示 agent 在等用户(按 §4 处理);终态见 §5。
|
|
46
43
|
|
|
47
|
-
## 4.
|
|
44
|
+
## 4. needs_user:continue_task
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
- `failed`:**未开自动返修或硬失败**。读 `query_task` 的 meta 与 `get_task_report` 定位失败 checks;如可修 → `rework_task(taskId, feedback=失败摘要)` 手动续修(feedback 会给下一轮 agent);再轮询/`verify_task`。
|
|
51
|
-
- `needs_attention`:自动返修轮次已用尽仍失败。同样先读报告,给**针对性** feedback 调 `rework_task`(不要无脑重复同样的话)。多次仍不过或不可修:如实向用户汇报并给建议(人工看报告/换 agent/缩小任务),**不要反复空转重试**。
|
|
52
|
-
- `running` 卡死/超时:`cancel_task(taskId, reason)` 终止(kill 进程树)。
|
|
46
|
+
meta 块中 `needsUserKind` 给出等待类型、`pendingQuestion` 给出问题原文:
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
- `agent_question`:agent 提了问题 → 用 `continue_task(taskId, message=<答案>)`,message 会发到原会话。
|
|
49
|
+
- `close_existing_instance` / `login_required` / `system_permission`:需用户先处理(关闭旧实例 / 登录 / 授系统权限)→ 用户处理完后调 `continue_task(taskId, message=<已处理说明>)`,message 仅作为已处理的确认。
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
禁止新开会话冒充恢复。
|
|
52
|
+
|
|
53
|
+
## 5. 终态解读
|
|
54
|
+
|
|
55
|
+
- `succeeded`:用 `get_task_report(taskId, round?)`(round 为 0-based 报告轮次,缺省最新)取 changedFiles / diffstat / checks,向用户汇报变更与结论。
|
|
56
|
+
- `failed`:**未开自动返修或硬失败**。读 meta 的 `errorType` 与 `get_task_report` 定位失败 checks;如可修 → `rework_task(taskId, feedback=失败摘要)` 手动续修(feedback 会作为追加指示给下一轮 agent);再轮询或 `verify_task`。
|
|
57
|
+
- `needs_attention`:自动返修轮次已用尽仍失败。同样先读报告,给**针对性** feedback 调 `rework_task`(不要无脑重复同样的话)。多次仍不过或不可修:如实向用户汇报并给建议(人工看报告 / 换 agent / 缩小任务),**不要反复空转重试**。
|
|
58
|
+
- `cancelled` / `interrupted`:用户取消或超时/中断(meta 的 `abortSource` 区分 user/shutdown/timeout/internal)。`running` 卡死可用 `cancel_task(taskId, reason)` 终止(kill 进程树)。
|
|
59
|
+
|
|
60
|
+
## 6. 验收报告解读要点
|
|
61
|
+
|
|
62
|
+
- 结果文本末尾有 `---tianshu-mcp-meta---` 块(JSON),天枢可正则抽取;字段读法示例见 usage-examples.md。
|
|
63
|
+
- 报告全文走 `get_task_report`:`checks[]`(每项 PASS/FAIL/SKIP + 输出尾部)、`analysis`(变更清单、diffstat、可疑标记命中计数、超大单文件改动告警)。
|
|
64
|
+
- `verify_task` 可对任务或任意项目独立验收(**不改源码、无需审批**):`taskId` / `projectPath` 二选一;`extraChecks` 临时加验(`checksMode` 默认 append 追加,`replace` 才替换);`baselineRef` 可填任务 ID(用该任务动工前基线)或 git ref(如 `HEAD~1`);独立 projectPath 不设 baselineRef 时按当前基线做健康检查。
|
|
65
|
+
- 验收命令优先级:`extraChecks` > 项目 `.tianshu-mcp/acceptance.json` > projects.json 管理员补录 > 按技术栈推导的默认集。
|
|
58
66
|
- 注意:代码分析是确定性规则(TODO/FIXME、console.log/debugger、疑似密钥形态、超大改动),**不是** LLM 评审——命中仅提示人工,不等同于任务失败。
|
|
59
|
-
- changedFiles/diffstat 都相对**动工前 git 基线**(run_task
|
|
67
|
+
- changedFiles/diffstat 都相对**动工前 git 基线**(run_task 自动采集,含未跟踪新增)。MCP 不自动 commit/stash;需要回滚时由用户基于报告决定。
|
|
60
68
|
|
|
61
|
-
##
|
|
69
|
+
## 7. 纪律
|
|
62
70
|
|
|
63
|
-
- 写/执行类工具(run/cancel/rework
|
|
71
|
+
- 写/执行类工具(run/cancel/rework/continue)需审批:不绕过、不替用户代点同意;query/list/report/verify/get_profiles 为只读,无需审批。
|
|
64
72
|
- 不代替外部 agent 手改项目代码;不改用户 git 历史;不读取/转发任何 agent 密钥(登录态各 agent 自持)。
|
|
65
|
-
-
|
|
73
|
+
- 验收命令来自白名单式配置、按 argv 分词执行,不做 shell 注入。
|
|
66
74
|
|
|
67
75
|
## 快速上手清单
|
|
68
76
|
|
|
69
77
|
1. `get_profiles` → 确认目标 agent 可用。
|
|
70
|
-
2. `run_task(projectPath, task, agentId=codex, autoVerify=true, autoFixRounds=
|
|
71
|
-
3. `query_task(taskId)` 每 ~8
|
|
72
|
-
4.
|
|
78
|
+
2. `run_task(projectPath, task, agentId=codex, model=GPT-5.6 Sol, autoVerify=true, autoFixRounds=5)` → 拿 taskId(model 以 get_profiles/面板实际为准)。
|
|
79
|
+
3. `query_task(taskId)` 每 ~8 秒轮询到终态;遇 `needs_user` 按 §4 处理。
|
|
80
|
+
4. 终态处理见 §5;汇报时带 `get_task_report` 的 changedFiles 与 diffstat。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tianshu-mcp 使用示例(子文件)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
正文过长方法论不背:任务书模板、三种 agent 派活示例、meta 块字段解读、验收与返修模板都在这里,按需用读取文件工具查看。
|
|
4
4
|
|
|
5
5
|
## 1. 任务书模板
|
|
6
6
|
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
- <背景 / 已知约定 / 为什么这么做>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
要点:
|
|
23
|
+
|
|
24
|
+
- 「相关文件 / 上下文」里的项目内路径建议用反引号或 `./` 相对路径书写(如 `` `src/run.ts` ``、`./docs/plan.md`)——task/context 中的路径引用会在发送前校验存在性与项目边界,写错会立即报错而不是带病派单。
|
|
25
|
+
- 「上下文」也可拆到 `run_task` 的 `context` 参数:它会以【上下文与约束】拼进 agent 初始指令,适合放较长且与任务书正文解耦的背景。
|
|
26
|
+
|
|
22
27
|
示例(真实可用):
|
|
23
28
|
|
|
24
29
|
```text
|
|
@@ -30,14 +35,63 @@
|
|
|
30
35
|
- 不要改动 src/config/ 下已稳定的 schema
|
|
31
36
|
- 保持现有参数解析风格(commander)
|
|
32
37
|
相关文件:
|
|
33
|
-
- src/cli.ts
|
|
38
|
+
- `src/cli.ts`(入口与参数定义)、`src/run.ts`(执行逻辑)
|
|
34
39
|
上下文:
|
|
35
40
|
- 现有 run 命令会写 out/ 目录;dry-run 应跳过全部写操作
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
## 2.
|
|
43
|
+
## 2. 三种 agent 派活示例
|
|
44
|
+
|
|
45
|
+
### 2.1 codex(默认;model 必填,支持 reasoningLevel / planDoc / designSystem)
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
run_task(projectPath=D:/repo/app, agentId=codex,
|
|
49
|
+
model=GPT-5.6 Sol,
|
|
50
|
+
reasoningLevel=高,
|
|
51
|
+
planDoc=./docs/plan.md,
|
|
52
|
+
designSystem=./design-system,
|
|
53
|
+
task=按计划文档实现列表页与详情页,
|
|
54
|
+
autoVerify=true, autoFixRounds=5)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `planDoc` / `designSystem` 会被拼进初始开发指令「根据计划文档(<planDoc>)…和设计系统(<designSystem>)…」,路径必须存在且在项目内。
|
|
58
|
+
- `reasoningLevel` 接受 低/中/高 或 low/medium/high;不传沿用面板当前等级。
|
|
59
|
+
- 不支持 `mode` 参数,传了会直接报错。
|
|
60
|
+
|
|
61
|
+
### 2.2 zcode(model 必填且为「供应商/模型」)
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
run_task(projectPath=D:/repo/app, agentId=zcode,
|
|
65
|
+
model=DeepSeek/deepseek-flash,
|
|
66
|
+
task=按 `./docs/plan.md` 与 `./design-system` 实现功能,
|
|
67
|
+
autoVerify=true, autoFixRounds=2)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
若 `query_task` 返回 `needs_user`,先读 meta 的 `needsUserKind` 与 `pendingQuestion`:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
continue_task(taskId=tsk_..., message=采用 PostgreSQL 方案)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- `needsUserKind=agent_question`:message 作为答案发送到原会话。
|
|
77
|
+
- `needsUserKind=close_existing_instance / login_required / system_permission`:先让用户处理(关旧实例 / 登录 / 授系统权限),message 仅作为用户已处理的确认。
|
|
78
|
+
|
|
79
|
+
### 2.3 traework(model 可选;唯一支持 mode)
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
run_task(projectPath=D:/repo/app, agentId=traework,
|
|
83
|
+
model=GLM-5.3,
|
|
84
|
+
mode=Code,
|
|
85
|
+
task=重构导出模块,
|
|
86
|
+
autoVerify=true)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- `mode` 缺省时从任务书文本识别「切换 Work/Code/Design 模式」,识别不到保持 `Work`。
|
|
90
|
+
- TraeWork 窗口需保持可见;实现顺序为「新建会话 → 切模式 → 在目标模式内绑定项目」。
|
|
91
|
+
|
|
92
|
+
## 3. meta 块解读示例
|
|
39
93
|
|
|
40
|
-
`
|
|
94
|
+
`run_task` / `query_task` 等结果文本末尾的结构化块:
|
|
41
95
|
|
|
42
96
|
```text
|
|
43
97
|
---tianshu-mcp-meta---
|
|
@@ -47,49 +101,77 @@
|
|
|
47
101
|
"status": "needs_attention",
|
|
48
102
|
"agentId": "codex",
|
|
49
103
|
"projectPath": "d:/repo/my-app",
|
|
104
|
+
"model": "GPT-5.6 Sol",
|
|
50
105
|
"round": 3,
|
|
51
106
|
"changedFiles": ["src/a.ts", "src/b.ts"],
|
|
52
107
|
"diffstat": "+18 -4",
|
|
53
|
-
"reportFiles": { "md": "
|
|
54
|
-
"logFile": "
|
|
55
|
-
"
|
|
108
|
+
"reportFiles": { "md": "<任务目录>/report-2.md", "json": "<任务目录>/report-2.json" },
|
|
109
|
+
"logFile": "<任务目录>/agent-2.log",
|
|
110
|
+
"errorType": "verify_failed",
|
|
111
|
+
"reportRound": 2,
|
|
112
|
+
"verificationSource": "auto",
|
|
113
|
+
"message": "验收失败,自动返修轮次已用尽(3/5 轮)。…"
|
|
56
114
|
}
|
|
57
115
|
---tianshu-mcp-meta---
|
|
58
116
|
```
|
|
59
117
|
|
|
60
|
-
|
|
118
|
+
读法(按决策用途分组):
|
|
61
119
|
|
|
62
120
|
| 字段 | 含义 |
|
|
63
121
|
|---|---|
|
|
64
|
-
| `ok` |
|
|
122
|
+
| `ok` | 是否成功(仅 status=succeeded 时为 true) |
|
|
65
123
|
| `status` | queued/running/verify_start/fixing/needs_user/succeeded/failed/needs_attention/cancelled/interrupted |
|
|
124
|
+
| `message` | 状态摘要/失败原因,最先读 |
|
|
125
|
+
| `errorType` | 失败归类:timeout/spawn/agent_failed/verify_failed/cancelled/interrupted/agent_unresolved/internal |
|
|
126
|
+
| `needsUserKind` | needs_user 时的等待类型:agent_question/close_existing_instance/login_required/system_permission |
|
|
127
|
+
| `pendingQuestion` | needs_user 时 agent 提出的问题原文 |
|
|
66
128
|
| `round` / `roundsUsed` | 已进行的 agent 轮次 |
|
|
67
129
|
| `changedFiles` | 相对 git 基线的变更清单(含未跟踪新增) |
|
|
68
130
|
| `diffstat` | 增删行摘要(`+A -D`) |
|
|
69
131
|
| `reportFiles` | 最近一轮验收报告 md/json 绝对路径 |
|
|
70
132
|
| `logFile` | 最近一轮 agent 日志 |
|
|
71
|
-
| `
|
|
133
|
+
| `reportRound` | 最近一次验收的报告轮次(0-based,区别于 agent 轮次) |
|
|
134
|
+
| `verificationSource` | 最近一次验收来源:auto(run_task 自动)/ manual(verify_task 手动) |
|
|
135
|
+
| `latestVerificationVerdict` | 手动验收结论(不改变任务终态时单独记录) |
|
|
136
|
+
| `abortSource` | 中断来源:user/shutdown/timeout/internal |
|
|
137
|
+
| `model` / `mode` / `reasoningLevel` | 本次派单的模型 / 面板模式 / 思考等级(按 agent 生效) |
|
|
72
138
|
|
|
73
|
-
规则:`ok=true` 且 status=succeeded → 交付达成;否则读 `reportFiles.md` 全文定位。
|
|
139
|
+
规则:`ok=true` 且 status=succeeded → 交付达成;否则读 `message` 与 `reportFiles.md` 全文定位。
|
|
74
140
|
|
|
75
|
-
##
|
|
141
|
+
## 4. 验收:verify_task 示例
|
|
142
|
+
|
|
143
|
+
只读、不改源码、无需审批。三种典型用法:
|
|
76
144
|
|
|
77
145
|
```text
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
146
|
+
# 1) 复跑某任务的验收(用该任务动工前基线;round 缺省对最新状态)
|
|
147
|
+
verify_task(taskId=tsk_...)
|
|
148
|
+
|
|
149
|
+
# 2) 独立健康检查(无任务上下文,按当前基线)
|
|
150
|
+
verify_task(projectPath=D:/repo/app)
|
|
151
|
+
|
|
152
|
+
# 3) 临时加验 + 指定基线(extraChecks 追加到基础集之后)
|
|
153
|
+
verify_task(projectPath=D:/repo/app, baselineRef=HEAD~1,
|
|
154
|
+
extraChecks=[{name=lint, cmd=npm run lint, timeoutMs=120000}],
|
|
155
|
+
checksMode=append)
|
|
82
156
|
```
|
|
83
157
|
|
|
84
|
-
|
|
158
|
+
- `checksMode=replace` 时只用 `extraChecks`,不跑项目基础集。
|
|
159
|
+
- `extraChecks` 单条支持 `name`/`cmd`(argv 数组或字符串)/`timeoutMs`/`optional`(optional:true 失败只记 warning)。
|
|
160
|
+
- 验收命令优先级:extraChecks > 项目 `.tianshu-mcp/acceptance.json` > projects.json 管理员补录 > 按技术栈推导的默认集(详见 docs/acceptance-config.md)。
|
|
161
|
+
|
|
162
|
+
## 5. 查历史:list_tasks 示例
|
|
85
163
|
|
|
86
164
|
```text
|
|
87
|
-
|
|
165
|
+
# 某项目最近失败/需关注的任务
|
|
166
|
+
list_tasks(projectPath=D:/repo/app, status=needs_attention, limit=10)
|
|
167
|
+
|
|
168
|
+
# 全局最近 50 条
|
|
169
|
+
list_tasks()
|
|
88
170
|
```
|
|
89
171
|
|
|
90
|
-
`
|
|
172
|
+
返回含每条任务的 taskId/status/agentId/时间摘要,可用于接续 `get_task_report` / `rework_task`。
|
|
91
173
|
|
|
92
|
-
##
|
|
174
|
+
## 6. 返修提示语模板
|
|
93
175
|
|
|
94
176
|
给 `rework_task(taskId, feedback)` 的 `feedback`,讲究**针对性**,避免空转:
|
|
95
177
|
|
|
@@ -113,14 +195,16 @@ continue_task(taskId=tsk_..., message=采用 PostgreSQL 方案)
|
|
|
113
195
|
parameter of type 'number' (src/run.ts:42)。请只修这一处类型问题并重跑 npm run build 确认。
|
|
114
196
|
```
|
|
115
197
|
|
|
116
|
-
|
|
198
|
+
补充:自动返修(autoFixRounds)路径下,server 会先把失败证据写成修复计划文档(codex 写到项目 `.zcode/plans/`),并在下一轮指令中引用该文档;手动 `rework_task` 的 feedback 则按上面的针对性模板书写。
|
|
199
|
+
|
|
200
|
+
## 7. 汇报模板
|
|
117
201
|
|
|
118
202
|
`get_task_report` 拿全文后向用户汇报建议包含:
|
|
119
203
|
|
|
120
204
|
```text
|
|
121
|
-
任务 <taskId> 已完成(<agent>)。
|
|
205
|
+
任务 <taskId> 已完成(<agent>,model=<model>)。
|
|
122
206
|
- 变更文件:src/a.ts、src/b.ts(+18 -4)
|
|
123
|
-
- 自动命令检查:build
|
|
124
|
-
- 代码分析:无可疑标记;注意 README
|
|
207
|
+
- 自动命令检查:build PASS / test PASS / lint 跳过
|
|
208
|
+
- 代码分析:无可疑标记;注意 README 存在超大单文件改动(告警)
|
|
125
209
|
- 验收报告:<report.md 路径>
|
|
126
210
|
```
|