@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
@@ -68,20 +68,32 @@ ls .agents/workspace/blocked/{task-id}/task.md
68
68
 
69
69
  ### 6. 同步到 Issue(可选)
70
70
 
71
- 检查 `task.md` 中是否存在 `issue_number` 字段,且其值不为空也不为 `N/A`。如果没有,**跳过此步骤,不输出任何内容**。
71
+ 检查 `task.md` 中是否存在有效的 `issue_number`。如果没有,跳过。
72
72
 
73
- 如果存在有效的 `issue_number`,建议同步:
73
+ > Issue 同步的 status label 规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件。
74
74
 
75
- > **重要**:以下列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
75
+ 如果存在有效的 `issue_number`,直接设置 `status: blocked`。
76
76
 
77
+ ### 7. 完成校验
78
+
79
+ 运行完成校验,确认任务产物和同步状态符合规范:
80
+
81
+ ```bash
82
+ node .agents/scripts/validate-artifact.js gate block-task .agents/workspace/blocked/{task-id} --format text
77
83
  ```
78
- (可选)同步阻塞状态到 Issue:
79
- - Claude Code / OpenCode:/sync-issue {issue_number}
80
- - Gemini CLI:/{{project}}:sync-issue {issue_number}
81
- - Codex CLI:$sync-issue {issue_number}
82
- ```
83
84
 
84
- ### 7. 告知用户
85
+ 处理结果:
86
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
87
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
88
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
89
+
90
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
91
+
92
+ ### 8. 告知用户
93
+
94
+ > 仅在校验通过后执行本步骤。
95
+
96
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
85
97
 
86
98
  输出格式:
87
99
  ```
@@ -94,35 +106,11 @@ ls .agents/workspace/blocked/{task-id}/task.md
94
106
  解除阻塞时执行:
95
107
  mv .agents/workspace/blocked/{task-id} .agents/workspace/active/{task-id}
96
108
  # 然后更新 task.md:status -> active,移除 blocked_at
97
- ```
98
-
99
- ## 输出模板
100
-
101
- 添加到 task.md 的阻塞信息部分:
102
-
103
- ```markdown
104
- ## 阻塞信息
105
-
106
- ### 摘要
107
- {阻塞原因的一行描述}
108
-
109
- ### 问题描述
110
- {阻塞问题的详细描述}
111
-
112
- ### 根本原因
113
- {分析为什么会被阻塞}
114
-
115
- ### 已尝试的解决方案
116
- - {尝试了什么以及为什么没有成功}
117
-
118
- ### 解除阻塞所需
119
- - {需要什么:信息、决策、资源等}
120
-
121
- ### 解除阻塞条件
122
- {允许恢复工作的具体条件}
123
109
 
124
- ### 备选方案
125
- {考虑过的任何变通方法或替代方案}
110
+ 下一步 - 检查任务状态(解除阻塞后):
111
+ - Claude Code / OpenCode:/check-task {task-id}
112
+ - Gemini CLI:/agent-infra:check-task {task-id}
113
+ - Codex CLI:$check-task {task-id}
126
114
  ```
127
115
 
128
116
  ## 完成检查清单
@@ -0,0 +1,28 @@
1
+ {
2
+ "skill": "block-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
+ "blocked_at"
15
+ ],
16
+ "expected_status": "blocked",
17
+ "require_blocked_at": true
18
+ },
19
+ "activity-log": {
20
+ "expected_action_pattern": "Blocked",
21
+ "freshness_minutes": 30
22
+ },
23
+ "github-sync": {
24
+ "when": "issue_number_exists",
25
+ "expected_status_label": "status: blocked"
26
+ }
27
+ }
28
+ }
@@ -92,6 +92,8 @@ date "+%Y-%m-%d %H:%M:%S"
92
92
 
93
93
  ### 8. Inform User
94
94
 
95
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
96
+
95
97
  ```
96
98
  Code Scanning alert #{alert-number} dismissed.
97
99
 
