@fitlab-ai/agent-infra 0.4.1 → 0.4.3

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 (142) hide show
  1. package/README.md +44 -44
  2. package/README.zh-CN.md +44 -44
  3. package/lib/defaults.json +7 -9
  4. package/lib/init.js +1 -0
  5. package/lib/update.js +13 -1
  6. package/package.json +3 -3
  7. package/templates/.agents/QUICKSTART.md +7 -7
  8. package/templates/.agents/QUICKSTART.zh-CN.md +13 -13
  9. package/templates/.agents/README.md +31 -18
  10. package/templates/.agents/README.zh-CN.md +33 -20
  11. package/templates/.agents/rules/issue-sync.md +185 -0
  12. package/templates/.agents/rules/issue-sync.zh-CN.md +185 -0
  13. package/templates/.agents/scripts/validate-artifact.js +1280 -0
  14. package/templates/.agents/skills/analyze-task/SKILL.md +24 -1
  15. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +24 -1
  16. package/templates/.agents/skills/analyze-task/config/verify.json +41 -0
  17. package/templates/.agents/skills/archive-tasks/SKILL.md +40 -0
  18. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +40 -0
  19. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +403 -0
  20. package/templates/.agents/skills/block-task/SKILL.md +25 -37
  21. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +25 -37
  22. package/templates/.agents/skills/block-task/config/verify.json +28 -0
  23. package/templates/.agents/skills/close-codescan/SKILL.md +7 -0
  24. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -0
  25. package/templates/.agents/skills/close-dependabot/SKILL.md +7 -0
  26. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -0
  27. package/templates/.agents/skills/commit/SKILL.md +17 -0
  28. package/templates/.agents/skills/commit/SKILL.zh-CN.md +17 -0
  29. package/templates/.agents/skills/commit/config/verify.json +22 -0
  30. package/templates/.agents/skills/commit/reference/task-status-update.md +3 -3
  31. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +3 -3
  32. package/templates/.agents/skills/complete-task/SKILL.md +24 -10
  33. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +24 -10
  34. package/templates/.agents/skills/complete-task/config/verify.json +30 -0
  35. package/templates/.agents/skills/create-issue/SKILL.md +41 -5
  36. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +41 -5
  37. package/templates/.agents/skills/create-issue/config/verify.json +27 -0
  38. package/templates/.agents/skills/create-issue/reference/label-and-type.md +10 -11
  39. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +10 -11
  40. package/templates/.agents/skills/create-pr/SKILL.md +59 -16
  41. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +59 -16
  42. package/templates/.agents/skills/create-pr/config/verify.json +26 -0
  43. package/templates/.agents/skills/create-pr/reference/branch-strategy.md +3 -3
  44. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +3 -3
  45. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.md +6 -6
  46. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.zh-CN.md +10 -10
  47. package/templates/.agents/skills/create-pr/reference/pr-body-template.md +15 -6
  48. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +15 -6
  49. package/templates/.agents/skills/create-task/SKILL.md +25 -3
  50. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +25 -3
  51. package/templates/.agents/skills/create-task/config/verify.json +24 -0
  52. package/templates/.agents/skills/implement-task/SKILL.md +44 -8
  53. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +44 -8
  54. package/templates/.agents/skills/implement-task/config/verify.json +41 -0
  55. package/templates/.agents/skills/implement-task/reference/branch-management.md +48 -0
  56. package/templates/.agents/skills/implement-task/reference/branch-management.zh-CN.md +49 -0
  57. package/templates/.agents/skills/implement-task/reference/output-template.md +20 -0
  58. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +20 -0
  59. package/templates/.agents/skills/import-codescan/SKILL.md +18 -7
  60. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +18 -7
  61. package/templates/.agents/skills/import-codescan/config/verify.json +24 -0
  62. package/templates/.agents/skills/import-dependabot/SKILL.md +18 -7
  63. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +18 -7
  64. package/templates/.agents/skills/import-dependabot/config/verify.json +24 -0
  65. package/templates/.agents/skills/import-issue/SKILL.md +19 -1
  66. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +19 -1
  67. package/templates/.agents/skills/import-issue/config/verify.json +27 -0
  68. package/templates/.agents/skills/init-labels/SKILL.md +40 -10
  69. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +40 -10
  70. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +1 -22
  71. package/templates/.agents/skills/init-milestones/SKILL.md +13 -0
  72. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +13 -0
  73. package/templates/.agents/skills/plan-task/SKILL.md +29 -75
  74. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +29 -75
  75. package/templates/.agents/skills/plan-task/config/verify.json +42 -0
  76. package/templates/.agents/skills/refine-task/SKILL.md +51 -4
  77. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +51 -4
  78. package/templates/.agents/skills/refine-task/config/verify.json +37 -0
  79. package/templates/.agents/skills/refine-title/SKILL.md +10 -2
  80. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +10 -2
  81. package/templates/.agents/skills/restore-task/SKILL.md +159 -0
  82. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +159 -0
  83. package/templates/.agents/skills/restore-task/config/verify.json +24 -0
  84. package/templates/.agents/skills/review-task/SKILL.md +25 -1
  85. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +25 -1
  86. package/templates/.agents/skills/review-task/config/verify.json +40 -0
  87. package/templates/.agents/skills/update-agent-infra/SKILL.md +11 -0
  88. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +11 -0
  89. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +8 -10
  90. package/templates/.claude/commands/archive-tasks.md +9 -0
  91. package/templates/.claude/commands/archive-tasks.zh-CN.md +9 -0
  92. package/templates/.claude/commands/create-pr.md +1 -1
  93. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  94. package/templates/.claude/commands/restore-task.md +9 -0
  95. package/templates/.claude/commands/restore-task.zh-CN.md +9 -0
  96. package/templates/.gemini/commands/_project_/archive-tasks.toml +10 -0
  97. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +10 -0
  98. package/templates/.gemini/commands/_project_/restore-task.toml +8 -0
  99. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +8 -0
  100. package/templates/.github/workflows/status-label.yml +82 -0
  101. package/templates/.opencode/commands/archive-tasks.md +11 -0
  102. package/templates/.opencode/commands/archive-tasks.zh-CN.md +11 -0
  103. package/templates/.opencode/commands/restore-task.md +11 -0
  104. package/templates/.opencode/commands/restore-task.zh-CN.md +11 -0
  105. package/templates/.agents/skills/sync-issue/SKILL.md +0 -91
  106. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +0 -91
  107. package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -88
  108. package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -88
  109. package/templates/.agents/skills/sync-issue/reference/delivery-detection.md +0 -42
  110. package/templates/.agents/skills/sync-issue/reference/delivery-detection.zh-CN.md +0 -42
  111. package/templates/.agents/skills/sync-issue/reference/label-sync.md +0 -63
  112. package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +0 -63
  113. package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +0 -37
  114. package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +0 -37
  115. package/templates/.agents/skills/sync-pr/SKILL.md +0 -72
  116. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +0 -72
  117. package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +0 -54
  118. package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +0 -54
  119. package/templates/.claude/CLAUDE.md +0 -138
  120. package/templates/.claude/CLAUDE.zh-CN.md +0 -138
  121. package/templates/.claude/commands/sync-issue.md +0 -8
  122. package/templates/.claude/commands/sync-issue.zh-CN.md +0 -8
  123. package/templates/.claude/commands/sync-pr.md +0 -8
  124. package/templates/.claude/commands/sync-pr.zh-CN.md +0 -8
  125. package/templates/.claude/project-rules.md +0 -65
  126. package/templates/.claude/project-rules.zh-CN.md +0 -65
  127. package/templates/.codex/README.md +0 -38
  128. package/templates/.codex/README.zh-CN.md +0 -37
  129. package/templates/.gemini/commands/_project_/sync-issue.toml +0 -8
  130. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +0 -8
  131. package/templates/.gemini/commands/_project_/sync-pr.toml +0 -8
  132. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +0 -8
  133. package/templates/.opencode/COMMAND_STYLE_GUIDE.md +0 -232
  134. package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +0 -232
  135. package/templates/.opencode/README.md +0 -76
  136. package/templates/.opencode/README.zh-CN.md +0 -77
  137. package/templates/.opencode/commands/sync-issue.md +0 -11
  138. package/templates/.opencode/commands/sync-issue.zh-CN.md +0 -11
  139. package/templates/.opencode/commands/sync-pr.md +0 -11
  140. package/templates/.opencode/commands/sync-pr.zh-CN.md +0 -11
  141. package/templates/AGENTS.md +0 -112
  142. package/templates/AGENTS.zh-CN.md +0 -112
