@fitlab-ai/agent-infra 0.9.11 → 0.9.12

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 (193) hide show
  1. package/README.md +6 -6
  2. package/README.zh-CN.md +6 -6
  3. package/dist/bin/internal-cli.js +5 -0
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
  5. package/dist/lib/defaults.json +4 -0
  6. package/dist/lib/git/workflow.js +43 -1
  7. package/dist/lib/init.js +1 -0
  8. package/dist/lib/internal/git-workflow.js +8 -1
  9. package/dist/lib/internal/platform-pr.js +8 -2
  10. package/dist/lib/internal/task-delivery.js +59 -0
  11. package/dist/lib/platform/github-client.js +7 -1
  12. package/dist/lib/platform/pr-checks.js +8 -5
  13. package/dist/lib/platform/pr-summary.js +12 -8
  14. package/dist/lib/platform/pull-requests.js +393 -91
  15. package/dist/lib/platform/verification-required.js +13 -2
  16. package/dist/lib/platform/verification-sync.js +9 -4
  17. package/dist/lib/pr-review/evidence-grading.js +12 -4
  18. package/dist/lib/sandbox/config.js +5 -0
  19. package/dist/lib/sandbox/control/lifecycle.js +29 -7
  20. package/dist/lib/server/process-state.js +2 -2
  21. package/dist/lib/task/artifact-lifecycle.js +2 -2
  22. package/dist/lib/task/commit-intent.js +100 -0
  23. package/dist/lib/task/commit-operation.js +195 -101
  24. package/dist/lib/task/create.js +33 -7
  25. package/dist/lib/task/decision-details.js +3 -48
  26. package/dist/lib/task/delivery-target.js +97 -0
  27. package/dist/lib/task/delivery.js +153 -0
  28. package/dist/lib/task/human-override.js +5 -2
  29. package/dist/lib/task/lifecycle.js +106 -9
  30. package/dist/lib/task/orchestration.js +55 -62
  31. package/dist/lib/task/pr-delivery-fact.js +182 -0
  32. package/dist/lib/task/review-finalization.js +4 -8
  33. package/dist/lib/task/review-fingerprint.js +8 -0
  34. package/dist/lib/task/verification-engine.js +48 -24
  35. package/dist/lib/task/verification-review.js +1 -1
  36. package/dist/lib/update.js +9 -0
  37. package/dist/lifecycle-build-manifest.json +3 -3
  38. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
  39. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
  40. package/lib/defaults.json +4 -0
  41. package/lib/git/workflow.ts +38 -1
  42. package/lib/init.ts +3 -0
  43. package/lib/internal/git-workflow.ts +7 -1
  44. package/lib/internal/platform-pr.ts +8 -1
  45. package/lib/internal/task-delivery.ts +53 -0
  46. package/lib/platform/github-client.ts +8 -1
  47. package/lib/platform/pr-checks.ts +7 -5
  48. package/lib/platform/pr-summary.ts +10 -7
  49. package/lib/platform/pull-requests.ts +425 -87
  50. package/lib/platform/verification-required.ts +12 -2
  51. package/lib/platform/verification-sync.ts +9 -4
  52. package/lib/pr-review/evidence-grading.ts +7 -4
  53. package/lib/sandbox/config.ts +7 -0
  54. package/lib/sandbox/control/lifecycle.ts +30 -8
  55. package/lib/server/process-state.ts +2 -2
  56. package/lib/task/artifact-lifecycle.ts +2 -2
  57. package/lib/task/commit-intent.ts +137 -0
  58. package/lib/task/commit-operation.ts +174 -87
  59. package/lib/task/create.ts +34 -9
  60. package/lib/task/decision-details.ts +2 -62
  61. package/lib/task/delivery-target.ts +130 -0
  62. package/lib/task/delivery.ts +160 -0
  63. package/lib/task/human-override.ts +5 -2
  64. package/lib/task/lifecycle.ts +93 -4
  65. package/lib/task/orchestration.ts +62 -65
  66. package/lib/task/pr-delivery-fact.ts +254 -0
  67. package/lib/task/review-finalization.ts +4 -14
  68. package/lib/task/review-fingerprint.ts +10 -0
  69. package/lib/task/verification-engine.ts +45 -28
  70. package/lib/task/verification-review.ts +2 -0
  71. package/lib/update.ts +10 -0
  72. package/package.json +1 -1
  73. package/templates/.agents/rules/README.en.md +4 -2
  74. package/templates/.agents/rules/README.zh-CN.md +4 -2
  75. package/templates/.agents/rules/create-issue.en.md +11 -2
  76. package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
  77. package/templates/.agents/rules/issue-pr-commands.en.md +4 -17
  78. package/templates/.agents/rules/issue-sync.en.md +26 -5
  79. package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
  80. package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
  81. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
  82. package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
  83. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
  84. package/templates/.agents/rules/milestone-inference.en.md +12 -2
  85. package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
  86. package/templates/.agents/rules/pr-sync.en.md +22 -13
  87. package/templates/.agents/rules/pr-sync.zh-CN.md +22 -1
  88. package/templates/.agents/rules/release-commands.en.md +42 -3
  89. package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
  90. package/templates/.agents/rules/security-alerts.en.md +17 -2
  91. package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
  92. package/templates/.agents/rules/sync-content-generation.en.md +8 -0
  93. package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
  94. package/templates/.agents/rules/task-management.en.md +1 -1
  95. package/templates/.agents/rules/task-management.zh-CN.md +1 -1
  96. package/templates/.agents/scripts/security-alerts.github.sh +151 -0
  97. package/templates/.agents/scripts/security-alerts.sh +31 -0
  98. package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -0
  99. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -0
  100. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  101. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  102. package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
  103. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  104. package/templates/.agents/skills/code-task/SKILL.en.md +5 -2
  105. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +6 -3
  106. package/templates/.agents/skills/commit/SKILL.en.md +3 -3
  107. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -3
  108. package/templates/.agents/skills/commit/config/verify.json +1 -1
  109. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
  110. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
  111. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  112. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  113. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  114. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  115. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +2 -1
  116. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +2 -1
  117. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  118. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  119. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  120. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  121. package/templates/.agents/skills/complete-task/SKILL.en.md +10 -10
  122. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +10 -10
  123. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
  124. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
  125. package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
  126. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
  127. package/templates/.agents/skills/create-task/SKILL.en.md +1 -0
  128. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -0
  129. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  130. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  131. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  132. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  133. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
  134. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
  135. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
  136. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
  137. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
  138. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
  139. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -0
  140. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -0
  141. package/templates/.agents/skills/review-analysis/SKILL.en.md +4 -3
  142. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +4 -3
  143. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
  144. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
  145. package/templates/.agents/skills/review-code/SKILL.en.md +7 -6
  146. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +7 -6
  147. package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
  148. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
  149. package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
  150. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
  151. package/templates/.agents/skills/review-plan/SKILL.en.md +4 -3
  152. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +4 -3
  153. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
  154. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
  155. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
  156. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
  157. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
  158. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
  159. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -0
  160. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -0
  161. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  162. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  163. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +4 -0
  164. package/templates/.agents/skills/watch-pr/SKILL.en.md +4 -4
  165. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +4 -4
  166. package/templates/.agents/templates/task.en.md +5 -1
  167. package/templates/.agents/templates/task.zh-CN.md +5 -1
  168. package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
  169. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
  170. package/templates/.agents/workflows/feature-development.en.yaml +9 -8
  171. package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
  172. package/templates/.agents/workflows/refactoring.en.yaml +9 -8
  173. package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
  174. package/templates/.agents/rules/create-issue.github.en.md +0 -14
  175. package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
  176. package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
  177. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
  178. package/templates/.agents/rules/issue-sync.github.en.md +0 -40
  179. package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
  180. package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
  181. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
  182. package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
  183. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
  184. package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
  185. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
  186. package/templates/.agents/rules/pr-sync.github.en.md +0 -43
  187. package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
  188. package/templates/.agents/rules/release-commands.github.en.md +0 -44
  189. package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -44
  190. package/templates/.agents/rules/security-alerts.github.en.md +0 -43
  191. package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
  192. /package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +0 -0
  193. /package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +0 -0
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Note: whether a step's `pr_tasks` list counts toward workflow progress follows the "PR path" rule:
5
5
  # `.agents/.airc.json:prFlow="required"` always counts; `prFlow="disabled"` never counts;