@@ -103,6 +105,11 @@ Explanation: {explanation}
103
105
  View: {html_url}
104
106
 
105
107
  Note: it can be reopened on GitHub if necessary.
108
+
109
+ Next step - complete and archive the task if a related task exists:
110
+ - Claude Code / OpenCode: /complete-task {task-id}
111
+ - Gemini CLI: /{{project}}:complete-task {task-id}
112
+ - Codex CLI: $complete-task {task-id}
106
113
  ```
107
114
 
108
115
  ## Notes
@@ -92,6 +92,8 @@ date "+%Y-%m-%d %H:%M:%S"
92
92
 
93
93
  ### 8. 告知用户
94
94
 
95
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
96
+
95
97
  ```
96
98
  Code Scanning 告警 #{alert-number} 已关闭。
97
99
 
@@ -103,6 +105,11 @@ Code Scanning 告警 #{alert-number} 已关闭。
103
105
  查看:{html_url}
104
106
 
105
107
  注意:如有需要,可在 GitHub 上重新打开。
108
+
109
+ 下一步 - 完成并归档任务(如有关联任务):
110
+ - Claude Code / OpenCode:/complete-task {task-id}
111
+ - Gemini CLI:/agent-infra:complete-task {task-id}
112
+ - Codex CLI:$complete-task {task-id}
106
113
  ```
107
114
 
108
115
  ## 注意事项
@@ -100,6 +100,8 @@ date "+%Y-%m-%d %H:%M:%S"
100
100
 
101
101
  ### 8. Inform User
102
102
 
103
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
104
+
103
105
  ```
104
106
  Security alert #{alert-number} dismissed.
105
107
 
@@ -111,6 +113,11 @@ Explanation: {explanation}
111
113
  View: https://github.com/{owner}/{repo}/security/dependabot/{alert-number}
112
114
 
113
115
  Note: it can be reopened on GitHub if necessary.
116
+
117
+ Next step - complete and archive the task if a related task exists:
118
+ - Claude Code / OpenCode: /complete-task {task-id}
119
+ - Gemini CLI: /{{project}}:complete-task {task-id}
120
+ - Codex CLI: $complete-task {task-id}
114
121
  ```
115
122
 
116
123
  ## Notes
@@ -100,6 +100,8 @@ date "+%Y-%m-%d %H:%M:%S"
100
100
 
101
101
  ### 8. 告知用户
102
102
 
103
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
104
+
103
105
  ```
104
106
  安全告警 #{alert-number} 已关闭。
105
107
 
@@ -111,6 +113,11 @@ date "+%Y-%m-%d %H:%M:%S"
111
113
  查看:https://github.com/{owner}/{repo}/security/dependabot/{alert-number}
112
114
 
113
115
  注意:如有需要,可在 GitHub 上重新打开。
