@fitlab-ai/agent-infra 0.5.7 → 0.5.9

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 (132) hide show
  1. package/README.md +44 -4
  2. package/README.zh-CN.md +44 -4
  3. package/lib/defaults.json +4 -2
  4. package/lib/init.js +18 -1
  5. package/lib/sandbox/commands/vm.js +7 -1
  6. package/lib/sandbox/constants.js +3 -0
  7. package/lib/sandbox/engine.js +57 -3
  8. package/lib/sandbox/runtimes/base.dockerfile +9 -2
  9. package/lib/sandbox/shell.js +36 -2
  10. package/lib/update.js +14 -3
  11. package/package.json +6 -4
  12. package/templates/.agents/QUICKSTART.en.md +2 -2
  13. package/templates/.agents/QUICKSTART.zh-CN.md +2 -2
  14. package/templates/.agents/README.en.md +1 -1
  15. package/templates/.agents/README.zh-CN.md +1 -1
  16. package/templates/.agents/rules/create-issue.en.md +5 -0
  17. package/templates/.agents/rules/create-issue.github.en.md +178 -0
  18. package/templates/.agents/rules/create-issue.github.zh-CN.md +178 -0
  19. package/templates/.agents/rules/create-issue.zh-CN.md +5 -0
  20. package/templates/.agents/rules/issue-pr-commands.github.en.md +60 -0
  21. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +60 -0
  22. package/templates/.agents/rules/issue-sync.en.md +14 -0
  23. package/templates/.agents/rules/issue-sync.github.en.md +15 -1
  24. package/templates/.agents/rules/issue-sync.github.zh-CN.md +15 -1
  25. package/templates/.agents/rules/issue-sync.zh-CN.md +14 -0
  26. package/templates/.agents/rules/label-milestone-setup.github.en.md +10 -0
  27. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +10 -0
  28. package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
  29. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
  30. package/templates/.agents/rules/release-commands.github.en.md +16 -0
  31. package/templates/.agents/rules/release-commands.github.zh-CN.md +16 -0
  32. package/templates/.agents/scripts/platform-adapters/find-existing-task.github.js +272 -0
  33. package/templates/.agents/scripts/platform-adapters/find-existing-task.js +5 -0
  34. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +134 -9
  35. package/templates/.agents/scripts/platform-adapters/platform-sync.js +7 -0
  36. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  37. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  38. package/templates/.agents/skills/analyze-task/config/verify.json +3 -1
  39. package/templates/.agents/skills/block-task/config/verify.json +2 -1
  40. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  41. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  42. package/templates/.agents/skills/cancel-task/config/verify.json +2 -1
  43. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  44. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  45. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  46. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  47. package/templates/.agents/skills/commit/config/verify.json +2 -1
  48. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  49. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  50. package/templates/.agents/skills/complete-task/config/verify.json +2 -1
  51. package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
  52. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
  53. package/templates/.agents/skills/create-pr/config/verify.json +2 -1
  54. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +7 -17
  55. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +27 -37
  56. package/templates/.agents/skills/create-release-note/SKILL.en.md +9 -9
  57. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +9 -9
  58. package/templates/.agents/skills/create-task/SKILL.en.md +70 -12
  59. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +71 -13
  60. package/templates/.agents/skills/create-task/config/verify.json +6 -1
  61. package/templates/.agents/skills/implement-task/SKILL.en.md +1 -1
  62. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +1 -1
  63. package/templates/.agents/skills/implement-task/config/verify.json +3 -1
  64. package/templates/.agents/skills/implement-task/reference/implementation-rules.en.md +7 -12
  65. package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +7 -12
  66. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  67. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  68. package/templates/.agents/skills/import-issue/SKILL.en.md +40 -10
  69. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +40 -10
  70. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -9
  71. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -9
  72. package/templates/.agents/skills/init-milestones/SKILL.en.md +7 -7
  73. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +7 -7
  74. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  75. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -1
  76. package/templates/.agents/skills/plan-task/config/verify.json +3 -1
  77. package/templates/.agents/skills/refine-task/SKILL.en.md +1 -1
  78. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +1 -1
  79. package/templates/.agents/skills/refine-task/config/verify.json +3 -1
  80. package/templates/.agents/skills/refine-task/reference/fix-workflow.en.md +2 -2
  81. package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +2 -2
  82. package/templates/.agents/skills/restore-task/SKILL.en.md +13 -64
  83. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +13 -64
  84. package/templates/.agents/skills/review-task/SKILL.en.md +1 -1
  85. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +1 -1
  86. package/templates/.agents/skills/review-task/config/verify.json +3 -1
  87. package/templates/.agents/skills/test/SKILL.en.md +45 -6
  88. package/templates/.agents/skills/test/SKILL.zh-CN.md +45 -6
  89. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -0
  90. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -0
  91. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +56 -5
  92. package/templates/.claude/commands/import-issue.en.md +1 -1
  93. package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
  94. package/templates/.claude/commands/init-labels.en.md +1 -1
  95. package/templates/.claude/commands/init-labels.zh-CN.md +1 -1
  96. package/templates/.claude/commands/init-milestones.en.md +1 -1
  97. package/templates/.claude/commands/init-milestones.zh-CN.md +1 -1
  98. package/templates/.claude/commands/restore-task.en.md +1 -1
  99. package/templates/.claude/commands/restore-task.zh-CN.md +1 -1
  100. package/templates/.claude/hooks/check-version-format.sh +1 -1
  101. package/templates/.gemini/commands/_project_/import-issue.en.toml +1 -1
  102. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
  103. package/templates/.gemini/commands/_project_/init-labels.en.toml +2 -2
  104. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +2 -2
  105. package/templates/.gemini/commands/_project_/init-milestones.en.toml +2 -2
  106. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +2 -2
  107. package/templates/.gemini/commands/_project_/restore-task.en.toml +1 -1
  108. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +1 -1
  109. package/templates/{.github/hooks → .git-hooks}/check-version-format.sh +2 -2
  110. package/templates/.github/workflows/pr-label.yml +1 -1
  111. package/templates/.opencode/commands/import-issue.en.md +1 -1
  112. package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
  113. package/templates/.opencode/commands/init-labels.en.md +1 -1
  114. package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
  115. package/templates/.opencode/commands/init-milestones.en.md +1 -1
  116. package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
  117. package/templates/.opencode/commands/restore-task.en.md +1 -1
  118. package/templates/.opencode/commands/restore-task.zh-CN.md +1 -1
  119. package/templates/.agents/skills/create-issue/SKILL.en.md +0 -118
  120. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +0 -118
  121. package/templates/.agents/skills/create-issue/config/verify.json +0 -29
  122. package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +0 -71
  123. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +0 -71
  124. package/templates/.agents/skills/create-issue/reference/template-matching.en.md +0 -45
  125. package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +0 -45
  126. package/templates/.claude/commands/create-issue.en.md +0 -8
  127. package/templates/.claude/commands/create-issue.zh-CN.md +0 -8
  128. package/templates/.gemini/commands/_project_/create-issue.en.toml +0 -8
  129. package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +0 -8
  130. package/templates/.opencode/commands/create-issue.en.md +0 -11
  131. package/templates/.opencode/commands/create-issue.zh-CN.md +0 -11
  132. /package/templates/{.github/hooks → .git-hooks}/pre-commit +0 -0
