@fitlab-ai/agent-infra 0.4.2 → 0.4.4

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 (137) hide show
  1. package/README.md +24 -34
  2. package/README.zh-CN.md +24 -34
  3. package/lib/defaults.json +5 -0
  4. package/lib/init.js +1 -0
  5. package/lib/update.js +13 -1
  6. package/package.json +3 -3
  7. package/templates/.agents/README.md +16 -2
  8. package/templates/.agents/README.zh-CN.md +16 -2
  9. package/templates/.agents/rules/issue-sync.md +194 -0
  10. package/templates/.agents/rules/issue-sync.zh-CN.md +194 -0
  11. package/templates/.agents/rules/milestone-inference.md +102 -0
  12. package/templates/.agents/rules/milestone-inference.zh-CN.md +102 -0
  13. package/templates/.agents/scripts/validate-artifact.js +1444 -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 +43 -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/cancel-task/SKILL.md +142 -0
  24. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +142 -0
  25. package/templates/.agents/skills/cancel-task/config/verify.json +30 -0
  26. package/templates/.agents/skills/close-codescan/SKILL.md +7 -0
  27. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -0
  28. package/templates/.agents/skills/close-dependabot/SKILL.md +7 -0
  29. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -0
  30. package/templates/.agents/skills/commit/SKILL.md +17 -0
  31. package/templates/.agents/skills/commit/SKILL.zh-CN.md +17 -0
  32. package/templates/.agents/skills/commit/config/verify.json +22 -0
  33. package/templates/.agents/skills/complete-task/SKILL.md +25 -10
  34. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +25 -10
  35. package/templates/.agents/skills/complete-task/config/verify.json +35 -0
  36. package/templates/.agents/skills/create-issue/SKILL.md +42 -6
  37. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +42 -6
  38. package/templates/.agents/skills/create-issue/config/verify.json +29 -0
  39. package/templates/.agents/skills/create-issue/reference/label-and-type.md +13 -12
  40. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +13 -12
  41. package/templates/.agents/skills/create-pr/SKILL.md +44 -10
  42. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +44 -10
  43. package/templates/.agents/skills/create-pr/config/verify.json +27 -0
  44. package/templates/.agents/skills/create-pr/reference/branch-strategy.md +3 -3
  45. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +3 -3
  46. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.md +6 -6
  47. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.zh-CN.md +6 -6
  48. package/templates/.agents/skills/create-pr/reference/pr-body-template.md +8 -7
  49. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +8 -7
  50. package/templates/.agents/skills/create-task/SKILL.md +25 -3
  51. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +25 -3
  52. package/templates/.agents/skills/create-task/config/verify.json +24 -0
  53. package/templates/.agents/skills/implement-task/SKILL.md +47 -8
  54. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +47 -8
  55. package/templates/.agents/skills/implement-task/config/verify.json +43 -0
  56. package/templates/.agents/skills/implement-task/reference/branch-management.md +48 -0
  57. package/templates/.agents/skills/implement-task/reference/branch-management.zh-CN.md +49 -0
  58. package/templates/.agents/skills/implement-task/reference/output-template.md +20 -0
  59. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +20 -0
  60. package/templates/.agents/skills/import-codescan/SKILL.md +18 -7
  61. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +18 -7
  62. package/templates/.agents/skills/import-codescan/config/verify.json +24 -0
  63. package/templates/.agents/skills/import-dependabot/SKILL.md +18 -7
  64. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +18 -7
  65. package/templates/.agents/skills/import-dependabot/config/verify.json +24 -0
  66. package/templates/.agents/skills/import-issue/SKILL.md +28 -1
  67. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +28 -1
  68. package/templates/.agents/skills/import-issue/config/verify.json +27 -0
  69. package/templates/.agents/skills/init-labels/SKILL.md +40 -10
  70. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +40 -10
  71. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +1 -22
  72. package/templates/.agents/skills/init-milestones/SKILL.md +13 -0
  73. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +13 -0
  74. package/templates/.agents/skills/plan-task/SKILL.md +29 -75
  75. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +29 -75
  76. package/templates/.agents/skills/plan-task/config/verify.json +44 -0
  77. package/templates/.agents/skills/refine-task/SKILL.md +41 -2
  78. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +41 -2
  79. package/templates/.agents/skills/refine-task/config/verify.json +39 -0
  80. package/templates/.agents/skills/refine-task/reference/fix-workflow.md +7 -7
  81. package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +7 -7
  82. package/templates/.agents/skills/refine-title/SKILL.md +10 -2
  83. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +10 -2
  84. package/templates/.agents/skills/restore-task/SKILL.md +159 -0
  85. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +159 -0
  86. package/templates/.agents/skills/restore-task/config/verify.json +24 -0
  87. package/templates/.agents/skills/review-task/SKILL.md +25 -1
  88. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +25 -1
  89. package/templates/.agents/skills/review-task/config/verify.json +42 -0
  90. package/templates/.agents/skills/update-agent-infra/SKILL.md +11 -0
  91. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +11 -0
  92. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +6 -1
  93. package/templates/.agents/templates/task.md +3 -7
  94. package/templates/.agents/templates/task.zh-CN.md +3 -7
  95. package/templates/.claude/commands/archive-tasks.md +9 -0
  96. package/templates/.claude/commands/archive-tasks.zh-CN.md +9 -0
  97. package/templates/.claude/commands/cancel-task.md +9 -0
  98. package/templates/.claude/commands/cancel-task.zh-CN.md +9 -0
  99. package/templates/.claude/commands/restore-task.md +9 -0
  100. package/templates/.claude/commands/restore-task.zh-CN.md +9 -0
  101. package/templates/.gemini/commands/_project_/archive-tasks.toml +10 -0
  102. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +10 -0
  103. package/templates/.gemini/commands/_project_/cancel-task.toml +8 -0
  104. package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +8 -0
  105. package/templates/.gemini/commands/_project_/restore-task.toml +8 -0
  106. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +8 -0
  107. package/templates/.github/workflows/status-label.yml +85 -0
  108. package/templates/.opencode/commands/archive-tasks.md +11 -0
  109. package/templates/.opencode/commands/archive-tasks.zh-CN.md +11 -0
  110. package/templates/.opencode/commands/cancel-task.md +11 -0
  111. package/templates/.opencode/commands/cancel-task.zh-CN.md +11 -0
  112. package/templates/.opencode/commands/restore-task.md +11 -0
  113. package/templates/.opencode/commands/restore-task.zh-CN.md +11 -0
  114. package/templates/.agents/skills/sync-issue/SKILL.md +0 -93
  115. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +0 -93
  116. package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -84
  117. package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -84
  118. package/templates/.agents/skills/sync-issue/reference/label-sync.md +0 -62
  119. package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +0 -62
  120. package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +0 -37
  121. package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +0 -37
  122. package/templates/.agents/skills/sync-pr/SKILL.md +0 -87
  123. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +0 -87
  124. package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +0 -54
  125. package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +0 -54
  126. package/templates/.claude/commands/sync-issue.md +0 -8
  127. package/templates/.claude/commands/sync-issue.zh-CN.md +0 -8
  128. package/templates/.claude/commands/sync-pr.md +0 -8
  129. package/templates/.claude/commands/sync-pr.zh-CN.md +0 -8
  130. package/templates/.gemini/commands/_project_/sync-issue.toml +0 -8
  131. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +0 -8
  132. package/templates/.gemini/commands/_project_/sync-pr.toml +0 -8
  133. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +0 -8
  134. package/templates/.opencode/commands/sync-issue.md +0 -11
  135. package/templates/.opencode/commands/sync-issue.zh-CN.md +0 -11
  136. package/templates/.opencode/commands/sync-pr.md +0 -11
  137. package/templates/.opencode/commands/sync-pr.zh-CN.md +0 -11
