@fitlab-ai/agent-infra 0.12.0 → 0.12.1

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 (46) hide show
  1. package/dist/lib/internal/manual-validation.js +11 -17
  2. package/dist/lib/internal/platform-comment.js +56 -7
  3. package/dist/lib/platform/issue-comments.js +373 -267
  4. package/dist/lib/platform/issue-summary-content.js +112 -0
  5. package/dist/lib/platform/pr-change-report.js +175 -26
  6. package/dist/lib/platform/pr-summary-content.js +54 -0
  7. package/dist/lib/platform/pr-summary.js +318 -284
  8. package/dist/lib/platform/summary-content-pipeline.js +18 -0
  9. package/dist/lib/sandbox/removal.js +59 -2
  10. package/dist/lib/task/finalization.js +16 -7
  11. package/dist/lib/task/platform-operation-recovery.js +87 -87
  12. package/dist/lifecycle-build-manifest.json +3 -3
  13. package/lib/internal/manual-validation.ts +12 -18
  14. package/lib/internal/platform-comment.ts +46 -4
  15. package/lib/platform/issue-comments.ts +478 -280
  16. package/lib/platform/issue-summary-content.ts +132 -0
  17. package/lib/platform/pr-change-report.ts +165 -20
  18. package/lib/platform/pr-summary-content.ts +60 -0
  19. package/lib/platform/pr-summary.ts +364 -257
  20. package/lib/platform/summary-content-pipeline.ts +23 -0
  21. package/lib/sandbox/removal.ts +57 -1
  22. package/lib/task/finalization.ts +11 -6
  23. package/lib/task/platform-operation-recovery.ts +70 -81
  24. package/package.json +1 -1
  25. package/templates/.agents/rules/pr-sync.en.md +4 -2
  26. package/templates/.agents/rules/pr-sync.zh-CN.md +6 -9
  27. package/templates/.agents/skills/cancel-task/SKILL.en.md +1 -1
  28. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +1 -1
  29. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  30. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  31. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +2 -2
  32. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +2 -2
  33. package/templates/.agents/skills/complete-task/SKILL.en.md +10 -25
  34. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +11 -26
  35. package/templates/.agents/skills/create-pr/SKILL.en.md +1 -1
  36. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +1 -1
  37. package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -2
  38. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -2
  39. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -2
  40. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -2
  41. package/templates/.agents/skills/create-task/SKILL.en.md +0 -18
  42. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +0 -18
  43. package/templates/.agents/skills/watch-pr/SKILL.en.md +1 -1
  44. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +1 -1
  45. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +3 -3
  46. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +3 -3
@@ -18,8 +18,7 @@ description: >
18
18
 
19
19
  生成收尾报告或同步内容时,先读取 `.agents/rules/evidence-reporting.md`。成功检查记录命令、范围、状态/结构化结果、实际结果和未覆盖部分;失败、阻塞或争议保留复现入口、准确位置和决定性摘录。
20
20
 
21
- - 本命令更新任务元数据并物理移动任务目录
22
- - 除非强制执行,不要转移有未完成工作流步骤的任务
21
+ - 本命令由宿主更新任务元数据并原子移动任务目录
23
22
  - 入口接受可选 `--external-pr <N>`;仅用于外部交付候选歧义时的显式选择,不绕过身份或平台门禁
24
23
 
25
24
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -141,9 +140,9 @@ Please satisfy the hard prerequisite first, then retry complete-task.
141
140
  如果存在有效的 `platform_issue_identity`,严格按以下顺序执行:
142
141
 