@@ -61,7 +61,7 @@ Confirm? (y/N)
61
61
 
62
62
  Dismiss the alert by following the Code Scanning dismiss command in `.agents/rules/security-alerts.md`, passing the mapped `{api-reason}` and the user's explanation.
63
63
 
64
- **API reason mapping** (per the GitHub Code Scanning API):
64
+ **API reason mapping** (per the Code Scanning API):
65
65
  - False Positive -> `false positive`
66
66
  - Won't Fix -> `won't fix`
67
67
  - Used in Tests -> `used in tests`
@@ -96,7 +96,7 @@ Explanation: {explanation}
96
96
 
97
97
  View: {html_url}
98
98
 
99
- Note: it can be reopened on GitHub if necessary.
99
+ Note: it can be reopened on the platform if necessary.
100
100
 
101
101
  Next step - complete and archive the task if a related task exists:
102
102
  - Claude Code / OpenCode: /complete-task {task-id}
@@ -61,7 +61,7 @@ Code Scanning 告警 #{alert-number}
61
61
 
62
62
  按 `.agents/rules/security-alerts.md` 中的 Code Scanning 告警关闭命令执行关闭操作,并传入映射后的 `{api-reason}` 与用户说明。
63
63
 
64
- **API reason 映射**(按 GitHub Code Scanning API):
64
+ **API reason 映射**(按 Code Scanning API):
65
65
  - 误报 -> `false positive`
66
66
  - 不会修复 -> `won't fix`
67
67
  - 测试代码 -> `used in tests`
@@ -96,7 +96,7 @@ Code Scanning 告警 #{alert-number} 已关闭。
96
96
 
97
97
  查看:{html_url}
98
98
 
99
- 注意:如有需要,可在 GitHub 上重新打开。
99
+ 注意:如有需要,可在 平台上重新打开。
100
100
 
101
101
  下一步 - 完成并归档任务(如有关联任务):
102
102
  - Claude Code / OpenCode:/complete-task {task-id}
@@ -64,7 +64,7 @@ Failure handling matches "Update Task Status When Applicable": warn, but do **no
64
64
 
65
65
  ## 7. Sync PR Summary When Applicable
66
66
 
67
- When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR summary comment `<!-- sync-pr:{task-id}:summary -->` on the PR. Otherwise, skip this step.
67
+ 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.
68
68
 
69
69
  > The full trigger conditions, aggregation rules, PATCH/POST flow, shell-safety constraints, and error handling live in `reference/pr-summary-sync.md` (which in turn points to `.agents/rules/pr-sync.md`). Read `reference/pr-summary-sync.md` before executing this step.
70
70
  >
@@ -64,7 +64,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
64
64
 
65
65
  ## 7. 同步 PR 摘要(按需)
66
66
 
67
- 当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上的 `<!-- sync-pr:{task-id}:summary -->` 摘要评论;否则跳过。
67
+ 当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上由 `.agents/rules/pr-sync.md` 中定义的 PR 摘要评论标记对应的摘要评论;否则跳过。
68
68
 
69
69
  > 完整的触发条件、聚合规则、PATCH/POST 流程、Shell 安全约束和错误处理见 `reference/pr-summary-sync.md`(其内联引用 `.agents/rules/pr-sync.md`)。执行此步骤前先读取 `reference/pr-summary-sync.md`。
70
70
  >
@@ -21,7 +21,8 @@
21
21
  "when": "pr_number_exists",
22
22
  "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
23
  "verify_in_labels_computed": true,
