@fitlab-ai/agent-infra 0.4.1 → 0.4.2
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 +23 -13
- package/README.zh-CN.md +23 -13
- package/lib/defaults.json +3 -9
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.md +7 -7
- package/templates/.agents/QUICKSTART.zh-CN.md +13 -13
- package/templates/.agents/README.md +15 -16
- package/templates/.agents/README.zh-CN.md +17 -18
- package/templates/.agents/skills/commit/reference/task-status-update.md +3 -3
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +3 -3
- package/templates/.agents/skills/create-pr/SKILL.md +20 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +20 -11
- package/templates/.agents/skills/create-task/SKILL.md +1 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/implement-task/SKILL.md +1 -0
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/import-issue/SKILL.md +1 -0
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/refine-task/SKILL.md +4 -2
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +4 -2
- package/templates/.agents/skills/sync-issue/SKILL.md +14 -12
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +14 -12
- package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -4
- package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -4
- package/templates/.agents/skills/sync-issue/reference/label-sync.md +4 -5
- package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +4 -5
- package/templates/.agents/skills/sync-pr/SKILL.md +26 -11
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +26 -11
- package/templates/.agents/skills/sync-pr/reference/comment-publish.zh-CN.md +4 -4
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +4 -10
- package/templates/.claude/commands/create-pr.md +1 -1
- package/templates/.claude/commands/create-pr.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/.gemini/commands/_project_/sync-pr.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +1 -1
- package/templates/.opencode/commands/sync-pr.md +1 -1
- package/templates/.opencode/commands/sync-pr.zh-CN.md +1 -1
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.md +0 -42
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.zh-CN.md +0 -42
- package/templates/.claude/CLAUDE.md +0 -138
- package/templates/.claude/CLAUDE.zh-CN.md +0 -138
- package/templates/.claude/project-rules.md +0 -65
- package/templates/.claude/project-rules.zh-CN.md +0 -65
- package/templates/.codex/README.md +0 -38
- package/templates/.codex/README.zh-CN.md +0 -37
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +0 -232
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +0 -232
- package/templates/.opencode/README.md +0 -76
- package/templates/.opencode/README.zh-CN.md +0 -77
- package/templates/AGENTS.md +0 -112
- package/templates/AGENTS.zh-CN.md +0 -112
|
@@ -9,38 +9,47 @@ description: "创建 Pull Request 到目标分支"
|
|
|
9
9
|
|
|
10
10
|
## 执行流程
|
|
11
11
|
|
|
12
|
-
### 1.
|
|
12
|
+
### 1. 解析命令参数
|
|
13
|
+
|
|
14
|
+
从命令参数中识别:
|
|
15
|
+
- 匹配 `TASK-{yyyyMMdd-HHmmss}` 格式的参数 -> `{task-id}`
|
|
16
|
+
- 其余参数 -> `{target-branch}`
|
|
17
|
+
|
|
18
|
+
如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `issue_number`、`type` 等)。
|
|
19
|
+
如果未提供,可从当前 session 上下文获取;仍无法确定 `{task-id}` 时,后续步骤中的任务关联逻辑跳过。
|
|
20
|
+
|
|
21
|
+
### 2. 确定目标分支
|
|
13
22
|
|
|
14
23
|
如果用户显式提供参数就直接使用;否则根据 Git 历史和分支拓扑自动推断。
|
|
15
24
|
|
|
16
25
|
> 详细分支判断规则见 `reference/branch-strategy.md`。自动推断 base 分支前,先读取 `reference/branch-strategy.md`。
|
|
17
26
|
|
|
18
|
-
###
|
|
27
|
+
### 3. 准备 PR 正文
|
|
19
28
|
|
|
20
29
|
读取 `.github/PULL_REQUEST_TEMPLATE.md`(如存在),参考最近合并的 PR 风格,并收集 `<target-branch>` 到 `HEAD` 的全部提交。
|
|
21
30
|
|
|
22
31
|
> 模板处理、HEREDOC 正文生成和 `Generated with AI assistance` 要求见 `reference/pr-body-template.md`。编写正文前先读取 `reference/pr-body-template.md`。
|
|
23
32
|
|
|
24
|
-
###
|
|
33
|
+
### 4. 检查远程分支状态
|
|
25
34
|
|
|
26
35
|
确认当前分支是否已有 upstream;必要时执行 `git push -u origin <current-branch>`。
|
|
27
36
|
|
|
28
|
-
###
|
|
37
|
+
### 5. 创建 PR
|
|
29
38
|
|
|
30
39
|
使用 `gh pr create --base <target-branch> --title "<title>" --assignee @me --body ...` 创建 PR。
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
如果获取到 `{task-id}` 且对应任务提供了 `issue_number`,必须在 PR 正文中保留 `Closes #{issue-number}`。
|
|
33
42
|
|
|
34
|
-
###
|
|
43
|
+
### 6. 同步 PR 元数据
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
对获取到 `{task-id}` 的 PR,立即同步这些核心元数据:
|
|
37
46
|
- 执行 `gh label list --search "type:" --limit 1 --json name --jq 'length'`
|
|
38
47
|
- 使用 `gh pr edit {pr-number} --add-label "{type-label}"` 添加 type label
|
|
39
48
|
- 使用 `gh pr edit {pr-number} --add-label "in: {module}"` 添加相关 `in:` labels
|
|
40
49
|
- 使用 `gh pr edit {pr-number} --milestone "{milestone-title}"` 设置里程碑
|
|
41
50
|
- 通过 `Closes #{issue-number}` 保持 Development 关联
|
|
42
51
|
|
|
43
|
-
###
|
|
52
|
+
### 7. 更新任务状态
|
|
44
53
|
|
|
45
54
|
获取当前时间:
|
|
46
55
|
|
|
@@ -48,9 +57,9 @@ description: "创建 Pull Request 到目标分支"
|
|
|
48
57
|
date "+%Y-%m-%d %H:%M:%S"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
如果获取到了 `{task-id}`,更新 task.md 的 `pr_number`、`updated_at`,并追加 PR Created 的 Activity Log。
|
|
52
61
|
|
|
53
|
-
###
|
|
62
|
+
### 8. 告知用户
|
|
54
63
|
|
|
55
64
|
说明 PR URL、元数据同步结果,并按顺序给出两个后续动作:
|
|
56
65
|
- 可选执行 `sync-pr {task-id}`,发布面向 reviewer 的上下文摘要
|
|
@@ -59,7 +68,7 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
59
68
|
## 注意事项
|
|
60
69
|
|
|
61
70
|
- 必须检查分支中的全部提交,而不是只看最后一个
|
|
62
|
-
- `create-pr` 不能把 type label 映射委托给 `sync-pr
|
|
71
|
+
- `create-pr` 不能把 type label 映射委托给 `sync-pr`,必须在获取到 `{task-id}` 时于本技能内内联处理
|
|
63
72
|
- 如果从 Issue 继承元数据失败,继续使用 task.md 和分支推断兜底
|
|
64
73
|
|
|
65
74
|
## 错误处理
|
|
@@ -24,7 +24,7 @@ After executing this skill, you **must** immediately update task status in task.
|
|
|
24
24
|
### 1. Parse the User Description
|
|
25
25
|
|
|
26
26
|
Extract from the natural-language description:
|
|
27
|
-
- **Task title**: a concise title (maximum 50 characters)
|
|
27
|
+
- **Task title**: a concise title (maximum 50 characters), in the same language as the user's description
|
|
28
28
|
- **Task type**: `feature` | `bugfix` | `refactor` | `docs` | `chore` (infer from the description)
|
|
29
29
|
- **Workflow**: `feature-development` | `bug-fix` | `refactoring` (infer from the type)
|
|
30
30
|
- **Detailed description**: the cleaned-up original user request
|
|
@@ -24,7 +24,7 @@ description: "根据自然语言描述创建任务"
|
|
|
24
24
|
### 1. 解析用户描述
|
|
25
25
|
|
|
26
26
|
从自然语言描述中提取:
|
|
27
|
-
- **任务标题**:简洁标题(最多 50
|
|
27
|
+
- **任务标题**:简洁标题(最多 50 个字符),使用与用户描述相同的语言
|
|
28
28
|
- **任务类型**:`feature` | `bugfix` | `refactor` | `docs` | `chore`(从描述推断)
|
|
29
29
|
- **工作流**:`feature-development` | `bug-fix` | `refactoring`(从类型推断)
|
|
30
30
|
- **详细描述**:整理后的用户原始描述
|
|
@@ -71,6 +71,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
|
|
|
71
71
|
- `current_step`: implementation
|
|
72
72
|
- `assigned_to`: {current agent}
|
|
73
73
|
- `updated_at`: {current time}
|
|
74
|
+
- review the `## Requirements` section and only change items from `- [ ]` to `- [x]` when they are clearly satisfied by this round's implemented code and passing tests
|
|
74
75
|
- record `{implementation-artifact}` for Round `{implementation-round}`
|
|
75
76
|
- append:
|
|
76
77
|
`- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
|
|
@@ -71,6 +71,7 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
71
71
|
- `current_step`:implementation
|
|
72
72
|
- `assigned_to`:{当前代理}
|
|
73
73
|
- `updated_at`:{当前时间}
|
|
74
|
+
- 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
|
|
74
75
|
- 记录 Round `{implementation-round}` 的 `{implementation-artifact}`
|
|
75
76
|
- 追加:
|
|
76
77
|
`- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
|
|
@@ -54,8 +54,10 @@ Get the current time:
|
|
|
54
54
|
date "+%Y-%m-%d %H:%M:%S"
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Update task.md
|
|
58
|
-
|
|
57
|
+
Update task.md:
|
|
58
|
+
- review the `## Requirements` section and only change items from `- [ ]` to `- [x]` when they are newly satisfied by this round's fixes and passing tests
|
|
59
|
+
- append:
|
|
60
|
+
`- {yyyy-MM-dd HH:mm:ss} — **Refinement (Round {N}, for {review-artifact})** by {agent} — Fixed {n} blockers, {n} major, {n} minor issues → {refinement-artifact}`
|
|
59
61
|
|
|
60
62
|
### 7. Inform User
|
|
61
63
|
|
|
@@ -54,8 +54,10 @@ description: "处理代码审查反馈并修复问题"
|
|
|
54
54
|
date "+%Y-%m-%d %H:%M:%S"
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
更新 task.md
|
|
58
|
-
|
|
57
|
+
更新 task.md:
|
|
58
|
+
- 审查 `## 需求` 段落,仅把因本轮修复而新满足且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
|
|
59
|
+
- 追加:
|
|
60
|
+
`- {yyyy-MM-dd HH:mm:ss} — **Refinement (Round {N}, for {review-artifact})** by {agent} — Fixed {n} blockers, {n} major, {n} minor issues → {refinement-artifact}`
|
|
59
61
|
|
|
60
62
|
### 7. 告知用户
|
|
61
63
|
|
|
@@ -5,7 +5,7 @@ description: "Sync task progress to a GitHub Issue"
|
|
|
5
5
|
|
|
6
6
|
# Sync Progress to Issue
|
|
7
7
|
|
|
8
|
-
Sync the task state,
|
|
8
|
+
Sync the task state, summary comment, and published artifacts to the related GitHub Issue.
|
|
9
9
|
|
|
10
10
|
## Execution Flow
|
|
11
11
|
|
|
@@ -35,32 +35,35 @@ Extract `issue_number`, `type`, task title, status, `current_step`, and timestam
|
|
|
35
35
|
|
|
36
36
|
Read the highest-round `analysis.md` / `analysis-r{N}.md`, `plan.md` / `plan-r{N}.md`, and the current implementation, refinement, and review artifacts that still exist.
|
|
37
37
|
|
|
38
|
-
### 5.
|
|
39
|
-
|
|
40
|
-
> Delivery-mode detection, protected-branch checks, PR-state rules, absolute commit/PR links, and the completed/PR/in-development mode matrix live in `reference/delivery-detection.md`. Read `reference/delivery-detection.md` before summarizing delivery status.
|
|
41
|
-
|
|
42
|
-
### 6. Sync Labels and Issue Type
|
|
38
|
+
### 5. Sync Labels and Issue Type
|
|
43
39
|
|
|
44
40
|
> Label initialization, `status:` replacement rules, `in:` label discovery, and the `issue-types` mapping logic live in `reference/label-sync.md`. Read `reference/label-sync.md` before editing Issue metadata.
|
|
45
41
|
|
|
46
|
-
###
|
|
42
|
+
### 6. Sync Development Linking
|
|
47
43
|
|
|
48
44
|
If `pr_number` exists, make sure the PR body contains one of:
|
|
49
45
|
- `Closes #{issue-number}`
|
|
50
46
|
- `Fixes #{issue-number}`
|
|
51
47
|
- `Resolves #{issue-number}`
|
|
52
48
|
|
|
53
|
-
###
|
|
49
|
+
### 7. Sync the Milestone
|
|
54
50
|
|
|
55
51
|
> Milestone inheritance, line-branch inference, and `General Backlog` fallback rules live in `reference/milestone-sync.md`. Read `reference/milestone-sync.md` before editing the Issue milestone.
|
|
56
52
|
|
|
53
|
+
### 8. Sync Requirement Checkboxes
|
|
54
|
+
|
|
55
|
+
Extract checked `- [x]` items from the `## Requirements` section of task.md; if none exist, skip this step.
|
|
56
|
+
Read the current Issue body with `gh issue view {issue-number} --json body --jq '.body'`.
|
|
57
|
+
Match by checkbox text and replace only `- [ ] {text}` with `- [x] {text}` in the Issue body; keep existing `- [x]` items, unmatched items, and non-requirement checkboxes unchanged.
|
|
58
|
+
Only when the body actually changes, update the full body with `gh api` PATCH and build the request payload with `cat <<'EOF'` heredoc.
|
|
59
|
+
|
|
57
60
|
### 9. Publish Context Artifacts
|
|
58
61
|
|
|
59
|
-
> Existing-comment discovery, hidden markers, the artifact timeline, summary comment ordering
|
|
62
|
+
> Existing-comment discovery, hidden markers, the artifact timeline, and summary comment ordering live in `reference/comment-publish.md`. Read `reference/comment-publish.md` before publishing Issue comments.
|
|
60
63
|
|
|
61
64
|
> **Shell Safety Rules** (read before publishing comments):
|
|
62
65
|
> 1. `{comment-body}` must be replaced with **actual inline text**. Read the file with the Read tool first, then paste the full content into the heredoc body. **Do NOT** use `$(cat ...)`, `$(< ...)`, `$(...)`, or `${...}` inside `<<'EOF'`. Quoted heredocs suppress all command substitution and variable expansion, so those expressions will be output as literal text.
|
|
63
|
-
> 2. When constructing strings that contain `<!-- -->`, **do NOT use `echo`**. In bash/zsh, `echo` escapes `!` as `\!`, which makes hidden markers visible. Build all comment content with `cat <<'EOF'` heredocs or `printf '%s\n'`.
|
|
66
|
+
> 2. When constructing strings that contain `<!-- -->`, **do NOT use `echo`**. In bash/zsh, `echo` escapes `!` as `\!`, which makes hidden markers visible. Build all comment content and the Step 8 Issue body update with `cat <<'EOF'` heredocs or `printf '%s\n'`.
|
|
64
67
|
|
|
65
68
|
### 10. Update Task Status
|
|
66
69
|
|
|
@@ -79,9 +82,8 @@ Summarize synced labels, milestone, development linkage, published comments, and
|
|
|
79
82
|
## Notes
|
|
80
83
|
|
|
81
84
|
- The hidden comment marker format must stay `<!-- sync-issue:{task-id}:{file-stem} -->`
|
|
82
|
-
- Use absolute links such as `https://github.com/{owner}/{repo}/commit/{commit-hash}` and `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
83
85
|
- Build the artifact timeline from Activity Log order, not a fixed `analysis -> plan -> implementation -> review -> summary` sequence
|
|
84
|
-
- Follow the Step 9 shell safety rules when publishing comments: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
|
|
86
|
+
- Follow the Step 9 shell safety rules when publishing comments or updating the Issue body: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
|
|
85
87
|
|
|
86
88
|
## Error Handling
|
|
87
89
|
|
|
@@ -5,7 +5,7 @@ description: "将任务进度同步到 GitHub Issue"
|
|
|
5
5
|
|
|
6
6
|
# 同步进度到 Issue
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
把任务状态、摘要评论和产物发布时间线同步到关联的 GitHub Issue。
|
|
9
9
|
|
|
10
10
|
## 执行流程
|
|
11
11
|
|
|
@@ -35,32 +35,35 @@ grep -rl "^issue_number: {issue-number}$" \
|
|
|
35
35
|
|
|
36
36
|
读取最高轮次的 `analysis.md` / `analysis-r{N}.md`、`plan.md` / `plan-r{N}.md`,以及仍然存在的实现、修复、审查产物。
|
|
37
37
|
|
|
38
|
-
### 5.
|
|
39
|
-
|
|
40
|
-
> 交付模式探测、受保护分支检查、PR 状态判断、绝对 commit/PR 链接,以及完成/PR 阶段/开发中模式矩阵见 `reference/delivery-detection.md`。汇总交付状态前先读取 `reference/delivery-detection.md`。
|
|
41
|
-
|
|
42
|
-
### 6. 同步 Labels 和 Issue Type
|
|
38
|
+
### 5. 同步 Labels 和 Issue Type
|
|
43
39
|
|
|
44
40
|
> label 初始化、`status:` 替换规则、`in:` label 发现,以及 `issue-types` 映射逻辑见 `reference/label-sync.md`。编辑 Issue 元数据前先读取 `reference/label-sync.md`。
|
|
45
41
|
|
|
46
|
-
###
|
|
42
|
+
### 6. 同步 Development 关联
|
|
47
43
|
|
|
48
44
|
如果存在 `pr_number`,确保 PR 正文包含以下任一项:
|
|
49
45
|
- `Closes #{issue-number}`
|
|
50
46
|
- `Fixes #{issue-number}`
|
|
51
47
|
- `Resolves #{issue-number}`
|
|
52
48
|
|
|
53
|
-
###
|
|
49
|
+
### 7. 同步里程碑
|
|
54
50
|
|
|
55
51
|
> milestone 继承、版本分支推断和 `General Backlog` 回退规则见 `reference/milestone-sync.md`。编辑 Issue milestone 前先读取 `reference/milestone-sync.md`。
|
|
56
52
|
|
|
53
|
+
### 8. 同步需求复选框
|
|
54
|
+
|
|
55
|
+
从 task.md 的 `## 需求` 段落提取已勾选的 `- [x]` 项;如果没有,跳过。
|
|
56
|
+
读取 Issue 当前正文:`gh issue view {issue-number} --json body --jq '.body'`。
|
|
57
|
+
按复选框文本匹配,将 Issue body 中对应的 `- [ ] {text}` 单向替换为 `- [x] {text}`;已有 `- [x]`、未匹配项和非需求复选框保持不变。
|
|
58
|
+
只有在正文实际变化时,才使用 `gh api` PATCH 更新完整 body,并用 `cat <<'EOF'` heredoc 构造请求内容。
|
|
59
|
+
|
|
57
60
|
### 9. 发布上下文产物
|
|
58
61
|
|
|
59
|
-
>
|
|
62
|
+
> 已有评论探测、隐藏标记、产物时间线和 summary 评论顺序见 `reference/comment-publish.md`。发布 Issue 评论前先读取 `reference/comment-publish.md`。
|
|
60
63
|
|
|
61
64
|
> **Shell 安全规则**(发布评论前必读):
|
|
62
65
|
> 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
|
|
63
|
-
> 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为
|
|
66
|
+
> 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容以及步骤 8 的 Issue body 更新都统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
|
|
64
67
|
|
|
65
68
|
### 10. 更新任务状态
|
|
66
69
|
|
|
@@ -79,9 +82,8 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
79
82
|
## 注意事项
|
|
80
83
|
|
|
81
84
|
- 隐藏评论标记必须保持为 `<!-- sync-issue:{task-id}:{file-stem} -->`
|
|
82
|
-
- 必须使用绝对链接,例如 `https://github.com/{owner}/{repo}/commit/{commit-hash}` 和 `https://github.com/{owner}/{repo}/pull/{pr-number}`
|
|
83
85
|
- 产物时间线按 Activity Log 顺序构建,而不是固定的 `analysis -> plan -> implementation -> review -> summary`
|
|
84
|
-
-
|
|
86
|
+
- 发布评论和更新 Issue body 时遵守步骤 9 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
|
|
85
87
|
|
|
86
88
|
## 错误处理
|
|
87
89
|
|
|
@@ -81,8 +81,4 @@ EOF
|
|
|
81
81
|
)"
|
|
82
82
|
```
|
|
83
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
84
|
Do not fall back to a fixed `analysis -> plan -> implementation -> review -> summary` order.
|
|
@@ -24,12 +24,11 @@ Status decision table:
|
|
|
24
24
|
|
|
25
25
|
| Condition | Action |
|
|
26
26
|
|---|---|
|
|
27
|
+
| Issue is closed (`state = CLOSED`) | add no new `status:` label |
|
|
28
|
+
| task lives under `completed/` | add no new `status:` label |
|
|
27
29
|
| task lives under `blocked/` | add `status: blocked` |
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| Scenario B: PR is `OPEN` | add `status: in-progress` |
|
|
31
|
-
| Scenario C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | add `status: pending-design-work` |
|
|
32
|
-
| Scenario C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | add `status: in-progress` |
|
|
30
|
+
| `current_step` ∈ {`requirement-analysis`, `technical-design`} | add `status: pending-design-work` |
|
|
31
|
+
| `current_step` ∈ {`implementation`, `code-review`, `refinement`} | add `status: in-progress` |
|
|
33
32
|
|
|
34
33
|
`in:` label workflow:
|
|
35
34
|
|
|
@@ -24,12 +24,11 @@ gh issue edit {issue-number} --add-label "{status-label}"
|
|
|
24
24
|
|
|
25
25
|
| 条件 | 操作 |
|
|
26
26
|
|---|---|
|
|
27
|
+
| Issue 已关闭(`state = CLOSED`) | 不新增 `status:` label |
|
|
28
|
+
| 任务位于 `completed/` 目录下 | 不新增 `status:` label |
|
|
27
29
|
| 任务位于 `blocked/` 目录下 | 添加 `status: blocked` |
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| 场景 B:PR 状态为 `OPEN` | 添加 `status: in-progress` |
|
|
31
|
-
| 场景 C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
|
|
32
|
-
| 场景 C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
|
|
30
|
+
| `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
|
|
31
|
+
| `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
|
|
33
32
|
|
|
34
33
|
`in:` label 工作流:
|
|
35
34
|
|
|
@@ -9,33 +9,47 @@ Sync PR metadata and keep one reviewer-facing summary comment up to date.
|
|
|
9
9
|
|
|
10
10
|
## Execution Flow
|
|
11
11
|
|
|
12
|
-
### 1.
|
|
12
|
+
### 1. Parse the Argument
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Accept either `task-id` or PR number. For PR-number input, resolve the task with:
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
```bash
|
|
17
|
+
grep -rl "^pr_number: {pr-number}$" \
|
|
18
|
+
.agents/workspace/active/ \
|
|
19
|
+
.agents/workspace/blocked/ \
|
|
20
|
+
.agents/workspace/completed/ \
|
|
21
|
+
2>/dev/null | head -1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If no task matches, output `No task found associated with PR #{pr-number}`.
|
|
25
|
+
|
|
26
|
+
### 2. Verify the Task Exists
|
|
27
|
+
|
|
28
|
+
Search active, blocked, and completed task directories and lock onto the matching task folder before continuing.
|
|
29
|
+
|
|
30
|
+
### 3. Read Task Information
|
|
17
31
|
|
|
18
32
|
Extract `pr_number`, `issue_number`, task title, type, and the latest timestamps from task.md.
|
|
19
33
|
|
|
20
|
-
###
|
|
34
|
+
### 4. Read Context Files
|
|
21
35
|
|
|
22
36
|
Read the latest plan, implementation, review, and refinement artifacts that will inform PR metadata and the reviewer summary.
|
|
23
37
|
|
|
24
|
-
###
|
|
38
|
+
### 5. Resolve Repository Coordinates and Label Readiness
|
|
25
39
|
|
|
26
40
|
Resolve `repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"` and verify whether `type:` labels have been initialized.
|
|
27
41
|
|
|
28
|
-
###
|
|
42
|
+
### 6. Sync Metadata
|
|
29
43
|
|
|
30
44
|
Sync the mapped type label, relevant `in:` labels, and milestone onto the PR.
|
|
31
45
|
|
|
32
46
|
> PR-state safeguards, milestone inference, and metadata skip rules for closed or merged PRs live in `reference/delivery-detection.md`. Read `reference/delivery-detection.md` before editing PR metadata.
|
|
33
47
|
|
|
34
|
-
###
|
|
48
|
+
### 7. Sync Development Linking
|
|
35
49
|
|
|
36
50
|
If `issue_number` exists, ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword.
|
|
37
51
|
|
|
38
|
-
###
|
|
52
|
+
### 8. Publish the Reviewer Summary
|
|
39
53
|
|
|
40
54
|
> Hidden markers, idempotent summary comment updates, review-history formatting, and comment create/update rules live in `reference/comment-publish.md`. Read `reference/comment-publish.md` before publishing the summary.
|
|
41
55
|
|
|
@@ -43,7 +57,7 @@ If `issue_number` exists, ensure the PR body contains `Closes #{issue-number}` o
|
|
|
43
57
|
> 1. `{comment-body}` must be replaced with **actual inline text**. Read the file with the Read tool first, then paste the full content into the heredoc body. **Do NOT** use `$(cat ...)`, `$(< ...)`, `$(...)`, or `${...}` inside `<<'EOF'`. Quoted heredocs suppress all command substitution and variable expansion, so those expressions will be output as literal text.
|
|
44
58
|
> 2. When constructing strings that contain `<!-- -->`, **do NOT use `echo`**. In bash/zsh, `echo` escapes `!` as `\!`, which makes hidden markers visible. Build all comment content with `cat <<'EOF'` heredocs or `printf '%s\n'`.
|
|
45
59
|
|
|
46
|
-
###
|
|
60
|
+
### 9. Update Task Status
|
|
47
61
|
|
|
48
62
|
Get the current time:
|
|
49
63
|
|
|
@@ -53,7 +67,7 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
53
67
|
|
|
54
68
|
Update `last_synced_to_pr_at` and append the Sync to PR Activity Log entry.
|
|
55
69
|
|
|
56
|
-
###
|
|
70
|
+
### 10. Inform the User
|
|
57
71
|
|
|
58
72
|
Report the synchronized labels, milestone, development status, summary result, and PR URL.
|
|
59
73
|
|
|
@@ -62,10 +76,11 @@ Report the synchronized labels, milestone, development status, summary result, a
|
|
|
62
76
|
- The hidden summary marker must stay `<!-- sync-pr:{task-id}:summary -->`
|
|
63
77
|
- Keep exactly one summary comment for reviewers
|
|
64
78
|
- If the PR is already closed or merged, report `PR #{number} is closed/merged, metadata sync skipped`
|
|
65
|
-
- Follow the Step
|
|
79
|
+
- Follow the Step 8 shell safety rules when publishing comments: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
|
|
66
80
|
|
|
67
81
|
## Error Handling
|
|
68
82
|
|
|
83
|
+
- No task found for the PR: `No task found associated with PR #{pr-number}`
|
|
69
84
|
- Task not found: `Task {task-id} not found`
|
|
70
85
|
- Missing PR number: `Task has no pr_number field`
|
|
71
86
|
- PR not found: `PR #{number} not found`
|
|
@@ -9,33 +9,47 @@ description: "将任务进度同步到 Pull Request"
|
|
|
9
9
|
|
|
10
10
|
## 执行流程
|
|
11
11
|
|
|
12
|
-
### 1.
|
|
12
|
+
### 1. 解析参数
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
同时接受 `task-id` 和 PR number。对于 PR number,使用下面的命令反查任务:
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
```bash
|
|
17
|
+
grep -rl "^pr_number: {pr-number}$" \
|
|
18
|
+
.agents/workspace/active/ \
|
|
19
|
+
.agents/workspace/blocked/ \
|
|
20
|
+
.agents/workspace/completed/ \
|
|
21
|
+
2>/dev/null | head -1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
如果没有匹配任务,输出 `No task found associated with PR #{pr-number}`。
|
|
25
|
+
|
|
26
|
+
### 2. 验证任务存在
|
|
27
|
+
|
|
28
|
+
按 active、blocked、completed 的顺序定位匹配任务目录,再继续后续步骤。
|
|
29
|
+
|
|
30
|
+
### 3. 读取任务信息
|
|
17
31
|
|
|
18
32
|
从 task.md 提取 `pr_number`、`issue_number`、任务标题、type 和最新时间戳。
|
|
19
33
|
|
|
20
|
-
###
|
|
34
|
+
### 4. 读取上下文文件
|
|
21
35
|
|
|
22
36
|
读取最新的方案、实现、审查和修复产物,用于生成 PR 元数据和 reviewer 摘要。
|
|
23
37
|
|
|
24
|
-
###
|
|
38
|
+
### 5. 解析仓库坐标并检查 label 就绪状态
|
|
25
39
|
|
|
26
40
|
先解析 `repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"`,再确认 `type:` labels 是否已经初始化。
|
|
27
41
|
|
|
28
|
-
###
|
|
42
|
+
### 6. 同步元数据
|
|
29
43
|
|
|
30
44
|
把映射后的 type label、相关 `in:` labels 和 milestone 同步到 PR 上。
|
|
31
45
|
|
|
32
46
|
> PR 状态保护、milestone 推断,以及 PR 已关闭/已合并时的跳过规则见 `reference/delivery-detection.md`。编辑 PR 元数据前先读取 `reference/delivery-detection.md`。
|
|
33
47
|
|
|
34
|
-
###
|
|
48
|
+
### 7. 同步 Development 关联
|
|
35
49
|
|
|
36
50
|
如果存在 `issue_number`,确保 PR 正文包含 `Closes #{issue-number}` 或等价的关闭关键字。
|
|
37
51
|
|
|
38
|
-
###
|
|
52
|
+
### 8. 发布 reviewer 摘要
|
|
39
53
|
|
|
40
54
|
> 隐藏标记、幂等 summary 评论更新、review history 格式,以及评论创建/更新规则见 `reference/comment-publish.md`。发布摘要前先读取 `reference/comment-publish.md`。
|
|
41
55
|
|
|
@@ -43,7 +57,7 @@ description: "将任务进度同步到 Pull Request"
|
|
|
43
57
|
> 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
|
|
44
58
|
> 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
|
|
45
59
|
|
|
46
|
-
###
|
|
60
|
+
### 9. 更新任务状态
|
|
47
61
|
|
|
48
62
|
获取当前时间:
|
|
49
63
|
|
|
@@ -53,7 +67,7 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
53
67
|
|
|
54
68
|
更新 `last_synced_to_pr_at`,并追加 Sync to PR 的 Activity Log。
|
|
55
69
|
|
|
56
|
-
###
|
|
70
|
+
### 10. 告知用户
|
|
57
71
|
|
|
58
72
|
汇总已同步的 labels、milestone、development 状态、summary 结果以及 PR URL。
|
|
59
73
|
|
|
@@ -62,10 +76,11 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
62
76
|
- 隐藏 summary 标记必须保持 `<!-- sync-pr:{task-id}:summary -->`
|
|
63
77
|
- 面向 reviewer 只保留一条摘要评论
|
|
64
78
|
- 如果 PR 已关闭或已合并,必须报告 `PR #{number} is closed/merged, metadata sync skipped`
|
|
65
|
-
- 发布摘要时遵守步骤
|
|
79
|
+
- 发布摘要时遵守步骤 8 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
|
|
66
80
|
|
|
67
81
|
## 错误处理
|
|
68
82
|
|
|
83
|
+
- 未找到关联任务:`No task found associated with PR #{pr-number}`
|
|
69
84
|
- 任务未找到:`Task {task-id} not found`
|
|
70
85
|
- 缺少 PR 编号:`Task has no pr_number field`
|
|
71
86
|
- PR 不存在:`PR #{number} not found`
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
已有评论必须通过 Issues comments API 获取,而不是单独的 PR comments API。
|
|
14
14
|
|
|
15
15
|
推荐摘要章节:
|
|
16
|
-
- `##
|
|
17
|
-
- `###
|
|
18
|
-
- `###
|
|
19
|
-
- `###
|
|
16
|
+
- `## 审查摘要`
|
|
17
|
+
- `### 关键技术决策`
|
|
18
|
+
- `### 审查历程`
|
|
19
|
+
- `### 测试结果`
|
|
20
20
|
|
|
21
21
|
摘要内容规则:
|
|
22
22
|
- 面向 reviewer 编写,而不是面向终端用户
|
|
@@ -22,6 +22,8 @@ import { fileURLToPath } from 'node:url';
|
|
|
22
22
|
const DEFAULTS = {
|
|
23
23
|
"files": {
|
|
24
24
|
"managed": [
|
|
25
|
+
".agents/QUICKSTART.md",
|
|
26
|
+
".agents/README.md",
|
|
25
27
|
".agents/skills/",
|
|
26
28
|
".agents/templates/",
|
|
27
29
|
".agents/workflows/",
|
|
@@ -37,28 +39,20 @@ const DEFAULTS = {
|
|
|
37
39
|
"**/test-integration.*",
|
|
38
40
|
"**/test.*",
|
|
39
41
|
"**/upgrade-dependency.*",
|
|
40
|
-
".agents/QUICKSTART.md",
|
|
41
|
-
".agents/README.md",
|
|
42
42
|
".agents/skills/release/SKILL.*",
|
|
43
43
|
".agents/skills/test-integration/SKILL.*",
|
|
44
44
|
".agents/skills/test/SKILL.*",
|
|
45
45
|
".agents/skills/upgrade-dependency/SKILL.*",
|
|
46
|
-
".claude/CLAUDE.md",
|
|
47
|
-
".claude/project-rules.md",
|
|
48
46
|
".claude/settings.json",
|
|
49
|
-
".codex/README.md",
|
|
50
47
|
".gemini/settings.json",
|
|
51
48
|
".github/hooks/pre-commit",
|
|
52
|
-
".gitignore"
|
|
53
|
-
".opencode/COMMAND_STYLE_GUIDE.md",
|
|
54
|
-
".opencode/README.md",
|
|
55
|
-
"AGENTS.md"
|
|
49
|
+
".gitignore"
|
|
56
50
|
],
|
|
57
51
|
"ejected": []
|
|
58
52
|
}
|
|
59
53
|
};
|
|
60
54
|
|
|
61
|
-
const INSTALLER_VERSION = "v0.4.
|
|
55
|
+
const INSTALLER_VERSION = "v0.4.2";
|
|
62
56
|
|
|
63
57
|
function norm(p) { return p.replace(/\\/g, '/'); }
|
|
64
58
|
|