@fitlab-ai/agent-infra 0.4.0 → 0.4.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.
- package/README.md +1 -3
- package/README.zh-CN.md +1 -3
- package/lib/defaults.json +2 -0
- package/lib/init.js +1 -6
- package/lib/update.js +0 -55
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.md +10 -0
- package/templates/.agents/QUICKSTART.zh-CN.md +10 -0
- package/templates/.agents/README.md +18 -11
- package/templates/.agents/README.zh-CN.md +18 -11
- package/templates/.agents/skills/analyze-task/SKILL.md +1 -4
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/block-task/SKILL.md +1 -5
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +1 -4
- package/templates/.agents/skills/check-task/SKILL.md +1 -5
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/close-codescan/SKILL.md +1 -4
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/close-dependabot/SKILL.md +1 -4
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/commit/SKILL.md +26 -198
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +26 -197
- package/templates/.agents/skills/commit/reference/commit-message.md +60 -0
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +60 -0
- package/templates/.agents/skills/commit/reference/copyright-check.md +39 -0
- package/templates/.agents/skills/commit/reference/copyright-check.zh-CN.md +39 -0
- package/templates/.agents/skills/commit/reference/task-status-update.md +88 -0
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +88 -0
- package/templates/.agents/skills/complete-task/SKILL.md +1 -6
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -4
- package/templates/.agents/skills/create-issue/SKILL.md +32 -251
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +33 -252
- package/templates/.agents/skills/create-issue/reference/label-and-type.md +77 -0
- package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +77 -0
- package/templates/.agents/skills/create-issue/reference/template-matching.md +45 -0
- package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +45 -0
- package/templates/.agents/skills/create-pr/SKILL.md +33 -224
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +32 -222
- package/templates/.agents/skills/create-pr/reference/branch-strategy.md +29 -0
- package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +29 -0
- package/templates/.agents/skills/create-pr/reference/pr-body-template.md +86 -0
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +86 -0
- package/templates/.agents/skills/create-release-note/SKILL.md +10 -13
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +10 -12
- package/templates/.agents/skills/create-task/SKILL.md +1 -4
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/implement-task/SKILL.md +46 -176
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +42 -170
- package/templates/.agents/skills/implement-task/reference/implementation-rules.md +58 -0
- package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +58 -0
- package/templates/.agents/skills/implement-task/reference/report-template.md +63 -0
- package/templates/.agents/skills/implement-task/reference/report-template.zh-CN.md +63 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +1 -4
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/import-dependabot/SKILL.md +1 -4
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/import-issue/SKILL.md +1 -3
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/init-labels/SKILL.md +1 -4
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +1 -4
- package/templates/.agents/skills/init-milestones/SKILL.md +1 -3
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/plan-task/SKILL.md +1 -5
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/refine-task/SKILL.md +38 -162
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +36 -158
- package/templates/.agents/skills/refine-task/reference/fix-workflow.md +76 -0
- package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +76 -0
- package/templates/.agents/skills/refine-task/reference/report-template.md +38 -0
- package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +38 -0
- package/templates/.agents/skills/refine-title/SKILL.md +1 -4
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/release/SKILL.md +10 -12
- package/templates/.agents/skills/release/SKILL.zh-CN.md +10 -11
- package/templates/.agents/skills/review-task/SKILL.md +37 -239
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +37 -238
- package/templates/.agents/skills/review-task/reference/output-templates.md +72 -0
- package/templates/.agents/skills/review-task/reference/output-templates.zh-CN.md +72 -0
- package/templates/.agents/skills/review-task/reference/report-template.md +63 -0
- package/templates/.agents/skills/review-task/reference/report-template.zh-CN.md +63 -0
- package/templates/.agents/skills/review-task/reference/review-criteria.md +24 -0
- package/templates/.agents/skills/review-task/reference/review-criteria.zh-CN.md +24 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +29 -487
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +30 -487
- package/templates/.agents/skills/sync-issue/reference/comment-publish.md +88 -0
- package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +88 -0
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.md +42 -0
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.zh-CN.md +42 -0
- package/templates/.agents/skills/sync-issue/reference/label-sync.md +63 -0
- package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +63 -0
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +37 -0
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +37 -0
- package/templates/.agents/skills/sync-pr/SKILL.md +25 -287
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +29 -291
- package/templates/.agents/skills/sync-pr/reference/comment-publish.md +82 -0
- package/templates/.agents/skills/sync-pr/reference/comment-publish.zh-CN.md +82 -0
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +54 -0
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +54 -0
- package/templates/.agents/skills/test/SKILL.md +1 -3
- package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/test-integration/SKILL.md +1 -4
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/update-agent-infra/SKILL.md +2 -6
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -4
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +42 -46
- package/templates/.agents/skills/upgrade-dependency/SKILL.md +1 -4
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +1 -3
- package/templates/.claude/CLAUDE.md +13 -51
- package/templates/.claude/CLAUDE.zh-CN.md +13 -51
- package/templates/.claude/commands/analyze-task.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.md +2 -1
- package/templates/.claude/commands/block-task.zh-CN.md +2 -1
- package/templates/.claude/commands/check-task.md +2 -1
- package/templates/.claude/commands/check-task.zh-CN.md +2 -1
- package/templates/.claude/commands/close-codescan.md +2 -1
- package/templates/.claude/commands/close-codescan.zh-CN.md +2 -1
- package/templates/.claude/commands/close-dependabot.md +2 -1
- package/templates/.claude/commands/close-dependabot.zh-CN.md +2 -1
- package/templates/.claude/commands/commit.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-issue.md +1 -1
- package/templates/.claude/commands/create-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/create-release-note.md +2 -1
- package/templates/.claude/commands/create-release-note.zh-CN.md +2 -1
- package/templates/.claude/commands/create-task.md +1 -1
- package/templates/.claude/commands/create-task.zh-CN.md +1 -1
- package/templates/.claude/commands/implement-task.md +1 -1
- package/templates/.claude/commands/implement-task.zh-CN.md +1 -1
- package/templates/.claude/commands/import-codescan.md +1 -0
- package/templates/.claude/commands/import-codescan.zh-CN.md +2 -1
- package/templates/.claude/commands/import-dependabot.md +1 -0
- package/templates/.claude/commands/import-dependabot.zh-CN.md +2 -1
- package/templates/.claude/commands/import-issue.md +1 -1
- package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/init-labels.md +1 -0
- package/templates/.claude/commands/init-labels.zh-CN.md +2 -1
- package/templates/.claude/commands/init-milestones.md +2 -1
- package/templates/.claude/commands/init-milestones.zh-CN.md +2 -1
- package/templates/.claude/commands/plan-task.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/refine-task.zh-CN.md +1 -1
- package/templates/.claude/commands/refine-title.md +2 -1
- package/templates/.claude/commands/refine-title.zh-CN.md +2 -1
- package/templates/.claude/commands/release.md +2 -1
- package/templates/.claude/commands/release.zh-CN.md +2 -1
- package/templates/.claude/commands/review-task.md +1 -1
- package/templates/.claude/commands/review-task.zh-CN.md +1 -1
- package/templates/.claude/commands/sync-issue.md +1 -1
- package/templates/.claude/commands/sync-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/sync-pr.md +1 -1
- package/templates/.claude/commands/sync-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/test-integration.md +2 -1
- package/templates/.claude/commands/test-integration.zh-CN.md +2 -1
- package/templates/.claude/commands/test.md +1 -1
- package/templates/.claude/commands/test.zh-CN.md +1 -1
- package/templates/.claude/commands/update-agent-infra.md +2 -1
- package/templates/.claude/commands/update-agent-infra.zh-CN.md +2 -1
- package/templates/.claude/commands/upgrade-dependency.md +2 -1
- package/templates/.claude/commands/upgrade-dependency.zh-CN.md +2 -1
- package/templates/.gemini/commands/_project_/analyze-task.toml +1 -1
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/block-task.toml +1 -1
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/check-task.toml +1 -1
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/close-codescan.toml +1 -1
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/close-dependabot.toml +1 -1
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/commit.toml +1 -1
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/complete-task.toml +1 -1
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-pr.toml +1 -1
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-release-note.toml +1 -1
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-task.toml +1 -1
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/implement-task.toml +1 -1
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-issue.toml +1 -1
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/plan-task.toml +1 -1
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-title.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/release.toml +1 -1
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/review-task.toml +1 -1
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-issue.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-pr.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/test-integration.toml +1 -1
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/test.toml +1 -1
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/update-agent-infra.toml +1 -1
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/upgrade-dependency.toml +1 -1
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +1 -1
- package/templates/.github/hooks/check-version-format.sh +29 -0
- package/templates/.github/hooks/pre-commit +8 -0
- package/templates/.opencode/commands/analyze-task.md +1 -1
- package/templates/.opencode/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/block-task.md +1 -1
- package/templates/.opencode/commands/block-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/check-task.md +1 -1
- package/templates/.opencode/commands/check-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/close-codescan.md +1 -1
- package/templates/.opencode/commands/close-codescan.zh-CN.md +1 -1
- package/templates/.opencode/commands/close-dependabot.md +1 -1
- package/templates/.opencode/commands/close-dependabot.zh-CN.md +1 -1
- package/templates/.opencode/commands/commit.md +1 -1
- package/templates/.opencode/commands/commit.zh-CN.md +1 -1
- package/templates/.opencode/commands/complete-task.md +1 -1
- package/templates/.opencode/commands/complete-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-pr.md +1 -1
- package/templates/.opencode/commands/create-pr.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-release-note.md +1 -1
- package/templates/.opencode/commands/create-release-note.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-task.md +1 -1
- package/templates/.opencode/commands/create-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/implement-task.md +1 -1
- package/templates/.opencode/commands/implement-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-codescan.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-dependabot.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-issue.md +1 -1
- package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
- package/templates/.opencode/commands/init-milestones.md +1 -1
- package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
- package/templates/.opencode/commands/plan-task.md +1 -1
- package/templates/.opencode/commands/plan-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/refine-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/refine-title.md +1 -1
- package/templates/.opencode/commands/refine-title.zh-CN.md +1 -1
- package/templates/.opencode/commands/release.md +1 -1
- package/templates/.opencode/commands/release.zh-CN.md +1 -1
- package/templates/.opencode/commands/review-task.md +1 -1
- package/templates/.opencode/commands/review-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/sync-issue.md +1 -1
- package/templates/.opencode/commands/sync-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/sync-pr.md +1 -1
- package/templates/.opencode/commands/sync-pr.zh-CN.md +1 -1
- package/templates/.opencode/commands/test-integration.md +1 -1
- package/templates/.opencode/commands/test-integration.zh-CN.md +1 -1
- package/templates/.opencode/commands/test.md +1 -1
- package/templates/.opencode/commands/test.zh-CN.md +1 -1
- package/templates/.opencode/commands/update-agent-infra.md +1 -1
- package/templates/.opencode/commands/update-agent-infra.zh-CN.md +1 -1
- package/templates/.opencode/commands/upgrade-dependency.md +1 -1
- package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +1 -1
- package/templates/AGENTS.md +10 -2
- package/templates/AGENTS.zh-CN.md +10 -2
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sync-issue
|
|
3
|
-
description:
|
|
4
|
-
将任务处理进度同步到对应的 GitHub Issue 评论。
|
|
5
|
-
当用户要求同步进度到 Issue 时触发。参数:task-id 或 issue-number。
|
|
3
|
+
description: "将任务进度同步到 GitHub Issue"
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# 同步进度到 Issue
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
把任务状态、交付摘要和产物发布时间线同步到关联的 GitHub Issue。
|
|
11
9
|
|
|
12
10
|
## 执行流程
|
|
13
11
|
|
|
14
12
|
### 1. 解析参数
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
- 纯数字(如 `123`)或 `#` + 数字(如 `#123`)-> 视为 issue number
|
|
18
|
-
- `TASK-` 开头 -> 视为 task-id(现有格式)
|
|
19
|
-
|
|
20
|
-
如果参数是 issue number,使用 Bash 搜索关联任务(注意:`.agents/workspace` 是隐藏目录,Grep/Glob 工具会跳过,必须使用 Bash):
|
|
14
|
+
同时接受 `task-id` 和 issue number。对于 issue number,使用下面的命令反查任务:
|
|
21
15
|
|
|
22
16
|
```bash
|
|
23
17
|
grep -rl "^issue_number: {issue-number}$" \
|
|
@@ -27,479 +21,48 @@ grep -rl "^issue_number: {issue-number}$" \
|
|
|
27
21
|
2>/dev/null | head -1
|
|
28
22
|
```
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
- 如果无返回,提示 `No task found associated with Issue #{issue-number}`
|
|
32
|
-
|
|
33
|
-
如果参数是 task-id,继续执行步骤 2 的现有逻辑。
|
|
24
|
+
如果没有匹配任务,输出 `No task found associated with Issue #{issue-number}`。
|
|
34
25
|
|
|
35
26
|
### 2. 验证任务存在
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
- `.agents/workspace/active/{task-id}/task.md`
|
|
39
|
-
- `.agents/workspace/blocked/{task-id}/task.md`
|
|
40
|
-
- `.agents/workspace/completed/{task-id}/task.md`
|
|
41
|
-
|
|
42
|
-
注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
|
|
43
|
-
|
|
44
|
-
如果步骤 1 已通过 issue number 找到匹配任务,则直接使用该任务目录继续后续步骤,无需再次扫描。
|
|
28
|
+
按 active、blocked、completed 的顺序定位匹配任务目录,再继续后续步骤。
|
|
45
29
|
|
|
46
30
|
### 3. 读取任务信息
|
|
47
31
|
|
|
48
|
-
从 task.md
|
|
49
|
-
- `issue_number`(必需 —— 如果缺失,提示用户)
|
|
50
|
-
- `type`
|
|
51
|
-
- 任务标题、描述、状态
|
|
52
|
-
- `current_step`、`created_at`、`updated_at`、`last_synced_at`(如存在)
|
|
32
|
+
从 task.md 提取 `issue_number`、`type`、标题、状态、`current_step` 和时间戳字段。
|
|
53
33
|
|
|
54
34
|
### 4. 读取上下文文件
|
|
55
35
|
|
|
56
|
-
|
|
57
|
-
- 最高轮次的 `analysis.md` / `analysis-r{N}.md` - 需求分析
|
|
58
|
-
- 最高轮次的 `plan.md` / `plan-r{N}.md` - 技术方案
|
|
59
|
-
- `implementation.md`、`implementation-r*.md` - 实现报告
|
|
60
|
-
- `refinement.md`、`refinement-r*.md` - 修复报告
|
|
61
|
-
- `review.md`、`review-r*.md` - 审查报告
|
|
36
|
+
读取最高轮次的 `analysis.md` / `analysis-r{N}.md`、`plan.md` / `plan-r{N}.md`,以及仍然存在的实现、修复、审查产物。
|
|
62
37
|
|
|
63
38
|
### 5. 探测交付状态
|
|
64
39
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
在开始探测前,先获取仓库坐标和绝对 URL 前缀:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
|
|
71
|
-
owner="${repo%%/*}"
|
|
72
|
-
repo_url="https://github.com/$repo"
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**a) 提取 commit hash**
|
|
76
|
-
|
|
77
|
-
从 task.md 的 `## Activity Log` 中匹配最后一条 `**Commit** by` 记录,活动日志格式固定为:
|
|
78
|
-
|
|
79
|
-
```text
|
|
80
|
-
**Commit** by {agent} — {hash} {subject}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
提取第一个词作为 commit hash;如果找不到,标记为“无 commit”。
|
|
84
|
-
|
|
85
|
-
**b) 检测 commit 是否在受保护分支上**
|
|
86
|
-
|
|
87
|
-
如果存在 commit hash,执行:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
git branch -a --contains {commit-hash} 2>/dev/null
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
判断规则:
|
|
94
|
-
- 输出包含 `main` 或 `master` -> 已合入主分支,记录分支名
|
|
95
|
-
- 输出匹配 `{major}.{minor}.x` 模式的分支名 -> 已合入版本分支,记录分支名
|
|
96
|
-
- 都不匹配 -> 未合入受保护分支
|
|
97
|
-
|
|
98
|
-
**c) 检测关联 PR**
|
|
99
|
-
|
|
100
|
-
检查 task.md 的 `pr_number` 字段;如果存在,执行:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
gh pr view {pr-number} --json state,mergedAt
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
根据返回结果识别 PR 是 `OPEN`、`MERGED` 还是其他状态。
|
|
107
|
-
|
|
108
|
-
**d) 综合判定交付模式**
|
|
109
|
-
|
|
110
|
-
按以下优先级确定摘要模式:
|
|
111
|
-
|
|
112
|
-
| 条件 | 模式 |
|
|
113
|
-
|------|------|
|
|
114
|
-
| commit 已在受保护分支上 | 模式 A:已完成 |
|
|
115
|
-
| 有 PR,且状态为 `OPEN` 或 `MERGED` | 模式 B:PR 阶段 |
|
|
116
|
-
| 其他情况 | 模式 C:开发中 |
|
|
117
|
-
|
|
118
|
-
优先级必须为 `模式 A > 模式 B > 模式 C`。即使存在 PR,只要 commit 已在受保护分支上,也按“已完成”处理。
|
|
119
|
-
|
|
120
|
-
后续所有 commit / PR 链接必须使用绝对 URL:
|
|
121
|
-
- `https://github.com/{owner}/{repo}/commit/{commit-hash}`
|
|
122
|
-
- `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
123
|
-
|
|
124
|
-
不要再使用 `../../commit/...` 或 `../../pull/...` 这类相对路径。
|
|
40
|
+
> 交付模式探测、受保护分支检查、PR 状态判断、绝对 commit/PR 链接,以及完成/PR 阶段/开发中模式矩阵见 `reference/delivery-detection.md`。汇总交付状态前先读取 `reference/delivery-detection.md`。
|
|
125
41
|
|
|
126
42
|
### 6. 同步 Labels 和 Issue Type
|
|
127
43
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
**a) 检查 label 体系是否已初始化**
|
|
131
|
-
|
|
132
|
-
执行:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
判断规则:
|
|
139
|
-
- 返回 `0` -> 说明标准 label 体系缺失。先执行 `init-labels` 技能(幂等),然后重新执行本步骤
|
|
140
|
-
- 返回非 `0` -> 继续后续 label 同步
|
|
141
|
-
|
|
142
|
-
**b) 同步 status label**
|
|
143
|
-
|
|
144
|
-
先读取 Issue 上已有的 `status:` labels:
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
gh issue view {issue-number} --json labels --jq '.labels[].name | select(startswith("status:"))'
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
对每个已有的 `status:` label 执行移除:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
gh issue edit {issue-number} --remove-label "{status-label}"
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
然后按以下优先级决定是否添加新的 `status:` label:
|
|
44
|
+
> label 初始化、`status:` 替换规则、`in:` label 发现,以及 `issue-types` 映射逻辑见 `reference/label-sync.md`。编辑 Issue 元数据前先读取 `reference/label-sync.md`。
|
|
157
45
|
|
|
158
|
-
|
|
159
|
-
|---|---|
|
|
160
|
-
| 任务位于 `blocked/` 目录 | 添加 `status: blocked` |
|
|
161
|
-
| 模式 A:已完成 | 不添加新的 status label |
|
|
162
|
-
| 模式 B:PR 已 MERGED | 不添加新的 status label |
|
|
163
|
-
| 模式 B:PR OPEN | 添加 `status: in-progress` |
|
|
164
|
-
| 模式 C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
|
|
165
|
-
| 模式 C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
|
|
46
|
+
### 7. 同步 Development 关联
|
|
166
47
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
gh issue edit {issue-number} --add-label "{status-label}"
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**c) 同步 in: label**
|
|
174
|
-
|
|
175
|
-
从实现报告(优先)或 `analysis.md` 中提取受影响文件路径:
|
|
176
|
-
- 优先读取 `implementation.md` 与 `implementation-r*.md` 中 `## 修改文件` / `## 新建文件` 的文件列表
|
|
177
|
-
- 如果实现报告不存在,则回退到分析报告中的受影响文件列表
|
|
178
|
-
|
|
179
|
-
对每个文件路径:
|
|
180
|
-
1. 取第一级目录作为模块名
|
|
181
|
-
2. 去重
|
|
182
|
-
3. 检查仓库中是否存在对应 label:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
4. 只有存在精确匹配的 `in: {module}` label 时才执行:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
gh issue edit {issue-number} --add-label "in: {module}"
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
5. **只添加,不移除**现有的 `in:` labels
|
|
195
|
-
|
|
196
|
-
**d) 同步 Issue Type 字段**
|
|
197
|
-
|
|
198
|
-
根据 task.md 的 `type` 字段映射 GitHub 原生 Issue Type:
|
|
199
|
-
|
|
200
|
-
| task.md type | GitHub Issue Type |
|
|
201
|
-
|---|---|
|
|
202
|
-
| `bug`、`bugfix` | `Bug` |
|
|
203
|
-
| `feature`、`enhancement` | `Feature` |
|
|
204
|
-
| `task`、`documentation`、`dependency-upgrade`、`chore`、`docs`、`refactor`、`refactoring` 及其他值 | `Task` |
|
|
205
|
-
|
|
206
|
-
先查询组织可用的 Issue Types:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
gh api "orgs/$owner/issue-types" --jq '.[].name'
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
然后仅在目标类型存在时执行:
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
容错要求:
|
|
219
|
-
- 如果 API 返回 `404`、仓库 owner 不是组织,或仓库未启用 Issue Types,记录 `Issue Type: skipped (not enabled)` 并继续,不要让整个同步失败
|
|
220
|
-
- 如果目标类型不存在,记录 `Issue Type: skipped (type not available)`
|
|
221
|
-
- 不要尝试创建新的 Issue Type;只使用组织中已存在的类型名称
|
|
222
|
-
|
|
223
|
-
### 7. 同步 Development
|
|
224
|
-
|
|
225
|
-
如果 task.md 包含 `pr_number`,确保 PR body 关联当前 Issue。
|
|
226
|
-
|
|
227
|
-
1. 读取 PR body:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
gh pr view {pr-number} --json body --jq '.body // ""'
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
2. 检查 body 是否已经包含以下任一关键词:
|
|
48
|
+
如果存在 `pr_number`,确保 PR 正文包含以下任一项:
|
|
234
49
|
- `Closes #{issue-number}`
|
|
235
50
|
- `Fixes #{issue-number}`
|
|
236
51
|
- `Resolves #{issue-number}`
|
|
237
52
|
|
|
238
|
-
|
|
239
|
-
4. 如果不存在,在 body 末尾追加:
|
|
53
|
+
### 8. 同步里程碑
|
|
240
54
|
|
|
241
|
-
|
|
242
|
-
gh pr edit {pr-number} --body "$(cat <<'EOF'
|
|
243
|
-
{existing-body}
|
|
244
|
-
|
|
245
|
-
Closes #{issue-number}
|
|
246
|
-
EOF
|
|
247
|
-
)"
|
|
248
|
-
```
|
|
55
|
+
> milestone 继承、版本分支推断和 `General Backlog` 回退规则见 `reference/milestone-sync.md`。编辑 Issue milestone 前先读取 `reference/milestone-sync.md`。
|
|
249
56
|
|
|
250
|
-
|
|
57
|
+
### 9. 发布上下文产物
|
|
251
58
|
|
|
252
|
-
|
|
59
|
+
> 已有评论探测、隐藏标记、产物时间线、summary 评论顺序,以及绝对产物链接规则见 `reference/comment-publish.md`。发布 Issue 评论前先读取 `reference/comment-publish.md`。
|
|
253
60
|
|
|
254
|
-
|
|
61
|
+
> **Shell 安全规则**(发布评论前必读):
|
|
62
|
+
> 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
|
|
63
|
+
> 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
|
|
255
64
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
执行:
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
gh issue view {issue-number} --json milestone --jq '.milestone.title // empty'
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
如果返回非空,保留现有里程碑并记录 `Milestone: {existing} (preserved)`,跳过后续里程碑同步步骤。
|
|
265
|
-
|
|
266
|
-
**b) 检查 task.md 是否显式指定 milestone**
|
|
267
|
-
|
|
268
|
-
如果 task.md frontmatter 中存在非空 `milestone` 字段,优先使用该值作为目标里程碑。
|
|
269
|
-
此字段应填写线里程碑标题或 `General Backlog`,不要自动指定具体版本里程碑。
|
|
270
|
-
|
|
271
|
-
**c) 推断目标线里程碑**
|
|
272
|
-
|
|
273
|
-
当 task.md 未显式指定 `milestone` 时,按以下顺序推断:
|
|
274
|
-
|
|
275
|
-
1. 检测当前分支:
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
git branch --show-current
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
- 如果分支名匹配 `{major}.{minor}.x`,目标里程碑为同名线里程碑 `{major}.{minor}.x`
|
|
282
|
-
|
|
283
|
-
2. 如果当前分支是 `main` 或 `master`,检测现有版本分支:
|
|
284
|
-
|
|
285
|
-
```bash
|
|
286
|
-
git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
- 如果存在最高版本分支 `X.Y.x`,则目标里程碑为 `(X+1).0.x`
|
|
290
|
-
- 如果不存在版本分支,则读取最新 tag:
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
git tag --list 'v*' --sort=-v:refname | head -1
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
- 当最新 tag 存在且可解析为 `X.Y.Z` 时,目标里程碑为 `X.Y.x`
|
|
297
|
-
|
|
298
|
-
3. 如果以上规则都无法得出结果,回退到 `General Backlog`
|
|
299
|
-
|
|
300
|
-
**d) 查找目标里程碑编号**
|
|
301
|
-
|
|
302
|
-
执行:
|
|
303
|
-
|
|
304
|
-
```bash
|
|
305
|
-
gh api "repos/$repo/milestones" --paginate \
|
|
306
|
-
--jq '.[] | select(.title=="{target}") | .number'
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
- 如果目标里程碑不存在,则降级到查找 `General Backlog`
|
|
310
|
-
- 如果 `General Backlog` 也不存在,则记录 `Milestone: skipped (not found)` 并跳过关联
|
|
311
|
-
|
|
312
|
-
**e) 关联 Issue 到里程碑**
|
|
313
|
-
|
|
314
|
-
一旦找到目标里程碑编号,执行:
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
gh api "repos/$repo/issues/{issue-number}" -X PATCH -F milestone={milestone-number}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
记录:
|
|
321
|
-
- `Milestone: {target} (assigned)` 或
|
|
322
|
-
- `Milestone: General Backlog (fallback)`
|
|
323
|
-
|
|
324
|
-
### 9. 拉取已有评论并构建已发布文件集合
|
|
325
|
-
|
|
326
|
-
一次性拉取 Issue 的全部评论,并基于隐藏标识构建“已发布文件 stem 集合”,同时在本地构建待发布的产物时间线。
|
|
327
|
-
|
|
328
|
-
先拉取评论(保留 comment id 与 body):
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
comments_jsonl="$(mktemp)"
|
|
332
|
-
|
|
333
|
-
gh api "repos/$repo/issues/{issue-number}/comments" \
|
|
334
|
-
--paginate \
|
|
335
|
-
--jq '.[] | {id, body}' > "$comments_jsonl"
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
从 `task.md` 的 Activity Log 中提取所有以 `→ {filename}` 结尾的记录。
|
|
339
|
-
|
|
340
|
-
解析规则:
|
|
341
|
-
- 使用正则 `/→\s+(\S+\.md)\s*$/` 提取文件名
|
|
342
|
-
- 去掉 `.md` 后缀得到 `{file-stem}`
|
|
343
|
-
- 按 Activity Log 中的出现顺序构建产物时间线
|
|
344
|
-
- `summary` 仍作为最后一个固定产物追加到时间线末尾
|
|
345
|
-
- `summary` 始终排在最末
|
|
346
|
-
|
|
347
|
-
仅当 Activity Log 引用的文件当前存在于任务目录中时,才纳入待发布集合;缺失文件跳过,不报错。
|
|
348
|
-
|
|
349
|
-
每条同步评论的第一行必须插入隐藏标识:
|
|
350
|
-
|
|
351
|
-
```html
|
|
352
|
-
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
其中 `{file-stem}` 为去掉 `.md` 后缀后的文件名,例如 `analysis`、`plan`、`implementation`、`implementation-r2`、`review-r3`;`summary` 仍使用字面量 `summary`。
|
|
356
|
-
|
|
357
|
-
时间线示例:
|
|
358
|
-
`analysis → plan → implementation → review → refinement → analysis-r2 → plan-r2 → implementation-r2 → review-r2 → summary`
|
|
359
|
-
|
|
360
|
-
对每个 `{file-stem}`,用本地检索判断是否已发布:
|
|
361
|
-
|
|
362
|
-
```bash
|
|
363
|
-
grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
- 匹配到:该产物已发布,后续默认跳过
|
|
367
|
-
- 未匹配:该产物尚未发布,可以创建新评论
|
|
368
|
-
|
|
369
|
-
对 `summary` 产物,额外提取评论 id 以便后续更新:
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
summary_comment_id="$(
|
|
373
|
-
jq -r 'select(.body | contains("<!-- sync-issue:{task-id}:summary -->")) | .id' \
|
|
374
|
-
"$comments_jsonl" | head -1
|
|
375
|
-
)"
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
在步骤 9 结束前,基于上述已发布/未发布结果,预先判断 `has_unpublished_artifacts`:是否存在任何尚未发布的非 `summary` 产物。该判断在步骤 10 执行期间保持不变,仅用于决定 `summary` 是原地更新还是删除后在尾部重建。
|
|
379
|
-
|
|
380
|
-
幂等要求:
|
|
381
|
-
- 第一次执行时,只发布当前已存在产物对应的文件评论
|
|
382
|
-
- 第二次执行时,必须跳过已发布文件,只补发新增产物(例如 `implementation-r2`、`review-r2`)
|
|
383
|
-
- 如果所有产物文件评论都已发布,且 `summary` 内容没有变化,则本次不发布任何新评论
|
|
384
|
-
- 如果 `summary` 已发布但交付状态发生变化:当本次有新产物发布时,删除旧 `summary` 并在尾部重建;当本次无新产物发布时,原地更新原评论
|
|
385
|
-
|
|
386
|
-
### 10. 按时间线逐条发布上下文文件
|
|
387
|
-
|
|
388
|
-
按步骤 9 生成的已排序产物列表逐条处理,不要再使用固定 5 步骤,也不要把同类型多轮次产物合并到一条评论。
|
|
389
|
-
|
|
390
|
-
**a) 为每个产物准备评论内容**
|
|
391
|
-
|
|
392
|
-
- `analysis`:发布 `analysis.md` 原文
|
|
393
|
-
- `plan`:发布 `plan.md` 原文
|
|
394
|
-
- `analysis-r{N}`、`plan-r{N}`:每个文件各自发布一条评论,正文直接使用对应产物原文
|
|
395
|
-
- `implementation`、`implementation-r{N}`:每个文件各自发布一条评论,正文直接使用对应实现报告原文
|
|
396
|
-
- `refinement`、`refinement-r{N}`:每个文件各自发布一条评论,正文直接使用对应修复报告原文
|
|
397
|
-
- `review`、`review-r{N}`:每个文件各自发布一条评论,正文直接使用对应审查报告原文
|
|
398
|
-
- `summary`:生成精简交付摘要,只包含当前交付状态与 GitHub 上可访问的绝对链接
|
|
399
|
-
|
|
400
|
-
除 `summary` 外,其余产物都应发布原文,不要再次压缩成摘要。
|
|
401
|
-
|
|
402
|
-
每条评论统一格式:
|
|
403
|
-
|
|
404
|
-
```markdown
|
|
405
|
-
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
406
|
-
## {产物标题}
|
|
407
|
-
|
|
408
|
-
{原文内容或 summary 内容}
|
|
409
|
-
|
|
410
|
-
---
|
|
411
|
-
*由 AI 自动生成 · 内部追踪:{task-id}*
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
推荐标题映射:
|
|
415
|
-
- `analysis` -> `需求分析`
|
|
416
|
-
- `analysis-r2` -> `需求分析(Round 2)`
|
|
417
|
-
- `analysis-r{N}` -> `需求分析(Round {N})`
|
|
418
|
-
- `plan` -> `技术方案`
|
|
419
|
-
- `plan-r2` -> `技术方案(Round 2)`
|
|
420
|
-
- `plan-r{N}` -> `技术方案(Round {N})`
|
|
421
|
-
- `implementation` -> `实现报告(Round 1)`
|
|
422
|
-
- `implementation-r2` -> `实现报告(Round 2)`
|
|
423
|
-
- `implementation-r{N}` -> `实现报告(Round {N})`
|
|
424
|
-
- `refinement` -> `修复报告(Round 1)`
|
|
425
|
-
- `refinement-r2` -> `修复报告(Round 2)`
|
|
426
|
-
- `refinement-r{N}` -> `修复报告(Round {N})`
|
|
427
|
-
- `review` -> `审查报告(Round 1)`
|
|
428
|
-
- `review-r2` -> `审查报告(Round 2)`
|
|
429
|
-
- `review-r{N}` -> `审查报告(Round {N})`
|
|
430
|
-
- `summary` -> `交付摘要`
|
|
431
|
-
|
|
432
|
-
`summary` 评论建议格式:
|
|
433
|
-
|
|
434
|
-
```markdown
|
|
435
|
-
<!-- sync-issue:{task-id}:summary -->
|
|
436
|
-
## 交付摘要
|
|
437
|
-
|
|
438
|
-
**更新时间**:{当前时间}
|
|
439
|
-
**状态**:{模式化状态描述}
|
|
440
|
-
|
|
441
|
-
| 类型 | 内容 |
|
|
442
|
-
|---|---|
|
|
443
|
-
| 分支 | `{branch 或 N/A}` |
|
|
444
|
-
| Commit | [`{commit-short}`](https://github.com/{owner}/{repo}/commit/{commit-hash}) 或 `N/A` |
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
*由 AI 自动生成 · 内部追踪:{task-id}*
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
模式化状态描述要求:
|
|
451
|
-
- 模式 A:`✅ 已完成`
|
|
452
|
-
- 模式 B:`PR 阶段`
|
|
453
|
-
- 模式 C:`开发中,当前步骤为 {current_step}`
|
|
454
|
-
|
|
455
|
-
**b) 跳过已发布或缺失的产物**
|
|
456
|
-
|
|
457
|
-
- 对于 `analysis.md`、`plan.md`、`implementation*.md`、`review*.md`:如果对应文件不存在,直接跳过,不报错
|
|
458
|
-
- 对于任意产物:如果标识已存在,默认跳过
|
|
459
|
-
- 对于 `summary`:即使标识已存在,也要重新生成候选内容,用于比较是否需要更新
|
|
460
|
-
|
|
461
|
-
**c) 发布新评论**
|
|
462
|
-
|
|
463
|
-
当产物尚未发布时,执行:
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
gh issue comment {issue-number} --body "$(cat <<'EOF'
|
|
467
|
-
{comment-body}
|
|
468
|
-
EOF
|
|
469
|
-
)"
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
**d) 发布或重建 summary 评论**
|
|
473
|
-
|
|
474
|
-
`summary` 必须始终保持为最后一条评论。根据以下条件决定处理方式:
|
|
475
|
-
|
|
476
|
-
- `summary` 不存在:按步骤 10c 发布新的 `summary` 评论
|
|
477
|
-
- `summary` 已存在且 `has_unpublished_artifacts=true`:先删除旧 `summary` 评论,再按步骤 10c 发布新的 `summary` 评论
|
|
478
|
-
- `summary` 已存在且 `has_unpublished_artifacts=false` 且新生成内容与已有内容不同:原地更新原评论
|
|
479
|
-
- `summary` 已存在且 `has_unpublished_artifacts=false` 且内容相同:不做任何操作
|
|
480
|
-
|
|
481
|
-
删除旧 `summary` 评论时,执行:
|
|
482
|
-
|
|
483
|
-
```bash
|
|
484
|
-
gh api "repos/$repo/issues/comments/{summary_comment_id}" -X DELETE
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
原地更新已有 `summary` 评论时,执行:
|
|
488
|
-
|
|
489
|
-
```bash
|
|
490
|
-
gh api "repos/$repo/issues/comments/{summary_comment_id}" -X PATCH -f body="$(cat <<'EOF'
|
|
491
|
-
{comment-body}
|
|
492
|
-
EOF
|
|
493
|
-
)"
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
**e) 零操作场景**
|
|
497
|
-
|
|
498
|
-
如果所有产物都已同步,且 `summary` 无需更新:
|
|
499
|
-
- 不发布任何新评论
|
|
500
|
-
- 在最终告知用户时明确说明:`所有产物已同步,无新内容`
|
|
501
|
-
|
|
502
|
-
### 11. 更新任务状态
|
|
65
|
+
### 10. 更新任务状态
|
|
503
66
|
|
|
504
67
|
获取当前时间:
|
|
505
68
|
|
|
@@ -507,42 +70,22 @@ EOF
|
|
|
507
70
|
date "+%Y-%m-%d %H:%M:%S"
|
|
508
71
|
```
|
|
509
72
|
|
|
510
|
-
|
|
511
|
-
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
512
|
-
```
|
|
513
|
-
- {yyyy-MM-dd HH:mm:ss} — **Sync to Issue** by {agent} — Progress synced to Issue #{issue-number}
|
|
514
|
-
```
|
|
73
|
+
更新 task.md 中的 `last_synced_at`,并追加 Sync to Issue 的 Activity Log。
|
|
515
74
|
|
|
516
|
-
###
|
|
75
|
+
### 11. 告知用户
|
|
517
76
|
|
|
518
|
-
|
|
519
|
-
进度已同步到 Issue #{issue-number}。
|
|
520
|
-
|
|
521
|
-
同步结果:
|
|
522
|
-
- 新发布评论:{数量}
|
|
523
|
-
- 更新评论:{数量}
|
|
524
|
-
- 已跳过步骤:{步骤列表或 `无`}
|
|
525
|
-
- 当前状态:{状态}
|
|
526
|
-
- Labels:status={status-label 或 cleared},in:={新增数量}
|
|
527
|
-
- Issue Type:{Bug / Feature / Task / skipped}
|
|
528
|
-
- Milestone:{preserved / assigned / fallback / skipped}
|
|
529
|
-
- Development:{已追加 Closes 关联 / 已存在关联 / 无 PR,跳过}
|
|
530
|
-
|
|
531
|
-
查看:https://github.com/{owner}/{repo}/issues/{issue-number}
|
|
532
|
-
|
|
533
|
-
如果本次没有发布或更新任何评论,请明确说明:所有步骤已同步,无新内容。
|
|
534
|
-
```
|
|
77
|
+
汇总已同步的 labels、milestone、development 关联、已发布评论,并给出 Issue URL。
|
|
535
78
|
|
|
536
79
|
## 注意事项
|
|
537
80
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
81
|
+
- 隐藏评论标记必须保持为 `<!-- sync-issue:{task-id}:{file-stem} -->`
|
|
82
|
+
- 必须使用绝对链接,例如 `https://github.com/{owner}/{repo}/commit/{commit-hash}` 和 `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
83
|
+
- 产物时间线按 Activity Log 顺序构建,而不是固定的 `analysis -> plan -> implementation -> review -> summary`
|
|
84
|
+
- 发布评论时遵守步骤 9 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
|
|
542
85
|
|
|
543
86
|
## 错误处理
|
|
544
87
|
|
|
545
|
-
-
|
|
546
|
-
- 缺少
|
|
547
|
-
-
|
|
548
|
-
-
|
|
88
|
+
- 任务未找到:`Task {task-id} not found`
|
|
89
|
+
- 缺少 `issue_number`:`Task has no issue_number field`
|
|
90
|
+
- GitHub CLI 认证失败:`Please check GitHub CLI authentication`
|
|
91
|
+
- Issue 不存在:`Issue #{number} not found`
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Comment Publication
|
|
2
|
+
|
|
3
|
+
Read this file before creating or updating Issue comments.
|
|
4
|
+
|
|
5
|
+
## Fetch Existing Comments and Build the Published Artifact Set
|
|
6
|
+
|
|
7
|
+
Use hidden markers like:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Artifact extraction rules:
|
|
14
|
+
- extract artifact filenames from Activity Log with `/→\s+(\S+\.md)\s*$/`
|
|
15
|
+
- drop the `.md` suffix to get `{file-stem}`
|
|
16
|
+
- build the artifact timeline in Activity Log order
|
|
17
|
+
- append `summary` as the fixed final artifact
|
|
18
|
+
|
|
19
|
+
Build the artifact timeline in Activity Log order. Only include artifacts whose files still exist.
|
|
20
|
+
Typical artifact filenames include `implementation-r*.md` and `review-r*.md`.
|
|
21
|
+
|
|
22
|
+
Published-set detection:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Interpretation:
|
|
29
|
+
- match found -> the artifact is already published
|
|
30
|
+
- no match -> the artifact can be created now
|
|
31
|
+
|
|
32
|
+
Define `has_unpublished_artifacts` before publishing comments: whether any non-`summary` artifact in the timeline is still unpublished. Keep that flag fixed while processing this sync pass.
|
|
33
|
+
|
|
34
|
+
Recommended title mapping:
|
|
35
|
+
|
|
36
|
+
| file-stem | title |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `analysis` | `Requirements Analysis` |
|
|
39
|
+
| `analysis-r{N}` | `Requirements Analysis (Round {N})` |
|
|
40
|
+
| `plan` | `Technical Plan` |
|
|
41
|
+
| `plan-r{N}` | `Technical Plan (Round {N})` |
|
|
42
|
+
| `implementation` | `Implementation Report (Round 1)` |
|
|
43
|
+
| `implementation-r{N}` | `Implementation Report (Round {N})` |
|
|
44
|
+
| `refinement` | `Refinement Report (Round 1)` |
|
|
45
|
+
| `refinement-r{N}` | `Refinement Report (Round {N})` |
|
|
46
|
+
| `review` | `Review Report (Round 1)` |
|
|
47
|
+
| `review-r{N}` | `Review Report (Round {N})` |
|
|
48
|
+
| `summary` | `Delivery Summary` |
|
|
49
|
+
|
|
50
|
+
## Publish Context Files One by One in Timeline Order
|
|
51
|
+
|
|
52
|
+
Keep `summary` last. Do not collapse multiple rounds into one comment.
|
|
53
|
+
|
|
54
|
+
Unified comment format:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
58
|
+
## {artifact-title}
|
|
59
|
+
|
|
60
|
+
{artifact original body or summary body}
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
*Generated by AI · Internal tracking: {task-id}*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Summary handling rules:
|
|
67
|
+
- if `summary` does not exist, create it
|
|
68
|
+
- if `summary` exists and `has_unpublished_artifacts=true`, delete the old `summary` and recreate it at the end
|
|
69
|
+
- if `summary` exists, `has_unpublished_artifacts=false`, and the content changed, patch the existing comment in place
|
|
70
|
+
- if `summary` exists, `has_unpublished_artifacts=false`, and the content is unchanged, do nothing
|
|
71
|
+
|
|
72
|
+
Zero-operation rule:
|
|
73
|
+
- if all artifacts are already synced and `summary` content is unchanged, publish nothing and report `All artifacts are already synced; no new content`
|
|
74
|
+
|
|
75
|
+
When updating an existing summary comment, use:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
gh api "repos/$repo/issues/comments/{summary_comment_id}" -X PATCH -f body="$(cat <<'EOF'
|
|
79
|
+
{comment-body}
|
|
80
|
+
EOF
|
|
81
|
+
)"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Required link formats:
|
|
85
|
+
- `https://github.com/{owner}/{repo}/commit/{commit-hash}`
|
|
86
|
+
- `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
87
|
+
|
|
88
|
+
Do not fall back to a fixed `analysis -> plan -> implementation -> review -> summary` order.
|