24
- "verify_pr_comment_last_commit_matches_head": true
24
+ "verify_pr_comment_last_commit_matches_head": true,
25
+ "expected_pr_comment_marker_key": "prSummary"
25
26
  }
26
27
  }
27
28
  }
@@ -93,7 +93,7 @@ If a valid `issue_number` exists:
93
93
  - First scan and backfill unpublished `task.md`, `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` comments using the backfill rules in `.agents/rules/issue-sync.md` (`task.md` uses the idempotent update path)
94
94
  - Backfill checked `## Requirements` items to the Issue body by following the requirements-checkbox sync steps in issue-sync.md
95
95
  - Do not set any `status:` label — status labels are automatically cleared when the Issue is closed
96
- - Finally create or update the summary comment marked with `<!-- sync-issue:{task-id}:summary -->`
96
+ - Finally create or update the summary comment marked with the summary marker defined in `.agents/rules/issue-sync.md`
97
97
 
98
98
  ### 7. Verification Gate
99
99
 
@@ -93,7 +93,7 @@ ls .agents/workspace/completed/{task-id}/task.md
93
93
  - 先按 `.agents/rules/issue-sync.md` 的补发规则扫描并补发未发布的 `task.md`、`analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md` 评论(`task.md` 走幂等更新路径)
94
94
  - 按 issue-sync.md 的需求复选框同步步骤,兜底同步 `## 需求` 中已勾选的条目到 Issue body
95
95
  - 不要设置 `status:` label — Issue 关闭后 status label 会被自动清除
96
- - 最后创建或更新 `<!-- sync-issue:{task-id}:summary -->` 标记的 summary 评论
96
+ - 最后创建或更新 `.agents/rules/issue-sync.md` 中定义的 summary 评论标记对应的 summary 评论
97
97
 
98
98
  ### 7. 完成校验
99
99
 
@@ -29,7 +29,8 @@
29
29
  "verify_task_comment_content": true,
30
30
  "sync_checked_requirements": true,
31
31
  "verify_issue_type": true,
32
- "verify_milestone": true
32
+ "verify_milestone": true,
33
+ "expected_comment_marker_key": "summary"
33
34
  }
34
35
  }
35
36
  }
@@ -26,7 +26,7 @@ Use the explicit argument when provided. Otherwise infer the target branch from
26
26
 
27
27
  ### 3. Prepare the PR Body
28
28
 
29
- Read `.github/PULL_REQUEST_TEMPLATE.md` when it exists, review recent merged PRs for style, and gather all commits between `<target-branch>` and `HEAD`.
29
+ Read the PR template through `.agents/rules/issue-pr-commands.md`, review recent merged PRs for style, and gather all commits between `<target-branch>` and `HEAD`.
30
30
 
31
31
  > Template handling, HEREDOC body generation, and `Generated with AI assistance` requirements live in `reference/pr-body-template.md`. Read `reference/pr-body-template.md` before writing the PR body.
32
32
 
@@ -101,7 +101,7 @@ Explain the created PR URL, summarize metadata sync and summary-comment results,
101
101
 
102
102
  - Review every commit in the branch, not only the latest one
103
103
  - `create-pr` must not defer type-label mapping to another skill; inline the mapping here when `{task-id}` is available
104
- - Keep the hidden summary marker as `<!-- sync-pr:{task-id}:summary -->` for compatibility with existing PR comments
104
+ - Keep the hidden summary marker as the PR summary marker defined in `.agents/rules/pr-sync.md` for compatibility with existing PR comments
105
105
  - If the current branch already has a PR, show its URL and stop without repeating sync work
106
106
  - When metadata inheritance from the Issue fails, continue with task.md and branch-based fallbacks
107
107
 
@@ -26,7 +26,7 @@ description: "创建 Pull Request 到目标分支"
26
26
 
27
27
  ### 3. 准备 PR 正文
28
28
 
29
- 读取 `.github/PULL_REQUEST_TEMPLATE.md`(如存在),参考最近合并的 PR 风格,并收集 `<target-branch>` 到 `HEAD` 的全部提交。
29
+ 通过 `.agents/rules/issue-pr-commands.md` 读取 PR 模板,参考最近合并的 PR 风格,并收集 `<target-branch>` 到 `HEAD` 的全部提交。
30
30
 
31
31
  > 模板处理、HEREDOC 正文生成和 `Generated with AI assistance` 要求见 `reference/pr-body-template.md`。编写正文前先读取 `reference/pr-body-template.md`。
32
32
 
@@ -101,7 +101,7 @@ node .agents/scripts/validate-artifact.js gate create-pr .agents/workspace/activ
101
101
 
102
102
  - 必须检查分支中的全部提交,而不是只看最后一个
103
103
  - `create-pr` 不能把 type label 映射委托给其他技能,必须在获取到 `{task-id}` 时于本技能内内联处理
104
- - 隐藏 summary 标记必须保持 `<!-- sync-pr:{task-id}:summary -->` 以兼容已有 PR 评论
104
+ - 隐藏 summary 标记必须保持为 `.agents/rules/pr-sync.md` 中定义的 PR 摘要评论标记,以兼容已有 PR 评论
105
105
  - 如果当前分支已存在 PR,直接告知用户 PR URL 并结束,不做重复同步
106
106
  - 如果从 Issue 继承元数据失败,继续使用 task.md 和分支推断兜底
107
107
 
@@ -23,7 +23,8 @@
23
23
  "verify_in_labels_match_pr": true,