116
+
117
+ 下一步 - 完成并归档任务(如有关联任务):
118
+ - Claude Code / OpenCode:/complete-task {task-id}
119
+ - Gemini CLI:/agent-infra:complete-task {task-id}
120
+ - Codex CLI:$complete-task {task-id}
114
121
  ```
115
122
 
116
123
  ## 注意事项
@@ -44,12 +44,29 @@ date "+%Y-%m-%d %H:%M:%S"
44
44
 
45
45
  > The full four-case status matrix, prerequisite checks, and multi-TUI next-step commands live in `reference/task-status-update.md`. Read `reference/task-status-update.md` before updating task state.
46
46
 
47
+ > **IMPORTANT**: When showing the next step, output every TUI command format in full and directly use the standard template from `reference/task-status-update.md`.
48
+
47
49
  Append the Commit Activity Log entry and choose exactly one next-step case:
48
50
  - final commit -> `complete-task {task-id}`
49
51
  - more work remains -> update task.md and stop
50
52
  - ready for review -> `review-task {task-id}`
51
53
  - ready for PR -> `create-pr`
52
54
 
55
+ ## 6. Verification Gate
56
+
57
+ If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
58
+
59
+ ```bash
60
+ node .agents/scripts/validate-artifact.js gate commit .agents/workspace/active/{task-id}
61
+ ```
62
+
63
+ Handle the result as follows:
64
+ - exit code 0 (all checks passed) -> continue the remaining wrap-up steps
65
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
66
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
67
+
68
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
69
+
53
70
  ## Notes
54
71
 
55
72
  - Never commit secrets such as `.env`, credentials, or keys
@@ -44,12 +44,29 @@ date "+%Y-%m-%d %H:%M:%S"
44
44
 
45
45
  > 完整的 4 种状态分支、前置条件检查和多 TUI 下一步命令见 `reference/task-status-update.md`。更新任务状态前,先读取 `reference/task-status-update.md`。
46
46
 
47
+ > **重要**:向用户展示下一步时,必须完整输出所有 TUI 命令格式,并直接使用 `reference/task-status-update.md` 中对应场景的标准模板。
48
+
47
49
  追加 Commit 的 Activity Log,并且只能选择一个下一步分支:
48
50
  - 最终提交 -> `complete-task {task-id}`
49
51
  - 还有后续工作 -> 更新 task.md 后停止
50
52
  - 准备审查 -> `review-task {task-id}`
51
53
  - 准备创建 PR -> `create-pr`
52
54
 
55
+ ## 6. 完成校验
56
+
57
+ 如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
58
+
59
+ ```bash
60
+ node .agents/scripts/validate-artifact.js gate commit .agents/workspace/active/{task-id}
61
+ ```
62
+
63
+ 处理结果:
64
+ - 退出码 0(全部通过)-> 继续后续收尾步骤
65
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
66
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
67
+
68
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
69
+
53
70
  ## 注意事项
54
71
 
55
72
  - 不要提交 `.env`、凭据、密钥等敏感文件
@@ -0,0 +1,22 @@
1
+ {
2
+ "skill": "commit",
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
+ },
16
+ "activity-log": {
17
+ "expected_action_pattern": "Commit",
18
+ "freshness_minutes": 30
19
+ },
20
+ "github-sync": null
21
+ }
22
+ }
@@ -82,7 +82,7 @@ Required next-step commands:
82
82
 
83
83
  ```text
84
84
  Next step - create Pull Request:
85
- - Claude Code / OpenCode: /create-pr
86
- - Gemini CLI: /agent-infra:create-pr
87
- - Codex CLI: $create-pr
85
+ - Claude Code / OpenCode: /create-pr {task-id}
86
+ - Gemini CLI: /agent-infra:create-pr {task-id}
87
+ - Codex CLI: $create-pr {task-id}
88
88
  ```
@@ -82,7 +82,7 @@ date "+%Y-%m-%d %H:%M:%S"
82
82
 
83
83
  ```text
84
84
  下一步 - 创建 Pull Request:
85
- - Claude Code / OpenCode: /create-pr
86
- - Gemini CLI: /agent-infra:create-pr
87
- - Codex CLI: $create-pr
85
+ - Claude Code / OpenCode: /create-pr {task-id}
86
+ - Gemini CLI: /agent-infra:create-pr {task-id}
87
+ - Codex CLI: $create-pr {task-id}
88
88
  ```
@@ -82,22 +82,36 @@ ls .agents/workspace/completed/{task-id}/task.md
82
82
 
83
83
  Confirm the task directory was successfully moved.
84
84
 
85
- ### 6. Sync to Issue (Optional)
85
+ ### 6. Sync to Issue
86
86
 
87
- Check whether `task.md` includes an `issue_number` field whose value is neither empty nor `N/A`. If not, **skip this step and output nothing**.
87
+ Check whether `task.md` includes a valid `issue_number`. If not, skip this step and output nothing.
88
88
 
89
- If a valid `issue_number` exists, optionally sync the completion status:
89
+ > Issue sync rules live in `.agents/rules/issue-sync.md`. Read that file before syncing.
90
90
 
91
- > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
91
+ If a valid `issue_number` exists:
92
+ - First scan and backfill unpublished `task.md`, `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` comments using the backfill rules in `.agents/rules/issue-sync.md` (`task.md` uses the idempotent update path)
93
+ - Backfill checked `## Requirements` items to the Issue body
94
+ - Do not set any `status:` label — status labels are automatically cleared when the Issue is closed
95
+ - Finally create or update the summary comment marked with `<!-- sync-issue:{task-id}:summary -->`
92
96
 
