@iservu-inc/adf-cli 0.11.0 → 0.12.9

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.
Files changed (34) hide show
  1. package/.adf/feature-audit.md +208 -0
  2. package/.adf/final-summary.md +347 -0
  3. package/.adf/implementation-plan.md +244 -0
  4. package/.adf/implementation-progress.md +203 -0
  5. package/.adf/learning/answer-history.json +995 -0
  6. package/.adf/learning/config.json +25 -0
  7. package/.adf/learning/learned-rules.json +59 -0
  8. package/.adf/learning/patterns.json +277 -0
  9. package/.adf/learning/skip-history.json +1451 -0
  10. package/.adf/learning/stats.json +9 -0
  11. package/.claude/settings.local.json +12 -5
  12. package/CHANGELOG.md +110 -0
  13. package/CLAUDE.md +479 -0
  14. package/bin/adf.js +339 -1
  15. package/lib/ai/ai-client.js +161 -44
  16. package/lib/ai/ai-config.js +249 -105
  17. package/lib/commands/deploy.js +73 -6
  18. package/lib/generators/agents-md-generator.js +431 -161
  19. package/lib/generators/antigravity-generator.js +140 -0
  20. package/lib/generators/deepagent-generator.js +144 -0
  21. package/lib/generators/gemini-cli-generator.js +241 -0
  22. package/lib/generators/index.js +55 -0
  23. package/lib/generators/opencode-generator.js +153 -0
  24. package/lib/generators/zed-generator.js +252 -0
  25. package/lib/templates/shared/agents/architect.md +24 -24
  26. package/lib/templates/shared/agents/dev.md +25 -20
  27. package/lib/templates/shared/agents/pm.md +14 -4
  28. package/lib/templates/shared/agents/sm.md +18 -14
  29. package/lib/templates/shared/templates/openspec-delta.md +16 -0
  30. package/lib/templates/shared/templates/openspec-proposal.md +18 -0
  31. package/lib/templates/shared/templates/openspec-tasks.md +21 -0
  32. package/lib/utils/context-manager.js +484 -0
  33. package/package.json +6 -1
  34. package/tests/agents-md-generator.test.js +47 -10
@@ -2,9 +2,10 @@ const ToolConfigGenerator = require('./tool-config-generator');
2
2
 
3
3
  /**
4
4
  * Generator for AGENTS.md - Universal AI coding agent instructions
5
- * Supported by: OpenAI Codex, Cursor, Windsurf, Google Jules, Factory, and more
5
+ * Supported by: OpenAI Codex, Cursor, Windsurf, Google Jules, Factory, Zed, Antigravity, and more
6
6
  *
7
7
  * AGENTS.md is the industry standard open format for AI agent configuration
8
+ * Follows the Agent-Native Development Framework (ANDF) specification
8
9
  * See: https://agents.md/ and https://github.com/openai/agents.md
9
10
  */
