@fitlab-ai/agent-infra 0.6.5 → 0.7.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 +51 -25
- package/README.zh-CN.md +49 -23
- package/bin/cli.ts +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/lib/builtin-tuis.js +45 -0
- package/dist/lib/defaults.json +4 -0
- package/dist/lib/init.js +65 -23
- package/dist/lib/prompt.js +49 -1
- package/dist/lib/sandbox/commands/create.js +4 -2
- package/dist/lib/sandbox/commands/enter.js +15 -4
- package/dist/lib/sandbox/commands/list-running.js +153 -0
- package/dist/lib/sandbox/commands/ls.js +24 -45
- package/dist/lib/sandbox/commands/rebuild.js +7 -13
- package/dist/lib/sandbox/commands/rm.js +2 -0
- package/dist/lib/sandbox/config.js +3 -0
- package/dist/lib/sandbox/image-prune.js +18 -0
- package/dist/lib/sandbox/index.js +2 -1
- package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/dist/lib/sandbox/task-resolver.js +18 -0
- package/dist/lib/sandbox/tools.js +213 -8
- package/dist/lib/update.js +70 -18
- package/lib/builtin-tuis.ts +55 -0
- package/lib/defaults.json +4 -0
- package/lib/init.ts +97 -35
- package/lib/prompt.ts +54 -1
- package/lib/sandbox/commands/create.ts +10 -2
- package/lib/sandbox/commands/enter.ts +14 -4
- package/lib/sandbox/commands/list-running.ts +188 -0
- package/lib/sandbox/commands/ls.ts +28 -49
- package/lib/sandbox/commands/rebuild.ts +12 -14
- package/lib/sandbox/commands/rm.ts +3 -0
- package/lib/sandbox/config.ts +7 -0
- package/lib/sandbox/image-prune.ts +23 -0
- package/lib/sandbox/index.ts +2 -1
- package/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/lib/sandbox/task-resolver.ts +23 -1
- package/lib/sandbox/tools.ts +248 -9
- package/lib/update.ts +85 -30
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +1 -1
- package/templates/.agents/QUICKSTART.zh-CN.md +1 -1
- package/templates/.agents/README.en.md +111 -2
- package/templates/.agents/README.zh-CN.md +111 -2
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +6 -5
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +6 -5
- package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
- package/templates/.agents/rules/no-mid-flow-questions.en.md +57 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +57 -0
- package/templates/.agents/rules/pr-sync.github.en.md +4 -5
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +4 -5
- package/templates/.agents/rules/task-management.en.md +9 -6
- package/templates/.agents/rules/task-management.zh-CN.md +9 -6
- package/templates/.agents/rules/task-short-id.en.md +141 -0
- package/templates/.agents/rules/task-short-id.zh-CN.md +124 -0
- package/templates/.agents/rules/testing-discipline.en.md +2 -2
- package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
- package/templates/.agents/scripts/task-short-id.js +713 -0
- package/templates/.agents/scripts/validate-artifact.js +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.en.md +20 -4
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +20 -5
- package/templates/.agents/skills/block-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/check-task/SKILL.en.md +47 -32
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +46 -32
- package/templates/.agents/skills/close-codescan/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/code-task/SKILL.en.md +121 -0
- package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +55 -25
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
- package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
- package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
- package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
- package/templates/.agents/skills/commit/SKILL.en.md +6 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
- package/templates/.agents/skills/complete-task/SKILL.en.md +17 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +17 -4
- package/templates/.agents/skills/create-pr/SKILL.en.md +21 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +21 -1
- package/templates/.agents/skills/create-task/SKILL.en.md +14 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +14 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +15 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +15 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +16 -2
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +16 -2
- package/templates/.agents/skills/import-issue/SKILL.en.md +17 -3
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +17 -3
- package/templates/.agents/skills/plan-task/SKILL.en.md +8 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/restore-task/SKILL.en.md +16 -3
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +16 -4
- package/templates/.agents/skills/review-analysis/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +15 -9
- package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +19 -10
- package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
- package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
- package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
- package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/test/SKILL.en.md +2 -2
- package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +1 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +113 -21
- package/templates/.agents/templates/task.en.md +4 -3
- package/templates/.agents/templates/task.zh-CN.md +3 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
- package/templates/.agents/workflows/feature-development.en.yaml +115 -70
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
- package/templates/.agents/workflows/refactoring.en.yaml +123 -78
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
- package/templates/.claude/commands/code-task.en.md +8 -0
- package/templates/.claude/commands/code-task.zh-CN.md +8 -0
- package/templates/.claude/commands/review-analysis.en.md +8 -0
- package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
- package/templates/.claude/commands/review-code.en.md +8 -0
- package/templates/.claude/commands/review-code.zh-CN.md +8 -0
- package/templates/.claude/commands/review-plan.en.md +8 -0
- package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
- package/templates/.opencode/commands/code-task.en.md +11 -0
- package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-analysis.en.md +11 -0
- package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-code.en.md +11 -0
- package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-plan.en.md +11 -0
- package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
- package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
- package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
- package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
- package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
- package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
- package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
- package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
- package/templates/.claude/commands/implement-task.en.md +0 -8
- package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
- package/templates/.claude/commands/refine-task.en.md +0 -8
- package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
- package/templates/.claude/commands/review-task.en.md +0 -8
- package/templates/.claude/commands/review-task.zh-CN.md +0 -8
- package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
- package/templates/.opencode/commands/implement-task.en.md +0 -11
- package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/refine-task.en.md +0 -11
- package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/review-task.en.md +0 -11
- package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
- /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<strong>From issue to merged PR in
|
|
12
|
+
<strong>From issue to merged PR in 11 commands.</strong> Define a requirement, let AI handle analysis, planning, coding, and three-stage review — you only step in when it matters.
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
@@ -66,11 +66,23 @@ Once initialized, open the project in your AI TUI and install the latest skills:
|
|
|
66
66
|
|
|
67
67
|
> AI scans the codebase, identifies `src/auth/login.ts` as the root cause, and writes `analysis.md`.
|
|
68
68
|
|
|
69
|
+
```bash
|
|
70
|
+
/review-analysis TASK-20260319-100000
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> AI self-reviews the analysis: *"Approved. 0 blockers, 0 major, 0 minor — scope and root cause are clear, proceed to design."*
|
|
74
|
+
|
|
69
75
|
```bash
|
|
70
76
|
/plan-task TASK-20260319-100000
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
> AI proposes a fix plan: *"Sanitize the email input in `LoginService.validate()` and add a dedicated unit test."*
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
/review-plan TASK-20260319-100000
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> AI self-reviews the plan: *"Approved with no findings. Ready for implementation."*
|
|
74
86
|
>
|
|
75
87
|
> **You review the plan and reply in natural language:**
|
|
76
88
|
|
|
@@ -79,22 +91,22 @@ The plan looks right, but don't change the DB schema.
|
|
|
79
91
|
Just fix it at the application layer in LoginService.
|
|
80
92
|
```
|
|
81
93
|
|
|
82
|
-
> AI
|
|
94
|
+
> AI re-runs `/plan-task` to update the plan accordingly and confirms.
|
|
83
95
|
|
|
84
96
|
```bash
|
|
85
|
-
/
|
|
97
|
+
/code-task TASK-20260319-100000
|
|
86
98
|
```
|
|
87
99
|
|
|
88
100
|
> AI writes the fix, adds a test case for `user+tag@example.com`, and runs all tests — green.
|
|
89
101
|
|
|
90
102
|
```bash
|
|
91
|
-
/review-
|
|
103
|
+
/review-code TASK-20260319-100000
|
|
92
104
|
```
|
|
93
105
|
|
|
94
|
-
> AI reviews its own
|
|
106
|
+
> AI reviews its own code: *"Approved. 0 blockers, 0 major, 1 minor (missing JSDoc)."*
|
|
95
107
|
|
|
96
108
|
```bash
|
|
97
|
-
/
|
|
109
|
+
/code-task TASK-20260319-100000
|
|
98
110
|
```
|
|
99
111
|
|
|
100
112
|
> AI fixes the minor issue and re-validates.
|
|
@@ -107,7 +119,7 @@ Just fix it at the application layer in LoginService.
|
|
|
107
119
|
|
|
108
120
|
> Commit created, PR #43 opened (auto-linked to issue #42), task archived.
|
|
109
121
|
|
|
110
|
-
**
|
|
122
|
+
**11 commands. 1 natural-language correction. From issue to merged PR.** That is the entire SOP — programming can have a standard operating procedure too.
|
|
111
123
|
|
|
112
124
|
Every command above works the same way in Claude Code, Codex, Gemini CLI, and OpenCode. Switch tools mid-task — the workflow state follows.
|
|
113
125
|
|
|
@@ -115,9 +127,9 @@ Every command above works the same way in Claude Code, Codex, Gemini CLI, and Op
|
|
|
115
127
|
|
|
116
128
|
These are not thin command aliases. Each skill encapsulates standardized processes that are tedious and error-prone when done by hand:
|
|
117
129
|
|
|
118
|
-
- **Structured artifacts** — every step produces a templated document (`analysis.md`, `plan.md`, `review.md`) with consistent structure, not free-form notes
|
|
130
|
+
- **Structured artifacts** — every step produces a templated document (`analysis.md`, `review-analysis.md`, `plan.md`, `review-plan.md`, `code.md`, `review-code.md`) with consistent structure, not free-form notes
|
|
119
131
|
- **Multi-round versioning** — requirements changed? Run `analyze-task` again to get `analysis-r2.md`; the full revision history is preserved
|
|
120
|
-
- **Severity-classified reviews** — `review-
|
|
132
|
+
- **Severity-classified reviews** — `review-code` categorizes findings into Blocker / Major / Minor with file paths and fix suggestions, not a vague "looks good"
|
|
121
133
|
- **Cross-tool state continuity** — `task.md` records who did what and when; Claude can analyze, Codex can implement, Gemini can review — context transfers seamlessly
|
|
122
134
|
- **Audit trail and co-authorship** — every step appends to the Activity Log; the final commit includes `Co-Authored-By` lines for all participating AI agents
|
|
123
135
|
|
|
@@ -327,7 +339,7 @@ agent-infra is intentionally simple: a bootstrap CLI creates the seed configurat
|
|
|
327
339
|
1. **Install** — `npm install -g @fitlab-ai/agent-infra` (or `brew install fitlab-ai/tap/agent-infra` on macOS, or use the shell script wrapper)
|
|
328
340
|
2. **Initialize** — `ai init` in the project root to generate `.agents/.airc.json` and install the seed command
|
|
329
341
|
3. **Render** — run `update-agent-infra` in any AI TUI to detect the bundled template version and generate all managed files
|
|
330
|
-
4. **Develop** — use built-in skills to drive the full lifecycle: `analysis →
|
|
342
|
+
4. **Develop** — use built-in skills to drive the full lifecycle: `analysis → analysis-review → design → design-review → code → code-review → commit`
|
|
331
343
|
5. **Update** — run `update-agent-infra` again whenever a new template version is available
|
|
332
344
|
|
|
333
345
|
### Layered Architecture
|
|
@@ -524,10 +536,11 @@ agent-infra ships with **a rich set of built-in AI skills**. They are organized
|
|
|
524
536
|
| `create-task` | Create a task scaffold from a natural-language request and cascade Issue creation through the platform rule when available. | `description` | Start a new feature, bug-fix, or improvement from scratch. |
|
|
525
537
|
| `import-issue` | Import a GitHub Issue into the local task workspace. | `issue-number` | Convert an existing Issue into an actionable task folder. |
|
|
526
538
|
| `analyze-task` | Produce a requirement analysis artifact for an existing task. | `task-id` | Capture scope, risks, and impacted files before designing. |
|
|
527
|
-
| `
|
|
528
|
-
| `
|
|
529
|
-
| `review-
|
|
530
|
-
| `
|
|
539
|
+
| `review-analysis` | Review the requirement analysis and classify findings by severity. | `task-id` | Confirm the analysis is complete before design. |
|
|
540
|
+
| `plan-task` | Write the technical plan with a review checkpoint. | `task-id` | Define the approach after analysis approval. |
|
|
541
|
+
| `review-plan` | Review the technical plan and classify findings by severity. | `task-id` | Confirm the design is actionable before coding. |
|
|
542
|
+
| `code-task` | Implement the approved plan or fix code review findings, producing a code report. | `task-id` | Write code, tests, and docs after plan approval, or handle review feedback. |
|
|
543
|
+
| `review-code` | Review the code and classify findings by severity. | `task-id` | Run a structured code review before merging. |
|
|
531
544
|
| `complete-task` | Mark the task complete and archive it after all gates pass. | `task-id` | Close out a task after review, tests, and commit are done. |
|
|
532
545
|
|
|
533
546
|
<a id="task-status"></a>
|
|
@@ -694,8 +707,8 @@ Supported `invoke` placeholders:
|
|
|
694
707
|
|
|
695
708
|
| Placeholder | Replaced with | Example |
|
|
696
709
|
|-------------|---------------|---------|
|
|
697
|
-
| `${skillName}` | The skill command name, such as `review-
|
|
698
|
-
| `${projectName}` | The `.airc.json` `project` value. Use this for namespaced commands. | `/${projectName}:${skillName}` -> `/agent-infra:review-
|
|
710
|
+
| `${skillName}` | The skill command name, such as `review-code` or `commit`. | `<your-cli> ${skillName}` -> `<your-cli> review-code` |
|
|
711
|
+
| `${projectName}` | The `.airc.json` `project` value. Use this for namespaced commands. | `/${projectName}:${skillName}` -> `/agent-infra:review-code` |
|
|
699
712
|
|
|
700
713
|
Non-namespaced custom TUI:
|
|
701
714
|
|
|
@@ -732,17 +745,17 @@ Namespaced custom TUI:
|
|
|
732
745
|
|
|
733
746
|
## Prebuilt Workflows
|
|
734
747
|
|
|
735
|
-
agent-infra includes **4 prebuilt workflows**. Three of them share the same gated delivery lifecycle:
|
|
748
|
+
agent-infra includes **4 prebuilt workflows**. Three of them share the same symmetric gated delivery lifecycle:
|
|
736
749
|
|
|
737
|
-
`analysis ->
|
|
750
|
+
`analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit`
|
|
738
751
|
|
|
739
752
|
The fourth, `code-review`, is intentionally smaller and optimized for reviewing an existing PR or branch.
|
|
740
753
|
|
|
741
754
|
| Workflow | Best for | Step chain |
|
|
742
755
|
|----------|----------|------------|
|
|
743
|
-
| `feature-development` | Building a new feature or capability | `analysis ->
|
|
744
|
-
| `bug-fix` | Diagnosing and fixing a defect with regression coverage | `analysis ->
|
|
745
|
-
| `refactoring` | Structural changes that should preserve behavior | `analysis ->
|
|
756
|
+
| `feature-development` | Building a new feature or capability | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
757
|
+
| `bug-fix` | Diagnosing and fixing a defect with regression coverage | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
758
|
+
| `refactoring` | Structural changes that should preserve behavior | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
746
759
|
| `code-review` | Reviewing an existing PR or branch | `analysis -> review -> report` |
|
|
747
760
|
|
|
748
761
|
### Example lifecycle
|
|
@@ -758,20 +771,33 @@ import-issue #42 Import task from GitHub Issue
|
|
|
758
771
|
analyze-task T1 Requirement analysis
|
|
759
772
|
|
|
|
760
773
|
v
|
|
761
|
-
|
|
774
|
+
review-analysis T1 Review analysis
|
|
775
|
+
|
|
|
776
|
+
Issues?
|
|
777
|
+
+--YES----> analyze-task T1
|
|
778
|
+
|
|
|
779
|
+
v
|
|
780
|
+
plan-task T1 Design solution
|
|
781
|
+
|
|
|
782
|
+
v
|
|
783
|
+
review-plan T1 Review plan
|
|
784
|
+
|
|
|
785
|
+
Issues?
|
|
786
|
+
+--YES----> plan-task T1
|
|
787
|
+
|
|
|
762
788
|
|
|
|
763
789
|
v
|
|
764
|
-
|
|
790
|
+
code-task T1 Write code and tests
|
|
765
791
|
|
|
|
766
792
|
v
|
|
767
|
-
+-> review-
|
|
793
|
+
+-> review-code T1 Automated code review
|
|
768
794
|
| |
|
|
769
795
|
| Issues?
|
|
770
796
|
| +--NO-------+
|
|
771
797
|
| YES |
|
|
772
798
|
| | |
|
|
773
799
|
| v |
|
|
774
|
-
|
|
|
800
|
+
| code-task T1 (fix mode)
|
|
775
801
|
| | |
|
|
776
802
|
+------+ |
|
|
777
803
|
|
|
package/README.zh-CN.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<strong>从 Issue 到合并 PR,只需
|
|
12
|
+
<strong>从 Issue 到合并 PR,只需 11 条命令。</strong> 定义需求,让 AI 完成分析、方案设计、编码与三阶段审查 —— 你只需在关键节点介入。
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
@@ -66,11 +66,23 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
66
66
|
|
|
67
67
|
> AI 扫描代码库,定位 `src/auth/login.ts` 为根因,输出 `analysis.md`。
|
|
68
68
|
|
|
69
|
+
```bash
|
|
70
|
+
/review-analysis TASK-20260319-100000
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> AI 自审分析报告:*"通过。0 阻塞项,0 主要,0 次要 —— 范围与根因清晰,可进入方案设计。"*
|
|
74
|
+
|
|
69
75
|
```bash
|
|
70
76
|
/plan-task TASK-20260319-100000
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
> AI 提出修复方案:*"在 `LoginService.validate()` 中清洗邮箱输入,并添加专项单元测试。"*
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
/review-plan TASK-20260319-100000
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> AI 自审方案:*"通过且无问题。可进入编码。"*
|
|
74
86
|
>
|
|
75
87
|
> **你审查方案后用自然语言回复:**
|
|
76
88
|
|
|
@@ -79,22 +91,22 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
79
91
|
只在应用层的 LoginService 里修复就行。
|
|
80
92
|
```
|
|
81
93
|
|
|
82
|
-
> AI
|
|
94
|
+
> AI 按你的要求重跑 `/plan-task` 更新方案并确认。
|
|
83
95
|
|
|
84
96
|
```bash
|
|
85
|
-
/
|
|
97
|
+
/code-task TASK-20260319-100000
|
|
86
98
|
```
|
|
87
99
|
|
|
88
100
|
> AI 编写修复代码,添加 `user+tag@example.com` 的测试用例,运行全部测试 —— 通过。
|
|
89
101
|
|
|
90
102
|
```bash
|
|
91
|
-
/review-
|
|
103
|
+
/review-code TASK-20260319-100000
|
|
92
104
|
```
|
|
93
105
|
|
|
94
106
|
> AI 审查自己的实现:*"通过。0 阻塞项,0 主要问题,1 次要问题(缺少 JSDoc)。"*
|
|
95
107
|
|
|
96
108
|
```bash
|
|
97
|
-
/
|
|
109
|
+
/code-task TASK-20260319-100000
|
|
98
110
|
```
|
|
99
111
|
|
|
100
112
|
> AI 修复次要问题并重新验证。
|
|
@@ -107,7 +119,7 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
107
119
|
|
|
108
120
|
> 提交完成,PR #43 已创建(自动关联 Issue #42),任务归档。
|
|
109
121
|
|
|
110
|
-
**
|
|
122
|
+
**11 条命令,1 次自然语言纠正,从 Issue 到合并 PR。** 这就是完整的 SOP —— 编程也可以有标准作业流程。
|
|
111
123
|
|
|
112
124
|
以上每条命令在 Claude Code、Codex、Gemini CLI、OpenCode 中完全通用。任务进行到一半切换工具,工作流状态照常延续。
|
|
113
125
|
|
|
@@ -115,9 +127,9 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
115
127
|
|
|
116
128
|
这些不是简单的命令别名。每个 skill 都封装了手动操作时容易遗漏或不一致的标准化流程:
|
|
117
129
|
|
|
118
|
-
- **结构化产物** — 每个步骤都输出模板化的文档(`analysis.md`、`plan.md`、`review.md`),格式统一,而非自由发挥的散文
|
|
130
|
+
- **结构化产物** — 每个步骤都输出模板化的文档(`analysis.md`、`review-analysis.md`、`plan.md`、`review-plan.md`、`code.md`、`review-code.md`),格式统一,而非自由发挥的散文
|
|
119
131
|
- **多轮版本化** — 需求变了?再执行一次 `analyze-task` 会生成 `analysis-r2.md`,完整修订历史自动保留
|
|
120
|
-
- **分级审查机制** — `review-
|
|
132
|
+
- **分级审查机制** — `review-code` 按 Blocker / Major / Minor 分类问题,附带文件路径和修复建议,而非含糊的"看着没问题"
|
|
121
133
|
- **跨工具状态延续** — `task.md` 记录了谁在什么时间做了什么;Claude 分析、Codex 实现、Gemini 审查——上下文无缝衔接
|
|
122
134
|
- **审计轨迹与联合署名** — 每个步骤自动追加 Activity Log;最终提交包含所有参与 AI 的 `Co-Authored-By` 署名
|
|
123
135
|
|
|
@@ -300,7 +312,7 @@ agent-infra 的结构刻意保持简单:引导 CLI 负责生成种子配置,
|
|
|
300
312
|
1. **安装** — `npm install -g @fitlab-ai/agent-infra`(或在 macOS 上使用 `brew install fitlab-ai/tap/agent-infra`,或使用 shell 脚本便捷封装)
|
|
301
313
|
2. **初始化** — 在项目根目录运行 `ai init`,生成 `.agents/.airc.json` 并安装种子命令
|
|
302
314
|
3. **渲染** — 在任意 AI TUI 中执行 `update-agent-infra`,检测当前打包模板版本并生成所有受管理文件
|
|
303
|
-
4. **开发** — 使用内置 skill 驱动完整生命周期:`analysis →
|
|
315
|
+
4. **开发** — 使用内置 skill 驱动完整生命周期:`analysis → analysis-review → design → design-review → code → code-review → commit`
|
|
304
316
|
5. **升级** — 有新模板版本时再次执行 `update-agent-infra` 即可
|
|
305
317
|
|
|
306
318
|
### 分层架构
|
|
@@ -497,10 +509,11 @@ agent-infra 提供 **丰富的内置 AI skills**。它们按使用场景分组
|
|
|
497
509
|
| `create-task` | 根据自然语言请求创建任务骨架,并在平台规则可用时级联创建 Issue。 | `description` | 从零开始记录新功能、缺陷或改进需求。 |
|
|
498
510
|
| `import-issue` | 将 GitHub Issue 导入本地任务工作区。 | `issue-number` | 把已有 Issue 转成可执行的任务目录。 |
|
|
499
511
|
| `analyze-task` | 为已有任务输出需求分析产物。 | `task-id` | 在设计前明确范围、风险和受影响文件。 |
|
|
500
|
-
| `
|
|
501
|
-
| `
|
|
502
|
-
| `review-
|
|
503
|
-
| `
|
|
512
|
+
| `review-analysis` | 审查需求分析产物,并按严重程度分类问题。 | `task-id` | 在设计前确认分析完整可用。 |
|
|
513
|
+
| `plan-task` | 编写技术实施方案,并设置审查检查点。 | `task-id` | 分析获批后定义具体实现路径。 |
|
|
514
|
+
| `review-plan` | 审查技术方案,并按严重程度分类问题。 | `task-id` | 在编码前确认方案可执行。 |
|
|
515
|
+
| `code-task` | 按批准方案实施,或修复代码审查问题,并生成实现报告。 | `task-id` | 在方案获批后编写代码、测试和文档,或处理 review 反馈。 |
|
|
516
|
+
| `review-code` | 审查实现结果,并按严重程度分类问题。 | `task-id` | 合入前执行结构化代码审查。 |
|
|
504
517
|
| `complete-task` | 在所有关卡通过后标记任务完成并归档。 | `task-id` | 测试、审查和提交都完成后收尾。 |
|
|
505
518
|
|
|
506
519
|
<a id="task-status"></a>
|
|
@@ -667,8 +680,8 @@ args: "<task-id>" # 可选
|
|
|
667
680
|
|
|
668
681
|
| 占位符 | 替换为 | 示例 |
|
|
669
682
|
|--------|--------|------|
|
|
670
|
-
| `${skillName}` | skill 命令名,例如 `review-
|
|
671
|
-
| `${projectName}` | `.airc.json` 中的 `project` 值,适用于带命名空间的命令。 | `/${projectName}:${skillName}` -> `/agent-infra:review-
|
|
683
|
+
| `${skillName}` | skill 命令名,例如 `review-code` 或 `commit`。 | `<your-cli> ${skillName}` -> `<your-cli> review-code` |
|
|
684
|
+
| `${projectName}` | `.airc.json` 中的 `project` 值,适用于带命名空间的命令。 | `/${projectName}:${skillName}` -> `/agent-infra:review-code` |
|
|
672
685
|
|
|
673
686
|
不带命名空间的自定义 TUI:
|
|
674
687
|
|
|
@@ -707,15 +720,15 @@ args: "<task-id>" # 可选
|
|
|
707
720
|
|
|
708
721
|
agent-infra 内置 **4 个预置工作流**。其中 3 个共享同一条分阶段交付链路:
|
|
709
722
|
|
|
710
|
-
`analysis ->
|
|
723
|
+
`analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit`
|
|
711
724
|
|
|
712
725
|
第 4 个 `code-review` 则更轻量,专门用于审查已有 PR 或分支。
|
|
713
726
|
|
|
714
727
|
| Workflow | 适用场景 | 步骤链 |
|
|
715
728
|
|----------|----------|--------|
|
|
716
|
-
| `feature-development` | 开发新功能或新能力 | `analysis ->
|
|
717
|
-
| `bug-fix` | 诊断并修复缺陷,同时补回归验证 | `analysis ->
|
|
718
|
-
| `refactoring` | 进行应保持行为稳定的结构性重构 | `analysis ->
|
|
729
|
+
| `feature-development` | 开发新功能或新能力 | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
730
|
+
| `bug-fix` | 诊断并修复缺陷,同时补回归验证 | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
731
|
+
| `refactoring` | 进行应保持行为稳定的结构性重构 | `analysis -> analysis-review -> design -> design-review -> code -> code-review -> commit` |
|
|
719
732
|
| `code-review` | 审查已有 Pull Request 或分支 | `analysis -> review -> report` |
|
|
720
733
|
|
|
721
734
|
### 生命周期示例
|
|
@@ -731,20 +744,33 @@ import-issue #42 从 GitHub Issue 导入任务
|
|
|
731
744
|
analyze-task T1 需求分析
|
|
732
745
|
|
|
|
733
746
|
v
|
|
734
|
-
|
|
747
|
+
review-analysis T1 审查需求分析
|
|
748
|
+
|
|
|
749
|
+
有问题?
|
|
750
|
+
+--YES----> analyze-task T1
|
|
751
|
+
|
|
|
752
|
+
v
|
|
753
|
+
plan-task T1 设计方案
|
|
754
|
+
|
|
|
755
|
+
v
|
|
756
|
+
review-plan T1 审查技术方案
|
|
757
|
+
|
|
|
758
|
+
有问题?
|
|
759
|
+
+--YES----> plan-task T1
|
|
760
|
+
|
|
|
735
761
|
|
|
|
736
762
|
v
|
|
737
|
-
|
|
763
|
+
code-task T1 编写代码与测试
|
|
738
764
|
|
|
|
739
765
|
v
|
|
740
|
-
+-> review-
|
|
766
|
+
+-> review-code T1 自动代码审查
|
|
741
767
|
| |
|
|
742
768
|
| 有问题?
|
|
743
769
|
| +--NO-------+
|
|
744
770
|
| YES |
|
|
745
771
|
| | |
|
|
746
772
|
| v |
|
|
747
|
-
|
|
|
773
|
+
| code-task T1 (fix mode)
|
|
748
774
|
| | |
|
|
749
775
|
+------+ |
|
|
750
776
|
|
|
package/bin/cli.ts
CHANGED
package/dist/bin/cli.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const BUILTIN_TUI_IDS = ['claude-code', 'codex', 'gemini-cli', 'opencode'];
|
|
2
|
+
const BUILTIN_TUI_DISPLAY = {
|
|
3
|
+
'claude-code': 'Claude Code',
|
|
4
|
+
'codex': 'Codex',
|
|
5
|
+
'gemini-cli': 'Gemini CLI',
|
|
6
|
+
'opencode': 'OpenCode'
|
|
7
|
+
};
|
|
8
|
+
const BUILTIN_TUI_OWNED_PATH_PREFIXES = {
|
|
9
|
+
'claude-code': ['.claude/'],
|
|
10
|
+
'codex': ['.codex/'],
|
|
11
|
+
'gemini-cli': ['.gemini/'],
|
|
12
|
+
'opencode': ['.opencode/']
|
|
13
|
+
};
|
|
14
|
+
function isBuiltinTUIId(value) {
|
|
15
|
+
return typeof value === 'string' && BUILTIN_TUI_IDS.includes(value);
|
|
16
|
+
}
|
|
17
|
+
function resolveEnabledTUIs(value) {
|
|
18
|
+
// Missing field / null / non-array → full set (backward compat for legacy
|
|
19
|
+
// .airc.json predating the `tuis` field).
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return new Set(BUILTIN_TUI_IDS);
|
|
22
|
+
// Empty array is a meaningful, user-set value: "no built-in TUI managed".
|
|
23
|
+
// This supports the customTUI-only project layout.
|
|
24
|
+
const set = new Set();
|
|
25
|
+
for (const v of value) {
|
|
26
|
+
if (isBuiltinTUIId(v))
|
|
27
|
+
set.add(v);
|
|
28
|
+
}
|
|
29
|
+
return set;
|
|
30
|
+
}
|
|
31
|
+
function isPathOwnedByDisabledTUI(rel, enabled) {
|
|
32
|
+
const normalized = String(rel || '').replace(/\\/g, '/').replace(/^\.\//, '');
|
|
33
|
+
for (const tui of BUILTIN_TUI_IDS) {
|
|
34
|
+
if (enabled.has(tui))
|
|
35
|
+
continue;
|
|
36
|
+
for (const prefix of BUILTIN_TUI_OWNED_PATH_PREFIXES[tui]) {
|
|
37
|
+
const trimmed = prefix.replace(/\/$/, '');
|
|
38
|
+
if (normalized === trimmed || normalized.startsWith(prefix))
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
export { BUILTIN_TUI_IDS, BUILTIN_TUI_DISPLAY, BUILTIN_TUI_OWNED_PATH_PREFIXES, isBuiltinTUIId, resolveEnabledTUIs, isPathOwnedByDisabledTUI };
|
|
45
|
+
//# sourceMappingURL=builtin-tuis.js.map
|
package/dist/lib/defaults.json
CHANGED
package/dist/lib/init.js
CHANGED
|
@@ -3,11 +3,12 @@ import path from 'node:path';
|
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
4
|
import { platform } from 'node:os';
|
|
5
5
|
import { info, ok, err } from "./log.js";
|
|
6
|
-
import { prompt, select, closePrompt } from "./prompt.js";
|
|
6
|
+
import { prompt, select, multiSelect, closePrompt } from "./prompt.js";
|
|
7
7
|
import { resolveTemplateDir } from "./paths.js";
|
|
8
8
|
import { renderFile, copySkillDir, KNOWN_PLATFORMS } from "./render.js";
|
|
9
9
|
import { enginesForPlatform } from "./sandbox/engines/index.js";
|
|
10
10
|
import { VERSION } from "./version.js";
|
|
11
|
+
import { BUILTIN_TUI_IDS, BUILTIN_TUI_DISPLAY, isPathOwnedByDisabledTUI, resolveEnabledTUIs } from "./builtin-tuis.js";
|
|
11
12
|
const defaults = JSON.parse(fs.readFileSync(new URL('./defaults.json', import.meta.url), 'utf8'));
|
|
12
13
|
const PLATFORM_DEFAULT_ENGINES = Object.freeze({
|
|
13
14
|
linux: 'native',
|
|
@@ -23,10 +24,11 @@ function isPathOwnedByOtherPlatform(relativePath, platformType) {
|
|
|
23
24
|
return false;
|
|
24
25
|
return candidate !== platformType;
|
|
25
26
|
}
|
|
26
|
-
function buildDefaultFiles(platformType) {
|
|
27
|
+
function buildDefaultFiles(platformType, enabledTUIs) {
|
|
28
|
+
const ownedByDisabled = (entry) => isPathOwnedByDisabledTUI(entry, enabledTUIs);
|
|
27
29
|
return {
|
|
28
|
-
managed: (defaults.files.managed || []).filter((entry) => !isPathOwnedByOtherPlatform(entry, platformType)),
|
|
29
|
-
merged: (defaults.files.merged || []).filter((entry) => !isPathOwnedByOtherPlatform(entry, platformType)),
|
|
30
|
+
managed: (defaults.files.managed || []).filter((entry) => !isPathOwnedByOtherPlatform(entry, platformType) && !ownedByDisabled(entry)),
|
|
31
|
+
merged: (defaults.files.merged || []).filter((entry) => !isPathOwnedByOtherPlatform(entry, platformType) && !ownedByDisabled(entry)),
|
|
30
32
|
ejected: structuredClone(defaults.files.ejected || [])
|
|
31
33
|
};
|
|
32
34
|
}
|
|
@@ -156,6 +158,19 @@ async function cmdInit() {
|
|
|
156
158
|
info(`Custom platform '${platformType}' selected. Built-in templates are only complete for github;`
|
|
157
159
|
+ ` provide matching '.${platformType}.' or generic templates before running update-agent-infra.`);
|
|
158
160
|
}
|
|
161
|
+
const requiresPRChoice = await select('Require Pull Request flow?', ['yes', 'no'], 'yes');
|
|
162
|
+
const requiresPullRequest = requiresPRChoice !== 'no';
|
|
163
|
+
let enabledTUIs;
|
|
164
|
+
try {
|
|
165
|
+
enabledTUIs = await multiSelect('Built-in TUI command files to install/manage', BUILTIN_TUI_IDS.map((id) => ({ id, label: BUILTIN_TUI_DISPLAY[id] })));
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
err(e instanceof Error ? e.message : String(e));
|
|
169
|
+
closePrompt();
|
|
170
|
+
process.exitCode = 1;
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const enabledTUISet = resolveEnabledTUIs(enabledTUIs);
|
|
159
174
|
const templateSources = parseLocalSources(await prompt('Template sources (optional, comma-separated local paths, e.g. ~/my-templates; Enter to skip)', ''));
|
|
160
175
|
const skillSources = parseLocalSources(await prompt('Skill sources (optional, comma-separated local paths, e.g. ~/my-skills; Enter to skip)', ''));
|
|
161
176
|
closePrompt();
|
|
@@ -184,25 +199,34 @@ async function cmdInit() {
|
|
|
184
199
|
// install skill
|
|
185
200
|
copySkillDir(path.join(templateDir, '.agents', 'skills', 'update-agent-infra'), path.join('.agents', 'skills', 'update-agent-infra'), replacements, language, platformType);
|
|
186
201
|
ok('Installed .agents/skills/update-agent-infra/');
|
|
187
|
-
// install Claude command
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
// install Claude command (only if enabled)
|
|
203
|
+
if (enabledTUISet.has('claude-code')) {
|
|
204
|
+
renderFile(path.join(templateDir, '.claude', 'commands', claudeSrc), path.join('.claude', 'commands', 'update-agent-infra.md'), replacements);
|
|
205
|
+
ok('Installed .claude/commands/update-agent-infra.md');
|
|
206
|
+
}
|
|
207
|
+
// install Gemini command (only if enabled)
|
|
208
|
+
if (enabledTUISet.has('gemini-cli')) {
|
|
209
|
+
renderFile(path.join(templateDir, '.gemini', 'commands', '_project_', geminiSrc), path.join('.gemini', 'commands', project, 'update-agent-infra.toml'), replacements);
|
|
210
|
+
ok(`Installed .gemini/commands/${project}/update-agent-infra.toml`);
|
|
211
|
+
}
|
|
212
|
+
// install OpenCode command (only if enabled)
|
|
213
|
+
if (enabledTUISet.has('opencode')) {
|
|
214
|
+
renderFile(path.join(templateDir, '.opencode', 'commands', opencodeSrc), path.join('.opencode', 'commands', 'update-agent-infra.md'), replacements);
|
|
215
|
+
ok('Installed .opencode/commands/update-agent-infra.md');
|
|
216
|
+
}
|
|
196
217
|
// generate .agents/.airc.json
|
|
197
218
|
const config = {
|
|
198
219
|
project: projectName,
|
|
199
220
|
org: orgName,
|
|
200
221
|
language,
|
|
201
222
|
platform: { type: platformType },
|
|
223
|
+
requiresPullRequest,
|
|
202
224
|
templateVersion: VERSION,
|
|
203
225
|
sandbox: structuredClone(defaults.sandbox),
|
|
226
|
+
task: structuredClone(defaults.task),
|
|
204
227
|
labels: structuredClone(defaults.labels),
|
|
205
|
-
files: buildDefaultFiles(platformType)
|
|
228
|
+
files: buildDefaultFiles(platformType, enabledTUISet),
|
|
229
|
+
tuis: enabledTUIs
|
|
206
230
|
};
|
|
207
231
|
if (sandboxEngine) {
|
|
208
232
|
config.sandbox.engine = sandboxEngine;
|
|
@@ -224,15 +248,33 @@ async function cmdInit() {
|
|
|
224
248
|
console.log('');
|
|
225
249
|
ok('Project initialized successfully!');
|
|
226
250
|
console.log('');
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
251
|
+
if (enabledTUISet.size === 0) {
|
|
252
|
+
console.log(' No built-in TUI selected.');
|
|
253
|
+
console.log(` Configure "customTUIs" in ${configPath} before running update-agent-infra.`);
|
|
254
|
+
console.log('');
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
console.log(' Next step: open this project in any AI TUI and run:');
|
|
258
|
+
console.log('');
|
|
259
|
+
const claudeOrOpencode = [];
|
|
260
|
+
if (enabledTUISet.has('claude-code'))
|
|
261
|
+
claudeOrOpencode.push('Claude Code');
|
|
262
|
+
if (enabledTUISet.has('opencode'))
|
|
263
|
+
claudeOrOpencode.push('OpenCode');
|
|
264
|
+
if (claudeOrOpencode.length > 0) {
|
|
265
|
+
console.log(` ${claudeOrOpencode.join(' / ')}: /update-agent-infra`);
|
|
266
|
+
}
|
|
267
|
+
if (enabledTUISet.has('gemini-cli')) {
|
|
268
|
+
console.log(` Gemini CLI: /${project}:update-agent-infra`);
|
|
269
|
+
}
|
|
270
|
+
if (enabledTUISet.has('codex')) {
|
|
271
|
+
console.log(' Codex CLI: $update-agent-infra');
|
|
272
|
+
}
|
|
273
|
+
console.log('');
|
|
274
|
+
console.log(' This will render all templates and set up the full');
|
|
275
|
+
console.log(' AI collaboration infrastructure.');
|
|
276
|
+
console.log('');
|
|
277
|
+
}
|
|
236
278
|
}
|
|
237
279
|
export { cmdInit };
|
|
238
280
|
//# sourceMappingURL=init.js.map
|
package/dist/lib/prompt.js
CHANGED
|
@@ -74,6 +74,54 @@ async function select(question, choices, defaultValue) {
|
|
|
74
74
|
}
|
|
75
75
|
return trimmed;
|
|
76
76
|
}
|
|
77
|
+
async function multiSelect(question, choices) {
|
|
78
|
+
process.stdout.write(` ${question}:\n`);
|
|
79
|
+
const idWidth = Math.max(...choices.map((c) => c.id.length));
|
|
80
|
+
choices.forEach((c, i) => {
|
|
81
|
+
process.stdout.write(` ${i + 1}) ${c.id.padEnd(idWidth)} (${c.label})\n`);
|
|
82
|
+
});
|
|
83
|
+
ask('Enter comma-separated numbers or ids to keep, or "none" to select nothing [default: all]: ');
|
|
84
|
+
setupInterface();
|
|
85
|
+
const line = await nextLine();
|
|
86
|
+
// Strictly distinguish bare Enter (null/empty string) from whitespace input.
|
|
87
|
+
if (line === null || line === '')
|
|
88
|
+
return choices.map((c) => c.id);
|
|
89
|
+
// Explicit empty selection: "none" means deliberately zero built-in choices.
|
|
90
|
+
if (line.trim().toLowerCase() === 'none')
|
|
91
|
+
return [];
|
|
92
|
+
const tokens = line.split(',').map((t) => t.trim());
|
|
93
|
+
if (tokens.some((t) => t === '')) {
|
|
94
|
+
throw new Error(`Invalid selection input: "${line}" (empty token)`);
|
|
95
|
+
}
|
|
96
|
+
const idSet = new Set(choices.map((c) => c.id));
|
|
97
|
+
const seenIds = new Set();
|
|
98
|
+
for (const t of tokens) {
|
|
99
|
+
let resolvedId;
|
|
100
|
+
if (/^[0-9]+$/.test(t)) {
|
|
101
|
+
const n = Number.parseInt(t, 10);
|
|
102
|
+
if (n < 1 || n > choices.length) {
|
|
103
|
+
throw new Error(`Selection out of range: "${t}" (expected 1..${choices.length})`);
|
|
104
|
+
}
|
|
105
|
+
resolvedId = choices[n - 1].id;
|
|
106
|
+
}
|
|
107
|
+
else if (idSet.has(t)) {
|
|
108
|
+
resolvedId = t;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
throw new Error(`Unknown TUI selection token: "${t}"`);
|
|
112
|
+
}
|
|
113
|
+
if (seenIds.has(resolvedId)) {
|
|
114
|
+
throw new Error(`Duplicate selection: "${t}" resolves to already-selected "${resolvedId}"`);
|
|
115
|
+
}
|
|
116
|
+
seenIds.add(resolvedId);
|
|
117
|
+
}
|
|
118
|
+
// Normalize to prompt order: users can type tokens in any order, but the
|
|
119
|
+
// persisted array follows the canonical choices order to keep .airc.json
|
|
120
|
+
// diffs stable. An empty result here is impossible (tokens.length > 0 and
|
|
121
|
+
// every token resolves to an id), so no separate empty guard is needed —
|
|
122
|
+
// explicit "none" handled above.
|
|
123
|
+
return choices.map((c) => c.id).filter((id) => seenIds.has(id));
|
|
124
|
+
}
|
|
77
125
|
function closePrompt() {
|
|
78
126
|
if (_rl) {
|
|
79
127
|
_rl.close();
|
|
@@ -81,5 +129,5 @@ function closePrompt() {
|
|
|
81
129
|
_stdinDone = true;
|
|
82
130
|
}
|
|
83
131
|
}
|
|
84
|
-
export { prompt, select, closePrompt };
|
|
132
|
+
export { prompt, select, multiSelect, closePrompt };
|
|
85
133
|
//# sourceMappingURL=prompt.js.map
|