@fitlab-ai/agent-infra 0.7.6 → 0.7.7

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 (106) hide show
  1. package/bin/cli.ts +11 -3
  2. package/dist/bin/cli.js +10 -3
  3. package/dist/lib/sandbox/commands/ls.js +4 -33
  4. package/dist/lib/sandbox/commands/show.js +67 -0
  5. package/dist/lib/sandbox/index.js +7 -0
  6. package/dist/lib/task/commands/issue-body.js +94 -0
  7. package/dist/lib/task/commands/log.js +92 -9
  8. package/dist/lib/task/index.js +8 -0
  9. package/dist/lib/task/issue-form.js +66 -0
  10. package/dist/lib/task/sections.js +44 -0
  11. package/lib/sandbox/commands/ls.ts +4 -36
  12. package/lib/sandbox/commands/show.ts +80 -0
  13. package/lib/sandbox/index.ts +7 -0
  14. package/lib/task/commands/issue-body.ts +102 -0
  15. package/lib/task/commands/log.ts +96 -9
  16. package/lib/task/index.ts +8 -0
  17. package/lib/task/issue-form.ts +77 -0
  18. package/lib/task/sections.ts +44 -0
  19. package/package.json +3 -2
  20. package/templates/.agents/README.en.md +3 -1
  21. package/templates/.agents/README.zh-CN.md +3 -1
  22. package/templates/.agents/rules/create-issue.github.en.md +20 -29
  23. package/templates/.agents/rules/create-issue.github.zh-CN.md +20 -29
  24. package/templates/.agents/rules/issue-pr-commands.github.en.md +6 -0
  25. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +6 -0
  26. package/templates/.agents/rules/next-step-output.en.md +26 -1
  27. package/templates/.agents/rules/next-step-output.zh-CN.md +26 -1
  28. package/templates/.agents/rules/task-management.en.md +2 -0
  29. package/templates/.agents/rules/task-management.zh-CN.md +2 -0
  30. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -1
  31. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -1
  32. package/templates/.agents/skills/archive-tasks/SKILL.en.md +3 -1
  33. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +3 -1
  34. package/templates/.agents/skills/block-task/SKILL.en.md +3 -1
  35. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +3 -1
  36. package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -1
  37. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -1
  38. package/templates/.agents/skills/check-task/SKILL.en.md +30 -81
  39. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +30 -80
  40. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -1
  41. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -1
  42. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -1
  43. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -1
  44. package/templates/.agents/skills/code-task/SKILL.en.md +3 -1
  45. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -1
  46. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +7 -2
  47. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +7 -2
  48. package/templates/.agents/skills/code-task/scripts/detect-mode.js +6 -14
  49. package/templates/.agents/skills/commit/SKILL.en.md +27 -5
  50. package/templates/.agents/skills/commit/SKILL.zh-CN.md +27 -5
  51. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -1
  52. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -1
  53. package/templates/.agents/skills/create-pr/SKILL.en.md +3 -1
  54. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +3 -1
  55. package/templates/.agents/skills/create-release-note/SKILL.en.md +3 -1
  56. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +3 -1
  57. package/templates/.agents/skills/create-task/SKILL.en.md +3 -1
  58. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +3 -1
  59. package/templates/.agents/skills/import-codescan/SKILL.en.md +3 -1
  60. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +3 -1
  61. package/templates/.agents/skills/import-dependabot/SKILL.en.md +3 -1
  62. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -1
  63. package/templates/.agents/skills/import-issue/SKILL.en.md +19 -2
  64. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +19 -2
  65. package/templates/.agents/skills/init-labels/SKILL.en.md +3 -1
  66. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +3 -1
  67. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -1
  68. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -1
  69. package/templates/.agents/skills/plan-task/SKILL.en.md +3 -1
  70. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +3 -1
  71. package/templates/.agents/skills/post-release/SKILL.en.md +3 -1
  72. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +3 -1
  73. package/templates/.agents/skills/refine-title/SKILL.en.md +3 -1
  74. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +3 -1
  75. package/templates/.agents/skills/release/SKILL.en.md +3 -1
  76. package/templates/.agents/skills/release/SKILL.zh-CN.md +3 -1
  77. package/templates/.agents/skills/restore-task/SKILL.en.md +3 -1
  78. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +3 -1
  79. package/templates/.agents/skills/review-analysis/SKILL.en.md +6 -2
  80. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +6 -2
  81. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +1 -1
  82. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +1 -1
  83. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +1 -1
  84. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +1 -2
  85. package/templates/.agents/skills/review-code/SKILL.en.md +5 -2
  86. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -2
  87. package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
  88. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
  89. package/templates/.agents/skills/review-code/reference/report-template.en.md +1 -1
  90. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +1 -2
  91. package/templates/.agents/skills/review-plan/SKILL.en.md +6 -2
  92. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +6 -2
  93. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +1 -1
  94. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +1 -1
  95. package/templates/.agents/skills/review-plan/reference/report-template.en.md +1 -1
  96. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +1 -2
  97. package/templates/.agents/skills/test/SKILL.en.md +3 -1
  98. package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -1
  99. package/templates/.agents/skills/test-integration/SKILL.en.md +3 -1
  100. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +3 -1
  101. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +3 -1
  102. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +3 -1
  103. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +3 -1
  104. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +3 -1
  105. package/templates/.agents/skills/watch-pr/SKILL.en.md +3 -1
  106. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +3 -1
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "Close a Dependabot alert with a documented reason"
3
+ description: >
4
+ Close a Dependabot alert with a documented reason.
5
+ Use when a Dependabot alert has been handled or dismissed and needs closing with a reason.
4
6
  ---
