@fitlab-ai/agent-infra 0.5.7 → 0.5.8

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.
Files changed (116) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/lib/defaults.json +4 -2
  4. package/lib/init.js +18 -1
  5. package/lib/sandbox/engine.js +19 -0
  6. package/lib/sandbox/shell.js +36 -2
  7. package/lib/update.js +14 -3
  8. package/package.json +4 -4
  9. package/templates/.agents/QUICKSTART.en.md +2 -2
  10. package/templates/.agents/QUICKSTART.zh-CN.md +2 -2
  11. package/templates/.agents/README.en.md +1 -1
  12. package/templates/.agents/README.zh-CN.md +1 -1
  13. package/templates/.agents/rules/issue-pr-commands.github.en.md +60 -0
  14. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +60 -0
  15. package/templates/.agents/rules/issue-sync.en.md +14 -0
  16. package/templates/.agents/rules/issue-sync.github.en.md +14 -0
  17. package/templates/.agents/rules/issue-sync.github.zh-CN.md +14 -0
  18. package/templates/.agents/rules/issue-sync.zh-CN.md +14 -0
  19. package/templates/.agents/rules/label-milestone-setup.github.en.md +10 -0
  20. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +10 -0
  21. package/templates/.agents/rules/release-commands.github.en.md +16 -0
  22. package/templates/.agents/rules/release-commands.github.zh-CN.md +16 -0
  23. package/templates/.agents/scripts/platform-adapters/find-existing-task.github.js +272 -0
  24. package/templates/.agents/scripts/platform-adapters/find-existing-task.js +5 -0
  25. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +88 -8
  26. package/templates/.agents/scripts/platform-adapters/platform-sync.js +7 -0
  27. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  28. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  29. package/templates/.agents/skills/analyze-task/config/verify.json +3 -1
  30. package/templates/.agents/skills/block-task/config/verify.json +2 -1
  31. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  32. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  33. package/templates/.agents/skills/cancel-task/config/verify.json +2 -1
  34. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  35. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  36. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  37. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  38. package/templates/.agents/skills/commit/config/verify.json +2 -1
  39. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  40. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  41. package/templates/.agents/skills/complete-task/config/verify.json +2 -1
  42. package/templates/.agents/skills/create-issue/SKILL.en.md +8 -8
  43. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +8 -8
  44. package/templates/.agents/skills/create-issue/config/verify.json +2 -1
  45. package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +3 -3
  46. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +3 -3
  47. package/templates/.agents/skills/create-issue/reference/template-matching.en.md +6 -34
  48. package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +8 -36
  49. package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
  50. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
  51. package/templates/.agents/skills/create-pr/config/verify.json +2 -1
  52. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +7 -17
  53. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +27 -37
  54. package/templates/.agents/skills/create-release-note/SKILL.en.md +9 -9
  55. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +9 -9
  56. package/templates/.agents/skills/create-task/SKILL.en.md +3 -3
  57. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +3 -3
  58. package/templates/.agents/skills/implement-task/SKILL.en.md +1 -1
  59. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +1 -1
  60. package/templates/.agents/skills/implement-task/config/verify.json +3 -1
  61. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  62. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  63. package/templates/.agents/skills/import-issue/SKILL.en.md +39 -9
  64. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +39 -9
  65. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -9
  66. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -9
  67. package/templates/.agents/skills/init-milestones/SKILL.en.md +7 -7
  68. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +7 -7
  69. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  70. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -1
  71. package/templates/.agents/skills/plan-task/config/verify.json +3 -1
  72. package/templates/.agents/skills/refine-task/SKILL.en.md +1 -1
  73. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +1 -1
  74. package/templates/.agents/skills/refine-task/config/verify.json +3 -1
  75. package/templates/.agents/skills/restore-task/SKILL.en.md +13 -64
  76. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +13 -64
  77. package/templates/.agents/skills/review-task/SKILL.en.md +1 -1
  78. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +1 -1
  79. package/templates/.agents/skills/review-task/config/verify.json +3 -1
  80. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -0
  81. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -0
  82. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +56 -5
  83. package/templates/.claude/commands/create-issue.en.md +1 -1
  84. package/templates/.claude/commands/create-issue.zh-CN.md +1 -1
  85. package/templates/.claude/commands/import-issue.en.md +1 -1
  86. package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
  87. package/templates/.claude/commands/init-labels.en.md +1 -1
  88. package/templates/.claude/commands/init-labels.zh-CN.md +1 -1
  89. package/templates/.claude/commands/init-milestones.en.md +1 -1
  90. package/templates/.claude/commands/init-milestones.zh-CN.md +1 -1
  91. package/templates/.claude/commands/restore-task.en.md +1 -1
  92. package/templates/.claude/commands/restore-task.zh-CN.md +1 -1
  93. package/templates/.claude/hooks/check-version-format.sh +1 -1
  94. package/templates/.gemini/commands/_project_/create-issue.en.toml +1 -1
  95. package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +1 -1
  96. package/templates/.gemini/commands/_project_/import-issue.en.toml +1 -1
  97. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
  98. package/templates/.gemini/commands/_project_/init-labels.en.toml +2 -2
  99. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +2 -2
  100. package/templates/.gemini/commands/_project_/init-milestones.en.toml +2 -2
  101. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +2 -2
  102. package/templates/.gemini/commands/_project_/restore-task.en.toml +1 -1
  103. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +1 -1
  104. package/templates/{.github/hooks → .git-hooks}/check-version-format.sh +2 -2
  105. package/templates/.github/workflows/pr-label.yml +1 -1
  106. package/templates/.opencode/commands/create-issue.en.md +1 -1
  107. package/templates/.opencode/commands/create-issue.zh-CN.md +1 -1
  108. package/templates/.opencode/commands/import-issue.en.md +1 -1
  109. package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
  110. package/templates/.opencode/commands/init-labels.en.md +1 -1
  111. package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
  112. package/templates/.opencode/commands/init-milestones.en.md +1 -1
  113. package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
  114. package/templates/.opencode/commands/restore-task.en.md +1 -1
  115. package/templates/.opencode/commands/restore-task.zh-CN.md +1 -1
  116. /package/templates/{.github/hooks → .git-hooks}/pre-commit +0 -0
