@fitlab-ai/agent-infra 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/lib/merge.js +22 -7
  4. package/lib/sandbox/commands/rm.js +1 -1
  5. package/lib/sandbox/runtimes/base.dockerfile +17 -1
  6. package/package.json +1 -1
  7. package/templates/.agents/rules/issue-pr-commands.github.en.md +25 -9
  8. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +25 -9
  9. package/templates/.agents/rules/issue-sync.github.en.md +111 -23
  10. package/templates/.agents/rules/issue-sync.github.zh-CN.md +105 -17
  11. package/templates/.agents/rules/milestone-inference.github.en.md +13 -6
  12. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +13 -6
  13. package/templates/.agents/rules/pr-sync.github.en.md +3 -1
  14. package/templates/.agents/rules/pr-sync.github.zh-CN.md +3 -1
  15. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +1080 -0
  16. package/templates/.agents/scripts/validate-artifact.js +54 -805
  17. package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -4
  18. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -4
  19. package/templates/.agents/skills/analyze-task/config/verify.json +1 -1
  20. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +1 -1
  21. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  22. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +4 -4
  23. package/templates/.agents/skills/block-task/config/verify.json +1 -1
  24. package/templates/.agents/skills/cancel-task/SKILL.en.md +18 -18
  25. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +18 -18
  26. package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
  27. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  28. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  29. package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
  30. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  31. package/templates/.agents/skills/commit/SKILL.en.md +15 -3
  32. package/templates/.agents/skills/commit/SKILL.zh-CN.md +15 -3
  33. package/templates/.agents/skills/commit/config/verify.json +2 -1
  34. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +23 -0
  35. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +23 -0
  36. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  37. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  38. package/templates/.agents/skills/complete-task/SKILL.en.md +13 -13
  39. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
  40. package/templates/.agents/skills/complete-task/config/verify.json +1 -1
  41. package/templates/.agents/skills/create-issue/SKILL.en.md +4 -2
  42. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +4 -2
  43. package/templates/.agents/skills/create-issue/config/verify.json +1 -1
  44. package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +6 -1
  45. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +6 -1
  46. package/templates/.agents/skills/create-pr/SKILL.en.md +5 -5
  47. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +5 -5
  48. package/templates/.agents/skills/create-pr/config/verify.json +1 -1
  49. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +9 -5
  50. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +9 -5
  51. package/templates/.agents/skills/create-task/SKILL.en.md +4 -4
  52. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -4
  53. package/templates/.agents/skills/create-task/config/verify.json +1 -1
  54. package/templates/.agents/skills/implement-task/SKILL.en.md +6 -6
  55. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +6 -6
  56. package/templates/.agents/skills/implement-task/config/verify.json +1 -2
  57. package/templates/.agents/skills/import-codescan/SKILL.en.md +2 -2
  58. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +2 -2
  59. package/templates/.agents/skills/import-codescan/config/verify.json +1 -1
  60. package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
  61. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +2 -2
  62. package/templates/.agents/skills/import-dependabot/config/verify.json +1 -1
  63. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  64. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  65. package/templates/.agents/skills/import-issue/config/verify.json +1 -1
  66. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
  67. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
  68. package/templates/.agents/skills/plan-task/config/verify.json +1 -1
  69. package/templates/.agents/skills/refine-task/SKILL.en.md +4 -6
  70. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +4 -6
  71. package/templates/.agents/skills/refine-task/config/verify.json +1 -2
  72. package/templates/.agents/skills/refine-title/SKILL.en.md +5 -1
  73. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +5 -1
  74. package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
  75. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +2 -2
  76. package/templates/.agents/skills/restore-task/config/verify.json +1 -1
  77. package/templates/.agents/skills/review-task/SKILL.en.md +4 -4
  78. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +4 -4
  79. package/templates/.agents/skills/review-task/config/verify.json +1 -1
  80. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +1 -1
  81. package/templates/.agents/templates/task.en.md +3 -3
  82. package/templates/.agents/templates/task.zh-CN.md +3 -3
  83. package/templates/.github/workflows/metadata-sync.yml +127 -0
  84. package/templates/.github/workflows/pr-label.yml +75 -0
  85. package/templates/.github/workflows/status-label.yml +12 -8
@@ -8,7 +8,7 @@ description: "Mark a task as completed and archive it"
8
8
  ## Boundary / Critical Rules