143
142
  1. 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --requirements --fields`。
144
- 2. 把业务摘要写入临时文件,并调用 `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`。该命令把正文和 SHA-256 写入 task 目录的 durable staging record;本步骤不得直接发布 summary 评论。
143
+ 2. 把完成摘要字段写成 JSON 临时文件,并调用 `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`。字段为 `taskId`、`title`、`summary`、`artifacts`、`verification:{state,detail}`;`taskId` 必须是当前完整任务 ID,`title` 来自 task.md,`artifacts` 来自当前 artifact registry(无产物用 `[]`)。验证尚未执行时写 `state:"not-run"` 和非空说明,不等待之后的终态事件或最终验证。命令把规范 payload 与摘要写入 durable staging record;本步骤不得直接发布 summary 评论。
145
144
 
146
- 摘要正文只记录当前任务证据能够支持的交付结果、关联 PR 与实际合入事实、验证命令及其范围/结果/未覆盖部分,以及已知待办;需要说明验证范围时可注明对应提交。没有证据支持的事实不推断,未完成事项写入待办。这是 Issue 收尾摘要,不是 PR 留言。
145
+ `summary` 字段只记录当前任务证据能够支持的交付结果、关联 PR 与实际合入事实、验证命令及其范围/结果/未覆盖部分,以及已知待办;需要说明验证范围时可注明对应提交。没有证据支持的事实不推断,未完成事项写入待办。这是 Issue 收尾摘要,不是 PR 留言。
147
146
 
148
147
  摘要默认使用当前技能的语言:中文技能生成中文摘要,英文技能生成英文摘要。中英文摘要保持相同字段结构。
149
148
 
@@ -224,32 +223,18 @@ ai sandbox rm {task-id} # 或使用本任务仍保留的短号
224
223
 
225
224
  ## 完成检查清单
226
225
 
227
- - [ ] 验证了所有工作流步骤已完成
228
- - [ ] 更新了 task.md 的完成状态和时间戳
229
- - [ ] 将任务目录移动到 `<task-workspace>/completed/`
230
- - [ ] 验证了转移成功
231
- - [ ] 告知了用户完成情况
226
+ - [ ] 满足了硬性前置条件并通过预完成门禁
227
+ - [ ] 宿主 finalization 返回 `result=completed` 或 `result=completed_with_warnings`
228
+ - [ ] 完成校验通过
229
+ - [ ] 已向用户报告结构化完成结果和适用的警告
232
230
 
233
231
  ## 注意事项
234
232
 
235
- 1. **过早完成**:不要转移有未完成步骤的任务。未完成的情况示例:
236
- - 代码已编写但未提交
237
- - 代码已提交但未审查
238
- - 审查发现阻塞项但未修复
239
- - PR 已创建但未合并
240
- - 人工校验项未完成
241
-
242
- 2. **回滚**:如果任务被错误转移:
243
- ```bash
244
- mv <task-workspace>/completed/{task-id} <task-workspace>/active/{task-id}
245
- ```
246
- 然后将 task.md 中的状态改回 `active`。
247
-
248
- 3. **多贡献者**:如果多个 AI 代理参与了任务,确保所有贡献都已提交后再完成。
233
+ - 如果多个 AI 代理参与任务,确保所有贡献都包含在本地 checkpoint 中。
249
234
 
250
235
  ## 错误处理
251
236
 
252
237
  - 任务未找到:提示 "Task {task-id} not found in active directory"
253
- - 已完成:提示 "Task {task-id} is already in completed directory"
254
- - 任务被阻塞:提示 "Task {task-id} is blocked. Unblock it first by moving to active/"
255
- - 移动失败:提示错误并建议手动移动
238
+ - 已完成:仅当存在匹配的 Complete Task Activity Log 时进入 `finalization-retry`;否则说明终态身份不完整并停止
239
+ - 任务被阻塞:满足记录的解除条件后,通过 `task-lifecycle activate` 恢复任务,再重试
240
+ - finalization 失败或阻塞:保留源数据和 receipt,根据结构化错误通过同一 finalization 入口恢复;不要手工改写终态或移动任务目录
@@ -86,7 +86,7 @@ The core renderer owns the report section. It is part of the reviewer summary be
86
86
 
87
87
  Read the latest context artifacts when they exist: `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md`.
88
88
 
89
- Aggregate a reviewer-facing summary from those artifacts with exactly one `<!-- canonical-pr-change-report -->` placeholder, and maintain a single idempotent summary comment via the hidden marker. Pass `--change-report-file <task-workspace>/active/{task-id}/pr-change-report.json` and the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
89
+ Assemble a structured reviewer summary JSON from those artifacts with overview, tests, review, manual validation, open decisions, and risks. Report valid not-started states honestly; do not include later validation or event results in advance. Maintain one idempotent summary comment via the hidden marker; the core renderer generates the fixed summary sections and change report. Pass the summary JSON, `--change-report-file <task-workspace>/active/{task-id}/pr-change-report.json`, and the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
90
90
 
91
91
  > Canonical context, aggregation, and the `summary-sync` call live in `reference/comment-publish.md`, which points to `.agents/rules/pr-sync.md`. Read that reference before publishing.
92
92
 
@@ -86,7 +86,7 @@ description: >
86
86
 
87
87
  读取最新的上下文产物:`plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md`、`review-code.md` / `review-code-r{N}.md`(存在时)。
88
88
 
89
- 基于这些产物聚合 reviewer 摘要,正文只放一次 `<!-- canonical-pr-change-report -->` 占位符,再使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时传入 `--change-report-file <task-workspace>/active/{task-id}/pr-change-report.json`,并继续传递同一个 `--result {primary-result}`;不得根据同步子步骤猜测 PR 是创建还是复用。
89
+ 基于这些产物组装结构化 reviewer 摘要 JSON,包含概览、测试、Review、人工校验、待决事项和风险;将合法未启动状态如实传入,不提前写入后续验证或事件结果。使用隐藏标记维护唯一且幂等的摘要评论;核心 renderer 负责生成固定摘要段落和 change report。调用 `summary-sync` 时传入摘要 JSON 与 `--change-report-file <task-workspace>/active/{task-id}/pr-change-report.json`,并继续传递同一个 `--result {primary-result}`;不得根据同步子步骤猜测 PR 是创建还是复用。
90
90
 
91
91
  > canonical context、摘要聚合和 `summary-sync` 调用见 `reference/comment-publish.md`(其引用 `.agents/rules/pr-sync.md`)。发布摘要前先读取该 reference。
92
92
 
@@ -24,9 +24,16 @@ agent-infra-internal platform-pr change-report {task-id} \
24
24
 
25
25
  The core validates the task-intent digest, PR identity, complete patch SHA, totals, and the ordered checks `target-alignment`, `change-composition`, `compatibility-policy`, `legacy-path-cleanup`, `redundancy`, and `scope-discipline`. A `needs-review` check routes to `review-code`; `formalReview` remains `false`.
26
26
 
27
- When generating the candidate, use the six existing `rationale` fields and `Evidence[]` as readable analysis for each logical change group; do not add group fields. For each group, explain its goal and acceptance-criteria alignment, added and removed behavior, necessity, redundancy or duplicate implementation, scope, related tests, and whether the tests are sufficient. Cite paths, line ranges, and concise evidence for the conclusions. Each check must still state its actual finding: `target-alignment` explains the goal relationship, `change-composition` summarizes responsibilities and behavior changes, `compatibility-policy` states the compatibility result, `legacy-path-cleanup` states how legacy paths were handled, `redundancy` states the redundancy result, and `scope-discipline` states the scope judgment. Do not reuse generic boilerplate; mark unsupported conclusions as unconfirmed. Use the deployed skill's language. Chinese skill deployments must use Chinese. The canonical renderer displays every item in each `Evidence[]`.
27
+ Before generating the candidate, list functional change groups from the task goal and complete diff; file responsibilities or category totals are not functional groups. Represent each group as a typed object in the existing `change-composition.groups[]` with `id`, `target`, `behaviorChange`, `necessity`, `files[]`, and `tests:{coverage,cost}`. `rationale` and `Evidence[]` may support the judgment and locations but cannot replace group objects.
28
28
 
29
- Explain applicable production-code, test, and documentation changes for each group. Keep source line changes, execution/call-count changes, and workflow unification distinct. Diff line counts support text changes only; they do not prove fewer executions or a unified workflow. Execution behavior and test adequacy need their own direct evidence. State gaps where evidence is missing. Green CI does not prove necessity or absence of redundancy.
29
+ - `files[]` must reference canonical paths (`oldPath ?? newPath`) from the complete formal diff. A rename remains one mechanical file record with both old and new paths. Assign every formal diff file to exactly one group; do not omit, duplicate, or invent paths.
30
+ - Do not enter group line counts in the candidate. Core derives each group's additions, deletions, and net from the bound formal diff's per-file counts and reconciles group totals with the complete diff. A `null` count stays uncountable; the file still belongs to one group and must not be represented as zero.
31
+ - `Evidence[].detail` may cite relevant code, test, or documentation changes. Use `tests.coverage` and `tests.cost` for existing/new test coverage and fixture/test cost. If no test changed, state why existing coverage is sufficient.
32
+ - List and reconcile complete-PR changes separately from the current head-to-head increment. Do not infer increment values when the previous head is unconfirmed.
33
+
34
+ `target-alignment` passes only when every group maps to a task goal or acceptance criterion. Typed structure, file membership, and derived counts are structural checks; the existing semantic review still decides whether groups, behavior added/removed, necessity, test coverage/cost, and evidence are adequately explained. Missing, contradictory, or unverifiable structure or explanation remains `needs-review`; state the gap so the core routes to `review-code`. Complete structure or green CI does not establish sufficient explanation.
35
+
36
+ State the actual finding for each of the other four checks. Use the deployed skill's language for evidence; Chinese deployments must use Chinese. The canonical renderer displays every rationale and evidence item. Source line counts describe text additions/deletions only; they do not prove execution counts or workflow unification.
30
37
 
31
38
  ## Complete PR and Per-Round Increment
32
39
 
@@ -24,9 +24,16 @@ agent-infra-internal platform-pr change-report {task-id} \
24
24
 
25
25
  core 校验任务意图 digest、PR identity、完整 patch SHA、统计合计和固定顺序的 `target-alignment`、`change-composition`、`compatibility-policy`、`legacy-path-cleanup`、`redundancy`、`scope-discipline`。任一项为 `needs-review` 时路由到 `review-code`,`formalReview` 仍为 `false`。
26
26
 
27
- 生成 candidate 时,按逻辑变化组用六项 `rationale` 和 `Evidence[]` 给出可读分析,不新增组级字段。每组说明其目标/验收对应、行为增加与减少、必要性、冗余或重复实现、范围、对应测试及测试是否充分;列出支撑结论的路径、行号和简短证据。六项检查各自仍须写实际结论:`target-alignment` 说明目标对应关系,`change-composition` 概括职责和行为变化,`compatibility-policy` 说明兼容策略,`legacy-path-cleanup` 说明旧路径处理,`redundancy` 说明重复/冗余结果,`scope-discipline` 说明范围判断。不得复用泛化套话;证据不足的维度明确标记未确认,不推断结论。证据详情遵循当前已部署技能的语言,中文技能必须使用中文。canonical renderer 会完整展示每项 `Evidence[]`。
27
+ 生成 candidate 前,先根据任务目标和完整 diff 列出功能变化组;不得把文件职责概述或类别总数当作功能组。每个功能组作为现有 `change-composition` 检查中的 typed `groups[]` 对象,包含 `id`、`target`、`behaviorChange`、`necessity`、`files[]` 和 `tests:{coverage,cost}`。`rationale`/`Evidence[]` 仅补充判断和定位,不能替代组对象。
28
28
 
29
- 每组解释覆盖生产代码、测试和文档中适用的变化,并区分源码行数变化、执行/调用次数变化和流程统一。diff 行数仅支持代码文本增减;不能据此推断执行次数减少或流程统一。执行次数、流程行为和测试充分性须有各自直接证据;没有证据时明确说明缺口。CI 全绿不能代替必要性或冗余判断。
29
+ - `files[]` 只能引用完整正式 diff 中的 canonical 文件路径(机械报告的 `oldPath ?? newPath`);rename 仍作为一条机械记录保留 old/new 两端。正式 diff 中每个文件必须恰好归入一个组,不得遗漏、重复或引用 diff 外文件。
30
+ - 不要在 candidate 中填写组级行数。core 从绑定的正式 diff 逐文件 additions/deletions 聚合各组的新增、删除和净增,并将各组加总与正式 diff totals 对账。`null` 行数保持不可计数,文件仍需归组且不能改写为零。
31
+ - 每条 `Evidence[].detail` 可引用具体代码、测试或文档变更;`tests.coverage` 与 `tests.cost` 分别说明覆盖风险/已有覆盖依据,以及本次新增 fixture / 测试的成本。没有测试变更时说明现有覆盖依据。
32
+ - 完整 PR 与本轮 head-to-head 增量分别列示和对账;上一 head 未确认时不得推算增量数值。
33
+
34
+ `target-alignment` 只有在每个功能组都能对应任务目标或验收标准时才能判为 `pass`。`change-composition` 的 typed 结构、文件集合和机械计数通过结构校验后,仍须按现有语义判断组别、行为增减、必要性、测试覆盖/成本和证据是否充分;结构或解释缺项、矛盾、无法核实时保持 `needs-review` 并说明缺口,使 core 路由到 `review-code`。不得因结构完整或 CI 通过而自动判定内容充分。
35
+
36
+ 其他四项检查仍分别给出实际结论;证据详情遵循当前已部署技能的语言,中文技能必须使用中文。canonical renderer 会展示全部 rationale 和 evidence。源码行数只说明文本增删;不能据此推断执行次数或流程统一。
30
37
 
31
38
  ## 完整 PR 与本轮增量
32
39
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  After PR creation, run `agent-infra-internal platform-pr summary-context {task-id}` and aggregate the reviewer summary only from its canonical artifacts according to `.agents/rules/pr-sync.md`.
4
4
 
5
- Write the plain summary body, containing exactly one `<!-- canonical-pr-change-report -->` placeholder and no report heading/JSON, marker, or HEAD metadata, to a temporary file, then run:
5
+ Write the PR summary JSON fields from `.agents/rules/pr-sync.md` to a temporary file, then run. The core renderer adds the feature change section from the canonical report:
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
@@ -11,4 +11,4 @@ agent-infra-internal platform-pr summary-sync {task-id} \
11
11
  --result {primary-result}
12
12
  ```
