@iservu-inc/adf-cli 0.1.6 → 0.3.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.
Files changed (31) hide show
  1. package/.project/chats/complete/2025-10-03_ADF-CLI-QUALITY-BASED-PROGRESS-AND-RESUME.md +399 -0
  2. package/.project/chats/current/2025-10-03_AGENTS-MD-AND-TOOL-GENERATORS.md +699 -0
  3. package/.project/docs/architecture/SYSTEM-DESIGN.md +369 -0
  4. package/.project/docs/frameworks/FRAMEWORK-METHODOLOGIES.md +449 -0
  5. package/.project/docs/goals/PROJECT-VISION.md +112 -0
  6. package/.project/docs/tool-integrations/IDE-CUSTOMIZATIONS.md +578 -0
  7. package/.project/docs/tool-integrations/RESEARCH-FINDINGS.md +828 -0
  8. package/CHANGELOG.md +292 -0
  9. package/jest.config.js +20 -0
  10. package/lib/commands/deploy.js +122 -3
  11. package/lib/commands/init.js +41 -113
  12. package/lib/frameworks/answer-quality-analyzer.js +216 -0
  13. package/lib/frameworks/interviewer.js +447 -0
  14. package/lib/frameworks/output-generators.js +345 -0
  15. package/lib/frameworks/progress-tracker.js +239 -0
  16. package/lib/frameworks/questions.js +664 -0
  17. package/lib/frameworks/session-manager.js +100 -0
  18. package/lib/generators/agents-md-generator.js +388 -0
  19. package/lib/generators/cursor-generator.js +374 -0
  20. package/lib/generators/index.js +98 -0
  21. package/lib/generators/tool-config-generator.js +188 -0
  22. package/lib/generators/vscode-generator.js +403 -0
  23. package/lib/generators/windsurf-generator.js +596 -0
  24. package/package.json +10 -5
  25. package/tests/agents-md-generator.test.js +245 -0
  26. package/tests/answer-quality-analyzer.test.js +173 -0
  27. package/tests/cursor-generator.test.js +326 -0
  28. package/tests/progress-tracker.test.js +205 -0
  29. package/tests/session-manager.test.js +162 -0
  30. package/tests/vscode-generator.test.js +436 -0
  31. package/tests/windsurf-generator.test.js +320 -0