9
9
 
10
10
  - This command updates task metadata AND physically moves the task directory
11
- - Do not archive a task that has incomplete workflow steps unless forced
11
+ - Do not move a task that has incomplete workflow steps unless forced
12
12
 
13
13
  ## Steps
14
14
 
@@ -36,7 +36,7 @@ Before marking complete, verify ALL of these:
36
36
  > - If any condition is missing -> **stop by default** and output the prerequisite warning
37
37
  > - Only continue with unmet prerequisites when the user explicitly requested `--force`
38
38
  >
39
- > **Do not continue to Steps 3-7 when prerequisites are not met, and do not output "Task {task-id} completed and archived."**
39
+ > **Do not continue to Steps 3-7 when prerequisites are not met, and do not output "Task {task-id} completed; task directory moved to completed/."**
40
40
 
41
41
  If any prerequisite is not met, warn the user:
42
42
  ```
@@ -53,7 +53,7 @@ If prerequisites are not met and the user did not explicitly provide `--force`,
53
53
  Get the current time:
54
54
 
55
55
  ```bash
56
- date "+%Y-%m-%d %H:%M:%S"
56
+ date "+%Y-%m-%d %H:%M:%S%:z"
57
57
  ```
58
58
 
59
59
  Update `.agents/workspace/active/{task-id}/task.md`:
@@ -64,10 +64,10 @@ Update `.agents/workspace/active/{task-id}/task.md`:
64
64
  - Verify and check off all items in `## Completion Checklist` (change `- [ ]` to `- [x]`)
65
65
  - **Append** to `## Activity Log` (do NOT overwrite previous entries):
66
66
  ```
67
- - {yyyy-MM-dd HH:mm:ss} — **Completed** by {agent} — Task archived to completed/
67
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Completed** by {agent} — Task moved to completed/
68
68
  ```
69
69
 
70
- ### 4. Archive Task
70
+ ### 4. Move Task
71
71
 
72
72
  Move the task directory from active to completed:
73
73
 
@@ -75,7 +75,7 @@ Move the task directory from active to completed:
75
75
  mv .agents/workspace/active/{task-id} .agents/workspace/completed/{task-id}
76
76
  ```
77
77
 
78
- ### 5. Verify Archive
78
+ ### 5. Verify Move
79
79
 
80
80
  ```bash
81
81
  ls .agents/workspace/completed/{task-id}/task.md
@@ -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
 
@@ -116,12 +116,12 @@ Keep the gate output in your reply as fresh evidence. Do not claim completion wi
116
116
 
117
117
  Output format:
118
118
  ```
119
- Task {task-id} completed and archived.
119
+ Task {task-id} completed; task directory moved to completed/.
120
120
 
121
121
  Task info:
122
122
  - Title: {title}
123
123
  - Completed at: {timestamp}
124
- - Archived to: .agents/workspace/completed/{task-id}/
124
+ - Target path: .agents/workspace/completed/{task-id}/
125
125
 
126
126
  Deliverables:
127
127
  - {List of key outputs: files modified, tests added, etc.}
@@ -132,18 +132,18 @@ Deliverables:
132
132
  - [ ] Verified all workflow steps are complete
133
133
  - [ ] Updated task.md with completed status and timestamp
134
134
  - [ ] Moved task directory to `.agents/workspace/completed/`
135
- - [ ] Verified archive succeeded
135
+ - [ ] Verified move succeeded
136
136
  - [ ] Informed user of completion
137
137
 
138
138
  ## Notes
139
139
 
140
- 1. **Premature completion**: Do not archive a task that has incomplete steps. Examples of incomplete situations:
140
+ 1. **Premature completion**: Do not move a task that has incomplete steps. Examples of incomplete situations:
141
141
  - Code is written but not committed
142
142
  - Code is committed but not reviewed
143
143
  - Review found blockers that haven't been fixed
144
144
  - PR is created but not merged
145
145
 
146
- 2. **Rollback**: If a task was archived incorrectly:
146
+ 2. **Rollback**: If a task was incorrectly moved:
147
147
  ```bash
148
148
  mv .agents/workspace/completed/{task-id} .agents/workspace/active/{task-id}
