@fitlab-ai/agent-infra 0.5.3 → 0.5.5

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 (69) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/lib/defaults.json +1 -0
  4. package/package.json +1 -1
  5. package/templates/.agents/rules/issue-pr-commands.github.en.md +35 -10
  6. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +35 -10
  7. package/templates/.agents/rules/issue-sync.github.en.md +118 -28
  8. package/templates/.agents/rules/issue-sync.github.zh-CN.md +112 -22
  9. package/templates/.agents/rules/milestone-inference.github.en.md +13 -6
  10. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +13 -6
  11. package/templates/.agents/rules/pr-sync.github.en.md +3 -1
  12. package/templates/.agents/rules/pr-sync.github.zh-CN.md +3 -1
  13. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +1118 -0
  14. package/templates/.agents/scripts/validate-artifact.js +51 -802
  15. package/templates/.agents/skills/analyze-task/SKILL.en.md +2 -2
  16. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +2 -2
  17. package/templates/.agents/skills/analyze-task/config/verify.json +1 -1
  18. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  19. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  20. package/templates/.agents/skills/block-task/config/verify.json +1 -1
  21. package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -6
  22. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -6
  23. package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
  24. package/templates/.agents/skills/commit/SKILL.en.md +14 -2
  25. package/templates/.agents/skills/commit/SKILL.zh-CN.md +14 -2
  26. package/templates/.agents/skills/commit/config/verify.json +2 -1
  27. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +23 -0
  28. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +23 -0
  29. package/templates/.agents/skills/complete-task/SKILL.en.md +2 -2
  30. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +2 -2
  31. package/templates/.agents/skills/complete-task/config/verify.json +1 -1
  32. package/templates/.agents/skills/create-issue/SKILL.en.md +3 -1
  33. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +3 -1
  34. package/templates/.agents/skills/create-issue/config/verify.json +1 -1
  35. package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +6 -1
  36. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +6 -1
  37. package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
  38. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
  39. package/templates/.agents/skills/create-pr/config/verify.json +3 -1
  40. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +9 -6
  41. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +9 -6
  42. package/templates/.agents/skills/create-release-note/SKILL.en.md +27 -2
  43. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +27 -2
  44. package/templates/.agents/skills/create-task/config/verify.json +1 -1
  45. package/templates/.agents/skills/implement-task/SKILL.en.md +4 -4
  46. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +4 -4
  47. package/templates/.agents/skills/implement-task/config/verify.json +1 -2
  48. package/templates/.agents/skills/import-codescan/config/verify.json +1 -1
  49. package/templates/.agents/skills/import-dependabot/config/verify.json +1 -1
  50. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  51. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  52. package/templates/.agents/skills/import-issue/config/verify.json +1 -1
  53. package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
  54. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
  55. package/templates/.agents/skills/plan-task/config/verify.json +1 -1
  56. package/templates/.agents/skills/refine-task/SKILL.en.md +2 -4
  57. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +2 -4
  58. package/templates/.agents/skills/refine-task/config/verify.json +1 -2
  59. package/templates/.agents/skills/refine-title/SKILL.en.md +5 -1
  60. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +5 -1
  61. package/templates/.agents/skills/restore-task/config/verify.json +1 -1
  62. package/templates/.agents/skills/review-task/SKILL.en.md +2 -2
  63. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +2 -2
  64. package/templates/.agents/skills/review-task/config/verify.json +1 -1
  65. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +2 -1
  66. package/templates/.github/scripts/sync-labels-to-set.sh +110 -0
  67. package/templates/.github/workflows/metadata-sync.yml +118 -0
  68. package/templates/.github/workflows/pr-label.yml +66 -0
  69. package/templates/.github/workflows/status-label.yml +20 -30
@@ -119,8 +119,8 @@ Update `.agents/workspace/active/{task-id}/task.md`:
119
119
  ```
120
120
 
121
121
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
122
- - Read `.agents/rules/issue-sync.md` before syncing
123
- - Set `status: pending-design-work`
122
+ - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
123
+ - Set `status: pending-design-work` by following issue-sync.md
124
124
  - Publish the `{analysis-artifact}` comment
125
125
  - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
126
126
 
@@ -119,8 +119,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
119
119
  ```
120
120
 
121
121
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
122
- - 执行前先读取 `.agents/rules/issue-sync.md`
123
- - 设置 `status: pending-design-work`
122
+ - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
123
+ - 按 issue-sync.md 设置 `status: pending-design-work`
124
124
  - 发布 `{analysis-artifact}` 评论