24
24
  "verify_pr_type_label": true,
25
25
  "verify_pr_assignee": true,
26
- "verify_milestone": true
26
+ "verify_milestone": true,
27
+ "expected_pr_comment_marker_key": "prSummary"
27
28
  }
28
29
  }
29
30
  }
@@ -4,15 +4,11 @@ Read this file before generating the PR title and body.
4
4
 
5
5
  ## Read the PR Template
6
6
 
7
- Read `.github/PULL_REQUEST_TEMPLATE.md` from the repository. If it does not exist, use the standard format.
7
+ PR template discovery is platform-specific. Read `.agents/rules/issue-pr-commands.md` and follow the PR template section provided by the configured platform. If no template is available, use the standard format.
8
8
 
9
9
  ## Review Recent Merged PRs for Reference
10
10
 
11
- ```bash
12
- gh pr list --limit 3 --state merged --json number,title,body
13
- ```
14
-
15
- Use the recent merged PRs as style and formatting references.
11
+ Use the recent merged PR query from `.agents/rules/issue-pr-commands.md` as style and formatting reference input.
16
12
 
17
13
  ## Analyze Current Branch Changes
18
14
 
@@ -27,19 +23,13 @@ git diff <target-branch>...HEAD
27
23
 
28
24
  Read `.agents/rules/issue-pr-commands.md` before this step.
29
25
 
30
- Before syncing linked Issue metadata, complete authentication and code-hosting platform detection through that rule. Keep `gh pr list` / `gh pr create` on the current repository.
31
-
32
- Before syncing labels, verify the standard label system:
33
-
34
- ```bash
35
- gh label list --search "type:" --limit 1 --json name --jq 'length'
36
- ```
26
+ Before syncing linked Issue metadata, complete authentication and code-hosting platform detection through that rule.
37
27
 
38
- If the result is `0`, run `init-labels` before retrying metadata sync.
28
+ Before syncing labels, verify the standard label system by following the label-list command in `.agents/rules/issue-pr-commands.md`. If the result shows no standard type labels, run `init-labels` before retrying metadata sync.
39
29
 
40
30
  Type label mapping:
41
31
 
42
- | task.md type | GitHub label |
32
+ | task.md type | label |
43
33
  |---|---|
44
34
  | `bug`, `bugfix` | `type: bug` |
45
35
  | `feature` | `type: feature` |
@@ -54,7 +44,7 @@ Metadata sync order:
54
44
  1. query Issue labels and milestone via the Issue read command in `.agents/rules/issue-pr-commands.md`
55
45
  2. build `{label-args}` from the mapped type label, non-`type:` / non-`status:` Issue labels, and the current Issue `in:` labels (commit already computed them, so do not recompute them here and do not write back to the Issue)
56
46
  3. build `{milestone-arg}` by following "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md` and reusing the Issue milestone directly
57
- 4. pass `{label-args}` and `{milestone-arg}` atomically to `gh pr create` by using the create-PR command template and permission-degradation rules in `.agents/rules/issue-pr-commands.md`
47
+ 4. pass `{label-args}` and `{milestone-arg}` atomically by using the create-PR command template and permission-degradation rules in `.agents/rules/issue-pr-commands.md`
58
48
  5. ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword
59
49
 
60
50
  If those rules say to skip the direct metadata arguments above, keep only the PR body linkage plus later comment sync.
@@ -72,7 +62,7 @@ Milestone rule:
72
62
  - Replace `{$IssueNumber}` in the template when present
73
63
  - End the PR body with `Generated with AI assistance`
74
64
 
75
- Create the PR with the "Create a PR" command template in `.agents/rules/issue-pr-commands.md`.
65
+ Create the PR with the create-PR command template in `.agents/rules/issue-pr-commands.md`.
76
66
 
77
67
  Final user output should include this follow-up path:
78
68
 
@@ -1,20 +1,16 @@
1
1
  # PR 正文模板规则
2
2
 
3
- 在生成 PR 标题和正文之前先读取本文件。
3
+ 生成 PR 标题和正文前先读取本文件。
4
4
 
5
5
  ## 读取 PR 模板
6
6
 
7
- 读取仓库中的 `.github/PULL_REQUEST_TEMPLATE.md`。如果不存在,则使用标准格式。
7
+ PR 模板发现属于平台相关逻辑。先读取 `.agents/rules/issue-pr-commands.md`,并按当前配置平台提供的 PR 模板章节执行。如果没有可用模板,则使用标准格式。
8
8
 
9
9
  ## 参考最近合并的 PR
10
10
 
11
- ```bash
12
- gh pr list --limit 3 --state merged --json number,title,body
13
- ```
11
+ 使用 `.agents/rules/issue-pr-commands.md` 中的最近合并 PR 查询命令,作为风格和格式参考输入。
14
12
 
15
- 把最近合并的 PR 当作风格和排版参考。
16
-
17
- ## 分析当前分支变更
13
+ ## 分析当前分支改动
18
14
 