97
+ ### 7. 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 complete-task .agents/workspace/completed/{task-id} --format text
93
103
  ```
94
- (Optional) Sync completion status to the GitHub Issue:
95
- - Claude Code / OpenCode: /sync-issue {issue_number}
96
- - Gemini CLI: /{{project}}:sync-issue {issue_number}
97
- - Codex CLI: $sync-issue {issue_number}
98
- ```
99
104
 
100
- ### 7. Inform User
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
+ ### 8. Inform User
113
+
114
+ > Execute this step only after the verification gate passes.
101
115
 
102
116
  Output format:
103
117
  ```
@@ -82,22 +82,36 @@ ls .agents/workspace/completed/{task-id}/task.md
82
82
 
83
83
  确认任务目录已成功移动。
84
84
 
85
- ### 6. 同步到 Issue(可选)
85
+ ### 6. 同步到 Issue
86
86
 
87
- 检查 `task.md` 中是否存在 `issue_number` 字段,且其值不为空也不为 `N/A`。如果没有,**跳过此步骤,不输出任何内容**。
87
+ 检查 `task.md` 中是否存在有效的 `issue_number`。如果没有,跳过此步骤且不输出任何内容。
88
88
 
89
- 如果存在有效的 `issue_number`,可选择同步完成状态:
89
+ > Issue 同步规则见 `.agents/rules/issue-sync.md`。执行同步前先读取该文件。
90
90
 
91
- > **重要**:以下列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
91
+ 如果存在有效的 `issue_number`:
92
+ - 先按 `.agents/rules/issue-sync.md` 的补发规则扫描并补发未发布的 `task.md`、`analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md` 评论(`task.md` 走幂等更新路径)
93
+ - 兜底同步 `## 需求` 中已勾选的条目到 Issue body
94
+ - 不要设置 `status:` label — Issue 关闭后 status label 会被自动清除
95
+ - 最后创建或更新 `<!-- sync-issue:{task-id}:summary -->` 标记的 summary 评论
92
96
 
97
+ ### 7. 完成校验
98
+
99
+ 运行完成校验,确认任务产物和同步状态符合规范:
100
+
101
+ ```bash
102
+ node .agents/scripts/validate-artifact.js gate complete-task .agents/workspace/completed/{task-id} --format text
93
103
  ```
94
- (可选)同步完成状态到 GitHub Issue:
95
- - Claude Code / OpenCode:/sync-issue {issue_number}
96
- - Gemini CLI:/{{project}}:sync-issue {issue_number}
97
- - Codex CLI:$sync-issue {issue_number}
98
- ```
99
104
 
100
- ### 7. 告知用户
105
+ 处理结果:
106
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
107
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
108
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
109
+
110
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
111
+
112
+ ### 8. 告知用户
113
+
114
+ > 仅在校验通过后执行本步骤。
101
115
 
102
116
  输出格式:
103
117
  ```
@@ -0,0 +1,30 @@
1
+ {
2
+ "skill": "complete-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
+ "completed_at"
15
+ ],
16
+ "expected_status": "completed",
17
+ "require_completed_at": true
18
+ },
19
+ "activity-log": {
20
+ "expected_action_pattern": "Completed",
21
+ "freshness_minutes": 30
22
+ },
23
+ "github-sync": {
24
+ "when": "issue_number_exists",
25
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:summary -->",
26
+ "verify_task_comment_content": true,
27
+ "sync_checked_requirements": true
28
+ }
29
+ }
30
+ }
@@ -10,6 +10,7 @@ Create the base GitHub Issue from `task.md` and write `issue_number` back to the
10
10
  ## Boundary / Critical Rules