@@ -137,7 +137,7 @@ Next step - run requirements analysis:
137
137
  - Gemini CLI: /{{project}}:analyze-task {task-id}
138
138
  - Codex CLI: $analyze-task {task-id}
139
139
 
140
- Or create a GitHub Issue first:
140
+ Or create an Issue first:
141
141
  - Claude Code / OpenCode: /create-issue {task-id}
142
142
  - Gemini CLI: /{{project}}:create-issue {task-id}
143
143
  - Codex CLI: $create-issue {task-id}
@@ -161,8 +161,8 @@ Wait for the user to run the `analyze-task` skill.
161
161
  ## Notes
162
162
 
163
163
  1. **Clarity**: if the user description is vague or missing key information, ask for clarification first
164
- 2. **Difference from `import-issue`**: `import-issue` imports from a GitHub Issue; `create-task` creates from a free-form description
165
- 3. **Workflow order**: after creating a task, typically run `analyze-task` before `plan-task`; if you need GitHub tracking first, you may run `create-issue` first
164
+ 2. **Difference from `import-issue`**: `import-issue` imports from an Issue; `create-task` creates from a free-form description
165
+ 3. **Workflow order**: after creating a task, typically run `analyze-task` before `plan-task`; if you need platform tracking first, you may run `create-issue` first
166
166
 
167
167
  ## Error Handling
168
168
 
@@ -137,7 +137,7 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
137
137
  - Gemini CLI:/agent-infra:analyze-task {task-id}
138
138
  - Codex CLI:$analyze-task {task-id}
139
139
 
140
- 或先创建 GitHub Issue:
140
+ 或先创建 Issue:
141
141
  - Claude Code / OpenCode:/create-issue {task-id}
142
142
  - Gemini CLI:/agent-infra:create-issue {task-id}
143
143
  - Codex CLI:$create-issue {task-id}
@@ -161,8 +161,8 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
161
161
  ## 注意事项
162
162
 
163
163
  1. **清晰度**:如果用户描述模糊或缺少关键信息,先要求澄清
164
- 2. **与 import-issue 的区别**:`import-issue` 从 GitHub Issue 导入任务;`create-task` 从自由描述创建
165
- 3. **工作流顺序**:创建任务后,通常先执行 `analyze-task` 再进入 `plan-task`;如需先建立 GitHub 跟踪,也可先执行 `create-issue`
164
+ 2. **与 import-issue 的区别**:`import-issue` 从 Issue 导入任务;`create-task` 从自由描述创建
165
+ 3. **工作流顺序**:创建任务后,通常先执行 `analyze-task` 再进入 `plan-task`;如需先建立 平台跟踪,也可先执行 `create-issue`
166
166
 
167
167
  ## 错误处理
168
168
 
@@ -95,7 +95,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
95
95
 
96
96
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure; read `.agents/rules/issue-sync.md` first and complete upstream repository detection plus permission detection):
97
97
  - Set `status: in-progress` by following issue-sync.md
98
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
98
+ - Create or update the task comment marker defined in `.agents/rules/issue-sync.md` (follow the task.md comment sync rule in issue-sync.md)
99
99
  - Publish the `{implementation-artifact}` comment
100
100
 
101
101
  ### 10. Verification Gate
@@ -95,7 +95,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
95
95
 
96
96
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测):
97
97
  - 按 issue-sync.md 设置 `status: in-progress`