@@ -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
+ }
@@ -70,7 +70,34 @@ Update `.agents/workspace/active/{task-id}/task.md`:
70
70
  - {yyyy-MM-dd HH:mm:ss} — **Import Issue** by {agent} — Issue #{number} imported
71
71
  ```
72
72
 
73
- ### 5. Inform User
73
+ ### 5. Assign the Issue Assignee
74
+
75
+ If task.md contains a valid `issue_number`, assign the Issue to the current executor:
76
+
77
+ ```bash
78
+ gh issue edit {issue-number} --add-assignee @me 2>/dev/null || true
79
+ ```
80
+
81
+ See the Assignee Sync rules in `.agents/rules/issue-sync.md`.
82
+
83
+ ### 6. Verification Gate
84
+
85
+ Run the verification gate to confirm the task artifact and sync state are valid:
86
+
87
+ ```bash
88
+ node .agents/scripts/validate-artifact.js gate import-issue .agents/workspace/active/{task-id} --format text
89
+ ```
90
+
91
+ Handle the result as follows:
92
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
93
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
94
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
95
+
96
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
97
+
98
+ ### 7. Inform User
99
+
100
+ > Execute this step only after the verification gate passes.
74
101
 
75
102
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
76
103
 
@@ -70,7 +70,34 @@ date "+%Y-%m-%d %H:%M:%S"
70
70
  - {yyyy-MM-dd HH:mm:ss} — **Import Issue** by {agent} — Issue #{number} imported
71
71
  ```