11
11
 
12
12
  - Build the Issue title and body from `task.md` only
13
+ - Issue title format: `type(scope): description` - map `type` from task.md (`feature` -> `feat`, `bugfix` -> `fix`, `refactor` -> `refactor`, `docs` -> `docs`, `chore` -> `chore`), infer scope from the affected module (omit it if unclear), and use the task title from task.md verbatim for the description (do not translate or rewrite)
13
14
  - Do not read `analysis.md`, `plan.md`, `implementation.md`, or review artifacts
14
15
  - The only durable outputs are the GitHub Issue and the `issue_number` update in task.md
15
16
  - After executing this skill, you **must** immediately update task.md
@@ -26,7 +27,7 @@ If `issue_number` already exists and is not empty or `N/A`, confirm with the use
26
27
 
27
28
  ### 2. Extract Task Information
28
29
 
29
- Extract the title, `## Description`, `## Requirements`, `type`, and `milestone` from task.md.
30
+ Extract the title, `## Description`, `## Requirements`, `type`, and `milestone` from task.md. Build the Issue title by mapping task.md `type` to a Conventional Commits type, inferring scope, and formatting it as `cc_type(scope): task_title` or `cc_type: task_title` when scope is unclear.
30
31
 
31
32
  ### 3. Build Issue Content
32
33
 
@@ -53,9 +54,44 @@ date "+%Y-%m-%d %H:%M:%S"
53
54
 
54
55
  Write back `issue_number`, update `updated_at`, and append the Create Issue Activity Log entry.
55
56
 
56
- ### 6. Inform User
57
+ ### 5.1 Backfill Existing Artifacts
57
58
 
58
- Show the Issue number, URL, labels, Issue Type, milestone result, confirm that `issue_number` was written back, and include the next `sync-issue` command in every TUI format.
59
+ If artifact files already exist in the task directory, backfill them in this order:
60
+
61
+ 1. `task.md` -> `<!-- sync-issue:{task-id}:task -->` comment (idempotent create or update)
62
+ 2. Backfill existing `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` files in filename order
63
+
64
+ Every backfill action must follow the raw publishing, task.md sync, and chunking rules in `.agents/rules/issue-sync.md`.
65
+
66
+ ### 6. Verification Gate
67
+
68
+ Run the verification gate to confirm the task artifact and sync state are valid:
69
+
70
+ ```bash
71
+ node .agents/scripts/validate-artifact.js gate create-issue .agents/workspace/active/{task-id} --format text
72
+ ```
73
+
74
+ Handle the result as follows:
75
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
76
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
77
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
78
+
79
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
80
+
81
+ ### 7. Inform User
82
+
83
+ > Execute this step only after the verification gate passes.
84
+
85
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
86
+
87
+ Show the Issue number, URL, labels, Issue Type, milestone result, confirm that `issue_number` was written back, and include the next-step commands in every TUI format:
88
+
89
+ ```
90
+ Next step - run requirements analysis:
91
+ - Claude Code / OpenCode: /analyze-task {task-id}
92
+ - Gemini CLI: /{{project}}:analyze-task {task-id}
93
+ - Codex CLI: $analyze-task {task-id}
94
+ ```
59
95
 
60
96
  ## Completion Checklist
61
97
 