98
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
98
+ - 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
99
99
  - 发布 `{implementation-artifact}` 评论
100
100
 
101
101
  ### 10. 完成校验
@@ -36,7 +36,9 @@
36
36
  "verify_comment_content": true,
37
37
  "verify_task_comment_content": true,
38
38
  "verify_issue_type": true,
39
- "verify_milestone": true
39
+ "verify_milestone": true,
40
+ "expected_status_label_key": "inProgress",
41
+ "expected_comment_marker_key": "artifact"
40
42
  }
41
43
  }
42
44
  }
@@ -25,7 +25,7 @@ Extract key information:
25
25
  - `rule`: rule information (`id`, `severity`, `description`, `security_severity_level`)
26
26
  - `tool`: scanning tool information (`name`, `version`)
27
27
  - `most_recent_instance`: location (`path`, `start_line`, `end_line`) and message
28
- - `html_url`: GitHub alert link
28
+ - `html_url`: alert link in the platform
29
29
 
30
30
  ### 2. Create the Task Directory and File
31
31
 
@@ -25,7 +25,7 @@ description: "导入 Code Scanning 告警并创建修复任务"
25
25
  - `rule`:规则信息(id、severity、description、security_severity_level)
26
26
  - `tool`:扫描工具信息(name、version)
27
27
  - `most_recent_instance`:位置(path、start_line、end_line)、消息
28
- - `html_url`:GitHub 告警链接
28
+ - `html_url`:平台告警链接
29
29
 
30
30
  ### 2. 创建任务目录和文件
31
31
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "Import a GitHub Issue and create a task"
3
+ description: "Import an Issue and create a task"
4
4
  ---
5
5
 
6
6
  # Import Issue
7
7
 
8
- Import the specified GitHub Issue and create a task. Argument: issue number.
8
+ Import the specified Issue and create a task. Argument: issue number.
9
9
 
10
10
  ## Boundary / Critical Rules
11
11
 