13
13
 
14
- The caller does not add markers, HEAD metadata, report sections, or comment API parameters. The typed core rechecks the task-bound sidecar against the authoritative PR snapshot and renders the report. `--result` is required and must be passed unchanged from `platform-pr create`; `no_op` maps to `no_op_with_warnings` if summary synchronization degrades. Missing/stale/invalid sidecars or body bypasses do not publish, and summary failures do not roll back a created or reused PR.
14
+ The caller does not add markers, HEAD metadata, report sections, or comment API parameters. The typed core validates fields, renders fixed sections, rechecks the task-bound sidecar against the authoritative PR snapshot, then reads back and compares the remote body. `--result` is required and passed unchanged from `platform-pr create`; incomplete structure does not publish, and summary failures do not roll back a created or reused PR.
@@ -2,7 +2,7 @@
2
2
 
3
3
  创建 PR 后先调用 `agent-infra-internal platform-pr summary-context {task-id}`,只根据返回的 canonical 产物按 `.agents/rules/pr-sync.md` 聚合 reviewer 摘要。
4
4
 
5
- 把恰好包含一次 `<!-- canonical-pr-change-report -->` 且不含报告标题/JSON、marker 或 HEAD 元数据的纯摘要正文写入临时文件,再调用:
5
+ 按 `.agents/rules/pr-sync.md` 填写 PR 摘要 JSON 字段(overview、tests、review、manualValidation、humanDecisions、risks),写入临时文件,再调用。功能增减章节由 core renderer 从 canonical report 生成:
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
@@ -11,4 +11,4 @@ agent-infra-internal platform-pr summary-sync {task-id} \
11
11
  --result {primary-result}