72
72
 
73
- ### 5. 告知用户
73
+ ### 5. 分配 Issue Assignee
74
+
75
+ 如果 task.md 中存在有效的 `issue_number`,将 Issue 分配给当前执行者:
76
+
77
+ ```bash
78
+ gh issue edit {issue-number} --add-assignee @me 2>/dev/null || true
79
+ ```
80
+
81
+ 参见 `.agents/rules/issue-sync.md` 的 Assignee 同步规则。
82
+
83
+ ### 6. 完成校验
84
+
85
+ 运行完成校验,确认任务产物和同步状态符合规范:
86
+
87
+ ```bash
88
+ node .agents/scripts/validate-artifact.js gate import-issue .agents/workspace/active/{task-id} --format text
89
+ ```
90
+
91
+ 处理结果:
92
+ - 退出码 0(全部通过)-> 继续到「告知用户」步骤
93
+ - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
94
+ - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
95
+
96
+ 将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
97
+
98
+ ### 7. 告知用户
99
+
100
+ > 仅在校验通过后执行本步骤。
74
101
 
75
102
  > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
76
103
 
@@ -0,0 +1,27 @@
1
+ {
2
+ "skill": "import-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
+ "expected_step": "requirement-analysis",
16
+ "require_issue_number": true
17
+ },
18
+ "activity-log": {
19
+ "expected_action_pattern": "Import Issue",
20
+ "freshness_minutes": 30
21
+ },
22
+ "github-sync": {
23
+ "when": "issue_number_exists",
24
+ "issue_must_exist": true
25
+ }
26
+ }
27
+ }
@@ -29,8 +29,6 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
29
29
  The script is responsible for:
30
30
  - Capturing the current label snapshot before making changes
31
31
  - Creating or updating the standard label set with `gh label create --force`
32
- - Auto-detecting top-level directories and creating one `in:` label per valid directory
33
- - Falling back to `in: core` when no eligible directory is detected
34
32
  - Reporting unmatched GitHub default labels such as `question` and `wontfix`
35
33
  - Printing the final execution summary
36
34
 
@@ -50,25 +48,57 @@ The script manages these common label families:
50
48
  | `status:` | Yes | — | PRs already have their own state flow (Open/Draft/Merged/Closed); Issues use `status:` labels for project tracking |
51
49
  | `in:` | Yes | Yes | Both Issues and PRs need module-based filtering |
52
50
 
53
- ### 4. Scope discovery rules
51
+ ### 4. Configure the `in:` Label Mapping
54
52
 
55
- Directory-derived labels follow these rules:
56
- - Detect top-level project directories only
57
- - Skip hidden directories and common generated folders
58
- - Create `in: core` only when no valid directory remains
59
- - Do not create any `theme:` labels in this skill
53
+ Check whether `.agents/.airc.json` already contains a `labels.in` field.
54
+
55
+ #### 4.1 Existing mapping
56
+
57
+ Show the current mapping and ask whether it should be updated.
58
+ - if no: continue to step 4.3
59
+ - if yes: continue to step 4.2
60
+
61
+ #### 4.2 Missing mapping or user-requested update
62
+
63
+ 1. Scan top-level project directories while excluding hidden and generated folders.
64
+ 2. Analyze the directory contents and suggest meaningful module groupings.
65
+ 3. Show the proposed `in:` label mapping and refine it through the user's natural-language feedback.
66
+ 4. If the user declines configuration, generate a 1:1 fallback mapping for each top-level directory (`{dir}/`).
67
+
68
+ #### 4.3 Write the mapping and create labels
69
+
70
+ 1. Write the final mapping to `.agents/.airc.json` under `labels.in`.
71
+ 2. Create one `in: {key}` label for each mapping key:
72
+ ```bash
73
+ gh label create "in: {key}" --color EBF8DF --description "Module: {key}" --force
74
+ ```
75
+ 3. After user confirmation, delete stale `in:` labels that are no longer present in the final mapping.
60
76
 
61
77
  ### 5. Output and behavior guarantees