@@ -24,22 +24,46 @@ Use the Issue title as-is for the task title (preserve the Issue's original lang
24
24
 
25
25
  ### 2. Check for an Existing Task
26
26
 
27
- Search `.agents/workspace/active/` for an existing task linked to this Issue.
27
+ 2.1 Search `.agents/workspace/active/` for an existing task linked to this Issue.
28
28
  - If found, ask the user whether to re-import or continue with the existing task
29
- - If not found, create a new task
29
+ - If not found, continue to 2.2
30
+
31
+ 2.2 Scan Issue comments for sync markers and look for a recoverable historical task ID:
32
+
33
+ If `$upstream_repo` was not set in step 1, omit `--repo`; the script will infer it using the issue-sync.md detection rule.
34
+
35
+ ```bash
36
+ node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
37
+ ```
38
+
39
+ - Script outputs `found=false`: create a new task through the normal import flow
40
+ - Script outputs `found=true`: reuse `task_id`
41
+ - Script exits 2: treat it as network, authentication, or platform API degradation; show the failure reason from script stderr to the user, then continue with the new-task import flow without blocking
30
42
 
31
43
  ### 3. Create the Task Directory and File
32
44
 
45
+ 3.1 Decide the task ID and `created_at`.
46
+
47
+ | Scenario | Trigger | task ID source | created_at source | User confirmation |
48
+ |---|---|---|---|---|
49
+ | Scenario A | 2.1 finds a local task | Reuse local ID | Preserve local value | Must ask whether to re-import or continue using the existing task |
50
+ | Scenario B | 2.1 no match + 2.2 no candidate | Create with `date +%Y%m%d-%H%M%S` | Current time | Not required |
51
+ | Scenario C | 2.1 no match + 2.2 any candidate | Automatically reuse the earliest candidate ID | Prefer remote frontmatter `created_at`; use current time if missing | Inform only |
52
+
33
53
  ```bash
34
54
  date +%Y%m%d-%H%M%S
35
55
  ```
36
56
 
37
- - Create the directory: `.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
57
+ 3.2 Write the task directory and `task.md`.
58
+
59
+ - Create the directory: `.agents/workspace/active/{task-id}/`
38
60
  - Use the `.agents/templates/task.md` template to create `task.md`
61
+ - For Scenario C, prefer `type`, `workflow`, `branch`, `created_by`, and `milestone` from the remote frontmatter; infer missing or damaged fields from Issue labels and current rules
62
+ - Always write `current_step` as `requirement-analysis`; do not restore the remote original `current_step`
39
63
 
40
64
  Task metadata:
41
65
  ```yaml
42
- id: TASK-{yyyyMMdd-HHmmss}
66
+ id: {task-id}
43
67
  issue_number: <issue-number>
44
68
  type: feature|bugfix|refactor|docs|chore
45
69
  branch: <project>-<type>-<slug>
@@ -52,6 +76,11 @@ current_step: requirement-analysis
52
76
  assigned_to: {current AI agent}
53
77
  ```
54
78
 
79
+ 3.3 Append Activity Log entries.
80
+
81
+ - Scenario B: append `Import Issue`
82
+ - Scenario C: append `Import Issue (Recovered)` and include the recovered task ID, any recoverable original `current_step`, original `assigned_to`, and that `current_step` was reset to `requirement-analysis`; if some frontmatter fields are missing or damaged, mention the fallback in the same entry
83
+
55
84
  ### 4. Update Task Status
56
85
 
57
86
  Get the current time:
@@ -69,6 +98,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
69
98
  ```
70
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Import Issue** by {agent} — Issue #{number} imported
71
100
  ```
101
+ If step 3.3 already appended recovery Activity Log entries, do not append a duplicate equivalent entry.
72
102
 
73
103
  ### 5. Assign the Issue Assignee
74
104
 
@@ -79,7 +109,7 @@ If task.md contains a valid `issue_number`, use the Issue update command from `.
79
109
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
80
110
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
81
111
  - Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "Stage 1: `create-issue`". If `has_triage=false` or the inference is uncertain, skip and continue
82
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
112
+ - After every scenario, task comment sync is mandatory: create or update the task comment marker defined in `.agents/rules/issue-sync.md` so the remote `:task` comment exists and matches the local `task.md` content (follow the task.md comment sync rule in issue-sync.md)
83
113
 
84
114
  ### 7. Verification Gate
85
115
 
@@ -126,7 +156,7 @@ Next step - run requirements analysis:
126
156
  - [ ] Updated `current_step` to requirement-analysis
127
157
  - [ ] Updated `updated_at` to the current time
128
158
  - [ ] Appended an Activity Log entry to task.md
129
- - [ ] Synced the task comment to the Issue
159
+ - [ ] Synced the task comment to the Issue, with remote content matching local task.md
130
160
  - [ ] Informed the user of the next step (must include all TUI command formats, including any custom TUIs; do not filter)
131
161
  - [ ] **Did not modify any business code**
132
162
 
@@ -143,5 +173,5 @@ After completing the checklist, **stop immediately**. Do not continue to later s
143
173
  ## Error Handling
144
174
 
145
175
  - Issue not found: output "Issue #{number} not found, please check the issue number"
146
- - Network error: output "Cannot connect to GitHub, please check network"
176
+ - Network error: output "Cannot connect to the platform, please check network"
147
177
  - Permission error: output "No access to this repository"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "从 GitHub Issue 导入并创建任务"
3
+ description: "从 Issue 导入并创建任务"
4
4
  ---
5
5
 
6
6
  # 导入 Issue
7
7
 
8
- 导入指定的 GitHub Issue 并创建任务。参数:issue 编号。
8
+ 导入指定的 Issue 并创建任务。参数:issue 编号。
9
9
 
10
10
  ## 行为边界 / 关键规则
11
11
 
@@ -24,22 +24,46 @@ description: "从 GitHub Issue 导入并创建任务"
24
24
 
25
25
  ### 2. 检查已有任务
26
26
 
27
- 搜索 `.agents/workspace/active/` 中是否已有链接到此 Issue 的任务。
27
+ 2.1 搜索 `.agents/workspace/active/` 中是否已有链接到此 Issue 的任务。
28
28
  - 如果找到,询问用户是重新导入还是继续使用现有任务
29
- - 如果未找到,创建新任务
29
+ - 如果未找到,继续执行 2.2
30
+
31
+ 2.2 扫描 Issue 评论中的同步标记,查找可恢复的历史任务 ID:
32
+
33
+ 如未在步骤 1 中已设置 `$upstream_repo`,可省略 `--repo`,脚本会自动按 issue-sync.md 的检测规则推断。
34
+
35
+ ```bash
36
+ node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
37
+ ```
38
+
39
+ - 脚本输出 `found=false`:按新 Issue 导入流程创建新任务
40
+ - 脚本输出 `found=true`:复用 `task_id`
41
+ - 脚本退出码 2:视为网络、认证或 platform API 降级,向用户展示脚本 stderr 中的失败原因后,按新 Issue 导入流程继续,不阻塞导入
30
42
 
31
43
  ### 3. 创建任务目录和文件
32
44
 
45
+ 3.1 决定 task ID 和 `created_at`。
46
+
47
+ | 场景 | 触发条件 | task ID 来源 | created_at 来源 | 用户确认 |
48
+ |---|---|---|---|---|
49
+ | 场景 A | 2.1 命中本地任务 | 复用本地 ID | 本地保留 | 必须询问"重新导入还是继续使用现有任务" |
50
+ | 场景 B | 2.1 无命中 + 2.2 无候选 | `date +%Y%m%d-%H%M%S` 新建 | 当前时间 | 不需要 |
51
+ | 场景 C | 2.1 无命中 + 2.2 有候选 | 自动复用最早候选 ID | 优先用远端 frontmatter 的 `created_at`,缺失时用当前时间 | 告知即可 |
52
+
33
53
  ```bash
34
54
  date +%Y%m%d-%H%M%S
35
55
  ```
36
56
 
37
- - 创建目录:`.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
57
+ 3.2 写入任务目录和 `task.md`。
58
+
59
+ - 创建目录:`.agents/workspace/active/{task-id}/`
38
60
  - 使用 `.agents/templates/task.md` 模板创建 `task.md`
61
+ - 场景 C 优先沿用远端 frontmatter 中的 `type`、`workflow`、`branch`、`created_by`、`milestone`;缺失或损坏字段按 Issue 标签和当前规则重新推断
62
+ - `current_step` 始终写入 `requirement-analysis`,不要恢复为远端原 `current_step`
39
63
 
40
64
  任务元数据:
41
65
  ```yaml
42
- id: TASK-{yyyyMMdd-HHmmss}
66
+ id: {task-id}
43
67
  issue_number: <issue-number>
44
68
  type: feature|bugfix|refactor|docs|chore
45
69
  branch: <project>-<type>-<slug>
@@ -52,6 +76,11 @@ current_step: requirement-analysis
52
76
  assigned_to: {当前 AI 代理}
53
77
  ```
54
78
 
79
+ 3.3 追加 Activity Log。
80
+
81
+ - 场景 B:追加 `Import Issue`
82
+ - 场景 C:追加 `Import Issue (Recovered)`,注明恢复的 task ID、可恢复的原 `current_step`、原 `assigned_to`,并说明 `current_step` 已重置为 `requirement-analysis`;如果部分 frontmatter 字段缺失或损坏,在同一条记录中注明 fallback
83
+
55
84
  ### 4. 更新任务状态
56
85
 
57
86
  获取当前时间:
@@ -69,6 +98,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
69
98
  ```
70
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Import Issue** by {agent} — Issue #{number} imported
71
100
  ```
101
+ 如果步骤 3.3 已经按恢复场景追加了 Activity Log,不要重复追加同义记录。
72
102
 
73
103
  ### 5. 分配 Issue Assignee
74
104
 
@@ -79,7 +109,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
79
109
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
80
110
  - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
81
111
  - 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-issue`」规则推断并设置 milestone;如果 `has_triage=false` 或推断不确定,跳过并继续
82
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
112
+ - 所有场景结束后,必须执行一次 task 留言同步,创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记,确保远端 `:task` 评论存在且内容与本地 `task.md` 一致(按 issue-sync.md 的 task.md 评论同步规则)
83
113
 
84
114
  ### 7. 完成校验
85
115
 
@@ -126,7 +156,7 @@ Issue #{number} 已导入。
126
156
  - [ ] 更新了 `current_step` 为 requirement-analysis
127
157
  - [ ] 更新了 `updated_at` 为当前时间
128
158
  - [ ] 追加了 Activity Log 条目到 task.md
129
- - [ ] 同步了 task 评论到 Issue
159
+ - [ ] 同步了 task 评论到 Issue,且远端内容与本地 task.md 一致
130
160
  - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,含自定义 TUI,不要筛选)