12
12
  ```
13
13
 
14
- 调用方不添加 marker、HEAD、报告段或评论 API 参数。typed core 会重新校验任务绑定 sidecar 与权威 PR snapshot 并渲染报告。`--result` 是必填的,必须把 `platform-pr create` 的 `result` 原样传入;sidecar 缺失/过期/非法或正文旁路时不发布,摘要失败沿用该 primary result 映射 warning(`no_op` 对应 `no_op_with_warnings`),不回滚已创建或复用的 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
14
+ 调用方不添加 marker、HEAD、报告段或评论 API 参数。typed core 会校验字段结构、渲染固定章节、重新校验任务绑定 sidecar 与权威 PR snapshot,并在发布后回读比较远端正文。`--result` 是必填的,必须把 `platform-pr create` 的 `result` 原样传入;sidecar 缺失/过期/非法或结构不完整时不发布,摘要失败沿用该 primary result 映射 warning(`no_op` 对应 `no_op_with_warnings`),不回滚已创建或复用的 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
@@ -93,24 +93,6 @@ agent-infra-internal task-create --input "$candidate_file"
93
93
 
94
94
  The host owns TASK-id/timestamps/version, workflow and branch derivation, template rendering, atomic persistence, short ids, Issue sync, and warnings. The skill must not create task directories, copy templates, allocate short ids, or call platform subcommands directly.
95
95
 
96
- Task metadata (`task.md` YAML front matter):
97
- ```yaml
98
- id: TASK-{yyyyMMdd-HHmmss}
99
- type: feature|bugfix|refactor|docs|chore
100
- branch: <project>-<type>-<slug>
101
- workflow: feature-development|bug-fix|refactoring
102
- status: active
103
- created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
104
- updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
105
- agent_infra_version: {agent_infra_version}
106
- priority: # required; inferred by the AI from the title/description; Urgent | High | Medium | Low
107
- effort: # required; inferred by the AI from the title/description; High | Medium | Low
108
- start_date: # optional; YYYY-MM-DD
109
- target_date: # optional; YYYY-MM-DD
110
- current_step: requirement-analysis
111
- assigned_to: {current AI agent}
112
- ```
113
-
114
96
  priority / effort are required: the AI infers them from the task title and description (candidates in `.agents/rules/issue-fields.md`; normalize localized input). Leave start_date / target_date empty at creation: `start_date` is written by the analyze stage and `target_date` by the complete stage; do not invent dates.
115
97
 
116
98
  ### 3. Handle the Structured Result
@@ -92,24 +92,6 @@ agent-infra-internal task-create --input "$candidate_file"
92
92
 
93
93
  宿主负责 TASK-id/时间戳/版本戳、workflow/branch 派生、模板渲染、原子持久化、短号、Issue 与 warning。技能不得自行 `mkdir`、复制任务模板、分配短号或直接调用平台子命令。
94
94
 
95
- 任务元数据(task.md YAML front matter):
96
- ```yaml
97
- id: TASK-{yyyyMMdd-HHmmss}
98
- type: feature|bugfix|refactor|docs|chore
99
- branch: <project>-<type>-<slug>
100
- workflow: feature-development|bug-fix|refactoring
101
- status: active
102
- created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
103
- updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
104
- agent_infra_version: {agent_infra_version}
105
- priority: # 必填;由 AI 从标题/描述推断;Urgent | High | Medium | Low
106
- effort: # 必填;由 AI 从标题/描述推断;High | Medium | Low
107
- start_date: # 可选;YYYY-MM-DD
108
- target_date: # 可选;YYYY-MM-DD
109
- current_step: requirement-analysis
110
- assigned_to: {当前 AI 代理}
111
- ```
112
-
113
95
  priority / effort 必填:由 AI 从任务标题与描述推断后填入(候选值见 `.agents/rules/issue-fields.md`;中文输入按本地化映射规范化)。start_date / target_date 创建时保持留空:`start_date` 由 analyze 阶段写入、`target_date` 由 complete 阶段写入;不要臆测日期。
114
96
 
115
97
  ### 3. 处理结构化结果
@@ -61,7 +61,7 @@ process.stdout.write(`${JSON.stringify(previous)}\n`);
61
61
  ' {task-id}
62
62
  ```