10
11
  class AgentsMdGenerator extends ToolConfigGenerator {
@@ -14,6 +15,10 @@ class AgentsMdGenerator extends ToolConfigGenerator {
14
15
  async generate() {
15
16
  await this.initialize();
16
17
 
18
+ // Generate YAML frontmatter
19
+ const frontmatter = this.generateFrontmatter();
20
+
21
+ // Generate content based on framework
17
22
  let content;
18
23
  if (this.framework === 'rapid') {
19
24
  content = this.generateFromPRP();
@@ -25,90 +30,245 @@ class AgentsMdGenerator extends ToolConfigGenerator {
25
30
  throw new Error(`Unknown framework: ${this.framework}`);
26
31
  }
27
32
 
28
- const filePath = await this.writeToProject('AGENTS.md', content);
33
+ // Combine frontmatter and content
34
+ const fullContent = `${frontmatter}\n${content}`;
35
+
36
+ const filePath = await this.writeToProject('AGENTS.md', fullContent);
29
37
  return filePath;
30
38
  }
31
39
 
32
40
  /**
33
- * Generate AGENTS.md from PRP framework
41
+ * Generate YAML frontmatter with agent metadata and MCP tools
42
+ * Follows ANDF specification
34
43
  */
35
- generateFromPRP() {
44
+ generateFrontmatter() {
45
+ const agentName = this.getAgentName();
46
+ const description = this.getAgentDescription();
47
+ const tools = this.getMCPTools();
48
+
49
+ const frontmatter = `---
50
+ name: ${agentName}
51
+ description: ${description}
52
+ tools:${tools.map(tool => `
53
+ - name: ${tool.name}
54
+ ${tool.url ? `url: ${tool.url}` : `command: ${tool.command}`}${tool.args ? `
55
+ args: ${JSON.stringify(tool.args)}` : ''}${tool.description ? `
56
+ description: ${tool.description}` : ''}`).join('')}
57
+ ---`;
58
+
59
+ return frontmatter;
60
+ }
61
+
62
+ /**
63
+ * Get agent name based on framework and project
64
+ */
65
+ getAgentName() {
36
66
  const projectName = this.getProjectName();
37
- const sections = this.outputs.sections || {};
38
67
 
39
- return `# ${projectName}
68
+ // Map framework to agent role
69
+ const roleMap = {
70
+ 'rapid': 'Developer',
71
+ 'balanced': 'Project Architect',
72
+ 'comprehensive': 'Solutions Architect'
73
+ };
40
74
 
41
- ## Overview
75
+ const role = roleMap[this.framework] || 'Developer';
76
+ return `${projectName} ${role}`;
77
+ }
42
78
 
43
- ${sections['1._goal_definition'] || sections['goal_definition'] || 'AI-powered software development project'}
79
+ /**
80
+ * Get agent description based on framework and tech stack
81
+ */
82
+ getAgentDescription() {
83
+ const techStack = this.extractTechStackForDescription();
44
84
 
45
- ## Tech Stack
85
+ const roleDescriptions = {
86
+ 'rapid': `Expert developer specializing in ${techStack}`,
87
+ 'balanced': `Full-stack architect with expertise in ${techStack}`,
88
+ 'comprehensive': `Enterprise solutions architect specializing in ${techStack}`
89
+ };
46
90
 
47
- ${this.extractTechStack(sections)}
91
+ return roleDescriptions[this.framework] || `Software development expert in ${techStack}`;
92
+ }
48
93
 
49
- ## Build Commands
94
+ /**
95
+ * Extract tech stack for description
96
+ */
97
+ extractTechStackForDescription() {
98
+ // Try to extract from metadata
99
+ if (this.metadata && this.metadata.techStack) {
100
+ return this.metadata.techStack;
101
+ }
102
+
103
+ // Try to extract from outputs based on framework
104
+ if (this.framework === 'rapid' && this.outputs.sections) {
105
+ const sections = this.outputs.sections;
106
+ const contextSection = sections['3._contextual_intelligence'] || sections['contextual_intelligence'] || '';
107
+
108
+ // Look for common tech stack patterns
109
+ const techPatterns = [
110
+ /(?:using|built with|tech stack|technologies):\s*([^\n]+)/i,
111
+ /(?:react|vue|angular|next|svelte|node|express|django|rails|spring)/gi
112
+ ];
113
+
114
+ for (const pattern of techPatterns) {
115
+ const match = contextSection.match(pattern);
116
+ if (match) {
117
+ return match[1] || match[0];
118
+ }
119
+ }
120
+ }
121
+
122
+ return 'modern web technologies';
123
+ }
50
124
 
125
+ /**
126
+ * Get MCP tools configuration
127
+ * Returns array of tool configurations for various MCP servers
128
+ */
129
+ getMCPTools() {
130
+ const tools = [
131
+ {
132
+ name: 'project_context',
133
+ command: 'npx',
134
+ args: ['@modelcontextprotocol/server-filesystem', '.context'],
135
+ description: 'Access project context files (architecture, glossary, memory)'
136
+ }
137
+ ];
138
+
139
+ // Add Archon if configured in environment or metadata
140
+ const archonUrl = process.env.ARCHON_MCP_URL || this.metadata?.archonUrl;
141
+ if (archonUrl) {
142
+ tools.unshift({
143
+ name: 'archon',
144
+ url: archonUrl,
145
+ description: 'Internal API documentation and RAG system'
146
+ });
147
+ }
148
+
149
+ return tools;
150
+ }
151
+
152
+ /**
153
+ * Generate AGENTS.md from PRP framework (ANDF-compliant)
154
+ */
155
+ generateFromPRP() {
156
+ const projectName = this.getProjectName();
157
+ const sections = this.outputs.sections || {};
158
+ const sessionId = this.getSessionId();
159
+
160
+ return `
161
+ # AGENTS.md - The Agent Manifest
162
+
163
+ ## 1. Operational Rules (High Priority)
164
+
165
+ - **Source of Truth**: Before answering, consult \`.context/memory/architecture.md\` for system design
166
+ - **Read Context First**: Review \`.adf/sessions/${sessionId}/outputs/prp.md\` for complete requirements
167
+ - **Security**: Never output \`.env\` secrets or API keys in code or logs
168
+ - **Testing**: All code changes must pass the test suite before committing
169
+ - **Follow Blueprint**: Implement features exactly as specified in the Implementation Blueprint
170
+ - **Validate Success**: Verify against Success Criteria before marking tasks complete
171
+
172
+ ## 2. Build & Test Commands
173
+
174
+ ### Installation
51
175
  \`\`\`bash
52
176
  # Install dependencies
53
177
  npm install
178
+ \`\`\`
54
179
 
180
+ ### Development
181
+ \`\`\`bash
55
182
  # Build project
56
183
  npm run build
57
- \`\`\`
58
184
 
59
- ## Test Commands
185
+ # Run in development mode (if applicable)
186
+ npm run dev
187
+ \`\`\`
60
188
 
189
+ ### Testing
61
190
  \`\`\`bash
62
191
  # Run tests
63
192
  npm test
64
193
 
65
194
  # Run tests with coverage
66
195
  npm run test:coverage
67
- \`\`\`
68
-
69
- ## Implementation Blueprint
70
196
 
71
- ${sections['4._implementation_blueprint'] || sections['implementation_blueprint'] || ''}
197
+ # Run linter
198
+ npm run lint
199
+ \`\`\`
72
200
 
73
- ## Success Criteria
201
+ ## 3. Project Structure
74
202
 
75
- ${sections['5._validation'] || sections['validation'] || ''}
203
+ - \`/.adf/\`: Framework data (sessions, learning, configuration) - DO NOT MODIFY
204
+ - \`/.context/\`: Agent-accessible deep context
205
+ - \`/memory/architecture.md\`: System architecture and technical design
206
+ - \`/memory/glossary.md\`: Domain-specific terminology
207
+ - \`/src/\`: Application source code
208
+ - \`/tests/\`: Test files
76
209
 
77
- ## Development Workflow
210
+ ## 4. Workflow Directives
78
211
 
79
- 1. Review the goal and requirements
212
+ ### Development Process
213
+ 1. Review the goal definition and requirements
80
214
  2. Check the implementation blueprint
81
- 3. Write tests first (if applicable)
82
- 4. Implement feature following the blueprint
215
+ 3. Write tests first (TDD approach when applicable)
216
+ 4. Implement feature following the blueprint exactly
83
217
  5. Verify against success criteria
84
- 6. Test thoroughly before committing
218
+ 6. Run full test suite
219
+ 7. Review code quality and documentation
220
+
221
+ ### Code Standards
222
+ - **Commits**: Use Conventional Commits format (e.g., \`feat: add user auth\`)
223
+ - **Refactoring**: Prioritize readability and maintainability over brevity
224
+ - **Documentation**: Add comments for complex logic, update README when needed
225
+ - **Error Handling**: Handle errors gracefully with descriptive messages
226
+
227
+ ## 5. Project Context
228
+
229
+ ### Goal Definition
230
+ ${sections['1._goal_definition'] || sections['goal_definition'] || 'AI-powered software development project'}
231
+
232
+ ### Tech Stack
233
+ ${this.extractTechStack(sections)}
85
234
 
86
- ## Key Context
235
+ ### Implementation Blueprint
236
+ ${sections['4._implementation_blueprint'] || sections['implementation_blueprint'] || 'See PRP document for implementation details'}
87
237
 
88
- All project requirements and context are documented in:
89
- - Framework outputs: \`.adf/sessions/${this.getSessionId()}/outputs/\`
90
- - Q&A responses: \`.adf/sessions/${this.getSessionId()}/qa-responses/\`
238
+ ### Success Criteria
239
+ ${sections['5._validation'] || sections['validation'] || 'See PRP document for validation criteria'}
91
240
 
92
- ## AI Agent Instructions
241
+ ## 6. Key Context Files
93
242
 
94
- When working on this project:
95
- 1. **Read the full context** in \`.adf/sessions/${this.getSessionId()}/outputs/prp.md\`
96
- 2. **Follow the implementation blueprint** exactly as specified
97
- 3. **Validate against success criteria** before marking tasks complete
98
- 4. **Ask clarifying questions** if requirements are unclear
99
- 5. **Maintain consistency** with the tech stack and architecture
243
+ - **PRP Document**: \`.adf/sessions/${sessionId}/outputs/prp.md\` - Complete requirements
244
+ - **Architecture**: \`.context/memory/architecture.md\` - System design (reference this first!)
245
+ - **Q&A Responses**: \`.adf/sessions/${sessionId}/qa-responses/\` - Detailed interview responses
246
+
247
+ ## 7. AI Agent Instructions
248
+
249
+ When working on this project, you MUST:
250
+
251
+ 1. **Read architecture first** - Consult \`.context/memory/architecture.md\` before making changes
252
+ 2. **Follow the blueprint** - Implement exactly as specified, don't deviate
253
+ 3. **Validate continuously** - Check against success criteria throughout development
254
+ 4. **Ask before changing** - If requirements are unclear or architecture changes needed, ask first
255
+ 5. **Maintain consistency** - With established tech stack, patterns, and conventions
256
+ 6. **Test thoroughly** - All changes must pass tests before committing
257
+ 7. **Never compromise security** - Follow security best practices, no secrets in code
100
258
 
101
259
  ---
102
260
 
103
261
  *Generated by [ADF CLI](https://www.npmjs.com/package/@iservu-inc/adf-cli) v${this.getADFVersion()}*
262
+ *Framework: Rapid Development (PRP) | Session: ${sessionId}*
104
263
  `;
105
264
  }
106
265
 
107
266
  /**
108
- * Generate AGENTS.md from Balanced framework
267
+ * Generate AGENTS.md from Balanced framework (ANDF-compliant)
109
268
  */
110
269
  generateFromBalanced() {
111
270
  const projectName = this.getProjectName();
271
+ const sessionId = this.getSessionId();
112
272
  const constitution = this.outputs.constitution || '';
113
273
  const specification = this.outputs.specification || '';
114
274
  const plan = this.outputs.plan || '';
@@ -118,47 +278,42 @@ When working on this project:
118
278
  const architecture = this.extractSection(specification, 'Architecture');
119
279
  const techStack = this.extractSection(plan, 'Technology Stack');
120
280
 
121
- return `# ${projectName}
122
-
123
- ## Overview
124
-
125
- ${this.extractSection(specification, 'Overview') || this.extractSection(specification, 'Purpose')}
126
-
127
- ## Constitution
128
-
129
- ### Core Principles
130
-
131
- ${principles || 'Follow best practices for software development'}
132
-
133
- ### Constraints
134
-
135
- ${constraints || 'No specific constraints defined'}
136
-
137
- ## Tech Stack
138
-
139
- ${techStack || 'See technical plan for details'}
281
+ return `
282
+ # AGENTS.md - The Agent Manifest
140
283
 
141
- ## Architecture
284
+ ## 1. Operational Rules (High Priority)
142
285
 
143
- ${architecture || 'See specification.md for complete architecture'}
286
+ - **Source of Truth**: Consult \`.context/memory/architecture.md\` for system design decisions
287
+ - **Read Constitution First**: Review \`.adf/sessions/${sessionId}/outputs/constitution.md\` for principles
288
+ - **Security**: Never output \`.env\` secrets or API keys in code or logs
289
+ - **Testing**: All code changes must pass the test suite before committing
290
+ - **Follow Spec**: Implement according to specification.md requirements exactly
291
+ - **Respect Constraints**: The constraints in constitution.md are NON-NEGOTIABLE
292
+ - **Architecture First**: Never deviate from architectural patterns without approval
144
293
 
145
- ## Build Commands
294
+ ## 2. Build & Test Commands
146
295
 
296
+ ### Installation
147
297
  \`\`\`bash
148
298
  # Install dependencies
149
299
  npm install
300
+ \`\`\`
150
301
 
302
+ ### Development
303
+ \`\`\`bash
151
304
  # Build project
152
305
  npm run build
153
306
 
154
307
  # Run in development mode
155
308
  npm run dev
156
- \`\`\`
157
309
 
158
- ## Test Commands
310
+ # Watch for changes
311
+ npm run watch
312
+ \`\`\`
159
313
 
314
+ ### Testing
160
315
  \`\`\`bash
161
- # Run tests
316
+ # Run all tests
162
317
  npm test
163
318
 
164
319
  # Run tests with coverage
@@ -166,58 +321,95 @@ npm run test:coverage
166
321
 
167
322
  # Run linter
168
323
  npm run lint
169
- \`\`\`
170
324
 
171
- ## Development Workflow
325
+ # Run type checking (if applicable)
326
+ npm run type-check
327
+ \`\`\`
172
328
 
173
- 1. Review the constitution and principles
174
- 2. Check the specification for requirements
175
- 3. Consult the technical plan for architecture decisions
176
- 4. Review tasks.md for implementation breakdown
177
- 5. Write tests first (TDD approach)
178
- 6. Implement following architecture patterns
329
+ ## 3. Project Structure
330
+
331
+ - \`/.adf/\`: Framework data (sessions, learning, configuration) - DO NOT MODIFY
332
+ - \`/.context/\`: Agent-accessible deep context
333
+ - \`/memory/architecture.md\`: Complete system architecture and design decisions
334
+ - \`/memory/glossary.md\`: Domain-specific terminology and definitions
335
+ - \`/src/\`: Application source code
336
+ - \`/tests/\`: Test files and test utilities
337
+ - \`/docs/\`: Additional documentation
338
+
339
+ ## 4. Workflow Directives
340
+
341
+ ### Development Process
342
+ 1. Review the constitution - understand principles and constraints
343
+ 2. Study the specification - know detailed requirements
344
+ 3. Consult the technical plan - understand architecture and tech stack
345
+ 4. Review tasks.md - understand implementation breakdown
346
+ 5. Write tests first (strict TDD approach)
347
+ 6. Implement following established architecture patterns
179
348
  7. Verify against acceptance criteria
180
- 8. Run tests and linter before committing
349
+ 8. Run full test suite and linter
350
+ 9. Review code quality and documentation
351
+
352
+ ### Code Standards
353
+ - **Commits**: Use Conventional Commits format (e.g., \`feat: add user auth\`)
354
+ - **Refactoring**: Prioritize readability and maintainability
355
+ - **Documentation**: Comprehensive comments for complex logic
356
+ - **Error Handling**: Graceful error handling with descriptive messages
357
+ - **Type Safety**: Use TypeScript or JSDoc for type annotations (if applicable)
358
+
359
+ ### Architecture Patterns
360
+ ${architecture ? `\n${architecture}\n` : 'See specification.md and .context/memory/architecture.md for detailed patterns'}
361
+
362
+ ## 5. Constitution & Constraints
363
+
364
+ ### Core Principles
365
+ ${principles || 'Follow best practices for software development'}
366
+
367
+ ### Constraints (NON-NEGOTIABLE)
368
+ ${constraints || 'No specific constraints defined - follow general best practices'}
181
369
 
182
- ## Code Style
370
+ ## 6. Technical Overview
183
371
 
184
- See technical plan for detailed coding standards.
372
+ ### Tech Stack
373
+ ${techStack || 'See technical plan for complete technology stack details'}
185
374
 
186
- **Key Points:**
187
- - Follow the architecture patterns defined in specification.md
188
- - Adhere to the constraints in constitution.md
189
- - Implement tasks as outlined in tasks.md
375
+ ### System Architecture
376
+ ${this.extractSection(specification, 'Overview') || this.extractSection(specification, 'Purpose') || 'See specification.md for complete system overview'}
190
377
 
191
- ## Key Context Files
378
+ ## 7. Key Context Files
192
379
 
193
- - **Constitution**: \`.adf/sessions/${this.getSessionId()}/outputs/constitution.md\` - Principles and constraints
194
- - **Specification**: \`.adf/sessions/${this.getSessionId()}/outputs/specification.md\` - Detailed requirements
195
- - **Technical Plan**: \`.adf/sessions/${this.getSessionId()}/outputs/plan.md\` - Architecture and decisions
196
- - **Tasks**: \`.adf/sessions/${this.getSessionId()}/outputs/tasks.md\` - Implementation breakdown
380
+ - **Constitution**: \`.adf/sessions/${sessionId}/outputs/constitution.md\` - Principles and constraints (read first!)
381
+ - **Specification**: \`.adf/sessions/${sessionId}/outputs/specification.md\` - Detailed requirements and design
382
+ - **Technical Plan**: \`.adf/sessions/${sessionId}/outputs/plan.md\` - Architecture decisions and tech stack
383
+ - **Tasks**: \`.adf/sessions/${sessionId}/outputs/tasks.md\` - Implementation breakdown and phases
384
+ - **Architecture**: \`.context/memory/architecture.md\` - Complete system design (reference this!)
197
385
 
198
- ## AI Agent Instructions
386
+ ## 8. AI Agent Instructions
199
387
 
200
- When working on this project:
388
+ When working on this project, you MUST:
201
389
 
202
- 1. **Read the constitution first** - Understand principles and constraints
203
- 2. **Review the specification** - Know what needs to be built
204
- 3. **Check the technical plan** - Follow architectural decisions
205
- 4. **Reference tasks.md** - Understand implementation phases
206
- 5. **Never violate constraints** - These are non-negotiable
207
- 6. **Ask before deviating** - If architecture changes are needed
208
- 7. **Maintain consistency** - With established patterns and decisions
390
+ 1. **Read constitution FIRST** - Understand principles and constraints before any code
391
+ 2. **Never violate constraints** - Constraints are non-negotiable, NO EXCEPTIONS
392
+ 3. **Follow architecture** - Stick to patterns defined in specification and architecture docs
393
+ 4. **Consult technical plan** - All tech decisions should align with the plan
394
+ 5. **Reference tasks.md** - Understand the implementation phases and current priorities
395
+ 6. **Ask before deviating** - If requirements conflict or architecture needs changes, ASK
396
+ 7. **Maintain consistency** - With established patterns, conventions, and decisions
397
+ 8. **Test thoroughly** - TDD approach, all tests must pass
398
+ 9. **Document decisions** - Update docs when making significant choices
209
399
 
210
400
  ---
211
401
 
212
402
  *Generated by [ADF CLI](https://www.npmjs.com/package/@iservu-inc/adf-cli) v${this.getADFVersion()}*
403
+ *Framework: Balanced (Specification-Driven) | Session: ${sessionId}*
213
404
  `;
214
405
  }
215
406
 
216
407
  /**
217
- * Generate AGENTS.md from BMAD framework
408
+ * Generate AGENTS.md from BMAD framework (ANDF-compliant)
218
409
  */
219
410
  generateFromBMAD() {
220
411
  const projectName = this.getProjectName();
412
+ const sessionId = this.getSessionId();
221
413
  const prd = this.outputs.prd || '';
222
414
  const architecture = this.outputs.architecture || '';
223
415
 
@@ -229,42 +421,50 @@ When working on this project:
229
421
  const archOverview = this.extractSection(architecture, 'System Overview') ||
230
422
  this.extractSection(architecture, 'Architecture Overview');
231
423
 
232
- return `# ${projectName}
233
-
234
- ## Product Overview
235
-
236
- ${overview || 'Comprehensive software development project'}
237
-
238
- ## Goals and Objectives
239
-
240
- ${goals || 'See PRD for detailed goals'}
241
-
242
- ## Technical Requirements
424
+ return `
425
+ # AGENTS.md - The Agent Manifest
243
426
 
244
- ${techRequirements || 'See PRD for complete technical requirements'}
427
+ ## 1. Operational Rules (High Priority)
245
428
 
246
- ## Architecture
429
+ - **Source of Truth**: Consult \`.context/memory/architecture.md\` for complete system design
430
+ - **Read PRD First**: Review \`.adf/sessions/${sessionId}/outputs/prd.md\` for product vision
431
+ - **Security**: Never output \`.env\` secrets, API keys, or sensitive data in code or logs
432
+ - **Testing**: All code changes must pass unit, integration, and e2e tests before committing
433
+ - **Follow Architecture**: Strictly adhere to architectural patterns defined in architecture.md
434
+ - **User Stories**: Implement exactly as specified in stories.md with acceptance criteria
435
+ - **Quality Standards**: Maintain >= 80% test coverage for all new code
436
+ - **Performance First**: Consider scalability, performance, and resource usage in all decisions
247
437
 
248
- ${archOverview || 'See architecture.md for complete system design'}
249
-
250
- ## Build Commands
438
+ ## 2. Build & Test Commands
251
439
 
440
+ ### Installation
252
441
  \`\`\`bash
253
442
  # Install dependencies
254
443
  npm install
255
444
 
445
+ # Install development tools
446
+ npm run install:dev
447
+ \`\`\`
448
+
449
+ ### Development
450
+ \`\`\`bash
256
451
  # Build project
257
452
  npm run build
258
453
 
259
454
  # Run in development mode
260
455
  npm run dev
261
456
 
262
- # Run production build
457
+ # Run in production mode
458
+ npm run start
459
+
460
+ # Build for production
263
461
  npm run build:production
264
- \`\`\`
265
462
 
266
- ## Test Commands
463
+ # Watch for changes
464
+ npm run watch
465
+ \`\`\`
267
466
 
467
+ ### Testing
268
468
  \`\`\`bash
269
469
  # Run all tests
270
470
  npm test
@@ -272,74 +472,144 @@ npm test
272
472
  # Run tests with coverage
273
473
  npm run test:coverage
274
474
 
475
+ # Run unit tests only
476
+ npm run test:unit
477
+
275
478
  # Run integration tests
276
479
  npm run test:integration
277
480
 
278
- # Run e2e tests
481
+ # Run end-to-end tests
279
482
  npm run test:e2e
280
483
 
281
484
  # Run linter
282
485
  npm run lint
283
- \`\`\`
284
-
285
- ## Development Workflow
286
-
287
- 1. Review the PRD (Product Requirements Document)
288
- 2. Understand the system architecture
289
- 3. Review relevant user stories
290
- 4. Plan implementation approach
291
- 5. Write tests first (TDD)
292
- 6. Implement following architecture patterns
293
- 7. Verify against acceptance criteria
294
- 8. Run full test suite
295
- 9. Create pull request with description
296
-
297
- ## Code Quality Standards
298
-
299
- - Maintain test coverage >= 80%
300
- - Follow architectural patterns defined in architecture.md
301
- - Implement user stories as specified in stories.md
302
- - Write clean, maintainable, documented code
303
- - Handle errors gracefully
304
- - Consider scalability and performance
305
486
 
306
- ## Key Context Files
487
+ # Run type checking
488
+ npm run type-check
307
489
 
308
- - **PRD**: \`.adf/sessions/${this.getSessionId()}/outputs/prd.md\` - Complete product requirements
309
- - **Architecture**: \`.adf/sessions/${this.getSessionId()}/outputs/architecture.md\` - System design and technical architecture
310
- - **User Stories**: \`.adf/sessions/${this.getSessionId()}/outputs/stories.md\` - Detailed user stories with acceptance criteria
311
-
312
- ## AI Agent Instructions
313
-
314
- When working on this project:
315
-
316
- 1. **Read the PRD thoroughly** - Understand the complete product vision
317
- 2. **Study the architecture** - Know the system design and component structure
318
- 3. **Review user stories** - Understand user needs and acceptance criteria
319
- 4. **Follow architectural patterns** - Maintain consistency with established design
320
- 5. **Implement with quality** - Tests, documentation, error handling
321
- 6. **Think long-term** - Consider scalability, maintainability, performance
322
- 7. **Validate against requirements** - Ensure implementation matches PRD
323
- 8. **Ask before major changes** - Architectural decisions should be discussed
490
+ # Run full CI suite
491
+ npm run ci
492
+ \`\`\`
324
493
 
325
- ## Security Notes
494
+ ### Quality Checks
495
+ \`\`\`bash
496
+ # Run security audit
497
+ npm audit
326
498
 
327
- - Never commit sensitive data (API keys, passwords, tokens)
328
- - Use environment variables for configuration
329
- - Validate all user input
330
- - Follow security best practices
331
- - See PRD for specific security requirements
499
+ # Check for outdated dependencies
500
+ npm outdated
332
501
 
333
- ## Performance Considerations
502
+ # Run performance benchmarks (if applicable)
503
+ npm run benchmark
504
+ \`\`\`
334
505
 
335
- - Follow performance requirements in PRD
336
- - Optimize critical paths
337
- - Monitor resource usage
338
- - See architecture.md for performance patterns
506
+ ## 3. Project Structure
507
+
508
+ - \`/.adf/\`: Framework data (sessions, learning, configuration) - DO NOT MODIFY
509
+ - \`/.context/\`: Agent-accessible deep context
510
+ - \`/memory/architecture.md\`: Complete enterprise architecture and design decisions
511
+ - \`/memory/glossary.md\`: Domain-specific terminology and business definitions
512
+ - \`/src/\`: Application source code
513
+ - \`/tests/\`: Comprehensive test suite
514
+ - \`/unit/\`: Unit tests
515
+ - \`/integration/\`: Integration tests
516
+ - \`/e2e/\`: End-to-end tests
517
+ - \`/docs/\`: Documentation (API docs, architecture diagrams, guides)
518
+ - \`/scripts/\`: Build and deployment scripts
519
+
520
+ ## 4. Workflow Directives
521
+
522
+ ### Development Process (Enterprise-Grade)
523
+ 1. Review the PRD - understand complete product vision and business requirements
524
+ 2. Study the architecture document - know system design, components, and data flow
525
+ 3. Review relevant user stories - understand user needs and acceptance criteria
526
+ 4. Plan implementation approach - design before coding
527
+ 5. Write tests FIRST (strict TDD approach)
528
+ - Unit tests for business logic
529
+ - Integration tests for component interaction
530
+ - E2E tests for user workflows
531
+ 6. Implement following established architecture patterns exactly
532
+ 7. Verify against acceptance criteria continuously
533
+ 8. Run full test suite (unit + integration + e2e)
534
+ 9. Run linter, type checker, and security audit
535
+ 10. Review code quality and performance
536
+ 11. Create pull request with comprehensive description
537
+ 12. Request code review from team
538
+
539
+ ### Code Standards (Enterprise-Grade)
540
+ - **Commits**: Use Conventional Commits format with scope (e.g., \`feat(auth): add OAuth support\`)
541
+ - **Refactoring**: Prioritize readability, maintainability, and performance
542
+ - **Documentation**: Comprehensive JSDoc/TSDoc for all public APIs
543
+ - **Error Handling**: Graceful error handling with structured logging
544
+ - **Type Safety**: Full TypeScript types or comprehensive JSDoc type annotations
545
+ - **Code Coverage**: Maintain >= 80% coverage, >= 90% for critical paths
546
+ - **Performance**: Profile before optimizing, benchmark critical operations
547
+
548
+ ### Architecture Patterns (Enterprise)
549
+ ${archOverview ? `\n${archOverview}\n` : 'See architecture.md and .context/memory/architecture.md for comprehensive patterns'}
550
+
551
+ ## 5. Product Vision & Requirements
552
+
553
+ ### Product Overview
554
+ ${overview || 'Comprehensive enterprise software development project'}
555
+
556
+ ### Goals and Objectives
557
+ ${goals || 'See PRD for detailed business goals and success metrics'}
558
+
559
+ ### Technical Requirements
560
+ ${techRequirements || 'See PRD for complete technical requirements and constraints'}
561
+
562
+ ## 6. Quality Standards
563
+
564
+ ### Test Coverage Requirements
565
+ - **Unit Tests**: >= 80% coverage for all business logic
566
+ - **Integration Tests**: All component interfaces and APIs
567
+ - **E2E Tests**: All critical user workflows and happy paths
568
+ - **Security**: OWASP Top 10 compliance, regular security audits
569
+
570
+ ### Performance Standards
571
+ - Follow performance requirements defined in PRD
572
+ - Optimize critical paths (database queries, API calls, rendering)
573
+ - Monitor resource usage (memory, CPU, network)
574
+ - See architecture.md for specific performance patterns and benchmarks
575
+
576
+ ### Security Standards
577
+ - Never commit sensitive data (API keys, passwords, tokens, credentials)
578
+ - Use environment variables for all configuration
579
+ - Validate and sanitize all user input
580
+ - Implement proper authentication and authorization
581
+ - Follow security best practices (HTTPS, CORS, CSP, etc.)
582
+ - See PRD for specific security requirements and compliance needs
583
+
584
+ ## 7. Key Context Files
585
+
586
+ - **PRD**: \`.adf/sessions/${sessionId}/outputs/prd.md\` - Complete product requirements (read first!)
587
+ - **Architecture**: \`.adf/sessions/${sessionId}/outputs/architecture.md\` - System design and technical architecture
588
+ - **User Stories**: \`.adf/sessions/${sessionId}/outputs/stories.md\` - Detailed user stories with acceptance criteria
589
+ - **Architecture Memory**: \`.context/memory/architecture.md\` - Complete enterprise architecture (reference this!)
590
+ - **Glossary**: \`.context/memory/glossary.md\` - Business and technical terminology
591
+
592
+ ## 8. AI Agent Instructions
593
+
594
+ When working on this project, you MUST:
595
+
596
+ 1. **Read PRD thoroughly FIRST** - Understand complete product vision and business context
597
+ 2. **Study architecture deeply** - Know system design, component structure, and data flow
598
+ 3. **Review user stories** - Understand user needs and acceptance criteria before coding
599
+ 4. **Follow architecture religiously** - Maintain consistency with established enterprise patterns
600
+ 5. **Think long-term** - Consider scalability, maintainability, performance, and extensibility
601
+ 6. **Implement with quality** - Comprehensive tests, documentation, error handling, logging
602
+ 7. **Validate continuously** - Ensure implementation matches PRD and user stories
603
+ 8. **Ask before major changes** - Architectural decisions and pattern changes require discussion
604
+ 9. **Never compromise security** - Security is non-negotiable, follow all best practices
605
+ 10. **Test thoroughly** - Unit + integration + e2e tests, all must pass
606
+ 11. **Document comprehensively** - Code comments, API docs, architecture decisions
607
+ 12. **Monitor performance** - Profile, benchmark, and optimize critical paths
339
608
 
340
609
  ---
341
610
 
342
611
  *Generated by [ADF CLI](https://www.npmjs.com/package/@iservu-inc/adf-cli) v${this.getADFVersion()}*
612
+ *Framework: BMAD Comprehensive (Enterprise) | Session: ${sessionId}*
343
613
  `;
344
614
  }
345
615