@bamptee/aia-code 0.7.0 → 0.10.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 +54 -2
- package/package.json +1 -1
- package/src/cli.js +2 -0
- package/src/commands/feature.js +4 -0
- package/src/commands/init.js +3 -1
- package/src/commands/quick.js +62 -0
- package/src/constants.js +2 -0
- package/src/prompt-builder.js +12 -1
- package/src/services/config.js +20 -0
- package/src/services/feature.js +21 -1
- package/src/services/prompts.js +149 -0
package/README.md
CHANGED
|
@@ -35,9 +35,10 @@ Each CLI manages its own authentication. Run `claude`, `codex`, or `gemini` once
|
|
|
35
35
|
| `aia next <feature> [description]` | Run the next pending step automatically |
|
|
36
36
|
| `aia status <feature>` | Show the current status of a feature |
|
|
37
37
|
| `aia reset <step> <feature>` | Reset a step to pending so it can be re-run |
|
|
38
|
+
| `aia quick <name> [description]` | Quick story/ticket: dev-plan → implement → review only |
|
|
38
39
|
| `aia repo scan` | Scan codebase and generate `repo-map.json` |
|
|
39
40
|
|
|
40
|
-
### Options for `run` and `
|
|
41
|
+
### Options for `run`, `next`, and `quick`
|
|
41
42
|
|
|
42
43
|
| Flag | Description |
|
|
43
44
|
|------|-------------|
|
|
@@ -219,6 +220,33 @@ aia run ba-spec session-replay
|
|
|
219
220
|
aia run tech-spec session-replay
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
#### Initial specs (`init.md`)
|
|
224
|
+
|
|
225
|
+
When you create a feature, AIA generates an `init.md` file. Edit it to add your initial specs, requirements, and constraints -- this content is injected into **every step** as context:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
aia feature session-replay
|
|
229
|
+
# Edit .aia/features/session-replay/init.md with your specs
|
|
230
|
+
aia next session-replay
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```markdown
|
|
234
|
+
<!-- .aia/features/session-replay/init.md -->
|
|
235
|
+
# session-replay
|
|
236
|
+
|
|
237
|
+
## Description
|
|
238
|
+
Record and replay user sessions for debugging.
|
|
239
|
+
|
|
240
|
+
## Existing specs
|
|
241
|
+
- Capture DOM snapshots every 500ms
|
|
242
|
+
- Record network requests and console logs
|
|
243
|
+
- Max session duration: 30 minutes
|
|
244
|
+
|
|
245
|
+
## Constraints
|
|
246
|
+
- Must work with our existing React 18 + Express stack
|
|
247
|
+
- Storage budget: max 5MB per session
|
|
248
|
+
```
|
|
249
|
+
|
|
222
250
|
#### Using `next` (recommended)
|
|
223
251
|
|
|
224
252
|
`next` automatically picks the next pending step:
|
|
@@ -253,6 +281,26 @@ aia reset tech-spec session-replay
|
|
|
253
281
|
aia run tech-spec session-replay "Add WebSocket support and rate limiting"
|
|
254
282
|
```
|
|
255
283
|
|
|
284
|
+
#### Quick mode (stories & tickets)
|
|
285
|
+
|
|
286
|
+
For small stories or tickets that don't need the full 8-step pipeline, use `aia quick`. It skips brief, ba-spec, questions, tech-spec, and challenge, and runs only **dev-plan → implement → review**:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Create feature + run 3 steps in sequence
|
|
290
|
+
aia quick fix-login-bug "Fix the login timeout issue on mobile"
|
|
291
|
+
|
|
292
|
+
# Or create the feature first, edit init.md, then run
|
|
293
|
+
aia feature fix-login-bug
|
|
294
|
+
# Edit .aia/features/fix-login-bug/init.md with details
|
|
295
|
+
aia quick fix-login-bug
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The `init.md` file serves as the sole input context for the dev-plan step. Verbose and apply flags work the same way:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
aia quick add-rate-limit "Add rate limiting to the /api/upload endpoint" -v
|
|
302
|
+
```
|
|
303
|
+
|
|
256
304
|
### 8. Print mode vs Agent mode
|
|
257
305
|
|
|
258
306
|
By default, AIA runs in **print mode** -- the AI generates text (specs, plans, reviews) saved to `.md` files.
|
|
@@ -326,7 +374,7 @@ knowledge:
|
|
|
326
374
|
|
|
327
375
|
## Prompt assembly
|
|
328
376
|
|
|
329
|
-
When you run a step, the prompt is built from up to
|
|
377
|
+
When you run a step, the prompt is built from up to 7 sections:
|
|
330
378
|
|
|
331
379
|
```
|
|
332
380
|
=== DESCRIPTION ===
|
|
@@ -338,6 +386,9 @@ When you run a step, the prompt is built from up to 6 sections:
|
|
|
338
386
|
=== KNOWLEDGE ===
|
|
339
387
|
(all .md files from the knowledge categories)
|
|
340
388
|
|
|
389
|
+
=== INITIAL SPECS ===
|
|
390
|
+
(content of init.md -- your initial specs and requirements)
|
|
391
|
+
|
|
341
392
|
=== FEATURE ===
|
|
342
393
|
(outputs of all prior steps for this feature)
|
|
343
394
|
|
|
@@ -368,6 +419,7 @@ src/
|
|
|
368
419
|
feature.js # aia feature <name>
|
|
369
420
|
run.js # aia run <step> <feature>
|
|
370
421
|
next.js # aia next <feature>
|
|
422
|
+
quick.js # aia quick <name> [description]
|
|
371
423
|
status.js # aia status <feature>
|
|
372
424
|
reset.js # aia reset <step> <feature>
|
|
373
425
|
repo.js # aia repo scan
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerRepoCommand } from './commands/repo.js';
|
|
|
6
6
|
import { registerStatusCommand } from './commands/status.js';
|
|
7
7
|
import { registerResetCommand } from './commands/reset.js';
|
|
8
8
|
import { registerNextCommand } from './commands/next.js';
|
|
9
|
+
import { registerQuickCommand } from './commands/quick.js';
|
|
9
10
|
|
|
10
11
|
export function createCli() {
|
|
11
12
|
const program = new Command();
|
|
@@ -19,6 +20,7 @@ export function createCli() {
|
|
|
19
20
|
registerFeatureCommand(program);
|
|
20
21
|
registerRunCommand(program);
|
|
21
22
|
registerNextCommand(program);
|
|
23
|
+
registerQuickCommand(program);
|
|
22
24
|
registerRepoCommand(program);
|
|
23
25
|
registerStatusCommand(program);
|
|
24
26
|
registerResetCommand(program);
|
package/src/commands/feature.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import chalk from 'chalk';
|
|
2
3
|
import { createFeature } from '../services/feature.js';
|
|
4
|
+
import { AIA_DIR } from '../constants.js';
|
|
3
5
|
|
|
4
6
|
export function registerFeatureCommand(program) {
|
|
5
7
|
program
|
|
@@ -8,7 +10,9 @@ export function registerFeatureCommand(program) {
|
|
|
8
10
|
.action(async (name) => {
|
|
9
11
|
try {
|
|
10
12
|
await createFeature(name);
|
|
13
|
+
const initPath = path.join(AIA_DIR, 'features', name, 'init.md');
|
|
11
14
|
console.log(chalk.green(`Feature "${name}" created.`));
|
|
15
|
+
console.log(chalk.gray(`Edit ${initPath} to add your initial specs and requirements.`));
|
|
12
16
|
} catch (err) {
|
|
13
17
|
console.error(chalk.red(err.message));
|
|
14
18
|
process.exit(1);
|
package/src/commands/init.js
CHANGED
|
@@ -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
|
|
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}`));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import yaml from 'yaml';
|
|
5
|
+
import { AIA_DIR, FEATURE_STEPS, QUICK_STEPS, STEP_STATUS } from '../constants.js';
|
|
6
|
+
import { createFeature, validateFeatureName } from '../services/feature.js';
|
|
7
|
+
import { runStep } from '../services/runner.js';
|
|
8
|
+
|
|
9
|
+
async function skipEarlySteps(feature, root) {
|
|
10
|
+
const statusFile = path.join(root, AIA_DIR, 'features', feature, 'status.yaml');
|
|
11
|
+
const raw = await fs.readFile(statusFile, 'utf-8');
|
|
12
|
+
const status = yaml.parse(raw);
|
|
13
|
+
|
|
14
|
+
for (const step of FEATURE_STEPS) {
|
|
15
|
+
if (!QUICK_STEPS.includes(step)) {
|
|
16
|
+
status.steps[step] = STEP_STATUS.DONE;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
status.current_step = QUICK_STEPS[0];
|
|
20
|
+
|
|
21
|
+
await fs.writeFile(statusFile, yaml.stringify(status), 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function registerQuickCommand(program) {
|
|
25
|
+
program
|
|
26
|
+
.command('quick <name> [description]')
|
|
27
|
+
.description('Quick story/ticket: create feature then run dev-plan → implement → review')
|
|
28
|
+
.option('-v, --verbose', 'Show AI thinking/tool usage')
|
|
29
|
+
.option('-a, --apply', 'Force agent mode (file editing) for all steps')
|
|
30
|
+
.action(async (name, description, opts) => {
|
|
31
|
+
try {
|
|
32
|
+
validateFeatureName(name);
|
|
33
|
+
|
|
34
|
+
const root = process.cwd();
|
|
35
|
+
const featureDir = path.join(root, AIA_DIR, 'features', name);
|
|
36
|
+
|
|
37
|
+
if (!(await fs.pathExists(featureDir))) {
|
|
38
|
+
await createFeature(name, root);
|
|
39
|
+
console.log(chalk.green(`Feature "${name}" created.`));
|
|
40
|
+
const initPath = path.join(AIA_DIR, 'features', name, 'init.md');
|
|
41
|
+
console.log(chalk.gray(`Using ${initPath} as input.`));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await skipEarlySteps(name, root);
|
|
45
|
+
|
|
46
|
+
for (const step of QUICK_STEPS) {
|
|
47
|
+
console.log(chalk.cyan(`\n--- Running ${step} ---\n`));
|
|
48
|
+
await runStep(step, name, {
|
|
49
|
+
description,
|
|
50
|
+
verbose: opts.verbose,
|
|
51
|
+
apply: opts.apply,
|
|
52
|
+
root,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(chalk.green(`\nQuick pipeline completed for "${name}".`));
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.error(chalk.red(err.message));
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
package/src/constants.js
CHANGED
package/src/prompt-builder.js
CHANGED
|
@@ -44,6 +44,11 @@ async function loadFeatureFiles(feature, step, root) {
|
|
|
44
44
|
return sections.join('\n\n');
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
async function loadInitSpecs(feature, root) {
|
|
48
|
+
const filePath = path.join(root, AIA_DIR, 'features', feature, 'init.md');
|
|
49
|
+
return readIfExists(filePath);
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
async function loadPreviousOutput(feature, step, root) {
|
|
48
53
|
const filePath = path.join(root, AIA_DIR, 'features', feature, `${step}.md`);
|
|
49
54
|
return readIfExists(filePath);
|
|
@@ -75,9 +80,10 @@ async function loadPromptTemplate(step, root) {
|
|
|
75
80
|
export async function buildPrompt(feature, step, { description, root = process.cwd() } = {}) {
|
|
76
81
|
const config = await loadConfig(root);
|
|
77
82
|
|
|
78
|
-
const [context, knowledgeCategories, featureContent, previousOutput, task] = await Promise.all([
|
|
83
|
+
const [context, knowledgeCategories, initSpecs, featureContent, previousOutput, task] = await Promise.all([
|
|
79
84
|
loadContextFiles(config, root),
|
|
80
85
|
resolveKnowledgeCategories(feature, config, root),
|
|
86
|
+
loadInitSpecs(feature, root),
|
|
81
87
|
loadFeatureFiles(feature, step, root),
|
|
82
88
|
loadPreviousOutput(feature, step, root),
|
|
83
89
|
loadPromptTemplate(step, root),
|
|
@@ -99,6 +105,11 @@ export async function buildPrompt(feature, step, { description, root = process.c
|
|
|
99
105
|
parts.push('\n\n=== KNOWLEDGE ===\n');
|
|
100
106
|
parts.push(knowledge || '(no knowledge)');
|
|
101
107
|
|
|
108
|
+
if (initSpecs) {
|
|
109
|
+
parts.push('\n\n=== INITIAL SPECS ===\n');
|
|
110
|
+
parts.push(initSpecs);
|
|
111
|
+
}
|
|
112
|
+
|
|
102
113
|
parts.push('\n\n=== FEATURE ===\n');
|
|
103
114
|
parts.push(featureContent || '(no prior steps)');
|
|
104
115
|
|
package/src/services/config.js
CHANGED
|
@@ -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: [
|
package/src/services/feature.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AIA_DIR, FEATURE_STEPS } from '../constants.js';
|
|
|
5
5
|
|
|
6
6
|
const FEATURE_FILES = [
|
|
7
7
|
'status.yaml',
|
|
8
|
+
'init.md',
|
|
8
9
|
...FEATURE_STEPS.map((s) => `${s}.md`),
|
|
9
10
|
];
|
|
10
11
|
|
|
@@ -18,6 +19,23 @@ export function validateFeatureName(name) {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
function buildInitMd(name) {
|
|
23
|
+
return `# ${name}
|
|
24
|
+
|
|
25
|
+
<!-- Describe your feature here. This file is injected into every step as context. -->
|
|
26
|
+
<!-- Add any initial specs, requirements, mockups, or notes you already have. -->
|
|
27
|
+
|
|
28
|
+
## Description
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Existing specs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Constraints
|
|
35
|
+
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
|
|
21
39
|
function buildStatusYaml(name) {
|
|
22
40
|
const steps = {};
|
|
23
41
|
for (const step of FEATURE_STEPS) {
|
|
@@ -45,7 +63,9 @@ export async function createFeature(name, root = process.cwd()) {
|
|
|
45
63
|
|
|
46
64
|
for (const file of FEATURE_FILES) {
|
|
47
65
|
const filePath = path.join(featureDir, file);
|
|
48
|
-
|
|
66
|
+
let content = '';
|
|
67
|
+
if (file === 'status.yaml') content = buildStatusYaml(name);
|
|
68
|
+
else if (file === 'init.md') content = buildInitMd(name);
|
|
49
69
|
await fs.writeFile(filePath, content, 'utf-8');
|
|
50
70
|
}
|
|
51
71
|
}
|
|
@@ -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
|
+
}
|