@fitlab-ai/agent-infra 0.8.2 → 0.8.4

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 (198) hide show
  1. package/README.zh-CN.md +10 -0
  2. package/bin/cli.ts +1 -1
  3. package/dist/bin/cli.js +2 -2
  4. package/dist/lib/cp.js +57 -16
  5. package/dist/lib/decide.js +2 -2
  6. package/dist/lib/defaults.json +2 -0
  7. package/dist/lib/init.js +7 -7
  8. package/dist/lib/merge.js +1 -1
  9. package/dist/lib/prompt.js +1 -1
  10. package/dist/lib/run/index.js +7 -7
  11. package/dist/lib/run/prompt.js +1 -1
  12. package/dist/lib/sandbox/capture.js +10 -8
  13. package/dist/lib/sandbox/clipboard/bridge.js +59 -21
  14. package/dist/lib/sandbox/clipboard/inbox.js +82 -0
  15. package/dist/lib/sandbox/clipboard/index.js +5 -6
  16. package/dist/lib/sandbox/clipboard/linux.js +91 -0
  17. package/dist/lib/sandbox/clipboard/paths.js +1 -1
  18. package/dist/lib/sandbox/clipboard/win32.js +144 -0
  19. package/dist/lib/sandbox/commands/create.js +106 -88
  20. package/dist/lib/sandbox/commands/enter.js +9 -9
  21. package/dist/lib/sandbox/commands/list-running.js +2 -2
  22. package/dist/lib/sandbox/commands/ls.js +7 -7
  23. package/dist/lib/sandbox/commands/prune.js +8 -8
  24. package/dist/lib/sandbox/commands/rebuild.js +38 -50
  25. package/dist/lib/sandbox/commands/refresh.js +2 -2
  26. package/dist/lib/sandbox/commands/rm.js +11 -11
  27. package/dist/lib/sandbox/commands/show.js +4 -4
  28. package/dist/lib/sandbox/commands/start.js +4 -4
  29. package/dist/lib/sandbox/commands/vm.js +4 -4
  30. package/dist/lib/sandbox/config.js +10 -4
  31. package/dist/lib/sandbox/constants.js +4 -1
  32. package/dist/lib/sandbox/credentials.js +1 -1
  33. package/dist/lib/sandbox/dotfiles.js +1 -1
  34. package/dist/lib/sandbox/engine.js +3 -3
  35. package/dist/lib/sandbox/engines/index.js +5 -5
  36. package/dist/lib/sandbox/engines/wsl2-paths.js +1 -1
  37. package/dist/lib/sandbox/image-build.js +80 -0
  38. package/dist/lib/sandbox/image-prune.js +2 -2
  39. package/dist/lib/sandbox/index.js +10 -10
  40. package/dist/lib/sandbox/managed-fs.js +1 -1
  41. package/dist/lib/sandbox/readme-scaffold.js +1 -1
  42. package/dist/lib/sandbox/runtimes/base.dockerfile +3 -0
  43. package/dist/lib/sandbox/shell.js +9 -1
  44. package/dist/lib/sandbox/tools.js +4 -4
  45. package/dist/lib/server/adapters/feishu/index.js +10 -3
  46. package/dist/lib/server/adapters/feishu/renderer.js +88 -0
  47. package/dist/lib/server/adapters/feishu/transport.js +2 -13
  48. package/dist/lib/server/daemon.js +64 -43
  49. package/dist/lib/server/display.js +83 -0
  50. package/dist/lib/server/index.js +2 -2
  51. package/dist/lib/server/process-control.js +2 -2
  52. package/dist/lib/server/protocol.js +2 -2
  53. package/dist/lib/server/streamer.js +5 -4
  54. package/dist/lib/task/commands/cat.js +2 -2
  55. package/dist/lib/task/commands/decisions.js +4 -4
  56. package/dist/lib/task/commands/files.js +3 -3
  57. package/dist/lib/task/commands/grep.js +3 -3
  58. package/dist/lib/task/commands/issue-body.js +4 -4
  59. package/dist/lib/task/commands/log.js +5 -5
  60. package/dist/lib/task/commands/ls.js +3 -3
  61. package/dist/lib/task/commands/show.js +1 -1
  62. package/dist/lib/task/commands/status.js +71 -25
  63. package/dist/lib/task/index.js +9 -9
  64. package/dist/lib/task/resolve-ref.js +1 -1
  65. package/dist/lib/task/workflow-warnings.js +94 -0
  66. package/dist/lib/update.js +4 -4
  67. package/lib/cp.ts +56 -15
  68. package/lib/defaults.json +2 -0
  69. package/lib/sandbox/capture.ts +5 -3
  70. package/lib/sandbox/clipboard/bridge.ts +62 -18
  71. package/lib/sandbox/clipboard/inbox.ts +83 -0
  72. package/lib/sandbox/clipboard/index.ts +5 -6
  73. package/lib/sandbox/clipboard/linux.ts +124 -0
  74. package/lib/sandbox/clipboard/win32.ts +173 -0
  75. package/lib/sandbox/commands/create.ts +132 -88
  76. package/lib/sandbox/commands/rebuild.ts +42 -54
  77. package/lib/sandbox/config.ts +13 -1
  78. package/lib/sandbox/constants.ts +4 -0
  79. package/lib/sandbox/image-build.ts +134 -0
  80. package/lib/sandbox/runtimes/base.dockerfile +3 -0
  81. package/lib/sandbox/shell.ts +11 -2
  82. package/lib/sandbox/tools.ts +5 -5
  83. package/lib/server/adapters/_contract.ts +3 -0
  84. package/lib/server/adapters/feishu/index.ts +11 -3
  85. package/lib/server/adapters/feishu/renderer.ts +99 -0
  86. package/lib/server/adapters/feishu/transport.ts +5 -18
  87. package/lib/server/daemon.ts +74 -38
  88. package/lib/server/display.ts +136 -0
  89. package/lib/server/streamer.ts +5 -4
  90. package/lib/task/commands/log.ts +3 -3
  91. package/lib/task/commands/status.ts +102 -21
  92. package/lib/task/workflow-warnings.ts +121 -0
  93. package/package.json +2 -2
  94. package/templates/.agents/README.en.md +3 -0
  95. package/templates/.agents/README.zh-CN.md +3 -0
  96. package/templates/.agents/rules/create-issue.github.en.md +4 -4
  97. package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -4
  98. package/templates/.agents/rules/issue-pr-commands.github.en.md +7 -2
  99. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +7 -2
  100. package/templates/.agents/rules/issue-sync.github.en.md +13 -0
  101. package/templates/.agents/rules/issue-sync.github.zh-CN.md +13 -0
  102. package/templates/.agents/rules/next-step-output.en.md +15 -1
  103. package/templates/.agents/rules/next-step-output.zh-CN.md +15 -1
  104. package/templates/.agents/rules/pr-sync.github.en.md +17 -2
  105. package/templates/.agents/rules/pr-sync.github.zh-CN.md +17 -2
  106. package/templates/.agents/rules/review-handshake.en.md +2 -2
  107. package/templates/.agents/rules/review-handshake.zh-CN.md +2 -2
  108. package/templates/.agents/rules/task-management.en.md +1 -1
  109. package/templates/.agents/rules/task-management.zh-CN.md +1 -1
  110. package/templates/.agents/rules/testing-discipline.en.md +3 -41
  111. package/templates/.agents/rules/testing-discipline.zh-CN.md +3 -41
  112. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +57 -0
  113. package/templates/.agents/scripts/validate-artifact.js +213 -0
  114. package/templates/.agents/scripts/workflow-warnings.js +290 -0
  115. package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -1
  116. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +2 -2
  117. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +1 -1
  118. package/templates/.agents/skills/block-task/SKILL.en.md +1 -1
  119. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  120. package/templates/.agents/skills/cancel-task/SKILL.en.md +1 -1
  121. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  122. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +9 -9
  123. package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
  124. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  125. package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
  126. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  127. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  128. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
  129. package/templates/.agents/skills/code-task/reference/branch-management.zh-CN.md +2 -2
  130. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +2 -2
  131. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +2 -2
  132. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +1 -1
  133. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  134. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  135. package/templates/.agents/skills/commit/reference/task-status-update.en.md +6 -6
  136. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +6 -6
  137. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +142 -0
  138. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +142 -0
  139. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +49 -0
  140. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +49 -0
  141. package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +48 -0
  142. package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +48 -0
  143. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +60 -0
  144. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +87 -0
  145. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  146. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  147. package/templates/.agents/skills/create-pr/SKILL.en.md +6 -4
  148. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +6 -4
  149. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  150. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  151. package/templates/.agents/skills/create-task/SKILL.en.md +6 -3
  152. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +9 -6
  153. package/templates/.agents/skills/import-codescan/SKILL.en.md +2 -2
  154. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +3 -3
  155. package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
  156. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
  157. package/templates/.agents/skills/import-issue/SKILL.en.md +2 -2
  158. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +3 -3
  159. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +1 -1
  160. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -2
  161. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -3
  162. package/templates/.agents/skills/init-milestones/scripts/init-milestones.github.sh +165 -41
  163. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  164. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
  165. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  166. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  167. package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
  168. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +1 -1
  169. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +5 -5
  170. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +5 -5
  171. package/templates/.agents/skills/review-code/SKILL.en.md +8 -4
  172. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +6 -3
  173. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  174. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  175. package/templates/.agents/skills/review-code/reference/output-templates.en.md +5 -5
  176. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +5 -5
  177. package/templates/.agents/skills/review-code/reference/report-template.en.md +2 -2
  178. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +2 -2
  179. package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
  180. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +1 -1
  181. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +5 -5
  182. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +5 -5
  183. package/templates/.agents/skills/test/SKILL.zh-CN.md +26 -8
  184. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -1
  185. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +36 -6
  186. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  187. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  188. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +8 -1
  189. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +8 -1
  190. package/templates/.agents/templates/task.en.md +7 -0
  191. package/templates/.agents/templates/task.zh-CN.md +7 -0
  192. package/templates/.claude/commands/complete-manual-validation.en.md +9 -0
  193. package/templates/.claude/commands/complete-manual-validation.zh-CN.md +9 -0
  194. package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +8 -0
  195. package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +8 -0
  196. package/templates/.github/workflows/metadata-sync.yml +5 -0
  197. package/templates/.opencode/commands/complete-manual-validation.en.md +11 -0
  198. package/templates/.opencode/commands/complete-manual-validation.zh-CN.md +11 -0