@@ -63,7 +99,7 @@ Show the Issue number, URL, labels, Issue Type, milestone result, confirm that `
63
99
  - [ ] Used `task.md` as the only content source
64
100
  - [ ] Recorded `issue_number` in task.md
65
101
  - [ ] Updated `updated_at` and appended the Activity Log entry
66
- - [ ] Included all TUI formats for the next `sync-issue` step
102
+ - [ ] Included all TUI formats for the next-step commands
67
103
 
68
104
  ## STOP
69
105
 
@@ -71,7 +107,7 @@ Stop after the checklist. Do not start detailed progress sync here.
71
107
 
72
108
  ## Notes
73
109
 
74
- - `create-issue` creates the base Issue; `sync-issue` publishes detailed progress later
110
+ - `create-issue` creates the base Issue; later status, comments, and checkboxes are maintained by workflow skills and GitHub Actions
75
111
  - If no valid labels survive filtering, create the Issue without labels instead of failing
76
112
  - If Issue Type or milestone setup fails, continue and record the fallback outcome
77
113
 
@@ -10,6 +10,7 @@ description: "从任务文件创建 GitHub Issue"
10
10
  ## 行为边界 / 关键规则
11
11
 
12
12
  - Issue 标题和正文只能来自 `task.md`
13
+ - Issue 标题格式为 `type(scope): 描述`——type 从 task.md 的 `type` 字段映射(feature→feat, bugfix→fix, refactor→refactor, docs→docs, chore→chore),scope 从受影响模块推断(无法确定时省略),描述使用 task.md 中的任务标题原文(不要翻译或改写)
13
14
  - 不要读取 `analysis.md`、`plan.md`、`implementation.md` 或审查产物
14
15
  - 持久产物只有 GitHub Issue 本身,以及 task.md 中的 `issue_number` 更新
15
16
  - 执行本技能后,你**必须**立即更新 task.md
@@ -26,7 +27,7 @@ description: "从任务文件创建 GitHub Issue"
26
27
 
27
28
  ### 2. 提取任务信息
28
29
 
29
- 从 task.md 提取标题、`## Description`、`## Requirements`、`type` 和 `milestone`。
30
+ 从 task.md 提取标题、`## Description`、`## Requirements`、`type` 和 `milestone`。构造 Issue 标题:将 task.md 的 `type` 映射为 Conventional Commits type,推断 scope,拼接为 `cc_type(scope): task_title` 或 `cc_type: task_title`(scope 不确定时省略)。
30
31
 
31
32
  ### 3. 构建 Issue 内容
32
33
 
@@ -53,9 +54,44 @@ date "+%Y-%m-%d %H:%M:%S"
53
54
 
54
55
  回写 `issue_number`,更新 `updated_at`,并追加 Create Issue 的 Activity Log。
55
56
 
56
- ### 6. 告知用户
57
+ ### 5.1 补发已有产物
57
58
 
58
- 展示 Issue 编号、URL、labels、Issue Type、milestone 结果,确认 `issue_number` 已回写,并完整输出所有 TUI 里的下一步 `sync-issue` 命令。
59
+ 如果任务目录中已存在产物文件,按以下顺序补发:
60
+
61
+ 1. `task.md` → `<!-- sync-issue:{task-id}:task -->` 评论(幂等创建或更新)
62
+ 2. 按文件名排序补发已存在的 `analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md`
63
+
64
+ 所有补发动作都必须遵循 `.agents/rules/issue-sync.md` 的原文发布、task.md 同步和分片规则。
65
+
66
+ ### 6. 完成校验
67
+
68
+ 运行完成校验,确认任务产物和同步状态符合规范:
69
+
70
+ ```bash
71
+ node .agents/scripts/validate-artifact.js gate create-issue .agents/workspace/active/{task-id} --format text
72
+ ```
73
+
74
+ 处理结果:
75
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
76
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
77
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
78
+
79
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
80
+
81
+ ### 7. 告知用户
82
+
83
+ > 仅在校验通过后执行本步骤。
84
+
85
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
86
+
87
+ 展示 Issue 编号、URL、labels、Issue Type、milestone 结果,确认 `issue_number` 已回写,并完整输出所有 TUI 里的下一步命令:
88
+
89
+ ```
90
+ 下一步 - 执行需求分析:
91
+ - Claude Code / OpenCode:/analyze-task {task-id}
92
+ - Gemini CLI:/agent-infra:analyze-task {task-id}
93
+ - Codex CLI:$analyze-task {task-id}
94
+ ```
59
95
 
60
96
  ## 完成检查清单
61
97
 
