@fitlab-ai/agent-infra 0.3.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/License.txt +21 -0
- package/README.md +170 -0
- package/README.zh-CN.md +170 -0
- package/bin/cli.js +65 -0
- package/lib/defaults.json +45 -0
- package/lib/init.js +203 -0
- package/lib/log.js +27 -0
- package/lib/paths.js +48 -0
- package/lib/prompt.js +70 -0
- package/lib/render.js +99 -0
- package/lib/update.js +161 -0
- package/lib/version.js +7 -0
- package/package.json +48 -0
- package/templates/.agent-workspace/README.md +26 -0
- package/templates/.agent-workspace/README.zh-CN.md +26 -0
- package/templates/.agents/QUICKSTART.md +166 -0
- package/templates/.agents/QUICKSTART.zh-CN.md +166 -0
- package/templates/.agents/README.md +134 -0
- package/templates/.agents/README.zh-CN.md +134 -0
- package/templates/.agents/skills/analyze-task/SKILL.md +169 -0
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +169 -0
- package/templates/.agents/skills/block-task/SKILL.md +164 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +163 -0
- package/templates/.agents/skills/check-task/SKILL.md +122 -0
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-dependabot/SKILL.md +130 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +130 -0
- package/templates/.agents/skills/commit/SKILL.md +218 -0
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +217 -0
- package/templates/.agents/skills/complete-task/SKILL.md +139 -0
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +137 -0
- package/templates/.agents/skills/create-pr/SKILL.md +126 -0
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +125 -0
- package/templates/.agents/skills/create-release-note/SKILL.md +167 -0
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +166 -0
- package/templates/.agents/skills/create-task/SKILL.md +143 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +143 -0
- package/templates/.agents/skills/implement-task/SKILL.md +229 -0
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +227 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +103 -0
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +103 -0
- package/templates/.agents/skills/import-dependabot/SKILL.md +107 -0
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +107 -0
- package/templates/.agents/skills/import-issue/SKILL.md +119 -0
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +119 -0
- package/templates/.agents/skills/init-labels/SKILL.md +74 -0
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +111 -0
- package/templates/.agents/skills/init-milestones/SKILL.md +74 -0
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +169 -0
- package/templates/.agents/skills/plan-task/SKILL.md +225 -0
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +225 -0
- package/templates/.agents/skills/refine-task/SKILL.md +200 -0
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +200 -0
- package/templates/.agents/skills/refine-title/SKILL.md +84 -0
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +83 -0
- package/templates/.agents/skills/release/SKILL.md +142 -0
- package/templates/.agents/skills/release/SKILL.zh-CN.md +141 -0
- package/templates/.agents/skills/release/scripts/manage-milestones.sh +80 -0
- package/templates/.agents/skills/review-task/SKILL.md +276 -0
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +276 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +569 -0
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +569 -0
- package/templates/.agents/skills/sync-pr/SKILL.md +142 -0
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +142 -0
- package/templates/.agents/skills/test/SKILL.md +61 -0
- package/templates/.agents/skills/test/SKILL.zh-CN.md +61 -0
- package/templates/.agents/skills/test-integration/SKILL.md +70 -0
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +69 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.md +136 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +124 -0
- package/templates/.agents/skills/update-agent-infra/scripts/package.json +3 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +469 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.md +88 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +87 -0
- package/templates/.agents/templates/handoff.md +60 -0
- package/templates/.agents/templates/handoff.zh-CN.md +60 -0
- package/templates/.agents/templates/review-report.md +67 -0
- package/templates/.agents/templates/review-report.zh-CN.md +67 -0
- package/templates/.agents/templates/task.md +65 -0
- package/templates/.agents/templates/task.zh-CN.md +65 -0
- package/templates/.agents/workflows/bug-fix.yaml +149 -0
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +149 -0
- package/templates/.agents/workflows/code-review.yaml +60 -0
- package/templates/.agents/workflows/code-review.zh-CN.yaml +60 -0
- package/templates/.agents/workflows/feature-development.yaml +150 -0
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +150 -0
- package/templates/.agents/workflows/refactoring.yaml +154 -0
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +154 -0
- package/templates/.claude/CLAUDE.md +163 -0
- package/templates/.claude/CLAUDE.zh-CN.md +163 -0
- package/templates/.claude/commands/analyze-task.md +8 -0
- package/templates/.claude/commands/analyze-task.zh-CN.md +8 -0
- package/templates/.claude/commands/block-task.md +8 -0
- package/templates/.claude/commands/block-task.zh-CN.md +8 -0
- package/templates/.claude/commands/check-task.md +8 -0
- package/templates/.claude/commands/check-task.zh-CN.md +8 -0
- package/templates/.claude/commands/close-codescan.md +8 -0
- package/templates/.claude/commands/close-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/close-dependabot.md +8 -0
- package/templates/.claude/commands/close-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/commit.md +7 -0
- package/templates/.claude/commands/commit.zh-CN.md +7 -0
- package/templates/.claude/commands/complete-task.md +8 -0
- package/templates/.claude/commands/complete-task.zh-CN.md +8 -0
- package/templates/.claude/commands/create-pr.md +8 -0
- package/templates/.claude/commands/create-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/create-release-note.md +8 -0
- package/templates/.claude/commands/create-release-note.zh-CN.md +8 -0
- package/templates/.claude/commands/create-task.md +8 -0
- package/templates/.claude/commands/create-task.zh-CN.md +8 -0
- package/templates/.claude/commands/implement-task.md +8 -0
- package/templates/.claude/commands/implement-task.zh-CN.md +8 -0
- package/templates/.claude/commands/import-codescan.md +8 -0
- package/templates/.claude/commands/import-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/import-dependabot.md +8 -0
- package/templates/.claude/commands/import-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/import-issue.md +8 -0
- package/templates/.claude/commands/import-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/init-labels.md +7 -0
- package/templates/.claude/commands/init-labels.zh-CN.md +7 -0
- package/templates/.claude/commands/init-milestones.md +8 -0
- package/templates/.claude/commands/init-milestones.zh-CN.md +8 -0
- package/templates/.claude/commands/plan-task.md +8 -0
- package/templates/.claude/commands/plan-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-task.md +8 -0
- package/templates/.claude/commands/refine-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-title.md +8 -0
- package/templates/.claude/commands/refine-title.zh-CN.md +8 -0
- package/templates/.claude/commands/release.md +8 -0
- package/templates/.claude/commands/release.zh-CN.md +8 -0
- package/templates/.claude/commands/review-task.md +8 -0
- package/templates/.claude/commands/review-task.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-issue.md +8 -0
- package/templates/.claude/commands/sync-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-pr.md +8 -0
- package/templates/.claude/commands/sync-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/test-integration.md +7 -0
- package/templates/.claude/commands/test-integration.zh-CN.md +7 -0
- package/templates/.claude/commands/test.md +7 -0
- package/templates/.claude/commands/test.zh-CN.md +7 -0
- package/templates/.claude/commands/update-agent-infra.md +7 -0
- package/templates/.claude/commands/update-agent-infra.zh-CN.md +7 -0
- package/templates/.claude/commands/upgrade-dependency.md +8 -0
- package/templates/.claude/commands/upgrade-dependency.zh-CN.md +8 -0
- package/templates/.claude/project-rules.md +65 -0
- package/templates/.claude/project-rules.zh-CN.md +65 -0
- package/templates/.claude/settings.json +20 -0
- package/templates/.codex/README.md +38 -0
- package/templates/.codex/README.zh-CN.md +37 -0
- package/templates/.editorconfig +15 -0
- package/templates/.gemini/commands/_project_/analyze-task.toml +8 -0
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/commit.toml +6 -0
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/complete-task.toml +8 -0
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-milestones.toml +10 -0
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +10 -0
- package/templates/.gemini/commands/_project_/plan-task.toml +8 -0
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/release.toml +8 -0
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/test-integration.toml +6 -0
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/test.toml +6 -0
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.toml +8 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +8 -0
- package/templates/.gemini/settings.json +3 -0
- package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +149 -0
- package/templates/.github/ISSUE_TEMPLATE/02_question.yml +101 -0
- package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +131 -0
- package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +165 -0
- package/templates/.github/ISSUE_TEMPLATE/05_other.yml +147 -0
- package/templates/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/templates/.github/PULL_REQUEST_TEMPLATE.md +123 -0
- package/templates/.github/dependabot.yml +17 -0
- package/templates/.github/hooks/check-utf8-encoding.sh +25 -0
- package/templates/.github/release.yml +27 -0
- package/templates/.github/workflows/pr-title-check.yml +42 -0
- package/templates/.mailmap +4 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +232 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +232 -0
- package/templates/.opencode/README.md +76 -0
- package/templates/.opencode/README.zh-CN.md +77 -0
- package/templates/.opencode/commands/analyze-task.md +11 -0
- package/templates/.opencode/commands/analyze-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/block-task.md +11 -0
- package/templates/.opencode/commands/block-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/check-task.md +11 -0
- package/templates/.opencode/commands/check-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-codescan.md +11 -0
- package/templates/.opencode/commands/close-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-dependabot.md +11 -0
- package/templates/.opencode/commands/close-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/commit.md +9 -0
- package/templates/.opencode/commands/commit.zh-CN.md +9 -0
- package/templates/.opencode/commands/complete-task.md +11 -0
- package/templates/.opencode/commands/complete-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-pr.md +11 -0
- package/templates/.opencode/commands/create-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-release-note.md +11 -0
- package/templates/.opencode/commands/create-release-note.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-task.md +11 -0
- package/templates/.opencode/commands/create-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/implement-task.md +11 -0
- package/templates/.opencode/commands/implement-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-codescan.md +11 -0
- package/templates/.opencode/commands/import-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-dependabot.md +11 -0
- package/templates/.opencode/commands/import-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-issue.md +11 -0
- package/templates/.opencode/commands/import-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/init-labels.md +9 -0
- package/templates/.opencode/commands/init-labels.zh-CN.md +9 -0
- package/templates/.opencode/commands/init-milestones.md +11 -0
- package/templates/.opencode/commands/init-milestones.zh-CN.md +11 -0
- package/templates/.opencode/commands/plan-task.md +11 -0
- package/templates/.opencode/commands/plan-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-task.md +11 -0
- package/templates/.opencode/commands/refine-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-title.md +11 -0
- package/templates/.opencode/commands/refine-title.zh-CN.md +11 -0
- package/templates/.opencode/commands/release.md +11 -0
- package/templates/.opencode/commands/release.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-task.md +11 -0
- package/templates/.opencode/commands/review-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-issue.md +11 -0
- package/templates/.opencode/commands/sync-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-pr.md +11 -0
- package/templates/.opencode/commands/sync-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/test-integration.md +9 -0
- package/templates/.opencode/commands/test-integration.zh-CN.md +9 -0
- package/templates/.opencode/commands/test.md +9 -0
- package/templates/.opencode/commands/test.zh-CN.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.zh-CN.md +9 -0
- package/templates/.opencode/commands/upgrade-dependency.md +11 -0
- package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +11 -0
- package/templates/AGENTS.md +91 -0
- package/templates/AGENTS.zh-CN.md +91 -0
- package/templates/CONTRIBUTING.md +126 -0
- package/templates/CONTRIBUTING.zh-CN.md +124 -0
- package/templates/SECURITY.md +131 -0
- package/templates/SECURITY.zh-CN.md +131 -0
package/License.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fitlab-ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Agent Infra
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@fitlab-ai/agent-infra)
|
|
4
|
+
[](https://www.npmjs.com/package/@fitlab-ai/agent-infra)
|
|
5
|
+
[](License.txt)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://github.com/fitlab-ai/agent-infra/releases)
|
|
8
|
+
|
|
9
|
+
A template and skill repository for initializing and maintaining AI multi-tool collaboration infrastructure and project governance across software projects.
|
|
10
|
+
|
|
11
|
+
[中文版](README.zh-CN.md)
|
|
12
|
+
|
|
13
|
+
## What is agent-infra?
|
|
14
|
+
|
|
15
|
+
agent-infra provides standardized configuration for AI TUI tools (Claude Code, Codex, Gemini CLI, OpenCode) to collaborate effectively on the same project. A lightweight bootstrap CLI seeds the first command; all subsequent operations are AI skill-driven.
|
|
16
|
+
|
|
17
|
+
### Key Features
|
|
18
|
+
|
|
19
|
+
- **Multi-AI Collaboration**: Structured workflows for Claude Code, Codex, Gemini CLI, and OpenCode to work together
|
|
20
|
+
- **Bootstrap CLI + Skill-Driven**: One-time CLI init, then all operations are AI skills
|
|
21
|
+
- **Bilingual Support**: Every user-facing file is available in English and Chinese
|
|
22
|
+
- **Modular Design**: Two independent modules (`ai` and `github`) that can be installed separately
|
|
23
|
+
- **Template Source Architecture**: `templates/` mirrors the working tree and is rendered into project files
|
|
24
|
+
- **AI Intelligent Merge**: LLMs handle template merging during updates, preserving user customizations
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### 1. Install agent-infra
|
|
29
|
+
|
|
30
|
+
**Option A — npm (recommended)**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @fitlab-ai/agent-infra
|
|
34
|
+
npx @fitlab-ai/agent-infra init
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Option B — Shell script**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Option C — Install from source**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/fitlab-ai/agent-infra.git
|
|
47
|
+
cd agent-infra
|
|
48
|
+
sh install.sh
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Initialize a new project
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cd my-project
|
|
55
|
+
ai init
|
|
56
|
+
# or: agent-infra init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The CLI will interactively collect project info (name, org, language, etc.), install the `update-agent-infra` seed command for all AI TUIs, and generate `.airc.json`.
|
|
60
|
+
|
|
61
|
+
> **Tip:** `ai` is a shorthand for `agent-infra`. Both commands are equivalent.
|
|
62
|
+
|
|
63
|
+
### 3. Render the full infrastructure
|
|
64
|
+
|
|
65
|
+
Open the project in any AI TUI and run `update-agent-infra`:
|
|
66
|
+
|
|
67
|
+
| TUI | Command |
|
|
68
|
+
|-----|---------|
|
|
69
|
+
| Claude Code | `/update-agent-infra` |
|
|
70
|
+
| Codex | `$update-agent-infra` |
|
|
71
|
+
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
72
|
+
| OpenCode | `/update-agent-infra` |
|
|
73
|
+
|
|
74
|
+
This pulls the latest templates and renders all files. Use the same command for future updates — it automatically handles both first-time setup and incremental updates.
|
|
75
|
+
|
|
76
|
+
## What You Get
|
|
77
|
+
|
|
78
|
+
After setup, your project gains a complete AI collaboration infrastructure:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
my-project/
|
|
82
|
+
├── .agents/ # Shared AI collaboration config
|
|
83
|
+
│ ├── skills/ # 30+ built-in AI skills
|
|
84
|
+
│ ├── workflows/ # Structured development workflows
|
|
85
|
+
│ └── templates/ # Task & artifact templates
|
|
86
|
+
├── .agent-workspace/ # Task workspace (git-ignored)
|
|
87
|
+
├── .claude/ # Claude Code config & commands
|
|
88
|
+
├── .gemini/ # Gemini CLI config & commands
|
|
89
|
+
├── .opencode/ # OpenCode config & commands
|
|
90
|
+
├── .github/ # PR templates, issue forms, workflows
|
|
91
|
+
├── AGENTS.md # Universal AI agent instructions
|
|
92
|
+
├── CONTRIBUTING.md # Development guide
|
|
93
|
+
├── SECURITY.md # Security policy (English)
|
|
94
|
+
├── SECURITY.zh-CN.md # Security policy (Chinese)
|
|
95
|
+
└── .airc.json # Central configuration
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Built-in AI Skills
|
|
99
|
+
|
|
100
|
+
| Category | Skills | Description |
|
|
101
|
+
|----------|--------|-------------|
|
|
102
|
+
| **Task Management** | `create-task`, `analyze-task`, `import-issue`, `plan-task`, `implement-task`, `review-task`, `refine-task`, `complete-task` | Full development lifecycle |
|
|
103
|
+
| **Code Quality** | `commit`, `test`, `test-integration` | Commit with co-authorship, run tests |
|
|
104
|
+
| **PR & Issues** | `create-pr`, `sync-issue`, `sync-pr` | Create PRs, sync progress |
|
|
105
|
+
| **Release** | `release`, `create-release-note` | Version release workflow |
|
|
106
|
+
| **Security** | `import-dependabot`, `import-codescan` | Security alert triage |
|
|
107
|
+
| **Maintenance** | `upgrade-dependency`, `refine-title` | Dependency updates, title formatting |
|
|
108
|
+
|
|
109
|
+
> Every skill works across all supported AI TUIs — same workflow, any tool.
|
|
110
|
+
|
|
111
|
+
### Basic Workflow Example
|
|
112
|
+
|
|
113
|
+
The simplest end-to-end development workflow:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
import-issue #42 Import task from GitHub Issue
|
|
117
|
+
(or: create-task "add dark mode") Or create task from description
|
|
118
|
+
|
|
|
119
|
+
| --> get task ID, e.g. T1
|
|
120
|
+
v
|
|
121
|
+
analyze-task T1 Requirement analysis
|
|
122
|
+
|
|
|
123
|
+
v
|
|
124
|
+
plan-task T1 Design solution <-- human review
|
|
125
|
+
|
|
|
126
|
+
v
|
|
127
|
+
implement-task T1 Write code & tests
|
|
128
|
+
|
|
|
129
|
+
v
|
|
130
|
+
+-> review-task T1 Automated code review
|
|
131
|
+
| |
|
|
132
|
+
| Issues?
|
|
133
|
+
| +--NO-------+
|
|
134
|
+
| YES |
|
|
135
|
+
| | |
|
|
136
|
+
| v |
|
|
137
|
+
| refine-task T1 |
|
|
138
|
+
| | |
|
|
139
|
+
+------+ |
|
|
140
|
+
|
|
|
141
|
+
+-----------+
|
|
142
|
+
|
|
|
143
|
+
v
|
|
144
|
+
commit Commit final code
|
|
145
|
+
|
|
|
146
|
+
v
|
|
147
|
+
complete-task T1 Archive & done
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## File Management Strategies
|
|
151
|
+
|
|
152
|
+
| Strategy | Meaning | Update Behavior |
|
|
153
|
+
|----------|---------|----------------|
|
|
154
|
+
| **managed** | agent-infra fully controls | Overwrite on update; users should not modify |
|
|
155
|
+
| **merged** | Template + user customizations coexist | AI intelligent merge preserving user additions |
|
|
156
|
+
| **ejected** | Generated only on first run | Never updated |
|
|
157
|
+
|
|
158
|
+
Users can adjust strategies per file in `.airc.json`.
|
|
159
|
+
|
|
160
|
+
## Version Management
|
|
161
|
+
|
|
162
|
+
Uses semantic versioning via git tags. Template version is tracked in `.airc.json` as `templateVersion`.
|
|
163
|
+
|
|
164
|
+
## Contributing
|
|
165
|
+
|
|
166
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
[MIT](License.txt)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Agent Infra
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@fitlab-ai/agent-infra)
|
|
4
|
+
[](https://www.npmjs.com/package/@fitlab-ai/agent-infra)
|
|
5
|
+
[](License.txt)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://github.com/fitlab-ai/agent-infra/releases)
|
|
8
|
+
|
|
9
|
+
用于初始化和维护 AI 多工具协作基础设施及项目治理配置的模板仓库和技能仓库。
|
|
10
|
+
|
|
11
|
+
[English](README.md)
|
|
12
|
+
|
|
13
|
+
## 什么是 agent-infra?
|
|
14
|
+
|
|
15
|
+
agent-infra 为 AI TUI 工具(Claude Code、Codex、Gemini CLI、OpenCode)提供标准化配置,使它们能在同一项目中高效协作。轻量级引导 CLI 安装种子命令,后续所有操作由 AI 技能驱动。
|
|
16
|
+
|
|
17
|
+
### 核心特性
|
|
18
|
+
|
|
19
|
+
- **多 AI 协作**:为 Claude Code、Codex、Gemini CLI 和 OpenCode 提供结构化工作流
|
|
20
|
+
- **引导 CLI + 技能驱动**:一次 CLI 初始化,后续全部通过 AI 技能完成
|
|
21
|
+
- **双语支持**:所有面向用户的文件提供英文和中文两个版本
|
|
22
|
+
- **模块化设计**:两个独立模块(`ai` 和 `github`),可单独安装
|
|
23
|
+
- **模板源架构**:`templates/` 完整镜像工作目录,再渲染生成项目工作文件
|
|
24
|
+
- **AI 智能合并**:更新时由大模型处理模板合并,保留用户定制内容
|
|
25
|
+
|
|
26
|
+
## 快速开始
|
|
27
|
+
|
|
28
|
+
### 1. 安装 agent-infra
|
|
29
|
+
|
|
30
|
+
**方式 A — npm(推荐)**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @fitlab-ai/agent-infra
|
|
34
|
+
npx @fitlab-ai/agent-infra init
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**方式 B — Shell 脚本**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**方式 C — 源码安装**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/fitlab-ai/agent-infra.git
|
|
47
|
+
cd agent-infra
|
|
48
|
+
sh install.sh
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. 初始化新项目
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cd my-project
|
|
55
|
+
ai init
|
|
56
|
+
# 或: agent-infra init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
CLI 会交互式收集项目信息(名称、组织、语言等),安装 `update-agent-infra` 种子命令到所有 AI TUI,并生成 `.airc.json`。
|
|
60
|
+
|
|
61
|
+
> **提示:** `ai` 是 `agent-infra` 的简写命令,两者完全等价。
|
|
62
|
+
|
|
63
|
+
### 3. 渲染完整基础设施
|
|
64
|
+
|
|
65
|
+
在任意 AI TUI 中执行 `update-agent-infra`:
|
|
66
|
+
|
|
67
|
+
| TUI | 命令 |
|
|
68
|
+
|-----|------|
|
|
69
|
+
| Claude Code | `/update-agent-infra` |
|
|
70
|
+
| Codex | `$update-agent-infra` |
|
|
71
|
+
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
72
|
+
| OpenCode | `/update-agent-infra` |
|
|
73
|
+
|
|
74
|
+
该命令会拉取最新模板并渲染所有文件。后续更新使用同一命令——自动处理首次安装和增量更新。
|
|
75
|
+
|
|
76
|
+
## 安装效果
|
|
77
|
+
|
|
78
|
+
安装完成后,项目将获得完整的 AI 协作基础设施:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
my-project/
|
|
82
|
+
├── .agents/ # 共享 AI 协作配置
|
|
83
|
+
│ ├── skills/ # 30+ 内置 AI 技能
|
|
84
|
+
│ ├── workflows/ # 结构化开发工作流
|
|
85
|
+
│ └── templates/ # 任务与产物模板
|
|
86
|
+
├── .agent-workspace/ # 任务工作区(已被 git 忽略)
|
|
87
|
+
├── .claude/ # Claude Code 配置与命令
|
|
88
|
+
├── .gemini/ # Gemini CLI 配置与命令
|
|
89
|
+
├── .opencode/ # OpenCode 配置与命令
|
|
90
|
+
├── .github/ # PR 模板、Issue 表单、工作流
|
|
91
|
+
├── AGENTS.md # 通用 AI 代理指令
|
|
92
|
+
├── CONTRIBUTING.md # 开发指南
|
|
93
|
+
├── SECURITY.md # 安全政策(英文)
|
|
94
|
+
├── SECURITY.zh-CN.md # 安全政策(中文)
|
|
95
|
+
└── .airc.json # 中央配置文件
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 内置 AI 技能
|
|
99
|
+
|
|
100
|
+
| 分类 | 技能 | 说明 |
|
|
101
|
+
|------|------|------|
|
|
102
|
+
| **任务管理** | `create-task`、`analyze-task`、`import-issue`、`plan-task`、`implement-task`、`review-task`、`refine-task`、`complete-task` | 完整开发生命周期 |
|
|
103
|
+
| **代码质量** | `commit`、`test`、`test-integration` | 带联合署名的提交、运行测试 |
|
|
104
|
+
| **PR 与 Issue** | `create-pr`、`sync-issue`、`sync-pr` | 创建 PR、同步进度 |
|
|
105
|
+
| **发布** | `release`、`create-release-note` | 版本发布工作流 |
|
|
106
|
+
| **安全** | `import-dependabot`、`import-codescan` | 安全告警分析 |
|
|
107
|
+
| **维护** | `upgrade-dependency`、`refine-title` | 依赖升级、标题优化 |
|
|
108
|
+
|
|
109
|
+
> 所有技能在所有支持的 AI TUI 中通用——同一工作流,任选工具。
|
|
110
|
+
|
|
111
|
+
### 基本工作流示例
|
|
112
|
+
|
|
113
|
+
最简单的端到端开发工作流:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
import-issue #42 从 GitHub Issue 导入任务
|
|
117
|
+
(或: create-task "添加暗色模式") 或直接描述需求创建任务
|
|
118
|
+
|
|
|
119
|
+
| --> 得到任务 ID, 如 T1
|
|
120
|
+
v
|
|
121
|
+
analyze-task T1 需求分析
|
|
122
|
+
|
|
|
123
|
+
v
|
|
124
|
+
plan-task T1 设计技术方案 <-- 人工审查检查点
|
|
125
|
+
|
|
|
126
|
+
v
|
|
127
|
+
implement-task T1 编写代码与测试
|
|
128
|
+
|
|
|
129
|
+
v
|
|
130
|
+
+-> review-task T1 自动代码审查
|
|
131
|
+
| |
|
|
132
|
+
| 有问题?
|
|
133
|
+
| +--NO-------+
|
|
134
|
+
| YES |
|
|
135
|
+
| | |
|
|
136
|
+
| v |
|
|
137
|
+
| refine-task T1 |
|
|
138
|
+
| | |
|
|
139
|
+
+------+ |
|
|
140
|
+
|
|
|
141
|
+
+-----------+
|
|
142
|
+
|
|
|
143
|
+
v
|
|
144
|
+
commit 提交最终代码
|
|
145
|
+
|
|
|
146
|
+
v
|
|
147
|
+
complete-task T1 归档完成
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 文件管理策略
|
|
151
|
+
|
|
152
|
+
| 策略 | 含义 | 更新行为 |
|
|
153
|
+
|------|------|---------|
|
|
154
|
+
| **managed** | agent-infra 完全控制 | 更新时覆盖,用户不应修改 |
|
|
155
|
+
| **merged** | 模板 + 用户定制共存 | AI 智能合并,保留用户添加的内容 |
|
|
156
|
+
| **ejected** | 仅首次运行时生成 | 永不更新 |
|
|
157
|
+
|
|
158
|
+
用户可在 `.airc.json` 中按文件调整策略。
|
|
159
|
+
|
|
160
|
+
## 版本管理
|
|
161
|
+
|
|
162
|
+
通过 git tag 使用语义版本号。模板版本记录在 `.airc.json` 的 `templateVersion` 字段中。
|
|
163
|
+
|
|
164
|
+
## 参与贡献
|
|
165
|
+
|
|
166
|
+
请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 了解开发指南。
|
|
167
|
+
|
|
168
|
+
## 许可协议
|
|
169
|
+
|
|
170
|
+
[MIT](License.txt)
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { VERSION } from '../lib/version.js';
|
|
3
|
+
|
|
4
|
+
// Node.js version check
|
|
5
|
+
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
6
|
+
if (major < 18) {
|
|
7
|
+
process.stderr.write(
|
|
8
|
+
`agent-infra requires Node.js >= 18 (current: ${process.version})\n`
|
|
9
|
+
);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const USAGE = `agent-infra - bootstrap AI collaboration infrastructure
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
agent-infra init Initialize a new project with update-agent-infra seed command
|
|
17
|
+
agent-infra update Update seed files and sync file registry for an existing project
|
|
18
|
+
agent-infra version Show version
|
|
19
|
+
agent-infra help Show this help message
|
|
20
|
+
|
|
21
|
+
Shorthand: ai (e.g. ai init)
|
|
22
|
+
|
|
23
|
+
Install methods:
|
|
24
|
+
npm: npm install -g @fitlab-ai/agent-infra
|
|
25
|
+
npx: npx @fitlab-ai/agent-infra init
|
|
26
|
+
curl: curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
cd my-project && agent-infra init
|
|
30
|
+
npx @fitlab-ai/agent-infra init
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const command = process.argv[2] || '';
|
|
34
|
+
|
|
35
|
+
switch (command) {
|
|
36
|
+
case 'init': {
|
|
37
|
+
const { cmdInit } = await import('../lib/init.js');
|
|
38
|
+
await cmdInit().catch((e) => {
|
|
39
|
+
process.stderr.write(`Error: ${e.message}\n`);
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
});
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'update': {
|
|
45
|
+
const { cmdUpdate } = await import('../lib/update.js');
|
|
46
|
+
await cmdUpdate().catch((e) => {
|
|
47
|
+
process.stderr.write(`Error: ${e.message}\n`);
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case 'version': {
|
|
53
|
+
console.log(`agent-infra ${VERSION}`);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'help':
|
|
57
|
+
case '':
|
|
58
|
+
process.stdout.write(USAGE);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
process.stderr.write(`Unknown command: ${command}\n\n`);
|
|
62
|
+
process.stdout.write(USAGE);
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"managed": [
|
|
4
|
+
".agents/skills/",
|
|
5
|
+
".agents/templates/",
|
|
6
|
+
".agents/workflows/",
|
|
7
|
+
".agent-workspace/README.md",
|
|
8
|
+
".claude/commands/",
|
|
9
|
+
".editorconfig",
|
|
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
|
+
".opencode/commands/"
|
|
17
|
+
],
|
|
18
|
+
"merged": [
|
|
19
|
+
"**/release.*",
|
|
20
|
+
"**/test-integration.*",
|
|
21
|
+
"**/test.*",
|
|
22
|
+
"**/upgrade-dependency.*",
|
|
23
|
+
".agents/QUICKSTART.md",
|
|
24
|
+
".agents/README.md",
|
|
25
|
+
".agents/skills/release/SKILL.*",
|
|
26
|
+
".agents/skills/test-integration/SKILL.*",
|
|
27
|
+
".agents/skills/test/SKILL.*",
|
|
28
|
+
".agents/skills/upgrade-dependency/SKILL.*",
|
|
29
|
+
".claude/CLAUDE.md",
|
|
30
|
+
".claude/project-rules.md",
|
|
31
|
+
".claude/settings.json",
|
|
32
|
+
".codex/README.md",
|
|
33
|
+
".gemini/settings.json",
|
|
34
|
+
".github/dependabot.yml",
|
|
35
|
+
".gitignore",
|
|
36
|
+
".mailmap",
|
|
37
|
+
".opencode/COMMAND_STYLE_GUIDE.md",
|
|
38
|
+
".opencode/README.md",
|
|
39
|
+
"AGENTS.md",
|
|
40
|
+
"CONTRIBUTING.md",
|
|
41
|
+
"SECURITY.md"
|
|
42
|
+
],
|
|
43
|
+
"ejected": []
|
|
44
|
+
}
|
|
45
|
+
}
|
package/lib/init.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { info, ok, err } from './log.js';
|
|
5
|
+
import { prompt, closePrompt } from './prompt.js';
|
|
6
|
+
import { resolveTemplateDir, resolveInstallDir, isCloneInstall } from './paths.js';
|
|
7
|
+
import { renderFile, copySkillDir } from './render.js';
|
|
8
|
+
import { VERSION } from './version.js';
|
|
9
|
+
|
|
10
|
+
const defaults = JSON.parse(
|
|
11
|
+
fs.readFileSync(new URL('./defaults.json', import.meta.url), 'utf8')
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
function detectProjectName() {
|
|
15
|
+
try {
|
|
16
|
+
const url = execSync('git remote get-url origin', { stdio: ['pipe', 'pipe', 'pipe'] })
|
|
17
|
+
.toString().trim().replace(/\.git$/, '');
|
|
18
|
+
return path.basename(url);
|
|
19
|
+
} catch {
|
|
20
|
+
return path.basename(process.cwd());
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function detectOrgName() {
|
|
25
|
+
try {
|
|
26
|
+
const url = execSync('git remote get-url origin', { stdio: ['pipe', 'pipe', 'pipe'] })
|
|
27
|
+
.toString().trim().replace(/\.git$/, '');
|
|
28
|
+
// SSH: git@github.com:org/repo → org
|
|
29
|
+
// HTTPS: https://github.com/org/repo → org
|
|
30
|
+
const sshMatch = url.match(/:([^/]+)\//);
|
|
31
|
+
if (sshMatch) return sshMatch[1];
|
|
32
|
+
const httpsMatch = url.match(/\/\/[^/]+\/([^/]+)\//);
|
|
33
|
+
if (httpsMatch) return httpsMatch[1];
|
|
34
|
+
} catch {
|
|
35
|
+
// no remote
|
|
36
|
+
}
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const VALID_NAME_RE = /^[a-zA-Z0-9_.@-]+$/;
|
|
41
|
+
|
|
42
|
+
async function cmdInit() {
|
|
43
|
+
console.log('');
|
|
44
|
+
console.log(' agent-infra init');
|
|
45
|
+
console.log(' ================================');
|
|
46
|
+
console.log('');
|
|
47
|
+
|
|
48
|
+
// resolve templates
|
|
49
|
+
const templateDir = resolveTemplateDir();
|
|
50
|
+
if (!templateDir) {
|
|
51
|
+
err('Template directory not found.');
|
|
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
|
+
process.exitCode = 1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// auto-update: only for clone installs
|
|
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
|
+
}
|
|
71
|
+
|
|
72
|
+
// check existing .airc.json
|
|
73
|
+
if (fs.existsSync('.airc.json')) {
|
|
74
|
+
err('This project already has a .airc.json.');
|
|
75
|
+
err('Use /update-agent-infra in your AI TUI to update.');
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// collect project info
|
|
81
|
+
const defaultProject = detectProjectName();
|
|
82
|
+
const projectName = await prompt('Project name', defaultProject);
|
|
83
|
+
if (!projectName) {
|
|
84
|
+
err('Project name is required.');
|
|
85
|
+
closePrompt();
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!VALID_NAME_RE.test(projectName)) {
|
|
90
|
+
err('Project name may only contain letters, digits, hyphens, underscores, dots, and @.');
|
|
91
|
+
err(`Got: ${projectName}`);
|
|
92
|
+
closePrompt();
|
|
93
|
+
process.exitCode = 1;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const defaultOrg = detectOrgName();
|
|
98
|
+
const orgName = await prompt('Organization / owner (optional)', defaultOrg);
|
|
99
|
+
if (orgName && !VALID_NAME_RE.test(orgName)) {
|
|
100
|
+
err('Organization name may only contain letters, digits, hyphens, underscores, dots, and @.');
|
|
101
|
+
err(`Got: ${orgName}`);
|
|
102
|
+
closePrompt();
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let language = await prompt('Language (en / zh)', 'zh');
|
|
108
|
+
closePrompt();
|
|
109
|
+
if (language === 'zh') language = 'zh-CN';
|
|
110
|
+
if (language !== 'en' && language !== 'zh-CN') {
|
|
111
|
+
err(`Language must be 'en' or 'zh'. Got: ${language}`);
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const modules = 'ai,github';
|
|
117
|
+
const project = projectName;
|
|
118
|
+
const replacements = { project, org: orgName };
|
|
119
|
+
|
|
120
|
+
console.log('');
|
|
121
|
+
if (orgName) {
|
|
122
|
+
info(`Installing update-agent-infra seed command for: ${projectName} (${orgName})`);
|
|
123
|
+
} else {
|
|
124
|
+
info(`Installing update-agent-infra seed command for: ${projectName}`);
|
|
125
|
+
}
|
|
126
|
+
console.log('');
|
|
127
|
+
|
|
128
|
+
// select language-specific template filenames
|
|
129
|
+
let claudeSrc, geminiSrc, opencodeSrc;
|
|
130
|
+
if (language === 'zh-CN') {
|
|
131
|
+
claudeSrc = 'update-agent-infra.zh-CN.md';
|
|
132
|
+
geminiSrc = 'update-agent-infra.zh-CN.toml';
|
|
133
|
+
opencodeSrc = 'update-agent-infra.zh-CN.md';
|
|
134
|
+
} else {
|
|
135
|
+
claudeSrc = 'update-agent-infra.md';
|
|
136
|
+
geminiSrc = 'update-agent-infra.toml';
|
|
137
|
+
opencodeSrc = 'update-agent-infra.md';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// install skill
|
|
141
|
+
copySkillDir(
|
|
142
|
+
path.join(templateDir, '.agents', 'skills', 'update-agent-infra'),
|
|
143
|
+
path.join('.agents', 'skills', 'update-agent-infra'),
|
|
144
|
+
replacements,
|
|
145
|
+
language
|
|
146
|
+
);
|
|
147
|
+
ok('Installed .agents/skills/update-agent-infra/');
|
|
148
|
+
|
|
149
|
+
// install Claude command
|
|
150
|
+
renderFile(
|
|
151
|
+
path.join(templateDir, '.claude', 'commands', claudeSrc),
|
|
152
|
+
path.join('.claude', 'commands', 'update-agent-infra.md'),
|
|
153
|
+
replacements
|
|
154
|
+
);
|
|
155
|
+
ok('Installed .claude/commands/update-agent-infra.md');
|
|
156
|
+
|
|
157
|
+
// install Gemini command
|
|
158
|
+
renderFile(
|
|
159
|
+
path.join(templateDir, '.gemini', 'commands', '_project_', geminiSrc),
|
|
160
|
+
path.join('.gemini', 'commands', project, 'update-agent-infra.toml'),
|
|
161
|
+
replacements
|
|
162
|
+
);
|
|
163
|
+
ok(`Installed .gemini/commands/${project}/update-agent-infra.toml`);
|
|
164
|
+
|
|
165
|
+
// install OpenCode command
|
|
166
|
+
renderFile(
|
|
167
|
+
path.join(templateDir, '.opencode', 'commands', opencodeSrc),
|
|
168
|
+
path.join('.opencode', 'commands', 'update-agent-infra.md'),
|
|
169
|
+
replacements
|
|
170
|
+
);
|
|
171
|
+
ok('Installed .opencode/commands/update-agent-infra.md');
|
|
172
|
+
|
|
173
|
+
// generate .airc.json
|
|
174
|
+
const modulesArray = modules.split(',');
|
|
175
|
+
const config = {
|
|
176
|
+
project: projectName,
|
|
177
|
+
org: orgName,
|
|
178
|
+
language,
|
|
179
|
+
templateSource: 'templates/',
|
|
180
|
+
templateVersion: VERSION,
|
|
181
|
+
modules: modulesArray,
|
|
182
|
+
files: structuredClone(defaults.files)
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
fs.writeFileSync('.airc.json', JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
186
|
+
ok('Generated .airc.json');
|
|
187
|
+
|
|
188
|
+
// done
|
|
189
|
+
console.log('');
|
|
190
|
+
ok('Project initialized successfully!');
|
|
191
|
+
console.log('');
|
|
192
|
+
console.log(' Next step: open this project in any AI TUI and run:');
|
|
193
|
+
console.log('');
|
|
194
|
+
console.log(' Claude Code / OpenCode: /update-agent-infra');
|
|
195
|
+
console.log(` Gemini CLI: /${project}:update-agent-infra`);
|
|
196
|
+
console.log(' Codex CLI: $update-agent-infra');
|
|
197
|
+
console.log('');
|
|
198
|
+
console.log(' This will render all templates and set up the full');
|
|
199
|
+
console.log(' AI collaboration infrastructure.');
|
|
200
|
+
console.log('');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { cmdInit };
|