131
161
  - [ ] **没有修改任何业务代码**
132
162
 
@@ -143,5 +173,5 @@ Issue #{number} 已导入。
143
173
  ## 错误处理
144
174
 
145
175
  - Issue 未找到:提示 "Issue #{number} not found, please check the issue number"
146
- - 网络错误:提示 "Cannot connect to GitHub, please check network"
176
+ - 网络错误:提示 "Cannot connect to the platform, please check network"
147
177
  - 权限错误:提示 "No access to this repository"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "Initialize the repository's standard GitHub Labels taxonomy"
3
+ description: "Initialize the repository's standard labels taxonomy"
4
4
  ---
5
5
 
6
- # Initialize GitHub Labels
6
+ # Initialize labels
7
7
 
8
- Initialize the repository's standard GitHub Labels taxonomy.
8
+ Initialize the repository's standard labels taxonomy.
9
9
 
10
10
  ## Execution Flow
11
11
 
@@ -36,14 +36,14 @@ The script and `.agents/rules/label-milestone-setup.md` are responsible for:
36
36
  The script manages these common label families:
37
37
  - `type:` labels such as `type: bug`, `type: enhancement`, `type: feature`, `type: documentation`, `type: dependency-upgrade`, and `type: task`
38
38
  - `status:` labels such as `status: waiting-for-triage`, `status: in-progress`, and `status: waiting-for-internal-feedback`
39
- - GitHub-default-name labels intentionally overwritten in place: `good first issue` and `help wanted`
39
+ - platform-default-name labels intentionally overwritten in place: `good first issue` and `help wanted`
40
40
  - Additional shared labels such as `dependencies`