19
15
  ```bash
20
16
  git status
@@ -25,21 +21,15 @@ git diff <target-branch>...HEAD
25
21
 
26
22
  ## 同步 PR 元数据
27
23
 
28
- 执行前先读取 `.agents/rules/issue-pr-commands.md`。
29
-
30
- 同步关联 Issue 元数据前,先按该规则完成认证和代码托管平台检测;`gh pr list` / `gh pr create` 仍保持作用于当前仓库。
24
+ 执行本步骤前先读取 `.agents/rules/issue-pr-commands.md`。
31
25
 
32
- 在同步 label 之前,先确认标准 label 体系已经存在:
33
-
34
- ```bash
35
- gh label list --search "type:" --limit 1 --json name --jq 'length'
36
- ```
26
+ 同步关联 Issue 元数据前,先按该规则完成认证和代码托管平台检测。
37
27
 
38
- 如果结果是 `0`,先执行 `init-labels`,再重试元数据同步。
28
+ 同步 label 前,按 `.agents/rules/issue-pr-commands.md` 中的 label 列表命令验证标准 label 体系。如果结果显示没有标准 type label,先运行 `init-labels` 再重试元数据同步。
39
29
 
40
- Type label 映射:
30
+ 类型 label 映射:
41
31
 
42
- | task.md type | GitHub label |
32
+ | task.md type | label |
43
33
  |---|---|
44
34
  | `bug`, `bugfix` | `type: bug` |
45
35
  | `feature` | `type: feature` |
@@ -51,34 +41,34 @@ Type label 映射:
51
41
  | 其他值 | 跳过 |
52
42
 
53
43
  元数据同步顺序:
54
- 1. `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询关联 Issue labels 和 milestone
55
- 2. 构建 `{label-args}`:包含映射后的 type label、非 `type:`/`status:` 的 Issue labels,以及 Issue 当前的 `in:` labelscommit 阶段已完成计算,此处不重新计算也不反向更新 Issue)
56
- 3. 构建 `{milestone-arg}`:按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」直接复用 Issue milestone
57
- 4. 按 `.agents/rules/issue-pr-commands.md` 的创建 PR 命令模板与权限降级规则,将 `{label-args}` 和 `{milestone-arg}` 原子化传入 `gh pr create`
58
- 5. 确保 PR 正文包含 `Closes #{issue-number}` 或等价的 closing keyword
44
+ 1. 通过 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询 Issue labels 和 milestone
45
+ 2. 从映射出的 type label、非 `type:` / 非 `status:` 的 Issue labels,以及当前 Issue `in:` labels 构建 `{label-args}`(commit 已经计算过,不在此重算,也不写回 Issue)
46
+ 3. `.agents/rules/milestone-inference.md` "阶段 3:`create-pr`" 复用 Issue milestone 构建 `{milestone-arg}`
47
+ 4. 按 `.agents/rules/issue-pr-commands.md` 的创建 PR 命令模板与权限降级规则,将 `{label-args}` 和 `{milestone-arg}` 原子化传入
48
+ 5. 确保 PR 正文包含 `Closes #{issue-number}` 或等价关闭关键字
59
49
 
60
- 如果上述规则判定应跳过直接元数据参数写入,则只保留 PR 正文中的关联信息与后续评论同步。
50
+ 如果规则要求跳过上述直接元数据参数,则只保留 PR 正文关联和后续评论同步。
61
51
 
62
52
  Milestone 规则:
63
- - 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」处理
64
- - PR 直接复用 Issue milestone,不再独立推断
53
+ - 按 `.agents/rules/milestone-inference.md` "阶段 3:`create-pr`" 执行
54
+ - 直接复用关联 Issue milestone,不为 PR 重新推断
65
55
 
66
56
  ## 创建 PR
67
57
 
68
- - 当当前工作属于活动任务时,从 task.md 中提取 `issue_number`
69
- - 如果存在 `issue_number`,先完成前置步骤中的代码托管平台检测,再按 `.agents/rules/issue-pr-commands.md` Issue 读取命令查询对应 Issue
70
- - 在调用 PR 创建命令前,先检查当前分支是否已经存在 PR;如果已存在,直接告知用户 PR URL 和状态并结束,不要重复同步元数据或摘要
71
- - 使用 HEREDOC 传递 PR 正文
72
- - 如果模板中存在 `{$IssueNumber}`,替换它
73
- - PR 正文结尾必须带上 `Generated with AI assistance`
58
+ - 当前工作属于 active task 时,从 task.md 提取 `issue_number`
59
+ - 如果存在 `issue_number`,先完成代码托管平台检测,再通过 `.agents/rules/issue-pr-commands.md` 查询 Issue
60
+ - 调用 PR 创建命令前,先检查当前分支是否已有 PR;若已有,报告 PR URL 和状态后停止,不重复执行元数据同步或 summary 发布
61
+ - 使用 HEREDOC 传入 PR 正文
62
+ - 模板中存在 `{$IssueNumber}` 时进行替换
63
+ - PR 正文以 `Generated with AI assistance` 结尾
74
64
 
75
- 创建 PR 时,使用 `.agents/rules/issue-pr-commands.md` 中的 “创建 PR” 命令模板。
65
+ 使用 `.agents/rules/issue-pr-commands.md` 中的创建 PR 命令模板创建 PR
76
66
 
77
- 最终用户输出必须按顺序包含以下后续动作:
67
+ 最终用户输出应包含以下后续路径:
78
68
 