63
63
 
64
- Then run `platform-pr summary-context` and compare the retained repository/resource identity with the authoritative snapshot; discard a mismatch and mark the increment unconfirmed. Rebuild the task-bound `pr-change-report.json` for the authoritative PR head using the shared PR change-report contract, and refresh the single summary with a body containing one `<!-- canonical-pr-change-report -->` placeholder via `summary-sync --change-report-file ... --result no_op --strict`. Complete-PR statistics keep the current base/head/merge-base/patch and existing totals. Only when the prior report is valid, the PR identity matches, and the heads differ, describe the separate head-to-head tree diff using `git diff --find-renames --numstat {previous-head} {current-head}`, `--name-status`, and `--summary`. Do not substitute a merge-base diff for this range or add increment totals to the full PR. If no valid prior head exists, state that it is unconfirmed; do not infer from complete-PR statistics or fill in zeroes. Matching heads mean there was no new head transition.
64
+ Then run `platform-pr summary-context` and compare the retained repository/resource identity with the authoritative snapshot; discard a mismatch and mark the increment unconfirmed. Rebuild the task-bound `pr-change-report.json` for the authoritative PR head using the shared PR change-report contract, and refresh the single summary with structured summary JSON via `summary-sync --change-report-file ... --result no_op --strict`. Preserve the actual test, review, and manual validation states; do not depend on later events or final verification. Complete-PR statistics keep the current base/head/merge-base/patch and existing totals. Only when the prior report is valid, the PR identity matches, and the heads differ, describe the separate head-to-head tree diff using `git diff --find-renames --numstat {previous-head} {current-head}`, `--name-status`, and `--summary`. Do not substitute a merge-base diff for this range or add increment totals to the full PR. If no valid prior head exists, state that it is unconfirmed; do not infer from complete-PR statistics or fill in zeroes. Matching heads mean there was no new head transition.
65
65
 