41
41
 
42
42
  #### Scope
43
43
 
44
44
  | Label prefix | Issue | PR | Notes |
45
45
  |---|---|---|---|
46
- | `type:` | — | Yes | Issues use the native GitHub Type field; PRs need `type:` labels to drive changelog grouping |
46
+ | `type:` | — | Yes | Issues use the native platform Type field; PRs need `type:` labels to drive changelog grouping |
47
47
  | `status:` | Yes | — | PRs already have their own state flow (Open/Draft/Merged/Closed); Issues use `status:` labels for project tracking |
48
48
  | `in:` | Yes | Yes | Both Issues and PRs need module-based filtering |
49
49
 
@@ -98,8 +98,8 @@ Next step - initialize milestones (optional):
98
98
 
99
99
  ## Error Handling
100
100
 
101
- - `gh` not found: prompt "GitHub CLI (`gh`) is not installed"
102
- - Authentication failed: prompt "GitHub CLI is not authenticated"
103
- - Repository access failed: prompt "Unable to access the current repository with gh"
101
+ - platform CLI not found: prompt "the platform CLI is not installed"
102
+ - Authentication failed: prompt "the platform CLI is not authenticated"
103
+ - Repository access failed: prompt "Unable to access the current repository with the platform CLI"
104
104
  - Permission error: prompt "No permission to manage labels in this repository"
105
- - API rate limit: prompt "GitHub API rate limit reached, please retry later"
105
+ - API rate limit: prompt "platform API rate limit reached, please retry later"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "初始化仓库的 GitHub Labels 体系"
3
+ description: "初始化仓库的 labels 体系"
4
4
  ---
5
5
 
6
- # 初始化 GitHub Labels
6
+ # 初始化 labels
7
7
 
8
- 一次性初始化仓库的标准 GitHub Labels 体系。
8
+ 一次性初始化仓库的标准 labels 体系。
9
9
 
10
10
  ## 执行流程
11
11
 
@@ -36,14 +36,14 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
36
36
  脚本管理以下通用 label 族:
37
37
  - `type:` labels,例如 `type: bug`、`type: enhancement`、`type: feature`、`type: documentation`、`type: dependency-upgrade`、`type: task`
38
38
  - `status:` labels,例如 `status: waiting-for-triage`、`status: in-progress`、`status: waiting-for-internal-feedback`
39
- - 明确覆盖的 GitHub 默认同名 labels:`good first issue` 和 `help wanted`
39
+ - 明确覆盖的 平台默认同名 labels:`good first issue` 和 `help wanted`
40
40
  - 额外通用 labels,例如 `dependencies`
41
41
 
42
42
  #### 适用范围
43
43
 
44
44
  | Label 前缀 | Issue | PR | 说明 |
45
45
  |---|---|---|---|
46
- | `type:` | — | Yes | Issue 使用 GitHub 原生 Type 字段;PR 无原生类型字段,需 `type:` label 驱动 changelog |
46
+ | `type:` | — | Yes | Issue 使用 平台原生 Type 字段;PR 无原生类型字段,需 `type:` label 驱动 changelog |
47
47
  | `status:` | Yes | — | PR 有自身状态流转(Open/Draft/Merged/Closed);Issue 使用 `status:` label 标记项目管理状态 |
48
48
  | `in:` | Yes | Yes | Issue 和 PR 均需按模块筛选 |
49
49
 
@@ -98,8 +98,8 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
98
98
 
99
99
  ## 错误处理
100
100
 
101
- - 未找到 `gh`:提示 "GitHub CLI (`gh`) is not installed"
102
- - 认证失败:提示 "GitHub CLI is not authenticated"
103
- - 仓库访问失败:提示 "Unable to access the current repository with gh"
101
+ - 未找到平台 CLI:提示 "the platform CLI is not installed"
102
+ - 认证失败:提示 "the platform CLI is not authenticated"
103
+ - 仓库访问失败:提示 "Unable to access the current repository with the platform CLI"
104
104
  - 权限不足:提示 "No permission to manage labels in this repository"
105
- - API 限流:提示 "GitHub API rate limit reached, please retry later"
105
+ - API 限流:提示 "platform API rate limit reached, please retry later"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "Initialize the repository's standard GitHub Milestones taxonomy"
3
+ description: "Initialize the repository's standard milestones taxonomy"
4
4
  ---
5
5
 
6
- # Initialize GitHub Milestones
6
+ # Initialize milestones
7
7
 
8
- Initialize the repository's standard GitHub Milestones taxonomy.
8
+ Initialize the repository's standard milestones taxonomy.
9
9
 
10
10
  ## Execution Flow
11
11
 
@@ -75,10 +75,10 @@ Next step - initialize labels (optional):
75
75
 
76
76
  ## Error Handling
77
77
 