6
- # when the field is absent, exclude only if task.md's `pr_status=skipped`, otherwise count
6
+ # when the field is absent, exclude only if task.md's `pr_delivery_fact.state=skipped`, otherwise count
7
7
  # (see .agents/skills/complete-task/SKILL.md).
8
8
 
9
9
  name: refactoring
@@ -128,6 +128,7 @@ steps:
128
128
  - Verify tests after each step
129
129
  - Fix findings from the latest code-review artifact when in fix mode
130
130
  - Update affected docs or comments
131
+ - Create a local checkpoint commit after tests pass
131
132
  - Ensure code follows project conventions
132
133
  inputs:
133
134
  - Approved refactoring plan
@@ -181,21 +182,21 @@ steps:
181
182
  - Code review report
182
183
  - Findings list, if any
183
184
 
184
- - name: commit
185
- description: Finalize the refactoring and create a pull request (the PR portion runs only on the PR path).
185
+ - name: delivery
186
+ description: Deliver the approved checkpoint as a pull request, then complete the task after merge and final gates.
186
187
  recommended_agents:
187
188
  - claude
188
189
  - human
189
190
  tasks:
190
- - Ensure all tests pass
191
- - Write a clear commit message explaining the refactoring
192
- - Move the task to completed
191
+ - Verify the current HEAD still equals the approved checkpoint
192
+ - Confirm the task-bound delivery remote and base branch remain valid
193
+ - Move the task to completed after PR merge and final gates
193
194
  pr_tasks:
194
195
  - Create a pull request with detailed changes
195
196
  - Link the PR to the related Issue
196
197
  inputs:
197
- - Final refactoring branch
198
+ - Approved local checkpoint
198
199
  - Task workspace
199
200
  outputs:
200
- - Completed task workspace under .agents/workspace/completed/
201
201
  - Pull request (only on the PR path)
202
+ - Completed task workspace under .agents/workspace/completed/ after merge and final gates
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # 注:步骤中的 `pr_tasks` 列表按「走 PR 路径」判定是否计入工作流进度:
5
5
  # `.agents/.airc.json:prFlow="required"` 始终计入;`prFlow="disabled"` 不计入;
6
- # 字段缺省时仅当 task.md 的 `pr_status=skipped` 排除,否则计入(详见 .agents/skills/complete-task/SKILL.md)。
6
+ # 字段缺省时仅当 task.md 的 `pr_delivery_fact.state=skipped` 排除,否则计入(详见 .agents/skills/complete-task/SKILL.md)。
7
7
 
8
8
  name: refactoring
9
9
  description: 安全且结构化的代码重构工作流。
@@ -127,6 +127,7 @@ steps:
127
127
  - 每步后验证测试通过
128
128
  - 修复最新 code-review 产物中要求处理的问题(如处于修复模式)
129
129
  - 更新受影响的文档或注释
130
+ - 测试通过后创建本地 checkpoint commit
130
131
  - 确保代码遵循项目规范
131
132
  inputs:
132
133
  - 已通过审查的重构计划
@@ -180,21 +181,21 @@ steps:
180
181
  - 代码审查报告
181
182
  - 问题列表(如有)
182
183
 
183
- - name: commit
184
- description: 最终确认重构并创建拉取请求(PR 部分仅在走 PR 路径时执行)。
184
+ - name: delivery
185
+ description: 将已审查的 checkpoint 交付为 PR,并在合并及最终门禁通过后完成任务。
185
186
  recommended_agents:
186
187
  - claude
187
188
  - human
188
189
  tasks:
189
- - 确保所有测试通过
190
- - 编写清晰的提交信息说明重构内容
191
- - 将任务移至已完成
190
+ - 验证当前 HEAD 仍等于已审查的 checkpoint
191
+ - 确认任务绑定的交付 remote 和目标分支仍有效
192
+ - 在 PR 合并及最终门禁通过后将任务移至已完成
192
193
  pr_tasks:
193
194
  - 创建包含详细变更描述的拉取请求
194
195
  - 将 PR 关联到相关 Issue
195
196
  inputs:
196
- - 最终重构分支
197
+ - 已审查的本地 checkpoint
197
198
  - 任务文件
198
199
  outputs:
199
- - 已完成的任务文件(位于 .agents/workspace/completed/)
200
200
  - 拉取请求(仅走 PR 路径时)