149
149
  ```
@@ -8,7 +8,7 @@ description: "标记任务完成并归档"
8
8
  ## 行为边界 / 关键规则
9
9
 
10
10
  - 本命令更新任务元数据并物理移动任务目录
11
- - 除非强制执行,不要归档有未完成工作流步骤的任务
11
+ - 除非强制执行,不要转移有未完成工作流步骤的任务
12
12
 
13
13
  ## 执行步骤
14
14
 
@@ -36,7 +36,7 @@ description: "标记任务完成并归档"
36
36
  > - 如果任意一个条件不满足 → **默认停止**,输出前置条件未满足的警告
37
37
  > - 只有用户明确要求 `--force` 时,才可以在前置条件未满足时继续
38
38
  >
39
- > **禁止在前置条件未满足时继续执行步骤 3-7,也不要输出「任务 {task-id} 已完成并归档。」**
39
+ > **禁止在前置条件未满足时继续执行步骤 3-7,也不要输出「任务 {task-id} 已完成,任务目录已转移到 completed/。」**
40
40
 
41
41
  如果任何前置条件未满足,警告用户:
42
42
  ```
@@ -53,7 +53,7 @@ Please complete the missing steps first, or use --force to override.
53
53
  获取当前时间:
54
54
 
55
55
  ```bash
56
- date "+%Y-%m-%d %H:%M:%S"
56
+ date "+%Y-%m-%d %H:%M:%S%:z"
57
57
  ```
58
58
 
59
59
  更新 `.agents/workspace/active/{task-id}/task.md`:
@@ -64,10 +64,10 @@ date "+%Y-%m-%d %H:%M:%S"
64
64
  - 逐项验证并勾选 `## 完成检查清单` 中的所有条目(将 `- [ ]` 改为 `- [x]`)
65
65
  - **追加**到 `## Activity Log`(不要覆盖之前的记录):
66
66
  ```
67
- - {yyyy-MM-dd HH:mm:ss} — **Completed** by {agent} — Task archived to completed/
67
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Completed** by {agent} — Task moved to completed/
68
68
  ```
69
69
 
70
- ### 4. 归档任务
70
+ ### 4. 转移任务
71
71
 
72
72
  将任务目录从 active 移动到 completed:
73
73
 
@@ -75,7 +75,7 @@ date "+%Y-%m-%d %H:%M:%S"
75
75
  mv .agents/workspace/active/{task-id} .agents/workspace/completed/{task-id}
76
76
  ```
77
77
 
78
- ### 5. 验证归档
78
+ ### 5. 验证转移
79
79
 
80
80
  ```bash
81
81
  ls .agents/workspace/completed/{task-id}/task.md
@@ -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
 
@@ -116,12 +116,12 @@ node .agents/scripts/validate-artifact.js gate complete-task .agents/workspace/c
116
116
 
117
117
  输出格式:
118
118
  ```
119
- 任务 {task-id} 已完成并归档。
119
+ 任务 {task-id} 已完成,任务目录已转移到 completed/。
120
120
 
121
121
  任务信息:
122
122
  - 标题:{title}
123
123
  - 完成时间:{timestamp}
124
- - 归档路径:.agents/workspace/completed/{task-id}/
124
+ - 目标路径:.agents/workspace/completed/{task-id}/
125
125
 
126
126
  交付物:
127
127
  - {关键产出列表:修改的文件、添加的测试等}
@@ -132,18 +132,18 @@ node .agents/scripts/validate-artifact.js gate complete-task .agents/workspace/c
132
132
  - [ ] 验证了所有工作流步骤已完成
133
133
  - [ ] 更新了 task.md 的完成状态和时间戳
134
134
  - [ ] 将任务目录移动到 `.agents/workspace/completed/`
135
- - [ ] 验证了归档成功
135
+ - [ ] 验证了转移成功
136
136
  - [ ] 告知了用户完成情况
137
137
 
138
138
  ## 注意事项
139
139
 
140
- 1. **过早完成**:不要归档有未完成步骤的任务。未完成的情况示例:
140
+ 1. **过早完成**:不要转移有未完成步骤的任务。未完成的情况示例:
141
141
  - 代码已编写但未提交
142
142
  - 代码已提交但未审查
143
143
  - 审查发现阻塞项但未修复
144
144
  - PR 已创建但未合并
145
145
 
146
- 2. **回滚**:如果任务被错误归档:
146
+ 2. **回滚**:如果任务被错误转移:
147
147
  ```bash
