@fitlab-ai/agent-infra 0.3.0
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/License.txt +21 -0
- package/README.md +170 -0
- package/README.zh-CN.md +170 -0
- package/bin/cli.js +65 -0
- package/lib/defaults.json +45 -0
- package/lib/init.js +203 -0
- package/lib/log.js +27 -0
- package/lib/paths.js +48 -0
- package/lib/prompt.js +70 -0
- package/lib/render.js +99 -0
- package/lib/update.js +161 -0
- package/lib/version.js +7 -0
- package/package.json +48 -0
- package/templates/.agent-workspace/README.md +26 -0
- package/templates/.agent-workspace/README.zh-CN.md +26 -0
- package/templates/.agents/QUICKSTART.md +166 -0
- package/templates/.agents/QUICKSTART.zh-CN.md +166 -0
- package/templates/.agents/README.md +134 -0
- package/templates/.agents/README.zh-CN.md +134 -0
- package/templates/.agents/skills/analyze-task/SKILL.md +169 -0
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +169 -0
- package/templates/.agents/skills/block-task/SKILL.md +164 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +163 -0
- package/templates/.agents/skills/check-task/SKILL.md +122 -0
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-dependabot/SKILL.md +130 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +130 -0
- package/templates/.agents/skills/commit/SKILL.md +218 -0
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +217 -0
- package/templates/.agents/skills/complete-task/SKILL.md +139 -0
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +137 -0
- package/templates/.agents/skills/create-pr/SKILL.md +126 -0
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +125 -0
- package/templates/.agents/skills/create-release-note/SKILL.md +167 -0
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +166 -0
- package/templates/.agents/skills/create-task/SKILL.md +143 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +143 -0
- package/templates/.agents/skills/implement-task/SKILL.md +229 -0
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +227 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +103 -0
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +103 -0
- package/templates/.agents/skills/import-dependabot/SKILL.md +107 -0
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +107 -0
- package/templates/.agents/skills/import-issue/SKILL.md +119 -0
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +119 -0
- package/templates/.agents/skills/init-labels/SKILL.md +74 -0
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +111 -0
- package/templates/.agents/skills/init-milestones/SKILL.md +74 -0
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +169 -0
- package/templates/.agents/skills/plan-task/SKILL.md +225 -0
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +225 -0
- package/templates/.agents/skills/refine-task/SKILL.md +200 -0
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +200 -0
- package/templates/.agents/skills/refine-title/SKILL.md +84 -0
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +83 -0
- package/templates/.agents/skills/release/SKILL.md +142 -0
- package/templates/.agents/skills/release/SKILL.zh-CN.md +141 -0
- package/templates/.agents/skills/release/scripts/manage-milestones.sh +80 -0
- package/templates/.agents/skills/review-task/SKILL.md +276 -0
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +276 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +569 -0
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +569 -0
- package/templates/.agents/skills/sync-pr/SKILL.md +142 -0
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +142 -0
- package/templates/.agents/skills/test/SKILL.md +61 -0
- package/templates/.agents/skills/test/SKILL.zh-CN.md +61 -0
- package/templates/.agents/skills/test-integration/SKILL.md +70 -0
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +69 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.md +136 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +124 -0
- package/templates/.agents/skills/update-agent-infra/scripts/package.json +3 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +469 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.md +88 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +87 -0
- package/templates/.agents/templates/handoff.md +60 -0
- package/templates/.agents/templates/handoff.zh-CN.md +60 -0
- package/templates/.agents/templates/review-report.md +67 -0
- package/templates/.agents/templates/review-report.zh-CN.md +67 -0
- package/templates/.agents/templates/task.md +65 -0
- package/templates/.agents/templates/task.zh-CN.md +65 -0
- package/templates/.agents/workflows/bug-fix.yaml +149 -0
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +149 -0
- package/templates/.agents/workflows/code-review.yaml +60 -0
- package/templates/.agents/workflows/code-review.zh-CN.yaml +60 -0
- package/templates/.agents/workflows/feature-development.yaml +150 -0
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +150 -0
- package/templates/.agents/workflows/refactoring.yaml +154 -0
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +154 -0
- package/templates/.claude/CLAUDE.md +163 -0
- package/templates/.claude/CLAUDE.zh-CN.md +163 -0
- package/templates/.claude/commands/analyze-task.md +8 -0
- package/templates/.claude/commands/analyze-task.zh-CN.md +8 -0
- package/templates/.claude/commands/block-task.md +8 -0
- package/templates/.claude/commands/block-task.zh-CN.md +8 -0
- package/templates/.claude/commands/check-task.md +8 -0
- package/templates/.claude/commands/check-task.zh-CN.md +8 -0
- package/templates/.claude/commands/close-codescan.md +8 -0
- package/templates/.claude/commands/close-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/close-dependabot.md +8 -0
- package/templates/.claude/commands/close-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/commit.md +7 -0
- package/templates/.claude/commands/commit.zh-CN.md +7 -0
- package/templates/.claude/commands/complete-task.md +8 -0
- package/templates/.claude/commands/complete-task.zh-CN.md +8 -0
- package/templates/.claude/commands/create-pr.md +8 -0
- package/templates/.claude/commands/create-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/create-release-note.md +8 -0
- package/templates/.claude/commands/create-release-note.zh-CN.md +8 -0
- package/templates/.claude/commands/create-task.md +8 -0
- package/templates/.claude/commands/create-task.zh-CN.md +8 -0
- package/templates/.claude/commands/implement-task.md +8 -0
- package/templates/.claude/commands/implement-task.zh-CN.md +8 -0
- package/templates/.claude/commands/import-codescan.md +8 -0
- package/templates/.claude/commands/import-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/import-dependabot.md +8 -0
- package/templates/.claude/commands/import-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/import-issue.md +8 -0
- package/templates/.claude/commands/import-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/init-labels.md +7 -0
- package/templates/.claude/commands/init-labels.zh-CN.md +7 -0
- package/templates/.claude/commands/init-milestones.md +8 -0
- package/templates/.claude/commands/init-milestones.zh-CN.md +8 -0
- package/templates/.claude/commands/plan-task.md +8 -0
- package/templates/.claude/commands/plan-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-task.md +8 -0
- package/templates/.claude/commands/refine-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-title.md +8 -0
- package/templates/.claude/commands/refine-title.zh-CN.md +8 -0
- package/templates/.claude/commands/release.md +8 -0
- package/templates/.claude/commands/release.zh-CN.md +8 -0
- package/templates/.claude/commands/review-task.md +8 -0
- package/templates/.claude/commands/review-task.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-issue.md +8 -0
- package/templates/.claude/commands/sync-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-pr.md +8 -0
- package/templates/.claude/commands/sync-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/test-integration.md +7 -0
- package/templates/.claude/commands/test-integration.zh-CN.md +7 -0
- package/templates/.claude/commands/test.md +7 -0
- package/templates/.claude/commands/test.zh-CN.md +7 -0
- package/templates/.claude/commands/update-agent-infra.md +7 -0
- package/templates/.claude/commands/update-agent-infra.zh-CN.md +7 -0
- package/templates/.claude/commands/upgrade-dependency.md +8 -0
- package/templates/.claude/commands/upgrade-dependency.zh-CN.md +8 -0
- package/templates/.claude/project-rules.md +65 -0
- package/templates/.claude/project-rules.zh-CN.md +65 -0
- package/templates/.claude/settings.json +20 -0
- package/templates/.codex/README.md +38 -0
- package/templates/.codex/README.zh-CN.md +37 -0
- package/templates/.editorconfig +15 -0
- package/templates/.gemini/commands/_project_/analyze-task.toml +8 -0
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/commit.toml +6 -0
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/complete-task.toml +8 -0
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-milestones.toml +10 -0
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +10 -0
- package/templates/.gemini/commands/_project_/plan-task.toml +8 -0
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/release.toml +8 -0
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/test-integration.toml +6 -0
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/test.toml +6 -0
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.toml +8 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +8 -0
- package/templates/.gemini/settings.json +3 -0
- package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +149 -0
- package/templates/.github/ISSUE_TEMPLATE/02_question.yml +101 -0
- package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +131 -0
- package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +165 -0
- package/templates/.github/ISSUE_TEMPLATE/05_other.yml +147 -0
- package/templates/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/templates/.github/PULL_REQUEST_TEMPLATE.md +123 -0
- package/templates/.github/dependabot.yml +17 -0
- package/templates/.github/hooks/check-utf8-encoding.sh +25 -0
- package/templates/.github/release.yml +27 -0
- package/templates/.github/workflows/pr-title-check.yml +42 -0
- package/templates/.mailmap +4 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +232 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +232 -0
- package/templates/.opencode/README.md +76 -0
- package/templates/.opencode/README.zh-CN.md +77 -0
- package/templates/.opencode/commands/analyze-task.md +11 -0
- package/templates/.opencode/commands/analyze-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/block-task.md +11 -0
- package/templates/.opencode/commands/block-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/check-task.md +11 -0
- package/templates/.opencode/commands/check-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-codescan.md +11 -0
- package/templates/.opencode/commands/close-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-dependabot.md +11 -0
- package/templates/.opencode/commands/close-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/commit.md +9 -0
- package/templates/.opencode/commands/commit.zh-CN.md +9 -0
- package/templates/.opencode/commands/complete-task.md +11 -0
- package/templates/.opencode/commands/complete-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-pr.md +11 -0
- package/templates/.opencode/commands/create-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-release-note.md +11 -0
- package/templates/.opencode/commands/create-release-note.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-task.md +11 -0
- package/templates/.opencode/commands/create-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/implement-task.md +11 -0
- package/templates/.opencode/commands/implement-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-codescan.md +11 -0
- package/templates/.opencode/commands/import-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-dependabot.md +11 -0
- package/templates/.opencode/commands/import-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-issue.md +11 -0
- package/templates/.opencode/commands/import-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/init-labels.md +9 -0
- package/templates/.opencode/commands/init-labels.zh-CN.md +9 -0
- package/templates/.opencode/commands/init-milestones.md +11 -0
- package/templates/.opencode/commands/init-milestones.zh-CN.md +11 -0
- package/templates/.opencode/commands/plan-task.md +11 -0
- package/templates/.opencode/commands/plan-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-task.md +11 -0
- package/templates/.opencode/commands/refine-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-title.md +11 -0
- package/templates/.opencode/commands/refine-title.zh-CN.md +11 -0
- package/templates/.opencode/commands/release.md +11 -0
- package/templates/.opencode/commands/release.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-task.md +11 -0
- package/templates/.opencode/commands/review-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-issue.md +11 -0
- package/templates/.opencode/commands/sync-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-pr.md +11 -0
- package/templates/.opencode/commands/sync-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/test-integration.md +9 -0
- package/templates/.opencode/commands/test-integration.zh-CN.md +9 -0
- package/templates/.opencode/commands/test.md +9 -0
- package/templates/.opencode/commands/test.zh-CN.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.zh-CN.md +9 -0
- package/templates/.opencode/commands/upgrade-dependency.md +11 -0
- package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +11 -0
- package/templates/AGENTS.md +91 -0
- package/templates/AGENTS.zh-CN.md +91 -0
- package/templates/CONTRIBUTING.md +126 -0
- package/templates/CONTRIBUTING.zh-CN.md +124 -0
- package/templates/SECURITY.md +131 -0
- package/templates/SECURITY.zh-CN.md +131 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-issue
|
|
3
|
+
description: >
|
|
4
|
+
将任务处理进度同步到对应的 GitHub Issue 评论。
|
|
5
|
+
当用户要求同步进度到 Issue 时触发。参数:task-id 或 issue-number。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 同步进度到 Issue
|
|
9
|
+
|
|
10
|
+
将任务处理进度同步到关联的 GitHub Issue。参数:task-id 或 issue-number。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 解析参数
|
|
15
|
+
|
|
16
|
+
识别用户提供的参数:
|
|
17
|
+
- 纯数字(如 `123`)或 `#` + 数字(如 `#123`)-> 视为 issue number
|
|
18
|
+
- `TASK-` 开头 -> 视为 task-id(现有格式)
|
|
19
|
+
|
|
20
|
+
如果参数是 issue number,使用 Bash 搜索关联任务(注意:`.agent-workspace` 是隐藏目录,Grep/Glob 工具会跳过,必须使用 Bash):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
grep -rl "^issue_number: {issue-number}$" \
|
|
24
|
+
.agent-workspace/active/ \
|
|
25
|
+
.agent-workspace/blocked/ \
|
|
26
|
+
.agent-workspace/completed/ \
|
|
27
|
+
2>/dev/null | head -1
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- 如果返回文件路径(如 `.agent-workspace/completed/TASK-xxx/task.md`),从路径中提取 `{task-id}` 和任务目录,继续执行步骤 2
|
|
31
|
+
- 如果无返回,提示 `No task found associated with Issue #{issue-number}`
|
|
32
|
+
|
|
33
|
+
如果参数是 task-id,继续执行步骤 2 的现有逻辑。
|
|
34
|
+
|
|
35
|
+
### 2. 验证任务存在
|
|
36
|
+
|
|
37
|
+
对于 `task-id` 路径,按优先顺序搜索任务:
|
|
38
|
+
- `.agent-workspace/active/{task-id}/task.md`
|
|
39
|
+
- `.agent-workspace/blocked/{task-id}/task.md`
|
|
40
|
+
- `.agent-workspace/completed/{task-id}/task.md`
|
|
41
|
+
|
|
42
|
+
注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
|
|
43
|
+
|
|
44
|
+
如果步骤 1 已通过 issue number 找到匹配任务,则直接使用该任务目录继续后续步骤,无需再次扫描。
|
|
45
|
+
|
|
46
|
+
### 3. 读取任务信息
|
|
47
|
+
|
|
48
|
+
从 task.md 中提取:
|
|
49
|
+
- `issue_number`(必需 —— 如果缺失,提示用户)
|
|
50
|
+
- `type`
|
|
51
|
+
- 任务标题、描述、状态
|
|
52
|
+
- `current_step`、`created_at`、`updated_at`、`last_synced_at`(如存在)
|
|
53
|
+
|
|
54
|
+
### 4. 读取上下文文件
|
|
55
|
+
|
|
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` - 审查报告
|
|
62
|
+
|
|
63
|
+
### 5. 探测交付状态
|
|
64
|
+
|
|
65
|
+
依次执行以下探测;任一步失败时,降级到“模式 C:开发中”,不要编造无法确认的信息。
|
|
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) 检测 Issue 状态**
|
|
109
|
+
|
|
110
|
+
执行:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
gh issue view {issue-number} --json state
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
记录 Issue 当前是 `OPEN` 还是 `CLOSED`。
|
|
117
|
+
|
|
118
|
+
**e) 综合判定交付模式**
|
|
119
|
+
|
|
120
|
+
按以下优先级确定摘要模式:
|
|
121
|
+
|
|
122
|
+
| 条件 | 模式 |
|
|
123
|
+
|------|------|
|
|
124
|
+
| commit 已在受保护分支上 | 模式 A:已完成 |
|
|
125
|
+
| 有 PR,且状态为 `OPEN` 或 `MERGED` | 模式 B:PR 阶段 |
|
|
126
|
+
| 其他情况 | 模式 C:开发中 |
|
|
127
|
+
|
|
128
|
+
优先级必须为 `模式 A > 模式 B > 模式 C`。即使存在 PR,只要 commit 已在受保护分支上,也按“已完成”处理。
|
|
129
|
+
|
|
130
|
+
后续所有 commit / PR 链接必须使用绝对 URL:
|
|
131
|
+
- `https://github.com/{owner}/{repo}/commit/{commit-hash}`
|
|
132
|
+
- `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
133
|
+
|
|
134
|
+
不要再使用 `../../commit/...` 或 `../../pull/...` 这类相对路径。
|
|
135
|
+
|
|
136
|
+
### 6. 同步 Labels 和 Issue Type
|
|
137
|
+
|
|
138
|
+
基于步骤 5 的探测结果同步 Issue labels。
|
|
139
|
+
|
|
140
|
+
**a) 检查 label 体系是否已初始化**
|
|
141
|
+
|
|
142
|
+
执行:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
判断规则:
|
|
149
|
+
- 返回 `0` -> 说明标准 label 体系缺失。先执行 `init-labels` 技能(幂等),然后重新执行本步骤
|
|
150
|
+
- 返回非 `0` -> 继续后续 label 同步
|
|
151
|
+
|
|
152
|
+
**b) 同步 type label**
|
|
153
|
+
|
|
154
|
+
根据 task.md 的 `type` 字段按下表映射:
|
|
155
|
+
|
|
156
|
+
| task.md type | GitHub label |
|
|
157
|
+
|---|---|
|
|
158
|
+
| bug、bugfix | `type: bug` |
|
|
159
|
+
| feature | `type: feature` |
|
|
160
|
+
| enhancement | `type: enhancement` |
|
|
161
|
+
| documentation | `type: documentation` |
|
|
162
|
+
| dependency-upgrade | `type: dependency-upgrade` |
|
|
163
|
+
| task | `type: task` |
|
|
164
|
+
| 其他(含 refactoring 等) | 跳过 |
|
|
165
|
+
|
|
166
|
+
如果映射到具体 label,执行:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
gh issue edit {issue-number} --add-label "{type-label}"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
未映射到标准 type label 时跳过,不创建新 label。
|
|
173
|
+
|
|
174
|
+
**c) 同步 status label**
|
|
175
|
+
|
|
176
|
+
先读取 Issue 上已有的 `status:` labels:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
gh issue view {issue-number} --json labels --jq '.labels[].name | select(startswith("status:"))'
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
对每个已有的 `status:` label 执行移除:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
gh issue edit {issue-number} --remove-label "{status-label}"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
然后按以下优先级决定是否添加新的 `status:` label:
|
|
189
|
+
|
|
190
|
+
| 条件 | 动作 |
|
|
191
|
+
|---|---|
|
|
192
|
+
| 任务位于 `blocked/` 目录 | 添加 `status: blocked` |
|
|
193
|
+
| 模式 A:已完成 | 不添加新的 status label |
|
|
194
|
+
| 模式 B:PR 已 MERGED | 不添加新的 status label |
|
|
195
|
+
| 模式 B:PR OPEN | 添加 `status: in-progress` |
|
|
196
|
+
| 模式 C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
|
|
197
|
+
| 模式 C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
|
|
198
|
+
|
|
199
|
+
如果需要添加新 label,执行:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
gh issue edit {issue-number} --add-label "{status-label}"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**d) 同步 in: label**
|
|
206
|
+
|
|
207
|
+
从实现报告(优先)或 `analysis.md` 中提取受影响文件路径:
|
|
208
|
+
- 优先读取 `implementation.md` 与 `implementation-r*.md` 中 `## 修改文件` / `## 新建文件` 的文件列表
|
|
209
|
+
- 如果实现报告不存在,则回退到分析报告中的受影响文件列表
|
|
210
|
+
|
|
211
|
+
对每个文件路径:
|
|
212
|
+
1. 取第一级目录作为模块名
|
|
213
|
+
2. 去重
|
|
214
|
+
3. 检查仓库中是否存在对应 label:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
4. 只有存在精确匹配的 `in: {module}` label 时才执行:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
gh issue edit {issue-number} --add-label "in: {module}"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
5. **只添加,不移除**现有的 `in:` labels
|
|
227
|
+
|
|
228
|
+
**e) 同步 Issue Type 字段**
|
|
229
|
+
|
|
230
|
+
根据 task.md 的 `type` 字段映射 GitHub 原生 Issue Type:
|
|
231
|
+
|
|
232
|
+
| task.md type | GitHub Issue Type |
|
|
233
|
+
|---|---|
|
|
234
|
+
| `bug`、`bugfix` | `Bug` |
|
|
235
|
+
| `feature`、`enhancement` | `Feature` |
|
|
236
|
+
| `task`、`documentation`、`dependency-upgrade`、`chore`、`docs`、`refactor`、`refactoring` 及其他值 | `Task` |
|
|
237
|
+
|
|
238
|
+
先查询组织可用的 Issue Types:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
gh api "orgs/$owner/issue-types" --jq '.[].name'
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
然后仅在目标类型存在时执行:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
容错要求:
|
|
251
|
+
- 如果 API 返回 `404`、仓库 owner 不是组织,或仓库未启用 Issue Types,记录 `Issue Type: skipped (not enabled)` 并继续,不要让整个同步失败
|
|
252
|
+
- 如果目标类型不存在,记录 `Issue Type: skipped (type not available)`
|
|
253
|
+
- 不要尝试创建新的 Issue Type;只使用组织中已存在的类型名称
|
|
254
|
+
|
|
255
|
+
### 7. 同步 Development
|
|
256
|
+
|
|
257
|
+
如果 task.md 包含 `pr_number`,确保 PR body 关联当前 Issue。
|
|
258
|
+
|
|
259
|
+
1. 读取 PR body:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
gh pr view {pr-number} --json body --jq '.body // ""'
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
2. 检查 body 是否已经包含以下任一关键词:
|
|
266
|
+
- `Closes #{issue-number}`
|
|
267
|
+
- `Fixes #{issue-number}`
|
|
268
|
+
- `Resolves #{issue-number}`
|
|
269
|
+
|
|
270
|
+
3. 如果已存在任一关键词,跳过更新
|
|
271
|
+
4. 如果不存在,在 body 末尾追加:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
gh pr edit {pr-number} --body "$(cat <<'EOF'
|
|
275
|
+
{existing-body}
|
|
276
|
+
|
|
277
|
+
Closes #{issue-number}
|
|
278
|
+
EOF
|
|
279
|
+
)"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
5. 如果 task.md 不包含 `pr_number`,记录为 `Development: N/A`
|
|
283
|
+
|
|
284
|
+
### 8. 同步 Milestone
|
|
285
|
+
|
|
286
|
+
根据 Issue 当前状态、任务显式配置和分支策略,为 Issue 关联线里程碑。
|
|
287
|
+
|
|
288
|
+
**a) 检查 Issue 是否已有 Milestone**
|
|
289
|
+
|
|
290
|
+
执行:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
gh issue view {issue-number} --json milestone --jq '.milestone.title // empty'
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
如果返回非空,保留现有里程碑并记录 `Milestone: {existing} (preserved)`,跳过后续里程碑同步步骤。
|
|
297
|
+
|
|
298
|
+
**b) 检查 task.md 是否显式指定 milestone**
|
|
299
|
+
|
|
300
|
+
如果 task.md frontmatter 中存在非空 `milestone` 字段,优先使用该值作为目标里程碑。
|
|
301
|
+
此字段应填写线里程碑标题或 `General Backlog`,不要自动指定具体版本里程碑。
|
|
302
|
+
|
|
303
|
+
**c) 推断目标线里程碑**
|
|
304
|
+
|
|
305
|
+
当 task.md 未显式指定 `milestone` 时,按以下顺序推断:
|
|
306
|
+
|
|
307
|
+
1. 检测当前分支:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
git branch --show-current
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
- 如果分支名匹配 `{major}.{minor}.x`,目标里程碑为同名线里程碑 `{major}.{minor}.x`
|
|
314
|
+
|
|
315
|
+
2. 如果当前分支是 `main` 或 `master`,检测现有版本分支:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- 如果存在最高版本分支 `X.Y.x`,则目标里程碑为 `(X+1).0.x`
|
|
322
|
+
- 如果不存在版本分支,则读取最新 tag:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
git tag --list 'v*' --sort=-v:refname | head -1
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
- 当最新 tag 存在且可解析为 `X.Y.Z` 时,目标里程碑为 `X.Y.x`
|
|
329
|
+
|
|
330
|
+
3. 如果以上规则都无法得出结果,回退到 `General Backlog`
|
|
331
|
+
|
|
332
|
+
**d) 查找目标里程碑编号**
|
|
333
|
+
|
|
334
|
+
执行:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
gh api "repos/$repo/milestones" --paginate \
|
|
338
|
+
--jq '.[] | select(.title=="{target}") | .number'
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
- 如果目标里程碑不存在,则降级到查找 `General Backlog`
|
|
342
|
+
- 如果 `General Backlog` 也不存在,则记录 `Milestone: skipped (not found)` 并跳过关联
|
|
343
|
+
|
|
344
|
+
**e) 关联 Issue 到里程碑**
|
|
345
|
+
|
|
346
|
+
一旦找到目标里程碑编号,执行:
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
gh api "repos/$repo/issues/{issue-number}" -X PATCH -F milestone={milestone-number}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
记录:
|
|
353
|
+
- `Milestone: {target} (assigned)` 或
|
|
354
|
+
- `Milestone: General Backlog (fallback)`
|
|
355
|
+
|
|
356
|
+
### 9. 拉取已有评论并构建已发布文件集合
|
|
357
|
+
|
|
358
|
+
一次性拉取 Issue 的全部评论,并基于隐藏标识构建“已发布文件 stem 集合”,同时在本地构建待发布的产物时间线。
|
|
359
|
+
|
|
360
|
+
先拉取评论(保留 comment id 与 body):
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
comments_jsonl="$(mktemp)"
|
|
364
|
+
|
|
365
|
+
gh api "repos/$repo/issues/{issue-number}/comments" \
|
|
366
|
+
--paginate \
|
|
367
|
+
--jq '.[] | {id, body}' > "$comments_jsonl"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
从 `task.md` 的 Activity Log 中提取所有以 `→ {filename}` 结尾的记录。
|
|
371
|
+
|
|
372
|
+
解析规则:
|
|
373
|
+
- 使用正则 `/→\s+(\S+\.md)\s*$/` 提取文件名
|
|
374
|
+
- 去掉 `.md` 后缀得到 `{file-stem}`
|
|
375
|
+
- 按 Activity Log 中的出现顺序构建产物时间线
|
|
376
|
+
- `summary` 仍作为最后一个固定产物追加到时间线末尾
|
|
377
|
+
- `summary` 始终排在最末
|
|
378
|
+
|
|
379
|
+
仅当 Activity Log 引用的文件当前存在于任务目录中时,才纳入待发布集合;缺失文件跳过,不报错。
|
|
380
|
+
|
|
381
|
+
每条同步评论的第一行必须插入隐藏标识:
|
|
382
|
+
|
|
383
|
+
```html
|
|
384
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
其中 `{file-stem}` 为去掉 `.md` 后缀后的文件名,例如 `analysis`、`plan`、`implementation`、`implementation-r2`、`review-r3`;`summary` 仍使用字面量 `summary`。
|
|
388
|
+
|
|
389
|
+
时间线示例:
|
|
390
|
+
`analysis → plan → implementation → review → refinement → analysis-r2 → plan-r2 → implementation-r2 → review-r2 → summary`
|
|
391
|
+
|
|
392
|
+
对每个 `{file-stem}`,用本地检索判断是否已发布:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
- 匹配到:该产物已发布,后续默认跳过
|
|
399
|
+
- 未匹配:该产物尚未发布,可以创建新评论
|
|
400
|
+
|
|
401
|
+
对 `summary` 产物,额外提取评论 id 以便后续更新:
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
summary_comment_id="$(
|
|
405
|
+
jq -r 'select(.body | contains("<!-- sync-issue:{task-id}:summary -->")) | .id' \
|
|
406
|
+
"$comments_jsonl" | head -1
|
|
407
|
+
)"
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
幂等要求:
|
|
411
|
+
- 第一次执行时,只发布当前已存在产物对应的文件评论
|
|
412
|
+
- 第二次执行时,必须跳过已发布文件,只补发新增产物(例如 `implementation-r2`、`review-r2`)
|
|
413
|
+
- 如果所有产物文件评论都已发布,且 `summary` 内容没有变化,则本次不发布任何新评论
|
|
414
|
+
- 如果 `summary` 已发布但交付状态发生变化,只更新原评论,不新增第二条 summary 评论
|
|
415
|
+
|
|
416
|
+
### 10. 按时间线逐条发布上下文文件
|
|
417
|
+
|
|
418
|
+
按步骤 9 生成的已排序产物列表逐条处理,不要再使用固定 5 步骤,也不要把同类型多轮次产物合并到一条评论。
|
|
419
|
+
|
|
420
|
+
**a) 为每个产物准备评论内容**
|
|
421
|
+
|
|
422
|
+
- `analysis`:发布 `analysis.md` 原文
|
|
423
|
+
- `plan`:发布 `plan.md` 原文
|
|
424
|
+
- `analysis-r{N}`、`plan-r{N}`:每个文件各自发布一条评论,正文直接使用对应产物原文
|
|
425
|
+
- `implementation`、`implementation-r{N}`:每个文件各自发布一条评论,正文直接使用对应实现报告原文
|
|
426
|
+
- `refinement`、`refinement-r{N}`:每个文件各自发布一条评论,正文直接使用对应修复报告原文
|
|
427
|
+
- `review`、`review-r{N}`:每个文件各自发布一条评论,正文直接使用对应审查报告原文
|
|
428
|
+
- `summary`:生成精简交付摘要,只包含当前交付状态与 GitHub 上可访问的绝对链接
|
|
429
|
+
|
|
430
|
+
除 `summary` 外,其余产物都应发布原文,不要再次压缩成摘要。
|
|
431
|
+
|
|
432
|
+
每条评论统一格式:
|
|
433
|
+
|
|
434
|
+
```markdown
|
|
435
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
436
|
+
## {产物标题}
|
|
437
|
+
|
|
438
|
+
{原文内容或 summary 内容}
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
*由 AI 自动生成 · 内部追踪:{task-id}*
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
推荐标题映射:
|
|
445
|
+
- `analysis` -> `需求分析`
|
|
446
|
+
- `analysis-r2` -> `需求分析(Round 2)`
|
|
447
|
+
- `analysis-r{N}` -> `需求分析(Round {N})`
|
|
448
|
+
- `plan` -> `技术方案`
|
|
449
|
+
- `plan-r2` -> `技术方案(Round 2)`
|
|
450
|
+
- `plan-r{N}` -> `技术方案(Round {N})`
|
|
451
|
+
- `implementation` -> `实现报告(Round 1)`
|
|
452
|
+
- `implementation-r2` -> `实现报告(Round 2)`
|
|
453
|
+
- `implementation-r{N}` -> `实现报告(Round {N})`
|
|
454
|
+
- `refinement` -> `修复报告(Round 1)`
|
|
455
|
+
- `refinement-r2` -> `修复报告(Round 2)`
|
|
456
|
+
- `refinement-r{N}` -> `修复报告(Round {N})`
|
|
457
|
+
- `review` -> `审查报告(Round 1)`
|
|
458
|
+
- `review-r2` -> `审查报告(Round 2)`
|
|
459
|
+
- `review-r{N}` -> `审查报告(Round {N})`
|
|
460
|
+
- `summary` -> `交付摘要`
|
|
461
|
+
|
|
462
|
+
`summary` 评论建议格式:
|
|
463
|
+
|
|
464
|
+
```markdown
|
|
465
|
+
<!-- sync-issue:{task-id}:summary -->
|
|
466
|
+
## 交付摘要
|
|
467
|
+
|
|
468
|
+
**更新时间**:{当前时间}
|
|
469
|
+
**状态**:{模式化状态描述}
|
|
470
|
+
|
|
471
|
+
| 类型 | 内容 |
|
|
472
|
+
|---|---|
|
|
473
|
+
| 分支 | `{branch 或 N/A}` |
|
|
474
|
+
| Commit | [`{commit-short}`](https://github.com/{owner}/{repo}/commit/{commit-hash}) 或 `N/A` |
|
|
475
|
+
| PR | [#{pr-number}](https://github.com/{owner}/{repo}/pull/{pr-number}) 或 `N/A` |
|
|
476
|
+
| Issue | `{issue-state}` |
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
*由 AI 自动生成 · 内部追踪:{task-id}*
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
模式化状态描述要求:
|
|
483
|
+
- 模式 A:`✅ 已完成,代码已合入 {branch}`
|
|
484
|
+
- 模式 B:`PR 阶段,当前为 #{pr-number}(OPEN 或 MERGED)`
|
|
485
|
+
- 模式 C:`开发中,当前步骤为 {current_step}`
|
|
486
|
+
|
|
487
|
+
**b) 跳过已发布或缺失的产物**
|
|
488
|
+
|
|
489
|
+
- 对于 `analysis.md`、`plan.md`、`implementation*.md`、`review*.md`:如果对应文件不存在,直接跳过,不报错
|
|
490
|
+
- 对于任意产物:如果标识已存在,默认跳过
|
|
491
|
+
- 对于 `summary`:即使标识已存在,也要重新生成候选内容,用于比较是否需要更新
|
|
492
|
+
|
|
493
|
+
**c) 发布新评论**
|
|
494
|
+
|
|
495
|
+
当产物尚未发布时,执行:
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
gh issue comment {issue-number} --body "$(cat <<'EOF'
|
|
499
|
+
{comment-body}
|
|
500
|
+
EOF
|
|
501
|
+
)"
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**d) 仅更新已有 summary 评论**
|
|
505
|
+
|
|
506
|
+
如果 `summary` 标识已存在,且新生成内容与已有内容不同,则编辑原评论:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
gh api "repos/$repo/issues/comments/{comment-id}" -X PATCH -f body="$(cat <<'EOF'
|
|
510
|
+
{comment-body}
|
|
511
|
+
EOF
|
|
512
|
+
)"
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
如果内容相同,则不做任何操作。
|
|
516
|
+
|
|
517
|
+
**e) 零操作场景**
|
|
518
|
+
|
|
519
|
+
如果所有产物都已同步,且 `summary` 无需更新:
|
|
520
|
+
- 不发布任何新评论
|
|
521
|
+
- 在最终告知用户时明确说明:`所有产物已同步,无新内容`
|
|
522
|
+
|
|
523
|
+
### 11. 更新任务状态
|
|
524
|
+
|
|
525
|
+
获取当前时间:
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
在 task.md 中添加或更新 `last_synced_at` 字段为 `{当前时间}`。
|
|
532
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
533
|
+
```
|
|
534
|
+
- {yyyy-MM-dd HH:mm:ss} — **Sync to Issue** by {agent} — Progress synced to Issue #{issue-number}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### 12. 告知用户
|
|
538
|
+
|
|
539
|
+
```
|
|
540
|
+
进度已同步到 Issue #{issue-number}。
|
|
541
|
+
|
|
542
|
+
同步结果:
|
|
543
|
+
- 新发布评论:{数量}
|
|
544
|
+
- 更新评论:{数量}
|
|
545
|
+
- 已跳过步骤:{步骤列表或 `无`}
|
|
546
|
+
- 当前状态:{状态}
|
|
547
|
+
- Labels:type={type-label 或 skipped},status={status-label 或 cleared},in:={新增数量}
|
|
548
|
+
- Issue Type:{Bug / Feature / Task / skipped}
|
|
549
|
+
- Milestone:{preserved / assigned / fallback / skipped}
|
|
550
|
+
- Development:{已追加 Closes 关联 / 已存在关联 / 无 PR,跳过}
|
|
551
|
+
|
|
552
|
+
查看:https://github.com/{owner}/{repo}/issues/{issue-number}
|
|
553
|
+
|
|
554
|
+
如果本次没有发布或更新任何评论,请明确说明:所有步骤已同步,无新内容。
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
## 注意事项
|
|
558
|
+
|
|
559
|
+
1. **需要 Issue 编号**:任务的 task.md 中必须有 `issue_number`。如果缺失,提示用户。
|
|
560
|
+
2. **受众**:`sync-issue` 技能面向利益相关者;`sync-pr` 技能面向代码审查者。关注点不同。
|
|
561
|
+
3. **同步时机**:在完成重要阶段(分析、设计、实现、审查)或被阻塞时同步。
|
|
562
|
+
4. **避免刷屏**:不要同步过于频繁。虽然本技能使用隐藏标识保证幂等,但仍应避免无意义重复同步。
|
|
563
|
+
|
|
564
|
+
## 错误处理
|
|
565
|
+
|
|
566
|
+
- 任务未找到:提示 "Task {task-id} not found"
|
|
567
|
+
- 缺少 Issue 编号:提示 "Task has no issue_number field"
|
|
568
|
+
- Issue 未找到:提示 "Issue #{number} not found"
|
|
569
|
+
- gh 认证失败:提示 "Please check GitHub CLI authentication"
|