@fitlab-ai/agent-infra 0.3.1 → 0.4.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/README.md +29 -39
- package/README.zh-CN.md +29 -39
- package/bin/cli.js +1 -1
- package/lib/defaults.json +3 -12
- package/lib/init.js +13 -24
- package/lib/paths.js +3 -42
- package/lib/update.js +98 -32
- package/lib/version.js +2 -1
- package/package.json +2 -1
- package/templates/.agents/QUICKSTART.md +7 -7
- package/templates/.agents/QUICKSTART.zh-CN.md +7 -7
- package/templates/.agents/README.md +16 -4
- package/templates/.agents/README.zh-CN.md +16 -4
- package/templates/.agents/skills/analyze-task/SKILL.md +106 -105
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/block-task/SKILL.md +8 -8
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/check-task/SKILL.md +3 -3
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +3 -3
- 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 +1 -1
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.md +7 -7
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/create-issue/SKILL.md +57 -12
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +57 -12
- package/templates/.agents/skills/create-pr/SKILL.md +44 -7
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +44 -7
- 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 +11 -10
- package/templates/.agents/skills/implement-task/SKILL.md +15 -18
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +15 -18
- package/templates/.agents/skills/import-codescan/SKILL.md +54 -53
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.md +57 -56
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/import-issue/SKILL.md +58 -58
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
- 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/plan-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/refine-task/SKILL.md +3 -3
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/release/SKILL.md +55 -14
- package/templates/.agents/skills/release/SKILL.zh-CN.md +55 -14
- package/templates/.agents/skills/review-task/SKILL.md +9 -9
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +9 -9
- package/templates/.agents/skills/sync-issue/SKILL.md +258 -279
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +34 -56
- package/templates/.agents/skills/sync-pr/SKILL.md +8 -28
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +7 -27
- package/templates/.agents/skills/update-agent-infra/SKILL.md +6 -6
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +61 -116
- package/templates/.agents/templates/handoff.md +1 -1
- package/templates/.agents/templates/handoff.zh-CN.md +1 -1
- package/templates/.agents/workflows/bug-fix.yaml +71 -71
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/feature-development.yaml +71 -71
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/refactoring.yaml +76 -76
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +1 -1
- package/templates/{.agent-workspace → .agents/workspace}/README.md +1 -1
- package/templates/{.agent-workspace → .agents/workspace}/README.zh-CN.md +1 -1
- package/templates/.claude/CLAUDE.md +14 -1
- package/templates/.claude/CLAUDE.zh-CN.md +14 -1
- package/templates/.claude/hooks/check-version-format.sh +44 -0
- package/templates/.claude/settings.json +14 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +6 -6
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +6 -6
- package/templates/AGENTS.md +14 -1
- package/templates/AGENTS.zh-CN.md +14 -1
- package/templates/.editorconfig +0 -15
- package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +0 -149
- package/templates/.github/ISSUE_TEMPLATE/02_question.yml +0 -101
- package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +0 -131
- package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +0 -165
- package/templates/.github/ISSUE_TEMPLATE/05_other.yml +0 -147
- package/templates/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/templates/.github/PULL_REQUEST_TEMPLATE.md +0 -123
- package/templates/.github/dependabot.yml +0 -17
- package/templates/.github/hooks/check-utf8-encoding.sh +0 -25
- package/templates/.github/release.yml +0 -27
- package/templates/.github/workflows/pr-title-check.yml +0 -42
- package/templates/.mailmap +0 -4
- package/templates/CONTRIBUTING.md +0 -126
- package/templates/CONTRIBUTING.zh-CN.md +0 -124
- package/templates/SECURITY.md +0 -131
- package/templates/SECURITY.zh-CN.md +0 -131
|
@@ -20,7 +20,7 @@ description: >
|
|
|
20
20
|
### 1. 验证前置条件
|
|
21
21
|
|
|
22
22
|
检查必要文件:
|
|
23
|
-
- `.
|
|
23
|
+
- `.agents/workspace/active/{task-id}/task.md` - 任务文件
|
|
24
24
|
|
|
25
25
|
检查 GitHub CLI 可用且已认证:
|
|
26
26
|
|
|
@@ -62,15 +62,18 @@ Issue 内容规则:
|
|
|
62
62
|
rg --files .github/ISSUE_TEMPLATE -g '*.yml' -g '!config.yml'
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
如果存在模板文件,读取每个模板的顶层 `name:` 字段,构建候选列表。结合任务标题和描述,从候选列表中选择最匹配的模板。
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
示例候选列表:
|
|
68
|
+
- `bug_report.yml` — Bug 类模板
|
|
69
|
+
- `question.yml` — 问题咨询类模板
|
|
70
|
+
- `feature_request.yml` — 功能请求类模板
|
|
71
|
+
- `documentation.yml` — 文档问题类模板
|
|
72
|
+
- `other.yml` — 通用兜底模板
|
|
73
|
+
|
|
74
|
+
如果没有明确匹配的模板,选择最接近的一个。
|
|
75
|
+
|
|
76
|
+
以上文件名仅为示例,应以目标项目实际存在的模板为准。
|
|
74
77
|
|
|
75
78
|
如果没有模板、没有匹配到合适模板,或模板 YAML 解析失败,则直接进入 **3c fallback / 兜底路径**。
|
|
76
79
|
|
|
@@ -172,16 +175,55 @@ issue_number="${issue_url##*/}"
|
|
|
172
175
|
|
|
173
176
|
如果已经确定了 `{issue-type}`,在创建后以 best-effort 方式设置 Issue Type:
|
|
174
177
|
|
|
178
|
+
先获取仓库信息,后续 `in:` label 步骤也会复用:
|
|
179
|
+
|
|
175
180
|
```bash
|
|
176
181
|
repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
|
|
177
182
|
owner="${repo%%/*}"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
查询组织可用的 Issue Types:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
178
188
|
gh api "orgs/$owner/issue-types" --jq '.[].name'
|
|
179
|
-
gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}"
|
|
180
189
|
```
|
|
181
190
|
|
|
191
|
+
如果查询成功且 `{issue-type}` 在返回列表中,执行设置:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}" --silent
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
验证设置结果:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
gh api "repos/$repo/issues/{issue-number}" --jq '.type.name // empty'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
如果验证返回的名称与 `{issue-type}` 一致,记录 `Issue Type: {issue-type}`;否则记录 `Issue Type: failed to set`。
|
|
204
|
+
|
|
205
|
+
#### 添加 `in:` labels
|
|
206
|
+
|
|
207
|
+
获取仓库中所有 `in:` 前缀的 labels:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
gh label list --search "in:" --limit 50 --json name --jq '.[].name'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
如果没有 `in:` labels,跳过此步骤。
|
|
214
|
+
|
|
215
|
+
如果存在 `in:` labels,结合任务上下文(标题、描述、受影响文件列表)判断每个 `in:` label 是否与当前任务相关。对判断为相关的 label,执行:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
gh issue edit {issue-number} --add-label "in: {module}"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
记录所有成功添加的 `in:` labels。如果没有判断为相关的 label,记录 `in: labels: skipped (no relevant labels)`。
|
|
222
|
+
|
|
182
223
|
容错要求:
|
|
183
224
|
- 如果 `orgs/$owner/issue-types` 返回 `404`、仓库 owner 不是组织,或仓库未启用 Issue Types,则跳过,不要让创建失败
|
|
184
225
|
- 如果目标 `{issue-type}` 不在可用列表中,则跳过
|
|
226
|
+
- `in:` label 添加失败时,跳过并记录,不阻止 Issue 创建流程
|
|
185
227
|
- Milestone 不存在或名称无效时,也应提示并跳过,而不是中断整个 Issue 创建流程
|
|
186
228
|
|
|
187
229
|
### 5. 更新任务状态
|
|
@@ -192,7 +234,7 @@ gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}"
|
|
|
192
234
|
date "+%Y-%m-%d %H:%M:%S"
|
|
193
235
|
```
|
|
194
236
|
|
|
195
|
-
更新 `.
|
|
237
|
+
更新 `.agents/workspace/active/{task-id}/task.md`:
|
|
196
238
|
- 添加或更新 `issue_number`:`{issue-number}`
|
|
197
239
|
- `updated_at`:{当前时间}
|
|
198
240
|
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
@@ -212,7 +254,8 @@ Issue 信息:
|
|
|
212
254
|
- 编号:#{issue-number}
|
|
213
255
|
- URL:{issue-url}
|
|
214
256
|
- Labels:{applied-labels 或 skipped}
|
|
215
|
-
-
|
|
257
|
+
- in: Labels:{applied-in-labels 或 skipped}
|
|
258
|
+
- Issue Type:{issue-type | failed to set | skipped}
|
|
216
259
|
- Milestone:{milestone 或 skipped}
|
|
217
260
|
|
|
218
261
|
产出:
|
|
@@ -231,6 +274,7 @@ Issue 信息:
|
|
|
231
274
|
- [ ] 有模板时按模板结构生成正文;无模板时走 fallback / 兜底格式
|
|
232
275
|
- [ ] Issue 标题和正文仅来自 task.md
|
|
233
276
|
- [ ] 如可用,处理了 `type:` / Issue Type 和 `milestone`
|
|
277
|
+
- [ ] 处理了 `in:` labels(LLM 判断关联性)
|
|
234
278
|
- [ ] 在 task.md 中记录了 `issue_number`
|
|
235
279
|
- [ ] 更新了 task.md 中的 `updated_at`
|
|
236
280
|
- [ ] 追加了 Activity Log 条目到 task.md
|
|
@@ -248,6 +292,7 @@ Issue 信息:
|
|
|
248
292
|
3. **Label 容错**:标准 label 未初始化时,可以跳过 label,但不要阻止 Issue 创建
|
|
249
293
|
4. **模板容错**:模板缺失、匹配失败或 YAML 异常时,退回 fallback / 兜底正文,不要让整个创建失败
|
|
250
294
|
5. **Issue Type / Milestone 容错**:Issue Type 未启用、类型不存在或 milestone 不可用时,跳过该项并继续创建
|
|
295
|
+
6. **in: Label 容错**:`in:` label 添加失败时跳过,不阻止 Issue 创建
|
|
251
296
|
|
|
252
297
|
## 错误处理
|
|
253
298
|
|
|
@@ -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
|
|
@@ -93,7 +102,21 @@ gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
|
93
102
|
- returns `0` -> run the `init-labels` skill first, then retry this step
|
|
94
103
|
- returns non-zero -> continue
|
|
95
104
|
|
|
96
|
-
**b)
|
|
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**
|
|
97
120
|
|
|
98
121
|
Map task.md `type` using this table:
|
|
99
122
|
|
|
@@ -114,7 +137,17 @@ If task.md `type` maps to a standard type label, run:
|
|
|
114
137
|
gh pr edit {pr-number} --add-label "{type-label}"
|
|
115
138
|
```
|
|
116
139
|
|
|
117
|
-
**
|
|
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**
|
|
118
151
|
|
|
119
152
|
Extract affected modules from implementation reports or analysis, verify that the label exists, then run:
|
|
120
153
|
|
|
@@ -124,11 +157,12 @@ gh pr edit {pr-number} --add-label "in: {module}"
|
|
|
124
157
|
|
|
125
158
|
Only add labels; do not remove existing `in:` labels.
|
|
126
159
|
|
|
127
|
-
**
|
|
160
|
+
**f) Sync the milestone**
|
|
128
161
|
|
|
129
|
-
|
|
162
|
+
Extend the `sync-pr` milestone inference strategy with Issue milestone priority:
|
|
130
163
|
- preserve an existing PR milestone
|
|
131
164
|
- otherwise respect explicit `milestone` from task.md
|
|
165
|
+
- otherwise use the Issue milestone when available (`{issue-milestone}`)
|
|
132
166
|
- otherwise infer from the current branch, release branches, or the latest tag
|
|
133
167
|
- finally fall back to `General Backlog`
|
|
134
168
|
|
|
@@ -138,7 +172,7 @@ Once the target is resolved, run:
|
|
|
138
172
|
gh pr edit {pr-number} --milestone "{milestone-title}"
|
|
139
173
|
```
|
|
140
174
|
|
|
141
|
-
**
|
|
175
|
+
**g) Sync development linking**
|
|
142
176
|
|
|
143
177
|
If task.md contains `issue_number`, read the PR body:
|
|
144
178
|
|
|
@@ -170,7 +204,7 @@ Get the current time:
|
|
|
170
204
|
date "+%Y-%m-%d %H:%M:%S"
|
|
171
205
|
```
|
|
172
206
|
|
|
173
|
-
If there is an active task for this work, update `.
|
|
207
|
+
If there is an active task for this work, update `.agents/workspace/active/{task-id}/task.md`:
|
|
174
208
|
- `pr_number`: {pr-number}
|
|
175
209
|
- `updated_at`: {current time}
|
|
176
210
|
- **Append** to `## Activity Log` (do NOT overwrite previous entries):
|
|
@@ -222,3 +256,6 @@ Next steps (if in task workflow):
|
|
|
222
256
|
- No commits to push: Prompt "No commits found between {target} and HEAD"
|
|
223
257
|
- Push rejected: Suggest `git pull --rebase` first
|
|
224
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
|
|
@@ -92,7 +101,21 @@ gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
|
92
101
|
- 返回 `0` -> 先执行 `init-labels` 技能,然后重新执行本步骤
|
|
93
102
|
- 返回非 `0` -> 继续
|
|
94
103
|
|
|
95
|
-
**b)
|
|
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**
|
|
96
119
|
|
|
97
120
|
根据 task.md 的 `type` 字段按下表映射:
|
|
98
121
|
|
|
@@ -113,7 +136,17 @@ gh label list --search "type:" --limit 1 --json name --jq 'length'
|
|
|
113
136
|
gh pr edit {pr-number} --add-label "{type-label}"
|
|
114
137
|
```
|
|
115
138
|
|
|
116
|
-
**
|
|
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**
|
|
117
150
|
|
|
118
151
|
从实现报告或分析报告提取受影响模块,确认对应 label 存在后执行:
|
|
119
152
|
|
|
@@ -123,11 +156,12 @@ gh pr edit {pr-number} --add-label "in: {module}"
|
|
|
123
156
|
|
|
124
157
|
只添加,不移除现有的 `in:` labels。
|
|
125
158
|
|
|
126
|
-
**
|
|
159
|
+
**f) 同步 Milestone**
|
|
127
160
|
|
|
128
|
-
|
|
161
|
+
基于 `sync-pr` 的里程碑推断策略,并扩展 Issue Milestone 优先级:
|
|
129
162
|
- 先检查 PR 是否已有 milestone
|
|
130
163
|
- 再检查 task.md 是否显式指定 `milestone`
|
|
164
|
+
- 再检查 Issue 是否已有 milestone(使用 `{issue-milestone}`)
|
|
131
165
|
- 否则基于当前分支、版本分支或最新 tag 推断
|
|
132
166
|
- 最终回退到 `General Backlog`
|
|
133
167
|
|
|
@@ -137,7 +171,7 @@ gh pr edit {pr-number} --add-label "in: {module}"
|
|
|
137
171
|
gh pr edit {pr-number} --milestone "{milestone-title}"
|
|
138
172
|
```
|
|
139
173
|
|
|
140
|
-
**
|
|
174
|
+
**g) 同步 Development 关联**
|
|
141
175
|
|
|
142
176
|
如果 task.md 包含 `issue_number`,读取 PR body:
|
|
143
177
|
|
|
@@ -169,7 +203,7 @@ EOF
|
|
|
169
203
|
date "+%Y-%m-%d %H:%M:%S"
|
|
170
204
|
```
|
|
171
205
|
|
|
172
|
-
如果有关联的活跃任务,更新 `.
|
|
206
|
+
如果有关联的活跃任务,更新 `.agents/workspace/active/{task-id}/task.md`:
|
|
173
207
|
- `pr_number`:{pr-number}
|
|
174
208
|
- `updated_at`:{当前时间}
|
|
175
209
|
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
@@ -221,3 +255,6 @@ PR 已创建:{pr-url}
|
|
|
221
255
|
- 无提交可推送:提示 "No commits found between {target} and HEAD"
|
|
222
256
|
- 推送被拒绝:建议先执行 `git pull --rebase`
|
|
223
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
|
|
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-task
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Create a task skeleton from the user's natural-language description.
|
|
5
|
+
Triggered when the user describes a new feature, bug, or improvement request.
|
|
6
|
+
The only output is task.md; do not write any business code. Argument: task description text.
|
|
6
7
|
---
|
|
7
8
|
|
|
8
|
-
#
|
|
9
|
+
# Create Task
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Boundary / Critical Rules
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
**The only output of this skill is `task.md`.**
|
|
13
14
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
- Do not write, modify, or create any business code or configuration files
|
|
16
|
+
- Do not perform requirements analysis; analysis is handled separately by `analyze-task`
|
|
17
|
+
- Do not directly implement the requested functionality
|
|
18
|
+
- Do not skip the workflow and jump directly to planning or implementation
|
|
19
|
+
- Only do this: parse the description -> create the task file -> update task status -> inform the user of the next step
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
The user's description is a **work item**, not an **instruction to execute immediately**.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
After executing this skill, you **must** immediately update task status in task.md.
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Steps
|
|
25
26
|
|
|
26
|
-
### 1.
|
|
27
|
+
### 1. Parse the User Description
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
29
|
+
Extract from the natural-language description:
|
|
30
|
+
- **Task title**: a concise title (maximum 50 characters)
|
|
31
|
+
- **Task type**: `feature` | `bugfix` | `refactor` | `docs` | `chore` (infer from the description)
|
|
32
|
+
- **Workflow**: `feature-development` | `bug-fix` | `refactoring` (infer from the type)
|
|
33
|
+
- **Detailed description**: the cleaned-up original user request
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
If the description is unclear, **ask the user to clarify first**.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
- 包含 "add"、"new"、"support"、"implement" -> `feature`
|
|
38
|
-
- 包含 "fix"、"resolve"、"bug"、"error" -> `bugfix`
|
|
39
|
-
- 包含 "refactor"、"optimize"、"improve"、"clean up" -> `refactor`
|
|
40
|
-
- 包含 "document"、"javadoc"、"comment"、"readme" -> `docs`
|
|
41
|
-
- 其他 -> `chore`
|
|
37
|
+
**Type inference**: choose the best matching type from the following candidates based on the semantics of the task description:
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
- `feature` - new functionality or capability
|
|
40
|
+
- `bugfix` - defect or error fix
|
|
41
|
+
- `refactor` - refactoring, optimization, or code improvement
|
|
42
|
+
- `docs` - documentation-related work
|
|
43
|
+
- `chore` - other miscellaneous work
|
|
44
|
+
|
|
45
|
+
**Workflow mapping**:
|
|
44
46
|
- `feature` / `docs` / `chore` -> `feature-development`
|
|
45
47
|
- `bugfix` -> `bug-fix`
|
|
46
48
|
- `refactor` -> `refactoring`
|
|
47
49
|
|
|
48
|
-
### 2.
|
|
50
|
+
### 2. Create the Task Directory and File
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
Get the current timestamp:
|
|
51
53
|
|
|
52
54
|
```bash
|
|
53
55
|
date +%Y%m%d-%H%M%S
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
+
- Create the task directory: `.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
|
|
59
|
+
- Use the `.agents/templates/task.md` template to create the task file: `task.md`
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
61
|
+
**Important**:
|
|
62
|
+
- Directory naming: `TASK-{yyyyMMdd-HHmmss}` (**must** include the `TASK-` prefix)
|
|
63
|
+
- Example: `TASK-20260306-143022`
|
|
64
|
+
- Task ID = directory name
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
Task metadata (`task.md` YAML front matter):
|
|
65
67
|
```yaml
|
|
66
68
|
id: TASK-{yyyyMMdd-HHmmss}
|
|
67
69
|
type: feature|bugfix|refactor|docs|chore
|
|
@@ -71,73 +73,73 @@ created_at: {yyyy-MM-dd HH:mm:ss}
|
|
|
71
73
|
updated_at: {yyyy-MM-dd HH:mm:ss}
|
|
72
74
|
created_by: human
|
|
73
75
|
current_step: requirement-analysis
|
|
74
|
-
assigned_to: {
|
|
76
|
+
assigned_to: {current AI agent}
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
Note: `created_by` is `human` because the task comes from the user's description.
|
|
78
80
|
|
|
79
|
-
### 3.
|
|
81
|
+
### 3. Update Task Status
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
Get the current time:
|
|
82
84
|
|
|
83
85
|
```bash
|
|
84
86
|
date "+%Y-%m-%d %H:%M:%S"
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
- `current_step
|
|
89
|
-
- `assigned_to
|
|
90
|
-
- `updated_at
|
|
91
|
-
-
|
|
89
|
+
Update `.agents/workspace/active/{task-id}/task.md`:
|
|
90
|
+
- `current_step`: requirement-analysis
|
|
91
|
+
- `assigned_to`: {current AI agent}
|
|
92
|
+
- `updated_at`: {current time}
|
|
93
|
+
- **Append** to `## Activity Log` (do NOT overwrite previous entries):
|
|
92
94
|
```
|
|
93
95
|
- {yyyy-MM-dd HH:mm:ss} — **Task Created** by {agent} — Task created from description
|
|
94
96
|
```
|
|
95
97
|
|
|
96
|
-
### 4.
|
|
98
|
+
### 4. Inform User
|
|
97
99
|
|
|
98
|
-
>
|
|
100
|
+
> **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
Output format:
|
|
101
103
|
```
|
|
102
|
-
|
|
104
|
+
Task created.
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
106
|
+
Task information:
|
|
107
|
+
- Task ID: {task-id}
|
|
108
|
+
- Title: {title}
|
|
109
|
+
- Type: {type}
|
|
110
|
+
- Workflow: {workflow}
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
+
Output file:
|
|
113
|
+
- Task file: .agents/workspace/active/{task-id}/task.md
|
|
112
114
|
|
|
113
|
-
|
|
114
|
-
- Claude Code / OpenCode
|
|
115
|
-
- Gemini CLI
|
|
116
|
-
- Codex CLI
|
|
115
|
+
Next step - run requirements analysis:
|
|
116
|
+
- Claude Code / OpenCode: /analyze-task {task-id}
|
|
117
|
+
- Gemini CLI: /{{project}}:analyze-task {task-id}
|
|
118
|
+
- Codex CLI: $analyze-task {task-id}
|
|
117
119
|
```
|
|
118
120
|
|
|
119
|
-
##
|
|
121
|
+
## Completion Checklist
|
|
120
122
|
|
|
121
|
-
- [ ]
|
|
122
|
-
- [ ]
|
|
123
|
-
- [ ]
|
|
124
|
-
- [ ]
|
|
125
|
-
- [ ]
|
|
126
|
-
- [ ]
|
|
127
|
-
- [ ]
|
|
123
|
+
- [ ] Created the task file `.agents/workspace/active/{task-id}/task.md`
|
|
124
|
+
- [ ] Updated `current_step` to requirement-analysis in task.md
|
|
125
|
+
- [ ] Updated `updated_at` to the current time in task.md
|
|
126
|
+
- [ ] Updated `assigned_to` in task.md
|
|
127
|
+
- [ ] Appended an Activity Log entry to task.md
|
|
128
|
+
- [ ] Informed the user of the next step (must include all TUI command formats; do not filter)
|
|
129
|
+
- [ ] **Did not modify any business code or configuration files** (only task.md)
|
|
128
130
|
|
|
129
|
-
##
|
|
131
|
+
## STOP
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
After completing the checklist, **stop immediately**. Do not continue to planning, implementation, or any follow-up step.
|
|
134
|
+
Wait for the user to run the `analyze-task` skill.
|
|
133
135
|
|
|
134
|
-
##
|
|
136
|
+
## Notes
|
|
135
137
|
|
|
136
|
-
1.
|
|
137
|
-
2.
|
|
138
|
-
3.
|
|
138
|
+
1. **Clarity**: if the user description is vague or missing key information, ask for clarification first
|
|
139
|
+
2. **Difference from `import-issue`**: `import-issue` imports from a GitHub Issue; `create-task` creates from a free-form description
|
|
140
|
+
3. **Workflow order**: after creating a task, `analyze-task` must run before `plan-task`
|
|
139
141
|
|
|
140
|
-
##
|
|
142
|
+
## Error Handling
|
|
141
143
|
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
+
- Empty description: output "Please provide a task description"
|
|
145
|
+
- Description too vague: ask clarification questions before creating the task
|