62
78
 
63
79
  The summary must include:
64
80
  - Number of common labels created or updated
65
- - Number of `in:` labels created or updated
81
+ - The written `labels.in` mapping
82
+ - The number of `in:` labels derived from the mapping keys
66
83
  - Confirmation that exact-match GitHub defaults were overwritten
67
84
  - Any unmatched GitHub default labels still present
68
85
 
69
86
  Operational notes:
70
87
  - The operation is idempotent because every label uses `gh label create --force`.
71
- - If the detected `in:` labels need refinement, adjust them manually after initialization.
88
+ - `in:` labels are managed by the AI-guided step together with the `.airc.json` mapping.
89
+
90
+ ### 6. Inform User
91
+
92
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
93
+
94
+ After summarizing the label initialization, show:
95
+
96
+ ```
97
+ Next step - initialize milestones (optional):
98
+ - Claude Code / OpenCode: /init-milestones
99
+ - Gemini CLI: /{{project}}:init-milestones
100
+ - Codex CLI: $init-milestones
101
+ ```
72
102
 
73
103
  ## Error Handling
74
104
 
@@ -29,8 +29,6 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
29
29
  脚本负责:
30
30
  - 在修改前保存当前 label 快照
31
31
  - 使用 `gh label create --force` 创建或更新标准 label 集合
32
- - 自动探测顶层目录,并为有效目录创建对应的 `in:` label
33
- - 在没有可用目录时回退到 `in: core`
34
32
  - 提示仍然存在的 GitHub 默认 labels,例如 `question` 和 `wontfix`
35
33
  - 输出最终执行摘要
36
34
 
@@ -50,25 +48,57 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
50
48
  | `status:` | Yes | — | PR 有自身状态流转(Open/Draft/Merged/Closed);Issue 使用 `status:` label 标记项目管理状态 |
51
49
  | `in:` | Yes | Yes | Issue 和 PR 均需按模块筛选 |
52
50
 
53
- ### 4. 范围探测规则
51
+ ### 4. 配置 `in:` label 映射
54
52
 
55
- 目录派生 label 遵循以下规则:
56
- - 只探测项目顶层目录
57
- - 排除隐藏目录和常见构建/缓存目录
58
- - 仅当没有有效目录时才创建 `in: core`
59
- - 本技能不创建任何 `theme:` labels
53
+ 检查 `.agents/.airc.json` 中是否已有 `labels.in` 字段。
54
+
55
+ #### 4.1 已有映射
56
+
57
+ 展示当前映射,询问用户是否需要更新。
58
+ - 不需要:跳到步骤 4.3
59
+ - 需要:按步骤 4.2 处理
60
+
61
+ #### 4.2 无映射或用户要求更新
62
+
63
+ 1. 扫描项目顶层目录,排除隐藏目录和常见构建目录。
64
+ 2. 分析目录内容,给出有意义的模块分组建议。
65
+ 3. 向用户展示建议的 `in:` label 映射,并根据自然语言反馈迭代调整。
66
+ 4. 如果用户拒绝配置,则为每个顶层目录生成 1:1 默认映射(`{dir}/`)。
67
+
68
+ #### 4.3 写入配置并创建 label
69
+
70
+ 1. 将最终映射写入 `.agents/.airc.json` 的 `labels.in` 字段。
71
+ 2. 为每个映射 key 创建 `in: {key}` label:
72
+ ```bash
73
+ gh label create "in: {key}" --color EBF8DF --description "Module: {key}" --force
74
+ ```
75
+ 3. 询问用户确认后,清理不在最终映射中的旧 `in:` label。
60
76
 
61
77
  ### 5. 输出与行为保证
62
78
 
63
79
  摘要必须包含:
64
80
  - 创建或更新的通用 labels 数量
65
- - 创建或更新的 `in:` labels 数量
81
+ - 写入的 `labels.in` 映射结果
82
+ - 按映射 key 计算的 `in:` labels 数量
66
83
  - 名称完全匹配的 GitHub 默认 labels 已被覆盖的说明
67
84
  - 仍然存在的未匹配 GitHub 默认 labels
68
85
 
69
86
  执行说明:
70
87
  - 整个操作具备幂等性,因为每个 label 都使用 `gh label create --force`。