@@ -24,7 +24,20 @@ Check these files first:
24
24
 
25
25
  If either file is missing, stop and ask the user to complete the prerequisite step.
26
26
 
27
- ### 2. Determine the Input Plan and Implementation Round
27
+ ### 2. Ensure the Task Branch
28
+
29
+ Read the branch field in `## Context` from `task.md` and check whether the current Git branch matches it.
30
+
31
+ - if a task branch is already recorded, switch to it when the current branch does not match
32
+ - if no branch is recorded, check whether the current branch follows the naming convention and belongs to this task
33
+ - if yes: record the current branch and continue
34
+ - if no: create and switch to a new task branch that follows the naming rule
35
+
36
+ After this step, write the final branch name back to `task.md`.
37
+
38
+ > Branch naming rules, Git commands, and edge-case handling live in `reference/branch-management.md`. Read `reference/branch-management.md` before executing this step.
39
+
40
+ ### 3. Determine the Input Plan and Implementation Round
28
41
 
29
42
  Scan `.agents/workspace/active/{task-id}/` and record:
30
43
  - the highest-round plan file as `{plan-artifact}`
@@ -33,7 +46,7 @@ Scan `.agents/workspace/active/{task-id}/` and record:
33
46
 
34
47
  If any `plan-r{N}.md` exists, read the highest-round plan file. Otherwise read `plan.md`.
