@fitlab-ai/agent-infra 0.11.4 → 0.11.6

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 (149) hide show
  1. package/dist/bin/internal-cli.js +0 -5
  2. package/dist/lib/decide.js +4 -41
  3. package/dist/lib/git/branch-worktree.js +45 -0
  4. package/dist/lib/internal/cli-route-inventory.js +0 -3
  5. package/dist/lib/internal/task-activity.js +7 -40
  6. package/dist/lib/internal/task-event.js +4 -37
  7. package/dist/lib/internal/task-finalization.js +9 -2
  8. package/dist/lib/internal/task-ledger.js +5 -43
  9. package/dist/lib/internal/task-lifecycle.js +1 -1
  10. package/dist/lib/internal/task-operation-registry.js +1 -4
  11. package/dist/lib/internal/task-review.js +5 -37
  12. package/dist/lib/internal/task-verify.js +3 -47
  13. package/dist/lib/internal/task-warning.js +4 -40
  14. package/dist/lib/merge.js +62 -10
  15. package/dist/lib/platform/github-provider.js +9 -14
  16. package/dist/lib/platform/github-release-notes.js +80 -11
  17. package/dist/lib/platform/none-provider.js +1 -1
  18. package/dist/lib/platform/pr-summary.js +4 -23
  19. package/dist/lib/platform/provider-contract.d.ts +39 -16
  20. package/dist/lib/platform/provider-contract.js +1 -1
  21. package/dist/lib/platform/provider-validation.js +83 -13
  22. package/dist/lib/platform/release-notes.js +7 -8
  23. package/dist/lib/platform/verification-sync.js +12 -49
  24. package/dist/lib/sandbox/capture.js +1 -1
  25. package/dist/lib/sandbox/commands/create.js +46 -1
  26. package/dist/lib/sandbox/commands/enter.js +1 -1
  27. package/dist/lib/sandbox/commands/start.js +1 -1
  28. package/dist/lib/sandbox/config.js +10 -0
  29. package/dist/lib/sandbox/control/client.js +4 -1
  30. package/dist/lib/sandbox/control/executor.js +12 -4
  31. package/dist/lib/sandbox/control/lifecycle.js +18 -13
  32. package/dist/lib/sandbox/control/protocol.js +2 -1
  33. package/dist/lib/sandbox/removal.js +15 -8
  34. package/dist/lib/sandbox/task-resolver.js +62 -2
  35. package/dist/lib/task/activity-intent.js +1 -2
  36. package/dist/lib/task/artifact-operations.js +36 -2
  37. package/dist/lib/task/artifact-schema.js +7 -7
  38. package/dist/lib/task/control-authority.js +9 -166
  39. package/dist/lib/task/decision-intents.js +2 -4
  40. package/dist/lib/task/events.js +7 -28
  41. package/dist/lib/task/finalization-handoff.js +92 -0
  42. package/dist/lib/task/finalization.js +123 -12
  43. package/dist/lib/task/intermediate-cleanup.js +9 -148
  44. package/dist/lib/task/ledger-intents.js +3 -6
  45. package/dist/lib/task/lifecycle.js +50 -11
  46. package/dist/lib/task/local-artifact-finalization.js +13 -28
  47. package/dist/lib/task/resolve-ref.js +3 -3
  48. package/dist/lib/task/review-command.js +1 -2
  49. package/dist/lib/task/review-finalization.js +1 -2
  50. package/dist/lib/task/snapshot.js +6 -6
  51. package/dist/lib/task/verification-engine.js +16 -11
  52. package/dist/lib/task/verification.js +1 -13
  53. package/dist/lib/task/workflow-warning-intents.js +2 -4
  54. package/dist/lib/task/write.js +122 -3
  55. package/dist/lifecycle-build-manifest.json +3 -3
  56. package/lib/decide.ts +5 -35
  57. package/lib/git/branch-worktree.ts +41 -0
  58. package/lib/internal/cli-route-inventory.ts +0 -2
  59. package/lib/internal/task-activity.ts +6 -34
  60. package/lib/internal/task-event.ts +4 -37
  61. package/lib/internal/task-finalization.ts +9 -2
  62. package/lib/internal/task-ledger.ts +5 -38
  63. package/lib/internal/task-lifecycle.ts +2 -2
  64. package/lib/internal/task-operation-registry.ts +1 -4
  65. package/lib/internal/task-review.ts +5 -31
  66. package/lib/internal/task-verify.ts +3 -39
  67. package/lib/internal/task-warning.ts +3 -32
  68. package/lib/merge.ts +59 -10
  69. package/lib/platform/github-provider.ts +11 -18
  70. package/lib/platform/github-release-notes.ts +89 -14
  71. package/lib/platform/none-provider.ts +1 -1
  72. package/lib/platform/pr-summary.ts +4 -25
  73. package/lib/platform/provider-contract.ts +38 -12
  74. package/lib/platform/provider-validation.ts +83 -12
  75. package/lib/platform/release-notes.ts +11 -12
  76. package/lib/platform/verification-sync.ts +13 -53
  77. package/lib/sandbox/capture.ts +1 -1
  78. package/lib/sandbox/commands/create.ts +52 -1
  79. package/lib/sandbox/commands/enter.ts +1 -1
  80. package/lib/sandbox/commands/start.ts +1 -1
  81. package/lib/sandbox/config.ts +12 -0
  82. package/lib/sandbox/control/client.ts +5 -1
  83. package/lib/sandbox/control/executor.ts +13 -4
  84. package/lib/sandbox/control/lifecycle.ts +22 -13
  85. package/lib/sandbox/control/protocol.ts +3 -2
  86. package/lib/sandbox/removal.ts +23 -7
  87. package/lib/sandbox/task-resolver.ts +51 -2
  88. package/lib/task/activity-intent.ts +1 -2
  89. package/lib/task/artifact-operations.ts +58 -2
  90. package/lib/task/artifact-schema.ts +9 -7
  91. package/lib/task/control-authority.ts +14 -188
  92. package/lib/task/decision-intents.ts +2 -4
  93. package/lib/task/events.ts +8 -27
  94. package/lib/task/finalization-handoff.ts +104 -0
  95. package/lib/task/finalization.ts +120 -12
  96. package/lib/task/intermediate-cleanup.ts +9 -125
  97. package/lib/task/ledger-intents.ts +3 -6
  98. package/lib/task/lifecycle.ts +45 -13
  99. package/lib/task/local-artifact-finalization.ts +16 -35
  100. package/lib/task/resolve-ref.ts +3 -3
  101. package/lib/task/review-command.ts +2 -5
  102. package/lib/task/review-finalization.ts +1 -4
  103. package/lib/task/snapshot.ts +6 -6
  104. package/lib/task/verification-engine.ts +20 -10
  105. package/lib/task/verification.ts +1 -15
  106. package/lib/task/workflow-warning-intents.ts +2 -4
  107. package/lib/task/write.ts +116 -5
  108. package/package.json +1 -1
  109. package/templates/.agents/rules/evidence-reporting.en.md +1 -2
  110. package/templates/.agents/rules/evidence-reporting.zh-CN.md +1 -2
  111. package/templates/.agents/skills/analyze-task/SKILL.en.md +11 -2
  112. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -2
  113. package/templates/.agents/skills/archive-tasks/SKILL.en.md +2 -2
  114. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +2 -2
  115. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +109 -6
  116. package/templates/.agents/skills/code-task/reference/report-template.en.md +6 -6
  117. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +6 -6
  118. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +2 -2
  119. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +2 -2
  120. package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +1 -3
  121. package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +1 -3
  122. package/templates/.agents/skills/complete-task/config/verify.en.json +2 -2
  123. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -2
  124. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -11
  125. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -11
  126. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +3 -3
  127. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +3 -3
  128. package/templates/.agents/skills/review-code/reference/report-template.en.md +3 -3
  129. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +3 -3
  130. package/templates/.agents/skills/review-plan/reference/report-template.en.md +3 -3
  131. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +3 -3
  132. package/templates/.agents/skills/review-pr/config/verify.en.json +3 -1
  133. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +3 -1
  134. package/templates/.agents/skills/review-pr/reference/report-template.en.md +3 -3
  135. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +3 -3
  136. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +2 -2
  137. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +2 -2
  138. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
  139. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
  140. package/dist/lib/internal/task-override.js +0 -138
  141. package/dist/lib/task/artifact-recovery.js +0 -476
  142. package/dist/lib/task/artifact-repair-intent.js +0 -181
  143. package/dist/lib/task/guard-override.js +0 -31
  144. package/dist/lib/task/human-override.js +0 -1259
  145. package/lib/internal/task-override.ts +0 -144
  146. package/lib/task/artifact-recovery.ts +0 -572
  147. package/lib/task/artifact-repair-intent.ts +0 -227
  148. package/lib/task/guard-override.ts +0 -50
  149. package/lib/task/human-override.ts +0 -1522