148
148
  mv .agents/workspace/completed/{task-id} .agents/workspace/active/{task-id}
149
149
  ```
@@ -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,12 +41,14 @@ 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:
47
49
 
48
50
  ```bash
49
- date "+%Y-%m-%d %H:%M:%S"
51
+ date "+%Y-%m-%d %H:%M:%S%:z"
50
52
  ```
51
53
 
52
54
  Write back `issue_number`, update `updated_at`, and append the Create Issue Activity Log entry.
@@ -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,12 +41,14 @@ 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
  获取当前时间:
47
49
 
48
50
  ```bash
49
- date "+%Y-%m-%d %H:%M:%S"
51
+ date "+%Y-%m-%d %H:%M:%S%:z"
50
52
  ```
51
53
 
52
54
  回写 `issue_number`,更新 `updated_at`,并追加 Create Issue 的 Activity Log。
@@ -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
@@ -69,7 +69,7 @@ Aggregate a reviewer-facing summary from those artifacts and maintain a single i
69
69
  Get the current time:
70
70
 
71
71
  ```bash
72
- date "+%Y-%m-%d %H:%M:%S"
72
+ date "+%Y-%m-%d %H:%M:%S%:z"
73
73
  ```
74
74
 
75
75
  If `{task-id}` is available, update task.md with `pr_number`, `updated_at`, and append the PR Created Activity Log entry including metadata-sync and summary results.
@@ -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. 发布审查摘要
@@ -69,7 +69,7 @@ description: "创建 Pull Request 到目标分支"
69
69
  获取当前时间:
70
70
 
71
71
  ```bash
72
- date "+%Y-%m-%d %H:%M:%S"
72
+ date "+%Y-%m-%d %H:%M:%S%:z"
73
73
  ```
74
74
 
75
75
  如果获取到了 `{task-id}`,更新 task.md 的 `pr_number`、`updated_at`,并追加 PR Created 的 Activity Log,记录元数据同步和摘要发布结果。
@@ -17,7 +17,7 @@
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,
@@ -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 edit` on the current repository.
31
+
30
32
  Before syncing labels, verify the standard label system:
31
33
 
32
34
  ```bash
@@ -50,12 +52,14 @@ 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
55
+ 2. handle the mapped type label via the PR update command and permission-degradation rules in `.agents/rules/issue-pr-commands.md`
56
+ 3. handle inheritance of non-`type:` and non-`status:` Issue labels via repeated PR update commands and the same permission-degradation rules
57
+ 4. copy the current Issue `in:` labels to the PR (commit already computed them, so do not recompute them here and do not write back to the Issue)
58
+ 5. handle the milestone by following "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md`, including its permission rules, and reuse the Issue milestone directly
57
59
  6. ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword
58
60
 
61
+ If those rules say to skip the direct metadata writes above, keep only the PR body linkage plus later comment sync.
62
+
59
63
  Milestone rule:
60
64
  - Follow "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md`
61
65
  - Reuse the linked Issue milestone directly instead of inferring a new PR milestone
@@ -63,7 +67,7 @@ Milestone rule:
63
67
  ## Create the PR
64
68
 
65
69
  - 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`
70
+ - 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
71
  - 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
72
  - Use HEREDOC to pass the PR body
69
73
  - 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 edit` 仍保持作用于当前仓库。
31
+
30
32
  在同步 label 之前,先确认标准 label 体系已经存在:
31
33
 
32
34
  ```bash
@@ -50,12 +52,14 @@ 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
55
+ 2. 按 `.agents/rules/issue-pr-commands.md` 的 PR 更新命令和权限降级规则处理映射后的 type label
56
+ 3. 按同一规则的 PR 更新命令和权限降级规则处理非 `type:`、非 `status:` 的 Issue labels 继承
57
+ 4. Issue 当前的 `in:` labels 复制到 PR(commit 阶段已完成计算,此处不重新计算也不反向更新 Issue
58
+ 5. 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」及其权限规则处理 milestone,直接复用 Issue milestone
57
59
  6. 确保 PR 正文包含 `Closes #{issue-number}` 或等价的 closing keyword
58
60
 
61
+ 如果上述规则判定应跳过直接元数据写入,则只保留 PR 正文中的关联信息与后续评论同步。
62
+
59
63
  Milestone 规则:
60
64
  - 按 `.agents/rules/milestone-inference.md` 的「阶段 3:`create-pr`」处理