78
- - `gh` not found: prompt "GitHub CLI (`gh`) is not installed"
79
- - Authentication failed: prompt "GitHub CLI is not authenticated"
80
- - Repository access failed: prompt "Unable to access the current repository with gh"
78
+ - platform CLI not found: prompt "the platform CLI is not installed"
79
+ - Authentication failed: prompt "the platform CLI is not authenticated"
80
+ - Repository access failed: prompt "Unable to access the current repository with the platform CLI"
81
81
  - Version detection failed: prompt "Unable to determine current version baseline"
82
82
  - No `v*` tags found in `--history` mode: prompt "No history tags found matching v*; only standard milestones will be created"
83
83
  - Permission error: prompt "No permission to manage milestones in this repository"
84
- - API rate limit: prompt "GitHub API rate limit reached, please retry later"
84
+ - API rate limit: prompt "platform API rate limit reached, please retry later"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "初始化仓库的 GitHub Milestones 体系"
3
+ description: "初始化仓库的 milestones 体系"
4
4
  ---
5
5
 
6
- # 初始化 GitHub Milestones
6
+ # 初始化 milestones
7
7
 
8
- 一次性初始化仓库的标准 GitHub Milestones 体系。
8
+ 一次性初始化仓库的标准 milestones 体系。
9
9
 
10
10
  ## 执行流程
11
11
 
@@ -75,10 +75,10 @@ bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
75
75
 
76
76
  ## 错误处理
77
77
 
78
- - 未找到 `gh`:提示 "GitHub CLI (`gh`) is not installed"
79
- - 认证失败:提示 "GitHub CLI is not authenticated"
80
- - 仓库访问失败:提示 "Unable to access the current repository with gh"
78
+ - 未找到平台 CLI:提示 "the platform CLI is not installed"
79
+ - 认证失败:提示 "the platform CLI is not authenticated"
80
+ - 仓库访问失败:提示 "Unable to access the current repository with the platform CLI"
81
81
  - 版本解析失败:提示 "Unable to determine current version baseline"
82
82
  - `--history` 模式下未找到任何 `v*` git tags:提示 "No history tags found matching v*; only standard milestones will be created"
83
83
  - 权限不足:提示 "No permission to manage milestones in this repository"
84
- - API 限流:提示 "GitHub API rate limit reached, please retry later"
84
+ - API 限流:提示 "platform API rate limit reached, please retry later"
@@ -99,7 +99,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
99
99
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
100
100
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
101
101
  - Set `status: pending-design-work` by following issue-sync.md
102
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
102
+ - Create or update the task comment marker defined in `.agents/rules/issue-sync.md` (follow the task.md comment sync rule in issue-sync.md)
103
103
  - Publish the `{plan-artifact}` comment
104
104
 
105
105
  ### 8. Verification Gate
@@ -99,7 +99,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
99
99
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
100
100
  - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
101
101
  - 按 issue-sync.md 设置 `status: pending-design-work`
102
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
102
+ - 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
103
103
  - 发布 `{plan-artifact}` 评论
104
104
 
105
105
  ### 8. 完成校验
@@ -38,7 +38,9 @@
38
38
  "verify_comment_content": true,
39
39
  "verify_task_comment_content": true,
40
40
  "verify_issue_type": true,
41
- "verify_milestone": true
41
+ "verify_milestone": true,
42
+ "expected_status_label_key": "pendingDesignWork",
43
+ "expected_comment_marker_key": "artifact"
42
44
  }
43
45
  }
44
46
  }
@@ -62,7 +62,7 @@ Update task.md:
62
62
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
63
63
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
64
64
  - Set `status: in-progress` by following issue-sync.md
65
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
65
+ - Create or update the task comment marker defined in `.agents/rules/issue-sync.md` (follow the task.md comment sync rule in issue-sync.md)
66
66
  - Publish the `{refinement-artifact}` comment
67
67
 
68
68
  ### 7. Verification Gate
@@ -62,7 +62,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
62
62
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
63
63
  - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
64
64
  - 按 issue-sync.md 设置 `status: in-progress`
65
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
65
+ - 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
66
66
  - 发布 `{refinement-artifact}` 评论
67
67
 
68
68
  ### 7. 完成校验
@@ -32,7 +32,9 @@
32
32
  "verify_comment_content": true,
33
33
  "verify_task_comment_content": true,
34
34
  "verify_issue_type": true,
35
- "verify_milestone": true
35
+ "verify_milestone": true,
36
+ "expected_status_label_key": "inProgress",
37
+ "expected_comment_marker_key": "artifact"
36
38
  }
37
39
  }
38
40
  }
@@ -9,7 +9,7 @@ Restore local task workspace files from platform Issue comments that contain syn
9
9
 
10
10
  ## Boundary / Critical Rules
11
11
 
