@fitlab-ai/agent-infra 0.3.1 → 0.4.0
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 +29 -39
- package/README.zh-CN.md +29 -39
- package/bin/cli.js +1 -1
- package/lib/defaults.json +3 -12
- package/lib/init.js +13 -24
- package/lib/paths.js +3 -42
- package/lib/update.js +98 -32
- package/lib/version.js +2 -1
- package/package.json +2 -1
- package/templates/.agents/QUICKSTART.md +7 -7
- package/templates/.agents/QUICKSTART.zh-CN.md +7 -7
- package/templates/.agents/README.md +16 -4
- package/templates/.agents/README.zh-CN.md +16 -4
- package/templates/.agents/skills/analyze-task/SKILL.md +106 -105
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/block-task/SKILL.md +8 -8
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/check-task/SKILL.md +3 -3
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/close-codescan/SKILL.md +64 -63
- package/templates/.agents/skills/close-dependabot/SKILL.md +71 -70
- package/templates/.agents/skills/commit/SKILL.md +1 -1
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.md +7 -7
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/create-issue/SKILL.md +57 -12
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +57 -12
- package/templates/.agents/skills/create-pr/SKILL.md +44 -7
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +44 -7
- package/templates/.agents/skills/create-release-note/SKILL.md +18 -11
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +18 -11
- package/templates/.agents/skills/create-task/SKILL.md +80 -78
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +11 -10
- package/templates/.agents/skills/implement-task/SKILL.md +15 -18
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +15 -18
- package/templates/.agents/skills/import-codescan/SKILL.md +54 -53
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.md +57 -56
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/import-issue/SKILL.md +58 -58
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/init-labels/SKILL.md +8 -0
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +8 -0
- package/templates/.agents/skills/plan-task/SKILL.md +151 -149
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/refine-task/SKILL.md +3 -3
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/release/SKILL.md +55 -14
- package/templates/.agents/skills/release/SKILL.zh-CN.md +55 -14
- package/templates/.agents/skills/review-task/SKILL.md +9 -9
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +9 -9
- package/templates/.agents/skills/sync-issue/SKILL.md +258 -279
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +34 -56
- package/templates/.agents/skills/sync-pr/SKILL.md +8 -28
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +7 -27
- package/templates/.agents/skills/update-agent-infra/SKILL.md +6 -6
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +61 -116
- package/templates/.agents/templates/handoff.md +1 -1
- package/templates/.agents/templates/handoff.zh-CN.md +1 -1
- package/templates/.agents/workflows/bug-fix.yaml +71 -71
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/feature-development.yaml +71 -71
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/refactoring.yaml +76 -76
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +1 -1
- package/templates/{.agent-workspace → .agents/workspace}/README.md +1 -1
- package/templates/{.agent-workspace → .agents/workspace}/README.zh-CN.md +1 -1
- package/templates/.claude/CLAUDE.md +14 -1
- package/templates/.claude/CLAUDE.zh-CN.md +14 -1
- package/templates/.claude/hooks/check-version-format.sh +44 -0
- package/templates/.claude/settings.json +14 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +6 -6
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +6 -6
- package/templates/AGENTS.md +14 -1
- package/templates/AGENTS.zh-CN.md +14 -1
- package/templates/.editorconfig +0 -15
- package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +0 -149
- package/templates/.github/ISSUE_TEMPLATE/02_question.yml +0 -101
- package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +0 -131
- package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +0 -165
- package/templates/.github/ISSUE_TEMPLATE/05_other.yml +0 -147
- package/templates/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/templates/.github/PULL_REQUEST_TEMPLATE.md +0 -123
- package/templates/.github/dependabot.yml +0 -17
- package/templates/.github/hooks/check-utf8-encoding.sh +0 -25
- package/templates/.github/release.yml +0 -27
- package/templates/.github/workflows/pr-title-check.yml +0 -42
- package/templates/.mailmap +0 -4
- package/templates/CONTRIBUTING.md +0 -126
- package/templates/CONTRIBUTING.zh-CN.md +0 -124
- package/templates/SECURITY.md +0 -131
- package/templates/SECURITY.zh-CN.md +0 -131
package/README.md
CHANGED
|
@@ -114,21 +114,26 @@ These are not thin command aliases. Each skill encapsulates standardized process
|
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
116
|
npm install -g @fitlab-ai/agent-infra
|
|
117
|
-
npx @fitlab-ai/agent-infra init
|
|
118
117
|
```
|
|
119
118
|
|
|
120
119
|
**Option B - Shell script**
|
|
121
120
|
|
|
122
121
|
```bash
|
|
122
|
+
# Convenience wrapper — detects Node.js and runs npm install -g internally
|
|
123
123
|
curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
### Updating agent-infra
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
npm update -g @fitlab-ai/agent-infra
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Check your current version:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
ai version
|
|
136
|
+
# or: agent-infra version
|
|
132
137
|
```
|
|
133
138
|
|
|
134
139
|
### 2. Initialize a new project
|
|
@@ -139,7 +144,7 @@ ai init
|
|
|
139
144
|
# or: agent-infra init
|
|
140
145
|
```
|
|
141
146
|
|
|
142
|
-
The CLI collects project metadata, installs the `update-agent-infra` seed command for all supported AI TUIs, and generates `.airc.json`.
|
|
147
|
+
The CLI collects project metadata, installs the `update-agent-infra` seed command for all supported AI TUIs, and generates `.agents/.airc.json`.
|
|
143
148
|
|
|
144
149
|
> `ai` is a shorthand for `agent-infra`. Both commands are equivalent.
|
|
145
150
|
|
|
@@ -154,7 +159,7 @@ Open the project in any AI TUI and run `update-agent-infra`:
|
|
|
154
159
|
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
155
160
|
| OpenCode | `/update-agent-infra` |
|
|
156
161
|
|
|
157
|
-
This
|
|
162
|
+
This detects the packaged template version and renders all managed files. The same command is used both for first-time setup and for future template upgrades.
|
|
158
163
|
|
|
159
164
|
<a id="architecture-overview"></a>
|
|
160
165
|
|
|
@@ -164,9 +169,9 @@ agent-infra is intentionally simple: a bootstrap CLI creates the seed configurat
|
|
|
164
169
|
|
|
165
170
|
### End-to-End Flow
|
|
166
171
|
|
|
167
|
-
1. **Install** — `npm install -g @fitlab-ai/agent-infra` (or use the shell script)
|
|
168
|
-
2. **Initialize** — `ai init` in the project root to generate `.airc.json` and install the seed command
|
|
169
|
-
3. **Render** — run `update-agent-infra` in any AI TUI to
|
|
172
|
+
1. **Install** — `npm install -g @fitlab-ai/agent-infra` (or use the shell script wrapper)
|
|
173
|
+
2. **Initialize** — `ai init` in the project root to generate `.agents/.airc.json` and install the seed command
|
|
174
|
+
3. **Render** — run `update-agent-infra` in any AI TUI to detect the bundled template version and generate all managed files
|
|
170
175
|
4. **Develop** — use 28 built-in skills to drive the full lifecycle: `analysis → design → implementation → review → fix → commit`
|
|
171
176
|
5. **Update** — run `update-agent-infra` again whenever a new template version is available
|
|
172
177
|
|
|
@@ -192,7 +197,7 @@ block-beta
|
|
|
192
197
|
|
|
193
198
|
block:project:4
|
|
194
199
|
columns 4
|
|
195
|
-
agents[".agents/"] config[".airc.json"] workspace[".
|
|
200
|
+
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
196
201
|
end
|
|
197
202
|
|
|
198
203
|
tui -- "slash commands" --> shared
|
|
@@ -210,19 +215,15 @@ After setup, your project gains a complete AI collaboration infrastructure:
|
|
|
210
215
|
```text
|
|
211
216
|
my-project/
|
|
212
217
|
├── .agents/ # Shared AI collaboration config
|
|
218
|
+
│ ├── .airc.json # Central configuration
|
|
219
|
+
│ ├── workspace/ # Task workspace (git-ignored)
|
|
213
220
|
│ ├── skills/ # 28 built-in AI skills
|
|
214
221
|
│ ├── workflows/ # 4 prebuilt workflows
|
|
215
222
|
│ └── templates/ # Task and artifact templates
|
|
216
|
-
├── .agent-workspace/ # Task workspace (git-ignored)
|
|
217
223
|
├── .claude/ # Claude Code config and commands
|
|
218
224
|
├── .gemini/ # Gemini CLI config and commands
|
|
219
225
|
├── .opencode/ # OpenCode config and commands
|
|
220
|
-
|
|
221
|
-
├── AGENTS.md # Universal AI agent instructions
|
|
222
|
-
├── CONTRIBUTING.md # Contribution guide
|
|
223
|
-
├── SECURITY.md # Security policy (English)
|
|
224
|
-
├── SECURITY.zh-CN.md # Security policy (Chinese)
|
|
225
|
-
└── .airc.json # Central configuration
|
|
226
|
+
└── AGENTS.md # Universal AI agent instructions
|
|
226
227
|
```
|
|
227
228
|
|
|
228
229
|
<a id="built-in-ai-skills"></a>
|
|
@@ -370,9 +371,9 @@ import-issue #42 Import task from GitHub Issue
|
|
|
370
371
|
|
|
371
372
|
## Configuration Reference
|
|
372
373
|
|
|
373
|
-
The generated `.airc.json` file is the central contract between the bootstrap CLI, templates, and future updates.
|
|
374
|
+
The generated `.agents/.airc.json` file is the central contract between the bootstrap CLI, templates, and future updates.
|
|
374
375
|
|
|
375
|
-
### Example `.airc.json`
|
|
376
|
+
### Example `.agents/.airc.json`
|
|
376
377
|
|
|
377
378
|
```json
|
|
378
379
|
{
|
|
@@ -380,10 +381,10 @@ The generated `.airc.json` file is the central contract between the bootstrap CL
|
|
|
380
381
|
"org": "my-org",
|
|
381
382
|
"language": "en",
|
|
382
383
|
"templateSource": "templates/",
|
|
383
|
-
"templateVersion": "v0.
|
|
384
|
-
"modules": ["ai", "github"],
|
|
384
|
+
"templateVersion": "v0.4.0",
|
|
385
385
|
"files": {
|
|
386
386
|
"managed": [
|
|
387
|
+
".agents/workspace/README.md",
|
|
387
388
|
".agents/skills/",
|
|
388
389
|
".agents/templates/",
|
|
389
390
|
".agents/workflows/",
|
|
@@ -394,9 +395,7 @@ The generated `.airc.json` file is the central contract between the bootstrap CL
|
|
|
394
395
|
"merged": [
|
|
395
396
|
".agents/README.md",
|
|
396
397
|
".gitignore",
|
|
397
|
-
"AGENTS.md"
|
|
398
|
-
"CONTRIBUTING.md",
|
|
399
|
-
"SECURITY.md"
|
|
398
|
+
"AGENTS.md"
|
|
400
399
|
],
|
|
401
400
|
"ejected": []
|
|
402
401
|
}
|
|
@@ -412,16 +411,8 @@ The generated `.airc.json` file is the central contract between the bootstrap CL
|
|
|
412
411
|
| `language` | Primary project language or locale used by rendered templates. |
|
|
413
412
|
| `templateSource` | Local template root used during rendering. |
|
|
414
413
|
| `templateVersion` | Installed template version for future upgrades and drift tracking. |
|
|
415
|
-
| `modules` | Enabled template bundles. Supported values are `ai` and `github`. |
|
|
416
414
|
| `files` | Per-path update strategy configuration for managed, merged, and ejected files. |
|
|
417
415
|
|
|
418
|
-
### Module reference
|
|
419
|
-
|
|
420
|
-
| Module | Includes |
|
|
421
|
-
|--------|----------|
|
|
422
|
-
| `ai` | `.agents/`, `.claude/`, `.gemini/`, `.opencode/`, `AGENTS.md`, and related collaboration assets |
|
|
423
|
-
| `github` | `.github/`, contribution templates, release config, and GitHub governance assets |
|
|
424
|
-
|
|
425
416
|
<a id="file-management-strategies"></a>
|
|
426
417
|
|
|
427
418
|
## File Management Strategies
|
|
@@ -441,15 +432,14 @@ Each generated path is assigned an update strategy. That strategy determines how
|
|
|
441
432
|
"files": {
|
|
442
433
|
"managed": [
|
|
443
434
|
".agents/skills/",
|
|
444
|
-
".
|
|
435
|
+
".agents/workspace/README.md"
|
|
445
436
|
],
|
|
446
437
|
"merged": [
|
|
447
438
|
".gitignore",
|
|
448
|
-
"AGENTS.md"
|
|
449
|
-
"CONTRIBUTING.md"
|
|
439
|
+
"AGENTS.md"
|
|
450
440
|
],
|
|
451
441
|
"ejected": [
|
|
452
|
-
"
|
|
442
|
+
"docs/architecture.md"
|
|
453
443
|
]
|
|
454
444
|
}
|
|
455
445
|
}
|
|
@@ -457,7 +447,7 @@ Each generated path is assigned an update strategy. That strategy determines how
|
|
|
457
447
|
|
|
458
448
|
### Moving a file from `managed` to `ejected`
|
|
459
449
|
|
|
460
|
-
1. Remove the path from the `managed` array in `.airc.json`.
|
|
450
|
+
1. Remove the path from the `managed` array in `.agents/.airc.json`.
|
|
461
451
|
2. Add the same path to the `ejected` array.
|
|
462
452
|
3. Run `update-agent-infra` again so future updates stop managing that file.
|
|
463
453
|
|
|
@@ -467,7 +457,7 @@ Use this when a file starts as template-owned but later becomes project-specific
|
|
|
467
457
|
|
|
468
458
|
## Version Management
|
|
469
459
|
|
|
470
|
-
agent-infra uses semantic versioning through Git tags and GitHub releases. The installed template version is recorded in `.airc.json` as `templateVersion`, which gives both humans and AI tools a stable reference point for upgrades.
|
|
460
|
+
agent-infra uses semantic versioning through Git tags and GitHub releases. The installed template version is recorded in `.agents/.airc.json` as `templateVersion`, which gives both humans and AI tools a stable reference point for upgrades.
|
|
471
461
|
|
|
472
462
|
<a id="contributing"></a>
|
|
473
463
|
|
package/README.zh-CN.md
CHANGED
|
@@ -114,21 +114,26 @@ agent-infra 的目标就是把这层协作面标准化。它为所有支持的 A
|
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
116
|
npm install -g @fitlab-ai/agent-infra
|
|
117
|
-
npx @fitlab-ai/agent-infra init
|
|
118
117
|
```
|
|
119
118
|
|
|
120
119
|
**方式 B - Shell 脚本**
|
|
121
120
|
|
|
122
121
|
```bash
|
|
122
|
+
# 便捷封装:检测 Node.js 后,内部执行 npm install -g
|
|
123
123
|
curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
### 更新 agent-infra
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
npm update -g @fitlab-ai/agent-infra
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
查看当前版本:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
ai version
|
|
136
|
+
# 或:agent-infra version
|
|
132
137
|
```
|
|
133
138
|
|
|
134
139
|
### 2. 初始化新项目
|
|
@@ -139,7 +144,7 @@ ai init
|
|
|
139
144
|
# 或:agent-infra init
|
|
140
145
|
```
|
|
141
146
|
|
|
142
|
-
CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-infra` 种子命令,并生成 `.airc.json`。
|
|
147
|
+
CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-infra` 种子命令,并生成 `.agents/.airc.json`。
|
|
143
148
|
|
|
144
149
|
> `ai` 是 `agent-infra` 的简写命令,两者等价。
|
|
145
150
|
|
|
@@ -154,7 +159,7 @@ CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-in
|
|
|
154
159
|
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
155
160
|
| OpenCode | `/update-agent-infra` |
|
|
156
161
|
|
|
157
|
-
|
|
162
|
+
该命令会检测当前打包模板版本并渲染所有受管理文件。首次安装和后续升级都使用同一条命令。
|
|
158
163
|
|
|
159
164
|
<a id="architecture-overview"></a>
|
|
160
165
|
|
|
@@ -164,9 +169,9 @@ agent-infra 的结构刻意保持简单:引导 CLI 负责生成种子配置,
|
|
|
164
169
|
|
|
165
170
|
### 端到端流程
|
|
166
171
|
|
|
167
|
-
1. **安装** — `npm install -g @fitlab-ai/agent-infra`(或使用 shell
|
|
168
|
-
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.airc.json` 并安装种子命令
|
|
169
|
-
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra
|
|
172
|
+
1. **安装** — `npm install -g @fitlab-ai/agent-infra`(或使用 shell 脚本便捷封装)
|
|
173
|
+
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.agents/.airc.json` 并安装种子命令
|
|
174
|
+
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra`,检测当前打包模板版本并生成所有受管理文件
|
|
170
175
|
4. **开发** — 使用 28 个内置 skill 驱动完整生命周期:`analysis → design → implementation → review → fix → commit`
|
|
171
176
|
5. **升级** — 有新模板版本时再次执行 `update-agent-infra` 即可
|
|
172
177
|
|
|
@@ -192,7 +197,7 @@ block-beta
|
|
|
192
197
|
|
|
193
198
|
block:project:4
|
|
194
199
|
columns 4
|
|
195
|
-
agents[".agents/"] config[".airc.json"] workspace[".
|
|
200
|
+
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
196
201
|
end
|
|
197
202
|
|
|
198
203
|
tui -- "slash commands" --> shared
|
|
@@ -210,19 +215,15 @@ GitHub 原生支持 Mermaid 渲染。即使某些下游渲染器不支持,上
|
|
|
210
215
|
```text
|
|
211
216
|
my-project/
|
|
212
217
|
├── .agents/ # 共享 AI 协作配置
|
|
218
|
+
│ ├── .airc.json # 中央配置文件
|
|
219
|
+
│ ├── workspace/ # 任务工作区(git 忽略)
|
|
213
220
|
│ ├── skills/ # 28 个内置 AI skills
|
|
214
221
|
│ ├── workflows/ # 4 个预置工作流
|
|
215
222
|
│ └── templates/ # 任务与产物模板
|
|
216
|
-
├── .agent-workspace/ # 任务工作区(git 忽略)
|
|
217
223
|
├── .claude/ # Claude Code 配置与命令
|
|
218
224
|
├── .gemini/ # Gemini CLI 配置与命令
|
|
219
225
|
├── .opencode/ # OpenCode 配置与命令
|
|
220
|
-
|
|
221
|
-
├── AGENTS.md # 通用 AI agent 指令
|
|
222
|
-
├── CONTRIBUTING.md # 贡献指南
|
|
223
|
-
├── SECURITY.md # 安全策略(英文)
|
|
224
|
-
├── SECURITY.zh-CN.md # 安全策略(中文)
|
|
225
|
-
└── .airc.json # 中央配置文件
|
|
226
|
+
└── AGENTS.md # 通用 AI agent 指令
|
|
226
227
|
```
|
|
227
228
|
|
|
228
229
|
<a id="built-in-ai-skills"></a>
|
|
@@ -370,9 +371,9 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
370
371
|
|
|
371
372
|
## 配置参考
|
|
372
373
|
|
|
373
|
-
生成出的 `.airc.json` 是引导 CLI、模板系统和后续升级之间的中心契约。
|
|
374
|
+
生成出的 `.agents/.airc.json` 是引导 CLI、模板系统和后续升级之间的中心契约。
|
|
374
375
|
|
|
375
|
-
### `.airc.json` 示例
|
|
376
|
+
### `.agents/.airc.json` 示例
|
|
376
377
|
|
|
377
378
|
```json
|
|
378
379
|
{
|
|
@@ -380,10 +381,10 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
380
381
|
"org": "my-org",
|
|
381
382
|
"language": "en",
|
|
382
383
|
"templateSource": "templates/",
|
|
383
|
-
"templateVersion": "v0.
|
|
384
|
-
"modules": ["ai", "github"],
|
|
384
|
+
"templateVersion": "v0.4.0",
|
|
385
385
|
"files": {
|
|
386
386
|
"managed": [
|
|
387
|
+
".agents/workspace/README.md",
|
|
387
388
|
".agents/skills/",
|
|
388
389
|
".agents/templates/",
|
|
389
390
|
".agents/workflows/",
|
|
@@ -394,9 +395,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
394
395
|
"merged": [
|
|
395
396
|
".agents/README.md",
|
|
396
397
|
".gitignore",
|
|
397
|
-
"AGENTS.md"
|
|
398
|
-
"CONTRIBUTING.md",
|
|
399
|
-
"SECURITY.md"
|
|
398
|
+
"AGENTS.md"
|
|
400
399
|
],
|
|
401
400
|
"ejected": []
|
|
402
401
|
}
|
|
@@ -412,16 +411,8 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
412
411
|
| `language` | 渲染模板时采用的项目主语言或区域设置。 |
|
|
413
412
|
| `templateSource` | 本地模板根目录。 |
|
|
414
413
|
| `templateVersion` | 当前安装的模板版本,用于升级和差异追踪。 |
|
|
415
|
-
| `modules` | 启用的模板模块。可选值为 `ai` 和 `github`。 |
|
|
416
414
|
| `files` | 针对具体路径配置 `managed`、`merged`、`ejected` 三类更新策略。 |
|
|
417
415
|
|
|
418
|
-
### 模块说明
|
|
419
|
-
|
|
420
|
-
| 模块 | 包含内容 |
|
|
421
|
-
|------|----------|
|
|
422
|
-
| `ai` | `.agents/`、`.claude/`、`.gemini/`、`.opencode/`、`AGENTS.md` 及相关协作资产 |
|
|
423
|
-
| `github` | `.github/`、贡献模板、发布配置以及 GitHub 治理相关文件 |
|
|
424
|
-
|
|
425
416
|
<a id="file-management-strategies"></a>
|
|
426
417
|
|
|
427
418
|
## 文件管理策略
|
|
@@ -441,15 +432,14 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
441
432
|
"files": {
|
|
442
433
|
"managed": [
|
|
443
434
|
".agents/skills/",
|
|
444
|
-
".
|
|
435
|
+
".agents/workspace/README.md"
|
|
445
436
|
],
|
|
446
437
|
"merged": [
|
|
447
438
|
".gitignore",
|
|
448
|
-
"AGENTS.md"
|
|
449
|
-
"CONTRIBUTING.md"
|
|
439
|
+
"AGENTS.md"
|
|
450
440
|
],
|
|
451
441
|
"ejected": [
|
|
452
|
-
"
|
|
442
|
+
"docs/architecture.md"
|
|
453
443
|
]
|
|
454
444
|
}
|
|
455
445
|
}
|
|
@@ -457,7 +447,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
457
447
|
|
|
458
448
|
### 如何把文件从 `managed` 改为 `ejected`
|
|
459
449
|
|
|
460
|
-
1. 在 `.airc.json` 中把该路径从 `managed` 数组移除。
|
|
450
|
+
1. 在 `.agents/.airc.json` 中把该路径从 `managed` 数组移除。
|
|
461
451
|
2. 将同一路径加入 `ejected` 数组。
|
|
462
452
|
3. 再次执行 `update-agent-infra`,让后续升级不再管理这个文件。
|
|
463
453
|
|
|
@@ -467,7 +457,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
467
457
|
|
|
468
458
|
## 版本管理
|
|
469
459
|
|
|
470
|
-
agent-infra 通过 Git tag 和 GitHub release 使用语义化版本号。当前安装的模板版本记录在 `.airc.json` 的 `templateVersion` 字段中,方便人和 AI 工具在升级时都能基于同一个版本基线工作。
|
|
460
|
+
agent-infra 通过 Git tag 和 GitHub release 使用语义化版本号。当前安装的模板版本记录在 `.agents/.airc.json` 的 `templateVersion` 字段中,方便人和 AI 工具在升级时都能基于同一个版本基线工作。
|
|
471
461
|
|
|
472
462
|
<a id="contributing"></a>
|
|
473
463
|
|
package/bin/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ Shorthand: ai (e.g. ai init)
|
|
|
23
23
|
Install methods:
|
|
24
24
|
npm: npm install -g @fitlab-ai/agent-infra
|
|
25
25
|
npx: npx @fitlab-ai/agent-infra init
|
|
26
|
-
curl: curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
26
|
+
curl: curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh (runs npm install -g internally)
|
|
27
27
|
|
|
28
28
|
Examples:
|
|
29
29
|
cd my-project && agent-infra init
|
package/lib/defaults.json
CHANGED
|
@@ -4,15 +4,10 @@
|
|
|
4
4
|
".agents/skills/",
|
|
5
5
|
".agents/templates/",
|
|
6
6
|
".agents/workflows/",
|
|
7
|
-
".
|
|
7
|
+
".agents/workspace/README.md",
|
|
8
8
|
".claude/commands/",
|
|
9
|
-
".
|
|
9
|
+
".claude/hooks/",
|
|
10
10
|
".gemini/commands/",
|
|
11
|
-
".github/hooks/",
|
|
12
|
-
".github/ISSUE_TEMPLATE/",
|
|
13
|
-
".github/PULL_REQUEST_TEMPLATE.md",
|
|
14
|
-
".github/release.yml",
|
|
15
|
-
".github/workflows/pr-title-check.yml",
|
|
16
11
|
".opencode/commands/"
|
|
17
12
|
],
|
|
18
13
|
"merged": [
|
|
@@ -31,14 +26,10 @@
|
|
|
31
26
|
".claude/settings.json",
|
|
32
27
|
".codex/README.md",
|
|
33
28
|
".gemini/settings.json",
|
|
34
|
-
".github/dependabot.yml",
|
|
35
29
|
".gitignore",
|
|
36
|
-
".mailmap",
|
|
37
30
|
".opencode/COMMAND_STYLE_GUIDE.md",
|
|
38
31
|
".opencode/README.md",
|
|
39
|
-
"AGENTS.md"
|
|
40
|
-
"CONTRIBUTING.md",
|
|
41
|
-
"SECURITY.md"
|
|
32
|
+
"AGENTS.md"
|
|
42
33
|
],
|
|
43
34
|
"ejected": []
|
|
44
35
|
}
|
package/lib/init.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
4
|
import { info, ok, err } from './log.js';
|
|
5
5
|
import { prompt, closePrompt } from './prompt.js';
|
|
6
|
-
import { resolveTemplateDir
|
|
6
|
+
import { resolveTemplateDir } from './paths.js';
|
|
7
7
|
import { renderFile, copySkillDir } from './render.js';
|
|
8
8
|
import { VERSION } from './version.js';
|
|
9
9
|
|
|
@@ -50,28 +50,19 @@ async function cmdInit() {
|
|
|
50
50
|
if (!templateDir) {
|
|
51
51
|
err('Template directory not found.');
|
|
52
52
|
err('Install via npm: npm install -g @fitlab-ai/agent-infra');
|
|
53
|
-
err('Or via clone: curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh');
|
|
54
53
|
process.exitCode = 1;
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
if (isCloneInstall()) {
|
|
60
|
-
const installDir = resolveInstallDir();
|
|
61
|
-
if (fs.existsSync(path.join(installDir, '.git'))) {
|
|
62
|
-
info('Updating templates to latest version...');
|
|
63
|
-
try {
|
|
64
|
-
execSync('git pull --rebase --quiet', { cwd: installDir, stdio: 'pipe' });
|
|
65
|
-
ok('Templates updated.');
|
|
66
|
-
} catch {
|
|
67
|
-
err('Failed to update templates (network issue?). Using local version.');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
57
|
+
const configPath = path.join('.agents', '.airc.json');
|
|
71
58
|
|
|
72
|
-
// check existing
|
|
73
|
-
if (
|
|
74
|
-
|
|
59
|
+
// check existing config
|
|
60
|
+
if (
|
|
61
|
+
fs.existsSync(configPath) ||
|
|
62
|
+
fs.existsSync('.airc.json') ||
|
|
63
|
+
fs.existsSync(path.join('.agent-infra', 'config.json'))
|
|
64
|
+
) {
|
|
65
|
+
err('This project already has agent-infra configuration.');
|
|
75
66
|
err('Use /update-agent-infra in your AI TUI to update.');
|
|
76
67
|
process.exitCode = 1;
|
|
77
68
|
return;
|
|
@@ -113,7 +104,6 @@ async function cmdInit() {
|
|
|
113
104
|
return;
|
|
114
105
|
}
|
|
115
106
|
|
|
116
|
-
const modules = 'ai,github';
|
|
117
107
|
const project = projectName;
|
|
118
108
|
const replacements = { project, org: orgName };
|
|
119
109
|
|
|
@@ -170,20 +160,19 @@ async function cmdInit() {
|
|
|
170
160
|
);
|
|
171
161
|
ok('Installed .opencode/commands/update-agent-infra.md');
|
|
172
162
|
|
|
173
|
-
// generate .airc.json
|
|
174
|
-
const modulesArray = modules.split(',');
|
|
163
|
+
// generate .agents/.airc.json
|
|
175
164
|
const config = {
|
|
176
165
|
project: projectName,
|
|
177
166
|
org: orgName,
|
|
178
167
|
language,
|
|
179
168
|
templateSource: 'templates/',
|
|
180
169
|
templateVersion: VERSION,
|
|
181
|
-
modules: modulesArray,
|
|
182
170
|
files: structuredClone(defaults.files)
|
|
183
171
|
};
|
|
184
172
|
|
|
185
|
-
fs.
|
|
186
|
-
|
|
173
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
174
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
175
|
+
ok(`Generated ${configPath}`);
|
|
187
176
|
|
|
188
177
|
// done
|
|
189
178
|
console.log('');
|
package/lib/paths.js
CHANGED
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
2
|
import { fileURLToPath } from 'node:url';
|
|
5
3
|
|
|
6
|
-
function resolveBundledTemplateDir() {
|
|
7
|
-
return fileURLToPath(new URL('../templates', import.meta.url));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function resolveCloneTemplateDir() {
|
|
11
|
-
return path.join(os.homedir(), '.agent-infra', 'templates');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function normalizePath(targetPath) {
|
|
15
|
-
try {
|
|
16
|
-
return fs.realpathSync(targetPath);
|
|
17
|
-
} catch {
|
|
18
|
-
return path.resolve(targetPath);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
4
|
function resolveTemplateDir() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (fs.existsSync(npmPath)) {
|
|
26
|
-
return npmPath;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// clone install mode: ~/.agent-infra/templates
|
|
30
|
-
const clonePath = resolveCloneTemplateDir();
|
|
31
|
-
if (fs.existsSync(clonePath)) {
|
|
32
|
-
return clonePath;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function resolveInstallDir() {
|
|
39
|
-
return path.join(os.homedir(), '.agent-infra');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function isCloneInstall() {
|
|
43
|
-
const npmPath = resolveBundledTemplateDir();
|
|
44
|
-
const clonePath = resolveCloneTemplateDir();
|
|
45
|
-
return fs.existsSync(npmPath) && normalizePath(npmPath) === normalizePath(clonePath);
|
|
5
|
+
const bundledDir = fileURLToPath(new URL('../templates', import.meta.url));
|
|
6
|
+
return fs.existsSync(bundledDir) ? bundledDir : null;
|
|
46
7
|
}
|
|
47
8
|
|
|
48
|
-
export { resolveTemplateDir
|
|
9
|
+
export { resolveTemplateDir };
|