@fitlab-ai/agent-infra 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/lib/defaults.json +2 -1
- package/package.json +1 -1
- package/templates/.agents/rules/commit-and-pr.md +30 -0
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +30 -0
- package/templates/.agents/rules/issue-sync.md +21 -2
- package/templates/.agents/rules/issue-sync.zh-CN.md +21 -2
- package/templates/.agents/rules/milestone-inference.md +102 -0
- package/templates/.agents/rules/milestone-inference.zh-CN.md +102 -0
- package/templates/.agents/rules/task-management.md +28 -0
- package/templates/.agents/rules/task-management.zh-CN.md +28 -0
- package/templates/.agents/scripts/validate-artifact.js +176 -12
- package/templates/.agents/skills/analyze-task/config/verify.json +3 -1
- package/templates/.agents/skills/cancel-task/SKILL.md +142 -0
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +142 -0
- package/templates/.agents/skills/cancel-task/config/verify.json +30 -0
- package/templates/.agents/skills/complete-task/SKILL.md +1 -0
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/complete-task/config/verify.json +6 -1
- package/templates/.agents/skills/create-issue/SKILL.md +2 -2
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/create-issue/config/verify.json +3 -1
- package/templates/.agents/skills/create-issue/reference/label-and-type.md +3 -1
- package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +3 -1
- package/templates/.agents/skills/create-pr/SKILL.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/config/verify.json +2 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.md +4 -12
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +4 -12
- package/templates/.agents/skills/implement-task/SKILL.md +12 -8
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +12 -8
- package/templates/.agents/skills/implement-task/config/verify.json +3 -1
- package/templates/.agents/skills/import-issue/SKILL.md +12 -2
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +12 -2
- package/templates/.agents/skills/plan-task/config/verify.json +3 -1
- package/templates/.agents/skills/refine-task/SKILL.md +4 -10
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +4 -10
- package/templates/.agents/skills/refine-task/config/verify.json +3 -1
- package/templates/.agents/skills/refine-task/reference/fix-workflow.md +7 -7
- package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +7 -7
- package/templates/.agents/skills/review-task/config/verify.json +3 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -2
- package/templates/.agents/templates/task.md +3 -7
- package/templates/.agents/templates/task.zh-CN.md +3 -7
- package/templates/.claude/commands/cancel-task.md +9 -0
- package/templates/.claude/commands/cancel-task.zh-CN.md +9 -0
- package/templates/.gemini/commands/_project_/cancel-task.toml +8 -0
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +8 -0
- package/templates/.github/workflows/status-label.yml +4 -1
- package/templates/.opencode/commands/cancel-task.md +11 -0
- package/templates/.opencode/commands/cancel-task.zh-CN.md +11 -0
package/README.md
CHANGED
|
@@ -380,7 +380,7 @@ The generated `.agents/.airc.json` file is the central contract between the boot
|
|
|
380
380
|
"project": "my-project",
|
|
381
381
|
"org": "my-org",
|
|
382
382
|
"language": "en",
|
|
383
|
-
"templateVersion": "v0.4.
|
|
383
|
+
"templateVersion": "v0.4.5",
|
|
384
384
|
"files": {
|
|
385
385
|
"managed": [
|
|
386
386
|
".agents/workspace/README.md",
|
package/README.zh-CN.md
CHANGED
package/lib/defaults.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# General Rules - Commit and PR
|
|
2
|
+
|
|
3
|
+
## Commit Message Format
|
|
4
|
+
|
|
5
|
+
- Use Conventional Commits: `<type>(<scope>): <subject>`
|
|
6
|
+
- Allowed `type` values: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`
|
|
7
|
+
- `scope`: module name (optional)
|
|
8
|
+
- Write the `subject` in concise imperative English
|
|
9
|
+
|
|
10
|
+
## No Automatic Commits
|
|
11
|
+
|
|
12
|
+
- Never run `git commit` or `git add` automatically
|
|
13
|
+
- Enter the commit workflow only when the user explicitly requests a commit
|
|
14
|
+
- After finishing code changes, remind the user to use the appropriate TUI commit command
|
|
15
|
+
|
|
16
|
+
## PR Rules
|
|
17
|
+
|
|
18
|
+
Before creating a PR, make sure:
|
|
19
|
+
- all tests pass
|
|
20
|
+
- code checks pass
|
|
21
|
+
- the build succeeds
|
|
22
|
+
- public API documentation is updated when applicable
|
|
23
|
+
- copyright header years are updated when applicable
|
|
24
|
+
|
|
25
|
+
## Copyright Year Updates
|
|
26
|
+
|
|
27
|
+
- Run `date +%Y` first and do not hardcode the year
|
|
28
|
+
- Update examples:
|
|
29
|
+
- `2024-2025` -> `2024-2026`
|
|
30
|
+
- `2024` -> `2024-2026`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 通用规则 - 提交与 PR
|
|
2
|
+
|
|
3
|
+
## 提交信息格式
|
|
4
|
+
|
|
5
|
+
- 使用 Conventional Commits:`<type>(<scope>): <subject>`
|
|
6
|
+
- `type` 仅限:`feat`、`fix`、`docs`、`refactor`、`test`、`chore`
|
|
7
|
+
- `scope`:模块名(可省略)
|
|
8
|
+
- `subject` 使用英文祈使语气,保持简洁
|
|
9
|
+
|
|
10
|
+
## 禁止自动提交
|
|
11
|
+
|
|
12
|
+
- 绝对不要自动执行 `git commit` 或 `git add`
|
|
13
|
+
- 仅在用户明确发起提交命令时才进入提交流程
|
|
14
|
+
- 完成代码修改后,提醒用户使用对应 TUI 的提交命令
|
|
15
|
+
|
|
16
|
+
## PR 提交规则
|
|
17
|
+
|
|
18
|
+
创建 PR 前必须确保:
|
|
19
|
+
- 所有测试通过
|
|
20
|
+
- 代码检查通过
|
|
21
|
+
- 构建成功
|
|
22
|
+
- 公共 API 已补充文档(如适用)
|
|
23
|
+
- 版权头年份已更新(如适用)
|
|
24
|
+
|
|
25
|
+
## 版权年份更新
|
|
26
|
+
|
|
27
|
+
- 先运行 `date +%Y` 获取当前年份,不要硬编码
|
|
28
|
+
- 更新格式示例:
|
|
29
|
+
- `2024-2025` -> `2024-2026`
|
|
30
|
+
- `2024` -> `2024-2026`
|
|
@@ -23,6 +23,15 @@ Use `while IFS= read -r label` so labels like `status: in-progress` are handled
|
|
|
23
23
|
|
|
24
24
|
If `gh` fails, skip and continue. Do not fail the skill.
|
|
25
25
|
|
|
26
|
+
## Assignee Sync
|
|
27
|
+
|
|
28
|
+
When a skill creates or imports an Issue, automatically add the current executor as assignee:
|
|
29
|
+
|
|
30
|
+
- `create-issue`: use `--assignee @me` in the `gh issue create` command
|
|
31
|
+
- `import-issue`: run `gh issue edit {issue-number} --add-assignee @me 2>/dev/null || true` after import
|
|
32
|
+
|
|
33
|
+
`@me` is resolved by `gh` CLI to the authenticated user. The operation is idempotent (adding an existing assignee is a no-op). If the command fails (e.g. insufficient permissions), skip and continue.
|
|
34
|
+
|
|
26
35
|
## `in:` Label Sync
|
|
27
36
|
|
|
28
37
|
Read the `labels.in` mapping from `.agents/.airc.json`.
|
|
@@ -79,12 +88,16 @@ Use this format:
|
|
|
79
88
|
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
80
89
|
## {artifact-title}
|
|
81
90
|
|
|
91
|
+
> **{agent}** · {task-id}
|
|
92
|
+
|
|
82
93
|
{artifact body}
|
|
83
94
|
|
|
84
95
|
---
|
|
85
|
-
*Generated by
|
|
96
|
+
*Generated by {agent} · Internal tracking: {task-id}*
|
|
86
97
|
```
|
|
87
98
|
|
|
99
|
+
`{agent}` is the name of the AI agent currently executing the skill (for example `claude`, `codex`, or `gemini`).
|
|
100
|
+
|
|
88
101
|
`summary` comments need extra handling:
|
|
89
102
|
- find an existing `<!-- sync-issue:{task-id}:summary -->` comment ID first
|
|
90
103
|
- create the comment when none exists
|
|
@@ -124,6 +137,8 @@ task.md comment format:
|
|
|
124
137
|
<!-- sync-issue:{task-id}:task -->
|
|
125
138
|
## Task File
|
|
126
139
|
|
|
140
|
+
> **{agent}** · {task-id}
|
|
141
|
+
|
|
127
142
|
<details><summary>Metadata (frontmatter)</summary>
|
|
128
143
|
|
|
129
144
|
```yaml
|
|
@@ -137,7 +152,7 @@ task.md comment format:
|
|
|
137
152
|
{task.md body after frontmatter}
|
|
138
153
|
|
|
139
154
|
---
|
|
140
|
-
*Generated by
|
|
155
|
+
*Generated by {agent} · Internal tracking: {task-id}*
|
|
141
156
|
```
|
|
142
157
|
|
|
143
158
|
When restoring, extract the frontmatter from the `<details>` block and reassemble with the body to recover the original `task.md`.
|
|
@@ -150,6 +165,10 @@ Title mapping:
|
|
|
150
165
|
- Scan `task.md`, `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` in the task directory
|
|
151
166
|
- Check whether each `{file-stem}` was already published by its hidden marker; publish only missing artifacts
|
|
152
167
|
- Backfill only appends missing comments; never delete or reorder existing comments
|
|
168
|
+
- Resolve `{agent}` for backfilled comments in this order:
|
|
169
|
+
1. Match the artifact filename in Activity Log (for example `→ analysis.md`) and extract the executor from `by {agent}`
|
|
170
|
+
2. If no match is found, fall back to `assigned_to` in task.md frontmatter
|
|
171
|
+
3. If `assigned_to` is also unavailable, use the current backfilling agent
|
|
153
172
|
- Derive the previous and next neighbors from Activity Log order and add this note below the title:
|
|
154
173
|
|
|
155
174
|
```markdown
|
|
@@ -23,6 +23,15 @@ fi
|
|
|
23
23
|
|
|
24
24
|
如果 `gh` 命令失败,跳过并继续,不中断技能执行。
|
|
25
25
|
|
|
26
|
+
## Assignee 同步
|
|
27
|
+
|
|
28
|
+
当技能创建或导入 Issue 时,自动将当前执行者添加为 assignee:
|
|
29
|
+
|
|
30
|
+
- `create-issue`:在 `gh issue create` 命令中使用 `--assignee @me` 参数
|
|
31
|
+
- `import-issue`:导入后执行 `gh issue edit {issue-number} --add-assignee @me 2>/dev/null || true`
|
|
32
|
+
|
|
33
|
+
`@me` 由 `gh` CLI 自动解析为当前认证用户。此操作是幂等的(重复添加不会报错)。如果命令失败(如权限不足),跳过并继续。
|
|
34
|
+
|
|
26
35
|
## `in:` label 同步
|
|
27
36
|
|
|
28
37
|
读取 `.agents/.airc.json` 的 `labels.in` 映射。
|
|
@@ -79,12 +88,16 @@ gh api "repos/{owner}/{repo}/issues/{issue-number}/comments" \
|
|
|
79
88
|
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
80
89
|
## {artifact-title}
|
|
81
90
|
|
|
91
|
+
> **{agent}** · {task-id}
|
|
92
|
+
|
|
82
93
|
{artifact body}
|
|
83
94
|
|
|
84
95
|
---
|
|
85
|
-
*由
|
|
96
|
+
*由 {agent} 自动生成 · 内部追踪:{task-id}*
|
|
86
97
|
```
|
|
87
98
|
|
|
99
|
+
其中 `{agent}` 使用当前执行该技能的 AI 代理名称(如 `claude`、`codex`、`gemini`)。
|
|
100
|
+
|
|
88
101
|
`summary` 评论需要额外处理:
|
|
89
102
|
- 先查找已有 `<!-- sync-issue:{task-id}:summary -->` 评论的 ID
|
|
90
103
|
- 不存在则创建
|
|
@@ -124,6 +137,8 @@ task.md 评论格式:
|
|
|
124
137
|
<!-- sync-issue:{task-id}:task -->
|
|
125
138
|
## 任务文件
|
|
126
139
|
|
|
140
|
+
> **{agent}** · {task-id}
|
|
141
|
+
|
|
127
142
|
<details><summary>元数据 (frontmatter)</summary>
|
|
128
143
|
|
|
129
144
|
```yaml
|
|
@@ -137,7 +152,7 @@ task.md 评论格式:
|
|
|
137
152
|
{task.md body after frontmatter}
|
|
138
153
|
|
|
139
154
|
---
|
|
140
|
-
*由
|
|
155
|
+
*由 {agent} 自动生成 · 内部追踪:{task-id}*
|
|
141
156
|
```
|
|
142
157
|
|
|
143
158
|
还原时,从 `<details>` 块中提取 frontmatter,与正文拼合恢复为原始 `task.md`。
|
|
@@ -150,6 +165,10 @@ task.md 评论格式:
|
|
|
150
165
|
- 扫描任务目录中的 `task.md`、`analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md`
|
|
151
166
|
- 对每个 `{file-stem}` 用隐藏标记检查是否已发布;未发布则补发,已发布则跳过
|
|
152
167
|
- 补发只追加缺失评论,不删除或重排已有评论
|
|
168
|
+
- 补发评论的 `{agent}` 按以下顺序确定:
|
|
169
|
+
1. 从 Activity Log 中匹配对应产物文件名(如 `→ analysis.md`),提取 `by {agent}` 中的执行者
|
|
170
|
+
2. 若未匹配到,则回退到 task.md frontmatter 的 `assigned_to`
|
|
171
|
+
3. 若 `assigned_to` 也不可用,则使用当前执行补发的 agent
|
|
153
172
|
- 位置说明从 Activity Log 推导时间线中的前后邻居,并加在评论标题下方:
|
|
154
173
|
|
|
155
174
|
```markdown
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Milestone Inference Rules
|
|
2
|
+
|
|
3
|
+
Read this file before `create-issue`, `implement-task`, or `create-pr` handles a milestone.
|
|
4
|
+
|
|
5
|
+
## General Principles
|
|
6
|
+
|
|
7
|
+
- Narrow the milestone over the skill lifecycle: release line -> concrete version -> reuse
|
|
8
|
+
- Every phase must fall back safely instead of blocking the skill
|
|
9
|
+
- If `gh` is unavailable, unauthenticated, or the GitHub API call fails, skip milestone handling and continue
|
|
10
|
+
- Only use milestones that actually exist in the repository; if a target milestone is unavailable, apply the fallback for that phase
|
|
11
|
+
|
|
12
|
+
## Branch Mode Detection
|
|
13
|
+
|
|
14
|
+
Use the following command to detect whether the repository has remote release-line branches:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git branch -r | grep -v 'HEAD' | grep -E 'origin/[0-9]+\.[0-9]+\.x$'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Any output: multi-version branch mode
|
|
21
|
+
- No output: trunk mode
|
|
22
|
+
|
|
23
|
+
## Phase 1: `create-issue`
|
|
24
|
+
|
|
25
|
+
Goal: choose a coarse-grained release line when the Issue is created.
|
|
26
|
+
|
|
27
|
+
Priority:
|
|
28
|
+
1. If task.md provides a valid explicit `milestone`, use it
|
|
29
|
+
2. Otherwise infer a release line:
|
|
30
|
+
- Trunk mode: query open `X.Y.x` milestones and choose the lowest release line
|
|
31
|
+
- Multi-version branch mode: try open `X.Y.x` milestones and choose the lowest release line; if that is not reliable, fall back to `General Backlog`
|
|
32
|
+
3. If the inferred release line does not exist, fall back to `General Backlog`
|
|
33
|
+
4. If `General Backlog` also does not exist, omit `--milestone`
|
|
34
|
+
|
|
35
|
+
Suggested release-line query:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gh api "repos/{owner}/{repo}/milestones?state=open&per_page=100" \
|
|
39
|
+
--jq '.[].title'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Only match titles in `X.Y.x` format and choose the smallest major/minor pair numerically.
|
|
43
|
+
|
|
44
|
+
## Phase 2: `implement-task`
|
|
45
|
+
|
|
46
|
+
Goal: narrow the Issue milestone from a release line to a concrete version when implementation starts.
|
|
47
|
+
|
|
48
|
+
Preconditions:
|
|
49
|
+
- task.md contains a valid `issue_number`
|
|
50
|
+
- the current Issue milestone matches the release-line format `X.Y.x`
|
|
51
|
+
|
|
52
|
+
Sequence:
|
|
53
|
+
1. Query the current Issue milestone
|
|
54
|
+
2. If it is not in `X.Y.x` format, treat it as already specific enough and keep it unchanged
|
|
55
|
+
3. If it is in `X.Y.x` format, narrow it according to branch mode:
|
|
56
|
+
- Trunk mode: query open concrete-version milestones on that release line (for example `0.4.4`) and choose the latest one
|
|
57
|
+
- Multi-version branch mode:
|
|
58
|
+
- If the task branch was created from `origin/X.Y.x`, choose the latest concrete version on that line
|
|
59
|
+
- If the task branch was created from `main`, find the highest release line and choose the latest concrete version on that line
|
|
60
|
+
4. When a target concrete version is found, run:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
gh issue edit {issue-number} --milestone "{version}"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. If the target milestone does not exist or the branch ancestry cannot be determined reliably, keep the original milestone unchanged
|
|
67
|
+
|
|
68
|
+
Suggested concrete-version query:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
gh api "repos/{owner}/{repo}/milestones?state=open&per_page=100" \
|
|
72
|
+
--jq '.[].title'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Release-line match: `^X\.Y\.x$`
|
|
76
|
+
- Concrete-version match: `^X\.Y\.[0-9]+$`
|
|
77
|
+
- "Latest" means the largest patch number
|
|
78
|
+
|
|
79
|
+
Suggested branch-origin checks:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git merge-base --is-ancestor origin/{release-line} HEAD
|
|
83
|
+
git merge-base --is-ancestor origin/main HEAD
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If neither check is reliable or the remote refs are unavailable, keep the original milestone and avoid guessing.
|
|
87
|
+
|
|
88
|
+
## Phase 3: `create-pr`
|
|
89
|
+
|
|
90
|
+
Goal: reuse the linked Issue milestone on the PR instead of inferring a new one.
|
|
91
|
+
|
|
92
|
+
Sequence:
|
|
93
|
+
1. If `issue_number` exists, query the Issue milestone
|
|
94
|
+
2. If the Issue has a milestone, run:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gh pr edit {pr-number} --milestone "{milestone}"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. If the Issue has no milestone, skip PR milestone assignment
|
|
101
|
+
|
|
102
|
+
Do not infer a PR milestone separately from task.md, branch names, tags, or `General Backlog`.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Milestone 推断规则
|
|
2
|
+
|
|
3
|
+
在 `create-issue`、`implement-task` 或 `create-pr` 处理 milestone 之前先读取本文件。
|
|
4
|
+
|
|
5
|
+
## 通用原则
|
|
6
|
+
|
|
7
|
+
- milestone 在技能生命周期中逐步收窄:版本线 -> 具体版本 -> 复用
|
|
8
|
+
- 任一步骤推断失败时都必须回退,不得阻塞技能执行
|
|
9
|
+
- 如果 `gh` CLI 不可用、未认证,或 GitHub API 请求失败,跳过 milestone 处理并继续
|
|
10
|
+
- 只使用仓库中实际存在的 milestone;目标 milestone 不存在时按各阶段 fallback 处理
|
|
11
|
+
|
|
12
|
+
## 分支模式检测
|
|
13
|
+
|
|
14
|
+
使用以下命令检测仓库是否存在远程 release line 分支:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git branch -r | grep -v 'HEAD' | grep -E 'origin/[0-9]+\.[0-9]+\.x$'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- 有输出:多版本分支模式
|
|
21
|
+
- 无输出:主干模式
|
|
22
|
+
|
|
23
|
+
## 阶段 1:`create-issue`
|
|
24
|
+
|
|
25
|
+
目标:在创建 Issue 时先确定粗粒度版本线。
|
|
26
|
+
|
|
27
|
+
优先级:
|
|
28
|
+
1. `task.md` 显式存在 `milestone` 字段且值有效 -> 直接使用
|
|
29
|
+
2. 否则推断版本线:
|
|
30
|
+
- 主干模式:查询 open 的 `X.Y.x` 里程碑,取最低版本线
|
|
31
|
+
- 多版本分支模式:优先查询 open 的 `X.Y.x` 里程碑,取最低版本线;如果无法确定则回退到 `General Backlog`
|
|
32
|
+
3. 推断出的版本线不存在 -> 回退到 `General Backlog`
|
|
33
|
+
4. `General Backlog` 也不存在 -> 省略 `--milestone`
|
|
34
|
+
|
|
35
|
+
版本线查询建议:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gh api "repos/{owner}/{repo}/milestones?state=open&per_page=100" \
|
|
39
|
+
--jq '.[].title'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
只匹配 `X.Y.x` 格式的标题;按 major、minor 数值升序取最小版本线。
|
|
43
|
+
|
|
44
|
+
## 阶段 2:`implement-task`
|
|
45
|
+
|
|
46
|
+
目标:开始开发时,把 Issue milestone 从版本线收窄到具体版本。
|
|
47
|
+
|
|
48
|
+
前置条件:
|
|
49
|
+
- `task.md` 存在有效 `issue_number`
|
|
50
|
+
- 当前 Issue milestone 为版本线格式 `X.Y.x`
|
|
51
|
+
|
|
52
|
+
执行顺序:
|
|
53
|
+
1. 查询 Issue 当前 milestone
|
|
54
|
+
2. 如果 milestone 不是 `X.Y.x` 格式 -> 视为已足够具体,保持不变
|
|
55
|
+
3. 如果 milestone 是 `X.Y.x` -> 按分支模式收窄:
|
|
56
|
+
- 主干模式:查询该版本线下 open 的具体版本 milestone(如 `0.4.4`),取最新版本
|
|
57
|
+
- 多版本分支模式:
|
|
58
|
+
- 当前任务分支来自 `origin/X.Y.x` release line -> 在该版本线下取最新具体版本
|
|
59
|
+
- 当前任务分支来自 `main` -> 找最高版本线,再取该版本线下的最新具体版本
|
|
60
|
+
4. 找到目标具体版本后,执行:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
gh issue edit {issue-number} --milestone "{version}"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. 如果目标 milestone 不存在或无法可靠判断 -> 保持原 milestone 不变
|
|
67
|
+
|
|
68
|
+
具体版本查询建议:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
gh api "repos/{owner}/{repo}/milestones?state=open&per_page=100" \
|
|
72
|
+
--jq '.[].title'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- 版本线匹配:`^X\.Y\.x$`
|
|
76
|
+
- 具体版本匹配:`^X\.Y\.[0-9]+$`
|
|
77
|
+
- “最新”按 patch 数值最大确定
|
|
78
|
+
|
|
79
|
+
分支来源判断建议:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git merge-base --is-ancestor origin/{release-line} HEAD
|
|
83
|
+
git merge-base --is-ancestor origin/main HEAD
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
如果两个判断都不可靠或远程引用缺失,保持原 milestone,不做错误推断。
|
|
87
|
+
|
|
88
|
+
## 阶段 3:`create-pr`
|
|
89
|
+
|
|
90
|
+
目标:PR 直接复用关联 Issue 的 milestone,不再独立推断。
|
|
91
|
+
|
|
92
|
+
执行顺序:
|
|
93
|
+
1. 如果存在 `issue_number`,查询 Issue milestone
|
|
94
|
+
2. Issue 有 milestone -> 执行:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gh pr edit {pr-number} --milestone "{milestone}"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Issue 没有 milestone -> 跳过,不设置 PR milestone
|
|
101
|
+
|
|
102
|
+
不要再使用 `task.md`、分支名、tag 或 `General Backlog` 为 PR 单独推断 milestone。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# General Rules - Task Management
|
|
2
|
+
|
|
3
|
+
## Task Intent Detection
|
|
4
|
+
|
|
5
|
+
Map user intent to the corresponding workflow command:
|
|
6
|
+
- "analyze issue #123" -> `import-issue`
|
|
7
|
+
- "analyze task TASK-20260306-143022" -> `analyze-task`
|
|
8
|
+
- "design a plan" -> `plan-task`
|
|
9
|
+
- "implement" or "build" -> `implement-task`
|
|
10
|
+
- "review" -> `review-task`
|
|
11
|
+
- "fix review feedback" -> `refine-task`
|
|
12
|
+
|
|
13
|
+
## Task State Management
|
|
14
|
+
|
|
15
|
+
- Update the corresponding `task.md` immediately after every workflow command
|
|
16
|
+
- At minimum, synchronize `current_step`, `updated_at`, `assigned_to`, and the current-round artifact reference
|
|
17
|
+
- Activity Log entries are append-only and must never overwrite history
|
|
18
|
+
|
|
19
|
+
## Required State Updates by Command
|
|
20
|
+
|
|
21
|
+
- `import-issue`: update `current_step`, `updated_at`, `assigned_to`
|
|
22
|
+
- `analyze-task`: update `current_step`, `updated_at`, `assigned_to`
|
|
23
|
+
- `plan-task`: update `current_step`, `updated_at`
|
|
24
|
+
- `implement-task`: update `current_step`, `updated_at`
|
|
25
|
+
- `review-task`: update `current_step`, `updated_at`
|
|
26
|
+
- `refine-task`: update `current_step`, `updated_at`
|
|
27
|
+
- `complete-task`: update `status`, `completed_at`, `updated_at`
|
|
28
|
+
- `block-task`: update `status`, `blocked_at`, `blocked_reason`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# 通用规则 - 任务管理
|
|
2
|
+
|
|
3
|
+
## 任务语义识别
|
|
4
|
+
|
|
5
|
+
根据用户意图自动映射到对应工作流命令:
|
|
6
|
+
- “分析 issue #123” -> `import-issue`
|
|
7
|
+
- “分析任务 TASK-20260306-143022” -> `analyze-task`
|
|
8
|
+
- “设计方案” -> `plan-task`
|
|
9
|
+
- “实施/实现” -> `implement-task`
|
|
10
|
+
- “审查” -> `review-task`
|
|
11
|
+
- “修复审查问题” -> `refine-task`
|
|
12
|
+
|
|
13
|
+
## 任务状态管理
|
|
14
|
+
|
|
15
|
+
- 每次执行工作流命令后,必须立即更新对应任务的 `task.md`
|
|
16
|
+
- 至少同步 `current_step`、`updated_at`、`assigned_to`,以及本轮产物引用
|
|
17
|
+
- Activity Log 只能追加,不能覆盖历史记录
|
|
18
|
+
|
|
19
|
+
## 常见命令的状态更新要求
|
|
20
|
+
|
|
21
|
+
- `import-issue`:更新 `current_step`、`updated_at`、`assigned_to`
|
|
22
|
+
- `analyze-task`:更新 `current_step`、`updated_at`、`assigned_to`
|
|
23
|
+
- `plan-task`:更新 `current_step`、`updated_at`
|
|
24
|
+
- `implement-task`:更新 `current_step`、`updated_at`
|
|
25
|
+
- `review-task`:更新 `current_step`、`updated_at`
|
|
26
|
+
- `refine-task`:更新 `current_step`、`updated_at`
|
|
27
|
+
- `complete-task`:更新 `status`、`completed_at`、`updated_at`
|
|
28
|
+
- `block-task`:更新 `status`、`blocked_at`、`blocked_reason`
|