61
65
  - PR 直接复用 Issue milestone,不再独立推断
@@ -63,7 +67,7 @@ Milestone 规则:
63
67
  ## 创建 PR
64
68
 
65
69
  - 当当前工作属于活动任务时,从 task.md 中提取 `issue_number`
66
- - 如果存在 `issue_number`,按 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询对应 Issue
70
+ - 如果存在 `issue_number`,先完成前置步骤中的代码托管平台检测,再按 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询对应 Issue
67
71
  - 在调用 PR 创建命令前,先检查当前分支是否已经存在 PR;如果已存在,直接告知用户 PR URL 和状态并结束,不要重复同步元数据或摘要
68
72
  - 使用 HEREDOC 传递 PR 正文
69
73
  - 如果模板中存在 `{$IssueNumber}`,替换它
@@ -71,8 +71,8 @@ type: feature|bugfix|refactor|docs|chore
71
71
  branch: <project>-<type>-<slug>
72
72
  workflow: feature-development|bug-fix|refactoring
73
73
  status: active
74
- created_at: {yyyy-MM-dd HH:mm:ss}
75
- updated_at: {yyyy-MM-dd HH:mm:ss}
74
+ created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
75
+ updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
76
76
  created_by: human
77
77
  current_step: requirement-analysis
78
78
  assigned_to: {current AI agent}
@@ -85,7 +85,7 @@ Note: `created_by` is `human` because the task comes from the user's description
85
85
  Get the current time:
86
86
 
87
87
  ```bash
88
- date "+%Y-%m-%d %H:%M:%S"
88
+ date "+%Y-%m-%d %H:%M:%S%:z"
89
89
  ```
90
90
 
91
91
  Update `.agents/workspace/active/{task-id}/task.md`:
@@ -95,7 +95,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
95
95
  - `## Context` -> `- **Branch**:`: update it to the generated branch name
96
96
  - **Append** to `## Activity Log` (do NOT overwrite previous entries):
97
97
  ```
98
- - {yyyy-MM-dd HH:mm:ss} — **Task Created** by {agent} — Task created from description
98
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Task Created** by {agent} — Task created from description
99
99
  ```
100
100
 
101
101
  ### 4. Verification Gate
@@ -71,8 +71,8 @@ type: feature|bugfix|refactor|docs|chore
71
71
  branch: <project>-<type>-<slug>
72
72
  workflow: feature-development|bug-fix|refactoring
73
73
  status: active
74
- created_at: {yyyy-MM-dd HH:mm:ss}
75
- updated_at: {yyyy-MM-dd HH:mm:ss}
74
+ created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
75
+ updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
76
76
  created_by: human
77
77
  current_step: requirement-analysis
78
78
  assigned_to: {当前 AI 代理}
@@ -85,7 +85,7 @@ assigned_to: {当前 AI 代理}
85
85
  获取当前时间:
86
86
 
87
87
  ```bash
88
- date "+%Y-%m-%d %H:%M:%S"
88
+ date "+%Y-%m-%d %H:%M:%S%:z"
89
89
  ```
90
90
 
91
91
  更新 `.agents/workspace/active/{task-id}/task.md`:
@@ -95,7 +95,7 @@ date "+%Y-%m-%d %H:%M:%S"
95
95
  - `## 上下文` 中的 `- **分支**:`:更新为生成的分支名
96
96
  - **追加**到 `## Activity Log`(不要覆盖之前的记录):
97
97
  ```
98
- - {yyyy-MM-dd HH:mm:ss} — **Task Created** by {agent} — Task created from description
98
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Task Created** by {agent} — Task created from description
99
99
  ```
100
100
 
101
101
  ### 4. 完成校验
@@ -20,6 +20,6 @@
20
20
  "expected_action_pattern": "Task Created",
21
21
  "freshness_minutes": 30
22
22
  },
23
- "github-sync": null
23
+ "platform-sync": null
24
24
  }
25
25
  }
@@ -39,7 +39,7 @@ After this step, write the final branch name back to `task.md`.
39
39
 
40
40
  ### 3. Narrow the Milestone
41
41
 
