@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.
- package/README.md +24 -34
- package/README.zh-CN.md +24 -34
- package/lib/defaults.json +5 -0
- package/lib/init.js +1 -0
- package/lib/update.js +13 -1
- package/package.json +3 -3
- package/templates/.agents/README.md +16 -2
- package/templates/.agents/README.zh-CN.md +16 -2
- package/templates/.agents/rules/issue-sync.md +194 -0
- package/templates/.agents/rules/issue-sync.zh-CN.md +194 -0
- package/templates/.agents/rules/milestone-inference.md +102 -0
- package/templates/.agents/rules/milestone-inference.zh-CN.md +102 -0
- package/templates/.agents/scripts/validate-artifact.js +1444 -0
- package/templates/.agents/skills/analyze-task/SKILL.md +24 -1
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +24 -1
- package/templates/.agents/skills/analyze-task/config/verify.json +43 -0
- package/templates/.agents/skills/archive-tasks/SKILL.md +40 -0
- package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +40 -0
- package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +403 -0
- package/templates/.agents/skills/block-task/SKILL.md +25 -37
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +25 -37
- package/templates/.agents/skills/block-task/config/verify.json +28 -0
- package/templates/.agents/skills/cancel-task/SKILL.md +142 -0
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +142 -0
- package/templates/.agents/skills/cancel-task/config/verify.json +30 -0
- package/templates/.agents/skills/close-codescan/SKILL.md +7 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -0
- package/templates/.agents/skills/close-dependabot/SKILL.md +7 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -0
- package/templates/.agents/skills/commit/SKILL.md +17 -0
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +17 -0
- package/templates/.agents/skills/commit/config/verify.json +22 -0
- package/templates/.agents/skills/complete-task/SKILL.md +25 -10
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +25 -10
- package/templates/.agents/skills/complete-task/config/verify.json +35 -0
- package/templates/.agents/skills/create-issue/SKILL.md +42 -6
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +42 -6
- package/templates/.agents/skills/create-issue/config/verify.json +29 -0
- package/templates/.agents/skills/create-issue/reference/label-and-type.md +13 -12
- package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +13 -12
- package/templates/.agents/skills/create-pr/SKILL.md +44 -10
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +44 -10
- package/templates/.agents/skills/create-pr/config/verify.json +27 -0
- package/templates/.agents/skills/create-pr/reference/branch-strategy.md +3 -3
- package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +3 -3
- package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.md +6 -6
- package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.zh-CN.md +6 -6
- package/templates/.agents/skills/create-pr/reference/pr-body-template.md +8 -7
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +8 -7
- package/templates/.agents/skills/create-task/SKILL.md +25 -3
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +25 -3
- package/templates/.agents/skills/create-task/config/verify.json +24 -0
- package/templates/.agents/skills/implement-task/SKILL.md +47 -8
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +47 -8
- package/templates/.agents/skills/implement-task/config/verify.json +43 -0
- package/templates/.agents/skills/implement-task/reference/branch-management.md +48 -0
- package/templates/.agents/skills/implement-task/reference/branch-management.zh-CN.md +49 -0
- package/templates/.agents/skills/implement-task/reference/output-template.md +20 -0
- package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +20 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +18 -7
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +18 -7
- package/templates/.agents/skills/import-codescan/config/verify.json +24 -0
- package/templates/.agents/skills/import-dependabot/SKILL.md +18 -7
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +18 -7
- package/templates/.agents/skills/import-dependabot/config/verify.json +24 -0
- package/templates/.agents/skills/import-issue/SKILL.md +28 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +28 -1
- package/templates/.agents/skills/import-issue/config/verify.json +27 -0
- package/templates/.agents/skills/init-labels/SKILL.md +40 -10
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +40 -10
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +1 -22
- package/templates/.agents/skills/init-milestones/SKILL.md +13 -0
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +13 -0
- package/templates/.agents/skills/plan-task/SKILL.md +29 -75
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +29 -75
- package/templates/.agents/skills/plan-task/config/verify.json +44 -0
- package/templates/.agents/skills/refine-task/SKILL.md +41 -2
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +41 -2
- package/templates/.agents/skills/refine-task/config/verify.json +39 -0
- package/templates/.agents/skills/refine-task/reference/fix-workflow.md +7 -7
- package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +7 -7
- package/templates/.agents/skills/refine-title/SKILL.md +10 -2
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +10 -2
- package/templates/.agents/skills/restore-task/SKILL.md +159 -0
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +159 -0
- package/templates/.agents/skills/restore-task/config/verify.json +24 -0
- package/templates/.agents/skills/review-task/SKILL.md +25 -1
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +25 -1
- package/templates/.agents/skills/review-task/config/verify.json +42 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.md +11 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +6 -1
- package/templates/.agents/templates/task.md +3 -7
- package/templates/.agents/templates/task.zh-CN.md +3 -7
- package/templates/.claude/commands/archive-tasks.md +9 -0
- package/templates/.claude/commands/archive-tasks.zh-CN.md +9 -0
- package/templates/.claude/commands/cancel-task.md +9 -0
- package/templates/.claude/commands/cancel-task.zh-CN.md +9 -0
- package/templates/.claude/commands/restore-task.md +9 -0
- package/templates/.claude/commands/restore-task.zh-CN.md +9 -0
- package/templates/.gemini/commands/_project_/archive-tasks.toml +10 -0
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +10 -0
- package/templates/.gemini/commands/_project_/cancel-task.toml +8 -0
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/restore-task.toml +8 -0
- package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +8 -0
- package/templates/.github/workflows/status-label.yml +85 -0
- package/templates/.opencode/commands/archive-tasks.md +11 -0
- package/templates/.opencode/commands/archive-tasks.zh-CN.md +11 -0
- package/templates/.opencode/commands/cancel-task.md +11 -0
- package/templates/.opencode/commands/cancel-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/restore-task.md +11 -0
- package/templates/.opencode/commands/restore-task.zh-CN.md +11 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +0 -93
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +0 -93
- package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -84
- package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -84
- package/templates/.agents/skills/sync-issue/reference/label-sync.md +0 -62
- package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +0 -62
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +0 -37
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +0 -37
- package/templates/.agents/skills/sync-pr/SKILL.md +0 -87
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +0 -87
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +0 -54
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +0 -54
- package/templates/.claude/commands/sync-issue.md +0 -8
- package/templates/.claude/commands/sync-issue.zh-CN.md +0 -8
- package/templates/.claude/commands/sync-pr.md +0 -8
- package/templates/.claude/commands/sync-pr.zh-CN.md +0 -8
- package/templates/.gemini/commands/_project_/sync-issue.toml +0 -8
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/sync-pr.toml +0 -8
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +0 -8
- package/templates/.opencode/commands/sync-issue.md +0 -11
- package/templates/.opencode/commands/sync-issue.zh-CN.md +0 -11
- package/templates/.opencode/commands/sync-pr.md +0 -11
- package/templates/.opencode/commands/sync-pr.zh-CN.md +0 -11
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<strong>
|
|
12
|
+
<strong>From issue to merged PR in 9 commands.</strong> Define a requirement, let AI handle analysis, planning, coding, review, and delivery — you only step in when it matters.
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
@@ -182,40 +182,30 @@ agent-infra is intentionally simple: a bootstrap CLI creates the seed configurat
|
|
|
182
182
|
1. **Install** — `npm install -g @fitlab-ai/agent-infra` (or use the shell script wrapper)
|
|
183
183
|
2. **Initialize** — `ai init` in the project root to generate `.agents/.airc.json` and install the seed command
|
|
184
184
|
3. **Render** — run `update-agent-infra` in any AI TUI to detect the bundled template version and generate all managed files
|
|
185
|
-
4. **Develop** — use
|
|
185
|
+
4. **Develop** — use built-in skills to drive the full lifecycle: `analysis → design → implementation → review → fix → commit`
|
|
186
186
|
5. **Update** — run `update-agent-infra` again whenever a new template version is available
|
|
187
187
|
|
|
188
188
|
### Layered Architecture
|
|
189
189
|
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
block:project:4
|
|
209
|
-
columns 4
|
|
210
|
-
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
tui -- "slash commands" --> shared
|
|
214
|
-
shared -- "renders into" --> project
|
|
190
|
+
```text
|
|
191
|
+
┌───────────────────────────────────────────────────────┐
|
|
192
|
+
│ AI TUI Layer │
|
|
193
|
+
│ Claude Code · Codex · Gemini CLI · OpenCode │
|
|
194
|
+
└──────────────────────────┬────────────────────────────┘
|
|
195
|
+
│ slash commands
|
|
196
|
+
▼
|
|
197
|
+
┌───────────────────────────────────────────────────────┐
|
|
198
|
+
│ Shared Layer │
|
|
199
|
+
│ Skills · Workflows · Templates │
|
|
200
|
+
└──────────────────────────┬────────────────────────────┘
|
|
201
|
+
│ renders into
|
|
202
|
+
▼
|
|
203
|
+
┌───────────────────────────────────────────────────────┐
|
|
204
|
+
│ Project Layer │
|
|
205
|
+
│ .agents/ · AGENTS.md │
|
|
206
|
+
└───────────────────────────────────────────────────────┘
|
|
215
207
|
```
|
|
216
208
|
|
|
217
|
-
GitHub renders Mermaid diagrams natively. If a downstream renderer does not, the text above still explains the system structure.
|
|
218
|
-
|
|
219
209
|
<a id="what-you-get"></a>
|
|
220
210
|
|
|
221
211
|
## What You Get
|
|
@@ -227,7 +217,7 @@ my-project/
|
|
|
227
217
|
├── .agents/ # Shared AI collaboration config
|
|
228
218
|
│ ├── .airc.json # Central configuration
|
|
229
219
|
│ ├── workspace/ # Task workspace (git-ignored)
|
|
230
|
-
│ ├── skills/ #
|
|
220
|
+
│ ├── skills/ # Built-in AI skills
|
|
231
221
|
│ ├── workflows/ # 4 prebuilt workflows
|
|
232
222
|
│ └── templates/ # Task and artifact templates
|
|
233
223
|
├── .claude/ # Claude Code config and commands
|
|
@@ -240,7 +230,7 @@ my-project/
|
|
|
240
230
|
|
|
241
231
|
## Built-in AI Skills
|
|
242
232
|
|
|
243
|
-
agent-infra ships with **
|
|
233
|
+
agent-infra ships with **a rich set of built-in AI skills**. They are organized by use case, but they all share the same design goal: every AI TUI should be able to execute the same workflow vocabulary in the same repository.
|
|
244
234
|
|
|
245
235
|
<a id="task-lifecycle"></a>
|
|
246
236
|
|
|
@@ -265,6 +255,7 @@ agent-infra ships with **28 built-in AI skills**. They are organized by use case
|
|
|
265
255
|
|-------|-------------|------------|----------------------|
|
|
266
256
|
| `check-task` | Inspect the current task status, workflow progress, and next step. | `task-id` | Check progress without modifying task state. |
|
|
267
257
|
| `block-task` | Move a task to blocked state and record the blocker reason. | `task-id`, `reason` (optional) | Pause work when an external dependency or decision is missing. |
|
|
258
|
+
| `restore-task` | Restore local task files from GitHub Issue sync comments. | `issue-number`, `task-id` (optional) | Recover a task workspace after switching machines or clearing local state. |
|
|
268
259
|
|
|
269
260
|
<a id="issue-and-pr"></a>
|
|
270
261
|
|
|
@@ -273,9 +264,7 @@ agent-infra ships with **28 built-in AI skills**. They are organized by use case
|
|
|
273
264
|
| Skill | Description | Parameters | Recommended use case |
|
|
274
265
|
|-------|-------------|------------|----------------------|
|
|
275
266
|
| `create-issue` | Create a GitHub Issue from a task file. | `task-id` | Push a local task into GitHub tracking. |
|
|
276
|
-
| `sync-issue` | Post task progress updates back to the linked GitHub Issue. | `task-id` or `issue-number` | Keep stakeholders updated as the task evolves. |
|
|
277
267
|
| `create-pr` | Open a Pull Request to an inferred or explicit target branch. | `task-id` (optional), `target-branch` (optional) | Publish reviewed changes for merge, with optional explicit task linkage after a fresh session. |
|
|
278
|
-
| `sync-pr` | Sync task progress and review metadata into the Pull Request. | `task-id` or `pr-number` | Keep PR metadata aligned with the local task record from either task or PR entrypoints. |
|
|
279
268
|
|
|
280
269
|
<a id="code-quality"></a>
|
|
281
270
|
|
|
@@ -317,6 +306,7 @@ agent-infra ships with **28 built-in AI skills**. They are organized by use case
|
|
|
317
306
|
| `refine-title` | Rewrite an Issue or PR title into Conventional Commits format. | `number` | Normalize inconsistent GitHub titles. |
|
|
318
307
|
| `init-labels` | Initialize the repository's standard GitHub label set. | None | Bootstrap labels in a new repository. |
|
|
319
308
|
| `init-milestones` | Initialize the repository's milestone structure. | None | Bootstrap milestone tracking in a new repository. |
|
|
309
|
+
| `archive-tasks` | Archive completed tasks into a date-organized directory with a manifest index. | `[--days N \| --before DATE \| TASK-ID...]` | Periodically clean up the `completed/` directory. |
|
|
320
310
|
| `update-agent-infra` | Update the project's collaboration infrastructure to the latest template version. | None | Refresh shared AI tooling without rebuilding local conventions. |
|
|
321
311
|
|
|
322
312
|
> Every skill works across supported AI TUIs. The command prefix changes, but the workflow semantics stay the same.
|
|
@@ -390,7 +380,7 @@ The generated `.agents/.airc.json` file is the central contract between the boot
|
|
|
390
380
|
"project": "my-project",
|
|
391
381
|
"org": "my-org",
|
|
392
382
|
"language": "en",
|
|
393
|
-
"templateVersion": "v0.4.
|
|
383
|
+
"templateVersion": "v0.4.4",
|
|
394
384
|
"files": {
|
|
395
385
|
"managed": [
|
|
396
386
|
".agents/workspace/README.md",
|
package/README.zh-CN.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<strong
|
|
12
|
+
<strong>从 Issue 到合并 PR,只需 9 条命令。</strong> 定义需求,让 AI 完成分析、方案设计、编码、审查和交付 —— 你只需在关键节点介入。
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
@@ -182,40 +182,30 @@ agent-infra 的结构刻意保持简单:引导 CLI 负责生成种子配置,
|
|
|
182
182
|
1. **安装** — `npm install -g @fitlab-ai/agent-infra`(或使用 shell 脚本便捷封装)
|
|
183
183
|
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.agents/.airc.json` 并安装种子命令
|
|
184
184
|
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra`,检测当前打包模板版本并生成所有受管理文件
|
|
185
|
-
4. **开发** —
|
|
185
|
+
4. **开发** — 使用内置 skill 驱动完整生命周期:`analysis → design → implementation → review → fix → commit`
|
|
186
186
|
5. **升级** — 有新模板版本时再次执行 `update-agent-infra` 即可
|
|
187
187
|
|
|
188
188
|
### 分层架构
|
|
189
189
|
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
block:project:4
|
|
209
|
-
columns 4
|
|
210
|
-
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
tui -- "slash commands" --> shared
|
|
214
|
-
shared -- "renders into" --> project
|
|
190
|
+
```text
|
|
191
|
+
┌───────────────────────────────────────────────────────┐
|
|
192
|
+
│ AI TUI Layer │
|
|
193
|
+
│ Claude Code · Codex · Gemini CLI · OpenCode │
|
|
194
|
+
└──────────────────────────┬────────────────────────────┘
|
|
195
|
+
│ slash 命令
|
|
196
|
+
▼
|
|
197
|
+
┌───────────────────────────────────────────────────────┐
|
|
198
|
+
│ Shared Layer │
|
|
199
|
+
│ Skills · Workflows · Templates │
|
|
200
|
+
└──────────────────────────┬────────────────────────────┘
|
|
201
|
+
│ 渲染为
|
|
202
|
+
▼
|
|
203
|
+
┌───────────────────────────────────────────────────────┐
|
|
204
|
+
│ Project Layer │
|
|
205
|
+
│ .agents/ · AGENTS.md │
|
|
206
|
+
└───────────────────────────────────────────────────────┘
|
|
215
207
|
```
|
|
216
208
|
|
|
217
|
-
GitHub 原生支持 Mermaid 渲染。即使某些下游渲染器不支持,上方文字也足以传达系统结构。
|
|
218
|
-
|
|
219
209
|
<a id="what-you-get"></a>
|
|
220
210
|
|
|
221
211
|
## 安装效果
|
|
@@ -227,7 +217,7 @@ my-project/
|
|
|
227
217
|
├── .agents/ # 共享 AI 协作配置
|
|
228
218
|
│ ├── .airc.json # 中央配置文件
|
|
229
219
|
│ ├── workspace/ # 任务工作区(git 忽略)
|
|
230
|
-
│ ├── skills/ #
|
|
220
|
+
│ ├── skills/ # 内置 AI skills
|
|
231
221
|
│ ├── workflows/ # 4 个预置工作流
|
|
232
222
|
│ └── templates/ # 任务与产物模板
|
|
233
223
|
├── .claude/ # Claude Code 配置与命令
|
|
@@ -240,7 +230,7 @@ my-project/
|
|
|
240
230
|
|
|
241
231
|
## 内置 AI Skills
|
|
242
232
|
|
|
243
|
-
agent-infra
|
|
233
|
+
agent-infra 提供 **丰富的内置 AI skills**。它们按使用场景分组,但共享同一个核心目标:无论使用哪种 AI TUI,都能在同一仓库里执行相同的工作流词汇和协作约定。
|
|
244
234
|
|
|
245
235
|
<a id="task-lifecycle"></a>
|
|
246
236
|
|
|
@@ -265,6 +255,7 @@ agent-infra 内置 **28 个 AI skills**。它们按使用场景分组,但共
|
|
|
265
255
|
|-------|------|------|---------|
|
|
266
256
|
| `check-task` | 查看当前任务状态、工作流进度和下一步建议。 | `task-id` | 不修改任务状态,仅检查当前进展。 |
|
|
267
257
|
| `block-task` | 将任务标记为阻塞并记录阻塞原因。 | `task-id`、`reason`(可选) | 缺少外部依赖、决策或资源时暂停任务。 |
|
|
258
|
+
| `restore-task` | 从 GitHub Issue 同步评论中还原本地任务文件。 | `issue-number`、`task-id`(可选) | 换机器或清空本地状态后恢复任务工作区。 |
|
|
268
259
|
|
|
269
260
|
<a id="issue-and-pr"></a>
|
|
270
261
|
|
|
@@ -273,9 +264,7 @@ agent-infra 内置 **28 个 AI skills**。它们按使用场景分组,但共
|
|
|
273
264
|
| Skill | 描述 | 参数 | 推荐场景 |
|
|
274
265
|
|-------|------|------|---------|
|
|
275
266
|
| `create-issue` | 根据任务文件创建 GitHub Issue。 | `task-id` | 需要把本地任务同步到 GitHub 跟踪时。 |
|
|
276
|
-
| `sync-issue` | 将任务进度同步回关联的 GitHub Issue。 | `task-id` 或 `issue-number` | 任务推进过程中持续同步状态。 |
|
|
277
267
|
| `create-pr` | 向推断出的目标分支或显式指定分支创建 Pull Request。 | `task-id`(可选)、`target-branch`(可选) | 变更准备合入时创建 PR;清空上下文后也可显式传入任务关联。 |
|
|
278
|
-
| `sync-pr` | 将任务进度和审查元数据同步到 Pull Request。 | `task-id` 或 `pr-number` | 允许从任务入口或 PR 入口同步,让 PR 元数据与本地任务记录保持一致。 |
|
|
279
268
|
|
|
280
269
|
<a id="code-quality"></a>
|
|
281
270
|
|
|
@@ -317,6 +306,7 @@ agent-infra 内置 **28 个 AI skills**。它们按使用场景分组,但共
|
|
|
317
306
|
| `refine-title` | 将 Issue 或 PR 标题重构为 Conventional Commits 格式。 | `number` | GitHub 标题格式不规范时。 |
|
|
318
307
|
| `init-labels` | 初始化仓库标准 GitHub labels 体系。 | 无 | 新仓库首次配置 labels 时。 |
|
|
319
308
|
| `init-milestones` | 初始化仓库 milestones 结构。 | 无 | 新仓库首次建立里程碑时。 |
|
|
309
|
+
| `archive-tasks` | 将已完成任务按日期归档到目录中,并生成 `manifest` 索引。 | `[--days N \| --before DATE \| TASK-ID...]` | 需要定期清理 `completed/` 目录时。 |
|
|
320
310
|
| `update-agent-infra` | 将项目协作基础设施升级到最新模板版本。 | 无 | 需要刷新共享 AI 工具层时。 |
|
|
321
311
|
|
|
322
312
|
> 所有 skills 都可跨支持的 AI TUI 复用。变化的只是命令前缀,工作流语义保持一致。
|
|
@@ -390,7 +380,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
390
380
|
"project": "my-project",
|
|
391
381
|
"org": "my-org",
|
|
392
382
|
"language": "en",
|
|
393
|
-
"templateVersion": "v0.4.
|
|
383
|
+
"templateVersion": "v0.4.4",
|
|
394
384
|
"files": {
|
|
395
385
|
"managed": [
|
|
396
386
|
".agents/workspace/README.md",
|
package/lib/defaults.json
CHANGED
package/lib/init.js
CHANGED
package/lib/update.js
CHANGED
|
@@ -139,8 +139,15 @@ async function cmdUpdate() {
|
|
|
139
139
|
// sync file registry
|
|
140
140
|
const { added, changed } = syncFileRegistry(config);
|
|
141
141
|
const hasNewEntries = added.managed.length > 0 || added.merged.length > 0;
|
|
142
|
+
const labelsAdded = !config.labels;
|
|
143
|
+
let configChanged = changed;
|
|
142
144
|
|
|
143
|
-
if (
|
|
145
|
+
if (labelsAdded) {
|
|
146
|
+
config.labels = structuredClone(defaults.labels);
|
|
147
|
+
configChanged = true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (configChanged) {
|
|
144
151
|
console.log('');
|
|
145
152
|
if (hasNewEntries) {
|
|
146
153
|
info(`New file entries synced to ${CONFIG_PATH}:`);
|
|
@@ -150,9 +157,14 @@ async function cmdUpdate() {
|
|
|
150
157
|
for (const entry of added.merged) {
|
|
151
158
|
ok(` merged: ${entry}`);
|
|
152
159
|
}
|
|
160
|
+
} else if (labelsAdded) {
|
|
161
|
+
info(`Default labels.in config added to ${CONFIG_PATH}.`);
|
|
153
162
|
} else {
|
|
154
163
|
info(`File registry changed in ${CONFIG_PATH}.`);
|
|
155
164
|
}
|
|
165
|
+
if (hasNewEntries && labelsAdded) {
|
|
166
|
+
info(`Default labels.in config added to ${CONFIG_PATH}.`);
|
|
167
|
+
}
|
|
156
168
|
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
157
169
|
ok(`Updated ${CONFIG_PATH}`);
|
|
158
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitlab-ai/agent-infra",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Gemini CLI, and OpenCode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node scripts/build-inline.js",
|
|
45
45
|
"prepare": "git config core.hooksPath .github/hooks || true",
|
|
46
|
-
"test": "node scripts/build-inline.js --check && node --test tests/*.test.js",
|
|
47
|
-
"prepublishOnly": "node scripts/build-inline.js --check && node --test tests/*.test.js"
|
|
46
|
+
"test": "node scripts/build-inline.js --check && node --test tests/cli/*.test.js tests/templates/*.test.js tests/core/*.test.js",
|
|
47
|
+
"prepublishOnly": "node scripts/build-inline.js --check && node --test tests/cli/*.test.js tests/templates/*.test.js tests/core/*.test.js"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -124,11 +124,25 @@ When writing or updating `.agents/skills/*/SKILL.md` files and their templates,
|
|
|
124
124
|
|
|
125
125
|
### SKILL.md Size Control
|
|
126
126
|
|
|
127
|
-
- Keep
|
|
128
|
-
-
|
|
127
|
+
- Keep SKILL.md as concise as possible; move detailed rules, long templates, and large script blocks into a sibling `reference/` or `scripts/` directory.
|
|
128
|
+
- Store declarative configuration in a sibling `config/` directory, for example `config/verify.json`.
|
|
129
129
|
- Use explicit navigation in the skeleton, such as: `Read reference/xxx.md before executing this step.`
|
|
130
130
|
- Keep scripts in `scripts/` and execute them instead of inlining long bash blocks.
|
|
131
131
|
|
|
132
|
+
## Verification Gate
|
|
133
|
+
|
|
134
|
+
For skills that produce structured artifacts or mutate task state, run the verification gate before claiming completion:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
node .agents/scripts/validate-artifact.js gate <skill-name> <task-dir> [artifact-file] [--format json|text]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- Each skill declares its own checks in `config/verify.json`; keep the file focused on what that skill must validate
|
|
141
|
+
- If a skill also prints next-step guidance, run the gate first and only show those instructions after the gate passes
|
|
142
|
+
- For user-facing final validation, prefer `--format text` so the reply contains a readable summary instead of raw JSON
|
|
143
|
+
- Shared validation logic belongs in `.agents/scripts/validate-artifact.js`; do not move detailed rules back into SKILL.md
|
|
144
|
+
- Keep the gate output in the reply as fresh evidence; without output from the current run, do not claim completion
|
|
145
|
+
|
|
132
146
|
## FAQ
|
|
133
147
|
|
|
134
148
|
### Q: Do I need to configure every AI tool separately?
|
|
@@ -124,11 +124,25 @@
|
|
|
124
124
|
|
|
125
125
|
### SKILL.md 体积控制
|
|
126
126
|
|
|
127
|
-
- SKILL.md
|
|
128
|
-
-
|
|
127
|
+
- SKILL.md 正文尽可能精简,把详细规则、长模板和大段脚本拆分到同级 `reference/` 或 `scripts/` 目录。
|
|
128
|
+
- 声明式配置统一放在同级 `config/` 目录,例如 `config/verify.json`。
|
|
129
129
|
- 骨架中使用明确导航,例如:`执行此步骤前,先读取 reference/xxx.md。`
|
|
130
130
|
- 长脚本继续放在 `scripts/` 目录,优先执行脚本而不是内联大段 bash。
|
|
131
131
|
|
|
132
|
+
## 完成校验
|
|
133
|
+
|
|
134
|
+
对会产生结构化产物或任务状态变更的 skill,统一在结束前运行完成校验:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
node .agents/scripts/validate-artifact.js gate <skill-name> <task-dir> [artifact-file] [--format json|text]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- 每个 skill 在自己的 `config/verify.json` 中声明需要检查的事项
|
|
141
|
+
- 如果 skill 还会展示“下一步”提示,必须先通过完成校验,再输出这些指引
|
|
142
|
+
- 面向用户展示最终校验结果时,优先使用 `--format text` 输出可读摘要,而不是原始 JSON
|
|
143
|
+
- 共享逻辑集中在 `.agents/scripts/validate-artifact.js`,不要把详细校验规则重新塞回 SKILL.md
|
|
144
|
+
- 在回复中保留当次校验输出作为当次验证输出;没有当次校验输出,不得声明完成
|
|
145
|
+
|
|
132
146
|
## 常见问题
|
|
133
147
|
|
|
134
148
|
### Q:我需要单独配置每个 AI 工具吗?
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Issue Sync Rules
|
|
2
|
+
|
|
3
|
+
Read this file before a task skill updates a GitHub Issue.
|
|
4
|
+
|
|
5
|
+
## Direct `status:` Label Updates
|
|
6
|
+
|
|
7
|
+
If task.md contains a valid `issue_number` (not empty and not `N/A`) and the Issue state is `OPEN`, replace every existing `status:` label and add the target one:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
state=$(gh issue view {issue-number} --json state --jq '.state' 2>/dev/null)
|
|
11
|
+
if [ "$state" = "OPEN" ]; then
|
|
12
|
+
gh issue view {issue-number} --json labels \
|
|
13
|
+
--jq '.labels[].name | select(startswith("status:"))' 2>/dev/null \
|
|
14
|
+
| while IFS= read -r label; do
|
|
15
|
+
[ -z "$label" ] && continue
|
|
16
|
+
gh issue edit {issue-number} --remove-label "$label" 2>/dev/null || true
|
|
17
|
+
done
|
|
18
|
+
gh issue edit {issue-number} --add-label "{target-status-label}" 2>/dev/null || true
|
|
19
|
+
fi
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `while IFS= read -r label` so labels like `status: in-progress` are handled line-by-line instead of being split on spaces.
|
|
23
|
+
|
|
24
|
+
If `gh` fails, skip and continue. Do not fail the skill.
|
|
25
|
+
|
|
26
|
+
## Assignee Sync
|
|
27
|
+
|
|
28
|
+
When a skill creates or imports an Issue, automatically add the current executor as assignee:
|
|
29
|
+
|
|
30
|
+
- `create-issue`: use `--assignee @me` in the `gh issue create` command
|
|
31
|
+
- `import-issue`: run `gh issue edit {issue-number} --add-assignee @me 2>/dev/null || true` after import
|
|
32
|
+
|
|
33
|
+
`@me` is resolved by `gh` CLI to the authenticated user. The operation is idempotent (adding an existing assignee is a no-op). If the command fails (e.g. insufficient permissions), skip and continue.
|
|
34
|
+
|
|
35
|
+
## `in:` Label Sync
|
|
36
|
+
|
|
37
|
+
Read the `labels.in` mapping from `.agents/.airc.json`.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git diff {base-branch}...HEAD --name-only
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`{base-branch}` is usually `main`; in PR context, use the PR's base branch.
|
|
44
|
+
|
|
45
|
+
### When a mapping exists (precise add/remove)
|
|
46
|
+
|
|
47
|
+
1. Collect the full set of changed files in the branch
|
|
48
|
+
2. Match each file against the directory prefixes in `labels.in` to compute the expected `in:` label set
|
|
49
|
+
3. Query the current `in:` labels on the Issue or PR
|
|
50
|
+
4. Apply the diff:
|
|
51
|
+
- expected but missing -> `gh issue edit {issue-number} --add-label "in: {module}" 2>/dev/null || true`
|
|
52
|
+
- present but no longer expected -> `gh issue edit {issue-number} --remove-label "in: {module}" 2>/dev/null || true`
|
|
53
|
+
|
|
54
|
+
### When no mapping exists (add-only fallback)
|
|
55
|
+
|
|
56
|
+
If `.airc.json` has no `labels.in` field or it is empty:
|
|
57
|
+
1. query existing repository `in:` labels
|
|
58
|
+
2. derive the top-level directory from each changed file
|
|
59
|
+
3. add matching labels only and never remove existing `in:` labels
|
|
60
|
+
|
|
61
|
+
## Artifact Comment Publishing
|
|
62
|
+
|
|
63
|
+
The hidden marker must remain compatible:
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Check for an existing comment before publishing:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
gh api "repos/{owner}/{repo}/issues/{issue-number}/comments" \
|
|
73
|
+
--paginate --jq '.[].body' \
|
|
74
|
+
| grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Skip publishing when the marker already exists.
|
|
78
|
+
|
|
79
|
+
Publishing flow:
|
|
80
|
+
|
|
81
|
+
1. Read the local artifact file in full first
|
|
82
|
+
2. Inline the full file contents as `{artifact body}`
|
|
83
|
+
3. Do not summarize, rewrite, or truncate the artifact body
|
|
84
|
+
|
|
85
|
+
Use this format:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
<!-- sync-issue:{task-id}:{file-stem} -->
|
|
89
|
+
## {artifact-title}
|
|
90
|
+
|
|
91
|
+
{artifact body}
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
*Generated by AI · Internal tracking: {task-id}*
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`summary` comments need extra handling:
|
|
98
|
+
- find an existing `<!-- sync-issue:{task-id}:summary -->` comment ID first
|
|
99
|
+
- create the comment when none exists
|
|
100
|
+
- patch the existing comment in place when the body changed
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
summary_comment_id=$(gh api "repos/{owner}/{repo}/issues/{issue-number}/comments" \
|
|
104
|
+
--paginate --jq '.[] | select(.body | startswith("<!-- sync-issue:{task-id}:summary -->")) | .id' \
|
|
105
|
+
| head -n 1)
|
|
106
|
+
gh api "repos/{owner}/{repo}/issues/comments/{comment-id}" -X PATCH -f body="$(cat <<'EOF'
|
|
107
|
+
{comment-body}
|
|
108
|
+
EOF
|
|
109
|
+
)"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## task.md Comment Sync
|
|
113
|
+
|
|
114
|
+
Hidden marker:
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<!-- sync-issue:{task-id}:task -->
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use an idempotent update path for `task.md`:
|
|
121
|
+
|
|
122
|
+
1. Read the full `task.md`
|
|
123
|
+
2. Wrap the YAML frontmatter (content between the `---` delimiters) inside a `<details><summary>Metadata (frontmatter)</summary>` block with a `yaml` code fence; render the remaining body as normal Markdown
|
|
124
|
+
3. Use `task` as `{file-stem}`
|
|
125
|
+
4. Find an existing comment ID for the marker
|
|
126
|
+
5. Create the comment when none exists
|
|
127
|
+
6. PATCH the comment in place when the body changed
|
|
128
|
+
7. Skip when the body is unchanged
|
|
129
|
+
|
|
130
|
+
task.md comment format:
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
<!-- sync-issue:{task-id}:task -->
|
|
134
|
+
## Task File
|
|
135
|
+
|
|
136
|
+
<details><summary>Metadata (frontmatter)</summary>
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
---
|
|
140
|
+
{frontmatter fields}
|
|
141
|
+
---
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
</details>
|
|
145
|
+
|
|
146
|
+
{task.md body after frontmatter}
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
*Generated by AI · Internal tracking: {task-id}*
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
When restoring, extract the frontmatter from the `<details>` block and reassemble with the body to recover the original `task.md`.
|
|
153
|
+
|
|
154
|
+
Title mapping:
|
|
155
|
+
- `task` -> `Task File`
|
|
156
|
+
|
|
157
|
+
## Backfill Rules (run before `/complete-task` archives)
|
|
158
|
+
|
|
159
|
+
- Scan `task.md`, `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` in the task directory
|
|
160
|
+
- Check whether each `{file-stem}` was already published by its hidden marker; publish only missing artifacts
|
|
161
|
+
- Backfill only appends missing comments; never delete or reorder existing comments
|
|
162
|
+
- Derive the previous and next neighbors from Activity Log order and add this note below the title:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
> ⚠️ This comment was backfilled. In the timeline it belongs after "{previous-artifact-title}" and before "{next-artifact-title}".
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- If only one neighbor exists, keep only that side of the note; if neither exists, omit the note
|
|
169
|
+
|
|
170
|
+
Title mapping:
|
|
171
|
+
- `task` -> `Task File`
|
|
172
|
+
- `analysis` / `analysis-r{N}` -> `Requirements Analysis` / `Requirements Analysis (Round {N})`
|
|
173
|
+
- `plan` / `plan-r{N}` -> `Technical Plan` / `Technical Plan (Round {N})`
|
|
174
|
+
- `implementation` / `implementation-r{N}` -> `Implementation Report (Round 1)` / `Implementation Report (Round {N})`
|
|
175
|
+
- `review` / `review-r{N}` -> `Review Report (Round 1)` / `Review Report (Round {N})`
|
|
176
|
+
- `refinement` / `refinement-r{N}` -> `Refinement Report (Round 1)` / `Refinement Report (Round {N})`
|
|
177
|
+
- `summary` -> `Delivery Summary`
|
|
178
|
+
|
|
179
|
+
## Requirement Checkbox Sync
|
|
180
|
+
|
|
181
|
+
Extract checked `- [x]` items from the `## Requirements` section in task.md. Skip when none exist.
|
|
182
|
+
|
|
183
|
+
Read the current Issue body:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
gh issue view {issue-number} --json body --jq '.body'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Replace matching `- [ ] {text}` lines with `- [x] {text}` only when the body actually changes, then PATCH the full body with `gh api`.
|
|
190
|
+
|
|
191
|
+
## Shell Safety Rules
|
|
192
|
+
|
|
193
|
+
1. Read the artifact first, then inline the real text into the heredoc body. Do not use command substitution or variable expansion inside `<<'EOF'`.
|
|
194
|
+
2. Do not use `echo` to build content containing `<!-- -->`. Use `cat <<'EOF'` or `printf '%s\n'` instead.
|