@@ -21,8 +21,8 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
21
21
  - **Reviewer**: {reviewer-name}
22
22
  - **Review Time**: {timestamp}
23
23
  - **Scope**: {file-count and major modules}
24
- - **Review Baseline Commit**: {raw git rev-parse HEAD} (baseline for the complete-task post-review commit gate; see `.agents/rules/review-handshake.md`)
25
- - **Reviewed Diff Fingerprint**: {raw node .agents/scripts/review-diff-fingerprint.js worktree HEAD}
24
+ - **Review Baseline Commit**: {raw R captured once for this round} (baseline for the complete-task post-review commit gate; see `.agents/rules/review-handshake.md`)
25
+ - **Reviewed Diff Fingerprint**: {raw node .agents/scripts/review-diff-fingerprint.js worktree "$R"}
26
26
  - **Overall Verdict**: {Approved / Changes Requested / Rejected} (pick exactly one; combined phrases will fail the verify gate)
27
27
  - **Findings (AI-actionable)**: 0 blockers, 0 majors, 0 minors / **Manual validation**: 0
28
28
 
@@ -21,8 +21,8 @@
21
21
  - **审查者**:{reviewer-name}
22
22
  - **审查时间**:{timestamp}
23
23
  - **审查范围**:{file-count and major modules}