@@ -0,0 +1,403 @@
1
+ const ToolConfigGenerator = require('./tool-config-generator');
2
+ const fs = require('fs-extra');
3
+ const path = require('path');
4
+
5
+ /**
6
+ * Generator for VS Code configuration files
7
+ * Creates .github/copilot-instructions.md and .vscode/settings.json
8
+ *
9
+ * Supports:
10
+ * - GitHub Copilot instructions
11
+ * - Custom chat modes
12
+ * - Language Model API integration
13
+ */
14
+ class VSCodeGenerator extends ToolConfigGenerator {
15
+ /**
16
+ * Generate all VS Code configuration files
17
+ */
18
+ async generate() {
19
+ await this.initialize();
20
+
21
+ const generated = {
22
+ copilot: [],
23
+ vscode: []
24
+ };
25
+
26
+ // Generate .github/copilot-instructions.md (GitHub Copilot)
27
+ const copilotPath = await this.generateCopilotInstructions();
28
+ generated.copilot.push(copilotPath);
29
+
30
+ // Generate/enhance .vscode/settings.json (custom chat modes)
31
+ const settingsPath = await this.generateVSCodeSettings();
32
+ generated.vscode.push(settingsPath);
33
+
34
+ return generated;
35
+ }
36
+
37
+ /**
38
+ * Generate .github/copilot-instructions.md
39
+ */
40
+ async generateCopilotInstructions() {
41
+ await this.ensureDir('.github');
42
+
43
+ const content = this.framework === 'rapid' ?
44
+ this.generateCopilotPRP() :
45
+ this.framework === 'balanced' ?
46
+ this.generateCopilotBalanced() :
47
+ this.generateCopilotBMAD();
48
+
49
+ return await this.writeToProject('.github/copilot-instructions.md', content);
50
+ }
51
+
52
+ generateCopilotPRP() {
53
+ const projectName = this.getProjectName();
54
+ const sections = this.outputs.sections || {};
55
+
56
+ return `# Copilot Instructions for ${projectName}
57
+
58
+ ## Project Overview
59
+
60
+ ${sections['1._goal_definition'] || sections['goal_definition'] || 'Software development project'}
61
+
62
+ ## Tech Stack
63
+
64
+ ${this.extractTechStack(sections)}
65
+
66
+ ## Implementation Blueprint
67
+
68
+ ${sections['4._implementation_blueprint'] || sections['implementation_blueprint'] || 'See PRP for details'}
69
+
70
+ ## Code Style
71
+
72
+ - Use the specified tech stack
73
+ - Follow the file structure in the blueprint
74
+ - Write clean, readable code
75
+ - Include error handling
76
+ - Add tests for new features
77
+
78
+ ## Testing
79
+
80
+ - Write tests for all new functionality
81
+ - Follow test patterns in the blueprint
82
+ - Ensure tests pass before committing
83
+
84
+ ## When Generating Code
85
+
86
+ 1. **Check requirements**: \`.adf/sessions/${this.getSessionId()}/outputs/prp.md\`
87
+ 2. **Follow the implementation blueprint** exactly
88
+ 3. **Include error handling** in all code
89
+ 4. **Add type definitions** (if using TypeScript)
90
+ 5. **Write accompanying tests**
91
+
92
+ ## Success Criteria
93
+
94
+ ${sections['5._validation'] || sections['validation'] || 'See PRP'}
95
+
96
+ Ensure all code meets these criteria before considering it complete.
97
+
98
+ ## Reference Document
99
+
100
+ Full PRP: \`.adf/sessions/${this.getSessionId()}/outputs/prp.md\`
101
+
102
+ ---
103
+
104
+ *Generated by ADF CLI v${this.getADFVersion()} from PRP framework*
105
+ `;
106
+ }
107
+
108
+ generateCopilotBalanced() {
109
+ const projectName = this.getProjectName();
110
+ const constitution = this.outputs.constitution || '';
111
+ const specification = this.outputs.specification || '';
112
+ const plan = this.outputs.plan || '';
113
+
114
+ const principles = this.extractSection(constitution, 'Core Principles');
115
+ const constraints = this.extractSection(constitution, 'Constraints');
116
+ const techStack = this.extractSection(plan, 'Technology Stack');
117
+ const codeStyle = this.extractSection(plan, 'Code Style') ||
118
+ this.extractSection(plan, 'Coding Standards');
119
+
120
+ return `# Copilot Instructions for ${projectName}
121
+
122
+ ## Project Overview
123
+
124
+ ${this.extractSection(specification, 'Overview') || this.extractSection(specification, 'Purpose')}
125
+
126
+ ## Core Principles
127
+
128
+ ${principles || 'Follow best practices'}
129
+
130
+ **These must always be followed.**
131
+
132
+ ## Constraints (Non-Negotiable)
133
+
134
+ ${constraints || 'No specific constraints'}
135
+
136
+ **Never violate these constraints.**
137
+
138
+ ## Tech Stack
139
+
140
+ ${techStack || 'See technical plan'}
141
+
142
+ ## Architecture
143
+
144
+ ${this.extractSection(specification, 'Architecture') || 'See specification.md'}
145
+
146
+ Full architecture: \`.adf/sessions/${this.getSessionId()}/outputs/specification.md\`
147
+
148
+ ## Code Standards
149
+
150
+ ${codeStyle || 'Follow best practices'}
151
+
152
+ - Write tests first (TDD approach)
153
+ - Follow architecture patterns
154
+ - Adhere to all constraints
155
+ - Maintain consistency
156
+
157
+ ## Patterns to Use
158
+
159
+ ${this.extractSection(plan, 'Recommended Patterns') || this.extractSection(specification, 'Patterns') || '- Follow architectural patterns from specification'}
160
+
161
+ ## Patterns to Avoid
162
+
163
+ ${this.extractSection(plan, 'Anti-Patterns') || this.extractSection(specification, 'What Not To Do') || '- Violating constraints\n- Skipping tests\n- Deviating from architecture'}
164
+
165
+ ## Testing Requirements
166
+
167
+ ${this.extractSection(plan, 'Testing') || '- Comprehensive test coverage\n- Unit and integration tests\n- All tests must pass'}
168
+
169
+ ## When Generating Code
170
+
171
+ 1. **Review requirements**: Check specification and technical plan
172
+ 2. **Follow architecture**: Use patterns from specification
173
+ 3. **Check constraints**: Never violate constitution constraints
174
+ 4. **Include error handling**: Handle all error cases
175
+ 5. **Add type definitions**: Use strong typing
176
+ 6. **Write tests**: Test-driven development
177
+
178
+ ## Reference Documents
179
+
180
+ - **Constitution**: \`.adf/sessions/${this.getSessionId()}/outputs/constitution.md\` (principles & constraints)
181
+ - **Specification**: \`.adf/sessions/${this.getSessionId()}/outputs/specification.md\` (requirements & architecture)
182
+ - **Technical Plan**: \`.adf/sessions/${this.getSessionId()}/outputs/plan.md\` (technical decisions)
183
+ - **Tasks**: \`.adf/sessions/${this.getSessionId()}/outputs/tasks.md\` (implementation breakdown)
184
+
185
+ ---
186
+
187
+ *Generated by ADF CLI v${this.getADFVersion()} from Balanced framework*
188
+ `;
189
+ }
190
+
191
+ generateCopilotBMAD() {
192
+ const projectName = this.getProjectName();
193
+ const prd = this.outputs.prd || '';
194
+ const architecture = this.outputs.architecture || '';
195
+
196
+ return `# Copilot Instructions for ${projectName}
197
+
198
+ ## Product Overview
199
+
200
+ ${this.extractSection(prd, 'Executive Summary') || this.extractSection(prd, 'Overview')}
201
+
202
+ ## Goals and Objectives
203
+
204
+ ${this.extractSection(prd, 'Goals and Objectives') || 'See PRD'}
205
+
206
+ ## Technical Requirements
207
+
208
+ ${this.extractSection(prd, 'Technical Requirements') || this.extractSection(prd, 'Technical Architecture')}
209
+
210
+ ## System Architecture
211
+
212
+ ${this.extractSection(architecture, 'System Overview') || this.extractSection(architecture, 'Architecture Overview')}
213
+
214
+ Full architecture: \`.adf/sessions/${this.getSessionId()}/outputs/architecture.md\`
215
+
216
+ ## Code Quality Standards
217
+
218
+ - **Test coverage**: >= 80%
219
+ - **Architecture**: Follow patterns from architecture.md
220
+ - **User stories**: Implement as specified in stories.md
221
+ - **Documentation**: Document public APIs and complex logic
222
+ - **Error handling**: Handle all error cases gracefully
223
+ - **Performance**: Consider scalability and performance
224
+
225
+ ## Testing Requirements
226
+
227
+ - Comprehensive test coverage (>= 80%)
228
+ - Unit tests for all components
229
+ - Integration tests for workflows
230
+ - E2E tests for user journeys
231
+ - All tests must pass before committing
232
+
233
+ ## Security Requirements
234
+
235
+ ${this.extractSection(prd, 'Security') || this.extractSection(prd, 'Security Requirements') || '- Never commit sensitive data\n- Validate all user input\n- Use environment variables for secrets'}
236
+
237
+ ## Performance Considerations
238
+
239
+ ${this.extractSection(prd, 'Performance') || '- Optimize critical paths\n- Monitor resource usage\n- Follow performance patterns from architecture'}
240
+
241
+ ## Patterns to Use
242
+
243
+ - Follow architectural patterns from architecture.md
244
+ - Implement user stories as specified
245
+ - Use consistent coding style
246
+ - Write self-documenting code
247
+
248
+ ## Patterns to Avoid
249
+
250
+ - Deviating from architectural decisions
251
+ - Skipping tests
252
+ - Ignoring user story acceptance criteria
253
+ - Committing sensitive data
254
+ - Making breaking changes without approval
255
+
256
+ ## When Generating Code
257
+
258
+ 1. **Review requirements**: Read the PRD for context
259
+ 2. **Check architecture**: Follow system design from architecture.md
260
+ 3. **Review user story**: Understand acceptance criteria
261
+ 4. **Include error handling**: Handle all cases
262
+ 5. **Add type definitions**: Use strong typing
263
+ 6. **Write tests first**: Test-driven development
264
+ 7. **Validate against criteria**: Ensure acceptance criteria met
265
+
266
+ ## Reference Documents
267
+
268
+ - **PRD**: \`.adf/sessions/${this.getSessionId()}/outputs/prd.md\` (complete product requirements)
269
+ - **Architecture**: \`.adf/sessions/${this.getSessionId()}/outputs/architecture.md\` (system design & technical architecture)
270
+ - **User Stories**: \`.adf/sessions/${this.getSessionId()}/outputs/stories.md\` (user needs & acceptance criteria)
271
+
272
+ ---
273
+
274
+ *Generated by ADF CLI v${this.getADFVersion()} from BMAD framework*
275
+ `;
276
+ }
277
+
278
+ /**
279
+ * Generate/enhance .vscode/settings.json with custom chat modes
280
+ */
281
+ async generateVSCodeSettings() {
282
+ await this.ensureDir('.vscode');
283
+
284
+ const settingsPath = path.join(this.projectPath, '.vscode', 'settings.json');
285
+ let settings = {};
286
+
287
+ // Load existing settings if they exist
288
+ if (await fs.pathExists(settingsPath)) {
289
+ try {
290
+ const content = await fs.readFile(settingsPath, 'utf-8');
291
+ settings = JSON.parse(content);
292
+ } catch (error) {
293
+ // If parsing fails, start fresh
294
+ console.warn('Warning: Could not parse existing .vscode/settings.json, will create new');
295
+ }
296
+ }
297
+
298
+ // Add custom chat modes
299
+ settings['github.copilot.chat.modes'] = this.generateChatModes();
300
+
301
+ const content = JSON.stringify(settings, null, 2);
302
+ await fs.writeFile(settingsPath, content, 'utf-8');
303
+
304
+ return '.vscode/settings.json';
305
+ }
306
+
307
+ generateChatModes() {
308
+ const sessionId = this.getSessionId();
309
+
310
+ const modes = {
311
+ architect: {
312
+ instructions: "Focus on system design and architecture patterns. Check component boundaries, data flow, and scalability.",
313
+ context: []
314
+ },
315
+ implementer: {
316
+ instructions: "Implement features following requirements and architecture. Write tests first.",
317
+ context: []
318
+ },
319
+ reviewer: {
320
+ instructions: "Review code against requirements and best practices. Check for compliance, quality, and security.",
321
+ context: []
322
+ }
323
+ };
324
+
325
+ // Add context files based on framework
326
+ if (this.framework === 'rapid') {
327
+ modes.architect.context.push(`.adf/sessions/${sessionId}/outputs/prp.md`);
328
+ modes.implementer.context.push(`.adf/sessions/${sessionId}/outputs/prp.md`);
329
+ modes.reviewer.context.push(`.adf/sessions/${sessionId}/outputs/prp.md`);
330
+ } else if (this.framework === 'balanced') {
331
+ modes.architect.context.push(
332
+ `.adf/sessions/${sessionId}/outputs/specification.md`,
333
+ `.adf/sessions/${sessionId}/outputs/plan.md`
334
+ );
335
+ modes.implementer.context.push(
336
+ `.adf/sessions/${sessionId}/outputs/specification.md`,
337
+ `.adf/sessions/${sessionId}/outputs/tasks.md`
338
+ );
339
+ modes.reviewer.context.push(
340
+ `.adf/sessions/${sessionId}/outputs/constitution.md`,
341
+ `.adf/sessions/${sessionId}/outputs/plan.md`
342
+ );
343
+ } else {
344
+ modes.architect.context.push(
345
+ `.adf/sessions/${sessionId}/outputs/architecture.md`,
346
+ `.adf/sessions/${sessionId}/outputs/prd.md`
347
+ );
348
+ modes.implementer.context.push(
349
+ `.adf/sessions/${sessionId}/outputs/stories.md`,
350
+ `.adf/sessions/${sessionId}/outputs/prd.md`
351
+ );
352
+ modes.reviewer.context.push(
353
+ `.adf/sessions/${sessionId}/outputs/prd.md`,
354
+ `.adf/sessions/${sessionId}/outputs/architecture.md`
355
+ );
356
+ }
357
+
358
+ return modes;
359
+ }
360
+
361
+ /**
362
+ * Extract tech stack from PRP sections
363
+ */
364
+ extractTechStack(sections) {
365
+ const contextualIntelligence = sections['3._contextual_intelligence'] ||
366
+ sections['contextual_intelligence'] || '';
367
+
368
+ const lines = contextualIntelligence.split('\n');
369
+ const techLines = [];
370
+ let inTechSection = false;
371
+
372
+ for (const line of lines) {
373
+ if (line.toLowerCase().includes('tech') ||
374
+ line.toLowerCase().includes('stack') ||
375
+ line.toLowerCase().includes('technology')) {
376
+ inTechSection = true;
377
+ }
378
+ if (inTechSection && line.trim()) {
379
+ techLines.push(line);
380
+ if (techLines.length > 10) break;
381
+ }
382
+ if (line.startsWith('##') && inTechSection && techLines.length > 0) {
383
+ break;
384
+ }
385
+ }
386
+
387
+ return techLines.length > 0 ? techLines.join('\n') : 'See framework outputs for tech stack';
388
+ }
389
+
390
+ /**
391
+ * Get ADF CLI version
392
+ */
393
+ getADFVersion() {
394
+ try {
395
+ const packageJson = require('../../package.json');
396
+ return packageJson.version;
397
+ } catch (error) {
398
+ return '0.3.0';
399
+ }
400
+ }
401
+ }
402
+
403
+ module.exports = VSCodeGenerator;