35
48
 
36
- ### 3. Read the Technical Plan
49
+ ### 4. Read the Technical Plan
37
50
 
38
51
  Read `{plan-artifact}` carefully and extract:
39
52
  - implementation steps
@@ -41,25 +54,25 @@ Read `{plan-artifact}` carefully and extract:
41
54
  - test strategy
42
55
  - constraints, risks, and any approved tradeoffs
43
56
 
44
- ### 4. Implement the Code
57
+ ### 5. Implement the Code
45
58
 
46
59
  Follow `.agents/workflows/feature-development.yaml` and the plan in order.
47
60
 
48
61
  > Detailed implementation rules, testing discipline, and deviation handling live in `reference/implementation-rules.md`. Read `reference/implementation-rules.md` before executing this step.
49
62
 
50
- ### 5. Run Test Verification
63
+ ### 6. Run Test Verification
51
64
 
52
65
  Use the project test command from the `test` skill and keep iterating until all required tests pass.
53
66
 
54
67
  If tests fail, Attempt to fix the issue and re-run tests first. Only stop when you confirm an external blocker, missing environment, or unclear requirement that is out of scope for the task.
55
68
 
56
- ### 6. Write the Implementation Report
69
+ ### 7. Write the Implementation Report
57
70
 
58
71
  Create `.agents/workspace/active/{task-id}/{implementation-artifact}`.
59
72
 
60
73
  > Report structure, required sections, and the full template live in `reference/report-template.md`. Read `reference/report-template.md` before writing the report.
61
74
 
62
- ### 7. Update Task Status
75
+ ### 8. Update Task Status
63
76
 
64
77
  Get the current time:
65
78
 
@@ -71,13 +84,36 @@ Update `.agents/workspace/active/{task-id}/task.md`:
71
84
  - `current_step`: implementation
72
85
  - `assigned_to`: {current agent}
73
86
  - `updated_at`: {current time}
87
+ - review the `## Requirements` section and only change items from `- [ ]` to `- [x]` when they are clearly satisfied by this round's implemented code and passing tests
74
88
  - record `{implementation-artifact}` for Round `{implementation-round}`
75
89
  - append:
76
90
  `- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
77
91
 
78
- ### 8. Inform the User
92
+ 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):
93
+ - Set `status: in-progress` and refine `in:` labels from the branch diff by following `.agents/rules/issue-sync.md` (add/remove when a mapping exists, add-only when it does not)
94
+ - Sync checked `## Requirements` items to the Issue body and publish the `{implementation-artifact}` comment
95
+ - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
96
+
97
+ ### 9. Verification Gate
98
+
99
+ Run the verification gate to confirm the task artifact and sync state are valid:
100
+
101
+ ```bash
102
+ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/active/{task-id} {implementation-artifact} --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
+
110
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
111
+
112
+ ### 10. Inform User
113
+
114
+ > Execute this step only after the verification gate passes.
79
115
 
80
- Output the implementation summary and include all TUI command variants for the next review step.
116
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent. Use the output template in `reference/output-template.md`.
81
117
 
82
118
  ## Completion Checklist
83
119
 
@@ -24,7 +24,20 @@ description: "根据技术方案实施任务并输出报告"
24
24
 
25
25
  如果缺少任一文件,立即停止并提示用户先完成前置步骤。
26
26
 
27
- ### 2. 确定输入方案与实现轮次
27
+ ### 2. 确保任务分支
28
+
29
+ 先读取 `task.md` 中 `## 上下文` 的分支字段,并检查当前 Git 分支是否匹配。
30
+
31
+ - 已记录任务分支:当前分支不匹配时切换到该分支
32
+ - 未记录任务分支:判断当前分支是否符合命名规范且属于当前任务
33
+ - 符合:记录当前分支并继续
34
+ - 不符合:按规范创建并切换到新的任务分支
35
+
36
+ 完成后,把最终使用的分支名回写到 `task.md`。
37
+
38
+ > 分支命名规则、Git 命令和边界处理见 `reference/branch-management.md`。执行此步骤前,先读取 `reference/branch-management.md`。
39
+
40
+ ### 3. 确定输入方案与实现轮次
28
41
 
29
42
  扫描 `.agents/workspace/active/{task-id}/` 并记录:
30
43
  - 最高轮次的方案文件为 `{plan-artifact}`
@@ -33,7 +46,7 @@ description: "根据技术方案实施任务并输出报告"
33
46
 
34
47
  如果存在 `plan-r{N}.md`,读取最高轮次的方案文件;否则读取 `plan.md`。
35
48
 
36
- ### 3. 阅读技术方案
49
+ ### 4. 阅读技术方案
37
50
 
38
51
  仔细阅读 `{plan-artifact}`,提取:
39
52
  - 实施步骤
@@ -41,25 +54,25 @@ description: "根据技术方案实施任务并输出报告"
41
54
  - 测试策略
42
55
  - 约束、风险与已批准的取舍
43
56
 
44
- ### 4. 执行代码实现
57
+ ### 5. 执行代码实现
45
58
 
46
59
  按照 `.agents/workflows/feature-development.yaml` 和方案顺序实施。
47
60
 
48
61
  > 详细实现规则、测试纪律和偏离处理见 `reference/implementation-rules.md`。执行此步骤前,先读取 `reference/implementation-rules.md`。
49
62
 
50
- ### 5. 运行测试验证
63
+ ### 6. 运行测试验证
51
64
 
52
65
  使用 `test` 技能中的项目测试命令,直到所有必需测试通过。
53
66
 
54
67
  如果测试失败,先尝试修复并重新运行测试。只有在确认存在外部阻塞、环境缺失或需求不明确且超出任务范围时,才可以停止。
55
68
 
56
- ### 6. 编写实现报告
69
+ ### 7. 编写实现报告
57
70
 
58
71
  创建 `.agents/workspace/active/{task-id}/{implementation-artifact}`。
59
72
 
60
73
  > 报告结构、必填章节和完整模板见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
61
74
 
62
- ### 7. 更新任务状态
75
+ ### 8. 更新任务状态
63
76
 
64
77
  获取当前时间:
65
78
 
@@ -71,13 +84,36 @@ date "+%Y-%m-%d %H:%M:%S"
71
84
  - `current_step`:implementation
72
85
  - `assigned_to`:{当前代理}
73
86
  - `updated_at`:{当前时间}
87
+ - 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
74
88
  - 记录 Round `{implementation-round}` 的 `{implementation-artifact}`
75
89
  - 追加:
76
90
  `- {yyyy-MM-dd HH:mm:ss} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
77
91
 
78
- ### 8. 告知用户
92
+ 如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`):
93
+ - 设置 `status: in-progress`,并按 `.agents/rules/issue-sync.md` 的 `in:` label 同步规则,基于分支改动精修 `in:` label(有映射时可增可删,无映射时仅补充)
94
+ - 同步 `## 需求` 中已勾选项到 Issue body,并发布 `{implementation-artifact}` 评论
95
+ - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
96
+
97
+ ### 9. 完成校验
98
+
99
+ 运行完成校验,确认任务产物和同步状态符合规范:
100
+
101
+ ```bash
102
+ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/active/{task-id} {implementation-artifact} --format text
103
+ ```
104
+
105
+ 处理结果:
106
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
107
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
108
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
109
+
110
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
111
+
112
+ ### 10. 告知用户
113
+
114
+ > 仅在校验通过后执行本步骤。
79
115
 