24
- - **审查基线提交**:{git rev-parse HEAD 原文}(complete-task 的 post-review commit 门禁基线;详见 `.agents/rules/review-handshake.md`)
25
- - **审查差异指纹**:{node .agents/scripts/review-diff-fingerprint.js worktree HEAD 原文}
24
+ - **审查基线提交**:{本轮一次性捕获的 R 原文}(complete-task 的 post-review commit 门禁基线;详见 `.agents/rules/review-handshake.md`)
25
+ - **审查差异指纹**:{node .agents/scripts/review-diff-fingerprint.js worktree "$R" 原文}
26
26
  - **总体结论**:{通过 / 需要修改 / 拒绝}(恰取一个;禁止写组合短语,否则 verify gate 失败)
27
27
  - **发现(AI 可处理)**:0 阻塞项,0 主要,0 次要 / **人工校验**:0
28
28
 
@@ -73,7 +73,7 @@ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
73
73
  Get the current time:
74
74
 
75
75
  ```bash
76
- date "+%Y-%m-%d %H:%M:%S%:z"
76
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
77
77
  ```
78
78
 
79
79
  Set `current_step` to `technical-design-review`, refresh task metadata, and append:
@@ -79,7 +79,7 @@ tail .agents/workspace/active/{task-id}/task.md
79
79
  获取当前时间:
80
80
 
81
81
  ```bash
82
- date "+%Y-%m-%d %H:%M:%S%:z"
82
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
83
83
  ```
84
84
 
85
85
  更新 task.md:
@@ -27,7 +27,7 @@ Task {task-id} technical plan review completed. Verdict: approved.
27
27
 
28
28
  Next step - write code:
29
29
  - Claude Code / OpenCode: /code-task {task-ref}
30
- - Gemini CLI: /agent-infra:code-task {task-ref}
30
+ - Gemini CLI: /{{project}}:code-task {task-ref}
31
31
  - Codex CLI: $code-task {task-ref}
32
32
 
33
33
  [When manual-validation > 0, append:]
@@ -43,12 +43,12 @@ Task {task-id} technical plan review completed. Verdict: approved.
43
43
 
44
44
  Next step - revise plan before coding (recommended):
45
45
  - Claude Code / OpenCode: /plan-task {task-ref}
46
- - Gemini CLI: /agent-infra:plan-task {task-ref}
46
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
47
47
  - Codex CLI: $plan-task {task-ref}
48
48
 
49
49
  Or proceed directly to coding:
50
50
  - Claude Code / OpenCode: /code-task {task-ref}
51
- - Gemini CLI: /agent-infra:code-task {task-ref}
51
+ - Gemini CLI: /{{project}}:code-task {task-ref}
52
52
  - Codex CLI: $code-task {task-ref}
53
53
 
54
54
  [When manual-validation > 0, append:]
@@ -64,7 +64,7 @@ Task {task-id} technical plan review completed. Verdict: changes requested.
64
64
 
65
65
  Next step - revise technical plan:
66
66
  - Claude Code / OpenCode: /plan-task {task-ref}
67
- - Gemini CLI: /agent-infra:plan-task {task-ref}
67
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
68
68
  - Codex CLI: $plan-task {task-ref}
69
69
 
70
70
  [When manual-validation > 0, append:]
@@ -80,7 +80,7 @@ Task {task-id} technical plan review completed. Verdict: rejected, redesign requ
80
80
 
81
81
  Next step - redesign:
82
82
  - Claude Code / OpenCode: /plan-task {task-ref}
83
- - Gemini CLI: /agent-infra:plan-task {task-ref}
83
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
84
84
  - Codex CLI: $plan-task {task-ref}
85
85
 
86
86
  [When manual-validation > 0, append:]
@@ -27,7 +27,7 @@
27
27
 
28
28
  下一步 - 编写代码:
29
29
  - Claude Code / OpenCode:/code-task {task-ref}
30
- - Gemini CLI:/agent-infra:code-task {task-ref}
30
+ - Gemini CLI:/{{project}}:code-task {task-ref}
31
31
  - Codex CLI:$code-task {task-ref}
32
32
 
33
33
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -43,12 +43,12 @@
43
43
 
44
44
  下一步 - 修订方案后编码(推荐):
45
45
  - Claude Code / OpenCode:/plan-task {task-ref}
46
- - Gemini CLI:/agent-infra:plan-task {task-ref}
46
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
47
47
  - Codex CLI:$plan-task {task-ref}
48
48
 
49
49
  或直接进入编码:
50
50
  - Claude Code / OpenCode:/code-task {task-ref}
51
- - Gemini CLI:/agent-infra:code-task {task-ref}
51
+ - Gemini CLI:/{{project}}:code-task {task-ref}
52
52
  - Codex CLI:$code-task {task-ref}
53
53
 
54
54
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -64,7 +64,7 @@
64
64
 
65
65
  下一步 - 修订技术方案:
66
66
  - Claude Code / OpenCode:/plan-task {task-ref}
67
- - Gemini CLI:/agent-infra:plan-task {task-ref}
67
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
68
68
  - Codex CLI:$plan-task {task-ref}
69
69
 
70
70
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -80,7 +80,7 @@
80
80
 
81
81
  下一步 - 重新设计:
82
82
  - Claude Code / OpenCode:/plan-task {task-ref}
83
- - Gemini CLI:/agent-infra:plan-task {task-ref}
83
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
84
84
  - Codex CLI:$plan-task {task-ref}
85
85
 
86
86
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -11,16 +11,27 @@ description: >
11
11
 
12
12
  ## 1. 编译 / 类型检查
13
13
 