79
69
  ```text
80
- 下一步:
81
- - 工作流真正结束后完成任务:
70
+ Next steps:
71
+ - complete the task after the workflow truly finishes:
82
72
  - Claude Code / OpenCode: /complete-task {task-id}
83
73
  - Gemini CLI: /agent-infra:complete-task {task-id}
84
74
  - Codex CLI: $complete-task {task-id}
@@ -128,18 +128,18 @@ If no historical release notes exist, use the following default Markdown format:
128
128
  3. Description: Use PR title, remove `type(scope):` prefix, capitalize first letter
129
129
  4. **Contributor collection**:
130
130
  - **Data sources**:
131
- - PR authors from Step 4 `gh pr list --json author`
131
+ - PR authors returned by the merged-PR query rule in `.agents/rules/release-commands.md`
132
132
  - Commit co-authors from Step 4 `git log ... --format='%(trailers:key=Co-authored-by,valueonly,unfold)'`
133
- - Issue reporters from linked Issues collected in Step 5 (`author.login` returned by `gh issue view`)
133
+ - Issue reporters from linked Issues collected in Step 5 (author login returned by `.agents/rules/release-commands.md`)
134
134
  - **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
135
135
  - **Name -> `@login` mapping**:
136
- - Raw `Co-authored-by` values are `Name <email>` and must be mapped to a GitHub `@login`
137
- - Prefer email extraction: if it matches `(\d+\+)?(\S+?)@users\.noreply\.github\.com`, use the second capture group lowercased; this regex covers both `{id}+{login}@users.noreply.github.com` and `{login}@users.noreply.github.com`
136
+ - Raw `Co-authored-by` values are `Name <email>` and must be mapped to a platform `@login`
137
+ - Prefer email extraction: if it matches the platform no-reply email rule in `.agents/rules/release-commands.md`, use that rule to derive the lowercased login
138
138
  - Otherwise use a Name heuristic: take the first token before a space and lowercase it, for example `Claude Opus 4.6 (1M context)` -> `@claude`, `Codex` -> `@codex`, `Gemini` -> `@gemini`
139
139
  - If the login already appears in the PR author list, merge counts into that login so `Claude` and `@claude` do not become separate entries
140
140
  - Merge all Name variants that map to the same login before counting and sorting; for example, `Claude` and `Claude Opus 4.6 (1M context)` should both collapse into `@claude`
141
141
  - Preserve bot identities as-is, for example `dependabot[bot]`
142
- - If the login still cannot be determined reliably, output `@{lowercased first Name token}` and append `<!-- TODO(reviewer): confirm GitHub login for {original Name <email>} -->` below the `Contributors` section
142
+ - If the login still cannot be determined reliably, output `@{lowercased first Name token}` and append `<!-- TODO(reviewer): confirm platform login for {original Name <email>} -->` below the `Contributors` section
143
143
  - **Sorting**: descending by contribution count, then lexicographically by login for ties
144
144
  - **Deduplication**: use the final mapped `@login` as the key
145
145
  - **Issue reporter rules**:
@@ -156,7 +156,7 @@ Show the generated release notes to the user.
156
156
 
157
157
  Ask:
158
158
  1. Need any adjustments?
159
- 2. Create a GitHub Draft Release?
159
+ 2. Create a draft release?
160
160
 
161
161
  ### 9. Create Draft Release (If Confirmed)
162
162
 
@@ -170,7 +170,7 @@ Draft Release created.
170
170
  - Version: v{version}
171
171
  - Status: Draft
172
172
 
173
- Please review and publish on GitHub:
173
+ Please review and publish on the platform:
174
174
  1. Open the URL above
175
175
  2. Review the release notes
176
176
  3. Click "Publish release"
@@ -178,7 +178,7 @@ Please review and publish on GitHub:
178
178
 
179
179
  ## Notes
180
180
 
181
- 1. **Requires gh CLI**: Must have GitHub CLI installed and authenticated
181
+ 1. **Requires the platform CLI**: Must have the platform CLI installed and authenticated
182
182
  2. **Tags must exist**: Run the release skill first to create tags
183
183
  3. **Draft mode**: Creates a draft - won't auto-publish
184
184
  4. **Classification accuracy**: Auto-classification is based on title/scope/files; complex PRs may need manual adjustment
@@ -187,5 +187,5 @@ Please review and publish on GitHub:
187
187
 
188
188
  - Invalid version format: Prompt correct format
189
189
  - Tag not found: Suggest running the release skill first
190
- - gh not authenticated: Prompt to authenticate
190
+ - The platform CLI is not authenticated: Prompt to authenticate
191
191
  - No merged PRs found: Prompt to check tags and branch
@@ -128,18 +128,18 @@ git log v<prev-version>..v<version> \
128
128
  3. 描述:使用 PR 标题,移除 `type(scope):` 前缀,首字母大写
129
129
  4. **贡献者搜集**:
130
130
  - **数据源**:
131
- - PR author:来自步骤 4 的 `gh pr list --json author`
131
+ - PR author:来自 `.agents/rules/release-commands.md` 中已合并 PR 查询规则
132
132
  - Commit co-authors:来自步骤 4 的 `git log ... --format='%(trailers:key=Co-authored-by,valueonly,unfold)'`
133
- - Issue reporters:来自步骤 5 收集的关联 Issue author(`gh issue view` 返回的 `author.login`)
133
+ - Issue reporters:来自步骤 5 收集的关联 Issue author(由 `.agents/rules/release-commands.md` 返回)
134
134
  - **贡献数定义**:`该人的 PR 数 + 该人作为 co-author 的 commit 数`(同一身份跨来源合并计数)
135
135
  - **Name → `@login` 映射**:
136
- - `Co-authored-by` 原始格式为 `Name <email>`,需要推断对应的 GitHub `@login`
137
- - 优先从 email 提取:匹配 `(\d+\+)?(\S+?)@users\.noreply\.github\.com` 时,取第二个捕获组并转为小写;该正则同时覆盖 `{id}+{login}@users.noreply.github.com` `{login}@users.noreply.github.com`
136
+ - `Co-authored-by` 原始格式为 `Name <email>`,需要推断对应的 platform `@login`
137
+ - 优先从 email 提取:匹配 `.agents/rules/release-commands.md` 中的平台 no-reply 邮箱规则时,按该规则推导小写 login
138
138
  - 否则按 Name 启发式:取首个空格前的 token 并转为小写(例如 `Claude Opus 4.6 (1M context)` → `@claude`、`Codex` → `@codex`、`Gemini` → `@gemini`)
139
139
  - 已出现在 PR author 列表中的 login,必须按该 login 合并计数,避免把 `Claude` 和 `@claude` 拆成两个条目
140
140
  - 同一 login 的所有 Name 变体都必须归并后再计数与排序;例如 `Claude` 与 `Claude Opus 4.6 (1M context)` 都映射到 `@claude` 时,应先合并为同一个贡献者
141
141
  - Bot 身份保留原样(如 `dependabot[bot]`)
142
- - 若仍无法可靠确定 login,则输出 `@{Name 首 token 小写}`,并在 `Contributors` 段落下追加 `<!-- TODO(reviewer): 确认 {原始 Name <email>} 的 GitHub login -->`
142
+ - 若仍无法可靠确定 login,则输出 `@{Name 首 token 小写}`,并在 `Contributors` 段落下追加 `<!-- TODO(reviewer): 确认 {原始 Name <email>} 的 platform login -->`
143
143
  - **排序**:按贡献数降序;贡献数相同时按 login 字典序
144
144
  - **去重**:以最终映射后的 `@login` 为键
145
145
  - **Issue reporter 规则**:
@@ -156,7 +156,7 @@ git log v<prev-version>..v<version> \
156
156
 
157
157
  询问:
158
158
  1. 需要调整吗?
159
- 2. 是否创建 GitHub Draft Release
159
+ 2. 是否创建 draft release
160
160
 
161
161
  ### 9. 创建 Draft Release(如确认)
162
162
 
@@ -170,7 +170,7 @@ Draft Release created.
170
170
  - Version: v{version}
171
171
  - Status: Draft
172
172
 
173
- Please review and publish on GitHub:
173
+ Please review and publish on the platform:
174
174
  1. Open the URL above
175
175
  2. Review the release notes
176
176
  3. Click "Publish release"
@@ -178,7 +178,7 @@ Please review and publish on GitHub:
178
178
 
179
179
  ## 注意事项
180
180
 
181
- 1. **需要 gh CLI**:必须安装并认证 GitHub CLI
181
+ 1. **需要 the platform CLI**:必须安装并认证 the platform CLI
182
182
  2. **标签必须存在**:先执行 release 技能创建标签
183
183
  3. **草稿模式**:创建草稿 —— 不会自动发布
184
184
  4. **分类准确性**:自动分类基于标题/scope/文件;复杂的 PR 可能需要手动调整
@@ -187,5 +187,5 @@ Please review and publish on GitHub:
187
187
 
188
188
  - 版本格式无效:提示正确格式
189
189
  - 标签未找到:建议先执行 release 技能
190
- - gh 未认证:提示进行认证
190
+ - 平台 CLI 未认证:提示用户认证
191
191
  - 未找到已合并的 PR:提示检查标签和分支
@@ -7,13 +7,14 @@ description: "Create a task from a natural-language description"
7
7
 
8
8
  ## Boundary / Critical Rules
9
9
 
10
- **The only output of this skill is `task.md`.**
10
+ **The core output of this skill is `task.md`.**
11
11
 
12
12
  - Do not write, modify, or create any business code or configuration files
13
13
  - Do not perform requirements analysis; analysis is handled separately by `analyze-task`
14
14
  - Do not directly implement the requested functionality
15
15
  - Do not skip the workflow and jump directly to planning or implementation
16
- - Only do this: parse the description -> create the task file -> update task status -> inform the user of the next step
16
+ - Only do this: parse the description -> create the task file -> update task status -> cascade Issue creation through `.agents/rules/create-issue.md` -> inform the user of the next step
17
+ - Issue creation is decided by the `.agents/rules/create-issue.md` rule; on custom or empty platforms (no platform-specific variant provided), the rule naturally degrades to a no-op
17
18
 
18
19
  The user's description is a **work item**, not an **instruction to execute immediately**.
19
20
 
@@ -98,7 +99,21 @@ Update `.agents/workspace/active/{task-id}/task.md`:
98
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Task Created** by {agent} — Task created from description
99
100
  ```