125
125
  - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
126
126
 
@@ -30,7 +30,7 @@
30
30
  "expected_action_pattern": "Requirement Analysis \\(Round \\d+\\)",
31
31
  "freshness_minutes": 30
32
32
  },
33
- "github-sync": {
33
+ "platform-sync": {
34
34
  "when": "issue_number_exists",
35
35
  "expected_status_label": "status: pending-design-work",
36
36
  "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
@@ -70,9 +70,9 @@ ls .agents/workspace/blocked/{task-id}/task.md
70
70
 
71
71
  Check whether `task.md` includes a valid `issue_number`. If not, skip this step.
72
72
 
73
- > Status-label sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing.
73
+ > Status-label sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing, and complete upstream repository detection plus permission detection.
74
74
 
75
- If a valid `issue_number` exists, set `status: blocked` directly.
75
+ If a valid `issue_number` exists, set `status: blocked` by following issue-sync.md.
76
76
 
77
77
  ### 7. Verification Gate
78
78
 
@@ -70,9 +70,9 @@ ls .agents/workspace/blocked/{task-id}/task.md
70
70
 
71
71
  检查 `task.md` 中是否存在有效的 `issue_number`。如果没有,跳过。
72
72
 
73
- > Issue 同步的 status label 规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件。
73
+ > Issue 同步的 status label 规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件,完成 upstream 仓库检测和权限检测。
74
74
 
75
- 如果存在有效的 `issue_number`,直接设置 `status: blocked`。
75
+ 如果存在有效的 `issue_number`,按 issue-sync.md 设置 `status: blocked`。
76
76
 
77
77
  ### 7. 完成校验
78
78
 
@@ -20,7 +20,7 @@
20
20
  "expected_action_pattern": "Blocked",
21
21
  "freshness_minutes": 30
22
22
  },
23
- "github-sync": {
23
+ "platform-sync": {
24
24
  "when": "issue_number_exists",
25
25
  "expected_status_label": "status: blocked"
26
26
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cancel-task
3
- description: "Cancel an unneeded task and archive it"
3
+ description: "Cancel an unneeded task and move it"
4
4
  ---
5
5
 
6
6
  # Cancel Task
@@ -71,14 +71,14 @@ Confirm the task directory was moved successfully.
71
71
 
72
72
  Check whether `task.md` contains a valid `issue_number`. If not, skip this step.
73
73
 
74
- > Issue sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing.
74
+ > Issue sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing, and complete upstream repository detection plus permission detection.
75
75
  > Read `.agents/rules/issue-pr-commands.md` before closing the Issue.
76
76
 
77
77
  If a valid `issue_number` exists:
78
- - Replace all `status:` labels with the label inferred in Step 2
79
- - Remove all `in:` labels
80
- - Remove the milestone
81
- - Remove all assignees
78
+ - Replace all `status:` labels with the label inferred in Step 2 by following issue-sync.md
79
+ - Remove all `in:` labels by following issue-sync.md
80
+ - Remove the milestone by following issue-sync.md
81
+ - Remove all assignees (skip directly when permission is insufficient; no fallback)
82
82
  - Publish a cancellation comment using the marker `<!-- sync-issue:{task-id}:cancel -->`
83
83
  - Create or update the `<!-- sync-issue:{task-id}:task -->` comment using the task-comment sync rules from `.agents/rules/issue-sync.md`
84
84
  - Close the Issue by following the "Close an Issue" command in `.agents/rules/issue-pr-commands.md`, using the fixed reason `not planned`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cancel-task
3
- description: "取消不再需要的任务并归档"
3
+ description: "取消不再需要的任务并转移"
4
4
  ---
5
5
 
6
6
  # 取消任务
@@ -71,14 +71,14 @@ ls .agents/workspace/completed/{task-id}/task.md
71
71
 
72
72
  检查 `task.md` 中是否存在有效的 `issue_number`。如果没有,跳过此步骤。
73
73
 
74
- > Issue 同步规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件。
74
+ > Issue 同步规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件,完成 upstream 仓库检测和权限检测。
75
75
  > 关闭 Issue 前先读取 `.agents/rules/issue-pr-commands.md`。
76
76
 
77
77
  如果存在有效的 `issue_number`:
78
- - 替换所有 `status:` labels,并设置步骤 2 推断出的标签
79
- - 移除所有 `in:` labels
80
- - 移除 milestone
81
- - 移除全部 assignees
78
+ - 按 issue-sync.md 替换所有 `status:` labels,并设置步骤 2 推断出的标签
79
+ - 按 issue-sync.md 移除所有 `in:` labels
80
+ - 按 issue-sync.md 移除 milestone
81
+ - 移除全部 assignees(无权限时直接跳过,不做替代)
82
82
  - 发布取消评论,隐藏标记使用 `<!-- sync-issue:{task-id}:cancel -->`
83
83
  - 使用 `.agents/rules/issue-sync.md` 的 task.md 评论同步规则创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论
84
84
  - 关闭 Issue:按 `.agents/rules/issue-pr-commands.md` 中的“关闭 Issue”命令执行,关闭原因固定为 `not planned`
@@ -21,7 +21,7 @@
21
21
  "expected_action_pattern": "Cancelled",
22
22
  "freshness_minutes": 30
23
23
  },
24
- "github-sync": {
24
+ "platform-sync": {
25
25
  "when": "issue_number_exists",
26
26
  "expected_comment_marker": "<!-- sync-issue:{task-id}:cancel -->",
27
27
  "verify_task_comment_content": true
@@ -52,15 +52,27 @@ Append the Commit Activity Log entry and choose exactly one next-step case:
52
52
  - ready for review -> `review-task {task-id}`
53
53
  - ready for PR -> `create-pr`
54
54
 
55
- ## 6. Sync PR Summary When Applicable
55
+ ## 6. Sync Issue Metadata When Applicable
56
+
57
+ 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.
58
+
59
+ > Trigger conditions, `in:` label computation rules, and requirement-checkbox sync flow live in `reference/issue-metadata-sync.md`. Read that file before running this step.
60
+ >
61
+ > If this step touches the code-hosting platform, complete the prerequisite checks in `.agents/rules/issue-pr-commands.md` first.
62
+
63
+ Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
64
+
65
+ ## 7. Sync PR Summary When Applicable
56
66
 
57
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.
58
68
 
59
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
+ >
71
+ > If this step touches the code-hosting platform, complete the prerequisite checks in `.agents/rules/issue-pr-commands.md` first so the runtime context required by `.agents/rules/pr-sync.md` is ready.
60
72
 
61
73
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
62
74
 
63
- ## 7. Verification Gate
75
+ ## 8. Verification Gate
64
76
 
65
77
  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.
66
78
 
@@ -52,15 +52,27 @@ date "+%Y-%m-%d %H:%M:%S%:z"
52
52
  - 准备审查 -> `review-task {task-id}`
53
53
  - 准备创建 PR -> `create-pr`
54
54
 
55
- ## 6. 同步 PR 摘要(按需)
55
+ ## 6. 同步 Issue 元数据(按需)
56
+
57
+ 当 `{task-id}` 存在且 task.md 包含有效 `issue_number` 时,同步 `in:` label 和需求复选框到关联 Issue;否则跳过。
58
+
59
+ > 触发条件、`in:` label 计算规则和复选框同步流程见 `reference/issue-metadata-sync.md`。执行前先读取该文件。
60
+ >
61
+ > 如果本步骤会访问代码托管平台,则先按 `.agents/rules/issue-pr-commands.md` 完成前置检测。
62
+
63
+ 失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
64
+
65
+ ## 7. 同步 PR 摘要(按需)
56
66
 
57
67
  当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上的 `<!-- sync-pr:{task-id}:summary -->` 摘要评论;否则跳过。
58
68
 
59
69
  > 完整的触发条件、聚合规则、PATCH/POST 流程、Shell 安全约束和错误处理见 `reference/pr-summary-sync.md`(其内联引用 `.agents/rules/pr-sync.md`)。执行此步骤前先读取 `reference/pr-summary-sync.md`。
70
+ >
71
+ > 如果本步骤会访问代码托管平台,则先按 `.agents/rules/issue-pr-commands.md` 完成前置检测,确保 `.agents/rules/pr-sync.md` 所需的运行时上下文已就绪。
60
72
 
61
73
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
62
74
 
63
- ## 7. 完成校验
75
+ ## 8. 完成校验
64
76
 
65
77
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
66
78
 
@@ -17,9 +17,10 @@
17
17
  "expected_action_pattern": "Commit",
18
18
  "freshness_minutes": 30
19
19
  },
20
- "github-sync": {
20
+ "platform-sync": {
21
21
  "when": "pr_number_exists",
22
22
  "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
+ "verify_in_labels_computed": true,
23
24
  "verify_pr_comment_last_commit_matches_head": true
24
25
  }
25
26
  }
@@ -0,0 +1,23 @@
1
+ # Commit-Stage Issue Metadata Sync
2
+
3
+ ## Trigger Conditions
4
+
5
+ Run this step only when all of the following are true:
6
+ - `{task-id}` is valid
7
+ - `task.md` frontmatter contains a valid `issue_number`
8
+
9
+ If either condition is missing, skip this step.
10
+
11
+ Read `.agents/rules/issue-sync.md` first so upstream repository detection and permission detection are complete before any sync work.
12
+
13
+ ## `in:` Label Sync
14
+
15
+ Follow the `in:` label sync steps in issue-sync.md and refine the Issue `in:` labels from the committed branch diff (`git diff {base-branch}...HEAD --name-only`).
16
+
17
+ ## Requirement Checkbox Sync
18
+
19
+ Follow the requirement-checkbox sync steps in issue-sync.md and sync checked items from task.md `## Requirements` into the Issue body.
20
+
21
+ ## Error Handling
22
+
23
+ Treat sync failures as warnings only. Do not block an already completed `git commit`.
@@ -0,0 +1,23 @@
1
+ # Commit 阶段 Issue 元数据同步
2
+
3
+ ## 触发条件
4
+
5
+ 仅当以下条件同时满足时执行:
6
+ - `{task-id}` 有效
7
+ - `task.md` frontmatter 中存在有效 `issue_number`
8
+
9
+ 任一条件不满足时,跳过本步骤。
10
+
11
+ 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测。
12
+
13
+ ## `in:` label 同步
14
+
15
+ 按 issue-sync.md 的 `in:` label 同步步骤,基于已提交分支的改动文件(`git diff {base-branch}...HEAD --name-only`)精修 Issue 的 `in:` label。
16
+
17
+ ## 需求复选框同步
18
+
19
+ 按 issue-sync.md 的需求复选框同步步骤,将 task.md `## 需求` 中已勾选的条目同步到 Issue body。
20
+
21
+ ## 错误处理
22
+
23
+ 同步失败只记为警告,不阻塞已完成的 `git commit`。
@@ -87,11 +87,11 @@ Confirm the task directory was successfully moved.
87
87
 
88
88
  Check whether `task.md` includes a valid `issue_number`. If not, skip this step and output nothing.
89
89
 
90
- > Issue sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing.
90
+ > Issue sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing, and complete upstream repository detection plus permission detection.
91
91
 
92
92
  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
- - Backfill checked `## Requirements` items to the Issue body
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
96
  - Finally create or update the summary comment marked with `<!-- sync-issue:{task-id}:summary -->`
97
97
 
@@ -87,11 +87,11 @@ ls .agents/workspace/completed/{task-id}/task.md
87
87
 
88
88
  检查 `task.md` 中是否存在有效的 `issue_number`。如果没有,跳过此步骤且不输出任何内容。
89
89
 
90
- > Issue 同步规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件。
90
+ > Issue 同步规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件,完成 upstream 仓库检测和权限检测。
91
91
 
92
92
  如果存在有效的 `issue_number`:
93
93
  - 先按 `.agents/rules/issue-sync.md` 的补发规则扫描并补发未发布的 `task.md`、`analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md` 评论(`task.md` 走幂等更新路径)
94
- - 兜底同步 `## 需求` 中已勾选的条目到 Issue body
94
+ - issue-sync.md 的需求复选框同步步骤,兜底同步 `## 需求` 中已勾选的条目到 Issue body
95
95
  - 不要设置 `status:` label — Issue 关闭后 status label 会被自动清除
96
96
  - 最后创建或更新 `<!-- sync-issue:{task-id}:summary -->` 标记的 summary 评论
97
97
 
@@ -23,7 +23,7 @@
23
23
  "completion-checklist": {
24
24
  "require_all_checked": true
25
25
  },
26
- "github-sync": {
26
+ "platform-sync": {
27
27
  "when": "issue_number_exists",
28
28
  "expected_comment_marker": "<!-- sync-issue:{task-id}:summary -->",
29
29
  "verify_task_comment_content": true,
@@ -21,7 +21,7 @@ Create the base GitHub Issue from `task.md` and write `issue_number` back to the
21
21
 
22
22
  Check:
23
23
  - `.agents/workspace/active/{task-id}/task.md`
24
- - read `.agents/rules/issue-pr-commands.md` first, then use its authentication commands to verify platform access
24
+ - read `.agents/rules/issue-pr-commands.md` first, then follow its prerequisite steps to complete authentication and code-hosting platform detection
25
25
 
26
26
  If `issue_number` already exists and is not empty or `N/A`, confirm with the user before creating a replacement Issue.
27
27
 
@@ -41,6 +41,8 @@ Detect `.github/ISSUE_TEMPLATE` files and decide whether to use a matched templa
41
41
 
42
42
  Create and enrich the Issue by following the "Create Issue" and "Set the Issue Type" sections in `.agents/rules/issue-pr-commands.md`. Omit label arguments when nothing valid remains.
43
43
 
44
+ Handle labels, milestone, Issue Type, and assignee behavior by following the permission-degradation rules in `.agents/rules/issue-pr-commands.md` and `.agents/rules/issue-sync.md`.
45
+
44
46
  ### 5. Update Task Status
45
47
 
46
48
  Get the current time:
@@ -21,7 +21,7 @@ description: "从任务文件创建 GitHub Issue"
21
21
 
22
22
  检查:
23
23
  - `.agents/workspace/active/{task-id}/task.md`
24
- - 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的认证命令验证当前平台访问能力
24
+ - 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测
25
25
 
26
26
  如果 `issue_number` 已存在且既不为空也不为 `N/A`,创建前必须先与用户确认。
27
27
 
@@ -41,6 +41,8 @@ description: "从任务文件创建 GitHub Issue"
41
41
 
42
42
  按 `.agents/rules/issue-pr-commands.md` 中的 “创建 Issue” 与 “Issue Type 设置” 规则创建并补充 Issue;如果没有有效 label,就省略 label 参数。
43
43
 
44
+ Label、milestone、Issue Type 和 assignee 的具体处理方式,都按 `.agents/rules/issue-pr-commands.md` 与 `.agents/rules/issue-sync.md` 中的权限降级规则执行。
45
+
44
46
  ### 5. 更新任务状态
45
47
 
46
48
  获取当前时间:
@@ -18,7 +18,7 @@
18
18
  "expected_action_pattern": "Create Issue",
19
19
  "freshness_minutes": 30
20
20
  },
21
- "github-sync": {
21
+ "platform-sync": {
22
22
  "when": "issue_number_exists",
23
23
  "issue_must_exist": true,
24
24
  "verify_task_comment_content": true,
@@ -44,12 +44,17 @@ Issue Type fallback mapping:
44
44
 
45
45
  Before creating the Issue, read `.agents/rules/issue-pr-commands.md` and use its "Create an Issue" command template.
46
46
 
47
+ Before calling the creation command, follow `.agents/rules/issue-sync.md` / `.agents/rules/issue-pr-commands.md` to complete the prerequisite authentication and code-hosting platform detection steps.
48
+
47
49
  If no valid labels remain, omit label arguments.
48
50
 
49
51
  For milestone inference, read `.agents/rules/milestone-inference.md` and follow "Phase 1: `create-issue`" before creating the Issue.
50
52
 
51
53
  Issue Type setup follows the matching commands in `.agents/rules/issue-pr-commands.md`.
52
54
 
55
+ - handle direct writes for labels, milestones, `in:` labels, and Issue Type by following the permission-degradation rules in `.agents/rules/issue-pr-commands.md` and `.agents/rules/issue-sync.md`
56
+ - when those rules say to skip a direct write, continue without failing Issue creation
57
+
53
58
  `in:` labels (coarse selection):
54
59
 
55
60
  Prepare label edit arguments by following the Issue update command in `.agents/rules/issue-pr-commands.md`.
@@ -61,6 +66,6 @@ Use the returned labels to do semantic matching against the task.md title and de
61
66
 
62
67
  Principle: prefer missing labels over wrong labels. Coarse selection does not need to be perfect because implement-task / create-pr will refine `in:` labels from actual changed files later.
63
68
 
64
- Only add relevant `in:` labels. Do not fail Issue creation when `in:` labels are unavailable or irrelevant.
69
+ Handle relevant `in:` labels by following the permission-degradation rules in `.agents/rules/issue-sync.md`. Do not fail Issue creation when `in:` labels are unavailable, irrelevant, or skipped by those rules.
65
70
 
66
71
  Skip unavailable labels, Issue Types, or milestones without failing the Issue creation flow.
@@ -44,12 +44,17 @@ Issue Type fallback 映射:
44
44
 
45
45
  创建 Issue 时,执行前先读取 `.agents/rules/issue-pr-commands.md`,并使用其中的 “创建 Issue” 命令模板。
46
46
 
47
+ 调用创建命令前,先按 `.agents/rules/issue-sync.md` / `.agents/rules/issue-pr-commands.md` 完成前置步骤中的认证和代码托管平台检测。
48
+
47
49
  如果最终没有有效 label,就省略 label 参数。
48
50
 
49
51
  Milestone 推断规则见 `.agents/rules/milestone-inference.md` 的「阶段 1:`create-issue`」。推断前先读取该文件。
50
52
 
51
53
  Issue Type 设置同样遵循 `.agents/rules/issue-pr-commands.md` 中的对应命令。
52
54
 
55
+ - Label、milestone、`in:` label 和 Issue Type 的直接设置,都按 `.agents/rules/issue-pr-commands.md` 与 `.agents/rules/issue-sync.md` 的权限降级规则处理
56
+ - 当规则判定应跳过直接写入时,继续创建 Issue,不要让流程失败
57
+
53
58
  `in:` label(粗选):
54
59
 
55
60
  执行前先按 `.agents/rules/issue-pr-commands.md` 的 Issue 更新命令准备 label 编辑参数。
@@ -61,6 +66,6 @@ Issue Type 设置同样遵循 `.agents/rules/issue-pr-commands.md` 中的对应
61
66
 
62
67
  原则:宁缺毋滥。粗选阶段不求精确,后续 implement-task / create-pr 阶段会基于实际改动文件精修。
63
68
 
64
- 只添加相关的 `in:` label。当 `in:` label 不可用或不相关时,不要让创建 Issue 流程失败。
69
+ 相关 `in:` label 的添加按 `.agents/rules/issue-sync.md` 的权限降级规则处理。当 `in:` label 不可用、不相关或规则判定应跳过时,不要让创建 Issue 流程失败。
65
70
 
66
71
  当 label、Issue Type 或 milestone 不可用时,应跳过并继续,不要让 Issue 创建失败。
@@ -38,7 +38,7 @@ Confirm whether the current branch already has an upstream. Push with `git push
38
38
 
39
39
  Check whether the current branch already has a PR first; if one exists, show the PR URL and stop without repeating metadata sync or summary publication.
40
40
 
41
- Read `.agents/rules/issue-pr-commands.md` before this step, then create the PR with its "Create a PR" command template.
41
+ Read `.agents/rules/issue-pr-commands.md` before this step, follow its prerequisite steps to complete authentication and code-hosting platform detection, then create the PR with its "Create a PR" command template.
42
42
 
43
43
  If `{task-id}` is available and the related task provides `issue_number`, keep `Closes #{issue-number}` in the PR body.
44
44
 
@@ -46,9 +46,9 @@ If `{task-id}` is available and the related task provides `issue_number`, keep `
46
46
 
47
47
  For PRs where `{task-id}` is available, sync the core metadata immediately:
48
48
  - query standard labels, Issue metadata, and PR metadata via `.agents/rules/issue-pr-commands.md`
49
- - add the mapped type label and relevant `in:` labels with the PR update command from `.agents/rules/issue-pr-commands.md`
50
- - sync the linked Issue `in:` labels to match by following the `in:` label sync rule in `.agents/rules/issue-sync.md`
51
- - reuse the Issue milestone by following "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md`
49
+ - apply the mapped type label by following the PR update commands and permission-degradation rules in `.agents/rules/issue-pr-commands.md`
50
+ - copy the current Issue `in:` labels to the PR without recomputing them and without writing back to the Issue
51
+ - reuse the Issue milestone by following "Phase 3: `create-pr`" and its permission rules in `.agents/rules/milestone-inference.md`
52
52
  - keep Development linking in the PR body with `Closes #{issue-number}` when applicable
53
53
 
54
54
  ### 7. Publish the Review Summary
@@ -38,7 +38,7 @@ description: "创建 Pull Request 到目标分支"
38
38
 
39
39
  先检查当前分支是否已经存在 PR;如果已存在,直接告知用户 PR URL 并结束,不要重复执行元数据同步或摘要发布。
40
40
 
41
- 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的 “创建 PR” 命令创建 PR。
41
+ 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测;随后按其中的 “创建 PR” 命令创建 PR。
42
42
 
43
43
  如果获取到 `{task-id}` 且对应任务提供了 `issue_number`,必须在 PR 正文中保留 `Closes #{issue-number}`。
44
44
 
@@ -46,9 +46,9 @@ description: "创建 Pull Request 到目标分支"
46
46
 
47
47
  对获取到 `{task-id}` 的 PR,立即同步这些核心元数据:
48
48
  - 按 `.agents/rules/issue-pr-commands.md` 查询标准 label / Issue / PR 元数据
49
- - 按 `.agents/rules/issue-pr-commands.md` 的 PR 更新命令添加 type label 与相关 `in:` labels
50
- - `.agents/rules/issue-sync.md` `in:` label 同步规则,同步更新关联 Issue 的 `in:` label 保持一致
51
- - 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」复用 Issue milestone
49
+ - 按 `.agents/rules/issue-pr-commands.md` 的 PR 更新命令和权限降级规则处理 type label
50
+ - Issue 当前的 `in:` labels 复制到 PR(不重新计算,不反向更新 Issue
51
+ - 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」及其权限规则复用 Issue milestone
52
52
  - 通过 `Closes #{issue-number}` 保持 Development 关联
53
53
 
54
54
  ### 7. 发布审查摘要
@@ -17,10 +17,12 @@
17
17
  "expected_action_pattern": "PR Created",
18
18
  "freshness_minutes": 30
19
19
  },
20
- "github-sync": {
20
+ "platform-sync": {
21
21
  "when": "issue_number_exists",
22
22
  "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
23
  "verify_in_labels_match_pr": true,
24
+ "verify_pr_type_label": true,
25
+ "verify_pr_assignee": true,
24
26
  "verify_milestone": true
25
27
  }
26
28
  }
@@ -27,6 +27,8 @@ git diff <target-branch>...HEAD
27
27
 
28
28
  Read `.agents/rules/issue-pr-commands.md` before this step.
29
29
 
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
+
30
32
  Before syncing labels, verify the standard label system:
31
33
 
32
34
  ```bash
@@ -50,11 +52,12 @@ Type label mapping:
50
52
 
51
53
  Metadata sync order:
52
54
  1. query Issue labels and milestone via the Issue read command in `.agents/rules/issue-pr-commands.md`
53
- 2. add the mapped type label via the PR update command in `.agents/rules/issue-pr-commands.md`
54
- 3. inherit non-`type:` and non-`status:` Issue labels via repeated PR update commands from the same rule
55
- 4. refine the PR `in:` labels by following `.agents/rules/issue-sync.md`, and keep the linked Issue `in:` labels in sync with the same result
56
- 5. handle the milestone by following "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md`, reusing the Issue milestone directly
57
- 6. ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword
55
+ 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
+ 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`
58
+ 5. ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword
59
+
60
+ If those rules say to skip the direct metadata arguments above, keep only the PR body linkage plus later comment sync.
58
61
 
59
62
  Milestone rule:
60
63
  - Follow "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md`
@@ -63,7 +66,7 @@ Milestone rule:
63
66
  ## Create the PR
64
67
 
65
68
  - Extract `issue_number` from task.md when this work belongs to an active task
66
- - If `issue_number` exists, query the Issue via `.agents/rules/issue-pr-commands.md`
69
+ - If `issue_number` exists, complete the prerequisite code-hosting platform detection steps first, then query the Issue via `.agents/rules/issue-pr-commands.md`
67
70
  - Before calling the PR creation command, check whether the current branch already has a PR. If it does, report the PR URL and state, then stop without repeating metadata sync or summary publication
68
71
  - Use HEREDOC to pass the PR body
69
72
  - Replace `{$IssueNumber}` in the template when present
@@ -27,6 +27,8 @@ git diff <target-branch>...HEAD
27
27
 
28
28
  执行前先读取 `.agents/rules/issue-pr-commands.md`。
29
29
 
30
+ 同步关联 Issue 元数据前,先按该规则完成认证和代码托管平台检测;`gh pr list` / `gh pr create` 仍保持作用于当前仓库。
31
+
30
32
  在同步 label 之前,先确认标准 label 体系已经存在:
31
33
 
32
34
  ```bash
@@ -50,11 +52,12 @@ Type label 映射:
50
52
 
51
53
  元数据同步顺序:
52
54
  1. 按 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询关联 Issue 的 labels 和 milestone
53
- 2. `.agents/rules/issue-pr-commands.md` 的 PR 更新命令添加映射后的 type label
54
- 3. 按同一规则的 PR 更新命令继承非 `type:`、非 `status:` Issue labels
55
- 4. 按 `.agents/rules/issue-sync.md` `in:` label 同步规则精修 PR `in:` label,同时同步更新关联 Issue `in:` label 保持一致
56
- 5. `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」处理 milestone,直接复用 Issue milestone
57
- 6. 确保 PR 正文包含 `Closes #{issue-number}` 或等价的 closing keyword
55
+ 2. 构建 `{label-args}`:包含映射后的 type label、非 `type:`/`status:`Issue labels,以及 Issue 当前的 `in:` labels(commit 阶段已完成计算,此处不重新计算也不反向更新 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
59
+
60
+ 如果上述规则判定应跳过直接元数据参数写入,则只保留 PR 正文中的关联信息与后续评论同步。
58
61
 
59
62
  Milestone 规则:
60
63
  - 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」处理
@@ -63,7 +66,7 @@ Milestone 规则:
63
66
  ## 创建 PR
64
67
 
65
68
  - 当当前工作属于活动任务时,从 task.md 中提取 `issue_number`
66
- - 如果存在 `issue_number`,按 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询对应 Issue
69
+ - 如果存在 `issue_number`,先完成前置步骤中的代码托管平台检测,再按 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询对应 Issue
67
70
  - 在调用 PR 创建命令前,先检查当前分支是否已经存在 PR;如果已存在,直接告知用户 PR URL 和状态并结束,不要重复同步元数据或摘要
68
71
  - 使用 HEREDOC 传递 PR 正文
69
72
  - 如果模板中存在 `{$IssueNumber}`,替换它
@@ -54,7 +54,7 @@ Read `.agents/rules/release-commands.md` before this step.
54
54
  - When generating release notes in Step 7, **must** follow both the historical format style and the full category list gathered in Step 3
55
55
  - If no historical release notes exist, use the default format defined in Step 7
56
56
 
57
- ### 4. Collect Merged PRs
57
+ ### 4. Collect Merged PRs and Contributors
58
58
 
59
59
  Get the date range between tags, then query merged PRs:
60
60
 
@@ -71,6 +71,17 @@ Also collect direct commits without PRs:
71
71
  git log v<prev-version>..v<version> --format="%H %s" --no-merges
72
72
  ```
73
73
 
74
+ Collect collaborative contributors from commit `Co-authored-by` trailers:
75
+
76
+ ```bash
77
+ git log v<prev-version>..v<version> \
78
+ --no-merges \
79
+ --format='%(trailers:key=Co-authored-by,valueonly,unfold)' \
80
+ | grep -v '^$' | sort | uniq -c | sort -rn
81
+ ```
82
+
83
+ Each output line is `Name <email>` and `uniq -c` provides the number of commits where that identity appeared as a co-author within the range.
84
+
74
85
  ### 5. Collect Related Issues
75
86
 
76
87
  From each PR body, extract linked Issues:
@@ -115,7 +126,21 @@ If no historical release notes exist, use the following default Markdown format:
115
126
  1. Item format: `- [scope] Description by @author in [#N](url)`
116
127
  2. Issue + PR: `in [#Issue](url) and [#PR](url)`
117
128
  3. Description: Use PR title, remove `type(scope):` prefix, capitalize first letter
118
- 4. Contributors: Deduplicated, sorted by contribution count (descending)
129
+ 4. **Contributor collection**:
130
+ - **Data sources**:
131
+ - PR authors from Step 4 `gh pr list --json author`
132
+ - Commit co-authors from Step 4 `git log ... --format='%(trailers:key=Co-authored-by,valueonly,unfold)'`
133
+ - **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
134
+ - **Name -> `@login` mapping**:
135
+ - Raw `Co-authored-by` values are `Name <email>` and must be mapped to a GitHub `@login`
136
+ - 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`
137
+ - 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`
138
+ - If the login already appears in the PR author list, merge counts into that login so `Claude` and `@claude` do not become separate entries
139
+ - 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`
140
+ - Preserve bot identities as-is, for example `dependabot[bot]`
141
+ - 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
+ - **Sorting**: descending by contribution count, then lexicographically by login for ties
143
+ - **Deduplication**: use the final mapped `@login` as the key
119
144
  5. Empty sections: Omit sections with no entries
120
145
 
121
146
  ### 8. Present and Confirm