@fitlab-ai/agent-infra 0.8.3 → 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 (100) hide show
  1. package/README.zh-CN.md +10 -0
  2. package/bin/cli.ts +1 -1
  3. package/dist/bin/cli.js +1 -1
  4. package/dist/lib/cp.js +56 -15
  5. package/dist/lib/defaults.json +1 -0
  6. package/dist/lib/sandbox/capture.js +5 -3
  7. package/dist/lib/sandbox/clipboard/bridge.js +12 -9
  8. package/dist/lib/sandbox/clipboard/inbox.js +82 -0
  9. package/dist/lib/sandbox/commands/create.js +39 -23
  10. package/dist/lib/sandbox/runtimes/base.dockerfile +3 -0
  11. package/dist/lib/sandbox/shell.js +9 -1
  12. package/dist/lib/sandbox/tools.js +2 -2
  13. package/lib/cp.ts +56 -15
  14. package/lib/defaults.json +1 -0
  15. package/lib/sandbox/capture.ts +5 -3
  16. package/lib/sandbox/clipboard/bridge.ts +14 -12
  17. package/lib/sandbox/clipboard/inbox.ts +83 -0
  18. package/lib/sandbox/commands/create.ts +48 -24
  19. package/lib/sandbox/runtimes/base.dockerfile +3 -0
  20. package/lib/sandbox/shell.ts +11 -2
  21. package/lib/sandbox/tools.ts +5 -5
  22. package/package.json +1 -1
  23. package/templates/.agents/README.en.md +3 -0
  24. package/templates/.agents/README.zh-CN.md +3 -0
  25. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  26. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  27. package/templates/.agents/rules/review-handshake.en.md +2 -2
  28. package/templates/.agents/rules/review-handshake.zh-CN.md +2 -2
  29. package/templates/.agents/rules/testing-discipline.en.md +3 -41
  30. package/templates/.agents/rules/testing-discipline.zh-CN.md +3 -41
  31. package/templates/.agents/scripts/validate-artifact.js +93 -0
  32. package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -1
  33. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +2 -2
  34. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +1 -1
  35. package/templates/.agents/skills/block-task/SKILL.en.md +1 -1
  36. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  37. package/templates/.agents/skills/cancel-task/SKILL.en.md +1 -1
  38. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  39. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +9 -9
  40. package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
  41. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  42. package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
  43. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  44. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  45. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
  46. package/templates/.agents/skills/code-task/reference/branch-management.zh-CN.md +2 -2
  47. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +2 -2
  48. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +2 -2
  49. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +1 -1
  50. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  51. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  52. package/templates/.agents/skills/commit/reference/task-status-update.en.md +6 -6
  53. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +6 -6
  54. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +27 -3
  55. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +27 -3
  56. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  57. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  58. package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
  59. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
  60. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  61. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  62. package/templates/.agents/skills/create-task/SKILL.en.md +2 -2
  63. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -5
  64. package/templates/.agents/skills/import-codescan/SKILL.en.md +2 -2
  65. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +3 -3
  66. package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
  67. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
  68. package/templates/.agents/skills/import-issue/SKILL.en.md +2 -2
  69. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +3 -3
  70. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +1 -1
  71. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -2
  72. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -3
  73. package/templates/.agents/skills/init-milestones/scripts/init-milestones.github.sh +165 -41
  74. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  75. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
  76. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  77. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  78. package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
  79. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +1 -1
  80. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +5 -5
  81. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +5 -5
  82. package/templates/.agents/skills/review-code/SKILL.en.md +8 -4
  83. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +6 -3
  84. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  85. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  86. package/templates/.agents/skills/review-code/reference/output-templates.en.md +5 -5
  87. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +5 -5
  88. package/templates/.agents/skills/review-code/reference/report-template.en.md +2 -2
  89. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +2 -2
  90. package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
  91. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +1 -1
  92. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +5 -5
  93. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +5 -5
  94. package/templates/.agents/skills/test/SKILL.zh-CN.md +26 -8
  95. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -1
  96. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +29 -6
  97. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  98. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  99. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +8 -1
  100. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +8 -1
@@ -27,7 +27,7 @@ Task {task-id} requirement analysis review completed. Verdict: approved.
27
27
 
28
28
  Next step - write the technical plan:
29
29
  - Claude Code / OpenCode: /plan-task {task-ref}
30
- - Gemini CLI: /agent-infra:plan-task {task-ref}
30
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
31
31
  - Codex CLI: $plan-task {task-ref}
32
32
 
33
33
  [When manual-validation > 0, append:]
@@ -43,12 +43,12 @@ Task {task-id} requirement analysis review completed. Verdict: approved.
43
43
 
44
44
  Next step - revise analysis before continuing (recommended):
45
45
  - Claude Code / OpenCode: /analyze-task {task-ref}
46
- - Gemini CLI: /agent-infra:analyze-task {task-ref}
46
+ - Gemini CLI: /{{project}}:analyze-task {task-ref}
47
47
  - Codex CLI: $analyze-task {task-ref}
48
48
 
49
49
  Or proceed directly to planning:
50
50
  - Claude Code / OpenCode: /plan-task {task-ref}
51
- - Gemini CLI: /agent-infra:plan-task {task-ref}
51
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
52
52
  - Codex CLI: $plan-task {task-ref}
53
53
 
54
54
  [When manual-validation > 0, append:]
@@ -64,7 +64,7 @@ Task {task-id} requirement analysis review completed. Verdict: changes requested
64
64
 
65
65
  Next step - revise requirement analysis:
66
66
  - Claude Code / OpenCode: /analyze-task {task-ref}
67
- - Gemini CLI: /agent-infra:analyze-task {task-ref}
67
+ - Gemini CLI: /{{project}}:analyze-task {task-ref}
68
68
  - Codex CLI: $analyze-task {task-ref}
69
69
 
70
70
  [When manual-validation > 0, append:]
@@ -80,7 +80,7 @@ Task {task-id} requirement analysis review completed. Verdict: rejected, fresh a
80
80
 
81
81
  Next step - re-analyze:
82
82
  - Claude Code / OpenCode: /analyze-task {task-ref}
83
- - Gemini CLI: /agent-infra:analyze-task {task-ref}
83
+ - Gemini CLI: /{{project}}:analyze-task {task-ref}
84
84
  - Codex CLI: $analyze-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:/plan-task {task-ref}
30
- - Gemini CLI:/agent-infra:plan-task {task-ref}
30
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
31
31
  - Codex CLI:$plan-task {task-ref}
32
32
 
33
33
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -43,12 +43,12 @@
43
43
 
44
44
  下一步 - 修订分析后继续(推荐):
45
45
  - Claude Code / OpenCode:/analyze-task {task-ref}
46
- - Gemini CLI:/agent-infra:analyze-task {task-ref}
46
+ - Gemini CLI:/{{project}}:analyze-task {task-ref}
47
47
  - Codex CLI:$analyze-task {task-ref}
48
48
 
49
49
  或直接进入方案设计:
50
50
  - Claude Code / OpenCode:/plan-task {task-ref}
51
- - Gemini CLI:/agent-infra:plan-task {task-ref}
51
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
52
52
  - Codex CLI:$plan-task {task-ref}
53
53
 
54
54
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -64,7 +64,7 @@
64
64
 
65
65
  下一步 - 修订需求分析:
66
66
  - Claude Code / OpenCode:/analyze-task {task-ref}
67
- - Gemini CLI:/agent-infra:analyze-task {task-ref}
67
+ - Gemini CLI:/{{project}}:analyze-task {task-ref}
68
68
  - Codex CLI:$analyze-task {task-ref}
69
69
 
70
70
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -80,7 +80,7 @@
80
80
 
81
81
  下一步 - 重新分析:
82
82
  - Claude Code / OpenCode:/analyze-task {task-ref}
83
- - Gemini CLI:/agent-infra:analyze-task {task-ref}
83
+ - Gemini CLI:/{{project}}:analyze-task {task-ref}
84
84
  - Codex CLI:$analyze-task {task-ref}
85
85
 
86
86
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -74,9 +74,10 @@ Read the highest-round code artifact and, if present, the highest-round fix arti
74
74
  ### 4. Perform the Review
75
75
 
76
76
  Follow `.agents/workflows/feature-development.yaml` and inspect the full change context:
77
- - `git diff --binary HEAD -- <post-review-globs>` for tracked changes
77
+ - Capture `R=$(git rev-parse HEAD)` exactly once; reuse that R for this round's report, fingerprint, and task review fact, and do not re-read HEAD later as a substitute
78
+ - `git diff --binary "$R" -- <post-review-globs>` for tracked changes
78
79
  - `git ls-files -o --exclude-standard -z -- <post-review-globs>` for untracked new files
79
- - `node .agents/scripts/review-diff-fingerprint.js worktree HEAD` for the reviewed diff fingerprint; write it into the report
80
+ - `node .agents/scripts/review-diff-fingerprint.js worktree "$R"` for the reviewed diff fingerprint; write it into the report
80
81
 
81
82
  > Detailed review criteria, severity rules, and reviewer expectations live in `reference/review-criteria.md`. Read `reference/review-criteria.md` before reviewing.
82
83
  > Test review gate: when `git diff` touches test files, read `.agents/rules/testing-discipline.md` first and check it item by item, especially "do not add negative assertions when a positive assertion already covers the behavior".
@@ -92,10 +93,13 @@ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
92
93
  Get the current time:
93
94
 
94
95
  ```bash
95
- date "+%Y-%m-%d %H:%M:%S%:z"
96
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
96
97
  ```
97
98
 
98
- Update task.md and append:
99
+ Update task.md:
100
+ - When this round's `Overall Verdict` / `总体结论` is `Approved` / `通过`, write `last_reviewed_commit: {R}`; the presence of a worktree diff does not affect this write, and repeating the same R is idempotent
101
+ - When this round is not Approved, preserve the existing `last_reviewed_commit`; do not advance or clear it
102
+ - Append:
99
103
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Code (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}, Manual-validation: {n} → {artifact-filename}`
100
104
 
101
105
  Always include the `Manual-validation: {n}` field in the done log, including when it is 0.
@@ -73,9 +73,10 @@ tail .agents/workspace/active/{task-id}/task.md
73
73
  ### 4. 执行审查
74
74
 
75
75
  遵循 `.agents/workflows/feature-development.yaml`,并同时检查完整变更上下文:
76
- - `git diff --binary HEAD -- <post-review-globs>` 覆盖已跟踪变更
76
+ - 一次性记录 `R=$(git rev-parse HEAD)`;本轮报告、指纹和任务审查事实都复用该 R,禁止稍后重新读取 HEAD 代替
77
+ - `git diff --binary "$R" -- <post-review-globs>` 覆盖已跟踪变更
77
78
  - `git ls-files -o --exclude-standard -z -- <post-review-globs>` 覆盖未跟踪新文件
78
- - `node .agents/scripts/review-diff-fingerprint.js worktree HEAD` 生成审查差异指纹,并写入报告
79
+ - `node .agents/scripts/review-diff-fingerprint.js worktree "$R"` 生成审查差异指纹,并写入报告
79
80
 
80
81
  > 详细审查标准、严重程度划分和 reviewer 关注点见 `reference/review-criteria.md`。执行此步骤前先读取 `reference/review-criteria.md`。
81
82
  > 测试审查硬门禁:当 `git diff` 触及测试文件时,必须先读取 `.agents/rules/testing-discipline.md` 并逐条核对(尤其"正向已覆盖时不应再加反向断言")。
@@ -91,13 +92,15 @@ tail .agents/workspace/active/{task-id}/task.md
91
92
  获取当前时间:
92
93
 
93
94
  ```bash
94
- date "+%Y-%m-%d %H:%M:%S%:z"
95
+ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
95
96
  ```
96
97
 
97
98
  - `current_step`:code-review
98
99
  - `assigned_to`:{当前代理}
99
100
  - `updated_at`:{当前时间}
100
101
  - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
102
+ - 若本轮 `总体结论` / `Overall Verdict` 为 `通过` / `Approved`,写入 `last_reviewed_commit: {R}`;是否存在工作区 diff 不影响写入,重复写同一 R 幂等
103
+ - 若本轮结论不是 Approved,保留既有 `last_reviewed_commit`,不得推进或清空
101
104
  - 追加:
102
105
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Code (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}, Manual-validation: {n} → {artifact-filename}`
103
106
 
@@ -36,6 +36,7 @@
36
36
  ],
37
37
  "freshness_minutes": 30
38
38
  },