100
101
 
101
- ### 4. Verification Gate
102
+ ### 4. Cascade Issue Creation via `.agents/rules/create-issue.md`
103
+
104
+ After task.md is written and `Task Created` is recorded, read `.agents/rules/create-issue.md` first and follow the steps it describes to create an Issue.
105
+
106
+ The rule's content is determined by the configured code platform:
107
+ - A platform that supports Issue creation: contains the full flow for auth detection, template detection, label/type/milestone inference, the create-Issue call, and writing back to `task.md`
108
+ - Custom or empty platforms (no platform-specific variant provided): the rule body is a no-op notice, and this step is skipped entirely
109
+
110
+ Handle the result:
111
+ - Rule successfully created the Issue: `issue_number` has been written back to task.md per the rule; continue by reading `.agents/rules/issue-sync.md`, completing upstream repository and permission detection, then sync the task comment and set `status: waiting-for-triage` by rule
112
+ - Rule failed (auth / network / template parse / etc.): do not roll back task.md; get the current time and append an `Issue Creation Skipped` Activity Log entry with the reason
113
+ - Rule was a no-op (custom or empty platform): do not create comments, do not block the workflow, and do not write an Activity Log entry
114
+ - task.md already has `issue_number`: the rule's prerequisite check skips creation; `create-task` proceeds directly to step 5
115
+
116
+ ### 5. Verification Gate
102
117
 