66
66
  `--strict` preserves report or summary refresh failures as `failed/blocked` instead of treating warnings as success. A report or summary refresh failure must not enter the ready/complete exit; use step 4. After a successful refresh, consume `nextAction` from the structured `summary-sync` result: `review-code` exits readiness/self-heal and follows the code-review branch in step 7; only `watch-pr` continues to `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`. Missing or invalid `nextAction` follows the refresh-failure exit; do not infer `watch-pr`. Route readiness only by `readiness.state`: `ready` to step 7, `conflicting|checks-failed` to step 3, and `pending|timed-out|cancelled` to step 4.
67
67
 
@@ -61,7 +61,7 @@ process.stdout.write(`${JSON.stringify(previous)}\n`);
61
61
  ' {task-id}
62
62
  ```
63
63
 
64
- 随后调用 `platform-pr summary-context`,比较暂存的 repository/resource identity 与当前权威 snapshot;不匹配时丢弃旧 head 并标记增量未确认。按共享 PR change-report contract 用当前权威 PR head 重建任务绑定的 `pr-change-report.json`,再用含唯一 `<!-- canonical-pr-change-report -->` 占位符的正文调用 `summary-sync --change-report-file ... --result no_op --strict` 刷新同一条摘要。完整 PR 仍使用当前 base/head/merge-base/patch 与现有 totals。只有在上一报告有效、PR identity 相同且两个 head 不同的情况下,才用 `git diff --find-renames --numstat {previous-head} {current-head}`、`--name-status`、`--summary` 描述独立的 head→head 树差异;不使用 merge-base 替代该范围,不把增量 totals 加入完整 PR。无有效上一 head 时写明未确认,不从完整 PR 推算或填零;head 相同只说明没有新的 head 转换。
64
+ 随后调用 `platform-pr summary-context`,比较暂存的 repository/resource identity 与当前权威 snapshot;不匹配时丢弃旧 head 并标记增量未确认。按共享 PR change-report contract 用当前权威 PR head 重建任务绑定的 `pr-change-report.json`,用结构化摘要 JSON 调用 `summary-sync --change-report-file ... --result no_op --strict` 刷新同一条摘要;保留测试、Review 和人工校验的真实状态,不能依赖后续事件或最终验证。完整 PR 仍使用当前 base/head/merge-base/patch 与现有 totals。只有在上一报告有效、PR identity 相同且两个 head 不同的情况下,才用 `git diff --find-renames --numstat {previous-head} {current-head}`、`--name-status`、`--summary` 描述独立的 head→head 树差异;不使用 merge-base 替代该范围,不把增量 totals 加入完整 PR。无有效上一 head 时写明未确认,不从完整 PR 推算或填零;head 相同只说明没有新的 head 转换。
65
65
 
66
66
  `--strict` 将报告或摘要刷新失败保留为 `failed/blocked`,不得把 warning 当作成功;刷新失败时不得进入 ready/complete 出口,按步骤 4 记录阻塞。刷新成功后,消费 `summary-sync` 结构化结果的 `nextAction`:`review-code` 立即结束 readiness/self-heal 路径,按步骤 7 的代码审查分支退出;`watch-pr` 才继续调用 `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`。缺失或 invalid `nextAction` 按刷新失败处理,不推断为 `watch-pr`。readiness 只按结构化 `readiness.state` 分流:`ready` 进入步骤 7,`conflicting` 或 `checks-failed` 进入步骤 3,`pending|timed-out|cancelled` 进入步骤 4。
67
67
 
@@ -13,11 +13,11 @@ After the watch command, route by structured `readiness.state`:
13
13
 
14
14
  ## Summary Refresh Boundary
15
15
 
16
- Before readiness in every round, and after an external push, self-heal commit, or successful rebase changes the PR head, rerun `summary-context` → mechanical report and six-check precheck → `platform-pr change-report` → `summary-sync --change-report-file ... --result no_op --strict` with exactly one `<!-- canonical-pr-change-report -->` placeholder. `--strict` preserves report or summary refresh failures as `failed/blocked` so warnings cannot reach the ready/complete route. The core revalidates the sidecar against the authoritative PR snapshot, task-intent digest, and complete patch; missing, stale, invalid, bypassed, or raced publication must not continue to a ready/complete route and must enter the help exit with a warning.
16
+ Before readiness in every round, and after an external push, self-heal commit, or successful rebase changes the PR head, rerun `summary-context` → mechanical report and six-check precheck → `platform-pr change-report` → update the full PR summary JSON per `.agents/rules/pr-sync.md` → `summary-sync --change-report-file ... --result no_op --strict`. `--strict` preserves report or summary refresh failures as `failed/blocked`. The core revalidates the sidecar and reads back the remote body; missing, stale, invalid, incomplete, or raced publication must not continue to a ready/complete route.
17
17
 
18
- When rebuilding the precheck, each of the six `rationale` fields must state the corresponding high-level finding and include at least one path, line range, and concise `detail` as evidence. `change-composition` must describe where responsibilities are concentrated; compatibility, legacy-path, redundancy, and scope checks must state their actual results separately, without reused generic boilerplate. Use the deployed skill's language for rationales and evidence details; Chinese skill deployments must use Chinese.
18
+ When rebuilding the precheck, each of the six `rationale` fields must state its actual finding and include at least one item of evidence with a path, line range, and concise `detail`; state compatibility, legacy-path, redundancy, and scope findings separately without generic boilerplate. Use the deployed skill's language for rationales and evidence; Chinese deployments must use Chinese.
19
19
 
20
- Use the six existing `rationale` fields and `Evidence[]` to explain each logical change group: its goal and acceptance-criteria alignment, behavior added or removed, necessity, redundancy or duplication, scope, related tests, and test adequacy. Cite locatable code, test, or documentation evidence; mark unsupported points as unconfirmed. The renderer displays every evidence item. Source line counts, execution/call counts, and workflow unification are distinct claims: diff line counts cannot prove execution-count or workflow-behavior changes, and green CI cannot prove necessity. Analysis must not expand self-heal or refactoring authority.
20
+ Use the candidate content contract in `.agents/skills/create-pr/reference/change-report.md` for functional grouping, per-group fields, unique line attribution, and `needs-review` criteria. Rebuild groups from the current task goal and patch on every refresh; do not reuse prior-head explanations as evidence for the current increment. Reconcile complete-PR statistics separately from the previous valid head → current head increment; explicitly mark the increment unconfirmed when no previous head can be verified. If any group lacks goal alignment, behavior added/removed, necessity, line-count reconciliation, test coverage/cost, or locatable evidence, mark `target-alignment` or `change-composition` as `needs-review` and identify the gap. Reuse the existing `nextAction=review-code` route; structural completeness or green CI must not continue to `watch-pr`.
21
21
 
22
22
  Keep complete-PR scope bound to the current authoritative base/head/merge-base/patch and its full statistics. Report the increment separately as previous valid report head → current head. Before overwriting the prior sidecar, validate it with `readPrChangeReport`; use its `identity.head.sha` only when its repository/resource identity matches the current PR. Compare the two head trees directly and state both SHAs. Do not substitute a merge-base diff for these endpoints or add increment totals to complete-PR totals. If no prior report exists, it is invalid, or its identity differs, mark the previous head unconfirmed; do not infer values from the full PR or fill in zeroes. Identical SHAs mean the head did not change. After a rebase, compare the old and new head trees. An invalid sidecar makes only the increment unconfirmed; the existing full-PR report flow continues.
23
23
 
@@ -13,11 +13,11 @@
13
13
 
14
14
  ## 摘要刷新边界
15
15
 
16
- 每轮 readiness 之前,以及外部 push、自愈 commit 或 rebase 成功改变 PR head 之后,必须重新执行 `summary-context` → 机械报告与六项 precheck → `platform-pr change-report` → 含一次 `<!-- canonical-pr-change-report -->` 的 `summary-sync --change-report-file ... --result no_op --strict`。`--strict` 将报告或摘要刷新失败保留为 `failed/blocked`,不允许 warning 穿透到 ready/complete 路由。core 以权威 PR snapshot、任务意图 digest 和完整 patch 重新校验 sidecar;报告缺失、stale、invalid、占位符绕过或发布竞态时,不得继续 ready/complete 路由,转入求助出口并登记 warning。
16
+ 每轮 readiness 之前,以及外部 push、自愈 commit 或 rebase 成功改变 PR head 之后,必须重新执行 `summary-context` → 机械报告与六项 precheck → `platform-pr change-report` → 按 `.agents/rules/pr-sync.md` 更新完整 PR 摘要 JSON 并调用 `summary-sync --change-report-file ... --result no_op --strict`。`--strict` 将报告或摘要刷新失败保留为 `failed/blocked`,不允许 warning 穿透到 ready/complete 路由。core 以权威 PR snapshot、任务意图 digest 和完整 patch 重新校验 sidecar,并回读远端正文;报告缺失、stale、invalid、结构不完整或发布竞态时,不得继续 ready/complete 路由,转入求助出口并登记 warning。
17
17
 
18
- 每轮重建 precheck 时,六项 `rationale` 都必须是对应检查的实际高层结论,并各带至少一条路径、行号和简短 `detail` 证据;`change-composition` 要说明职责集中位置,兼容、旧路径、冗余和范围检查要分别说明实际结果,禁止复用泛化套话。理由和证据详情遵循当前已部署技能的语言,中文技能必须使用中文。
18
+ 每轮重建 precheck 时,除执行下方功能级报告门槛外,六项 `rationale` 都必须陈述对应检查的实际结论,并至少带一条含路径、行号和简短 `detail` 的证据;兼容、旧路径、冗余和范围检查分别说明,不复用泛化套话。理由和证据遵循当前部署语言,中文技能必须使用中文。
19
19
 
20
- 按逻辑变化组使用现有六项 `rationale` 和 `Evidence[]` 说明目标/验收对应、行为增减、必要性、冗余或重复、范围、相关测试及测试充分性。列出可定位的代码/测试/文档证据;缺证据时明确写未确认。renderer 会展示每项的全部 evidence。源码行数、执行/调用次数和流程统一是不同结论:diff 行数不能证明执行次数或流程行为变化;CI 全绿也不能证明必要性。不得由分析建议自行扩大自愈或重构权限。
20
+ 功能分组、逐组字段、行数唯一归属及 `needs-review` 条件统一遵循 `.agents/skills/create-pr/reference/change-report.md` 的 candidate 内容契约。每次刷新都重新按当前任务目标和 patch 建立功能组,不沿用上一 head 的说明代替本轮证据。完整 PR 统计与上一有效 head → 当前 head 的增量分开核算;没有可验证的上一 head 时明确标为未确认。任何功能组缺少目标对应、行为增减、必要性、行数对账、测试覆盖/成本或定位证据时,将 `target-alignment` 或 `change-composition` 标为 `needs-review` 并指出缺口。沿用现有 `nextAction=review-code` 路由;不得以结构完整或 CI 全绿继续 `watch-pr`。
21
21
 
22
22
  完整 PR 的范围继续绑定当前权威 base/head/merge-base/patch 与完整统计。增量单独绑定上一有效报告 head → 当前 head:在覆盖旧 sidecar 前,用 `readPrChangeReport` 校验旧报告,只在 repository/resource identity 匹配当前 PR 时采用旧 `identity.head.sha`。对两个 head 做 tree-to-tree diff 并明确列出 SHA,不用 merge-base 替代端点差异,不把增量 totals 加到完整 PR totals。没有旧报告、报告无效或身份不符时标注上一 head 未确认,不从全量推算或填零。两个 SHA 相同只报告 head 未变化;rebase 后仍比较原 head 和新 head 的树差异。sidecar 无效只使增量不可确认,不改变现有 full-PR 报告流程。
23
23