@fitlab-ai/agent-infra 0.3.2 → 0.4.1
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 +18 -35
- package/README.zh-CN.md +18 -35
- package/lib/defaults.json +5 -12
- package/lib/init.js +9 -25
- package/lib/paths.js +3 -42
- package/lib/update.js +43 -32
- package/package.json +2 -1
- package/templates/.agents/QUICKSTART.md +17 -7
- package/templates/.agents/QUICKSTART.zh-CN.md +17 -7
- package/templates/.agents/README.md +21 -14
- package/templates/.agents/README.zh-CN.md +21 -14
- package/templates/.agents/skills/analyze-task/SKILL.md +7 -10
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +7 -9
- package/templates/.agents/skills/block-task/SKILL.md +9 -13
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +9 -12
- package/templates/.agents/skills/check-task/SKILL.md +4 -8
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +4 -6
- package/templates/.agents/skills/close-codescan/SKILL.md +1 -4
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/close-dependabot/SKILL.md +1 -4
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/commit/SKILL.md +26 -198
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +26 -197
- package/templates/.agents/skills/commit/reference/commit-message.md +60 -0
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +60 -0
- package/templates/.agents/skills/commit/reference/copyright-check.md +39 -0
- package/templates/.agents/skills/commit/reference/copyright-check.zh-CN.md +39 -0
- package/templates/.agents/skills/commit/reference/task-status-update.md +88 -0
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +88 -0
- package/templates/.agents/skills/complete-task/SKILL.md +8 -13
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +8 -11
- package/templates/.agents/skills/create-issue/SKILL.md +32 -251
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +33 -252
- package/templates/.agents/skills/create-issue/reference/label-and-type.md +77 -0
- package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +77 -0
- package/templates/.agents/skills/create-issue/reference/template-matching.md +45 -0
- package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +45 -0
- package/templates/.agents/skills/create-pr/SKILL.md +33 -224
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +32 -222
- package/templates/.agents/skills/create-pr/reference/branch-strategy.md +29 -0
- package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +29 -0
- package/templates/.agents/skills/create-pr/reference/pr-body-template.md +86 -0
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +86 -0
- package/templates/.agents/skills/create-release-note/SKILL.md +10 -13
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +10 -12
- package/templates/.agents/skills/create-task/SKILL.md +5 -8
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -7
- package/templates/.agents/skills/implement-task/SKILL.md +48 -178
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +44 -172
- package/templates/.agents/skills/implement-task/reference/implementation-rules.md +58 -0
- package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +58 -0
- package/templates/.agents/skills/implement-task/reference/report-template.md +63 -0
- package/templates/.agents/skills/implement-task/reference/report-template.zh-CN.md +63 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +2 -5
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +2 -4
- package/templates/.agents/skills/import-dependabot/SKILL.md +4 -7
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +4 -6
- package/templates/.agents/skills/import-issue/SKILL.md +6 -8
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +6 -8
- package/templates/.agents/skills/init-labels/SKILL.md +1 -4
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +1 -4
- package/templates/.agents/skills/init-milestones/SKILL.md +1 -3
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/plan-task/SKILL.md +7 -11
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +7 -9
- package/templates/.agents/skills/refine-task/SKILL.md +38 -162
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +36 -158
- package/templates/.agents/skills/refine-task/reference/fix-workflow.md +76 -0
- package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +76 -0
- package/templates/.agents/skills/refine-task/reference/report-template.md +38 -0
- package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +38 -0
- package/templates/.agents/skills/refine-title/SKILL.md +1 -4
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/release/SKILL.md +58 -19
- package/templates/.agents/skills/release/SKILL.zh-CN.md +58 -18
- package/templates/.agents/skills/review-task/SKILL.md +37 -239
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +37 -238
- package/templates/.agents/skills/review-task/reference/output-templates.md +72 -0
- package/templates/.agents/skills/review-task/reference/output-templates.zh-CN.md +72 -0
- package/templates/.agents/skills/review-task/reference/report-template.md +63 -0
- package/templates/.agents/skills/review-task/reference/report-template.zh-CN.md +63 -0
- package/templates/.agents/skills/review-task/reference/review-criteria.md +24 -0
- package/templates/.agents/skills/review-task/reference/review-criteria.zh-CN.md +24 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +32 -490
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +33 -490
- package/templates/.agents/skills/sync-issue/reference/comment-publish.md +88 -0
- package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +88 -0
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.md +42 -0
- package/templates/.agents/skills/sync-issue/reference/delivery-detection.zh-CN.md +42 -0
- package/templates/.agents/skills/sync-issue/reference/label-sync.md +63 -0
- package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +63 -0
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +37 -0
- package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +37 -0
- package/templates/.agents/skills/sync-pr/SKILL.md +25 -287
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +29 -291
- package/templates/.agents/skills/sync-pr/reference/comment-publish.md +82 -0
- package/templates/.agents/skills/sync-pr/reference/comment-publish.zh-CN.md +82 -0
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +54 -0
- package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +54 -0
- package/templates/.agents/skills/test/SKILL.md +1 -3
- package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/test-integration/SKILL.md +1 -4
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +1 -3
- package/templates/.agents/skills/update-agent-infra/SKILL.md +7 -11
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +7 -9
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +59 -118
- package/templates/.agents/skills/upgrade-dependency/SKILL.md +1 -4
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +1 -3
- 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 -52
- package/templates/.claude/CLAUDE.zh-CN.md +14 -52
- package/templates/.claude/commands/analyze-task.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.md +2 -1
- package/templates/.claude/commands/block-task.zh-CN.md +2 -1
- package/templates/.claude/commands/check-task.md +2 -1
- package/templates/.claude/commands/check-task.zh-CN.md +2 -1
- package/templates/.claude/commands/close-codescan.md +2 -1
- package/templates/.claude/commands/close-codescan.zh-CN.md +2 -1
- package/templates/.claude/commands/close-dependabot.md +2 -1
- package/templates/.claude/commands/close-dependabot.zh-CN.md +2 -1
- package/templates/.claude/commands/commit.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-issue.md +1 -1
- package/templates/.claude/commands/create-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/create-release-note.md +2 -1
- package/templates/.claude/commands/create-release-note.zh-CN.md +2 -1
- package/templates/.claude/commands/create-task.md +1 -1
- package/templates/.claude/commands/create-task.zh-CN.md +1 -1
- package/templates/.claude/commands/implement-task.md +1 -1
- package/templates/.claude/commands/implement-task.zh-CN.md +1 -1
- package/templates/.claude/commands/import-codescan.md +1 -0
- package/templates/.claude/commands/import-codescan.zh-CN.md +2 -1
- package/templates/.claude/commands/import-dependabot.md +1 -0
- package/templates/.claude/commands/import-dependabot.zh-CN.md +2 -1
- package/templates/.claude/commands/import-issue.md +1 -1
- package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/init-labels.md +1 -0
- package/templates/.claude/commands/init-labels.zh-CN.md +2 -1
- package/templates/.claude/commands/init-milestones.md +2 -1
- package/templates/.claude/commands/init-milestones.zh-CN.md +2 -1
- package/templates/.claude/commands/plan-task.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/refine-task.zh-CN.md +1 -1
- package/templates/.claude/commands/refine-title.md +2 -1
- package/templates/.claude/commands/refine-title.zh-CN.md +2 -1
- package/templates/.claude/commands/release.md +2 -1
- package/templates/.claude/commands/release.zh-CN.md +2 -1
- package/templates/.claude/commands/review-task.md +1 -1
- package/templates/.claude/commands/review-task.zh-CN.md +1 -1
- package/templates/.claude/commands/sync-issue.md +1 -1
- package/templates/.claude/commands/sync-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/sync-pr.md +1 -1
- package/templates/.claude/commands/sync-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/test-integration.md +2 -1
- package/templates/.claude/commands/test-integration.zh-CN.md +2 -1
- package/templates/.claude/commands/test.md +1 -1
- package/templates/.claude/commands/test.zh-CN.md +1 -1
- package/templates/.claude/commands/update-agent-infra.md +2 -1
- package/templates/.claude/commands/update-agent-infra.zh-CN.md +2 -1
- package/templates/.claude/commands/upgrade-dependency.md +2 -1
- package/templates/.claude/commands/upgrade-dependency.zh-CN.md +2 -1
- package/templates/.claude/hooks/check-version-format.sh +44 -0
- package/templates/.claude/settings.json +14 -0
- package/templates/.gemini/commands/_project_/analyze-task.toml +1 -1
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/block-task.toml +1 -1
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/check-task.toml +1 -1
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/close-codescan.toml +1 -1
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/close-dependabot.toml +1 -1
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/commit.toml +1 -1
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/complete-task.toml +1 -1
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-pr.toml +1 -1
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-release-note.toml +1 -1
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/create-task.toml +1 -1
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/implement-task.toml +1 -1
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/import-issue.toml +1 -1
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/plan-task.toml +1 -1
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-title.toml +1 -1
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/release.toml +1 -1
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/review-task.toml +1 -1
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-issue.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-pr.toml +1 -1
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/test-integration.toml +1 -1
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/test.toml +1 -1
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/update-agent-infra.toml +1 -1
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/upgrade-dependency.toml +1 -1
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +1 -1
- package/templates/.github/hooks/check-version-format.sh +29 -0
- package/templates/.github/hooks/pre-commit +8 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +6 -6
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +6 -6
- package/templates/.opencode/commands/analyze-task.md +1 -1
- package/templates/.opencode/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/block-task.md +1 -1
- package/templates/.opencode/commands/block-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/check-task.md +1 -1
- package/templates/.opencode/commands/check-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/close-codescan.md +1 -1
- package/templates/.opencode/commands/close-codescan.zh-CN.md +1 -1
- package/templates/.opencode/commands/close-dependabot.md +1 -1
- package/templates/.opencode/commands/close-dependabot.zh-CN.md +1 -1
- package/templates/.opencode/commands/commit.md +1 -1
- package/templates/.opencode/commands/commit.zh-CN.md +1 -1
- package/templates/.opencode/commands/complete-task.md +1 -1
- package/templates/.opencode/commands/complete-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-pr.md +1 -1
- package/templates/.opencode/commands/create-pr.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-release-note.md +1 -1
- package/templates/.opencode/commands/create-release-note.zh-CN.md +1 -1
- package/templates/.opencode/commands/create-task.md +1 -1
- package/templates/.opencode/commands/create-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/implement-task.md +1 -1
- package/templates/.opencode/commands/implement-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-codescan.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-dependabot.zh-CN.md +1 -1
- package/templates/.opencode/commands/import-issue.md +1 -1
- package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
- package/templates/.opencode/commands/init-milestones.md +1 -1
- package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
- package/templates/.opencode/commands/plan-task.md +1 -1
- package/templates/.opencode/commands/plan-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/refine-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/refine-title.md +1 -1
- package/templates/.opencode/commands/refine-title.zh-CN.md +1 -1
- package/templates/.opencode/commands/release.md +1 -1
- package/templates/.opencode/commands/release.zh-CN.md +1 -1
- package/templates/.opencode/commands/review-task.md +1 -1
- package/templates/.opencode/commands/review-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/sync-issue.md +1 -1
- package/templates/.opencode/commands/sync-issue.zh-CN.md +1 -1
- package/templates/.opencode/commands/sync-pr.md +1 -1
- package/templates/.opencode/commands/sync-pr.zh-CN.md +1 -1
- package/templates/.opencode/commands/test-integration.md +1 -1
- package/templates/.opencode/commands/test-integration.zh-CN.md +1 -1
- package/templates/.opencode/commands/test.md +1 -1
- package/templates/.opencode/commands/test.zh-CN.md +1 -1
- package/templates/.opencode/commands/update-agent-infra.md +1 -1
- package/templates/.opencode/commands/update-agent-infra.zh-CN.md +1 -1
- package/templates/.opencode/commands/upgrade-dependency.md +1 -1
- package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +1 -1
- package/templates/AGENTS.md +11 -3
- package/templates/AGENTS.zh-CN.md +11 -3
- 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
|
@@ -144,7 +144,7 @@ ai init
|
|
|
144
144
|
# or: agent-infra init
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
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`.
|
|
148
148
|
|
|
149
149
|
> `ai` is a shorthand for `agent-infra`. Both commands are equivalent.
|
|
150
150
|
|
|
@@ -159,7 +159,7 @@ Open the project in any AI TUI and run `update-agent-infra`:
|
|
|
159
159
|
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
160
160
|
| OpenCode | `/update-agent-infra` |
|
|
161
161
|
|
|
162
|
-
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.
|
|
163
163
|
|
|
164
164
|
<a id="architecture-overview"></a>
|
|
165
165
|
|
|
@@ -170,8 +170,8 @@ agent-infra is intentionally simple: a bootstrap CLI creates the seed configurat
|
|
|
170
170
|
### End-to-End Flow
|
|
171
171
|
|
|
172
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 `.airc.json` and install the seed command
|
|
174
|
-
3. **Render** — run `update-agent-infra` in any AI TUI to
|
|
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
|
|
175
175
|
4. **Develop** — use 28 built-in skills to drive the full lifecycle: `analysis → design → implementation → review → fix → commit`
|
|
176
176
|
5. **Update** — run `update-agent-infra` again whenever a new template version is available
|
|
177
177
|
|
|
@@ -197,7 +197,7 @@ block-beta
|
|
|
197
197
|
|
|
198
198
|
block:project:4
|
|
199
199
|
columns 4
|
|
200
|
-
agents[".agents/"] config[".airc.json"] workspace[".
|
|
200
|
+
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
tui -- "slash commands" --> shared
|
|
@@ -215,19 +215,15 @@ After setup, your project gains a complete AI collaboration infrastructure:
|
|
|
215
215
|
```text
|
|
216
216
|
my-project/
|
|
217
217
|
├── .agents/ # Shared AI collaboration config
|
|
218
|
+
│ ├── .airc.json # Central configuration
|
|
219
|
+
│ ├── workspace/ # Task workspace (git-ignored)
|
|
218
220
|
│ ├── skills/ # 28 built-in AI skills
|
|
219
221
|
│ ├── workflows/ # 4 prebuilt workflows
|
|
220
222
|
│ └── templates/ # Task and artifact templates
|
|
221
|
-
├── .agent-workspace/ # Task workspace (git-ignored)
|
|
222
223
|
├── .claude/ # Claude Code config and commands
|
|
223
224
|
├── .gemini/ # Gemini CLI config and commands
|
|
224
225
|
├── .opencode/ # OpenCode config and commands
|
|
225
|
-
|
|
226
|
-
├── AGENTS.md # Universal AI agent instructions
|
|
227
|
-
├── CONTRIBUTING.md # Contribution guide
|
|
228
|
-
├── SECURITY.md # Security policy (English)
|
|
229
|
-
├── SECURITY.zh-CN.md # Security policy (Chinese)
|
|
230
|
-
└── .airc.json # Central configuration
|
|
226
|
+
└── AGENTS.md # Universal AI agent instructions
|
|
231
227
|
```
|
|
232
228
|
|
|
233
229
|
<a id="built-in-ai-skills"></a>
|
|
@@ -375,20 +371,19 @@ import-issue #42 Import task from GitHub Issue
|
|
|
375
371
|
|
|
376
372
|
## Configuration Reference
|
|
377
373
|
|
|
378
|
-
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.
|
|
379
375
|
|
|
380
|
-
### Example `.airc.json`
|
|
376
|
+
### Example `.agents/.airc.json`
|
|
381
377
|
|
|
382
378
|
```json
|
|
383
379
|
{
|
|
384
380
|
"project": "my-project",
|
|
385
381
|
"org": "my-org",
|
|
386
382
|
"language": "en",
|
|
387
|
-
"
|
|
388
|
-
"templateVersion": "v0.3.2",
|
|
389
|
-
"modules": ["ai", "github"],
|
|
383
|
+
"templateVersion": "v0.4.1",
|
|
390
384
|
"files": {
|
|
391
385
|
"managed": [
|
|
386
|
+
".agents/workspace/README.md",
|
|
392
387
|
".agents/skills/",
|
|
393
388
|
".agents/templates/",
|
|
394
389
|
".agents/workflows/",
|
|
@@ -399,9 +394,7 @@ The generated `.airc.json` file is the central contract between the bootstrap CL
|
|
|
399
394
|
"merged": [
|
|
400
395
|
".agents/README.md",
|
|
401
396
|
".gitignore",
|
|
402
|
-
"AGENTS.md"
|
|
403
|
-
"CONTRIBUTING.md",
|
|
404
|
-
"SECURITY.md"
|
|
397
|
+
"AGENTS.md"
|
|
405
398
|
],
|
|
406
399
|
"ejected": []
|
|
407
400
|
}
|
|
@@ -415,18 +408,9 @@ The generated `.airc.json` file is the central contract between the bootstrap CL
|
|
|
415
408
|
| `project` | Project name used when rendering commands, paths, and templates. |
|
|
416
409
|
| `org` | GitHub organization or owner used by generated metadata and links. |
|
|
417
410
|
| `language` | Primary project language or locale used by rendered templates. |
|
|
418
|
-
| `templateSource` | Local template root used during rendering. |
|
|
419
411
|
| `templateVersion` | Installed template version for future upgrades and drift tracking. |
|
|
420
|
-
| `modules` | Enabled template bundles. Supported values are `ai` and `github`. |
|
|
421
412
|
| `files` | Per-path update strategy configuration for managed, merged, and ejected files. |
|
|
422
413
|
|
|
423
|
-
### Module reference
|
|
424
|
-
|
|
425
|
-
| Module | Includes |
|
|
426
|
-
|--------|----------|
|
|
427
|
-
| `ai` | `.agents/`, `.claude/`, `.gemini/`, `.opencode/`, `AGENTS.md`, and related collaboration assets |
|
|
428
|
-
| `github` | `.github/`, contribution templates, release config, and GitHub governance assets |
|
|
429
|
-
|
|
430
414
|
<a id="file-management-strategies"></a>
|
|
431
415
|
|
|
432
416
|
## File Management Strategies
|
|
@@ -446,15 +430,14 @@ Each generated path is assigned an update strategy. That strategy determines how
|
|
|
446
430
|
"files": {
|
|
447
431
|
"managed": [
|
|
448
432
|
".agents/skills/",
|
|
449
|
-
".
|
|
433
|
+
".agents/workspace/README.md"
|
|
450
434
|
],
|
|
451
435
|
"merged": [
|
|
452
436
|
".gitignore",
|
|
453
|
-
"AGENTS.md"
|
|
454
|
-
"CONTRIBUTING.md"
|
|
437
|
+
"AGENTS.md"
|
|
455
438
|
],
|
|
456
439
|
"ejected": [
|
|
457
|
-
"
|
|
440
|
+
"docs/architecture.md"
|
|
458
441
|
]
|
|
459
442
|
}
|
|
460
443
|
}
|
|
@@ -462,7 +445,7 @@ Each generated path is assigned an update strategy. That strategy determines how
|
|
|
462
445
|
|
|
463
446
|
### Moving a file from `managed` to `ejected`
|
|
464
447
|
|
|
465
|
-
1. Remove the path from the `managed` array in `.airc.json`.
|
|
448
|
+
1. Remove the path from the `managed` array in `.agents/.airc.json`.
|
|
466
449
|
2. Add the same path to the `ejected` array.
|
|
467
450
|
3. Run `update-agent-infra` again so future updates stop managing that file.
|
|
468
451
|
|
|
@@ -472,7 +455,7 @@ Use this when a file starts as template-owned but later becomes project-specific
|
|
|
472
455
|
|
|
473
456
|
## Version Management
|
|
474
457
|
|
|
475
|
-
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.
|
|
458
|
+
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.
|
|
476
459
|
|
|
477
460
|
<a id="contributing"></a>
|
|
478
461
|
|
package/README.zh-CN.md
CHANGED
|
@@ -144,7 +144,7 @@ ai init
|
|
|
144
144
|
# 或:agent-infra init
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-infra` 种子命令,并生成 `.airc.json`。
|
|
147
|
+
CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-infra` 种子命令,并生成 `.agents/.airc.json`。
|
|
148
148
|
|
|
149
149
|
> `ai` 是 `agent-infra` 的简写命令,两者等价。
|
|
150
150
|
|
|
@@ -159,7 +159,7 @@ CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-in
|
|
|
159
159
|
| Gemini CLI | `/{{project}}:update-agent-infra` |
|
|
160
160
|
| OpenCode | `/update-agent-infra` |
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
该命令会检测当前打包模板版本并渲染所有受管理文件。首次安装和后续升级都使用同一条命令。
|
|
163
163
|
|
|
164
164
|
<a id="architecture-overview"></a>
|
|
165
165
|
|
|
@@ -170,8 +170,8 @@ agent-infra 的结构刻意保持简单:引导 CLI 负责生成种子配置,
|
|
|
170
170
|
### 端到端流程
|
|
171
171
|
|
|
172
172
|
1. **安装** — `npm install -g @fitlab-ai/agent-infra`(或使用 shell 脚本便捷封装)
|
|
173
|
-
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.airc.json` 并安装种子命令
|
|
174
|
-
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra
|
|
173
|
+
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.agents/.airc.json` 并安装种子命令
|
|
174
|
+
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra`,检测当前打包模板版本并生成所有受管理文件
|
|
175
175
|
4. **开发** — 使用 28 个内置 skill 驱动完整生命周期:`analysis → design → implementation → review → fix → commit`
|
|
176
176
|
5. **升级** — 有新模板版本时再次执行 `update-agent-infra` 即可
|
|
177
177
|
|
|
@@ -197,7 +197,7 @@ block-beta
|
|
|
197
197
|
|
|
198
198
|
block:project:4
|
|
199
199
|
columns 4
|
|
200
|
-
agents[".agents/"] config[".airc.json"] workspace[".
|
|
200
|
+
agents[".agents/"] config[".agents/.airc.json"] workspace[".agents/workspace/"] governance["AGENTS.md"]
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
tui -- "slash commands" --> shared
|
|
@@ -215,19 +215,15 @@ GitHub 原生支持 Mermaid 渲染。即使某些下游渲染器不支持,上
|
|
|
215
215
|
```text
|
|
216
216
|
my-project/
|
|
217
217
|
├── .agents/ # 共享 AI 协作配置
|
|
218
|
+
│ ├── .airc.json # 中央配置文件
|
|
219
|
+
│ ├── workspace/ # 任务工作区(git 忽略)
|
|
218
220
|
│ ├── skills/ # 28 个内置 AI skills
|
|
219
221
|
│ ├── workflows/ # 4 个预置工作流
|
|
220
222
|
│ └── templates/ # 任务与产物模板
|
|
221
|
-
├── .agent-workspace/ # 任务工作区(git 忽略)
|
|
222
223
|
├── .claude/ # Claude Code 配置与命令
|
|
223
224
|
├── .gemini/ # Gemini CLI 配置与命令
|
|
224
225
|
├── .opencode/ # OpenCode 配置与命令
|
|
225
|
-
|
|
226
|
-
├── AGENTS.md # 通用 AI agent 指令
|
|
227
|
-
├── CONTRIBUTING.md # 贡献指南
|
|
228
|
-
├── SECURITY.md # 安全策略(英文)
|
|
229
|
-
├── SECURITY.zh-CN.md # 安全策略(中文)
|
|
230
|
-
└── .airc.json # 中央配置文件
|
|
226
|
+
└── AGENTS.md # 通用 AI agent 指令
|
|
231
227
|
```
|
|
232
228
|
|
|
233
229
|
<a id="built-in-ai-skills"></a>
|
|
@@ -375,20 +371,19 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
375
371
|
|
|
376
372
|
## 配置参考
|
|
377
373
|
|
|
378
|
-
生成出的 `.airc.json` 是引导 CLI、模板系统和后续升级之间的中心契约。
|
|
374
|
+
生成出的 `.agents/.airc.json` 是引导 CLI、模板系统和后续升级之间的中心契约。
|
|
379
375
|
|
|
380
|
-
### `.airc.json` 示例
|
|
376
|
+
### `.agents/.airc.json` 示例
|
|
381
377
|
|
|
382
378
|
```json
|
|
383
379
|
{
|
|
384
380
|
"project": "my-project",
|
|
385
381
|
"org": "my-org",
|
|
386
382
|
"language": "en",
|
|
387
|
-
"
|
|
388
|
-
"templateVersion": "v0.3.2",
|
|
389
|
-
"modules": ["ai", "github"],
|
|
383
|
+
"templateVersion": "v0.4.1",
|
|
390
384
|
"files": {
|
|
391
385
|
"managed": [
|
|
386
|
+
".agents/workspace/README.md",
|
|
392
387
|
".agents/skills/",
|
|
393
388
|
".agents/templates/",
|
|
394
389
|
".agents/workflows/",
|
|
@@ -399,9 +394,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
399
394
|
"merged": [
|
|
400
395
|
".agents/README.md",
|
|
401
396
|
".gitignore",
|
|
402
|
-
"AGENTS.md"
|
|
403
|
-
"CONTRIBUTING.md",
|
|
404
|
-
"SECURITY.md"
|
|
397
|
+
"AGENTS.md"
|
|
405
398
|
],
|
|
406
399
|
"ejected": []
|
|
407
400
|
}
|
|
@@ -415,18 +408,9 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
415
408
|
| `project` | 用于渲染命令、路径和模板内容的项目名。 |
|
|
416
409
|
| `org` | 生成元数据和链接时使用的 GitHub 组织或拥有者。 |
|
|
417
410
|
| `language` | 渲染模板时采用的项目主语言或区域设置。 |
|
|
418
|
-
| `templateSource` | 本地模板根目录。 |
|
|
419
411
|
| `templateVersion` | 当前安装的模板版本,用于升级和差异追踪。 |
|
|
420
|
-
| `modules` | 启用的模板模块。可选值为 `ai` 和 `github`。 |
|
|
421
412
|
| `files` | 针对具体路径配置 `managed`、`merged`、`ejected` 三类更新策略。 |
|
|
422
413
|
|
|
423
|
-
### 模块说明
|
|
424
|
-
|
|
425
|
-
| 模块 | 包含内容 |
|
|
426
|
-
|------|----------|
|
|
427
|
-
| `ai` | `.agents/`、`.claude/`、`.gemini/`、`.opencode/`、`AGENTS.md` 及相关协作资产 |
|
|
428
|
-
| `github` | `.github/`、贡献模板、发布配置以及 GitHub 治理相关文件 |
|
|
429
|
-
|
|
430
414
|
<a id="file-management-strategies"></a>
|
|
431
415
|
|
|
432
416
|
## 文件管理策略
|
|
@@ -446,15 +430,14 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
446
430
|
"files": {
|
|
447
431
|
"managed": [
|
|
448
432
|
".agents/skills/",
|
|
449
|
-
".
|
|
433
|
+
".agents/workspace/README.md"
|
|
450
434
|
],
|
|
451
435
|
"merged": [
|
|
452
436
|
".gitignore",
|
|
453
|
-
"AGENTS.md"
|
|
454
|
-
"CONTRIBUTING.md"
|
|
437
|
+
"AGENTS.md"
|
|
455
438
|
],
|
|
456
439
|
"ejected": [
|
|
457
|
-
"
|
|
440
|
+
"docs/architecture.md"
|
|
458
441
|
]
|
|
459
442
|
}
|
|
460
443
|
}
|
|
@@ -462,7 +445,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
462
445
|
|
|
463
446
|
### 如何把文件从 `managed` 改为 `ejected`
|
|
464
447
|
|
|
465
|
-
1. 在 `.airc.json` 中把该路径从 `managed` 数组移除。
|
|
448
|
+
1. 在 `.agents/.airc.json` 中把该路径从 `managed` 数组移除。
|
|
466
449
|
2. 将同一路径加入 `ejected` 数组。
|
|
467
450
|
3. 再次执行 `update-agent-infra`,让后续升级不再管理这个文件。
|
|
468
451
|
|
|
@@ -472,7 +455,7 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
472
455
|
|
|
473
456
|
## 版本管理
|
|
474
457
|
|
|
475
|
-
agent-infra 通过 Git tag 和 GitHub release 使用语义化版本号。当前安装的模板版本记录在 `.airc.json` 的 `templateVersion` 字段中,方便人和 AI 工具在升级时都能基于同一个版本基线工作。
|
|
458
|
+
agent-infra 通过 Git tag 和 GitHub release 使用语义化版本号。当前安装的模板版本记录在 `.agents/.airc.json` 的 `templateVersion` 字段中,方便人和 AI 工具在升级时都能基于同一个版本基线工作。
|
|
476
459
|
|
|
477
460
|
<a id="contributing"></a>
|
|
478
461
|
|
package/lib/defaults.json
CHANGED
|
@@ -4,15 +4,11 @@
|
|
|
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",
|
|
11
|
+
".github/hooks/check-version-format.sh",
|
|
16
12
|
".opencode/commands/"
|
|
17
13
|
],
|
|
18
14
|
"merged": [
|
|
@@ -31,14 +27,11 @@
|
|
|
31
27
|
".claude/settings.json",
|
|
32
28
|
".codex/README.md",
|
|
33
29
|
".gemini/settings.json",
|
|
34
|
-
".github/
|
|
30
|
+
".github/hooks/pre-commit",
|
|
35
31
|
".gitignore",
|
|
36
|
-
".mailmap",
|
|
37
32
|
".opencode/COMMAND_STYLE_GUIDE.md",
|
|
38
33
|
".opencode/README.md",
|
|
39
|
-
"AGENTS.md"
|
|
40
|
-
"CONTRIBUTING.md",
|
|
41
|
-
"SECURITY.md"
|
|
34
|
+
"AGENTS.md"
|
|
42
35
|
],
|
|
43
36
|
"ejected": []
|
|
44
37
|
}
|
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,15 @@ 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 (fs.existsSync(
|
|
74
|
-
err('This project already has
|
|
59
|
+
// check existing config
|
|
60
|
+
if (fs.existsSync(configPath)) {
|
|
61
|
+
err('This project already has agent-infra configuration.');
|
|
75
62
|
err('Use /update-agent-infra in your AI TUI to update.');
|
|
76
63
|
process.exitCode = 1;
|
|
77
64
|
return;
|
|
@@ -113,7 +100,6 @@ async function cmdInit() {
|
|
|
113
100
|
return;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
|
-
const modules = 'ai,github';
|
|
117
103
|
const project = projectName;
|
|
118
104
|
const replacements = { project, org: orgName };
|
|
119
105
|
|
|
@@ -170,20 +156,18 @@ async function cmdInit() {
|
|
|
170
156
|
);
|
|
171
157
|
ok('Installed .opencode/commands/update-agent-infra.md');
|
|
172
158
|
|
|
173
|
-
// generate .airc.json
|
|
174
|
-
const modulesArray = modules.split(',');
|
|
159
|
+
// generate .agents/.airc.json
|
|
175
160
|
const config = {
|
|
176
161
|
project: projectName,
|
|
177
162
|
org: orgName,
|
|
178
163
|
language,
|
|
179
|
-
templateSource: 'templates/',
|
|
180
164
|
templateVersion: VERSION,
|
|
181
|
-
modules: modulesArray,
|
|
182
165
|
files: structuredClone(defaults.files)
|
|
183
166
|
};
|
|
184
167
|
|
|
185
|
-
fs.
|
|
186
|
-
|
|
168
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
169
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
170
|
+
ok(`Generated ${configPath}`);
|
|
187
171
|
|
|
188
172
|
// done
|
|
189
173
|
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 };
|
package/lib/update.js
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { execSync } from 'node:child_process';
|
|
4
3
|
import { info, ok, err } from './log.js';
|
|
5
|
-
import { resolveTemplateDir
|
|
4
|
+
import { resolveTemplateDir } from './paths.js';
|
|
6
5
|
import { renderFile, copySkillDir } from './render.js';
|
|
7
6
|
|
|
8
7
|
const defaults = JSON.parse(
|
|
9
8
|
fs.readFileSync(new URL('./defaults.json', import.meta.url), 'utf8')
|
|
10
9
|
);
|
|
11
10
|
|
|
11
|
+
const CONFIG_DIR = '.agents';
|
|
12
|
+
const CONFIG_PATH = path.join(CONFIG_DIR, '.airc.json');
|
|
13
|
+
|
|
12
14
|
function syncFileRegistry(config) {
|
|
15
|
+
config.files ||= {};
|
|
16
|
+
const before = JSON.stringify({
|
|
17
|
+
files: {
|
|
18
|
+
managed: config.files.managed || [],
|
|
19
|
+
merged: config.files.merged || [],
|
|
20
|
+
ejected: config.files.ejected || []
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
config.files.managed = config.files.managed || [];
|
|
24
|
+
config.files.merged = config.files.merged || [];
|
|
25
|
+
config.files.ejected = config.files.ejected || [];
|
|
26
|
+
|
|
13
27
|
const allExisting = [
|
|
14
28
|
...config.files.managed,
|
|
15
29
|
...config.files.merged,
|
|
@@ -30,7 +44,15 @@ function syncFileRegistry(config) {
|
|
|
30
44
|
}
|
|
31
45
|
}
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
const after = JSON.stringify({
|
|
48
|
+
files: {
|
|
49
|
+
managed: config.files.managed,
|
|
50
|
+
merged: config.files.merged,
|
|
51
|
+
ejected: config.files.ejected
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return { added, changed: before !== after };
|
|
34
56
|
}
|
|
35
57
|
|
|
36
58
|
async function cmdUpdate() {
|
|
@@ -39,9 +61,9 @@ async function cmdUpdate() {
|
|
|
39
61
|
console.log(' ==================================');
|
|
40
62
|
console.log('');
|
|
41
63
|
|
|
42
|
-
// check
|
|
43
|
-
if (!fs.existsSync(
|
|
44
|
-
err(
|
|
64
|
+
// check config exists
|
|
65
|
+
if (!fs.existsSync(CONFIG_PATH)) {
|
|
66
|
+
err(`No ${CONFIG_PATH} found in current directory.`);
|
|
45
67
|
err('Run "ai init" first to initialize the project.');
|
|
46
68
|
process.exitCode = 1;
|
|
47
69
|
return;
|
|
@@ -52,27 +74,12 @@ async function cmdUpdate() {
|
|
|
52
74
|
if (!templateDir) {
|
|
53
75
|
err('Template directory not found.');
|
|
54
76
|
err('Install via npm: npm install -g @fitlab-ai/agent-infra');
|
|
55
|
-
err('Or via clone: curl -fsSL https://raw.githubusercontent.com/fitlab-ai/agent-infra/main/install.sh | sh');
|
|
56
77
|
process.exitCode = 1;
|
|
57
78
|
return;
|
|
58
79
|
}
|
|
59
80
|
|
|
60
|
-
// auto-update: only for clone installs
|
|
61
|
-
if (isCloneInstall()) {
|
|
62
|
-
const installDir = resolveInstallDir();
|
|
63
|
-
if (fs.existsSync(path.join(installDir, '.git'))) {
|
|
64
|
-
info('Updating templates to latest version...');
|
|
65
|
-
try {
|
|
66
|
-
execSync('git pull --rebase --quiet', { cwd: installDir, stdio: 'pipe' });
|
|
67
|
-
ok('Templates updated.');
|
|
68
|
-
} catch {
|
|
69
|
-
err('Failed to update templates (network issue?). Using local version.');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
81
|
// read project config
|
|
75
|
-
const config = JSON.parse(fs.readFileSync(
|
|
82
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
|
76
83
|
const { project, org, language } = config;
|
|
77
84
|
const replacements = { project, org };
|
|
78
85
|
|
|
@@ -130,20 +137,24 @@ async function cmdUpdate() {
|
|
|
130
137
|
ok('Updated .opencode/commands/update-agent-infra.md');
|
|
131
138
|
|
|
132
139
|
// sync file registry
|
|
133
|
-
const added = syncFileRegistry(config);
|
|
140
|
+
const { added, changed } = syncFileRegistry(config);
|
|
134
141
|
const hasNewEntries = added.managed.length > 0 || added.merged.length > 0;
|
|
135
142
|
|
|
136
|
-
if (
|
|
143
|
+
if (changed) {
|
|
137
144
|
console.log('');
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
if (hasNewEntries) {
|
|
146
|
+
info(`New file entries synced to ${CONFIG_PATH}:`);
|
|
147
|
+
for (const entry of added.managed) {
|
|
148
|
+
ok(` managed: ${entry}`);
|
|
149
|
+
}
|
|
150
|
+
for (const entry of added.merged) {
|
|
151
|
+
ok(` merged: ${entry}`);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
info(`File registry changed in ${CONFIG_PATH}.`);
|
|
144
155
|
}
|
|
145
|
-
fs.writeFileSync(
|
|
146
|
-
ok(
|
|
156
|
+
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
157
|
+
ok(`Updated ${CONFIG_PATH}`);
|
|
147
158
|
}
|
|
148
159
|
|
|
149
160
|
// done
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitlab-ai/agent-infra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node scripts/build-inline.js",
|
|
45
|
+
"prepare": "git config core.hooksPath .github/hooks || true",
|
|
45
46
|
"test": "node scripts/build-inline.js --check && node --test tests/*.test.js",
|
|
46
47
|
"prepublishOnly": "node scripts/build-inline.js --check && node --test tests/*.test.js"
|
|
47
48
|
}
|