12
- - Restore files only from comments marked with `<!-- sync-issue:{task-id}:... -->`
12
+ - Restore files only from comments that match the marker registry in `.agents/rules/issue-sync.md`
13
13
  - Restore into `.agents/workspace/active/{task-id}/` by default
14
14
  - Stop immediately if the target directory already exists and ask the user to resolve the conflict first
15
15
  - After executing this skill, you **must** immediately update the restored `task.md`
@@ -31,16 +31,11 @@ Read all Issue comments by following the "Read Issue comments" command in `.agen
31
31
 
32
32
  ### 3. Determine the task-id and Files to Restore
33
33
 
34
- Filter comments by these hidden markers:
35
-
36
- ```html
37
- <!-- sync-issue:{task-id}:{file-stem} -->
38
- <!-- sync-issue:{task-id}:{file-stem}:{part}/{total} -->
39
- ```
34
+ Filter comments by the task, artifact, and chunked artifact markers defined in `.agents/rules/issue-sync.md`.
40
35
 
41
36
  Rules:
42
37
  - when `{task-id}` was provided, match only that task
43
- - when `{task-id}` was omitted, infer it from the `<!-- sync-issue:{task-id}:task -->` comment first
38
+ - when `{task-id}` was omitted, infer it from the task comment marker first
44
39
  - if you cannot determine a unique task-id, stop and tell the user
45
40
  - ignore `summary` marker comments because they are complete-task aggregate output rather than restorable local task files
46
41
  - map `{file-stem}` back to filenames:
@@ -58,7 +53,7 @@ Read `.agents/rules/issue-sync.md` before executing this step.
58
53
  For each file:
59
54
  - collect its single comment or chunked comments
60
55
  - for `task.md` comments, reverse the `<details>` frontmatter wrapper described in issue-sync.md before reassembling the file body
61
- - when `{part}/{total}` exists, sort by part and verify the set is complete
56
+ - when a chunk marker includes part and total indexes, sort by part and verify the set is complete
62
57
  - extract the file body by removing the hidden marker, heading, and footer
63
58
  - concatenate chunk bodies into the final file content
64
59
 
@@ -88,66 +83,20 @@ Update the restored `task.md`:
88
83
  - `status`: `active`
89
84
  - `assigned_to`: {current AI agent}
90
85
  - `updated_at`: {current time}
91
- - keep the original `current_step`
92
- - append this entry to `## Activity Log`:
93
- ```
94
- - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Restore Task** by {agent} — Restored task from Issue #{issue-number}
95
- ```
96
-
97
- ### 7. Verification Gate
98
-
99
- Run the verification gate:
100
-
101
- ```bash
102
- node .agents/scripts/validate-artifact.js gate restore-task .agents/workspace/active/{task-id} --format text
103
- ```
104
-
105
- Handle the result as follows:
106
- - exit code 0 (all checks passed) -> continue to the "Inform User" step
107
- - exit code 1 (validation failed) -> fix the reported issues and run the gate again
108
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
109
86
 
110
- Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
87
+ Append an Activity Log entry indicating the task was restored from the platform Issue.
111
88
 
112
- ### 8. Inform User
89
+ ### 7. Inform User
113
90
 
114
- > Execute this step only after the verification gate passes.
115
-
116
- > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
117
-
118
- Output format:
119
-
120
- ```text
121
- Task {task-id} was restored from Issue #{issue-number}.
122
-
123
- Summary:
124
- - Restored files: {count}
125
- - Task directory: .agents/workspace/active/{task-id}/
126
- - Current step: {current_step}
127
-
128
- Next step - check task status:
129
- - Claude Code / OpenCode: /check-task {task-id}
130
- - Gemini CLI: /{{project}}:check-task {task-id}
131
- - Codex CLI: $check-task {task-id}
132
- ```
91
+ Report the restored task id, restored file count, and the active task directory.
133
92
 
134
93
  ## Completion Checklist
135
94
 
136
- - [ ] Fetched and parsed Issue comments
137
- - [ ] Restored `task.md` and every available artifact file
138
- - [ ] Updated the restored task.md
139
- - [ ] Ran and passed the verification gate
140
- - [ ] Showed the next-step commands in every TUI format, including any custom TUIs
141
-
142
- ## STOP
143
-
144
- Stop after completing the checklist. Do not continue the workflow automatically.
95
+ - [ ] Fetched Issue comments from the platform
96
+ - [ ] Restored task files locally
97
+ - [ ] Updated restored task metadata
98
+ - [ ] Reported the restored directory
145
99
 
146
- ## Error Handling
100
+ ### 8. Stop
147
101
 
148
- - Issue missing or inaccessible
149
- - Platform CLI unavailable or unauthenticated
150
- - No sync-marked comments found
151
- - Unable to determine a unique `task-id`
152
- - Target directory already exists
153
- - Missing chunks or incomplete chunk ordering
102
+ Stop after the completion checklist. Do not commit automatically.