@@ -15,7 +15,7 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
15
15
 
16
16
  ### Flow decision
17
17
 
18
- The analysis artifact must record the selected path, factual basis, unmet higher-path conditions, and factual upgrade triggers in `## Flow Decision`. The path is streamlined, standard, or full; file count, module count, and speculative risk cannot upgrade it by themselves.
18
+ The analysis artifact must record `Path`, `Basis`, `Unmet Higher-path Conditions`, and `Upgrade Triggers` exactly once each, with non-empty values, in `## Flow Decision`. The path is streamlined, standard, or full; file count, module count, and speculative risk cannot upgrade it by themselves. The analysis `finalize-local` reuses the lifecycle-path parser to validate this decision; directly repair the formal artifact and rerun it for missing, duplicate, or invalid values.
19
19
 
20
20
  ### Persisted Report Evidence
21
21
 
@@ -160,7 +160,7 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
160
160
 
161
161
  ## State Check
162
162
 
163
- > Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
163
+ > Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
164
164
 
165
165
  ## Requirement Source
166
166
 
@@ -187,6 +187,15 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
187
187
  ## Dependencies
188
188
  - {Required dependencies and coordination with other modules}
189
189
 
190
+ <!-- lifecycle-path-decision-template:start -->
191
+ ## Flow Decision
192
+
193
+ - **Path**: {lifecycle-path}
194
+ - **Basis**: {Factual basis for selecting the current path}
195
+ - **Unmet Higher-path Conditions**: {Factual conditions for the higher path that are not met; for full, state that no higher path exists}
196
+ - **Upgrade Triggers**: {Factual triggers that require reassessing the path}
197
+ <!-- lifecycle-path-decision-template:end -->
198
+
190
199
  ## Assumptions