71
- - 如果自动探测出的 `in:` labels 需要细化,请在初始化后手动调整。
88
+ - `in:` labels 由 AI 引导步骤和 `.airc.json` 映射统一管理。
89
+
90
+ ### 6. 告知用户
91
+
92
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
93
+
94
+ 输出 labels 初始化摘要后,提示:
95
+
96
+ ```
97
+ 下一步 - 初始化 Milestones(可选):
98
+ - Claude Code / OpenCode:/init-milestones
99
+ - Gemini CLI:/agent-infra:init-milestones
100
+ - Codex CLI:$init-milestones
101
+ ```
72
102
 
73
103
  ## 错误处理
74
104
 
@@ -58,25 +58,6 @@ while IFS="$(printf '\t')" read -r name color description; do
58
58
  gh label create "$name" --color "$color" --description "$description" --force
59
59
  done < "$tmpdir/common.tsv"
60
60
 
61
- project_dirs=$(
62
- find . -mindepth 1 -maxdepth 1 -type d ! -name '.*' |
63
- sed 's#^\./##' |
64
- grep -Ev '^(node_modules|vendor|dist|build|out|target|tmp|temp|log|logs|coverage|__pycache__)$' |
65
- sort -u
66
- )
67
-
68
- if [ -z "$project_dirs" ]; then
69
- project_dirs="core"
70
- fi
71
-
72
- printf '%s\n' "$project_dirs" | while IFS= read -r dir; do
73
- [ -n "$dir" ] || continue
74
- gh label create "in: $dir" \
75
- --color EBF8DF \
76
- --description "Issues in $dir" \
77
- --force
78
- done
79
-
80
61
  gh label list --limit 200 --json name --jq '.[].name' > "$tmpdir/final-names.txt"
81
62
  cp "$tmpdir/final-names.txt" "$tmpdir/final.txt"
82
63
 
@@ -88,13 +69,11 @@ for label in bug documentation duplicate enhancement invalid question wontfix; d
88
69
  done
89
70
 
90
71
  common_count="$(wc -l < "$tmpdir/common.tsv" | tr -d ' ')"
91
- in_count="$(printf '%s\n' "$project_dirs" | sed '/^$/d' | wc -l | tr -d ' ')"
92
72
 
93
73
  echo "GitHub Labels initialized."
94
74
  echo
95
75
  echo "Summary:"
96
76
  echo "- Common labels created or updated: $common_count"
97
- echo "- in: labels created or updated: $in_count"
98
77
  echo "- Exact-match GitHub defaults overwritten: good first issue, help wanted"
99
78
 
100
79
  if [ -s "$tmpdir/unmatched-defaults.txt" ]; then
@@ -108,4 +87,4 @@ echo
108
87
  echo "Notes:"
109
88
  echo "- theme: labels were intentionally not created."
110
89
  echo "- The operation is idempotent because every label uses gh label create --force."
111
- echo "- If the detected in: labels need refinement, adjust them manually after initialization."
90
+ echo "- in: labels are managed by the AI-guided step in the SKILL."
@@ -61,6 +61,19 @@ Operational notes:
61
61
  - Historical `X.Y.Z` tags create `X.Y.x` milestones as open and `X.Y.Z` milestones as closed.
62
62
  - Repositories with many tags may hit the GitHub API rate limit.
63
63
 
64
+ ### 5. Inform User
65
+
66
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
67
+
68
+ After summarizing the milestone initialization, show:
69
+
70
+ ```
71
+ Next step - initialize labels (optional):
72
+ - Claude Code / OpenCode: /init-labels
73
+ - Gemini CLI: /{{project}}:init-labels
74
+ - Codex CLI: $init-labels
75
+ ```
76
+
64
77
  ## Error Handling
65
78
 
66
79
  - `gh` not found: prompt "GitHub CLI (`gh`) is not installed"
@@ -61,6 +61,19 @@ bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
61
61
  - 历史 `X.Y.Z` tag 会生成开启状态的 `X.Y.x` 和关闭状态的 `X.Y.Z`。
62
62
  - 标签较多的仓库可能触发 GitHub API rate limit。
63
63
 
64
+ ### 5. 告知用户
65
+
66
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
67
+
68
+ 输出 milestones 初始化摘要后,提示:
69
+
70
+ ```
71
+ 下一步 - 初始化 Labels(可选):
72
+ - Claude Code / OpenCode:/init-labels
73
+ - Gemini CLI:/agent-infra:init-labels
74
+ - Codex CLI:$init-labels
75
+ ```
76
+
64
77
  ## 错误处理
65
78
 
66
79
  - 未找到 `gh`:提示 "GitHub CLI (`gh`) is not installed"