42
- If task.md contains a valid `issue_number`, read `.agents/rules/milestone-inference.md` and follow "Phase 2: `implement-task`" to narrow the Issue milestone before implementation starts.
42
+ If task.md contains a valid `issue_number`, read `.agents/rules/issue-sync.md` first to complete upstream repository detection plus permission detection; then read `.agents/rules/milestone-inference.md` and follow "Phase 2: `implement-task`" to narrow the Issue milestone before implementation starts; if `has_triage=false`, keep the current milestone unchanged.
43
43
 
44
44
  ### 4. Determine the Input Plan and Implementation Round
45
45
 
@@ -81,7 +81,7 @@ Create `.agents/workspace/active/{task-id}/{implementation-artifact}`.
81
81
  Get the current time:
82
82
 
83
83
  ```bash
84
- date "+%Y-%m-%d %H:%M:%S"
84
+ date "+%Y-%m-%d %H:%M:%S%:z"
85
85
  ```
86
86
 
87
87
  Update `.agents/workspace/active/{task-id}/task.md`:
@@ -91,11 +91,11 @@ Update `.agents/workspace/active/{task-id}/task.md`:
91
91
  - review the `## Requirements` section and only change items from `- [ ]` to `- [x]` when they are clearly satisfied by this round's implemented code and passing tests
92
92
  - record `{implementation-artifact}` for Round `{implementation-round}`
93
93
  - append:
94
- `- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
94
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
95
95
 
96
- If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure; read `.agents/rules/issue-sync.md` first):
97
- - Set `status: in-progress` and refine `in:` labels from the branch diff by following `.agents/rules/issue-sync.md` (add/remove when a mapping exists, add-only when it does not)
98
- - Sync checked `## Requirements` items to the Issue body and publish the `{implementation-artifact}` comment
96
+ If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure; read `.agents/rules/issue-sync.md` first and complete upstream repository detection plus permission detection):
97
+ - Set `status: in-progress` by following issue-sync.md
98
+ - Publish the `{implementation-artifact}` comment
99
99
  - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
100
100
 
101
101
  ### 10. Verification Gate
@@ -39,7 +39,7 @@ description: "根据技术方案实施任务并输出报告"
39
39
 
40
40
  ### 3. 收窄里程碑
41
41
 
42
- 如果 task.md 中存在有效的 `issue_number`,按 `.agents/rules/milestone-inference.md` 的「阶段 2:`implement-task`」收窄 Issue milestone。执行前先读取该文件。
42
+ 如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测;再读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 2:`implement-task`」收窄 Issue milestone;如果 `has_triage=false`,则保持原 milestone 不变。
43
43
 
44
44
  ### 4. 确定输入方案与实现轮次
45
45
 
@@ -81,7 +81,7 @@ description: "根据技术方案实施任务并输出报告"
81
81
  获取当前时间:
82
82
 
83
83
  ```bash
84
- date "+%Y-%m-%d %H:%M:%S"
84
+ date "+%Y-%m-%d %H:%M:%S%:z"
85
85
  ```
86
86
 
87
87
  更新 `.agents/workspace/active/{task-id}/task.md`:
@@ -91,11 +91,11 @@ date "+%Y-%m-%d %H:%M:%S"
91
91
  - 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
92
92
  - 记录 Round `{implementation-round}` 的 `{implementation-artifact}`
93
93
  - 追加:
94
- `- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
94
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
95
95
 
96
- 如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`):
97
- - 设置 `status: in-progress`,并按 `.agents/rules/issue-sync.md` `in:` label 同步规则,基于分支改动精修 `in:` label(有映射时可增可删,无映射时仅补充)
98
- - 同步 `## 需求` 中已勾选项到 Issue body,并发布 `{implementation-artifact}` 评论
96
+ 如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测):
97
+ - issue-sync.md 设置 `status: in-progress`
98
+ - 发布 `{implementation-artifact}` 评论
99
99
  - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
100
100
 
101
101
  ### 10. 完成校验
@@ -29,13 +29,12 @@
29
29
  "expected_action_pattern": "Implementation \\(Round \\d+\\)",
30
30
  "freshness_minutes": 30
31
31
  },
32
- "github-sync": {
32
+ "platform-sync": {
33
33
  "when": "issue_number_exists",
34
34
  "expected_status_label": "status: in-progress",
35
35
  "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
36
36
  "verify_comment_content": true,
37
37
  "verify_task_comment_content": true,
38
- "sync_checked_requirements": true,
39
38
  "verify_issue_type": true,
40
39
  "verify_milestone": true
41
40
  }