191
200
 
192
201
  > If this analysis depends on assumptions, list them here; omit this section if there are none.
@@ -15,7 +15,7 @@ description: >
15
15
 
16
16
  ### 流程裁定
17
17
 
18
- 分析产物必须在 `## 流程裁定` 中记录本任务路径、判定依据、未满足的更高路径条件和事实型升级触发条件。路径仅可为精简、标准或完整;文件数、模块数和推测性风险不能单独升级路径。
18
+ 分析产物必须在 `## 流程裁定` 中记录 `本任务路径`、`判定依据`、`未满足的更高路径条件` 和 `升级触发条件` 四个字段,每个字段恰好一次且非空。路径仅可为精简、标准或完整;文件数、模块数和推测性风险不能单独升级路径。analysis 的 `finalize-local` 会复用生命周期路径解析器校验该决定;缺失、重复或无效值必须直接修复正式产物后重跑。
19
19
 
20
20
  ### 持久化报告证据
21
21
 
@@ -163,7 +163,7 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
163
163
 
164
164
  ## 状态核对
165
165
 
166
- > 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
166
+ > 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
167
167
 
168
168
  ## 需求来源
169
169
 
@@ -190,6 +190,15 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
190
190
  ## 依赖关系
191
191
  - {需要的依赖和与其他模块的协调}
192
192
 
193
+ <!-- lifecycle-path-decision-template:start -->
194
+ ## 流程裁定
195
+
196
+ - **本任务路径**:{lifecycle-path}
197
+ - **判定依据**:{选择当前路径的事实依据}
198
+ - **未满足的更高路径条件**:{当前未满足的更高路径条件;完整路径写不存在更高路径的事实}
199
+ - **升级触发条件**:{未来需要重新评估路径的事实触发条件}
200
+ <!-- lifecycle-path-decision-template:end -->
201
+
193
202
  ## 资格审计
194
203
 
195
204
  > 按 `.agents/rules/decision-qualification.md` 填写约束依赖、候选资格、分类结果、上游关系、依赖快照五张表;没有 artifact 上游时保留空表头,不虚构关系。
@@ -7,7 +7,7 @@ description: >
7
7
 
8
8
  # Archive Completed Tasks
9
9
 
10
- Move completed tasks from `.agents/workspace/completed/` into `.agents/workspace/archive/YYYY/MM/DD/TASK-xxx/` and rebuild a three-level archive index:
10
+ Archive completed tasks from `.agents/workspace/completed/` into `.agents/workspace/archive/YYYY/MM/DD/TASK-xxx/local/` and rebuild a three-level archive index. Local task materials live in `local/` with a path-sorted `contents.sha256`; the TASK root contains no ordinary files.
11
11
  - root manifest: `.agents/workspace/archive/manifest.md`
12
12
  - yearly manifest: `.agents/workspace/archive/YYYY/manifest.md`
13
13
  - monthly manifest: `.agents/workspace/archive/YYYY/MM/manifest.md`
