@bamptee/aia-code 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -83
- package/package.json +1 -1
- package/src/constants.js +5 -0
- package/src/services/feature.js +1 -7
- package/src/services/runner.js +4 -2
package/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
CLI tool that orchestrates AI-assisted development workflows using a `.aia` folder convention.
|
|
4
4
|
|
|
5
|
-
AIA structures your feature development into steps (brief, spec, tech-spec, etc.), builds rich prompts from project context and knowledge files, and delegates execution to AI CLI tools (Claude Code, Codex CLI, Gemini CLI) with weighted random model selection.
|
|
5
|
+
AIA structures your feature development into steps (brief, spec, tech-spec, dev-plan, implement, etc.), builds rich prompts from project context and knowledge files, and delegates execution to AI CLI tools (Claude Code, Codex CLI, Gemini CLI) with weighted random model selection.
|
|
6
6
|
|
|
7
7
|
## Quick start
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install
|
|
11
|
-
|
|
10
|
+
npm install -g @bamptee/aia-code
|
|
11
|
+
aia init
|
|
12
|
+
aia feature session-replay
|
|
13
|
+
aia next session-replay "Record and replay user sessions for debugging"
|
|
12
14
|
```
|
|
13
15
|
|
|
14
16
|
## Prerequisites
|
|
@@ -19,7 +21,7 @@ AIA delegates to AI CLI tools. Install the ones you need:
|
|
|
19
21
|
|----------|-----|---------|
|
|
20
22
|
| Anthropic | `claude` (Claude Code) | `npm install -g @anthropic-ai/claude-code` |
|
|
21
23
|
| OpenAI | `codex` (Codex CLI) | `npm install -g @openai/codex` |
|
|
22
|
-
| Google | `gemini` (Gemini CLI) | `npm install -g @
|
|
24
|
+
| Google | `gemini` (Gemini CLI) | `npm install -g @google/gemini-cli` |
|
|
23
25
|
|
|
24
26
|
Each CLI manages its own authentication. Run `claude`, `codex`, or `gemini` once to log in before using AIA.
|
|
25
27
|
|
|
@@ -29,34 +31,40 @@ Each CLI manages its own authentication. Run `claude`, `codex`, or `gemini` once
|
|
|
29
31
|
|---------|-------------|
|
|
30
32
|
| `aia init` | Create `.aia/` folder structure and default config |
|
|
31
33
|
| `aia feature <name>` | Create a new feature workspace |
|
|
32
|
-
| `aia run <step> <feature
|
|
34
|
+
| `aia run <step> <feature> [description]` | Execute a step for a feature |
|
|
35
|
+
| `aia next <feature> [description]` | Run the next pending step automatically |
|
|
33
36
|
| `aia status <feature>` | Show the current status of a feature |
|
|
34
37
|
| `aia reset <step> <feature>` | Reset a step to pending so it can be re-run |
|
|
35
38
|
| `aia repo scan` | Scan codebase and generate `repo-map.json` |
|
|
36
39
|
|
|
40
|
+
### Options for `run` and `next`
|
|
41
|
+
|
|
42
|
+
| Flag | Description |
|
|
43
|
+
|------|-------------|
|
|
44
|
+
| `-v, --verbose` | Show CLI logs in real-time (thinking, tool use, file reads) |
|
|
45
|
+
| `-a, --apply` | Let the AI edit and create files in the project (agent mode) |
|
|
46
|
+
|
|
47
|
+
The `implement` step forces `--apply` automatically.
|
|
48
|
+
|
|
37
49
|
## Integrate into an existing project
|
|
38
50
|
|
|
39
51
|
### 1. Install
|
|
40
52
|
|
|
41
53
|
```bash
|
|
42
|
-
|
|
43
|
-
npm install /path/to/aia-code
|
|
54
|
+
npm install -g @bamptee/aia-code
|
|
44
55
|
```
|
|
45
56
|
|
|
46
|
-
Or
|
|
57
|
+
Or as a dev dependency:
|
|
47
58
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"aia": "file:../aia-code"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
59
|
+
```bash
|
|
60
|
+
cd your-project
|
|
61
|
+
npm install --save-dev @bamptee/aia-code
|
|
54
62
|
```
|
|
55
63
|
|
|
56
64
|
### 2. Initialize
|
|
57
65
|
|
|
58
66
|
```bash
|
|
59
|
-
|
|
67
|
+
aia init
|
|
60
68
|
```
|
|
61
69
|
|
|
62
70
|
This creates:
|
|
@@ -132,9 +140,10 @@ Include: problem statement, target users, success metrics.
|
|
|
132
140
|
```
|
|
133
141
|
|
|
134
142
|
```markdown
|
|
135
|
-
<!-- .aia/prompts/
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
<!-- .aia/prompts/implement.md -->
|
|
144
|
+
Implement the feature following the dev-plan.
|
|
145
|
+
Create all necessary files (controllers, services, models, routes, tests).
|
|
146
|
+
Follow the project conventions from the context and knowledge files.
|
|
138
147
|
```
|
|
139
148
|
|
|
140
149
|
Required templates (one per step you want to run):
|
|
@@ -146,6 +155,7 @@ Required templates (one per step you want to run):
|
|
|
146
155
|
.aia/prompts/tech-spec.md
|
|
147
156
|
.aia/prompts/challenge.md
|
|
148
157
|
.aia/prompts/dev-plan.md
|
|
158
|
+
.aia/prompts/implement.md
|
|
149
159
|
.aia/prompts/review.md
|
|
150
160
|
```
|
|
151
161
|
|
|
@@ -156,13 +166,13 @@ In `config.yaml`, assign models to steps with probability weights:
|
|
|
156
166
|
```yaml
|
|
157
167
|
models:
|
|
158
168
|
brief:
|
|
159
|
-
- model: claude-
|
|
169
|
+
- model: claude-default
|
|
160
170
|
weight: 1
|
|
161
171
|
|
|
162
172
|
questions:
|
|
163
|
-
- model: claude-
|
|
173
|
+
- model: claude-default
|
|
164
174
|
weight: 0.5
|
|
165
|
-
- model:
|
|
175
|
+
- model: openai-default
|
|
166
176
|
weight: 0.5
|
|
167
177
|
|
|
168
178
|
tech-spec:
|
|
@@ -170,107 +180,145 @@ models:
|
|
|
170
180
|
weight: 0.6
|
|
171
181
|
- model: gemini-2.5-pro
|
|
172
182
|
weight: 0.4
|
|
183
|
+
|
|
184
|
+
implement:
|
|
185
|
+
- model: claude-default
|
|
186
|
+
weight: 1
|
|
173
187
|
```
|
|
174
188
|
|
|
175
189
|
Weights don't need to sum to 1 -- they are normalized at runtime.
|
|
176
190
|
|
|
177
|
-
|
|
191
|
+
#### Model aliases
|
|
192
|
+
|
|
193
|
+
Use aliases to delegate to the CLI's default model:
|
|
194
|
+
|
|
195
|
+
| Alias | CLI used |
|
|
196
|
+
|-------|----------|
|
|
197
|
+
| `claude-default` | `claude` (uses whatever model is configured in Claude Code) |
|
|
198
|
+
| `openai-default` | `codex` (uses whatever model is configured in Codex CLI) |
|
|
199
|
+
| `codex-default` | `codex` (same as above) |
|
|
200
|
+
| `gemini-default` | `gemini` (uses whatever model is configured in Gemini CLI) |
|
|
201
|
+
|
|
202
|
+
#### Specific models
|
|
178
203
|
|
|
179
204
|
| Prefix | CLI | Examples |
|
|
180
205
|
|--------|-----|----------|
|
|
181
|
-
| `claude-*` | `claude -p --model` | `claude-sonnet-4-6`, `claude-
|
|
206
|
+
| `claude-*` | `claude -p --model` | `claude-sonnet-4-6`, `claude-opus-4-6` |
|
|
182
207
|
| `gpt-*`, `o[0-9]*` | `codex exec` | `gpt-4.1`, `o3`, `o4-mini` |
|
|
183
208
|
| `gemini-*` | `gemini` | `gemini-2.5-pro`, `gemini-2.5-flash` |
|
|
184
209
|
|
|
185
|
-
### 7.
|
|
210
|
+
### 7. Run the feature pipeline
|
|
211
|
+
|
|
212
|
+
#### Step by step
|
|
186
213
|
|
|
187
214
|
```bash
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
215
|
+
aia feature session-replay
|
|
216
|
+
aia run brief session-replay "Record and replay user sessions"
|
|
217
|
+
aia status session-replay
|
|
218
|
+
aia run ba-spec session-replay
|
|
219
|
+
aia run tech-spec session-replay
|
|
192
220
|
```
|
|
193
221
|
|
|
194
|
-
|
|
195
|
-
1. Loads context files + knowledge + prior step outputs
|
|
196
|
-
2. Selects a model based on weights
|
|
197
|
-
3. Sends the assembled prompt to the CLI tool via stdin
|
|
198
|
-
4. Streams the response to stdout in real-time
|
|
199
|
-
5. Saves the output to `.aia/features/<name>/<step>.md`
|
|
200
|
-
6. Updates `status.yaml` (marks step `done`, advances `current_step`)
|
|
201
|
-
7. Logs execution to `.aia/logs/execution.log`
|
|
222
|
+
#### Using `next` (recommended)
|
|
202
223
|
|
|
203
|
-
|
|
224
|
+
`next` automatically picks the next pending step:
|
|
204
225
|
|
|
205
226
|
```bash
|
|
206
|
-
|
|
207
|
-
|
|
227
|
+
aia feature session-replay
|
|
228
|
+
aia next session-replay "Record and replay user sessions" # -> brief
|
|
229
|
+
aia next session-replay # -> ba-spec
|
|
230
|
+
aia next session-replay # -> questions
|
|
231
|
+
aia next session-replay # -> tech-spec
|
|
232
|
+
aia next session-replay # -> challenge
|
|
233
|
+
aia next session-replay # -> dev-plan
|
|
234
|
+
aia next session-replay # -> implement (auto --apply)
|
|
235
|
+
aia next session-replay # -> review
|
|
208
236
|
```
|
|
209
237
|
|
|
210
|
-
|
|
238
|
+
#### Description parameter
|
|
239
|
+
|
|
240
|
+
Pass a short description in quotes to give context to the AI. Especially useful for the `brief` step:
|
|
211
241
|
|
|
212
242
|
```bash
|
|
213
|
-
|
|
243
|
+
aia run brief session-replay "Record DOM + network requests, replay for debugging"
|
|
244
|
+
aia next session-replay "Capture DOM snapshots, max 30 min sessions"
|
|
214
245
|
```
|
|
215
246
|
|
|
216
|
-
|
|
247
|
+
#### Re-running a step
|
|
217
248
|
|
|
218
|
-
|
|
249
|
+
When you re-run a step, the previous output is fed back as context so the AI can improve it:
|
|
219
250
|
|
|
251
|
+
```bash
|
|
252
|
+
aia reset tech-spec session-replay
|
|
253
|
+
aia run tech-spec session-replay "Add WebSocket support and rate limiting"
|
|
220
254
|
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
repo.js # aia repo scan
|
|
238
|
-
providers/
|
|
239
|
-
registry.js # Model name -> provider routing
|
|
240
|
-
cli-runner.js # Shared CLI spawn logic (stdout streaming, timeout, error handling)
|
|
241
|
-
openai.js # codex exec
|
|
242
|
-
anthropic.js # claude -p
|
|
243
|
-
gemini.js # gemini
|
|
244
|
-
services/
|
|
245
|
-
scaffold.js # .aia/ folder creation
|
|
246
|
-
config.js # Default config generation
|
|
247
|
-
feature.js # Feature workspace creation + validation
|
|
248
|
-
status.js # status.yaml read/write/reset
|
|
249
|
-
runner.js # Step execution orchestrator
|
|
250
|
-
model-call.js # Provider dispatch
|
|
251
|
-
repo-scan.js # Codebase scanner + categorizer
|
|
255
|
+
|
|
256
|
+
### 8. Print mode vs Agent mode
|
|
257
|
+
|
|
258
|
+
By default, AIA runs in **print mode** -- the AI generates text (specs, plans, reviews) saved to `.md` files.
|
|
259
|
+
|
|
260
|
+
With `--apply`, AIA runs in **agent mode** -- the AI can edit and create files in your project, just like running `claude` or `codex` directly.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Print mode (default) -- generates a document
|
|
264
|
+
aia run tech-spec session-replay
|
|
265
|
+
|
|
266
|
+
# Agent mode -- AI writes code in your project
|
|
267
|
+
aia run dev-plan session-replay --apply
|
|
268
|
+
|
|
269
|
+
# Verbose -- see thinking, tool calls, file operations in real-time
|
|
270
|
+
aia run dev-plan session-replay -av
|
|
252
271
|
```
|
|
253
272
|
|
|
273
|
+
The `implement` step always runs in agent mode automatically.
|
|
274
|
+
|
|
275
|
+
| Mode | Timeout | What the AI can do |
|
|
276
|
+
|------|---------|-------------------|
|
|
277
|
+
| Print (default) | 3 min idle | Generate text only |
|
|
278
|
+
| Agent (`--apply`) | 10 min idle | Edit files, run commands, create code |
|
|
279
|
+
|
|
280
|
+
Idle timeout resets every time the CLI produces output, so long-running steps that stream continuously won't time out.
|
|
281
|
+
|
|
282
|
+
### 9. Scan your repo
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
aia repo scan
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Generates `.aia/repo-map.json` -- a categorized index of your source files (services, models, routes, controllers, middleware, utils, config). Useful as additional context for prompts.
|
|
289
|
+
|
|
254
290
|
## Feature workflow
|
|
255
291
|
|
|
256
|
-
Each feature follows a fixed pipeline:
|
|
292
|
+
Each feature follows a fixed pipeline of 8 steps:
|
|
257
293
|
|
|
258
294
|
```
|
|
259
|
-
brief -> ba-spec -> questions -> tech-spec -> challenge -> dev-plan -> review
|
|
295
|
+
brief -> ba-spec -> questions -> tech-spec -> challenge -> dev-plan -> implement -> review
|
|
260
296
|
```
|
|
261
297
|
|
|
298
|
+
| Step | Purpose | Mode |
|
|
299
|
+
|------|---------|------|
|
|
300
|
+
| `brief` | Product brief from a short description | print |
|
|
301
|
+
| `ba-spec` | Business analysis specification | print |
|
|
302
|
+
| `questions` | Questions to clarify requirements | print |
|
|
303
|
+
| `tech-spec` | Technical specification (models, APIs, architecture) | print |
|
|
304
|
+
| `challenge` | Challenge the spec, find gaps and risks | print |
|
|
305
|
+
| `dev-plan` | Step-by-step implementation plan | print |
|
|
306
|
+
| `implement` | Write the actual code | **agent (auto)** |
|
|
307
|
+
| `review` | Code review of the implementation | print |
|
|
308
|
+
|
|
262
309
|
`status.yaml` tracks progress:
|
|
263
310
|
|
|
264
311
|
```yaml
|
|
265
312
|
feature: session-replay
|
|
266
|
-
current_step:
|
|
313
|
+
current_step: implement
|
|
267
314
|
steps:
|
|
268
315
|
brief: done
|
|
269
316
|
ba-spec: done
|
|
270
|
-
questions:
|
|
271
|
-
tech-spec:
|
|
272
|
-
challenge:
|
|
273
|
-
dev-plan:
|
|
317
|
+
questions: done
|
|
318
|
+
tech-spec: done
|
|
319
|
+
challenge: done
|
|
320
|
+
dev-plan: done
|
|
321
|
+
implement: pending
|
|
274
322
|
review: pending
|
|
275
323
|
knowledge:
|
|
276
324
|
- backend
|
|
@@ -278,9 +326,12 @@ knowledge:
|
|
|
278
326
|
|
|
279
327
|
## Prompt assembly
|
|
280
328
|
|
|
281
|
-
When you run a step, the prompt is built from
|
|
329
|
+
When you run a step, the prompt is built from up to 6 sections:
|
|
282
330
|
|
|
283
331
|
```
|
|
332
|
+
=== DESCRIPTION ===
|
|
333
|
+
(optional -- short description passed via CLI argument)
|
|
334
|
+
|
|
284
335
|
=== CONTEXT ===
|
|
285
336
|
(content of context files from config.yaml)
|
|
286
337
|
|
|
@@ -290,12 +341,52 @@ When you run a step, the prompt is built from four sections:
|
|
|
290
341
|
=== FEATURE ===
|
|
291
342
|
(outputs of all prior steps for this feature)
|
|
292
343
|
|
|
344
|
+
=== PREVIOUS OUTPUT ===
|
|
345
|
+
(if re-running -- previous version of this step, for the AI to improve)
|
|
346
|
+
|
|
293
347
|
=== TASK ===
|
|
294
348
|
(content of prompts/<step>.md)
|
|
295
349
|
```
|
|
296
350
|
|
|
297
351
|
The full prompt is piped to the CLI tool via stdin, so there are no argument length limits.
|
|
298
352
|
|
|
353
|
+
## Project structure
|
|
354
|
+
|
|
355
|
+
```
|
|
356
|
+
bin/
|
|
357
|
+
aia.js # CLI entrypoint
|
|
358
|
+
src/
|
|
359
|
+
cli.js # Commander program, registers commands
|
|
360
|
+
constants.js # Shared constants (dirs, steps, scan config)
|
|
361
|
+
models.js # Config loader + validation, weighted model selection
|
|
362
|
+
logger.js # Execution log writer
|
|
363
|
+
knowledge-loader.js # Recursive markdown loader by category
|
|
364
|
+
prompt-builder.js # Assembles full prompt from all sources
|
|
365
|
+
utils.js # Shared filesystem helpers
|
|
366
|
+
commands/
|
|
367
|
+
init.js # aia init
|
|
368
|
+
feature.js # aia feature <name>
|
|
369
|
+
run.js # aia run <step> <feature>
|
|
370
|
+
next.js # aia next <feature>
|
|
371
|
+
status.js # aia status <feature>
|
|
372
|
+
reset.js # aia reset <step> <feature>
|
|
373
|
+
repo.js # aia repo scan
|
|
374
|
+
providers/
|
|
375
|
+
registry.js # Model name + aliases -> provider routing
|
|
376
|
+
cli-runner.js # Shared CLI spawn (streaming, idle timeout, verbose)
|
|
377
|
+
openai.js # codex exec
|
|
378
|
+
anthropic.js # claude -p
|
|
379
|
+
gemini.js # gemini
|
|
380
|
+
services/
|
|
381
|
+
scaffold.js # .aia/ folder creation
|
|
382
|
+
config.js # Default config generation
|
|
383
|
+
feature.js # Feature workspace creation + validation
|
|
384
|
+
status.js # status.yaml read/write/reset
|
|
385
|
+
runner.js # Step execution orchestrator
|
|
386
|
+
model-call.js # Provider dispatch
|
|
387
|
+
repo-scan.js # Codebase scanner + categorizer
|
|
388
|
+
```
|
|
389
|
+
|
|
299
390
|
## Dependencies
|
|
300
391
|
|
|
301
392
|
Only four runtime dependencies:
|
|
@@ -305,4 +396,4 @@ Only four runtime dependencies:
|
|
|
305
396
|
- `fs-extra` -- filesystem utilities
|
|
306
397
|
- `chalk` -- terminal colors
|
|
307
398
|
|
|
308
|
-
AI calls use `child_process.spawn` to delegate to installed CLI tools.
|
|
399
|
+
AI calls use `child_process.spawn` to delegate to installed CLI tools. No API keys needed -- each CLI manages its own authentication.
|
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -32,9 +32,14 @@ export const FEATURE_STEPS = [
|
|
|
32
32
|
'tech-spec',
|
|
33
33
|
'challenge',
|
|
34
34
|
'dev-plan',
|
|
35
|
+
'implement',
|
|
35
36
|
'review',
|
|
36
37
|
];
|
|
37
38
|
|
|
39
|
+
export const APPLY_STEPS = new Set([
|
|
40
|
+
'implement',
|
|
41
|
+
]);
|
|
42
|
+
|
|
38
43
|
export const STEP_STATUS = {
|
|
39
44
|
PENDING: 'pending',
|
|
40
45
|
IN_PROGRESS: 'in-progress',
|
package/src/services/feature.js
CHANGED
|
@@ -5,13 +5,7 @@ import { AIA_DIR, FEATURE_STEPS } from '../constants.js';
|
|
|
5
5
|
|
|
6
6
|
const FEATURE_FILES = [
|
|
7
7
|
'status.yaml',
|
|
8
|
-
|
|
9
|
-
'ba-spec.md',
|
|
10
|
-
'questions.md',
|
|
11
|
-
'tech-spec.md',
|
|
12
|
-
'challenge.md',
|
|
13
|
-
'dev-plan.md',
|
|
14
|
-
'review.md',
|
|
8
|
+
...FEATURE_STEPS.map((s) => `${s}.md`),
|
|
15
9
|
];
|
|
16
10
|
|
|
17
11
|
const FEATURE_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
package/src/services/runner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
import { AIA_DIR, FEATURE_STEPS, STEP_STATUS } from '../constants.js';
|
|
4
|
+
import { AIA_DIR, FEATURE_STEPS, APPLY_STEPS, STEP_STATUS } from '../constants.js';
|
|
5
5
|
import { resolveModel } from '../models.js';
|
|
6
6
|
import { buildPrompt } from '../prompt-builder.js';
|
|
7
7
|
import { callModel } from './model-call.js';
|
|
@@ -23,12 +23,14 @@ export async function runStep(step, feature, { description, verbose = false, app
|
|
|
23
23
|
|
|
24
24
|
await updateStepStatus(feature, step, STEP_STATUS.IN_PROGRESS, root);
|
|
25
25
|
|
|
26
|
+
const shouldApply = apply || APPLY_STEPS.has(step);
|
|
27
|
+
|
|
26
28
|
try {
|
|
27
29
|
const model = await resolveModel(step, root);
|
|
28
30
|
const prompt = await buildPrompt(feature, step, { description, root });
|
|
29
31
|
|
|
30
32
|
const start = performance.now();
|
|
31
|
-
const output = await callModel(model, prompt, { verbose, apply });
|
|
33
|
+
const output = await callModel(model, prompt, { verbose, apply: shouldApply });
|
|
32
34
|
const duration = performance.now() - start;
|
|
33
35
|
|
|
34
36
|
const outputPath = path.join(root, AIA_DIR, 'features', feature, `${step}.md`);
|