14
- 本项目由 Node.js CLI 和模板文件组成,无需编译。跳过此步骤。
14
+ ```bash
15
+ # TODO:替换为项目实际的编译命令
16
+ # npx tsc --noEmit (TypeScript)
17
+ # mvn compile (Maven)
18
+ # go build ./... (Go)
19
+ # make build (通用)
20
+ ```
21
+
22
+ 确认没有编译错误。
15
23
 
16
24
  ## 2. 运行单元测试(按层级选择)
17
25
 
18
- 本项目把测试分为三层,按场景选择运行命令;新增测试文件默认归入 **full**,确认足够快且足够核心后,再上调到 core 或 smoke。
26
+ 三层测试是可选的反馈速度优化;如果测试套件较小,所有层级都可以映射到同一个完整测试命令。
19
27
 
20
28
  ### smoke(目标 <5s)
21
29
 
22
30
  ```bash
23
- npm run test:smoke
31
+ # TODO:替换为项目的 smoke 子集命令
32
+ # npm run test:smoke (Node.js)
33
+ # pytest -m "not slow" (Python)
34
+ # go test -short ./... (Go)
24
35
  ```
25
36
 
26
37
  适用场景:
@@ -31,7 +42,10 @@ npm run test:smoke
31
42
  ### core(目标 <15s)
32
43
 
33
44
  ```bash
34
- npm run test:core
45
+ # TODO:替换为项目的 core 子集命令
46
+ # npm run test:core (Node.js)
47
+ # pytest -m "not contract" (Python)
48
+ # go test ./... (Go)
35
49
  ```
36
50
 
37
51
  适用场景:
@@ -39,18 +53,22 @@ npm run test:core
39
53
  - 写 code.md / code-r{N}.md 报告前的最终验证
40
54
  - 推送 PR 前的本地把关
41
55
 
42
- ### full(目标 <60s)
56
+ ### full(完整测试套件)
43
57
 
44
58
  ```bash
45
- npm test
59
+ # TODO:替换为项目的完整测试命令
60
+ # npm test (Node.js)
61
+ # mvn test (Maven)
62
+ # pytest (Python)
63
+ # go test ./... (Go)
46
64
  ```
47
65
 
48
66
  适用场景:
49
67
  - release / tag 前
50
- - CI(unit-tests.yml)
68
+ - CI
51
69
  - main 合并前的最终把关
52
70
 
53
- full 层运行全部项目测试。`npm test` 使用通配匹配项目测试文件,**新增的测试文件会自动归入 full**,这是安全网。
71
+ 如果项目尚未分层,smoke / core / full 可以全部使用完整测试命令;分层不是使用协作工作流的前置条件。
54
72
 
55
73
  ## 3. 输出结果
56
74
 
@@ -133,7 +133,7 @@ node .agents/skills/update-agent-infra/scripts/sync-templates.js
133
133
  ```
134
134
  下一步 - 提交代码:
135
135
  - Claude Code / OpenCode:/commit
136
- - Gemini CLI:/agent-infra:commit
136
+ - Gemini CLI:/{{project}}:commit
137
137
  - Codex CLI:$commit
138
138
  ```
139
139
 
@@ -35,6 +35,7 @@ const DEFAULTS = {
35
35
  "gemini-cli",
36
36
  "opencode"
37
37
  ],
38
+ "refreshIntervalDays": 7,
38
39
  "dockerfile": null,