80
- 输出实现摘要,并完整展示下一步代码审查的所有 TUI 命令格式。
116
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。输出格式见 `reference/output-template.md`。
81
117
 
82
118
  ## 完成检查清单
83
119
 
@@ -0,0 +1,41 @@
1
+ {
2
+ "skill": "implement-task",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "current_step",
13
+ "assigned_to"
14
+ ],
15
+ "expected_step": "implementation"
16
+ },
17
+ "artifact": {
18
+ "file_pattern": "implementation.md|implementation-r{N}.md",
19
+ "required_sections": [
20
+ "变更文件",
21
+ "关键代码说明",
22
+ "测试结果",
23
+ "与方案的差异",
24
+ "供审查关注的内容"
25
+ ],
26
+ "freshness_minutes": 30
27
+ },
28
+ "activity-log": {
29
+ "expected_action_pattern": "Implementation \\(Round \\d+\\)",
30
+ "freshness_minutes": 30
31
+ },
32
+ "github-sync": {
33
+ "when": "issue_number_exists",
34
+ "expected_status_label": "status: in-progress",
35
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
36
+ "verify_comment_content": true,
37
+ "verify_task_comment_content": true,
38
+ "sync_checked_requirements": true
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,48 @@
1
+ # Branch Management
2
+
3
+ Read this file before ensuring the task branch.
4
+
5
+ ## Branch Naming Rule
6
+
7
+ - Format: `{{project}}-{type}-{slug}`
8
+ - project prefix: read the `project` field from `.agents/.airc.json`
9
+ - `{type}`: read the `type` field from the task frontmatter
10
+ - `{slug}`: derive a 3-6 word English kebab-case phrase from the task title
11
+
12
+ ## Branch Detection Flow
13
+
14
+ Read these inputs first:
15
+ - the `- **Branch**:` field under `## Context` in `task.md`
16
+ - the current branch from `git branch --show-current`
17
+
18
+ A recorded branch is valid when it has a non-empty value other than `TBD`, `to be created`, or `N/A`.
19
+
20
+ Scenario A: `task.md` already records the task branch
21
+ - if the current branch matches, continue
22
+ - if it does not match, follow the "Create and Switch Commands" section below to switch to the recorded branch
23
+
24
+ Scenario B: `task.md` has no task branch recorded
25
+ - check whether the current branch follows the project naming convention (`{{project}}-{type}-{slug}`) and semantically belongs to this task
26
+ - if yes: write the current branch name back to `task.md` and continue
27
+ - if no: generate a new task branch name, create and switch using the "Create and Switch Commands" section below, then write it back to `task.md`
28
+
29
+ ## Create and Switch Commands
30
+
31
+ Check branches in this order:
32
+
33
+ ```bash
34
+ git branch --list {branch-name}
35
+ git ls-remote --heads origin {branch-name}
36
+ ```
37
+
38
+ - local branch exists: `git switch {branch-name}`
39
+ - only remote branch exists: `git switch --track origin/{branch-name}`
40
+ - neither exists: `git switch -c {branch-name}`
41
+
42
+ If switching fails, stop and ask the user to resolve the branch or working tree conflict first.
43
+
44
+ ## task.md Write-back
45
+
46
+ - update `- **Branch**: {branch-name}` under `## Context`
47
+ - do not modify the other context fields
48
+ - preserve the recorded branch value when updating task status later
@@ -0,0 +1,49 @@
1
+ # 分支管理
2
+
3
+ 在确保任务分支之前先读取本文件。
4
+
5
+ ## 分支名规则
6
+
7
+ - 格式:`{{project}}-{type}-{slug}`
8
+ - 项目前缀:读取 `.agents/.airc.json` 中的 `project`
9
+ - `{type}`:读取 `task.md` frontmatter 中的 `type`
10
+ - `{slug}`:根据任务标题提取 3-6 个英文关键词,转为 kebab-case
11
+
12
+ ## 分支检测流程
13
+
14
+ 先读取:
15
+ - `task.md` 中 `## 上下文` 下的 `- **分支**:`
16
+ - 当前分支:`git branch --show-current`
17
+
18
+ 有效已记录分支:
19
+ - 有值,且不是 `待定`、`待创建`、`N/A` 或空字符串
20
+
21
+ 场景 A:`task.md` 已记录任务分支
22
+ - 当前分支与记录值一致:直接继续
23
+ - 当前分支不一致:按下方”创建与切换命令”章节切换到已记录分支
24
+
25
+ 场景 B:`task.md` 未记录任务分支
26
+ - 判断当前分支是否符合项目分支命名规范(`{{project}}-{type}-{slug}`)且语义上属于当前任务
27
+ - 符合:将当前分支名回写到 `task.md`,继续
28
+ - 不符合:生成新的任务分支名,按下方”创建与切换命令”章节创建并切换,回写到 `task.md`
29
+
30
+ ## 创建与切换命令
31
+
32
+ 按以下顺序处理:
33
+
34
+ ```bash
35
+ git branch --list {branch-name}
36
+ git ls-remote --heads origin {branch-name}
37
+ ```
38
+
39
+ - 本地分支已存在:`git switch {branch-name}`
40
+ - 仅远程分支存在:`git switch --track origin/{branch-name}`
41
+ - 本地和远程都不存在:`git switch -c {branch-name}`
42
+
43
+ 如果切换失败,立即停止并提示用户先处理工作区冲突或未解决的分支问题。
44
+
45
+ ## task.md 回写要求
46
+
47
+ - 更新 `## 上下文` 中的 `- **分支**:{branch-name}`
48
+ - 不修改其他上下文字段
49
+ - 若本步骤已回写 `task.md`,后续更新任务状态时保留该分支值
@@ -0,0 +1,20 @@
1
+ # Output Template
2
+
3
+ When reporting that implementation is complete, use the following standard format:
4
+
5
+ ```text
6
+ Task {task-id} implementation complete.
7
+
8
+ Summary:
9
+ - Implementation round: Round {implementation-round}
10
+ - Files modified: {count}
11
+ - All tests passed: {yes/no}
12
+
13
+ Output files:
14
+ - Implementation report: .agents/workspace/active/{task-id}/{implementation-artifact}
15
+
16
+ Next step - code review:
17
+ - Claude Code / OpenCode: /review-task {task-id}
18
+ - Gemini CLI: /{{project}}:review-task {task-id}
19
+ - Codex CLI: $review-task {task-id}
20
+ ```
@@ -0,0 +1,20 @@
1
+ # 输出模板
2
+
3
+ 向用户汇报实现完成时,使用以下标准格式:
4
+
5
+ ```text
6
+ 任务 {task-id} 实现完成。
7
+
8
+ 摘要:
9
+ - 实现轮次:Round {implementation-round}
10
+ - 修改文件:{数量}
11
+ - 所有测试通过:{是/否}
12
+
13
+ 产出文件:
14
+ - 实现报告:.agents/workspace/active/{task-id}/{implementation-artifact}
15
+
16
+ 下一步 - 代码审查:
17
+ - Claude Code / OpenCode:/review-task {task-id}
18
+ - Gemini CLI:/{{project}}:review-task {task-id}
19
+ - Codex CLI:$review-task {task-id}
20
+ ```
@@ -58,7 +58,24 @@ Update task.md: `current_step` -> `requirement-analysis`.
58
58
  - {yyyy-MM-dd HH:mm:ss} — **Import Code Scanning Alert** by {agent} — Code Scanning alert #{alert-number} imported
59
59
  ```
60
60
 
61
- ### 4. Inform User
61
+ ### 4. Verification Gate
62
+
63
+ Run the verification gate to confirm the task artifact and sync state are valid:
64
+
65
+ ```bash
66
+ node .agents/scripts/validate-artifact.js gate import-codescan .agents/workspace/active/{task-id} --format text
67
+ ```
68
+
69
+ Handle the result as follows:
70
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
71
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
72
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
73
+
74
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
75
+
76
+ ### 5. Inform User
77
+
78
+ > Execute this step only after the verification gate passes.
62
79
 
63
80
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
64
81
 
@@ -79,12 +96,6 @@ Next step:
79
96
  - Codex CLI: $analyze-task {task-id}
80
97
  ```
81
98
 
82
- ## Notes
83
-
84
- 1. **Severity priority**: Critical/High -> handle immediately. Medium -> schedule handling. Low -> can be deferred.
85
- 2. **Scope**: this skill only imports the alert and creates the task; risk assessment is handled by `analyze-task`.
86
- 3. **Follow-up**: after import, run `analyze-task` first, then decide whether to fix or dismiss.
87
-
88
99
  ## Completion Checklist
89
100
 
90
101
  - [ ] Retrieved and recorded the key alert information
@@ -58,7 +58,24 @@ date "+%Y-%m-%d %H:%M:%S"
58
58
  - {yyyy-MM-dd HH:mm:ss} — **Import Code Scanning Alert** by {agent} — Code Scanning alert #{alert-number} imported
59
59
  ```
60
60
 
61
- ### 4. 告知用户
61
+ ### 4. 完成校验
62
+
63
+ 运行完成校验,确认任务产物和同步状态符合规范:
64
+
65
+ ```bash
66
+ node .agents/scripts/validate-artifact.js gate import-codescan .agents/workspace/active/{task-id} --format text
67
+ ```
68
+
69
+ 处理结果:
70
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
71
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
72
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
73
+
74
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
75
+
76
+ ### 5. 告知用户
77
+
78
+ > 仅在校验通过后执行本步骤。
62
79
 
63
80
  > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
64
81
 
@@ -79,12 +96,6 @@ Code Scanning 告警 #{alert-number} 已导入。
79
96
  - Codex CLI:$analyze-task {task-id}
80
97
  ```
81
98
 
82
- ## 注意事项
83
-
84
- 1. **严重程度优先级**:Critical/High -> 立即处理。Medium -> 计划处理。Low -> 可延后。
85
- 2. **范围**:本技能仅负责导入告警并创建任务;风险评估由 `analyze-task` 负责。
86
- 3. **后续动作**:导入后先执行 `analyze-task`,分析完成后再决定修复或关闭。
87
-
88
99
  ## 完成检查清单
89
100
 
90
101
  - [ ] 获取并记录了告警关键信息
@@ -0,0 +1,24 @@
1
+ {
2
+ "skill": "import-codescan",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "current_step",
13
+ "assigned_to"
14
+ ],
15
+ "expected_step": "requirement-analysis",
16
+ "expected_status": "active"
17
+ },
18
+ "activity-log": {
19
+ "expected_action_pattern": "Import Code Scanning Alert",
20
+ "freshness_minutes": 30
21
+ },
22
+ "github-sync": null
23
+ }
24
+ }
@@ -59,7 +59,24 @@ Update task.md: `current_step` -> `requirement-analysis`.
59
59
  - {yyyy-MM-dd HH:mm:ss} — **Import Dependabot Alert** by {agent} — Dependabot alert #{alert-number} imported