39
+ "review-fact": {},
39
40
  "activity-log": {
40
41
  "expected_action_pattern": "(Review Code|Code Review) \\(Round \\d+\\)",
41
42
  "freshness_minutes": 30
@@ -36,6 +36,7 @@
36
36
  ],
37
37
  "freshness_minutes": 30
38
38
  },
39
+ "review-fact": {},
39
40
  "activity-log": {
40
41
  "expected_action_pattern": "(Review Code|Code Review) \\(Round \\d+\\)",
41
42
  "freshness_minutes": 30
@@ -29,7 +29,7 @@ Task {task-id} review completed. Verdict: approved.
29
29
 
30
30
  Next step - commit the code:
31
31
  - Claude Code / OpenCode: /commit
32
- - Gemini CLI: /agent-infra:commit
32
+ - Gemini CLI: /{{project}}:commit
33
33
  - Codex CLI: $commit
34
34
 
35
35
  [When manual-validation > 0, append this final line:]
@@ -45,12 +45,12 @@ Task {task-id} review completed. Verdict: approved.
45
45
 
46
46
  Next step - fix before commit (recommended):
47
47
  - Claude Code / OpenCode: /code-task {task-ref}
48
- - Gemini CLI: /agent-infra:code-task {task-ref}
48
+ - Gemini CLI: /{{project}}:code-task {task-ref}
49
49
  - Codex CLI: $code-task {task-ref}
50
50
 
51
51
  Or commit directly (skip fix):
52
52
  - Claude Code / OpenCode: /commit
53
- - Gemini CLI: /agent-infra:commit
53
+ - Gemini CLI: /{{project}}:commit
54
54
  - Codex CLI: $commit
55
55
 
56
56
  [When manual-validation > 0, append this final line:]
@@ -66,7 +66,7 @@ Task {task-id} review completed. Verdict: changes requested.
66
66
 
67
67
  Next step - fix the findings:
68
68
  - Claude Code / OpenCode: /code-task {task-ref}
69
- - Gemini CLI: /agent-infra:code-task {task-ref}
69
+ - Gemini CLI: /{{project}}:code-task {task-ref}
70
70
  - Codex CLI: $code-task {task-ref}
71
71
 
72
72
  [When manual-validation > 0, append this final line:]
@@ -82,7 +82,7 @@ Task {task-id} review completed. Verdict: rejected, re-design the technical plan
82
82
 
83
83
  Next step - re-design the technical plan:
84
84
  - Claude Code / OpenCode: /plan-task {task-ref}
85
- - Gemini CLI: /agent-infra:plan-task {task-ref}
85
+ - Gemini CLI: /{{project}}:plan-task {task-ref}
86
86
  - Codex CLI: $plan-task {task-ref}
87
87
 
88
88
  > Note: Rejected means the implementation direction needs to be reworked end-to-end, not patched locally. `code-task/scripts/detect-mode.js` branch #7 refuses a direct `/code-task` and requires a fresh plan first.
@@ -29,7 +29,7 @@
29
29
 
30
30
  下一步 - 提交代码:
31
31
  - Claude Code / OpenCode:/commit
32
- - Gemini CLI:/agent-infra:commit
32
+ - Gemini CLI:/{{project}}:commit
33
33
  - Codex CLI:$commit
34
34
 
35
35
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -45,12 +45,12 @@
45
45
 
46
46
  下一步 - 修复问题后提交(推荐):
47
47
  - Claude Code / OpenCode:/code-task {task-ref}
48
- - Gemini CLI:/agent-infra:code-task {task-ref}
48
+ - Gemini CLI:/{{project}}:code-task {task-ref}
49
49
  - Codex CLI:$code-task {task-ref}
50
50
 
51
51
  或直接提交(跳过修复):
52
52
  - Claude Code / OpenCode:/commit
53
- - Gemini CLI:/agent-infra:commit
53
+ - Gemini CLI:/{{project}}:commit
54
54
  - Codex CLI:$commit
55
55
 
56
56
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -66,7 +66,7 @@
66
66
 
67
67
  下一步 - 修复问题:
68
68
  - Claude Code / OpenCode:/code-task {task-ref}
69
- - Gemini CLI:/agent-infra:code-task {task-ref}
69
+ - Gemini CLI:/{{project}}:code-task {task-ref}
70
70
  - Codex CLI:$code-task {task-ref}
71
71
 
72
72
  [当 manual-validation > 0 时,在最后附加一行:]
@@ -82,7 +82,7 @@
82
82
 
83
83
  下一步 - 重新设计技术方案:
84
84
  - Claude Code / OpenCode:/plan-task {task-ref}
85
- - Gemini CLI:/agent-infra:plan-task {task-ref}
85
+ - Gemini CLI:/{{project}}:plan-task {task-ref}
86
86
  - Codex CLI:$plan-task {task-ref}
87
87
 
88
88
  > 注意:Rejected 表示实现方向需要整体重做,不是局部修复。`code-task/scripts/detect-mode.js` 分支 #7 会拒绝直接 `/code-task`,要求先重新方案设计。
@@ -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
 
@@ -73,6 +73,7 @@ const DEFAULTS = {
73
73
  "**/test-integration.*",
74
74
  "**/test.*",
75
75
  "**/upgrade-dependency.*",
76
+ ".agents/rules/testing-discipline.*",
76
77
  ".agents/skills/post-release/SKILL.*",
77
78
  ".agents/skills/release/SKILL.*",
78
79
  ".agents/skills/test-integration/SKILL.*",
@@ -235,7 +236,7 @@ function parseSkillFrontmatter(filePath) {
235
236
  if (!pair) continue;
236
237
 
237
238
  const [, key, rawValue] = pair;
238
- if (rawValue === '>') {
239
+ if (rawValue === '>' || rawValue === '|') {
239
240
  const block = [];
240
241
  for (let offset = index + 1; offset < lines.length; offset += 1) {
241
242
  const nextLine = lines[offset];
@@ -244,7 +245,7 @@ function parseSkillFrontmatter(filePath) {
244
245
  block.push(nextLine.trim());
245
246
  index = offset;
246
247
  }
247
- result[key] = block.join(' ').trim();
248
+ result[key] = block.join(rawValue === '|' ? '\n' : ' ').trim();
248
249
  continue;
249
250
  }
250
251
 
@@ -286,7 +287,8 @@ function detectCustomSkills(projectRoot, templateSkillNames) {
286
287
  dirName: entry.name,
287
288
  name: meta.name || entry.name,
288
289
  description: meta.description || '',
289
- args: meta.args || null
290
+ args: meta.args || null,
291
+ disableModelInvocation: meta['disable-model-invocation'] === 'true'
290
292
  };
291
293
  })
292
294
  .filter(Boolean)
@@ -501,14 +503,35 @@ function cleanStaleSyncedFiles(projectRoot, syncedSkills, report) {
501
503
  }
502
504
  }
503
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
+
504
523
  function generateClaudeCommand(skill, lang) {
505
524
  const isZhCN = lang === 'zh-CN';
506
- const lines = ['---', `description: ${JSON.stringify(skill.description)}`];
525
+ const lines = ['---', ...formatYamlMetadata('description', skill.description)];
507
526
 
508
527
  if (skill.args) {
509
528
  lines.push(`usage: ${JSON.stringify(`/${skill.dirName} ${skill.args}`)}`);
510
529
  }
511
530
 
531
+ if (skill.disableModelInvocation) {
532
+ lines.push('disable-model-invocation: true');
533
+ }
534
+
512
535
  lines.push('---', '');
513
536
  lines.push(
514
537
  isZhCN
@@ -539,7 +562,7 @@ function generateGeminiCommand(skill, lang) {
539
562
  promptLines.push(isZhCN ? '严格按照技能中定义的所有步骤执行。' : 'Follow all steps defined in the skill exactly.');
540
563
 
541
564
  return [
542
- `description = ${JSON.stringify(skill.description)}`,
565
+ formatTomlMetadata('description', skill.description),
543
566
  'prompt = """',
544
567
  ...promptLines,
545
568
  '"""'
@@ -550,7 +573,7 @@ function generateOpenCodeCommand(skill, lang) {
550
573
  const isZhCN = lang === 'zh-CN';
551
574
  const lines = [
552
575
  '---',
553
- `description: ${JSON.stringify(skill.description)}`,
576
+ ...formatYamlMetadata('description', skill.description),
554
577
  'agent: general',
555
578
  'subtask: false',
556
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
  - 绝不执行与失败无关的「顺手优化」;不放宽 / 跳过失败的断言来「修绿」。