@bamptee/aia-code 0.6.0 → 0.8.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 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
- node bin/aia.js init
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 @anthropic-ai/gemini-cli` |
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>` | Execute a step for a feature using AI |
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
- cd your-project
43
- npm install /path/to/aia-code
54
+ npm install -g @bamptee/aia-code
44
55
  ```
45
56
 
46
- Or add it as a dev dependency in your `package.json`:
57
+ Or as a dev dependency:
47
58
 
48
- ```json
49
- {
50
- "devDependencies": {
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
- npx aia init
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/tech-spec.md -->
136
- Write a technical specification.
137
- Include: data models, API endpoints, architecture decisions, trade-offs.
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-sonnet-4-6
169
+ - model: claude-default
160
170
  weight: 1
161
171
 
162
172
  questions:
163
- - model: claude-sonnet-4-6
173
+ - model: claude-default
164
174
  weight: 0.5
165
- - model: o3
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
- Supported model prefixes and the CLI used:
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-3-7-sonnet` |
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. Create a feature and run steps
210
+ ### 7. Run the feature pipeline
211
+
212
+ #### Step by step
186
213
 
187
214
  ```bash
188
- npx aia feature session-replay
189
- npx aia run brief session-replay
190
- npx aia status session-replay
191
- npx aia run tech-spec session-replay
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
- Each run:
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
- To re-run a step:
224
+ `next` automatically picks the next pending step:
204
225
 
205
226
  ```bash
206
- npx aia reset tech-spec session-replay
207
- npx aia run tech-spec session-replay
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
- ### 8. Scan your repo
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
- npx aia repo scan
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
- 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.
247
+ #### Re-running a step
217
248
 
218
- ## Project structure
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
- bin/
222
- aia.js # CLI entrypoint
223
- src/
224
- cli.js # Commander program, registers commands
225
- constants.js # Shared constants (dirs, steps, scan config)
226
- models.js # Config loader + validation, weighted model selection
227
- logger.js # Execution log writer
228
- knowledge-loader.js # Recursive markdown loader by category
229
- prompt-builder.js # Assembles full prompt from all sources
230
- utils.js # Shared filesystem helpers
231
- commands/
232
- init.js # aia init
233
- feature.js # aia feature <name>
234
- run.js # aia run <step> <feature>
235
- status.js # aia status <feature>
236
- reset.js # aia reset <step> <feature>
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: tech-spec
313
+ current_step: implement
267
314
  steps:
268
315
  brief: done
269
316
  ba-spec: done
270
- questions: pending
271
- tech-spec: pending
272
- challenge: pending
273
- dev-plan: pending
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 four sections:
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamptee/aia-code",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "AI Architecture Assistant - orchestrate AI-assisted development workflows via CLI tools (Claude, Codex, Gemini)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,16 +1,18 @@
1
1
  import chalk from 'chalk';
2
2
  import { createAiaStructure } from '../services/scaffold.js';
3
3
  import { writeDefaultConfig } from '../services/config.js';
4
+ import { writeDefaultPrompts } from '../services/prompts.js';
4
5
  import { AIA_DIR } from '../constants.js';
5
6
 
6
7
  export function registerInitCommand(program) {
7
8
  program
8
9
  .command('init')
9
- .description('Initialize .aia folder structure and default config')
10
+ .description('Initialize .aia folder structure, default config, and prompt templates')
10
11
  .action(async () => {
11
12
  try {
12
13
  await createAiaStructure();
13
14
  await writeDefaultConfig();
15
+ await writeDefaultPrompts();
14
16
  console.log(chalk.green(`Initialized ${AIA_DIR}/ project structure.`));
15
17
  } catch (err) {
16
18
  console.error(chalk.red(`Init failed: ${err.message}`));
@@ -5,6 +5,13 @@ import { AIA_DIR } from '../constants.js';
5
5
 
6
6
  const DEFAULT_CONFIG = {
7
7
  models: {
8
+ brief: [
9
+ { model: 'claude-default', weight: 1 },
10
+ ],
11
+ 'ba-spec': [
12
+ { model: 'claude-default', weight: 0.5 },
13
+ { model: 'openai-default', weight: 0.5 },
14
+ ],
8
15
  questions: [
9
16
  { model: 'claude-default', weight: 0.5 },
10
17
  { model: 'openai-default', weight: 0.5 },
@@ -13,6 +20,19 @@ const DEFAULT_CONFIG = {
13
20
  { model: 'claude-default', weight: 0.5 },
14
21
  { model: 'openai-default', weight: 0.5 },
15
22
  ],
23
+ challenge: [
24
+ { model: 'openai-default', weight: 1 },
25
+ ],
26
+ 'dev-plan': [
27
+ { model: 'claude-default', weight: 0.5 },
28
+ { model: 'openai-default', weight: 0.5 },
29
+ ],
30
+ implement: [
31
+ { model: 'claude-default', weight: 1 },
32
+ ],
33
+ review: [
34
+ { model: 'openai-default', weight: 1 },
35
+ ],
16
36
  },
17
37
  knowledge_default: ['backend'],
18
38
  context_files: [
@@ -0,0 +1,149 @@
1
+ import path from 'node:path';
2
+ import fs from 'fs-extra';
3
+ import { AIA_DIR, FEATURE_STEPS } from '../constants.js';
4
+
5
+ const DEFAULT_PROMPTS = {
6
+ brief: `You are a product manager. Write a product brief for this feature.
7
+
8
+ Include:
9
+ - Problem statement: what pain point does this solve?
10
+ - Target users: who benefits from this feature?
11
+ - User stories: 3-5 key user stories in "As a [user], I want [goal], so that [benefit]" format
12
+ - Success metrics: how do we measure if this feature is successful?
13
+ - Scope: what is in scope and out of scope for v1?
14
+ - Open questions: list any unknowns that need clarification
15
+
16
+ Keep it concise and actionable. Use the project context and knowledge to align with existing architecture.`,
17
+
18
+ 'ba-spec': `You are a business analyst. Write a detailed business analysis specification based on the brief.
19
+
20
+ Include:
21
+ - Functional requirements: numbered list of what the system must do
22
+ - Non-functional requirements: performance, security, scalability expectations
23
+ - Business rules: validation rules, edge cases, constraints
24
+ - Data requirements: what data is needed, where it comes from, how it flows
25
+ - User workflows: step-by-step flows for each key user story
26
+ - Acceptance criteria: clear, testable criteria for each requirement
27
+ - Dependencies: external systems, APIs, or teams involved
28
+
29
+ Be specific and measurable. Every requirement should be testable.`,
30
+
31
+ questions: `You are a senior architect reviewing the brief and BA spec.
32
+
33
+ Generate a list of critical questions that must be answered before implementation.
34
+
35
+ Organize by category:
36
+ - Architecture: system design, integration points, data flow
37
+ - Security: authentication, authorization, data protection
38
+ - Performance: expected load, latency requirements, caching strategy
39
+ - UX: user interaction details, error handling, edge cases
40
+ - Data: migration, storage, backup, retention policies
41
+ - Infrastructure: deployment, monitoring, scaling
42
+ - Dependencies: third-party services, API limits, licensing
43
+
44
+ For each question, explain why it matters and suggest a default answer if possible.`,
45
+
46
+ 'tech-spec': `You are a senior software architect. Write a detailed technical specification.
47
+
48
+ Include:
49
+ - Architecture overview: how this feature fits into the existing system
50
+ - Data models: schemas, relationships, indexes, migrations
51
+ - API design: endpoints, request/response formats, status codes, authentication
52
+ - Service layer: business logic, validation, error handling
53
+ - Integration points: external APIs, message queues, webhooks
54
+ - Security considerations: input validation, authorization checks, rate limiting
55
+ - Performance considerations: caching strategy, query optimization, pagination
56
+ - Error handling: failure modes, retry strategies, fallback behavior
57
+ - Testing strategy: unit tests, integration tests, key scenarios to cover
58
+
59
+ Use the project's existing patterns from the knowledge files. Be specific with code-level details.`,
60
+
61
+ challenge: `You are a devil's advocate reviewer. Challenge the technical specification.
62
+
63
+ Your job is to find weaknesses, gaps, and risks:
64
+ - Architectural risks: single points of failure, scaling bottlenecks, coupling issues
65
+ - Security vulnerabilities: injection risks, auth bypass, data leaks
66
+ - Missing edge cases: race conditions, concurrent access, data corruption
67
+ - Performance concerns: N+1 queries, missing indexes, memory leaks
68
+ - Operational risks: deployment complexity, rollback strategy, monitoring gaps
69
+ - Over-engineering: unnecessary complexity, premature optimization
70
+ - Under-engineering: missing error handling, insufficient validation
71
+
72
+ For each issue found:
73
+ 1. Describe the problem
74
+ 2. Explain the potential impact
75
+ 3. Suggest a concrete fix
76
+
77
+ Be constructive but thorough. It's better to catch issues now than in production.`,
78
+
79
+ 'dev-plan': `You are a tech lead. Create a step-by-step implementation plan.
80
+
81
+ Break the work into ordered tasks that can be implemented sequentially:
82
+
83
+ For each task:
84
+ - Title: short description
85
+ - Files: which files to create or modify
86
+ - Details: what exactly to implement
87
+ - Dependencies: which previous tasks must be completed first
88
+ - Tests: what tests to write for this task
89
+
90
+ Guidelines:
91
+ - Order tasks so each one builds on the previous
92
+ - Start with data models and migrations
93
+ - Then services and business logic
94
+ - Then API routes and controllers
95
+ - Then UI components if applicable
96
+ - End with integration tests
97
+ - Each task should be small enough to review in isolation
98
+ - Include exact file paths based on the project structure`,
99
+
100
+ implement: `You are a senior developer. Implement the feature following the dev-plan exactly.
101
+
102
+ Rules:
103
+ - Follow the project's existing code patterns and conventions
104
+ - Create all files specified in the dev-plan
105
+ - Write clean, production-ready code
106
+ - Include proper error handling and input validation
107
+ - Add JSDoc comments for public functions
108
+ - Follow the naming conventions from the knowledge files
109
+ - Write unit tests for business logic
110
+ - Write integration tests for API endpoints
111
+
112
+ Work through the dev-plan tasks in order. For each task, create or modify the specified files.
113
+ Do not skip any task. If a task depends on a previous one, make sure the dependency is implemented first.`,
114
+
115
+ review: `You are a senior code reviewer. Review the implementation of this feature.
116
+
117
+ Evaluate:
118
+ - Correctness: does the code match the tech spec and dev plan?
119
+ - Code quality: readability, naming, structure, DRY principle
120
+ - Error handling: are all failure modes covered?
121
+ - Security: input validation, SQL injection, XSS, auth checks
122
+ - Performance: N+1 queries, missing indexes, unnecessary computations
123
+ - Tests: coverage, edge cases, meaningful assertions
124
+ - Documentation: are public APIs documented?
125
+
126
+ For each issue found:
127
+ - File and line reference
128
+ - Severity: critical / warning / suggestion
129
+ - Description of the problem
130
+ - Suggested fix with code example
131
+
132
+ End with a summary: ship / ship with fixes / needs rework.`,
133
+ };
134
+
135
+ export async function writeDefaultPrompts(root = process.cwd()) {
136
+ const promptsDir = path.join(root, AIA_DIR, 'prompts');
137
+ await fs.ensureDir(promptsDir);
138
+
139
+ for (const step of FEATURE_STEPS) {
140
+ const filePath = path.join(promptsDir, `${step}.md`);
141
+ if (await fs.pathExists(filePath)) {
142
+ continue;
143
+ }
144
+ const content = DEFAULT_PROMPTS[step] ?? '';
145
+ if (content) {
146
+ await fs.writeFile(filePath, content, 'utf-8');
147
+ }
148
+ }
149
+ }