39
40
  "vm": {
40
41
  "cpu": null,
@@ -72,6 +73,7 @@ const DEFAULTS = {
72
73
  "**/test-integration.*",
73
74
  "**/test.*",
74
75
  "**/upgrade-dependency.*",
76
+ ".agents/rules/testing-discipline.*",
75
77
  ".agents/skills/post-release/SKILL.*",
76
78
  ".agents/skills/release/SKILL.*",
77
79
  ".agents/skills/test-integration/SKILL.*",
@@ -234,7 +236,7 @@ function parseSkillFrontmatter(filePath) {
234
236
  if (!pair) continue;
235
237
 
236
238
  const [, key, rawValue] = pair;
237
- if (rawValue === '>') {
239
+ if (rawValue === '>' || rawValue === '|') {
238
240
  const block = [];
239
241
  for (let offset = index + 1; offset < lines.length; offset += 1) {
240
242
  const nextLine = lines[offset];
@@ -243,7 +245,7 @@ function parseSkillFrontmatter(filePath) {
243
245
  block.push(nextLine.trim());
244
246
  index = offset;
245
247
  }
246
- result[key] = block.join(' ').trim();
248
+ result[key] = block.join(rawValue === '|' ? '\n' : ' ').trim();
247
249
  continue;
248
250
  }
249
251
 
@@ -260,6 +262,12 @@ function listTemplateSkillNames(templateRoot) {
260
262
  return new Set(
261
263
  fs.readdirSync(templateSkillsDir, { withFileTypes: true })
262
264
  .filter((entry) => entry.isDirectory())
265
+ .filter((entry) => {
266
+ const skillDir = path.join(templateSkillsDir, entry.name);
267
+ return ['SKILL.md', 'SKILL.en.md', 'SKILL.zh-CN.md'].some((file) =>
268
+ fs.existsSync(path.join(skillDir, file))
269
+ );
270
+ })
263
271
  .map((entry) => entry.name)
264
272
  );
265
273
  }
@@ -279,7 +287,8 @@ function detectCustomSkills(projectRoot, templateSkillNames) {
279
287
  dirName: entry.name,
280
288
  name: meta.name || entry.name,
281
289
  description: meta.description || '',
282
- args: meta.args || null
290
+ args: meta.args || null,
291
+ disableModelInvocation: meta['disable-model-invocation'] === 'true'
283
292
  };
284
293
  })
285
294
  .filter(Boolean)
@@ -494,14 +503,35 @@ function cleanStaleSyncedFiles(projectRoot, syncedSkills, report) {
494
503
  }
495
504
  }
496
505
 
506
+ function formatYamlMetadata(key, value) {
507
+ if (!value.includes('\n')) {
508
+ return [`${key}: ${JSON.stringify(value)}`];
509
+ }
510
+
511
+ return [`${key}: |-`, ...value.split('\n').map((line) => ` ${line}`)];
512
+ }
513
+
514
+ function formatTomlMetadata(key, value) {
515
+ if (!value.includes('\n')) {
516
+ return `${key} = ${JSON.stringify(value)}`;
517
+ }
518
+
519
+ const lines = value.split('\n').map((line) => JSON.stringify(line).slice(1, -1));
520
+ return `${key} = """${lines.join('\n')}"""`;
521
+ }
522
+
497
523
  function generateClaudeCommand(skill, lang) {
498
524
  const isZhCN = lang === 'zh-CN';
499
- const lines = ['---', `description: ${JSON.stringify(skill.description)}`];
525
+ const lines = ['---', ...formatYamlMetadata('description', skill.description)];
500
526
 
501
527
  if (skill.args) {
502
528
  lines.push(`usage: ${JSON.stringify(`/${skill.dirName} ${skill.args}`)}`);
503
529
  }
504
530
 
531
+ if (skill.disableModelInvocation) {
532
+ lines.push('disable-model-invocation: true');
533
+ }
534
+
505
535
  lines.push('---', '');
506
536
  lines.push(
507
537
  isZhCN
@@ -532,7 +562,7 @@ function generateGeminiCommand(skill, lang) {
532
562
  promptLines.push(isZhCN ? '严格按照技能中定义的所有步骤执行。' : 'Follow all steps defined in the skill exactly.');
533
563
 
534
564
  return [
535
- `description = ${JSON.stringify(skill.description)}`,
565
+ formatTomlMetadata('description', skill.description),
536
566
  'prompt = """',
537
567
  ...promptLines,
538
568
  '"""'
@@ -543,7 +573,7 @@ function generateOpenCodeCommand(skill, lang) {
543
573
  const isZhCN = lang === 'zh-CN';
544
574
  const lines = [
545
575
  '---',
546
- `description: ${JSON.stringify(skill.description)}`,
576
+ ...formatYamlMetadata('description', skill.description),
547
577
  'agent: general',
548
578
  'subtask: false',
549
579
  '---',
@@ -67,7 +67,7 @@ When self-heal hits the cap, the failure is non-code, the run id is unlocatable,
67
67
  Get the current time:
68
68
 
69
69
  ```bash
70
- date "+%Y-%m-%d %H:%M:%S%:z"
70
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
71
71
  ```
72
72
 
73
73
  Update `.agents/workspace/active/{task-id}/task.md`:
@@ -109,7 +109,7 @@ Output per scenario:
109
109
  ```
110
110
  Next step - Complete and archive the task:
111
111
  - Claude Code / OpenCode: /complete-task {task-ref}
112
- - Gemini CLI: /agent-infra:complete-task {task-ref}
112
+ - Gemini CLI: /{{project}}:complete-task {task-ref}
113
113
  - Codex CLI: $complete-task {task-ref}
114
114
  ```
115
115
 
@@ -67,7 +67,7 @@ description: >
67
67
  获取当前时间:
68
68
 
69
69
  ```bash
70
- date "+%Y-%m-%d %H:%M:%S%:z"
70
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
71
71
  ```
72
72
 
73
73
  更新 `.agents/workspace/active/{task-id}/task.md`:
@@ -109,7 +109,7 @@ node .agents/scripts/validate-artifact.js gate watch-pr .agents/workspace/active
109
109
  ```
110
110
  下一步 - 完成并归档任务:
111
111
  - Claude Code / OpenCode:/complete-task {task-ref}
112
- - Gemini CLI:/agent-infra:complete-task {task-ref}
112
+ - Gemini CLI:/{{project}}:complete-task {task-ref}
113
113
  - Codex CLI:$complete-task {task-ref}
114
114
  ```
115
115
 
@@ -12,6 +12,13 @@ After running the watch command from `.agents/rules/pr-checks-commands.md`, clas
12
12
 
13
13
  ## Self-Heal Decision Tree
14
14
 
15
+ ```text
16
+ # self-heal-test-command-contract
17
+ primary: failing-job-command
18
+ fallback-source: project-test-skill
19
+ unknown: help
20
+ ```
21
+
15
22
  For each failing check, decide "self-heal" vs "ask for help" in this order:
16
23
 
17
24
  1. **Can the corresponding CI run be located** (per the rule's "Resolve a failing run id")? No → ask for help.
@@ -22,7 +29,7 @@ For each failing check, decide "self-heal" vs "ask for help" in this order:
22
29
  4. When "locatable + code layer + under cap" holds, perform one self-heal:
23
30
  - Before fixing, run `git status -s` to record the working tree and ensure only changes related to this failure are included.
24
31
  - Locate and make a minimal fix per the logs (touch only code / tests / config related to that failure).
25
- - Run the relevant tests: prefer the local command for the failing job; fall back to `npm run test:core` repo-wide. **Do not commit or push before tests pass.**
32
+ - Run the relevant tests: prefer the local command for the failing job; otherwise read the project `test` skill and select its declared core or full validation command. If neither command is known, ask for help. **Do not commit or push before tests pass.**
26
33
  - After tests pass, publish the fix: per `.agents/rules/commit-and-pr.md` stage only the related files (`git add <paths>`, avoid `git add -A` pulling in unrelated changes) → create the fix commit (`git commit`) → `git push` to the current PR branch.
27
34
  - Record the fix commit SHA, increment the fix count, and return to SKILL step 2 to re-watch.
28
35
  - Never make unrelated "drive-by" optimizations; never loosen / skip the failing assertion to "make it green".
@@ -12,6 +12,13 @@
12
12
 
13
13
  ## 自愈决策树
14
14
 
15
+ ```text
16
+ # self-heal-test-command-contract
17
+ primary: failing-job-command
18
+ fallback-source: project-test-skill
19
+ unknown: help
20
+ ```
21
+
15
22
  对每个失败 check,按下列顺序判定「自愈」还是「求助」:
16
23
 
17
24
  1. **能否定位到对应的 CI run**(按规则的「解析失败 run id」)?否 → 求助。
@@ -22,7 +29,7 @@
22
29
  4. 满足「可定位 + 代码层 + 未达上限」时执行一次自愈:
23
30
  - 自愈前先 `git status -s` 记录当前工作树,确保后续只纳入与本次失败相关的改动。
24
31
  - 在本地按日志定位并最小化修复(只动与该失败相关的代码 / 测试 / 配置)。
25
- - 运行对应测试:优先失败 job 对应的本地命令;仓库统一回退 `npm run test:core`。**测试通过前不得提交或推送。**
32
+ - 运行对应测试:优先失败 job 对应的本地命令;否则读取项目 `test` skill,选择其中声明的 core 或 full 验证命令。两者均未知时进入求助出口。**测试通过前不得提交或推送。**
26
33
  - 测试通过后发布修复:按 `.agents/rules/commit-and-pr.md` 仅暂存本次相关文件(`git add <相关路径>`,避免 `git add -A` 卷入无关改动)→ 创建修复 commit(`git commit`)→ `git push` 到当前 PR 分支。
27
34
  - 记录本次修复的 commit SHA,修复计数 +1,回到 SKILL 步骤 2 重新监控。
28
35
  - 绝不执行与失败无关的「顺手优化」;不放宽 / 跳过失败的断言来「修绿」。
@@ -64,6 +64,13 @@ pr_status: pending # PR status: pending (default) | created (PR crea
64
64
 
65
65
  <!-- Humans record rulings for needs-human-decision decisions here and flip matching HD- rows in the Review Disagreement Ledger to human-decided. -->
66
66
 
67
+ ## Workflow Warnings
68
+
69
+ <!-- Workflow degradation, platform sync failures, permission gaps, and related events. Keep the header when empty. -->
70
+
71
+ | id | time | step | severity | code | status | target | message | action | resolved_at | resolution |
72
+ |----|------|------|----------|------|--------|--------|---------|--------|-------------|------------|
73
+
67
74
  ## Activity Log
68
75
 
69
76
  <!-- Append a new entry for each workflow step. Do NOT overwrite previous entries. -->
@@ -64,6 +64,13 @@ pr_status: pending # PR 状态:pending(默认)| created(已
64
64
 
65
65
  <!-- 人类在此记录对 needs-human-decision 决策的裁定,并把 ## 审查分歧账本 对应 HD- 行翻为 human-decided。 -->
66
66
 
67
+ ## 工作流告警
68
+
69
+ <!-- 工作流降级、平台同步失败、权限不足等需要后续注意的事件写入此段。无告警时保留表头即可。 -->
70
+
71
+ | id | time | step | severity | code | status | target | message | action | resolved_at | resolution |
72
+ |----|------|------|----------|------|--------|--------|---------|--------|-------------|------------|
73
+
67
74
  ## 活动日志
68
75
 
69
76
  <!-- 每个工作流步骤追加一条新记录,不要覆盖之前的记录。 -->
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: "Mark PR manual validation as completed and update the summary comment"
3
+ usage: "/complete-manual-validation <task-id> [pr-ref] <verification-summary>"
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Read and execute the complete-manual-validation skill from `.agents/skills/complete-manual-validation/SKILL.md`.
8
+
9
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: "标记 PR 人工验证已完成并更新摘要评论"
3
+ usage: "/complete-manual-validation <task-id> [pr-ref] <verification-summary>"
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ 读取并执行 `.agents/skills/complete-manual-validation/SKILL.md` 中的 complete-manual-validation 技能。
8
+
9
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,8 @@
1
+ description = "Mark PR manual validation as completed and update the summary comment"
2
+ prompt = """
3
+ Complete manual validation: {{args}}
4
+
5
+ Read and execute the complete-manual-validation skill from `.agents/skills/complete-manual-validation/SKILL.md`.
6
+
7
+ Follow all steps defined in the skill exactly.
8
+ """
@@ -0,0 +1,8 @@
1
+ description = "标记 PR 人工验证已完成并更新摘要评论"
2
+ prompt = """
3
+ 完成人工验证:{{args}}
4
+
5
+ 读取并执行 `.agents/skills/complete-manual-validation/SKILL.md` 中的 complete-manual-validation 技能。
6
+
7
+ 严格按照技能中定义的所有步骤执行。
8
+ """
@@ -87,6 +87,11 @@ jobs:
87
87
  ISSUE_NUMBER: ${{ github.event.issue.number }}
88
88
  TYPE: ${{ steps.metadata.outputs.type }}
89
89
  run: |
90
+ OWNER_TYPE=$(gh api "repos/$GITHUB_REPOSITORY" --jq '.owner.type // empty' 2>/dev/null || true)
91
+ if [ "$OWNER_TYPE" != "Organization" ]; then
92
+ exit 0
93
+ fi
94
+
90
95
  case "$TYPE" in
91
96
  bug|bugfix) ISSUE_TYPE="Bug" ;;
92
97
  feature|enhancement) ISSUE_TYPE="Feature" ;;
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "Mark PR manual validation as completed and update the summary comment"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ Complete manual validation: $ARGUMENTS
8
+
9
+ Read and execute the complete-manual-validation skill from `.agents/skills/complete-manual-validation/SKILL.md`.
10
+
11
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "标记 PR 人工验证已完成并更新摘要评论"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ 完成人工验证:$ARGUMENTS
8
+
9
+ 读取并执行 `.agents/skills/complete-manual-validation/SKILL.md` 中的 complete-manual-validation 技能。
10
+
11
+ 严格按照技能中定义的所有步骤执行。