60
60
  ```
61
61
 
62
- ### 4. Inform User
62
+ ### 4. Verification Gate
63
+
64
+ Run the verification gate to confirm the task artifact and sync state are valid:
65
+
66
+ ```bash
67
+ node .agents/scripts/validate-artifact.js gate import-dependabot .agents/workspace/active/{task-id} --format text
68
+ ```
69
+
70
+ Handle the result as follows:
71
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
72
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
73
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
74
+
75
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
76
+
77
+ ### 5. Inform User
78
+
79
+ > Execute this step only after the verification gate passes.
63
80
 
64
81
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
65
82
 
@@ -83,12 +100,6 @@ Next step:
83
100
  - Codex CLI: $analyze-task {task-id}
84
101
  ```
85
102
 
86
- ## Notes
87
-
88
- 1. **Severity priority**: Critical/High -> handle immediately. Medium -> schedule handling. Low -> can be deferred.
89
- 2. **Scope**: this skill only imports the alert and creates the task; risk assessment is handled by `analyze-task`.
90
- 3. **Follow-up**: after import, run `analyze-task` first, then decide whether to fix or dismiss.
91
-
92
103
  ## Completion Checklist
93
104
 
94
105
  - [ ] Retrieved and recorded the key alert information
@@ -59,7 +59,24 @@ date "+%Y-%m-%d %H:%M:%S"
59
59
  - {yyyy-MM-dd HH:mm:ss} — **Import Dependabot Alert** by {agent} — Dependabot alert #{alert-number} imported