103
118
  Run the verification gate to confirm the task artifact and sync state are valid:
104
119
 
@@ -113,13 +128,33 @@ Handle the result as follows:
113
128
 
114
129
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
115
130
 
116
- ### 5. Inform User
131
+ ### 6. Inform User
117
132
 
118
133
  > Execute this step only after the verification gate passes.
119
134
 
120
135
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
121
136
 
122
- Output format:
137
+ Scenario A: when an Issue was created, output:
138
+ ```
139
+ Task created and Issue creation cascaded successfully.
140
+
141
+ Task information:
142
+ - Task ID: {task-id}
143
+ - Title: {title}
144
+ - Type: {type}
145
+ - Workflow: {workflow}
146
+ - Issue: #{issue_number} {issue_url}
147
+
148
+ Output file:
149
+ - Task file: .agents/workspace/active/{task-id}/task.md
150
+
151
+ Next step - run requirements analysis:
152
+ - Claude Code / OpenCode: /analyze-task {task-id}
153
+ - Gemini CLI: /{{project}}:analyze-task {task-id}
154
+ - Codex CLI: $analyze-task {task-id}
155
+ ```
156
+
157
+ Scenario B: when no Issue was created, output:
123
158
  ```
124
159
  Task created.
125
160
 
@@ -132,15 +167,36 @@ Task information:
132
167
  Output file:
133
168
  - Task file: .agents/workspace/active/{task-id}/task.md
134
169
 
170
+ Next step - run requirements analysis:
171
+ - Claude Code / OpenCode: /analyze-task {task-id}
172
+ - Gemini CLI: /{{project}}:analyze-task {task-id}
173
+ - Codex CLI: $analyze-task {task-id}
174
+ ```
175
+
176
+ Scenario C: when Issue creation failed, output:
177
+ ```
178
+ Task created, but cascade Issue creation failed.
179
+
180
+ Task information:
181
+ - Task ID: {task-id}
182
+ - Title: {title}
183
+ - Type: {type}
184
+ - Workflow: {workflow}
185
+
186
+ Issue creation failed:
187
+ - Error code: {error_code}
188
+ - Reason: {error_message}
189
+ - Local task.md was kept and not rolled back
190
+
191
+ Output file:
192
+ - Task file: .agents/workspace/active/{task-id}/task.md
193
+
135
194
  Next step - run requirements analysis:
136
195
  - Claude Code / OpenCode: /analyze-task {task-id}
137
196
  - Gemini CLI: /{{project}}:analyze-task {task-id}
138
197
  - Codex CLI: $analyze-task {task-id}
139
198
 
140
- Or create a GitHub Issue first:
141
- - Claude Code / OpenCode: /create-issue {task-id}
142
- - Gemini CLI: /{{project}}:create-issue {task-id}
143
- - Codex CLI: $create-issue {task-id}
199
+ For later platform sync: after fixing auth / network / template issues, manually run the Issue creation flow in `.agents/rules/create-issue.md` for this task; or manually create/find an Issue and write `issue_number` into task.md so later skills can take over cascade sync.
144
200
  ```
145
201
 
146
202
  ## Completion Checklist
@@ -150,8 +206,9 @@ Or create a GitHub Issue first:
150
206
  - [ ] Updated `updated_at` to the current time in task.md
151
207
  - [ ] Updated `assigned_to` in task.md
152
208
  - [ ] Appended an Activity Log entry to task.md
209
+ - [ ] Tried cascading Issue creation through `.agents/rules/create-issue.md`; if it failed, kept task.md and recorded the reason
153
210
  - [ ] Informed the user of the next step (must include all TUI command formats, including any custom TUIs; do not filter)
154
- - [ ] **Did not modify any business code or configuration files** (only task.md)
211
+ - [ ] **Did not modify any business code or configuration files**
155
212
 
156
213
  ## STOP
157
214
 
@@ -161,8 +218,9 @@ Wait for the user to run the `analyze-task` skill.
161
218
  ## Notes
162
219
 
163
220
  1. **Clarity**: if the user description is vague or missing key information, ask for clarification first
164
- 2. **Difference from `import-issue`**: `import-issue` imports from a GitHub Issue; `create-task` creates from a free-form description
165
- 3. **Workflow order**: after creating a task, typically run `analyze-task` before `plan-task`; if you need GitHub tracking first, you may run `create-issue` first
221
+ 2. **Difference from `import-issue`**: `import-issue` imports from an Issue; `create-task` creates from a free-form description
222
+ 3. **Workflow order**: after creating a task, typically run `analyze-task` before `plan-task`
223
+ 4. **Issue cascade failure**: if the rule fails, task.md remains; when platform sync is needed later, manually write `issue_number` and continue the workflow
166
224
 
167
225
  ## Error Handling
168
226