@@ -32,7 +32,7 @@ bash .agents/skills/archive-tasks/scripts/archive-tasks.sh [--days N | --before
32
32
 
33
33
  The script is responsible for:
34
34
  - reading `completed_at` from `task.md` frontmatter and falling back to `updated_at`
35
- - moving task directories directly into `YYYY/MM/DD/TASK-xxx/` without compression
35
+ - storing local task materials under `YYYY/MM/DD/TASK-xxx/local/` without compression
36
36
  - skipping already archived, missing, or malformed tasks
37
37
  - rebuilding root, yearly, and monthly manifests from all archived tasks
38
38
  - printing an archive and skip summary
@@ -7,7 +7,7 @@ description: >
7
7
 
8
8
  # 归档已完成任务
9
9
 
10
- 将 `.agents/workspace/completed/` 中的已完成任务移动到 `.agents/workspace/archive/YYYY/MM/DD/TASK-xxx/`,并重建三级归档索引:
10
+ 将 `.agents/workspace/completed/` 中的已完成任务归档到 `.agents/workspace/archive/YYYY/MM/DD/TASK-xxx/local/`,并重建三级归档索引。TASK 本地材料位于 `local/`,含按路径排序的 `contents.sha256`;TASK 根目录不存放普通文件。
11
11
  - 根 manifest:`.agents/workspace/archive/manifest.md`
12
12
  - 年 manifest:`.agents/workspace/archive/YYYY/manifest.md`
13
13
  - 月 manifest:`.agents/workspace/archive/YYYY/MM/manifest.md`
@@ -32,7 +32,7 @@ bash .agents/skills/archive-tasks/scripts/archive-tasks.sh [--days N | --before
32
32
 
33
33
  脚本负责:
34
34
  - 解析 `task.md` frontmatter 中的 `completed_at`(缺失时回退到 `updated_at`)
35
- - 按 `YYYY/MM/DD/TASK-xxx/` 目录直接移动任务,不压缩
35
+ - 按 `YYYY/MM/DD/TASK-xxx/local/` 保存任务本地材料,不压缩
36
36
  - 跳过已归档、缺少元数据或不存在的任务
37
37
  - 全量重建根 / 年 / 月三级 manifest
38
38
  - 输出归档与跳过摘要
@@ -8,9 +8,14 @@ WORKSPACE_ROOT="$REPO_ROOT/.agents/workspace"
8
8
  COMPLETED_DIR="$WORKSPACE_ROOT/completed"
9
9
  ARCHIVE_DIR="$WORKSPACE_ROOT/archive"
10
10
  MANIFEST_PATH="$ARCHIVE_DIR/manifest.md"
11
+ tmpdir=""
12
+ cleanup() {
13
+ [ -z "$tmpdir" ] || rm -rf "$tmpdir"
14
+ }
15
+ trap 'cleanup' 0
16
+ trap 'cleanup; exit 1' HUP INT TERM
11
17
 
12
- tmpdir="$(mktemp -d)"
13
- trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
18
+ tmpdir="$(mktemp -d "$WORKSPACE_ROOT/.archive-tmp.XXXXXX")"
14
19
 
15
20
  IDS_FILE="$tmpdir/task-ids.txt"
16
21
  : > "$IDS_FILE"
@@ -160,6 +165,17 @@ archive_task_dir() {
160
165
  return 0
161
166
  fi
162
167
 
168
+ find "$task_dir" -name manifest.md -print > "$tmpdir/task-manifests.txt"
169
+ if [ -s "$tmpdir/task-manifests.txt" ]; then
170
+ echo "TASK content cannot contain manifest.md: $task_id" >&2
171
+ return 1
172
+ fi
173
+ find "$task_dir" ! -type f ! -type d -print > "$tmpdir/task-special-files.txt"
174
+ if [ -s "$tmpdir/task-special-files.txt" ]; then
175
+ echo "TASK content cannot contain symbolic links or special files: $task_id" >&2
176
+ return 1
177
+ fi
178
+
163
179
  completed_at=$(extract_completed_at "$task_file")
164
180
  task_date=$(printf '%s' "$completed_at" | cut -c1-10)
165
181
 
@@ -179,12 +195,89 @@ archive_task_dir() {
179
195
  return 0
180
196
  fi
181
197
 
182
- mkdir -p "$ARCHIVE_DIR/$year/$month/$day"
183
- mv "$task_dir" "$destination_dir"
198
+ mkdir -p "$(dirname "$destination_dir")"
199
+ staged_dir="$tmpdir/$task_id"
200
+ mkdir -p "$staged_dir/local"
201
+ cp -R "$task_dir"/. "$staged_dir/local/"
202
+ write_contents_hash "$staged_dir/local"
203
+ mv "$staged_dir" "$destination_dir"
204
+ if ! rm -rf "$task_dir"; then
205
+ if ! rm -rf "$destination_dir"; then
206
+ echo "Failed to remove completed task and roll back archive copy: $task_id" >&2
207
+ else
208
+ echo "Failed to remove completed task; rolled back archive copy: $task_id" >&2
209
+ fi
210
+ return 1
211
+ fi
184
212
  archived_count=$((archived_count + 1))
185
213
  printf 'Archived %s -> %s\n' "$task_id" "$relative_path"
186
214
  }
187
215
 
216
+ write_contents_hash() {
217
+ local_dir="$1"
218
+ hash_path=${2:-$local_dir/contents.sha256}
219
+ hash_tmp="$tmpdir/contents.sha256"
220
+ newline='
221
+ '
222
+ : > "$hash_tmp"
223
+ find "$local_dir" -type f ! -name contents.sha256 | LC_ALL=C sort | while IFS= read -r source_file; do
224
+ relative_file=${source_file#"$local_dir"/}
225
+ case "$relative_file" in *"$newline"*|*"$(printf '\r')"*) echo "Newline path is not supported" >&2; return 1 ;; esac
226
+ if command -v sha256sum >/dev/null 2>&1; then
227
+ digest=$(sha256sum "$source_file" | awk '{print $1}')
228
+ else
229
+ digest=$(shasum -a 256 "$source_file" | awk '{print $1}')
230
+ fi
231
+ printf '%s %s\n' "$digest" "$relative_file" >> "$hash_tmp"
232
+ done
233
+ mv "$hash_tmp" "$hash_path"
234
+ if [ "$hash_path" = "$local_dir/contents.sha256" ] && command -v sha256sum >/dev/null 2>&1; then
235
+ (cd "$local_dir" && sha256sum -c contents.sha256 >/dev/null)
236
+ elif [ "$hash_path" = "$local_dir/contents.sha256" ]; then
237
+ (cd "$local_dir" && shasum -a 256 -c contents.sha256 >/dev/null)
238
+ fi
239
+ }
240
+
241
+ validate_source_hash() {
242
+ source_dir="$1"
243
+ [ -f "$source_dir/task.md" ] || { echo "Archive source lacks task.md: $source_dir" >&2; return 1; }
244
+ [ -f "$source_dir/contents.sha256" ] || { echo "Archive source lacks contents.sha256: $source_dir" >&2; return 1; }
245
+ write_contents_hash "$source_dir" "$tmpdir/contents.expected"
246
+ if ! cmp -s "$tmpdir/contents.expected" "$source_dir/contents.sha256"; then
247
+ echo "Archive source checksum mismatch: $source_dir" >&2
248
+ return 1
249
+ fi
250
+ }
251
+
252
+ validate_existing_archive() {
253
+ [ -d "$ARCHIVE_DIR" ] || return 0
254
+ for year_dir in "$ARCHIVE_DIR"/[0-9][0-9][0-9][0-9]; do
255
+ [ -d "$year_dir" ] || continue
256
+ for month_dir in "$year_dir"/[0-9][0-9]; do
257
+ [ -d "$month_dir" ] || continue
258
+ for day_dir in "$month_dir"/[0-9][0-9]; do
259
+ [ -d "$day_dir" ] || continue
260
+ for task_dir in "$day_dir"/TASK-*; do
261
+ [ -d "$task_dir" ] || continue
262
+ [ -d "$task_dir/local" ] || { echo "Unsupported legacy archive task layout: $task_dir" >&2; return 1; }
263
+ for task_entry in "$task_dir"/*; do
264
+ [ -e "$task_entry" ] || continue
265
+ case "$(basename "$task_entry")" in
266
+ local|github|derived) [ -d "$task_entry" ] || { echo "Invalid archive source directory: $task_entry" >&2; return 1; } ;;
267
+ *) echo "Unexpected TASK root entry: $task_entry" >&2; return 1 ;;
268
+ esac
269
+ done
270
+ find "$task_dir/local" -name manifest.md -print > "$tmpdir/task-manifests.txt"
271
+ [ ! -s "$tmpdir/task-manifests.txt" ] || { echo "TASK content cannot contain manifest.md: $task_dir" >&2; return 1; }
272
+ find "$task_dir/local" ! -type f ! -type d -print > "$tmpdir/task-special-files.txt"
273
+ [ ! -s "$tmpdir/task-special-files.txt" ] || { echo "TASK content cannot contain symbolic links or special files: $task_dir" >&2; return 1; }
274
+ validate_source_hash "$task_dir/local"
275
+ done
276
+ done
277
+ done
278
+ done
279
+ }
280
+
188
281
  should_archive_filtered_task() {
189
282
  task_dir="$1"
190
283
  task_file="$task_dir/task.md"
@@ -231,7 +324,7 @@ rebuild_manifest() {
231
324
  [ -d "$task_dir" ] || continue
232
325
 
233
326
  task_id=$(basename "$task_dir")
234
- task_file="$task_dir/task.md"
327
+ task_file="$task_dir/local/task.md"
235
328
  relative_path="$year/$month/$day/$task_id/"
236
329
  title="$task_id"
237
330
  task_type="unknown"
@@ -261,7 +354,15 @@ rebuild_manifest() {
261
354
  done
262
355
  done
263
356
 
264
- find "$ARCHIVE_DIR" -type f -name 'manifest.md' -exec rm -f {} \;
357
+ rm -f "$ARCHIVE_DIR/manifest.md"
358
+ for year_dir in "$ARCHIVE_DIR"/[0-9][0-9][0-9][0-9]; do
359
+ [ -d "$year_dir" ] || continue
360
+ rm -f "$year_dir/manifest.md"
361
+ for month_dir in "$year_dir"/[0-9][0-9]; do
362
+ [ -d "$month_dir" ] || continue
363
+ rm -f "$month_dir/manifest.md"
364
+ done
365
+ done
265
366
 
266
367
  awk -F'\t' '{print $1 "\t" $2}' "$entries_file" | LC_ALL=C sort -u > "$month_keys_file"
267
368
  awk -F'\t' '{print $1}' "$entries_file" | LC_ALL=C sort -u > "$year_keys_file"
@@ -436,6 +537,8 @@ if [ -s "$IDS_FILE" ]; then
436
537
  MODE="ids"
437
538
  fi
438
539
 
540
+ validate_existing_archive
541
+
439
542
  archived_count=0
440
543
  skipped_count=0
441
544
 
@@ -102,25 +102,25 @@ Use this structure when creating `code.md` or `code-r{N}.md`.
102
102
 
103
103
  ## State Check
104
104
 
105
- > Record the state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `.
105
+ > Record the state-check command, task/artifact scope, key result, and uncovered parts.
106
106
  > Follow `.agents/rules/evidence-reporting.md`: record task/artifact scope, key result, and uncovered parts; do not paste complete successful stdout.
107
107
 
108
- Record at least one actually executed `$ ` command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
108
+ Record at least one actually executed command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
109
109
 
110
110
  ```text
111
- $ agent-infra-internal task-snapshot {task-id} --format text
111
+ agent-infra-internal task-snapshot {task-id} --format text
112
112
  {task state, implementation-artifact scope, and uncovered-area summary}
113
- $ agent-infra-internal task-artifact {task-id} inspect --family code
113
+ agent-infra-internal task-artifact {task-id} inspect --family code
114
114
  {code artifact, upstream input, and next-step summary}
115
115
  ```
116
116
 
117
117
  ## Raw Evidence
118
118
 
119
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
119
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
120
120
 
121
121
  - Claim: {verified claim}
122
122
  ```text
123
- $ {command}
123
+ {command}
124
124
  {result summary or decisive excerpt}
125
125
  ```
126
126
 
@@ -102,25 +102,25 @@
102
102
 
103
103
  ## 状态核对
104
104
 
105
- > 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
105
+ > 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分。
106
106
  > 按 `.agents/rules/evidence-reporting.md` 同时记录任务/产物范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
107
107
 
108
- 必须记录至少一条实际执行的 `$ ` 命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
108
+ 必须记录至少一条实际执行的命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
109
109
 
110
110
  ```text
111
- $ agent-infra-internal task-snapshot {task-id} --format text
111
+ agent-infra-internal task-snapshot {task-id} --format text
112
112
  {任务状态、实现产物范围和未覆盖项摘要}
113
- $ agent-infra-internal task-artifact {task-id} inspect --family code
113
+ agent-infra-internal task-artifact {task-id} inspect --family code
114
114
  {code artifact、上游输入和下一步摘要}
115
115
  ```
116
116
 
117
117
  ## 证据原文
118
118
 
119
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
119
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
120
120
 
121
121
  - 断言:{verified claim}
122
122
  ```text
123
- $ {command}
123
+ {command}
124
124
  {result summary or decisive excerpt}
125
125
  ```
126
126
 
@@ -23,8 +23,8 @@
23
23
  "Validation Details",
24
24
  "PR Summary Sync"
25
25
  ],
26
- "required_patterns": [
27
- "^\\$ "
26
+ "state_check_patterns": [
27
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
28
28
  ]
29
29
  },
30
30
  "activity-log": {
@@ -23,8 +23,8 @@
23
23
  "验证详情",
24
24
  "PR 摘要同步"
25
25
  ],
26
- "required_patterns": [
27
- "^\\$ "
26
+ "state_check_patterns": [
27
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
28
28
  ]
29
29
  },
30
30
  "activity-log": {
@@ -12,9 +12,7 @@ Read this file before creating `manual-validation.md` / `manual-validation-r{N}.
12
12
  ## State Check
13
13
 
14
14
  ```text
15
- $ git status -s
16
- $ ls -la .agents/workspace/active/{task-id}/
17
- $ tail .agents/workspace/active/{task-id}/task.md
15
+ agent-infra-internal task-snapshot {task-id} --format text
18
16
  ```
19
17
  > Follow `.agents/rules/evidence-reporting.md`: record task scope, key result, and uncovered parts; do not paste the complete directory listing or task tail for normal success.
20
18
 
@@ -12,9 +12,7 @@
12
12
  ## 状态核对
13
13
 
14
14
  ```text
15
- $ git status -s
16
- $ ls -la .agents/workspace/active/{task-id}/
17
- $ tail .agents/workspace/active/{task-id}/task.md
15
+ agent-infra-internal task-snapshot {task-id} --format text
18
16
  ```
19
17
  > 按 `.agents/rules/evidence-reporting.md` 记录任务范围、关键结果和未覆盖部分;正常成功不粘贴完整目录清单或 task tail。
20
18
 
@@ -38,8 +38,8 @@
38
38
  "required_sections": [
39
39
  "State Check"
40
40
  ],
41
- "required_patterns": [
42
- "^\\$ "
41
+ "state_check_patterns": [
42
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
43
43
  ]
44
44
  }
45
45
  }
@@ -38,8 +38,8 @@
38
38
  "required_sections": [
39
39
  "状态核对"
40
40
  ],
41
- "required_patterns": [
42
- "^\\$ "
41
+ "state_check_patterns": [
42
+ "agent-infra-internal[ \\t]+task-snapshot\\b"
43
43
  ]
44
44
  }
45
45
  }
@@ -53,6 +53,7 @@ agent-infra-internal platform-release-notes context \
53
53
 
54
54
  **Purpose**:
55
55
  - Part A: Analyze the section structure, heading style, emoji usage, and item format from the latest 3 historical release notes
56
+ - Each `history` item contains a tag, body, and Release URL; use the body as a format sample, not as current change facts
56
57
  - Part B: Provide a static complete category list so no existing category is omitted
57
58
  - This static list ensures existing category names are not missed during classification; if the current release has no entries for a category, Step 7 still omits the empty section
58
59
  - When generating release notes in Step 7, **must** follow both the historical format style and the full category list gathered in Step 3
@@ -60,7 +61,7 @@ agent-infra-internal platform-release-notes context \
60
61
 
61
62
  ### 4. Collect Merged PRs and Contributors
62
63
 
63
- Use `pullRequests` and `commits` from Step 3. Each commit's `authors` are normalized platform facts containing the git author and co-authors; the skill does not interpret raw platform fields or email rules.
64
+ Use `pullRequests` and `commits` from Step 3. Each commit's `authors` contains only that commit's platform authors; `pullRequestNumbers` records the platform's PR associations. The skill does not interpret raw platform fields or email rules. A PR's `closingIssues` contains its actual closing Issues; never infer a relationship from matching PR and Issue numbers.
64
65
 
65
66
  ### 5. Collect Related Issues
66
67
 
@@ -79,31 +80,36 @@ Use each PR's `closingIssues` from Step 3. Do not parse platform-specific refere
79
80
 
80
81
  ### 7. Generate Release Notes
81
82
 
82
- **Prioritize the historical format style obtained in Step 3 and ensure all categories listed in Step 3 are covered.** If historical release notes exist, strictly follow their section structure, heading style (including emojis), item format, and bilingual layout.
83
+ **Prioritize the historical format style obtained in Step 3 and ensure all categories listed in Step 3 are covered.** Dynamically use the latest 3 published notes each time. Treat sections, bilingual layout, and installation instructions shared by those notes as stable format; allow item content to vary by release. Never copy an example's authors or links into the current release.
83
84
 
84
85
  If no historical release notes exist, use the following default Markdown format:
85
86
 
86
87
  ```markdown
87
- ## {Module/Platform Name}
88
+ ## {Module / 模块}
88
89
 
89
- ### Enhancement
90
+ ### Enhancement / 增强
90
91
 
91
92
  - [{scope}] Description by @author in [#N](url)
92
93
 
93
- ### Bugfix
94
+ ### Bugfix / 修复
94
95
 
95
96
  - [{scope}] Description by @author in [#N](url)
96
97
 
97
- ## Contributors
98
+ ## Contributors / 贡献者
98
99
 
99
100
  @contributor1, @contributor2, @contributor3, @reporter1 (reported #N)
101
+
102
+ ## Installation / 安装
103
+
104
+ {English and Chinese installation instructions for this release, following stable steps in historical notes}
100
105
  ```
101
106
 
102
107
  **Format rules**:
103
- 1. Item format: `- [scope] Description by @author in [#N](url)`
104
- 2. Issue + PR: `in [#Issue](url) and [#PR](url)`
105
- 3. Description: Use PR title, remove `type(scope):` prefix, capitalize first letter
106
- 4. **Contributor collection**:
108
+ 1. PR item format: `- [scope] Description by @author in [#N](url)`
109
+ 2. Issue + PR: `in [#Issue](url) and [#PR](url)`; Issue reporters come from that PR's `closingIssues`
110
+ 3. Render each commit with an empty `pullRequestNumbers` as a standalone item using its subject and resolvable author; link to the commit itself when its URL is available, without adding an Issue or PR link
111
+ 4. Description: Use the PR title or commit subject; remove `type(scope):` from PR titles and capitalize the first letter
112
+ 5. **Contributor collection**:
107
113
  - **Data sources**:
108
114
  - PR authors from the typed context
109
115
  - Commit co-authors from the typed context's commit `authors`
@@ -123,7 +129,7 @@ If no historical release notes exist, use the following default Markdown format:
123
129
  - Reporter-only contributors use the format `@login (reported #N)`; if the same reporter reported multiple Issues, use `@login (reported #N1, #N2)`
124
130
  - Reporters are appended after code contributors in the Contributors section, separated by commas
125
131
  - Sort reporters by reported Issue count descending, then lexicographically by login for ties
126
- 5. Empty sections: Omit sections with no entries
132
+ 6. Empty sections: Omit categories with no entries; retain bilingual headings and the installation section from the historical format
127
133
 
128
134
  ### 8. Stage, Present, and Confirm
129
135
 
@@ -53,6 +53,7 @@ agent-infra-internal platform-release-notes context \
53
53
 
54
54
  **用途**:
55
55
  - Part A:分析最近 3 条历史发布说明的章节结构、标题风格、emoji 使用、条目格式
56
+ - 每项 `history` 含 tag、正文和 Release URL;正文只作为格式样例,不作为当前版本的变更事实
56
57
  - Part B:提供静态完整分类清单,确保后续生成时不遗漏已有分类
57
58
  - 该静态清单用于确保变更分类时不遗漏已有类别名称;若当前版本无该类变更,仍按步骤 7 的格式规则省略空分类
58
59
  - 后续步骤 7 生成发布说明时,**必须**同时参考步骤 3 的历史格式风格和完整分类清单,保持版本间的一致性
@@ -60,7 +61,7 @@ agent-infra-internal platform-release-notes context \
60
61
 
61
62
  ### 4. 收集已合并的 PR 与贡献者
62
63
 
63
- 使用步骤 3 返回的 `pullRequests` 与 `commits`。每个 commit 的 `authors` 已按平台事实规范化并包含 git author 与 co-author;技能不读取平台原始字段或邮箱规则。
64
+ 使用步骤 3 返回的 `pullRequests` 与 `commits`。每个 commit 的 `authors` 只包含该 commit 的平台作者;`pullRequestNumbers` 表示平台记录的 PR 关联。技能不读取平台原始字段或邮箱规则。PR 的 `closingIssues` 是该 PR 实际关闭的 Issue,不按 PR/Issue 编号推断关联。
64
65
 
65
66
  ### 5. 收集关联 Issue
66
67
 
@@ -79,31 +80,36 @@ agent-infra-internal platform-release-notes context \
79
80
 
80
81
  ### 7. 生成发布说明
81
82
 
82
- **优先使用步骤 3 中获取的历史格式风格,并确保覆盖步骤 3 列出的所有分类。** 如果存在历史发布说明,严格沿用其章节结构、标题风格(含 emoji)、条目格式和双语布局。
83
+ **优先使用步骤 3 中获取的历史格式风格,并确保覆盖步骤 3 列出的所有分类。** 每次动态参考最近 3 条已发布说明;把这些正文共同使用的章节、双语布局和安装段作为稳定格式,条目内容按当前版本变化。不要把样例中的作者或链接复制到当前版本。
83
84
 
84
85
  如果没有历史发布说明,使用以下默认格式化为 Markdown:
85
86
 
86
87
  ```markdown
87
- ## {模块/平台名称}
88
+ ## {Module / 模块}
88
89
 
89
- ### Enhancement
90
+ ### Enhancement / 增强
90
91
 
91
92
  - [{scope}] Description by @author in [#N](url)
92
93
 
93
- ### Bugfix
94
+ ### Bugfix / 修复
94
95
 
95
96
  - [{scope}] Description by @author in [#N](url)
96
97
 
97
- ## Contributors
98
+ ## Contributors / 贡献者
98
99
 
99
100
  @contributor1, @contributor2, @contributor3, @reporter1 (reported #N)
101
+
102
+ ## Installation / 安装
103
+
104
+ {本版本的中英文安装说明,沿用历史正文中的稳定安装步骤}
100
105
  ```
101
106
 
102
107
  **格式规则**:
103
- 1. 条目格式:`- [scope] Description by @author in [#N](url)`
104
- 2. Issue + PR:`in [#Issue](url) and [#PR](url)`
105
- 3. 描述:使用 PR 标题,移除 `type(scope):` 前缀,首字母大写
106
- 4. **贡献者搜集**:
108
+ 1. PR 条目格式:`- [scope] Description by @author in [#N](url)`
109
+ 2. Issue + PR:`in [#Issue](url) and [#PR](url)`;Issue reporter 来自该 PR 的 `closingIssues`
110
+ 3. `pullRequestNumbers` 为空的 commit 单独作为条目,使用 commit subject 和可解析作者;有 commit URL 时链接 commit 本身,不添加 Issue/PR 链接
111
+ 4. 描述:使用 PR 标题或 commit subject;移除 PR 标题中的 `type(scope):` 前缀,首字母大写
112
+ 5. **贡献者搜集**:
107
113
  - **数据源**:
108
114
  - PR author:来自 `.agents/rules/release-commands.md` 中已合并 PR 查询规则
109
115
  - Commit co-authors:来自步骤 3 typed context 的 commit `authors`
@@ -123,7 +129,7 @@ agent-infra-internal platform-release-notes context \
123
129
  - 仅报告贡献的用户以 `@login (reported #N)` 格式展示;同一 reporter 报告多个 Issue 时使用 `@login (reported #N1, #N2)`
124
130
  - Reporter 在 Contributors 段落中排在代码贡献者之后,以逗号分隔追加
125
131
  - Reporter 之间按报告的 Issue 数量降序排列,数量相同时按 login 字典序
126
- 5. 空部分:省略没有条目的部分
132
+ 6. 空部分:省略没有条目的分类;保留历史格式中的双语章节与安装段
127
133
 
128
134
  ### 8. Stage、展示并确认
129
135
 
@@ -147,16 +147,16 @@ Use this template when writing `review-analysis.md` or `review-analysis-r{N}.md`
147
147
 
148
148
  ## State Check
149
149
 
150
- > Record the state-check command, review scope, key result, and uncovered parts; each command starts with `$ `.
150
+ > Record the state-check command, review scope, key result, and uncovered parts.
151
151
  > Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
152
152
 
153
153
  ## Raw Evidence
154
154
 
155
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
155
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
156
156
 
157
157
  - Claim: {verified claim}
158
158
  ```text
159
- $ {command}
159
+ {command}
160
160
  {result summary or decisive excerpt}
161
161
  ```
162
162
 
@@ -147,16 +147,16 @@
147
147
 
148
148
  ## 状态核对
149
149
 
150
- > 记录状态核对命令、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
150
+ > 记录状态核对命令、审查范围、关键结果和未覆盖部分。
151
151
  > 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
152
152
 
153
153
  ## 证据原文
154
154
 
155
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
155
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
156
156
 
157
157
  - 断言:{verified claim}
158
158
  ```text
159
- $ {command}
159
+ {command}
160
160
  {result summary or decisive excerpt}
161
161
  ```
162
162
 
@@ -153,16 +153,16 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
153
153
 
154
154
  ## State Check
155
155
 
156
- > Record the state-check command, review scope, key result, and uncovered parts; each command starts with `$ `.
156
+ > Record the state-check command, review scope, key result, and uncovered parts.
157
157
  > Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
158
158
 
159
159
  ## Raw Evidence
160
160
 
161
- > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require reproducible evidence, exact location, and a decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
161
+ > Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require reproducible evidence, exact location, and a decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
162
162
 
163
163
  - Claim: {verified claim}
164
164
  ```text
165
- $ {command}
165
+ {command}
166
166
  {result summary or decisive excerpt}
167
167
  ```
168
168
 
@@ -153,16 +153,16 @@
153
153
 
154
154
  ## 状态核对
155
155
 
156
- > 记录状态核对命令、审查范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
156
+ > 记录状态核对命令、审查范围、关键结果和未覆盖部分。
157
157
  > 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
158
158
 
159
159
  ## 证据原文
160
160
 
161
- > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现证据、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
161
+ > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现证据、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
162
162
 
163
163
  - 断言:{verified claim}
164
164
  ```text
165
- $ {command}
165
+ {command}
166
166
  {result summary or decisive excerpt}
167
167
  ```
168
168