@fitlab-ai/agent-infra 0.3.0 → 0.3.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 +368 -51
- package/README.zh-CN.md +369 -52
- package/bin/cli.js +1 -1
- package/lib/version.js +2 -1
- package/package.json +1 -1
- package/templates/.agents/README.md +12 -0
- package/templates/.agents/README.zh-CN.md +12 -0
- package/templates/.agents/skills/analyze-task/SKILL.md +106 -105
- package/templates/.agents/skills/check-task/SKILL.md +108 -94
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +12 -0
- package/templates/.agents/skills/close-codescan/SKILL.md +64 -63
- package/templates/.agents/skills/close-dependabot/SKILL.md +71 -70
- package/templates/.agents/skills/commit/SKILL.md +19 -4
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +19 -4
- package/templates/.agents/skills/complete-task/SKILL.md +11 -1
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +11 -1
- package/templates/.agents/skills/create-issue/SKILL.md +302 -0
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +302 -0
- package/templates/.agents/skills/create-pr/SKILL.md +140 -5
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +140 -5
- package/templates/.agents/skills/create-release-note/SKILL.md +18 -11
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +18 -11
- package/templates/.agents/skills/create-task/SKILL.md +80 -78
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +7 -6
- package/templates/.agents/skills/implement-task/SKILL.md +7 -2
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +7 -2
- package/templates/.agents/skills/import-codescan/SKILL.md +54 -53
- package/templates/.agents/skills/import-dependabot/SKILL.md +57 -56
- package/templates/.agents/skills/import-issue/SKILL.md +58 -58
- package/templates/.agents/skills/init-labels/SKILL.md +8 -0
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +8 -0
- package/templates/.agents/skills/plan-task/SKILL.md +151 -149
- package/templates/.agents/skills/refine-task/SKILL.md +147 -137
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +10 -2
- package/templates/.agents/skills/review-task/SKILL.md +196 -186
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +13 -4
- package/templates/.agents/skills/sync-issue/SKILL.md +252 -272
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +26 -47
- package/templates/.agents/skills/sync-pr/SKILL.md +274 -82
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +251 -59
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +1 -1
- package/templates/.claude/CLAUDE.md +13 -0
- package/templates/.claude/CLAUDE.zh-CN.md +13 -0
- package/templates/.claude/commands/create-issue.md +8 -0
- package/templates/.claude/commands/create-issue.zh-CN.md +8 -0
- package/templates/.gemini/commands/_project_/create-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +8 -0
- package/templates/.opencode/commands/create-issue.md +11 -0
- package/templates/.opencode/commands/create-issue.zh-CN.md +11 -0
- package/templates/AGENTS.md +13 -0
- package/templates/AGENTS.zh-CN.md +13 -0
|
@@ -64,13 +64,22 @@ git push -u origin <current-branch>
|
|
|
64
64
|
|
|
65
65
|
### 7. Create PR
|
|
66
66
|
|
|
67
|
+
- If this work is associated with an active task, extract `issue_number` from task.md
|
|
68
|
+
- If `issue_number` exists, query Issue information on a best-effort basis and skip on failure:
|
|
69
|
+
```bash
|
|
70
|
+
gh issue view {issue-number} --json number,title --jq '.number' 2>/dev/null
|
|
71
|
+
```
|
|
67
72
|
- Follow `.github/PULL_REQUEST_TEMPLATE.md` format for all sections
|
|
68
73
|
- Reference recent merged PRs for style
|
|
69
74
|
- Use HEREDOC format to pass the body
|
|
75
|
+
- If `issue_number` exists:
|
|
76
|
+
- replace `{$IssueNumber}` in the template with the actual Issue number
|
|
77
|
+
- use `Closes #{issue_number}` in the `Related Issue` section
|
|
78
|
+
- If `issue_number` does not exist, keep the current behavior
|
|
70
79
|
- PR must end with: `Generated with AI assistance`
|
|
71
80
|
|
|
72
81
|
```bash
|
|
73
|
-
gh pr create --base <target-branch> --title "<title>" --body "$(cat <<'EOF'
|
|
82
|
+
gh pr create --base <target-branch> --title "<title>" --assignee @me --body "$(cat <<'EOF'
|
|
74
83
|
<Complete PR description following template>
|
|
75
84
|
|
|
76
85
|
Generated with AI assistance
|
|
@@ -78,7 +87,116 @@ EOF
|
|
|
78
87
|
)"
|
|
79
88
|
```
|
|
80
89
|
|
|
81
|
-
### 8.
|
|
90
|
+
### 8. Sync PR Metadata (If Task-Related)
|
|
91
|
+
|
|
92
|
+
If this work is associated with an active task, sync the following metadata immediately after creating the PR.
|
|
93
|
+
|
|
94
|
+
**a) Check whether the label system has been initialized**
|
|
95
|
+
|
|
96
|
+
Run:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- returns `0` -> run the `init-labels` skill first, then retry this step
|
|
103
|
+
- returns non-zero -> continue
|
|
104
|
+
|
|
105
|
+
**b) Query Issue metadata**
|
|
106
|
+
|
|
107
|
+
If task.md contains `issue_number`, query the Issue labels and milestone on a best-effort basis:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gh issue view {issue-number} --json labels,milestone 2>/dev/null
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If the query fails (Issue not found, permission denied, etc.), skip Issue metadata inheritance and continue with only the static mappings from task.md.
|
|
114
|
+
|
|
115
|
+
Record the results for later substeps:
|
|
116
|
+
- `{issue-labels}`: list of labels currently on the Issue
|
|
117
|
+
- `{issue-milestone}`: title of the Issue milestone, if present
|
|
118
|
+
|
|
119
|
+
**c) Sync the type label**
|
|
120
|
+
|
|
121
|
+
Map task.md `type` using this table:
|
|
122
|
+
|
|
123
|
+
| task.md type | GitHub label |
|
|
124
|
+
|---|---|
|
|
125
|
+
| bug, bugfix | `type: bug` |
|
|
126
|
+
| feature | `type: feature` |
|
|
127
|
+
| enhancement | `type: enhancement` |
|
|
128
|
+
| refactor, refactoring | `type: enhancement` |
|
|
129
|
+
| documentation | `type: documentation` |
|
|
130
|
+
| dependency-upgrade | `type: dependency-upgrade` |
|
|
131
|
+
| task | `type: task` |
|
|
132
|
+
| anything else | skip |
|
|
133
|
+
|
|
134
|
+
If task.md `type` maps to a standard type label, run:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
gh pr edit {pr-number} --add-label "{type-label}"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**d) Inherit Issue labels**
|
|
141
|
+
|
|
142
|
+
If `{issue-labels}` is not empty, filter labels that do not start with `type:` or `status:` and run the following for each label on a best-effort basis:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
gh pr edit {pr-number} --add-label "{label-name}"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Only add labels; do not remove any existing PR labels.
|
|
149
|
+
|
|
150
|
+
**e) Sync `in:` labels**
|
|
151
|
+
|
|
152
|
+
Extract affected modules from implementation reports or analysis, verify that the label exists, then run:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
gh pr edit {pr-number} --add-label "in: {module}"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Only add labels; do not remove existing `in:` labels.
|
|
159
|
+
|
|
160
|
+
**f) Sync the milestone**
|
|
161
|
+
|
|
162
|
+
Extend the `sync-pr` milestone inference strategy with Issue milestone priority:
|
|
163
|
+
- preserve an existing PR milestone
|
|
164
|
+
- otherwise respect explicit `milestone` from task.md
|
|
165
|
+
- otherwise use the Issue milestone when available (`{issue-milestone}`)
|
|
166
|
+
- otherwise infer from the current branch, release branches, or the latest tag
|
|
167
|
+
- finally fall back to `General Backlog`
|
|
168
|
+
|
|
169
|
+
Once the target is resolved, run:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
gh pr edit {pr-number} --milestone "{milestone-title}"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**g) Sync development linking**
|
|
176
|
+
|
|
177
|
+
If task.md contains `issue_number`, read the PR body:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
gh pr view {pr-number} --json body --jq '.body // ""'
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
If the body does not contain any of:
|
|
184
|
+
- `Closes #{issue-number}`
|
|
185
|
+
- `Fixes #{issue-number}`
|
|
186
|
+
- `Resolves #{issue-number}`
|
|
187
|
+
|
|
188
|
+
append:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
gh pr edit {pr-number} --body "$(cat <<'EOF'
|
|
192
|
+
{existing-body}
|
|
193
|
+
|
|
194
|
+
Closes #{issue-number}
|
|
195
|
+
EOF
|
|
196
|
+
)"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 9. Update Task Status (If Task-Related)
|
|
82
200
|
|
|
83
201
|
Get the current time:
|
|
84
202
|
|
|
@@ -94,19 +212,32 @@ If there is an active task for this work, update `.agent-workspace/active/{task-
|
|
|
94
212
|
- {yyyy-MM-dd HH:mm:ss} — **PR Created** by {agent} — PR #{pr-number} created
|
|
95
213
|
```
|
|
96
214
|
|
|
97
|
-
###
|
|
215
|
+
### 10. Output Result
|
|
98
216
|
|
|
99
217
|
> **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
|
|
100
218
|
|
|
219
|
+
> **⚠️ Next-Step Check — you must determine the real next action after PR creation before showing the commands below:**
|
|
220
|
+
>
|
|
221
|
+
> - If `task.md` has a valid `issue_number` and the PR status or review summary should be synced back into task context, prioritize "Publish review summary (optional)"
|
|
222
|
+
> - If all workflow steps are complete, or the next action after PR creation is task archival, include "Complete task"
|
|
223
|
+
> - If both apply, make the order explicit: **sync PR progress first, then complete the task**
|
|
224
|
+
>
|
|
225
|
+
> **Do not present "Complete task" as the only next step when PR progress or context still needs to be synced.**
|
|
226
|
+
|
|
101
227
|
```
|
|
102
228
|
PR created: {pr-url}
|
|
103
229
|
|
|
230
|
+
Metadata sync:
|
|
231
|
+
- Labels: {type-label-result}, {in-label-result}
|
|
232
|
+
- Milestone: {milestone-result}
|
|
233
|
+
- Development: {development-result}
|
|
234
|
+
|
|
104
235
|
Next steps (if in task workflow):
|
|
105
|
-
-
|
|
236
|
+
- Publish review summary (optional; recommended first when task/PR status still needs syncing):
|
|
106
237
|
- Claude Code / OpenCode: /sync-pr {task-id}
|
|
107
238
|
- Gemini CLI: /{{project}}:sync-pr {task-id}
|
|
108
239
|
- Codex CLI: $sync-pr {task-id}
|
|
109
|
-
- Complete task:
|
|
240
|
+
- Complete task (after all workflow steps are complete):
|
|
110
241
|
- Claude Code / OpenCode: /complete-task {task-id}
|
|
111
242
|
- Gemini CLI: /{{project}}:complete-task {task-id}
|
|
112
243
|
- Codex CLI: $complete-task {task-id}
|
|
@@ -118,9 +249,13 @@ Next steps (if in task workflow):
|
|
|
118
249
|
2. **Reference style**: Match the format and style of recent merged PRs
|
|
119
250
|
3. **Title format**: Follow Conventional Commits or project conventions
|
|
120
251
|
4. **All commits matter**: Analyze ALL commits in the branch, not just the latest
|
|
252
|
+
5. **Sync metadata automatically**: When task-related, create-pr must immediately fill labels, milestone, and development linking after PR creation
|
|
121
253
|
|
|
122
254
|
## Error Handling
|
|
123
255
|
|
|
124
256
|
- No commits to push: Prompt "No commits found between {target} and HEAD"
|
|
125
257
|
- Push rejected: Suggest `git pull --rebase` first
|
|
126
258
|
- PR already exists: Show existing PR URL
|
|
259
|
+
- Issue not accessible or missing: Skip Issue metadata inheritance and record "Issue #{number} not accessible, skipping metadata inheritance"
|
|
260
|
+
- Issue label unavailable: Skip that label and record "Label '{name}' not found, skipping"
|
|
261
|
+
- Issue milestone unavailable: Fall back to branch-based milestone inference
|
|
@@ -63,13 +63,22 @@ git push -u origin <current-branch>
|
|
|
63
63
|
|
|
64
64
|
### 7. 创建 PR
|
|
65
65
|
|
|
66
|
+
- 如果存在关联的活跃任务,从 task.md 提取 `issue_number`
|
|
67
|
+
- 如果 `issue_number` 存在,查询 Issue 信息(容错,失败时跳过):
|
|
68
|
+
```bash
|
|
69
|
+
gh issue view {issue-number} --json number,title --jq '.number' 2>/dev/null
|
|
70
|
+
```
|
|
66
71
|
- 遵循 `.github/PULL_REQUEST_TEMPLATE.md` 格式填写所有部分
|
|
67
72
|
- 参考最近合并的 PR 的风格
|
|
68
73
|
- 使用 HEREDOC 格式传递 body
|
|
74
|
+
- 如果 `issue_number` 存在:
|
|
75
|
+
- 将模板中的 `{$IssueNumber}` 替换为实际 Issue 编号
|
|
76
|
+
- 在 `Related Issue` 部分使用 `Closes #{issue_number}`
|
|
77
|
+
- 如果 `issue_number` 不存在,保持原有行为
|
|
69
78
|
- PR 必须以 `Generated with AI assistance` 结尾
|
|
70
79
|
|
|
71
80
|
```bash
|
|
72
|
-
gh pr create --base <target-branch> --title "<title>" --body "$(cat <<'EOF'
|
|
81
|
+
gh pr create --base <target-branch> --title "<title>" --assignee @me --body "$(cat <<'EOF'
|
|
73
82
|
<按模板填写的完整 PR 描述>
|
|
74
83
|
|
|
75
84
|
Generated with AI assistance
|
|
@@ -77,7 +86,116 @@ EOF
|
|
|
77
86
|
)"
|
|
78
87
|
```
|
|
79
88
|
|
|
80
|
-
### 8.
|
|
89
|
+
### 8. 同步 PR 元数据(如果与任务相关)
|
|
90
|
+
|
|
91
|
+
如果存在关联的活跃任务,在创建 PR 后立即同步以下元数据:
|
|
92
|
+
|
|
93
|
+
**a) 检查 label 体系是否已初始化**
|
|
94
|
+
|
|
95
|
+
执行:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- 返回 `0` -> 先执行 `init-labels` 技能,然后重新执行本步骤
|
|
102
|
+
- 返回非 `0` -> 继续
|
|
103
|
+
|
|
104
|
+
**b) 查询 Issue 元数据**
|
|
105
|
+
|
|
106
|
+
如果 task.md 包含 `issue_number`,查询 Issue 的 Labels 和 Milestone(容错):
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
gh issue view {issue-number} --json labels,milestone 2>/dev/null
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
如果查询失败(Issue 不存在、权限不足等),跳过 Issue 元数据继承,后续步骤仅使用 task.md 静态映射。
|
|
113
|
+
|
|
114
|
+
记录查询结果供后续子步骤使用:
|
|
115
|
+
- `{issue-labels}` — Issue 上的 Labels 列表
|
|
116
|
+
- `{issue-milestone}` — Issue 上的 Milestone 标题(如有)
|
|
117
|
+
|
|
118
|
+
**c) 同步 type label**
|
|
119
|
+
|
|
120
|
+
根据 task.md 的 `type` 字段按下表映射:
|
|
121
|
+
|
|
122
|
+
| task.md type | GitHub label |
|
|
123
|
+
|---|---|
|
|
124
|
+
| bug、bugfix | `type: bug` |
|
|
125
|
+
| feature | `type: feature` |
|
|
126
|
+
| enhancement | `type: enhancement` |
|
|
127
|
+
| refactor、refactoring | `type: enhancement` |
|
|
128
|
+
| documentation | `type: documentation` |
|
|
129
|
+
| dependency-upgrade | `type: dependency-upgrade` |
|
|
130
|
+
| task | `type: task` |
|
|
131
|
+
| 其他 | 跳过 |
|
|
132
|
+
|
|
133
|
+
如果 task.md 的 `type` 可以映射到标准 type label,执行:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
gh pr edit {pr-number} --add-label "{type-label}"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**d) 继承 Issue Labels**
|
|
140
|
+
|
|
141
|
+
如果 `{issue-labels}` 非空,筛选出不以 `type:` 或 `status:` 开头的 labels,对每个 label 执行(容错,label 不存在时跳过):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
gh pr edit {pr-number} --add-label "{label-name}"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
只添加,不移除 PR 上现有的 labels。
|
|
148
|
+
|
|
149
|
+
**e) 同步 in: label**
|
|
150
|
+
|
|
151
|
+
从实现报告或分析报告提取受影响模块,确认对应 label 存在后执行:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
gh pr edit {pr-number} --add-label "in: {module}"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
只添加,不移除现有的 `in:` labels。
|
|
158
|
+
|
|
159
|
+
**f) 同步 Milestone**
|
|
160
|
+
|
|
161
|
+
基于 `sync-pr` 的里程碑推断策略,并扩展 Issue Milestone 优先级:
|
|
162
|
+
- 先检查 PR 是否已有 milestone
|
|
163
|
+
- 再检查 task.md 是否显式指定 `milestone`
|
|
164
|
+
- 再检查 Issue 是否已有 milestone(使用 `{issue-milestone}`)
|
|
165
|
+
- 否则基于当前分支、版本分支或最新 tag 推断
|
|
166
|
+
- 最终回退到 `General Backlog`
|
|
167
|
+
|
|
168
|
+
找到目标后执行:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
gh pr edit {pr-number} --milestone "{milestone-title}"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**g) 同步 Development 关联**
|
|
175
|
+
|
|
176
|
+
如果 task.md 包含 `issue_number`,读取 PR body:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
gh pr view {pr-number} --json body --jq '.body // ""'
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
如果 body 不包含以下任一关键词:
|
|
183
|
+
- `Closes #{issue-number}`
|
|
184
|
+
- `Fixes #{issue-number}`
|
|
185
|
+
- `Resolves #{issue-number}`
|
|
186
|
+
|
|
187
|
+
则在末尾追加:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
gh pr edit {pr-number} --body "$(cat <<'EOF'
|
|
191
|
+
{existing-body}
|
|
192
|
+
|
|
193
|
+
Closes #{issue-number}
|
|
194
|
+
EOF
|
|
195
|
+
)"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 9. 更新任务状态(如果与任务相关)
|
|
81
199
|
|
|
82
200
|
获取当前时间:
|
|
83
201
|
|
|
@@ -93,19 +211,32 @@ date "+%Y-%m-%d %H:%M:%S"
|
|
|
93
211
|
- {yyyy-MM-dd HH:mm:ss} — **PR Created** by {agent} — PR #{pr-number} created
|
|
94
212
|
```
|
|
95
213
|
|
|
96
|
-
###
|
|
214
|
+
### 10. 输出结果
|
|
97
215
|
|
|
98
216
|
> **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
|
|
99
217
|
|
|
218
|
+
> **⚠️ 下一步判断 — 你必须先判断创建 PR 后的真实下一步,再展示下面的命令:**
|
|
219
|
+
>
|
|
220
|
+
> - 如果 `task.md` 有有效 `issue_number`,且需要把 PR 状态或审查摘要同步回任务上下文,优先提示「发布审查摘要(可选)」
|
|
221
|
+
> - 如果所有工作流步骤已经完成,或创建 PR 后下一步就是归档任务,提示「完成任务」
|
|
222
|
+
> - 如果以上两者都适用,必须明确顺序:**先同步 PR 进度,再完成任务**
|
|
223
|
+
>
|
|
224
|
+
> **禁止把「完成任务」写成唯一下一步,如果仍需要同步进度或补充 PR 上下文。**
|
|
225
|
+
|
|
100
226
|
```
|
|
101
227
|
PR 已创建:{pr-url}
|
|
102
228
|
|
|
229
|
+
元数据同步:
|
|
230
|
+
- Labels:{type-label-result}, {in-label-result}
|
|
231
|
+
- Milestone:{milestone-result}
|
|
232
|
+
- Development:{development-result}
|
|
233
|
+
|
|
103
234
|
下一步(如在任务工作流中):
|
|
104
|
-
-
|
|
235
|
+
- 发布审查摘要(可选;有关联任务或需要同步 PR 状态时建议先执行):
|
|
105
236
|
- Claude Code / OpenCode:/sync-pr {task-id}
|
|
106
237
|
- Gemini CLI:/{{project}}:sync-pr {task-id}
|
|
107
238
|
- Codex CLI:$sync-pr {task-id}
|
|
108
|
-
-
|
|
239
|
+
- 完成任务(所有工作流步骤完成后执行):
|
|
109
240
|
- Claude Code / OpenCode:/complete-task {task-id}
|
|
110
241
|
- Gemini CLI:/{{project}}:complete-task {task-id}
|
|
111
242
|
- Codex CLI:$complete-task {task-id}
|
|
@@ -117,9 +248,13 @@ PR 已创建:{pr-url}
|
|
|
117
248
|
2. **参考风格**:匹配最近合并的 PR 的格式和风格
|
|
118
249
|
3. **标题格式**:遵循 Conventional Commits 或项目规范
|
|
119
250
|
4. **所有提交都重要**:分析分支中的**所有**提交,而不仅仅是最新的
|
|
251
|
+
5. **自动同步元数据**:如果与任务相关,create-pr 必须在创建后立即补齐 labels、milestone 和 development 关联
|
|
120
252
|
|
|
121
253
|
## 错误处理
|
|
122
254
|
|
|
123
255
|
- 无提交可推送:提示 "No commits found between {target} and HEAD"
|
|
124
256
|
- 推送被拒绝:建议先执行 `git pull --rebase`
|
|
125
257
|
- PR 已存在:显示已有的 PR URL
|
|
258
|
+
- Issue 不存在或无权限:跳过 Issue 元数据继承,记录 "Issue #{number} not accessible, skipping metadata inheritance"
|
|
259
|
+
- Issue Label 不可用:跳过对应 label,记录 "Label '{name}' not found, skipping"
|
|
260
|
+
- Issue Milestone 不可用:回退到分支推断策略
|
|
@@ -34,22 +34,29 @@ git rev-parse v<version>
|
|
|
34
34
|
git rev-parse v<prev-version>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### Step 3: Reference Historical Release Notes Format
|
|
37
|
+
### Step 3: Reference Historical Release Notes Format and Categories
|
|
38
38
|
|
|
39
|
-
Fetch
|
|
39
|
+
Fetch multiple published release notes as format references, then use a predefined complete category list:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
#
|
|
43
|
-
gh release list --limit
|
|
44
|
-
--jq '[.[] | select(.isDraft == false and .isPrerelease == false)][0].tagName'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
gh release view <latest-tag> --json body -q '.body'
|
|
42
|
+
# Part A: Fetch the body for each of the 3 releases
|
|
43
|
+
for tag in $(gh release list --limit 10 --json tagName,isDraft,isPrerelease \
|
|
44
|
+
--jq '[.[] | select(.isDraft == false and .isPrerelease == false)] | .[0:3] | .[].tagName'); do
|
|
45
|
+
gh release view "$tag" --json body -q '.body'
|
|
46
|
+
done
|
|
48
47
|
```
|
|
49
48
|
|
|
49
|
+
**Part B: Complete Category List**
|
|
50
|
+
- `🆕 Feature`
|
|
51
|
+
- `✨ Enhancement`
|
|
52
|
+
- `✅ Bugfix`
|
|
53
|
+
- `📚 Documentation`
|
|
54
|
+
|
|
50
55
|
**Purpose**:
|
|
51
|
-
- Analyze the section structure, heading style, emoji usage, and item format
|
|
52
|
-
-
|
|
56
|
+
- Part A: Analyze the section structure, heading style, emoji usage, and item format from the latest 3 historical release notes
|
|
57
|
+
- Part B: Provide a static complete category list so no existing category is omitted
|
|
58
|
+
- This static list ensures existing category names are not missed during classification; if the current release has no entries for a category, Step 7 still omits the empty section
|
|
59
|
+
- When generating release notes in Step 7, **must** follow both the historical format style and the full category list gathered in Step 3
|
|
53
60
|
- If no historical release notes exist, use the default format defined in Step 7
|
|
54
61
|
|
|
55
62
|
### Step 4: Collect Merged PRs
|
|
@@ -94,7 +101,7 @@ gh issue view <N> --json number,title,labels,url
|
|
|
94
101
|
|
|
95
102
|
### Step 7: Generate Release Notes
|
|
96
103
|
|
|
97
|
-
**Prioritize the historical format obtained in Step 3.** If historical release notes exist, strictly follow their section structure, heading style (including emojis), item format, and bilingual layout.
|
|
104
|
+
**Prioritize the historical format style obtained in Step 3 and ensure all categories listed in Step 3 are covered.** If historical release notes exist, strictly follow their section structure, heading style (including emojis), item format, and bilingual layout.
|
|
98
105
|
|
|
99
106
|
If no historical release notes exist, use the following default Markdown format:
|
|
100
107
|
|
|
@@ -33,22 +33,29 @@ git rev-parse v<version>
|
|
|
33
33
|
git rev-parse v<prev-version>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### 步骤 3
|
|
36
|
+
### 步骤 3:参考历史发布说明格式与分类
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
获取最近多条已发布的 Release Note 作为格式参考,并参考预定义的完整分类清单:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
#
|
|
42
|
-
gh release list --limit
|
|
43
|
-
--jq '[.[] | select(.isDraft == false and .isPrerelease == false)][0].tagName'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
gh release view <latest-tag> --json body -q '.body'
|
|
41
|
+
# Part A: 逐条获取这 3 条 Release 的 body
|
|
42
|
+
for tag in $(gh release list --limit 10 --json tagName,isDraft,isPrerelease \
|
|
43
|
+
--jq '[.[] | select(.isDraft == false and .isPrerelease == false)] | .[0:3] | .[].tagName'); do
|
|
44
|
+
gh release view "$tag" --json body -q '.body'
|
|
45
|
+
done
|
|
47
46
|
```
|
|
48
47
|
|
|
48
|
+
**Part B:完整分类清单**
|
|
49
|
+
- `🆕 Feature`
|
|
50
|
+
- `✨ Enhancement`
|
|
51
|
+
- `✅ Bugfix`
|
|
52
|
+
- `📚 Documentation`
|
|
53
|
+
|
|
49
54
|
**用途**:
|
|
50
|
-
-
|
|
51
|
-
-
|
|
55
|
+
- Part A:分析最近 3 条历史发布说明的章节结构、标题风格、emoji 使用、条目格式
|
|
56
|
+
- Part B:提供静态完整分类清单,确保后续生成时不遗漏已有分类
|
|
57
|
+
- 该静态清单用于确保变更分类时不遗漏已有类别名称;若当前版本无该类变更,仍按步骤 7 的格式规则省略空分类
|
|
58
|
+
- 后续步骤 7 生成发布说明时,**必须**同时参考步骤 3 的历史格式风格和完整分类清单,保持版本间的一致性
|
|
52
59
|
- 如果没有历史发布说明,则使用步骤 7 中定义的默认格式
|
|
53
60
|
|
|
54
61
|
### 步骤 4:收集已合并的 PR
|
|
@@ -93,7 +100,7 @@ gh issue view <N> --json number,title,labels,url
|
|
|
93
100
|
|
|
94
101
|
### 步骤 7:生成发布说明
|
|
95
102
|
|
|
96
|
-
**优先使用步骤 3
|
|
103
|
+
**优先使用步骤 3 中获取的历史格式风格,并确保覆盖步骤 3 列出的所有分类。** 如果存在历史发布说明,严格沿用其章节结构、标题风格(含 emoji)、条目格式和双语布局。
|
|
97
104
|
|
|
98
105
|
如果没有历史发布说明,使用以下默认格式化为 Markdown:
|
|
99
106
|
|