201
+ - 已完成的任务文件(PR 合并和最终门禁通过后)
@@ -1,14 +0,0 @@
1
- # Issue Creation
2
-
3
- > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
-
5
- After `create-task` writes task.md, create and initialize the Issue through declarative internal intents:
6
-
7
- ```bash
8
- agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
9
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
10
- ```
11
-
12
- The core reads only persisted task identity, title, type, description, and requirements, and reuses deterministic `ai task issue-body` rendering. It owns template selection, upstream/capabilities, duplicate prevention, POST outcome boundaries, response validation, and atomic `issue_number` binding.
13
-
14
- `planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2. Callers must not fall back to direct `gh issue` or GraphQL orchestration.
@@ -1,27 +0,0 @@
1
- # Issue 创建
2
-
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
-
5
- 当 `create-task` 完成本地 `task.md` 落盘后,通过声明式内部命令创建 Issue:
6
-
7
- ```bash
8
- agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
9
- ```
10
-
11
- 命令只从已落盘 task.md 读取身份、标题、类型、描述与需求,并复用 `ai task issue-body` 的确定性正文渲染。它负责模板选择、upstream/capability、已有绑定检查、非幂等 POST 边界、响应身份校验及通过任务写入内核回写 `issue_number`。
12
-
13
- 创建后的初始元数据使用同一适配层同步:
14
-
15
- ```bash
16
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} \
17
- --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
18
- ```
19
-
20
- ## 结果处理
21
-
22
- - `planned|applied|no-op|degraded`:exit 0;调用方按 operations 继续评论同步。
23
- - `failed`:exit 1;调用方登记 `ISSUE_CREATE_FAILED` warning,不伪造绑定。
24
- - `blocked`:exit 2;认证、网络或创建 outcome 不确定,调用方保留远端 identity 证据并停止盲目重试。
25
- - 已绑定有效 Issue 时只验证绑定并返回 no-op,绝不重复创建。
26
-
27
- 自定义或空平台返回 no-op/degraded;调用方不得回退到直接 `gh issue` 或 GraphQL 编排。
@@ -1,34 +0,0 @@
1
- # PR Platform Intents
2
-
3
- > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
-
5
- PR lookup, creation, binding, and metadata synchronization go through typed internal intents. Skills decide branches and write titles/bodies; they do not assemble platform commands.
6
-
7
- ## Inspect
8
-
9
- ```bash
10
- agent-infra-internal platform-pr inspect {task-id}
11
- ```
12
-
13
- ## Create or recover
14
-
15
- ```bash
16
- agent-infra-internal platform-pr create {task-id} \
17
- --agent {standard-agent-token} --base {target-branch} --head {current-branch} \
18
- --title-file {title-file} --body-file {body-file}
19
- ```
20
-
21
- The core performs exact upstream/head/base lookup. One match is reused, zero creates, and multiple matches fail closed. Unknown create outcomes are reconciled by exact identity. `--dry-run` returns only the plan.
22
-
23
- ## Bind and synchronize
24
-
25
- ```bash
26
- agent-infra-internal platform-pr bind {task-id} --pr {pr-number} --agent {standard-agent-token}
27
-
28
- agent-infra-internal platform-pr sync {task-id} \
29
- --agent {standard-agent-token} --metadata --closing-issue
30
- ```
31
-
32
- Conflicting bindings do not change `task.md`. Metadata comes from the linked Issue, permission-bound items degrade independently, and an already-created PR is never rolled back.
33
-
34
- Statuses `planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2.
@@ -1,49 +0,0 @@
1
- # PR 平台意图命令
2
-
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
-
5
- PR 资源的定位、创建、绑定和元数据同步统一通过 typed internal intent;SKILL 只负责决定分支、标题、正文和调用时机,不直接拼装平台命令。
6
-
7
- ## 定位
8
-
9
- ```bash
10
- agent-infra-internal platform-pr inspect {task-id}
11
- ```
12
-
13
- 返回已绑定 PR 的规范身份;未绑定时返回 `PR_NOT_LINKED`。调用方不得按标题模糊匹配。
14
-
15
- ## 创建或恢复
16
-
17
- 调用方把标题和正文分别写入临时文件,然后执行:
18
-
19
- ```bash
20
- agent-infra-internal platform-pr create {task-id} \
21
- --agent {standard-agent-token} --base {target-branch} --head {current-branch} \
22
- --title-file {title-file} --body-file {body-file}
23
- ```
24
-
25
- core 会先按 upstream、head 和 base 精确定位;唯一既有 PR 会复用并绑定,零个才创建,多个稳定失败。远端结果未知时重新精确定位,不盲重建。`--dry-run` 只返回计划。
26
-
27
- ## 显式绑定
28
-
29
- ```bash
30
- agent-infra-internal platform-pr bind {task-id} --pr {pr-number} --agent {standard-agent-token}
31
- ```
32
-
33
- 冲突绑定稳定失败且不修改 `task.md`。
34
-
35
- ## 元数据同步
36
-
37
- ```bash
38
- agent-infra-internal platform-pr sync {task-id} \
39
- --agent {standard-agent-token} --metadata --closing-issue
40
- ```
41
-
42
- core 从关联 Issue 复制 type / `in:` labels、assignee、具体 milestone,并确保 closing association。权限不足返回逐项 `skipped` 和顶层 `degraded`;不得反向修改 Issue。
43
-
44
- ## 状态语义
45
-
46
- - `planned|applied|no-op|degraded`:退出码 0。
47
- - `failed`:退出码 1,确定性输入或远端错误。
48
- - `blocked`:退出码 2,网络、认证或结果未知,需要人工介入或安全重跑。
49
- - 创建后摘要或元数据同步失败不得回滚 PR;调用方按所属 SKILL 记录 warning。
@@ -1,40 +0,0 @@
1
- # Issue Sync
2
-
3
- > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
-
5
- ## Marker Registry
6
-
7
- | Key | Marker |
8
- |---|---|
9
- | `task` | `<!-- sync-issue:{task-id}:task -->` |
10
- | `artifact` | `<!-- sync-issue:{task-id}:{artifact-stem} -->` |
11
- | `artifactChunk` | `<!-- sync-issue:{task-id}:{artifact-stem}:{part}/{total} -->` |
12
- | `summary` | `<!-- sync-issue:{task-id}:summary -->` |
13
- | `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
14
-
15
- `pr-review` content is synced only as an Issue artifact comment (via the `artifact` / `artifactChunk` markers) and is never a `restore-task` recovery source; restore still accepts only an Issue number and reads only registered Issue markers, with no PR source.
16
-
17
- Comments use `platform-comment`; Issue resources use `platform-issue`:
18
-
19
- ```bash
20
- agent-infra-internal platform-issue inspect {task-id}
21
- agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
22
- agent-infra-internal platform-issue bind {task-id} --issue {number} --agent {standard-agent-token}
23
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
24
- ```
25
-
26
- The core owns status/in labels, assignees, milestones, Issue Type, pinned fields, requirements, state, capabilities, dry-run, retries, errors, and idempotency. Omitted flags preserve values; `none` explicitly clears them. Status labels converge to at most one, and ambiguous requirement identity fails closed.
27
-
28
- `planned|applied|no-op|degraded` exit 0; `failed` exits 1; `blocked` exits 2.
29
-
30
- Map material degraded/failed/blocked results to workflow warnings through the structured intent; callers must not edit warning rows directly:
31
-
32
- ```bash
33
- agent-infra-internal task-warning {task-id} add \
34
- --step issue-sync --severity {severity} --code {code} \
35
- --target {target} --message {message} --action {action}
36
- ```
37
-
38
- ## Backfill
39
-
40
- During completion, artifact comments are replayed with `--kind artifact --artifact <file> --backfill`. If the remote Issue has no matching marker, the core creates a comment with a historical-backfill notice. If a valid base or chunk marker set already exists, the core returns `no-op` and preserves the existing bodies and chunks. Marker conflicts still fail without writes.
@@ -1,76 +0,0 @@
1
- # Issue 同步规则
2
-
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
-
5
- ## Marker 注册表
6
-
7
- 以下 key 及格式是 Issue 评论身份的兼容契约;调用方只传 key/资源,不自行拼 marker。
8
-
9
- | Key | Marker |
10
- |---|---|
11
- | `task` | `<!-- sync-issue:{task-id}:task -->` |
12
- | `artifact` | `<!-- sync-issue:{task-id}:{artifact-stem} -->` |
13
- | `artifactChunk` | `<!-- sync-issue:{task-id}:{artifact-stem}:{part}/{total} -->` |
14
- | `summary` | `<!-- sync-issue:{task-id}:summary -->` |
15
- | `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
16
-
17
- `prSummary` 属于 `.agents/rules/pr-sync.md`,本规则不实现 PR 聚合。
18
-
19
- `pr-review` 原文只通过 `artifact` / `artifactChunk` marker 同步为 Issue artifact 评论,不作为 `restore-task` 恢复来源;恢复仍只接受 Issue 编号并只读注册的 Issue marker,不新增 PR 来源。
20
-
21
- ## 平台 intent
22
-
23
- GitHub upstream、认证、capability、分页、marker 查找、幂等 create/update、分片、重试与错误分类由 typed platform core 统一处理:
24
-
25
- ```bash
26
- agent-infra-internal platform-context resolve [--cwd <path>]
27
- agent-infra-internal platform-comment list --issue <N> [--cwd <path>]
28
- agent-infra-internal platform-comment owner <task-ref>
29
- agent-infra-internal platform-comment sync <task-ref> \
30
- --kind task|artifact|summary|cancel --agent {standard-agent-token} \
31
- [--artifact <canonical.md>] [--body-file <path|->] [--backfill]
32
- ```
33
-
34
- - `applied|no-op|degraded` → exit 0;`failed` → exit 1;`blocked` → exit 2。
35
- - task 评论保持 `<details>` frontmatter 可逆格式;artifact 原文内联并在超过 profile 上限时使用 `artifactChunk`。
36
- - 相同 intent 重放必须收敛为 `no-op`;重复 marker 返回 `COMMENT_MARKER_CONFLICT` 且不写入。
37
- - 外部贡献者锁定统一使用 `platform-comment owner`;不同作者且无 triage 时返回 `COMMENT_OWNER_CONFLICT`。
38
-
39
- ## 降级与告警
40
-
41
- 平台结果不直接写 task.md。调用方在有关联任务时把关键失败映射为 workflow warning:
42
-
43
- - capability 不足:`IMPORTANT / PERMISSION_DEGRADED`
44
- - 评论同步永久失败:`ACTION_REQUIRED / COMMENT_SYNC_FAILED`
45
- - 网络重试耗尽:`ACTION_REQUIRED / NETWORK_RETRY_EXHAUSTED`
46
-
47
- 使用 `agent-infra-internal task-warning {task-id} add ...` 登记;不得手写 warning 表。
48
-
49
- ```bash
50
- agent-infra-internal task-warning {task-id} add \
51
- --step issue-sync --severity {severity} --code {code} \
52
- --target {target} --message {message} --action {action}
53
- ```
54
-
55
- ## Issue 元数据 intent
56
-
57
- 所有 Issue 元数据写入统一使用:
58
-
59
- ```bash
60
- agent-infra-internal platform-issue inspect {task-id}
61
- agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
62
- agent-infra-internal platform-issue bind {task-id} --issue {number} --agent {standard-agent-token}
63
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
64
- ```
65
-
66
- `sync` 支持 status/in labels、assignee、milestone、Issue Type、pinned fields、需求复选框与 Issue state。省略 flag 表示 preserve,`none` 表示显式清空。适配层统一处理集合差集、动态 schema、权限降级、dry-run、重试、错误分类与幂等重放;SKILL 不得拼装 `gh issue`、GraphQL 或权限分支。
67
-
68
- - `planned|applied|no-op|degraded` → exit 0
69
- - `failed` → exit 1
70
- - `blocked` → exit 2
71
-
72
- status labels 始终至多一个;关闭后不保留 status label。`in:` labels 只从项目允许映射与仓库实际 labels 交集产生。需求复选框以 task.md 原文为身份,歧义时 fail closed。
73
-
74
- ## 补发
75
-
76
- complete-task 按 artifact catalog 时间线遍历本地已有产物:task 使用 `--kind task`,其余使用 `--kind artifact --artifact <file> --backfill`;最后用 `--kind summary --body-file <path>` 原地同步交付摘要。artifact backfill 在远端缺少 marker 时创建带“历史产物补发”提示的评论;已存在合法 marker 集合时保持原评论和分片不变并返回 `no-op`;marker 冲突仍失败。该判定由 core 完成,不由 Skill 扫描评论或拼标题。
@@ -1,60 +0,0 @@
1
- # Label / Milestone Platform Commands
2
-
3
- Read this file before initializing labels, initializing milestones, or adjusting milestones during release work.
4
-
5
- ## Authentication and Repository Info
6
-
7
- ```bash
8
- gh auth token
9
- gh repo view --json nameWithOwner --jq '.nameWithOwner'
10
- ```
11
-
12
- ## Label Operations
13
-
14
- List existing labels:
15
-
16
- ```bash
17
- gh label list --limit 200 --json name --jq '.[].name'
18
- ```
19
-
20
- Create or update a label:
21
-
22
- ```bash
23
- gh label create "{name}" --color "{color}" --description "{description}" --force
24
- ```
25
-
26
- ## Milestone Operations
27
-
28
- List milestones:
29
-
30
- ```bash
31
- gh api "repos/$repo/milestones?state=all" --paginate
32
- ```
33
-
34
- Create a milestone:
35
-
36
- ```bash
37
- gh api "repos/$repo/milestones" -f title="{title}" -f description="{description}" -f state="{state}"
38
- ```
39
-
40
- Update a milestone:
41
-
42
- ```bash
43
- gh api "repos/$repo/milestones/{number}" -X PATCH -f state="{state}" -f description="{description}"
44
- ```
45
-
46
- ## Error Prompt Templates
47
-
48
- Use these normalized prompts when the GitHub setup scripts fail:
49
-
50
- | Condition | Prompt |
51
- |---|---|
52
- | CLI missing | GitHub CLI (`gh`) is not installed |
53
- | Authentication failed | `GitHub CLI is not authenticated` |
54
- | API rate limit | `GitHub API rate limit reached, please retry later` |
55
-
56
- ## Constraints
57
-
58
- - use label names as the idempotency key
59
- - use milestone titles as the idempotency key, then milestone numbers when patching state
60
- - stop or skip according to the calling skill when commands fail
@@ -1,60 +0,0 @@
1
- # Label / Milestone 平台命令
2
-
3
- 在初始化 label、初始化 milestone,或发布流程需要调整 milestone 前先读取本文件。
4
-
5
- ## 认证与仓库信息
6
-
7
- ```bash
8
- gh auth token
9
- gh repo view --json nameWithOwner --jq '.nameWithOwner'
10
- ```
11
-
12
- ## Label 操作
13
-
14
- 列出现有 label:
15
-
16
- ```bash
17
- gh label list --limit 200 --json name --jq '.[].name'
18
- ```
19
-
20
- 创建或更新 label:
21
-
22
- ```bash
23
- gh label create "{name}" --color "{color}" --description "{description}" --force
24
- ```
25
-
26
- ## Milestone 操作
27
-
28
- 列出 milestone:
29
-
30
- ```bash
31
- gh api "repos/$repo/milestones?state=all" --paginate
32
- ```
33
-
34
- 创建 milestone:
35
-
36
- ```bash
37
- gh api "repos/$repo/milestones" -f title="{title}" -f description="{description}" -f state="{state}"
38
- ```
39
-
40
- 更新 milestone:
41
-
42
- ```bash
43
- gh api "repos/$repo/milestones/{number}" -X PATCH -f state="{state}" -f description="{description}"
44
- ```
45
-
46
- ## 错误提示模板
47
-
48
- GitHub 初始化脚本失败时使用以下标准提示:
49
-
50
- | 条件 | 提示 |
51
- |---|---|
52
- | CLI 缺失 | GitHub CLI (`gh`) is not installed |
53
- | 认证失败 | `GitHub CLI is not authenticated` |
54
- | API 限流 | `GitHub API rate limit reached, please retry later` |
55
-
56
- ## 约束
57
-
58
- - label 以名称作为幂等键
59
- - milestone 以标题作为幂等键,必要时再结合编号更新状态
60
- - 失败时按调用方规则决定停止或跳过
@@ -1,15 +0,0 @@
1
- # Milestone Inference
2
-
3
- > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
-
5
- Milestones narrow through declarative Issue intents:
6
-
7
- ```bash
8
- # create/import phase
9
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
10
-
11
- # code phase
12
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
13
- ```
14
-
15
- `initial` prefers a valid task milestone, otherwise the lowest open `X.Y.x`, then `General Backlog`. `specific` narrows a release line to the highest open patch version using main/release-line ancestry. Missing facts or triage permission preserve the remote value and return skipped/degraded. `create-pr` reuses the Issue milestone in the 09/10 PR adapter.
@@ -1,27 +0,0 @@
1
- # Milestone 推断规则
2
-
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
-
5
- Milestone 继续按生命周期逐步收窄,但候选读取、分支判断、权限降级和写入统一由 `platform-issue` 处理。
6
-
7
- ## 阶段 1:创建或导入
8
-
9
- ```bash
10
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
11
- ```
12
-
13
- 优先使用 task.md 中存在且有效的显式 milestone;否则从 open milestones 选择最低 `X.Y.x` 版本线,最后回退 `General Backlog`。`triage=false` 或外部事实不足时保持远端值并返回 skipped/degraded。
14
-
15
- ## 阶段 2:`code-task`
16
-
17
- ```bash
18
- agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
19
- ```
20
-
21
- 版本线收窄规则保持不变:主干模式在当前版本线取最高 patch;多版本分支模式依据 release-line/main 祖先关系选择版本线。无法可靠判断时保持原值。完成门禁仍拒绝 `X.Y.x`。
22
-
23
- ## 阶段 3:`create-pr`
24
-
25
- PR 只复用关联 Issue 的具体 milestone;该 PR 资源写入属于 09/10,不在 `platform-issue` 中实现。
26
-
27
- 调用方不得重新实现 milestone 列表、排序、分支祖先或 `gh issue edit` 逻辑。
@@ -1,18 +0,0 @@
1
- # GitHub PR Readiness Intents
2
-
3
- The GitHub adapter requires `gh >= 2.72.0`. Platform context checks this dependency before any GitHub API, PR, or checks operation. Projects that do not select GitHub neither probe nor depend on `gh`.
4
-
5
- ```bash
6
- agent-infra-internal platform-checks inspect {task-id}
7
-
8
- agent-infra-internal platform-checks watch {task-id} \
9
- --interval-seconds 30 --deadline-seconds 1800
10
-
11
- agent-infra-internal platform-checks resolve-run {task-id} \
12
- --check-name {check-name} [--details-url {details-url}]
13
-
14
- agent-infra-internal platform-checks logs {task-id} \
15
- --run {run-id} [--job {job-id}]
16
- ```
17
-
18
- The adapter normalizes REST `mergeable=false` to `conflicting`, null/missing to `unknown`, and true to `mergeable`; `mergeable=true` plus diagnostic `dirty` is contradictory and becomes `unknown`. Other diagnostics such as `blocked` do not override REST true. Core combines that fact with all checks for one `headSha`: only `ready` exits 0, `conflicting|checks-failed` exit 1, and pending/timeout/cancel/network blocking exit 2. Dependency and deterministic platform errors are preserved without degradation.
@@ -1,34 +0,0 @@
1
- # GitHub PR readiness 平台意图
2
-
3
- PR 全部 checks 的获取、轮询 deadline、失败 run/job 定位和日志获取统一由 typed internal intent 执行。SKILL/模型只负责失败分类、根因分析、最小修复和授权后的提交推送。
4
-
5
- GitHub adapter 要求 `gh >= 2.72.0`。平台上下文会在任何 GitHub API、PR 或 checks 操作前检查该依赖;未选择 GitHub 平台时不探测也不依赖 `gh`。
6
-
7
- ## 快照与监控
8
-
9
- ```bash
10
- agent-infra-internal platform-checks inspect {task-id}
11
-
12
- agent-infra-internal platform-checks watch {task-id} \
13
- --interval-seconds 30 --deadline-seconds 1800
14
- ```
15
-
16
- adapter 把 REST `mergeable=false` 规范化为 `conflicting`,null/缺失为 `unknown`,true 为 `mergeable`;true 与诊断 `dirty` 矛盾时降为 `unknown`。`blocked` 等其他诊断不覆盖 REST true。core 在同一 `headSha` 上与全部 checks 聚合:仅 `ready` 退出 0,`conflicting|checks-failed` 退出 1,pending/timeout/cancel/网络阻塞退出 2。依赖与确定性平台错误不降级。
17
-
18
- ## 定位失败 run/job
19
-
20
- ```bash
21
- agent-infra-internal platform-checks resolve-run {task-id} \
22
- --check-name {check-name} [--details-url {details-url}]
23
- ```
24
-
25
- core 优先验证详情链接;否则按 PR head SHA 与 exact check name 查询。零个或多个候选均 fail closed,不选择其他 run。
26
-
27
- ## 获取失败日志
28
-
29
- ```bash
30
- agent-infra-internal platform-checks logs {task-id} \
31
- --run {run-id} [--job {job-id}]
32
- ```
33
-
34
- 日志结果保真返回;缺失、权限、网络和资源不存在使用稳定错误码区分。平台 intent 不修改业务代码、不测试、不提交也不推送。
@@ -1,43 +0,0 @@
1
- # PR Summary Synchronization
2
-
3
- > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
-
5
- The model writes the semantic reviewer summary. Typed core owns canonical artifact selection, marker/HEAD wrapping, paginated comment lookup, and reconciliation.
6
-
7
- ## Three-Layer Isolation
8
-
9
- - `sync-pr:{task-id}:summary` (`platform-pr summary-sync`) is an updatable reviewer summary; it is neither a process copy nor a formal Review.
10
- - The full `pr-review*` process copy lives in the Issue artifact comment (`platform-comment sync --kind artifact`) and is restored by `restore-task` under its Issue-only contract.
11
- - A formal PR Review (`platform-pr-review publish`) is the only formal conclusion carrier published to the PR, bound to the reviewed head SHA, and includes conclusion, findings, receipt, and the Issue artifact link.
12
-
13
- The three never cross: a regular PR comment does not carry the full process copy; an Issue artifact comment is not treated as a formal Review; a summary is not presented as a formal Review.
14
-
15
- ```bash
16
- agent-infra-internal platform-pr summary-context {task-id}
17
-
18
- agent-infra-internal platform-pr summary-sync {task-id} \
19
- --agent {standard-agent-token} --body-file {summary-body-file}
20
- ```
21
-
22
- Use only canonical inputs returned by the context command. Write the plain body without marker or SHA. The core owns `<!-- sync-pr:{task-id}:summary -->`, current `<!-- last-commit: ... -->`, create/update/no-op behavior, and duplicate-marker conflicts. Summary failure never rolls back a PR or commit.
23
-
24
- The canonical comment envelope produced by the core is:
25
-
26
- ```markdown
27
- <!-- sync-pr:{task-id}:summary -->
28
- <!-- last-commit: {git-head-sha} -->
29
- ## Review Summary
30
- {manual-validation-section}
31
- ### Key Technical Decisions
32
- ### Review History
33
- ### Test Results
34
- ### PR Code Changes
35
- ```
36
-
37
- Canonical inputs include `manual-validation.md`. The manual-validation section is one of `### ✅ Manual Validation Passed`, `### ⚠️ Manual Verification Required`, or `### ✅ No Manual Verification Needed`; `complete-manual-validation` refreshes the same summary in place. The PR code-change section uses authoritative base/head facts from `platform-pr inspect` and the complete `git diff --find-renames --numstat base...head`, reconciles runtime, test, skill/rule, template, documentation, and other categories, and explains renames, mechanical mirrors, and potentially unnecessary changes.
38
-
39
- ```bash
40
- agent-infra-internal task-warning {task-id} add --step {step} --severity WARNING \
41
- --code COMMENT_SYNC_FAILED --target pr-summary --message "{reason}" \
42
- --action "Restore comment permission or connectivity and rerun this step"
43
- ```