60
60
  ```
61
61
 
62
- ### 4. 告知用户
62
+ ### 4. 完成校验
63
+
64
+ 运行完成校验,确认任务产物和同步状态符合规范:
65
+
66
+ ```bash
67
+ node .agents/scripts/validate-artifact.js gate import-dependabot .agents/workspace/active/{task-id} --format text
68
+ ```
69
+
70
+ 处理结果:
71
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
72
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
73
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
74
+
75
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
76
+
77
+ ### 5. 告知用户
78
+
79
+ > 仅在校验通过后执行本步骤。
63
80
 
64
81
  > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
65
82
 
@@ -83,12 +100,6 @@ date "+%Y-%m-%d %H:%M:%S"
83
100
  - Codex CLI:$analyze-task {task-id}
84
101
  ```
85
102
 
86
- ## 注意事项
87
-
88
- 1. **严重程度优先级**:Critical/High -> 立即处理。Medium -> 计划处理。Low -> 可延后。
89
- 2. **范围**:本技能仅负责导入告警并创建任务;风险评估由 `analyze-task` 负责。
90
- 3. **后续动作**:导入后先执行 `analyze-task`,分析完成后再决定修复或关闭。
91
-
92
103
  ## 完成检查清单
93
104
 
94
105
  - [ ] 获取并记录了告警关键信息