@@ -66,10 +66,11 @@ Follow the `technical-design` step in `.agents/workflows/feature-development.yam
66
66
  - [ ] Assess impact and risks
67
67
 
68
68
  **Design principles**:
69
- 1. **Simplicity**: prefer the simplest approach that satisfies the requirement
70
- 2. **Consistency**: follow existing code patterns and conventions
71
- 3. **Testability**: design for straightforward testing
72
- 4. **Reversibility**: prefer changes that are easy to roll back
69
+ 1. **Architectural soundness**: choose the structurally correct approach; diff size is not the primary criterion. Do not pile changes onto an unsound structure just to keep the diff small
70
+ 2. **Simplicity**: given a sound architecture, prefer the simplest approach and avoid over-engineering
71
+ 3. **Consistency**: follow existing code patterns and conventions
72
+ 4. **Testability**: design for straightforward testing
73
+ 5. **Reversibility**: prefer changes that are easy to roll back
73
74
 
74
75
  ### 6. Output Plan Document
75
76
 
@@ -95,7 +96,30 @@ Update `.agents/workspace/active/{task-id}/task.md`:
95
96
  - {yyyy-MM-dd HH:mm:ss} — **Technical Design (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
96
97
  ```
97
98
 
98
- ### 8. Inform User
99
+ If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
100
+ - Read `.agents/rules/issue-sync.md` before syncing
101
+ - Set `status: pending-design-work`
102
+ - Publish the `{plan-artifact}` comment
103
+ - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
104
+
105
+ ### 8. Verification Gate
106
+
107
+ Run the verification gate to confirm the task artifact and sync state are valid:
108
+
109
+ ```bash
110
+ node .agents/scripts/validate-artifact.js gate plan-task .agents/workspace/active/{task-id} {plan-artifact} --format text
111
+ ```
112
+
113
+ Handle the result as follows:
114
+ - exit code 0 (all checks passed) -> continue to the "Inform User" step
115
+ - exit code 1 (validation failed) -> fix the reported issues and run the gate again
116
+ - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
117
+
118
+ Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
119
+
120
+ ### 9. Inform User
121
+
122
+ > Execute this step only after the verification gate passes.
99
123
 
100
124
  > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
101
125
 
@@ -122,76 +146,6 @@ Next step - implement the task:
122
146
  - Codex CLI: $implement-task {task-id}
123
147
  ```
124
148
 
125
- ## Output Template
126
-
127
- ```markdown
128
- # Technical Plan
129
-
130
- - **Plan round**: Round {plan-round}
131
- - **Artifact file**: `{plan-artifact}`
132
-
133
- ## Problem Understanding
134
- {Summarize the problem to solve and the key constraints}
135
-
136
- ## Constraints
137
- - {Constraint 1}
138
- - {Constraint 2}
139
-
140
- ## Option Comparison
141
-
142
- ### Option A: {Name}
143
- - **Approach**: {Description}
144
- - **Pros**: {Advantages}
145
- - **Cons**: {Drawbacks}
146
-
147
- ### Option B: {Name}
148
- - **Approach**: {Description}
149
- - **Pros**: {Advantages}
150
- - **Cons**: {Drawbacks}
151
-
152
- ### Decision
153
- {Which option was chosen and why}
154
-
155
- ## Technical Approach
156
- {Detailed description of the selected approach}
157
-
158
- ## Implementation Steps
159
-
160
- ### Step 1: {Title}
161
- - **File**: `{file-path}`
162
- - **Action**: {What to do}
163
- - **Details**: {Specific details}
164
-
165
- ### Step 2: {Title}
166
- ...
167
-
168
- ## File List
169
-
170
- ### New Files
171
- - `{file-path}` - {Purpose}
172
-
173
- ### Modified Files
174
- - `{file-path}` - {Planned changes}
175
-
176
- ## Verification Strategy
177
-
178
- ### Unit Tests
179
- - {Test case 1}
180
- - {Test case 2}
181
-
182
- ### Manual Validation
183
- - {Validation step}
184
-
185
- ## Impact Assessment
186
- - Breaking change: {Yes/No - details}
187
- - Performance impact: {Assessment}
188
- - Security considerations: {Assessment}
189
-
190
- ## Risk Control
191
- - {Risk 1}: {Mitigation}
192
- - {Risk 2}: {Mitigation}
193
- ```
194
-
195
149
  ## Completion Checklist
196
150
 
197
151
  - [ ] Read and understood the requirements analysis