@@ -63,7 +99,7 @@ date "+%Y-%m-%d %H:%M:%S"
63
99
  - [ ] 已仅使用 `task.md` 作为内容来源
64
100
  - [ ] 已在 task.md 中记录 `issue_number`
65
101
  - [ ] 已更新 `updated_at` 并追加 Activity Log
66
- - [ ] 已输出所有 TUI 格式的 `sync-issue` 下一步命令
102
+ - [ ] 已输出所有 TUI 格式的下一步命令
67
103
 
68
104
  ## 停止
69
105
 
@@ -71,7 +107,7 @@ date "+%Y-%m-%d %H:%M:%S"
71
107
 
72
108
  ## 注意事项
73
109
 
74
- - `create-issue` 只负责创建基础 Issue;详细进度由 `sync-issue` 发布
110
+ - `create-issue` 只负责创建基础 Issue;后续状态、评论和复选框由工作流技能与 GitHub Actions 维护
75
111
  - 如果过滤后没有有效 label,允许不带 label 创建 Issue
76
112
  - 如果 Issue Type 或 milestone 设置失败,继续执行并记录结果
77
113
 
@@ -0,0 +1,27 @@
1
+ {
2
+ "skill": "create-issue",
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
+ "require_issue_number": true
16
+ },
17
+ "activity-log": {
18
+ "expected_action_pattern": "Create Issue",
19
+ "freshness_minutes": 30
20
+ },
21
+ "github-sync": {
22
+ "when": "issue_number_exists",
23
+ "issue_must_exist": true,
24
+ "verify_task_comment_content": true
25
+ }
26
+ }
27
+ }
@@ -28,7 +28,8 @@ Fallback label mapping:
28
28
  | `enhancement` | `type: enhancement` |
29
29
  | `docs`, `documentation` | `type: documentation` |
30
30
  | `dependency-upgrade` | `type: dependency-upgrade` |
31
- | `task`, `chore`, `refactor`, `refactoring` | `type: task` |
31
+ | `task`, `chore` | `type: task` |
32
+ | `refactor`, `refactoring` | `type: enhancement` |
32
33
  | other values | skip |
33
34
 
34
35
  Issue Type fallback mapping:
@@ -56,22 +57,20 @@ gh api "orgs/$owner/issue-types" --jq '.[].name'
56
57
  gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}" --silent
57
58
  ```
58
59
 
59
- `in:` labels:
60
+ `in:` labels (coarse selection):
60
61
 
61
62
  ```bash
62
63
  gh label list --search "in:" --limit 50 --json name --jq '.[].name'
63
64
  gh issue edit {issue-number} --add-label "in: {module}"
64
65
  ```
65
66
 
66
- Only add relevant `in:` labels. Do not remove existing `in:` labels, and do not fail Issue creation when `in:` labels are unavailable or irrelevant.
67
+ Use the returned labels to do semantic matching against the task.md title and description:
68
+ - add a label when the task **explicitly mentions** a module (for example, "fix CLI argument parsing" -> `in: cli`)
69
+ - add a label when the task **strongly implies** a module
70
+ - skip the label when the mapping is ambiguous or uncertain
67
71
 
68
- Skip unavailable labels, Issue Types, or milestones without failing the Issue creation flow.
72
+ Principle: prefer missing labels over wrong labels. Coarse selection does not need to be perfect because implement-task / create-pr will refine `in:` labels from actual changed files later.
69
73
 
70
- Final user output must include every TUI `sync-issue` command format:
74
+ Only add relevant `in:` labels. Do not fail Issue creation when `in:` labels are unavailable or irrelevant.
71
75
 
72
- ```text
73
- Next step - sync progress to the Issue:
74
- - Claude Code / OpenCode: /sync-issue {task-id}
75
- - Gemini CLI: /agent-infra:sync-issue {task-id}
76
- - Codex CLI: $sync-issue {task-id}
77
- ```
76
+ Skip unavailable labels, Issue Types, or milestones without failing the Issue creation flow.