@@ -0,0 +1,24 @@
1
+ {
2
+ "skill": "import-dependabot",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "current_step",
13
+ "assigned_to"
14
+ ],
15
+ "expected_step": "requirement-analysis",
16
+ "expected_status": "active"
17
+ },
18
+ "activity-log": {
19
+ "expected_action_pattern": "Import Dependabot Alert",
20
+ "freshness_minutes": 30
21
+ },
22
+ "github-sync": null
23
+ }
24
+ }
@@ -22,6 +22,7 @@ gh issue view <issue-number> --json number,title,body,labels
22
22
  ```
23
23
 
24
24
  Extract: issue number, title, description, and labels.
25
+ Use the Issue title as-is for the task title (preserve the Issue's original language).
25
26
 
26
27
  ### 2. Check for an Existing Task
27
28
 
@@ -69,7 +70,24 @@ Update `.agents/workspace/active/{task-id}/task.md`:
69
70
  - {yyyy-MM-dd HH:mm:ss} — **Import Issue** by {agent} — Issue #{number} imported
70
71
  ```
71
72
 
72
- ### 5. Inform User
73
+ ### 5. Verification Gate
74
+
75
+ Run the verification gate to confirm the task artifact and sync state are valid:
76
+
77
+ ```bash
78
+ node .agents/scripts/validate-artifact.js gate import-issue .agents/workspace/active/{task-id} --format text
79
+ ```
80
+
81
+ Handle the result as follows:
82
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
83
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
84
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
85
+
86
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
87
+
88
+ ### 6. Inform User
89
+
90
+ > Execute this step only after the verification gate passes.
73
91
 
74
92
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
75
93
 
@@ -22,6 +22,7 @@ gh issue view <issue-number> --json number,title,body,labels
22
22
  ```
23
23
 
24
24
  提取:issue 编号、标题、描述、标签。
25
+ 任务标题直接使用 Issue 的原始标题(保持 Issue 标题的原始语言)。
25
26
 
26
27
  ### 2. 检查已有任务
27
28
 
@@ -69,7 +70,24 @@ date "+%Y-%m-%d %H:%M:%S"
69
70
  - {yyyy-MM-dd HH:mm:ss} — **Import Issue** by {agent} — Issue #{number} imported
70
71
  ```
71
72
 
72
- ### 5. 告知用户
73
+ ### 5. 完成校验
74
+
75
+ 运行完成校验,确认任务产物和同步状态符合规范:
76
+
77
+ ```bash
78
+ node .agents/scripts/validate-artifact.js gate import-issue .agents/workspace/active/{task-id} --format text
79
+ ```
80
+
81
+ 处理结果:
82
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
83
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
84
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
85
+
86
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
87
+
88
+ ### 6. 告知用户
89
+
90
+ > 仅在校验通过后执行本步骤。
73
91
 
74
92
  > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
75
93