aped-method 1.0.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/bin/aped-method.js +8 -0
- package/package.json +31 -0
- package/src/index.js +348 -0
- package/src/scaffold.js +21 -0
- package/src/templates/commands.js +65 -0
- package/src/templates/config.js +230 -0
- package/src/templates/data/domain-complexity.csv +15 -0
- package/src/templates/data/project-types.csv +11 -0
- package/src/templates/guardrail.js +171 -0
- package/src/templates/index.js +17 -0
- package/src/templates/references.js +549 -0
- package/src/templates/scripts.js +345 -0
- package/src/templates/skills.js +412 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
function loadCSV(name) {
|
|
8
|
+
try {
|
|
9
|
+
return readFileSync(join(__dirname, 'data', name), 'utf-8');
|
|
10
|
+
} catch {
|
|
11
|
+
// Fallback: return minimal CSV if data files not bundled
|
|
12
|
+
if (name === 'domain-complexity.csv') return DOMAIN_COMPLEXITY_CSV;
|
|
13
|
+
if (name === 'project-types.csv') return PROJECT_TYPES_CSV;
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function references(c) {
|
|
19
|
+
const a = c.apedDir;
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
path: `${a}/aped-a/references/research-prompts.md`,
|
|
23
|
+
content: RESEARCH_PROMPTS,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: `${a}/aped-p/references/fr-rules.md`,
|
|
27
|
+
content: FR_RULES,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
path: `${a}/aped-p/references/domain-complexity.csv`,
|
|
31
|
+
content: loadCSV('domain-complexity.csv'),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: `${a}/aped-p/references/project-types.csv`,
|
|
35
|
+
content: loadCSV('project-types.csv'),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
path: `${a}/aped-e/references/epic-rules.md`,
|
|
39
|
+
content: EPIC_RULES,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: `${a}/aped-d/references/tdd-engine.md`,
|
|
43
|
+
content: TDD_ENGINE,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: `${a}/aped-r/references/review-criteria.md`,
|
|
47
|
+
content: REVIEW_CRITERIA,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const RESEARCH_PROMPTS = `# Research Agent Prompts
|
|
53
|
+
|
|
54
|
+
Use these prompts when launching the 3 parallel research agents in the Analyze phase.
|
|
55
|
+
|
|
56
|
+
## Agent 1: Market Research
|
|
57
|
+
|
|
58
|
+
You are a market research analyst. Investigate the following for the project idea provided:
|
|
59
|
+
|
|
60
|
+
### Questions to Answer
|
|
61
|
+
1. **Customer Behavior**: How do target users currently solve this problem? What tools/workarounds do they use?
|
|
62
|
+
2. **Pain Points**: What are the top 3-5 frustrations with existing solutions? Where do users drop off or give up?
|
|
63
|
+
3. **Competitive Landscape**: Who are the direct competitors? Indirect competitors? What are their strengths and weaknesses?
|
|
64
|
+
4. **Market Size**: What is the TAM/SAM/SOM? Is the market growing, stable, or declining?
|
|
65
|
+
5. **Pricing Models**: How do competitors price? Freemium, subscription, usage-based, one-time?
|
|
66
|
+
6. **Distribution**: How do competitors acquire users? What channels work in this space?
|
|
67
|
+
|
|
68
|
+
### Output Format
|
|
69
|
+
\`\`\`markdown
|
|
70
|
+
## Market Research Findings
|
|
71
|
+
|
|
72
|
+
### Customer Behavior & Pain Points
|
|
73
|
+
- [findings with sources]
|
|
74
|
+
|
|
75
|
+
### Competitive Landscape
|
|
76
|
+
| Competitor | Strengths | Weaknesses | Pricing |
|
|
77
|
+
|------------|-----------|------------|---------|
|
|
78
|
+
|
|
79
|
+
### Market Size & Trends
|
|
80
|
+
- [TAM/SAM/SOM estimates with sources]
|
|
81
|
+
|
|
82
|
+
### Key Insights
|
|
83
|
+
- [3-5 actionable insights]
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
### WebSearch Usage
|
|
87
|
+
Search for: \`{product_domain} market size {current_year}\`, \`{competitor_names} review\`, \`{target_user} pain points {product_domain}\`
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Agent 2: Domain Research
|
|
92
|
+
|
|
93
|
+
You are a domain analyst. Investigate the industry and regulatory landscape:
|
|
94
|
+
|
|
95
|
+
### Questions to Answer
|
|
96
|
+
1. **Industry Trends**: What are the top 3 trends shaping this domain? What's emerging?
|
|
97
|
+
2. **Regulations**: What compliance requirements exist? (GDPR, HIPAA, PCI-DSS, SOC2, etc.)
|
|
98
|
+
3. **Standards**: What industry standards or certifications are relevant?
|
|
99
|
+
4. **Barriers to Entry**: What are the technical, legal, or financial barriers?
|
|
100
|
+
5. **Ecosystem**: What platforms, APIs, or integrations are essential in this space?
|
|
101
|
+
|
|
102
|
+
### Output Format
|
|
103
|
+
\`\`\`markdown
|
|
104
|
+
## Domain Research Findings
|
|
105
|
+
|
|
106
|
+
### Industry Trends
|
|
107
|
+
- [trend with evidence]
|
|
108
|
+
|
|
109
|
+
### Regulatory & Compliance
|
|
110
|
+
- [regulation: requirement and impact]
|
|
111
|
+
|
|
112
|
+
### Standards & Certifications
|
|
113
|
+
- [standard: relevance]
|
|
114
|
+
|
|
115
|
+
### Barriers & Ecosystem
|
|
116
|
+
- [barrier/integration: details]
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
### WebSearch Usage
|
|
120
|
+
Search for: \`{domain} regulations {current_year}\`, \`{domain} industry trends\`, \`{domain} compliance requirements software\`
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Agent 3: Technical Research
|
|
125
|
+
|
|
126
|
+
You are a technical architect. Investigate technology options and patterns:
|
|
127
|
+
|
|
128
|
+
### Questions to Answer
|
|
129
|
+
1. **Tech Stack Options**: What frameworks, languages, and tools are best suited? Why?
|
|
130
|
+
2. **Architecture Patterns**: What architecture patterns do successful products in this space use?
|
|
131
|
+
3. **Integration Points**: What third-party APIs, services, or platforms need integration?
|
|
132
|
+
4. **Open Source**: What open-source tools and libraries are available and mature?
|
|
133
|
+
5. **Scalability Considerations**: What technical decisions will impact scaling?
|
|
134
|
+
6. **Developer Experience**: What SDKs, docs, and tooling exist in this ecosystem?
|
|
135
|
+
|
|
136
|
+
### Output Format
|
|
137
|
+
\`\`\`markdown
|
|
138
|
+
## Technical Research Findings
|
|
139
|
+
|
|
140
|
+
### Recommended Tech Stack
|
|
141
|
+
- [technology: rationale]
|
|
142
|
+
|
|
143
|
+
### Architecture Patterns
|
|
144
|
+
- [pattern: when to use, trade-offs]
|
|
145
|
+
|
|
146
|
+
### Integration Points
|
|
147
|
+
| Service/API | Purpose | Maturity | Notes |
|
|
148
|
+
|-------------|---------|----------|-------|
|
|
149
|
+
|
|
150
|
+
### Open Source Tools
|
|
151
|
+
- [tool: purpose, stars/activity, license]
|
|
152
|
+
|
|
153
|
+
### Scalability Notes
|
|
154
|
+
- [consideration: impact]
|
|
155
|
+
\`\`\`
|
|
156
|
+
|
|
157
|
+
### WebSearch Usage
|
|
158
|
+
Search for: \`{tech_stack} best practices {current_year}\`, \`{product_type} architecture patterns\`, \`{integration_name} API documentation\`
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
const FR_RULES = `# Functional Requirements Quality Rules
|
|
162
|
+
|
|
163
|
+
## FR Format
|
|
164
|
+
|
|
165
|
+
Every FR MUST follow this format:
|
|
166
|
+
\`\`\`
|
|
167
|
+
FR#: [Actor] can [capability] [context/constraint]
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
### Examples
|
|
171
|
+
- \`FR1: User can create an account using email and password\`
|
|
172
|
+
- \`FR12: Admin can export user data as CSV filtered by date range\`
|
|
173
|
+
- \`FR25: System can process payment transactions within 3 seconds\`
|
|
174
|
+
|
|
175
|
+
### Actors
|
|
176
|
+
Use specific actors, not generic ones:
|
|
177
|
+
- **Good**: User, Admin, Manager, System, API Consumer
|
|
178
|
+
- **Bad**: Someone, People, Anyone, They
|
|
179
|
+
|
|
180
|
+
## Anti-Patterns (MUST NOT appear in FRs)
|
|
181
|
+
|
|
182
|
+
### Subjective Adjectives
|
|
183
|
+
These words are unmeasurable and untestable:
|
|
184
|
+
- ~~easy~~ — specify the number of steps or clicks
|
|
185
|
+
- ~~intuitive~~ — specify the interaction pattern
|
|
186
|
+
- ~~fast~~ — specify the time threshold (e.g., "within 2 seconds")
|
|
187
|
+
- ~~responsive~~ — specify the breakpoints or time limits
|
|
188
|
+
- ~~simple~~ — specify the complexity constraints
|
|
189
|
+
|
|
190
|
+
### Vague Quantifiers
|
|
191
|
+
These words hide undefined scope:
|
|
192
|
+
- ~~multiple~~ — specify the exact number or range (e.g., "up to 10")
|
|
193
|
+
- ~~several~~ — specify the count
|
|
194
|
+
- ~~various~~ — list the specific items
|
|
195
|
+
|
|
196
|
+
### Implementation Leakage
|
|
197
|
+
FRs describe WHAT, not HOW:
|
|
198
|
+
- **Bad**: \`FR5: User can login using React form with JWT tokens\`
|
|
199
|
+
- **Good**: \`FR5: User can authenticate with email and password\`
|
|
200
|
+
- No technology names (React, PostgreSQL, Redis)
|
|
201
|
+
- No implementation details (JWT, REST, WebSocket)
|
|
202
|
+
- No specific libraries or frameworks
|
|
203
|
+
|
|
204
|
+
## NFR Format
|
|
205
|
+
|
|
206
|
+
\`\`\`
|
|
207
|
+
The system shall [metric] [condition] [measurement method]
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
### Examples
|
|
211
|
+
- \`The system shall respond to API requests within 200ms at the 95th percentile under normal load\`
|
|
212
|
+
- \`The system shall support 10,000 concurrent users without degradation\`
|
|
213
|
+
- \`The system shall achieve WCAG 2.1 AA compliance on all public pages\`
|
|
214
|
+
|
|
215
|
+
### NFR Categories (include only when relevant)
|
|
216
|
+
- **Performance**: response times, throughput, resource usage
|
|
217
|
+
- **Security**: authentication, authorization, encryption, compliance
|
|
218
|
+
- **Scalability**: concurrent users, data volume, geographic distribution
|
|
219
|
+
- **Accessibility**: WCAG level, assistive technology support
|
|
220
|
+
- **Integration**: API compatibility, data format standards, protocol support
|
|
221
|
+
|
|
222
|
+
## Information Density Rules
|
|
223
|
+
|
|
224
|
+
- Every sentence carries weight — zero fluff
|
|
225
|
+
- No preambles ("In order to provide...", "The system should aim to...")
|
|
226
|
+
- No redundant context (if it's in the Product Scope, don't repeat in FRs)
|
|
227
|
+
- One FR = one capability (no compound FRs with "and" joining unrelated actions)
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
const EPIC_RULES = `# Epic & Story Design Rules
|
|
231
|
+
|
|
232
|
+
## Epic Design Principles
|
|
233
|
+
|
|
234
|
+
### 1. User Value First
|
|
235
|
+
Each epic delivers COMPLETE functionality for its domain. Epics are organized by what users can DO, not by technical layers.
|
|
236
|
+
|
|
237
|
+
**Correct patterns:**
|
|
238
|
+
- "User Authentication and Profiles" — complete auth system end-to-end
|
|
239
|
+
- "Content Management" — full CRUD for content with publishing
|
|
240
|
+
- "Payment Processing" — billing, subscriptions, invoicing
|
|
241
|
+
|
|
242
|
+
**Wrong patterns:**
|
|
243
|
+
- "Database Setup" — no user value, technical layer
|
|
244
|
+
- "API Development" — no user value, technical layer
|
|
245
|
+
- "Frontend Components" — no user value, technical layer
|
|
246
|
+
- "Infrastructure" — exception: acceptable as Epic 1 if project needs scaffolding
|
|
247
|
+
|
|
248
|
+
### 2. Independence
|
|
249
|
+
- Each epic stands alone — no forward dependencies between epics
|
|
250
|
+
- Epic N should NOT require Epic N+1 to be useful
|
|
251
|
+
- If epics are interdependent, merge them or restructure
|
|
252
|
+
|
|
253
|
+
### 3. User-Outcome Naming
|
|
254
|
+
Epic names describe outcomes:
|
|
255
|
+
- "Users can manage their accounts" not "Account Module"
|
|
256
|
+
- "Team collaboration and sharing" not "Sharing Feature"
|
|
257
|
+
|
|
258
|
+
## Story Design Rules
|
|
259
|
+
|
|
260
|
+
### Format
|
|
261
|
+
\`\`\`
|
|
262
|
+
As a [role], I want [capability], so that [benefit].
|
|
263
|
+
\`\`\`
|
|
264
|
+
|
|
265
|
+
### Acceptance Criteria
|
|
266
|
+
Use Given/When/Then format:
|
|
267
|
+
\`\`\`
|
|
268
|
+
Given [context/precondition],
|
|
269
|
+
When [action/trigger],
|
|
270
|
+
Then [expected outcome].
|
|
271
|
+
\`\`\`
|
|
272
|
+
|
|
273
|
+
Minimum 1 AC per story. Each AC must be independently testable.
|
|
274
|
+
|
|
275
|
+
### Sizing
|
|
276
|
+
- Each story completable in **1 dev session** (single agent invocation)
|
|
277
|
+
- If a story has more than 8 tasks, split it
|
|
278
|
+
- If a story touches more than 5 files, consider splitting
|
|
279
|
+
|
|
280
|
+
### Dependency Rules
|
|
281
|
+
- No forward dependencies between stories within an epic
|
|
282
|
+
- Stories should be implementable in listed order but not REQUIRE that order
|
|
283
|
+
- Exception: Epic 1 Story 1 (setup) must come first if it scaffolds the project
|
|
284
|
+
|
|
285
|
+
### Database Rule
|
|
286
|
+
- DB tables/schemas created ONLY when the story that needs them is implemented
|
|
287
|
+
- Do NOT create all tables upfront in a "database story"
|
|
288
|
+
- Each story creates its own tables as part of implementation
|
|
289
|
+
|
|
290
|
+
### Starter Template Rule
|
|
291
|
+
If the project needs initial scaffolding:
|
|
292
|
+
- Epic 1, Story 1 = "Project Setup"
|
|
293
|
+
- Covers: project init, dependency install, config files, basic structure
|
|
294
|
+
- All subsequent stories build on this foundation
|
|
295
|
+
|
|
296
|
+
## Validation Gates
|
|
297
|
+
|
|
298
|
+
### Gate 1: FR Coverage
|
|
299
|
+
- Every FR from PRD mapped to exactly one epic
|
|
300
|
+
- No orphan FRs, no phantom FRs
|
|
301
|
+
|
|
302
|
+
### Gate 2: Architecture Compliance
|
|
303
|
+
- Stories respect project architecture (from project-context or PRD)
|
|
304
|
+
- No stories that violate stated technical decisions
|
|
305
|
+
|
|
306
|
+
### Gate 3: Story Quality
|
|
307
|
+
- Every story has: user story format, ACs in Given/When/Then, tasks with checkboxes
|
|
308
|
+
- No story exceeds single-session size
|
|
309
|
+
|
|
310
|
+
### Gate 4: Epic Structure
|
|
311
|
+
- Epics organized by user value
|
|
312
|
+
- No technical-layer epics (except setup)
|
|
313
|
+
- No forward dependencies
|
|
314
|
+
`;
|
|
315
|
+
|
|
316
|
+
const TDD_ENGINE = `# TDD Engine — Red-Green-Refactor Rules
|
|
317
|
+
|
|
318
|
+
## Core Cycle
|
|
319
|
+
|
|
320
|
+
### RED — Write Failing Test First
|
|
321
|
+
1. Read the task and its AC reference
|
|
322
|
+
2. Write test(s) that verify the expected behavior
|
|
323
|
+
3. Run tests — they MUST fail (if they pass, the test is wrong or the feature already exists)
|
|
324
|
+
4. If test doesn't fail: re-examine the test, ensure it actually tests new behavior
|
|
325
|
+
|
|
326
|
+
### GREEN — Minimal Implementation
|
|
327
|
+
1. Write the MINIMUM code to make the failing test pass
|
|
328
|
+
2. No extra features, no premature optimization
|
|
329
|
+
3. Run tests — they MUST pass
|
|
330
|
+
4. If tests fail: fix the implementation, not the test (unless the test was wrong)
|
|
331
|
+
|
|
332
|
+
### REFACTOR — Improve While Green
|
|
333
|
+
1. Improve code structure, naming, duplication
|
|
334
|
+
2. Run tests after each refactor step — they MUST stay green
|
|
335
|
+
3. No new behavior in refactor phase
|
|
336
|
+
|
|
337
|
+
## Gate Checklist (5 conditions — ALL required before marking \`[x]\`)
|
|
338
|
+
|
|
339
|
+
- [ ] **Tests exist** — at least one test covers this task's behavior
|
|
340
|
+
- [ ] **Tests pass 100%** — all tests for this task pass
|
|
341
|
+
- [ ] **Implementation matches** — code does exactly what the task describes, no more
|
|
342
|
+
- [ ] **ACs satisfied** — all linked ACs have code evidence
|
|
343
|
+
- [ ] **No regressions** — full test suite passes, not just this task's tests
|
|
344
|
+
|
|
345
|
+
## HALT Conditions
|
|
346
|
+
|
|
347
|
+
### Immediate HALT (ask user):
|
|
348
|
+
- **New dependency needed** — library, service, or API not in Dev Notes
|
|
349
|
+
- **3 consecutive failures** — same test failing after 3 fix attempts
|
|
350
|
+
- **Missing config** — environment variable, API key, or service not available
|
|
351
|
+
- **Ambiguity** — task or AC interpretation unclear
|
|
352
|
+
|
|
353
|
+
### Do NOT halt:
|
|
354
|
+
- Minor warnings that don't affect functionality
|
|
355
|
+
- Style preferences (follow existing patterns)
|
|
356
|
+
- Optional improvements not in task scope
|
|
357
|
+
|
|
358
|
+
## Sprint Status Update Rules
|
|
359
|
+
|
|
360
|
+
### Story Status Transitions
|
|
361
|
+
\`\`\`
|
|
362
|
+
backlog -> ready-for-dev -> in-progress -> review -> done
|
|
363
|
+
^ |
|
|
364
|
+
+--------------+
|
|
365
|
+
(if review finds issues)
|
|
366
|
+
\`\`\`
|
|
367
|
+
|
|
368
|
+
### Epic Status Rules
|
|
369
|
+
- Epic -> \`in-progress\` when its first story moves to \`in-progress\`
|
|
370
|
+
- Epic -> \`done\` when ALL its stories are \`done\`
|
|
371
|
+
|
|
372
|
+
## Review Continuation Protocol
|
|
373
|
+
|
|
374
|
+
When a story returns from review with \`[AI-Review]\` items:
|
|
375
|
+
|
|
376
|
+
1. Story status will be \`in-progress\` (set by aped-r)
|
|
377
|
+
2. Look for items formatted as: \`[AI-Review][Severity] Description [file:line]\`
|
|
378
|
+
3. Address ALL \`[AI-Review]\` items BEFORE continuing with regular tasks
|
|
379
|
+
4. For each item:
|
|
380
|
+
- Read the cited file:line
|
|
381
|
+
- Apply the fix following TDD (write test for the issue, fix, verify)
|
|
382
|
+
- Remove the \`[AI-Review]\` tag once resolved
|
|
383
|
+
|
|
384
|
+
## Writable Sections in Story File
|
|
385
|
+
|
|
386
|
+
Only modify these sections during development:
|
|
387
|
+
- **Tasks**: Mark checkboxes \`[x]\` as tasks complete
|
|
388
|
+
- **Dev Agent Record**: Fill in model, timestamps, debug log, completion notes, file list
|
|
389
|
+
|
|
390
|
+
Do NOT modify: User Story, Acceptance Criteria, Dev Notes (these are the spec).
|
|
391
|
+
|
|
392
|
+
## Definition of Done (25-item checklist)
|
|
393
|
+
|
|
394
|
+
### Code Quality (5)
|
|
395
|
+
- [ ] No commented-out code
|
|
396
|
+
- [ ] No TODO/FIXME without linked issue
|
|
397
|
+
- [ ] Functions < 50 lines
|
|
398
|
+
- [ ] No duplicate logic
|
|
399
|
+
- [ ] Consistent naming conventions
|
|
400
|
+
|
|
401
|
+
### Testing (5)
|
|
402
|
+
- [ ] All new code has tests
|
|
403
|
+
- [ ] Tests are deterministic (no flaky tests)
|
|
404
|
+
- [ ] Edge cases covered
|
|
405
|
+
- [ ] Error paths tested
|
|
406
|
+
- [ ] Full suite passes
|
|
407
|
+
|
|
408
|
+
### Security (5)
|
|
409
|
+
- [ ] Input validation on all user inputs
|
|
410
|
+
- [ ] No hardcoded secrets
|
|
411
|
+
- [ ] Authentication checks where needed
|
|
412
|
+
- [ ] Authorization checks where needed
|
|
413
|
+
- [ ] No SQL/command injection vectors
|
|
414
|
+
|
|
415
|
+
### Documentation (5)
|
|
416
|
+
- [ ] Complex logic has comments
|
|
417
|
+
- [ ] Public APIs documented
|
|
418
|
+
- [ ] Config changes documented
|
|
419
|
+
- [ ] Migration steps documented (if applicable)
|
|
420
|
+
- [ ] Dev Agent Record filled
|
|
421
|
+
|
|
422
|
+
### Integration (5)
|
|
423
|
+
- [ ] No breaking changes to existing APIs
|
|
424
|
+
- [ ] Database migrations are reversible
|
|
425
|
+
- [ ] Environment variables documented
|
|
426
|
+
- [ ] Dependencies are pinned
|
|
427
|
+
- [ ] CI/CD pipeline passes (if applicable)
|
|
428
|
+
`;
|
|
429
|
+
|
|
430
|
+
const REVIEW_CRITERIA = `# Adversarial Review Criteria
|
|
431
|
+
|
|
432
|
+
## Severity Definitions
|
|
433
|
+
|
|
434
|
+
| Severity | Definition | Action |
|
|
435
|
+
|----------|-----------|--------|
|
|
436
|
+
| **CRITICAL** | Task marked done with no code evidence, security vulnerability, data loss risk | Must fix immediately |
|
|
437
|
+
| **HIGH** | AC not implemented, files in story but no changes, broken functionality | Must fix before done |
|
|
438
|
+
| **MEDIUM** | Files changed but not in story list, code quality issues, missing error handling | Fix or document |
|
|
439
|
+
| **LOW** | Minor improvements, style inconsistencies, optional optimizations | Note for future |
|
|
440
|
+
|
|
441
|
+
## Review Protocols
|
|
442
|
+
|
|
443
|
+
### 1. AC Validation Protocol
|
|
444
|
+
|
|
445
|
+
For EACH acceptance criteria in the story:
|
|
446
|
+
|
|
447
|
+
1. Read the AC (Given/When/Then)
|
|
448
|
+
2. Search codebase for implementation evidence
|
|
449
|
+
3. Find the specific file:line that satisfies each part:
|
|
450
|
+
- **Given**: setup/precondition code
|
|
451
|
+
- **When**: trigger/action code
|
|
452
|
+
- **Then**: outcome/assertion code
|
|
453
|
+
4. Rate:
|
|
454
|
+
- **IMPLEMENTED**: clear code evidence for all three parts
|
|
455
|
+
- **PARTIAL**: some parts implemented, others missing
|
|
456
|
+
- **MISSING**: no code evidence found
|
|
457
|
+
|
|
458
|
+
### 2. Task Audit Protocol
|
|
459
|
+
|
|
460
|
+
For EACH task marked \`[x]\` in the story:
|
|
461
|
+
|
|
462
|
+
1. Read the task description
|
|
463
|
+
2. Search for code that fulfills the task
|
|
464
|
+
3. Verify tests exist for the task
|
|
465
|
+
4. Check:
|
|
466
|
+
- Task done + code exists + tests pass = OK
|
|
467
|
+
- Task done + code exists + no tests = MEDIUM
|
|
468
|
+
- Task done + no code evidence = **CRITICAL**
|
|
469
|
+
|
|
470
|
+
### 3. Code Quality Checklist
|
|
471
|
+
|
|
472
|
+
#### Security
|
|
473
|
+
- [ ] All user inputs validated and sanitized
|
|
474
|
+
- [ ] No SQL injection vectors (parameterized queries)
|
|
475
|
+
- [ ] No command injection (no \`eval\`, no unescaped shell commands)
|
|
476
|
+
- [ ] No XSS vectors (output encoding)
|
|
477
|
+
- [ ] Authentication on protected routes
|
|
478
|
+
- [ ] Authorization checks (user can only access own data)
|
|
479
|
+
- [ ] No hardcoded secrets or API keys
|
|
480
|
+
- [ ] HTTPS enforced for sensitive data
|
|
481
|
+
|
|
482
|
+
#### Performance
|
|
483
|
+
- [ ] No N+1 query patterns
|
|
484
|
+
- [ ] Appropriate database indexes
|
|
485
|
+
- [ ] No unnecessary data fetching (select only needed fields)
|
|
486
|
+
- [ ] Caching where appropriate
|
|
487
|
+
- [ ] No blocking operations in hot paths
|
|
488
|
+
- [ ] Pagination for list endpoints
|
|
489
|
+
|
|
490
|
+
#### Reliability
|
|
491
|
+
- [ ] Error handling on all external calls (DB, API, filesystem)
|
|
492
|
+
- [ ] Graceful degradation on failure
|
|
493
|
+
- [ ] No swallowed exceptions (catch without logging/handling)
|
|
494
|
+
- [ ] Null/undefined checks on external data
|
|
495
|
+
- [ ] Timeout handling on network requests
|
|
496
|
+
- [ ] Retry logic where appropriate
|
|
497
|
+
|
|
498
|
+
#### Test Quality
|
|
499
|
+
- [ ] Real assertions (not \`expect(true).toBe(true)\`)
|
|
500
|
+
- [ ] Edge cases tested (empty, null, boundary values)
|
|
501
|
+
- [ ] Error paths tested (not just happy path)
|
|
502
|
+
- [ ] Tests are independent (no shared mutable state)
|
|
503
|
+
- [ ] Test descriptions match what they test
|
|
504
|
+
- [ ] No hardcoded test data that masks bugs
|
|
505
|
+
|
|
506
|
+
## Minimum Findings Floor
|
|
507
|
+
|
|
508
|
+
**3 findings minimum.** If after thorough review you have fewer than 3:
|
|
509
|
+
|
|
510
|
+
Re-examine these areas:
|
|
511
|
+
1. **Edge cases**: What happens with empty inputs? Maximum values? Concurrent access?
|
|
512
|
+
2. **Architecture violations**: Does the code follow the patterns established in project-context?
|
|
513
|
+
3. **Test gaps**: Are there untested code paths? Missing error scenario tests?
|
|
514
|
+
4. **Error handling**: What happens when external services fail? Network timeout? Invalid data?
|
|
515
|
+
5. **Security surface**: Any input that reaches the database without validation?
|
|
516
|
+
|
|
517
|
+
## Fix vs Defer Decision
|
|
518
|
+
|
|
519
|
+
### Fix Immediately (this review cycle)
|
|
520
|
+
- CRITICAL findings — always
|
|
521
|
+
- HIGH findings where fix is straightforward (< 30 min)
|
|
522
|
+
- Security vulnerabilities
|
|
523
|
+
|
|
524
|
+
### Defer to Dev (add [AI-Review] items)
|
|
525
|
+
- HIGH findings requiring significant refactoring
|
|
526
|
+
- Findings that need user input or architectural decisions
|
|
527
|
+
- Issues that might break other stories if fixed now
|
|
528
|
+
|
|
529
|
+
### Format for Deferred Items
|
|
530
|
+
\`\`\`
|
|
531
|
+
[AI-Review][HIGH] Missing input validation on email field [src/auth/register.ts:42]
|
|
532
|
+
[AI-Review][CRITICAL] Task 3 marked done but no test exists [src/api/users.test.ts]
|
|
533
|
+
\`\`\`
|
|
534
|
+
`;
|
|
535
|
+
|
|
536
|
+
// Fallback CSV data (used when data/ directory not available)
|
|
537
|
+
const DOMAIN_COMPLEXITY_CSV = `domain,signals,complexity,key_concerns,required_knowledge,suggested_workflow,web_searches,special_sections
|
|
538
|
+
healthcare,"medical,diagnostic,clinical,FDA,patient,treatment,HIPAA,therapy,pharma,drug",high,"FDA approval;Clinical validation;HIPAA compliance;Patient safety;Medical device classification;Liability","Regulatory pathways;Clinical trial design;Medical standards;Data privacy;Integration requirements","domain-research","FDA software medical device guidance {date};HIPAA compliance software requirements;Medical software standards {date};Clinical validation software","clinical_requirements;regulatory_pathway;validation_methodology;safety_measures"
|
|
539
|
+
fintech,"payment,banking,trading,investment,crypto,wallet,transaction,KYC,AML,funds,fintech",high,"Regional compliance;Security standards;Audit requirements;Fraud prevention;Data protection","KYC/AML requirements;PCI DSS;Open banking;Regional laws (US/EU/APAC);Crypto regulations","domain-research","fintech regulations {date};payment processing compliance {date};open banking API standards;cryptocurrency regulations {date}","compliance_matrix;security_architecture;audit_requirements;fraud_prevention"
|
|
540
|
+
govtech,"government,federal,civic,public sector,citizen,municipal,voting",high,"Procurement rules;Security clearance;Accessibility (508);FedRAMP;Privacy;Transparency","Government procurement;Security frameworks;Accessibility standards;Privacy laws;Open data requirements","domain-research","government software procurement {date};FedRAMP compliance requirements;section 508 accessibility;government security standards","procurement_compliance;security_clearance;accessibility_standards;transparency_requirements"
|
|
541
|
+
edtech,"education,learning,student,teacher,curriculum,assessment,K-12,university,LMS",medium,"Student privacy (COPPA/FERPA);Accessibility;Content moderation;Age verification;Curriculum standards","Educational privacy laws;Learning standards;Accessibility requirements;Content guidelines;Assessment validity","domain-research","educational software privacy {date};COPPA FERPA compliance;WCAG education requirements;learning management standards","privacy_compliance;content_guidelines;accessibility_features;curriculum_alignment"
|
|
542
|
+
general,"",low,"Standard requirements;Basic security;User experience;Performance","General software practices","continue","software development best practices {date}","standard_requirements"`;
|
|
543
|
+
|
|
544
|
+
const PROJECT_TYPES_CSV = `project_type,detection_signals,key_questions,required_sections,skip_sections,web_search_triggers,innovation_signals
|
|
545
|
+
api_backend,"API,REST,GraphQL,backend,service,endpoints","Endpoints needed?;Authentication method?;Data formats?;Rate limits?;Versioning?;SDK needed?","endpoint_specs;auth_model;data_schemas;error_codes;rate_limits;api_docs","ux_ui;visual_design;user_journeys","framework best practices;OpenAPI standards","API composition;New protocol"
|
|
546
|
+
web_app,"website,webapp,browser,SPA,PWA","SPA or MPA?;Browser support?;SEO needed?;Real-time?;Accessibility?","browser_matrix;responsive_design;performance_targets;seo_strategy;accessibility_level","native_features;cli_commands","web standards;WCAG guidelines","New interaction;WebAssembly use"
|
|
547
|
+
mobile_app,"iOS,Android,app,mobile,iPhone,iPad","Native or cross-platform?;Offline needed?;Push notifications?;Device features?;Store compliance?","platform_reqs;device_permissions;offline_mode;push_strategy;store_compliance","desktop_features;cli_commands","app store guidelines;platform requirements","Gesture innovation;AR/VR features"
|
|
548
|
+
saas_b2b,"SaaS,B2B,platform,dashboard,teams,enterprise","Multi-tenant?;Permission model?;Subscription tiers?;Integrations?;Compliance?","tenant_model;rbac_matrix;subscription_tiers;integration_list;compliance_reqs","cli_interface;mobile_first","compliance requirements;integration guides","Workflow automation;AI agents"
|
|
549
|
+
cli_tool,"CLI,command,terminal,bash,script","Interactive or scriptable?;Output formats?;Config method?;Shell completion?","command_structure;output_formats;config_schema;scripting_support","visual_design;ux_principles;touch_interactions","CLI design patterns;shell integration","Natural language CLI;AI commands"`;
|