5
7
 
6
8
  # Dismiss Dependabot Alert
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "关闭 Dependabot 安全告警并记录理由"
3
+ description: >
4
+ 关闭 Dependabot 安全告警并记录理由。
5
+ 当某条 Dependabot 安全告警已处理或需按理由关闭时使用。
4
6
  ---
5
7
 
6
8
  # 关闭 Dependabot 告警
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "Implement code from the technical plan and output a report"
3
+ description: >
4
+ Implement code from the technical plan and output a report.
5
+ Use when an approved technical plan needs implementing, or code review found issues to fix.
4
6
  ---
5
7
 
6
8
  # Code Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "根据技术方案编码任务并输出报告"
3
+ description: >
4
+ 根据技术方案编码任务并输出报告。
5
+ 当技术方案已批准需要落地实现,或代码审查发现问题需要修复时使用。
4
6
  ---
5
7
 
6
8
  # 编码任务
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
11
  The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md` in the task directory.
12
12
 
13
- ## Eight Branches
13
+ ## Seven Branches
14
14
 
15
15
  > Branches are evaluated top-down in this table; the first match returns and skips later rows.
16
16
 
@@ -19,12 +19,17 @@ The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N
19
19
  | no code artifact | `init` | 0 | initial implementation, output `code.md` |
20
20
  | latest review-plan is approved (`Approved` or `Approved-with-issues`, i.e. `Overall Verdict: Approved` regardless of findings counts), its "Review Input" / "审查输入" entry names the same plan file as the latest `plan(-r{N})?.md` in the task directory, and its mtime is newer than the latest code artifact | `init` | 0 | plan has been approved after the latest code; enter a new implementation round, `next_round = code_max + 1`, `next_artifact = code-r{next_round}.md`. This branch fires regardless of whether review-code exists or passes. Plan and review-plan rounds are independent counters (e.g. `plan-r5` may be approved by `review-plan-r4`); the link is established via the review-plan's "Review Input" entry, not by matching round numbers. |
21
21
  | `rev_max < code_max` | `error` | 2 | latest code round is unreviewed; run `review-code` first |
22
- | `rev_max > code_max` | `error` | 2 | inconsistent state; manual inspection required |
23
22
  | latest review-code is Approved with 0/0/0 | `refused` | 1 | already approved; do not run `code-task` again |
24
23
  | latest review-code is Approved with major/minor findings | `fix` | 0 | optional fix mode |
25
24
  | latest review-code is Changes Requested | `fix` | 0 | required fix mode |
26
25
  | latest review-code is Rejected | `refused` | 1 | re-plan instead of local fixing |
27
26
 
27
+ > The four verdict branches above fire when `rev_max >= code_max`, decided by the latest `review-code-r{rev_max}` verdict:
28
+ > - `rev_max == code_max`: AI fix round (`review-code` reviews the same-numbered code artifact produced by `code-task`).
29
+ > - `rev_max > code_max`: human-supplemented review round — after a PR is opened a maintainer appends a `review-code-r{N}` round against the existing latest code. `fix` mode then uses `next_round = code_max + 1`.
30
+ >
31
+ > If the latest `review-code` verdict cannot be parsed, the script still returns `error` (exit 2) as the retained anomaly guard.
32
+
28
33
  ## Verdict Parsing
29
34
 
30
35
  The script supports zh-CN and English review-code reports:
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
11
  脚本扫描任务目录中的 `plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md` 和 `review-code.md` / `review-code-r{N}.md`。
12
12
 
13
- ## 8 个分支
13
+ ## 7 个分支
14
14
 
15
15
  > 分支按表中自上而下的顺序评估,命中即返回;后续分支不再判定。
16
16
 
@@ -19,12 +19,17 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
19
19
  | 无 code 产物 | `init` | 0 | 初次实现,产物为 `code.md` |
20
20
  | 最新 review-plan 已批准(`通过` 或 `通过 + major/minor 建议`,即 `Approved` 或 `Approved-with-issues`),且其「审查输入」/「Review Input」字段引用的 plan 文件 == 任务目录中最新的 `plan(-r{N})?.md`,且最新 review-plan 的 mtime > 最新 code 的 mtime | `init` | 0 | plan 已在 code 之后被批准;进入新一轮实现,`next_round = code_max + 1`、`next_artifact = code-r{next_round}.md`。**不论 review-code 是否已审**,本分支均先命中。plan 与 review-plan 的轮次独立递增(如 `plan-r5` 可被 `review-plan-r4` 批准),通过 review-plan 的「审查输入」字段建立批准关系,不要求同号 |
21
21
  | `rev_max < code_max` | `error` | 2 | 最新代码未审查,先运行 `review-code` |
22
- | `rev_max > code_max` | `error` | 2 | 数据状态异常,需要人工检查 |
23
22
  | 最新 review-code 为 Approved 且 0/0/0 | `refused` | 1 | 已通过,无需再次运行 `code-task` |
24
23
  | 最新 review-code 为 Approved 但有 major/minor | `fix` | 0 | 可选修复模式 |
25
24
  | 最新 review-code 为 Changes Requested | `fix` | 0 | 必需修复模式 |
26
25
  | 最新 review-code 为 Rejected | `refused` | 1 | 需要重新设计,不进入局部修复 |
27
26
 
27
+ > 上表 4 个 verdict 分支在 `rev_max >= code_max` 时命中,均以最新 `review-code-r{rev_max}` 的结论决定:
28
+ > - `rev_max == code_max`:AI 修复轮(`code-task` 产出代码后由 `review-code` 审查同号产物)。
29
+ > - `rev_max > code_max`:人工补审轮——PR 创建后维护者追加一轮 `review-code-r{N}` 审查既有最新代码。此时 `fix` 模式的 `next_round = code_max + 1`。
30
+ >
31
+ > 若最新 `review-code` 的 verdict 无法解析,仍返回 `error`(exit 2),作为保留的异常拦截。
32
+
28
33
  ## verdict 解析
29
34
 
30
35
  脚本支持中文和英文 review-code 报告:
@@ -84,20 +84,12 @@ function main() {
84
84
  return;
85
85
  }
86
86
 
87
- if (revMax > codeMax) {
88
- writeResult({
89
- mode: "error",
90
- code_max: codeMax,
91
- rev_max: revMax,
92
- verdict: null,
93
- next_round: null,
94
- next_artifact: null,
95
- review_artifact: artifactName("review-code", revMax),
96
- message: `Inconsistent state: review-code round ${revMax} > code round ${codeMax}. Manual inspection required.`
97
- }, 2);
98
- return;
99
- }
100
-
87
+ // human-supplemented review: after a PR is opened, a maintainer may append a
88
+ // review-code-r{N} round against the existing latest code, so rev_max > code_max.
89
+ // This is NOT corruption — defer to the latest review's verdict instead of erroring.
90
+ // rev_max === code_max (AI fix round) and rev_max > code_max (human review round)
91
+ // both fall through to the verdict dispatch below; fix mode uses next_round = code_max + 1.
92
+ // An unparsable verdict still returns error (exit 2) as the retained anomaly guard.
101
93
  const reviewArtifact = artifactName("review-code", revMax);
102
94
  const verdictResult = parseVerdict(path.join(resolvedTaskDir, reviewArtifact));
103
95
  if (!verdictResult.ok) {
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "Commit the current changes to Git"
3
+ description: >
4
+ Commit the current changes to Git.
5
+ Use when finished work needs to be turned into a Git commit.
4
6
  ---
5
7
 
6
8
  # Commit Changes
@@ -64,7 +66,27 @@ If this commit is associated with a task and a `review-code` artifact exists, re
64
66
  - After committing, write `last_reviewed_commit: <new_head>` to task.md frontmatter only when `pre_head == R` and `S == F`; otherwise do not advance that field
65
67
  - Do not scan backward to earlier Approved artifacts; the highest-round `review-code` artifact is the only authoritative source
66
68
 
67
- ## 5. Update Task Status When Applicable
69
+ ## 5. Push to the Existing PR When Applicable
70
+
71
+ After the commit is created, if the current branch already has an open Pull Request, push the new commit so the PR updates automatically. Otherwise keep the current behavior (the first push is still handled by `create-pr`). This is the push wrap-up of a user-initiated `commit`: it adds no extra commit and never pushes when there is no PR; it applies whether or not a task is associated.
72
+
73
+ > Detect whether the current branch has an open PR — and authenticate to the platform — per `.agents/rules/issue-pr-commands.md`; if that rule is unavailable or detection fails, follow the degradation below.
74
+
75
+ a. Detect whether the current branch (head) has an open PR per `.agents/rules/issue-pr-commands.md`.
76
+
77
+ b. On an open PR -> push the current branch:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. Safe degradation (never block an already completed `git commit`; only warn the user):
84
+ - Platform unavailable / unauthenticated / detection failed / no open PR -> do not push; continue.
85
+ - `git push` fails (needs `git pull --rebase`, no upstream, network error) -> keep the local commit and tell the user to push manually.
86
+
87
+ Fold the push outcome (pushed / skipped(no PR) / failed) into the next step's "Update Task Status" Activity Log note or user output.
88
+
89
+ ## 6. Update Task Status When Applicable
68
90
 
69
91
  Get the current time:
70
92
 
@@ -81,7 +103,7 @@ Append the Commit Activity Log entry and choose exactly one next-step case:
81
103
  - more work remains -> update task.md and stop
82
104
  - ready for review -> `review-code {task-id}`
83
105
 
84
- ## 6. Sync Issue Metadata When Applicable
106
+ ## 7. Sync Issue Metadata When Applicable
85
107
 
86
108
  When `{task-id}` exists and task.md contains a valid `issue_number`, sync the linked Issue `in:` labels and requirement checkboxes. Otherwise, skip this step.
87
109
 
@@ -91,7 +113,7 @@ When `{task-id}` exists and task.md contains a valid `issue_number`, sync the li
91
113
 
92
114
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
93
115
 
94
- ## 7. Sync PR Summary When Applicable
116
+ ## 8. Sync PR Summary When Applicable
95
117
 
96
118
  When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR summary comment marked with the PR summary marker defined in `.agents/rules/pr-sync.md` on the PR. Otherwise, skip this step.
97
119
 
@@ -101,7 +123,7 @@ When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR
101
123
 
102
124
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
103
125
 
104
- ## 8. Verification Gate
126
+ ## 9. Verification Gate
105
127
 
106
128
  If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
107
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "提交当前变更到 Git"
3
+ description: >
4
+ 提交当前变更到 Git。
5
+ 当需要把已完成的工作落为一次 Git 提交时使用。
4
6
  ---
5
7
 
6
8
  # 提交代码
@@ -64,7 +66,27 @@ git diff
64
66
  - 提交后仅当 `pre_head == R` 且 `S == F` 时,在 task.md frontmatter 写入 `last_reviewed_commit: <new_head>`;否则不推进该字段
65
67
  - 不向后扫描更早的 Approved 产物;最高轮 `review-code` 产物是唯一权威来源
66
68
 
67
- ## 5. 按需更新任务状态
69
+ ## 5. 推送到已有 PR(按需)
70
+
71
+ 提交完成后,如果当前分支已存在开放的 Pull Request,则把本次提交推送上去让 PR 自动更新;否则保持现状(首次推送仍由 `create-pr` 负责)。本步骤是用户已发起 `commit` 的推送收尾,不新增自动提交,也不在无 PR 时推送;与是否关联任务无关。
72
+
73
+ > 检测当前分支是否有开放 PR、以及平台认证,统一按 `.agents/rules/issue-pr-commands.md` 执行;该规则不可用或检测失败时,按下方降级处理。
74
+
75
+ a. 按 `.agents/rules/issue-pr-commands.md` 检测当前分支(head)是否存在开放 PR。
76
+
77
+ b. 命中开放 PR -> 推送当前分支:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. 安全降级(不阻塞已完成的 `git commit`,仅提示用户):
84
+ - 平台不可用 / 未认证 / 检测失败 / 未命中开放 PR -> 不推送,继续后续步骤。
85
+ - `git push` 失败(如需 `git pull --rebase`、无 upstream、网络异常)-> 保留本地提交,提示用户手动推送。
86
+
87
+ 把推送结果(pushed / skipped(no PR) / failed)并入下一步「更新任务状态」的 Activity Log 说明或用户输出。
88
+
89
+ ## 6. 按需更新任务状态
68
90
 
69
91
  获取当前时间:
70
92
 
@@ -81,7 +103,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
81
103
  - 还有后续工作 -> 更新 task.md 后停止
82
104
  - 准备审查 -> `review-code {task-id}`
83
105
 
84
- ## 6. 同步 Issue 元数据(按需)
106
+ ## 7. 同步 Issue 元数据(按需)
85
107
 
86
108
  当 `{task-id}` 存在且 task.md 包含有效 `issue_number` 时,同步 `in:` label 和需求复选框到关联 Issue;否则跳过。
87
109
 
@@ -91,7 +113,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
91
113
 
92
114
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
93
115
 
94
- ## 7. 同步 PR 摘要(按需)
116
+ ## 8. 同步 PR 摘要(按需)
95
117
 
96
118
  当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上由 `.agents/rules/pr-sync.md` 中定义的 PR 摘要评论标记对应的摘要评论;否则跳过。
97
119
 
@@ -101,7 +123,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
101
123
 
102
124
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
103
125
 
104
- ## 8. 完成校验
126
+ ## 9. 完成校验
105
127
 
106
128
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
107
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: complete-task
3
- description: "Mark a task as completed and archive it"
3
+ description: >
4
+ Mark a task as completed and archive it.
5
+ Use when a task's work is done and verified and you want to close and archive it.
4
6
  ---
5
7
 
6
8
  # Complete Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: complete-task
3
- description: "标记任务完成并归档"
3
+ description: >
4
+ 标记任务完成并归档。
5
+ 当任务工作已完成并验证、需要收尾归档时使用。
4
6
  ---
5
7
 
6
8
  # 完成任务
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-pr
3
- description: "Create a Pull Request to a target branch"
3
+ description: >
4
+ Create a Pull Request to a target branch.
5
+ Use when changes are committed and you need to open a Pull Request for review.
4
6
  ---
5
7
 
6
8
  # Create Pull Request
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-pr
3
- description: "创建 Pull Request 到目标分支"
3
+ description: >
4
+ 创建 Pull Request 到目标分支。
5
+ 当变更已提交、需要发起 Pull Request 评审时使用。
4
6
  ---
5
7
 
6
8
  # 创建 Pull Request
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-release-note
3
- description: "Generate release notes from PRs and commits"
3
+ description: >
4
+ Generate release notes from PRs and commits.
5
+ Use when preparing a release and you need notes compiled from PRs and commits.
4
6
  ---
5
7
 
6
8
  # Create Release Notes
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-release-note
3
- description: "从 PR 和 commit 生成版本发布说明"
3
+ description: >
4
+ 从 PR 和 commit 生成版本发布说明。
5
+ 当准备发版、需要从 PR 与 commit 汇总发布说明时使用。
4
6
  ---
5
7
 
6
8
  # 创建发布说明
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-task
3
- description: "Create a task from a natural-language description"
3
+ description: >
4
+ Create a task from a natural-language description.
5
+ Use when you want to turn a free-form idea or request into a tracked task.
4
6
  ---
5
7
 
6
8
  # Create Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-task
3
- description: "根据自然语言描述创建任务"
3
+ description: >
4
+ 根据自然语言描述创建任务。
5
+ 当想把一段自然语言的想法或需求落为受跟踪的任务时使用。
4
6
  ---
5
7
 
6
8
  # 创建任务
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-codescan
3
- description: "Import a Code Scanning alert and create a remediation task"
3
+ description: >
4
+ Import a Code Scanning alert and create a remediation task.
5
+ Use when a Code Scanning alert needs to become a tracked remediation task.
4
6
  ---
5
7
 
6
8
  # Import Code Scanning Alert
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-codescan
3
- description: "导入 Code Scanning 告警并创建修复任务"
3
+ description: >
4
+ 导入 Code Scanning 告警并创建修复任务。
5
+ 当某条 Code Scanning 告警需要转为受跟踪的修复任务时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Code Scanning 告警
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-dependabot
3
- description: "Import a Dependabot alert and create a remediation task"
3
+ description: >
4
+ Import a Dependabot alert and create a remediation task.
5
+ Use when a Dependabot alert needs to become a tracked remediation task.
4
6
  ---
5
7
 
6
8
  # Import Dependabot Security Alert
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-dependabot
3
- description: "导入 Dependabot 安全告警并创建修复任务"
3
+ description: >
4
+ 导入 Dependabot 安全告警并创建修复任务。
5
+ 当某条 Dependabot 安全告警需要转为受跟踪的修复任务时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Dependabot 安全告警
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "Import an Issue and create a task"
3
+ description: >
4
+ Import an Issue and create a task.
5
+ Use when you want to start work from an existing Issue and track it locally.
4
6
  ---
5
7
 
6
8
  # Import Issue
@@ -40,7 +42,22 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
40
42
  Read `.agents/rules/issue-pr-commands.md` first, follow its prerequisite steps to complete authentication and code-hosting platform detection, then load the Issue data with its "Read an Issue" command.
41
43
 
42
44
  Extract: issue number, title, description, and labels.
43
- Use the Issue title as-is for the task title (preserve the Issue's original language).
45
+
46
+ Derive the task title from the Issue title by stripping an optional single leading Conventional Commits prefix, following the contract below; preserve the rest of the description verbatim and in its original language. This fenced contract is the authoritative, language-neutral rule — keep it byte-for-byte identical across every `import-issue` variant:
47
+
48
+ ```
49
+ # title-derivation-contract
50
+ strip-prefix: type(scope):
51
+ prefix-types: feat fix docs style refactor perf test build ci chore revert
52
+ single-layer-only: true
53
+ preserve-body-colon: true
54
+ keep-when-no-prefix: true
55
+ example-strip: "feat(meta): create-pr summary" => "create-pr summary"
56
+ example-keep: "修复某问题" => "修复某问题"
57
+ example-single-layer: "feat: add A: B" => "add A: B"
58
+ ```
59
+
60
+ Strip only the first layer, and only when the leading token is a `prefix-types` value optionally followed by `(scope)` and a `!`, then `:` and at least one space; a colon inside the description is never a prefix.
44
61
 
45
62
  ### 2. Check for an Existing Task
46
63
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "从 Issue 导入并创建任务"
3
+ description: >
4
+ 从 Issue 导入并创建任务。
5
+ 当想从既有 Issue 开工并在本地跟踪时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Issue
@@ -40,7 +42,22 @@ description: "从 Issue 导入并创建任务"
40
42
  执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测;随后按其中的 “读取 Issue” 命令获取 Issue 信息。
41
43
 
42
44
  提取:issue 编号、标题、描述、标签。
43
- 任务标题直接使用 Issue 的原始标题(保持 Issue 标题的原始语言)。
45
+
46
+ 从 Issue 标题派生任务标题:按下方契约剥掉可选的单层前导 Conventional Commits 前缀,其余描述原文与原始语言保持不变。下方 fenced 契约是权威的、与语言无关的规则——在所有 `import-issue` 变体中保持逐字节一致:
47
+
48
+ ```
49
+ # title-derivation-contract
50
+ strip-prefix: type(scope):
51
+ prefix-types: feat fix docs style refactor perf test build ci chore revert
52
+ single-layer-only: true
53
+ preserve-body-colon: true
54
+ keep-when-no-prefix: true
55
+ example-strip: "feat(meta): create-pr summary" => "create-pr summary"
56
+ example-keep: "修复某问题" => "修复某问题"
57
+ example-single-layer: "feat: add A: B" => "add A: B"
58
+ ```
59
+
60
+ 只剥第一层前缀,且仅当前导 token 是 `prefix-types` 之一、其后可带 `(scope)` 与 `!`,再接 `:` 和至少一个空格;描述正文中的冒号永远不算前缀。
44
61
 
45
62
  ### 2. 检查已有任务
46
63
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "Initialize the repository's standard labels taxonomy"
3
+ description: >
4
+ Initialize the repository's standard labels taxonomy.
5
+ Use when setting up a repository and you need the standard label taxonomy created.
4
6
  ---
5
7
 
6
8
  # Initialize labels
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "初始化仓库的 labels 体系"
3
+ description: >
4
+ 初始化仓库的 labels 体系。
5
+ 当初始化仓库、需要创建标准 label 体系时使用。
4
6
  ---
5
7
 
6
8
  # 初始化 labels
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "Initialize the repository's standard milestones taxonomy"
3
+ description: >
4
+ Initialize the repository's standard milestones taxonomy.
5
+ Use when setting up a repository and you need the standard milestone taxonomy created.
4
6
  ---
5
7
 
6
8
  # Initialize milestones
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "初始化仓库的 milestones 体系"
3
+ description: >
4
+ 初始化仓库的 milestones 体系。
5
+ 当初始化仓库、需要创建标准 milestone 体系时使用。
4
6
  ---
5
7
 
6
8
  # 初始化 milestones
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: plan-task
3
- description: "Design a technical plan for a task"
3
+ description: >
4
+ Design a technical plan for a task.
5
+ Use when a requirement is understood and you need a technical design before coding.
4
6
  ---
5
7
 
6
8
  # Design Technical Plan
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: plan-task
3
- description: "为任务设计技术方案和实施计划"
3
+ description: >
4
+ 为任务设计技术方案和实施计划。
5
+ 当需求已明确、需要在编码前形成技术方案时使用。
4
6
  ---
5
7
 
6
8
  # 设计技术方案
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: post-release
3
- description: "Run post-release follow-up tasks"
3
+ description: >
4
+ Run post-release follow-up tasks.
5
+ Use when a release has shipped and follow-up housekeeping is needed.
4
6
  ---
5
7
 
6
8
  # Post-release Tasks
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: post-release
3
- description: "执行版本发布后的后处理工作"
3
+ description: >
4
+ 执行版本发布后的后处理工作。
5
+ 当版本已发布、需要执行发版后的收尾工作时使用。
4
6
  ---
5
7
 
6
8
  # 发布后处理
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: refine-title
3
- description: "Rewrite an Issue or PR title in Conventional Commits format"
3
+ description: >
4
+ Rewrite an Issue or PR title in Conventional Commits format.
5
+ Use when an Issue or PR title needs rewriting into Conventional Commits format.
4
6
  ---
5
7
 
6
8
  # Refine Title
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: refine-title
3
- description: "重构 Issue/PR 标题为 Conventional Commits 格式"
3
+ description: >
4
+ 重构 Issue/PR 标题为 Conventional Commits 格式。
5
+ 当某个 Issue/PR 标题需要改写为 Conventional Commits 格式时使用。
4
6
  ---
5
7
 
6
8
  # 重构标题
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: release
3
- description: "Run the version release workflow"
3
+ description: >
4
+ Run the version release workflow.
5
+ Use when you are ready to cut and publish a new version.
4
6
  ---
5
7
 
6
8
  # Version Release
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: release
3
- description: "执行版本发布流程"
3
+ description: >
4
+ 执行版本发布流程。
5
+ 当准备切出并发布新版本时使用。
4
6
  ---
5
7
 
6
8
  # 版本发布
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: restore-task
3
- description: "Restore local task files from platform Issue comments"
3
+ description: >
4
+ Restore local task files from platform Issue comments.
5
+ Use when local task files are missing and need rebuilding from platform Issue comments.
4
6
  ---
5
7
 
6
8
  # Restore Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: restore-task
3
- description: "从平台 Issue 评论还原本地任务文件"
3
+ description: >
4
+ 从平台 Issue 评论还原本地任务文件。
5
+ 当本地任务文件缺失、需要从平台 Issue 评论还原时使用。
4
6
  ---
5
7
 
6
8
  # 还原任务
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: review-analysis
3
- description: "Review the requirement analysis artifact"
3
+ description: >
4
+ Review the requirement analysis artifact.
5
+ Use when a requirements analysis needs an independent review before planning.
4
6
  ---
5
7
 
6
8
  # Requirement Analysis Review
@@ -52,7 +54,7 @@ Record `{analysis-artifact}`, `{review-round}`, and `{review-artifact}` (`review
52
54
 
53
55
  ### 3. Read Analysis Context
54
56
 
55
- Read `{analysis-artifact}`, `task.md`, and Issue context when available.
57
+ Read `{analysis-artifact}`, `task.md`, and Issue context when available. After reading, record the actually reviewed highest-round analysis artifact by filename in the report's `Review Input` field; leave it blank when it cannot be reliably determined—do not fabricate.
56
58
 
57
59
  ### 4. Perform Review
58
60
 
@@ -77,6 +79,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
77
79
  Set `current_step` to `requirement-analysis-review`, refresh task metadata, and append:
78
80
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Analysis (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
79
81
 
82
+ `env-blocked` is the data source for the `Manual-verify` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
83
+
80
84
  If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, sync the task comment, and publish the `{review-artifact}` comment.
81
85
 
82
86
  ### 7. Run Completion Gate