@iservu-inc/adf-cli 0.10.0 → 0.12.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 (40) 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 +10 -1
  12. package/.project/chats/current/SESSION-STATUS.md +102 -73
  13. package/.project/docs/ROADMAP.md +47 -32
  14. package/.project/docs/designs/LEARNING-ANALYTICS-DASHBOARD.md +1383 -0
  15. package/CHANGELOG.md +341 -0
  16. package/CLAUDE.md +479 -0
  17. package/README.md +7 -1
  18. package/lib/commands/deploy.js +42 -2
  19. package/lib/generators/agents-md-generator.js +431 -161
  20. package/lib/generators/antigravity-generator.js +140 -0
  21. package/lib/generators/index.js +22 -0
  22. package/lib/generators/zed-generator.js +252 -0
  23. package/lib/learning/analytics-exporter.js +241 -0
  24. package/lib/learning/analytics-view.js +508 -0
  25. package/lib/learning/analytics.js +681 -0
  26. package/lib/learning/learning-manager.js +19 -6
  27. package/lib/templates/shared/agents/architect.md +24 -24
  28. package/lib/templates/shared/agents/dev.md +25 -20
  29. package/lib/templates/shared/agents/pm.md +14 -4
  30. package/lib/templates/shared/agents/sm.md +18 -14
  31. package/lib/templates/shared/templates/openspec-delta.md +16 -0
  32. package/lib/templates/shared/templates/openspec-proposal.md +18 -0
  33. package/lib/templates/shared/templates/openspec-tasks.md +21 -0
  34. package/lib/utils/context-manager.js +484 -0
  35. package/package.json +6 -1
  36. package/scripts/generate-test-data.js +557 -0
  37. package/tests/agents-md-generator.test.js +47 -10
  38. package/tests/analytics-exporter.test.js +477 -0
  39. package/tests/analytics-view.test.js +466 -0
  40. package/tests/analytics.test.js +712 -0
@@ -0,0 +1,484 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Context Manager
6
+ * Manages the .context/ directory structure for Agent-Native Development Framework (ANDF)
7
+ *
8
+ * The .context/ directory contains agent-accessible deep context:
9
+ * - /memory/architecture.md - System architecture and design decisions
10
+ * - /memory/glossary.md - Domain-specific terminology
11
+ * - /skills/ - Executable scripts and tools
12
+ */
13
+ class ContextManager {
14
+ constructor(projectPath) {
15
+ this.projectPath = projectPath;
16
+ this.contextPath = path.join(projectPath, '.context');
17
+ this.memoryPath = path.join(this.contextPath, 'memory');
18
+ this.skillsPath = path.join(this.contextPath, 'skills');
19
+ }
20
+
21
+ /**
22
+ * Create complete .context/ directory structure
23
+ * @returns {Promise<object>} Created paths
24
+ */
25
+ async createStructure() {
26
+ const created = {
27
+ context: this.contextPath,
28
+ memory: this.memoryPath,
29
+ skills: this.skillsPath
30
+ };
31
+
32
+ // Create directories
33
+ await fs.ensureDir(this.memoryPath);
34
+ await fs.ensureDir(this.skillsPath);
35
+
36
+ // Create README to explain the structure
37
+ const readmePath = path.join(this.contextPath, 'README.md');
38
+ if (!await fs.pathExists(readmePath)) {
39
+ await this.createContextReadme(readmePath);
40
+ }
41
+
42
+ return created;
43
+ }
44
+
45
+ /**
46
+ * Create README.md explaining the .context/ directory
47
+ */
48
+ async createContextReadme(readmePath) {
49
+ const readmeContent = `# .context Directory
50
+
51
+ This directory contains agent-accessible deep context for AI coding assistants.
52
+
53
+ ## Structure
54
+
55
+ - \`/memory/\` - Deep memory and knowledge base
56
+ - \`architecture.md\` - System architecture and design decisions
57
+ - \`glossary.md\` - Domain-specific terminology and definitions
58
+
59
+ - \`/skills/\` - Executable scripts and tools
60
+ - Helper scripts that agents can reference or execute
61
+
62
+ ## Purpose
63
+
64
+ The \`.context/\` directory follows the Agent-Native Development Framework (ANDF) specification.
65
+ AI coding assistants reference these files via the Model Context Protocol (MCP) to:
66
+ - Understand system architecture before making changes
67
+ - Learn domain-specific terminology
68
+ - Access helper scripts and tools
69
+
70
+ ## DO NOT MODIFY
71
+
72
+ This directory is managed by ADF CLI. Contents are generated from interview sessions.
73
+ Manual changes may be overwritten during deployment.
74
+
75
+ For more information, see: AGENTS.md
76
+ `;
77
+
78
+ await fs.writeFile(readmePath, readmeContent, 'utf-8');
79
+ }
80
+
81
+ /**
82
+ * Generate architecture.md from session outputs
83
+ * @param {string} sessionPath - Path to ADF session
84
+ * @param {string} framework - Framework type (rapid/balanced/comprehensive)
85
+ */
86
+ async generateArchitecture(sessionPath, framework) {
87
+ const archPath = path.join(this.memoryPath, 'architecture.md');
88
+
89
+ let content;
90
+ if (framework === 'rapid') {
91
+ content = await this.generateArchitectureFromPRP(sessionPath);
92
+ } else if (framework === 'balanced') {
93
+ content = await this.generateArchitectureFromBalanced(sessionPath);
94
+ } else if (framework === 'comprehensive') {
95
+ content = await this.generateArchitectureFromBMAD(sessionPath);
96
+ } else {
97
+ throw new Error(`Unknown framework: ${framework}`);
98
+ }
99
+
100
+ await fs.writeFile(archPath, content, 'utf-8');
101
+ return archPath;
102
+ }
103
+
104
+ /**
105
+ * Generate architecture.md from PRP (Rapid) outputs
106
+ */
107
+ async generateArchitectureFromPRP(sessionPath) {
108
+ const prpPath = path.join(sessionPath, 'outputs', 'prp.md');
109
+
110
+ if (!await fs.pathExists(prpPath)) {
111
+ return this.getDefaultArchitecture();
112
+ }
113
+
114
+ const prpContent = await fs.readFile(prpPath, 'utf-8');
115
+
116
+ // Extract sections from PRP
117
+ const goalDef = this.extractPRPSection(prpContent, '1. Goal Definition');
118
+ const contextIntel = this.extractPRPSection(prpContent, '3. Contextual Intelligence');
119
+ const blueprint = this.extractPRPSection(prpContent, '4. Implementation Blueprint');
120
+
121
+ return `# System Architecture
122
+
123
+ **Framework:** Rapid Development (PRP)
124
+ **Generated:** ${new Date().toISOString()}
125
+
126
+ ## Overview
127
+
128
+ ${goalDef || 'See PRP document for project overview'}
129
+
130
+ ## Technical Context
131
+
132
+ ${contextIntel || 'See PRP document for technical context'}
133
+
134
+ ## Implementation Architecture
135
+
136
+ ${blueprint || 'See PRP document for implementation blueprint'}
137
+
138
+ ## Design Decisions
139
+
140
+ ### Architecture Pattern
141
+ - Pattern to be determined during implementation
142
+ - Follow modern best practices for the chosen tech stack
143
+
144
+ ### Tech Stack
145
+ See "3. Contextual Intelligence" section in PRP document for complete tech stack.
146
+
147
+ ## Key Components
148
+
149
+ To be defined during implementation based on the blueprint above.
150
+
151
+ ## Data Flow
152
+
153
+ To be defined during implementation.
154
+
155
+ ## Security Considerations
156
+
157
+ - Follow OWASP security best practices
158
+ - Validate all user input
159
+ - Use environment variables for sensitive configuration
160
+ - Implement proper authentication and authorization
161
+
162
+ ## Performance Considerations
163
+
164
+ - Optimize critical rendering paths
165
+ - Minimize database queries
166
+ - Cache where appropriate
167
+ - Monitor resource usage
168
+
169
+ ---
170
+
171
+ *For complete requirements, see: \`.adf/sessions/[session]/outputs/prp.md\`*
172
+ `;
173
+ }
174
+
175
+ /**
176
+ * Generate architecture.md from Balanced outputs
177
+ */
178
+ async generateArchitectureFromBalanced(sessionPath) {
179
+ const specPath = path.join(sessionPath, 'outputs', 'specification.md');
180
+ const planPath = path.join(sessionPath, 'outputs', 'plan.md');
181
+ const constitutionPath = path.join(sessionPath, 'outputs', 'constitution.md');
182
+
183
+ const spec = await fs.pathExists(specPath) ? await fs.readFile(specPath, 'utf-8') : '';
184
+ const plan = await fs.pathExists(planPath) ? await fs.readFile(planPath, 'utf-8') : '';
185
+ const constitution = await fs.pathExists(constitutionPath) ? await fs.readFile(constitutionPath, 'utf-8') : '';
186
+
187
+ const archSection = this.extractSection(spec, 'Architecture');
188
+ const techStack = this.extractSection(plan, 'Technology Stack');
189
+ const principles = this.extractSection(constitution, 'Core Principles');
190
+ const constraints = this.extractSection(constitution, 'Constraints');
191
+
192
+ return `# System Architecture
193
+
194
+ **Framework:** Balanced (Specification-Driven)
195
+ **Generated:** ${new Date().toISOString()}
196
+
197
+ ## Core Principles
198
+
199
+ ${principles || 'See constitution.md for core principles'}
200
+
201
+ ## System Constraints
202
+
203
+ ${constraints || 'See constitution.md for constraints'}
204
+
205
+ ## Architecture Overview
206
+
207
+ ${archSection || 'See specification.md for complete architecture'}
208
+
209
+ ## Technology Stack
210
+
211
+ ${techStack || 'See plan.md for technology stack'}
212
+
213
+ ## Component Design
214
+
215
+ See specification.md for detailed component design and interactions.
216
+
217
+ ## Data Architecture
218
+
219
+ See specification.md for data models, database schema, and data flow.
220
+
221
+ ## API Design
222
+
223
+ See specification.md for API endpoints, request/response formats, and integration points.
224
+
225
+ ## Security Architecture
226
+
227
+ - Follow security principles defined in constitution.md
228
+ - Implement authentication and authorization per specification
229
+ - Validate all inputs, sanitize all outputs
230
+ - Use HTTPS for all communications
231
+ - See specification.md for security requirements
232
+
233
+ ## Performance Architecture
234
+
235
+ - Follow performance constraints in constitution.md
236
+ - Optimize based on requirements in specification.md
237
+ - Monitor critical paths and resource usage
238
+
239
+ ## Deployment Architecture
240
+
241
+ See plan.md for deployment strategy and infrastructure requirements.
242
+
243
+ ---
244
+
245
+ *For complete details, see:*
246
+ - *Constitution: \`.adf/sessions/[session]/outputs/constitution.md\`*
247
+ - *Specification: \`.adf/sessions/[session]/outputs/specification.md\`*
248
+ - *Technical Plan: \`.adf/sessions/[session]/outputs/plan.md\`*
249
+ `;
250
+ }
251
+
252
+ /**
253
+ * Generate architecture.md from BMAD (Comprehensive) outputs
254
+ */
255
+ async generateArchitectureFromBMAD(sessionPath) {
256
+ const archPath = path.join(sessionPath, 'outputs', 'architecture.md');
257
+ const prdPath = path.join(sessionPath, 'outputs', 'prd.md');
258
+
259
+ if (await fs.pathExists(archPath)) {
260
+ // BMAD already has architecture.md, so copy it
261
+ const archContent = await fs.readFile(archPath, 'utf-8');
262
+ return `${archContent}\n\n---\n\n*Copied from: \`.adf/sessions/[session]/outputs/architecture.md\`*\n*Generated: ${new Date().toISOString()}*`;
263
+ }
264
+
265
+ // Fallback: extract from PRD
266
+ const prd = await fs.pathExists(prdPath) ? await fs.readFile(prdPath, 'utf-8') : '';
267
+ const techReq = this.extractSection(prd, 'Technical Requirements');
268
+ const archReq = this.extractSection(prd, 'Technical Architecture');
269
+
270
+ return `# System Architecture
271
+
272
+ **Framework:** BMAD Comprehensive (Enterprise)
273
+ **Generated:** ${new Date().toISOString()}
274
+
275
+ ## Enterprise Architecture Overview
276
+
277
+ ${archReq || techReq || 'See architecture.md and prd.md for complete enterprise architecture'}
278
+
279
+ ## System Components
280
+
281
+ See architecture.md for detailed component breakdown and responsibilities.
282
+
283
+ ## Integration Architecture
284
+
285
+ See architecture.md for integration patterns, APIs, and external system connections.
286
+
287
+ ## Data Architecture
288
+
289
+ See architecture.md for:
290
+ - Data models and schemas
291
+ - Database architecture
292
+ - Data flow and transformations
293
+ - Caching strategy
294
+
295
+ ## Security Architecture
296
+
297
+ See architecture.md and prd.md for:
298
+ - Authentication and authorization patterns
299
+ - Security layers and controls
300
+ - Compliance requirements
301
+ - Threat model and mitigations
302
+
303
+ ## Performance & Scalability
304
+
305
+ See architecture.md for:
306
+ - Performance targets and benchmarks
307
+ - Scalability patterns
308
+ - Load balancing and distribution
309
+ - Resource optimization
310
+
311
+ ## Deployment Architecture
312
+
313
+ See architecture.md for:
314
+ - Infrastructure design
315
+ - Deployment pipelines
316
+ - Environment strategy
317
+ - Disaster recovery
318
+
319
+ ---
320
+
321
+ *For complete enterprise architecture, see:*
322
+ - *Architecture Document: \`.adf/sessions/[session]/outputs/architecture.md\`*
323
+ - *PRD: \`.adf/sessions/[session]/outputs/prd.md\`*
324
+ - *User Stories: \`.adf/sessions/[session]/outputs/stories.md\`*
325
+ `;
326
+ }
327
+
328
+ /**
329
+ * Generate glossary.md from session outputs
330
+ * @param {string} sessionPath - Path to ADF session
331
+ * @param {string} framework - Framework type
332
+ */
333
+ async generateGlossary(sessionPath, framework) {
334
+ const glossaryPath = path.join(this.memoryPath, 'glossary.md');
335
+
336
+ // Extract domain terms from interview transcripts
337
+ const transcriptPath = path.join(sessionPath, '_transcript.json');
338
+ let terms = {};
339
+
340
+ if (await fs.pathExists(transcriptPath)) {
341
+ const transcript = await fs.readJson(transcriptPath);
342
+ terms = this.extractTermsFromTranscript(transcript);
343
+ }
344
+
345
+ const content = this.generateGlossaryContent(terms, framework);
346
+ await fs.writeFile(glossaryPath, content, 'utf-8');
347
+
348
+ return glossaryPath;
349
+ }
350
+
351
+ /**
352
+ * Extract domain terms from interview transcript
353
+ */
354
+ extractTermsFromTranscript(transcript) {
355
+ const terms = {};
356
+
357
+ // Look for capitalized terms, technical acronyms, and domain-specific language
358
+ const entries = Array.isArray(transcript) ? transcript : [];
359
+
360
+ for (const entry of entries) {
361
+ if (entry.answer && typeof entry.answer === 'string') {
362
+ // Extract potential domain terms (capitalized words, acronyms)
363
+ const matches = entry.answer.match(/\b[A-Z][A-Z0-9]{2,}\b|\b[A-Z][a-z]+(?:\s+[A-Z][a-z]+)*\b/g);
364
+ if (matches) {
365
+ for (const term of matches) {
366
+ if (!terms[term] && term.length > 2) {
367
+ terms[term] = this.extractTermDefinition(entry.answer, term);
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+
374
+ return terms;
375
+ }
376
+
377
+ /**
378
+ * Extract definition for a term from context
379
+ */
380
+ extractTermDefinition(text, term) {
381
+ // Try to find a sentence that defines or explains the term
382
+ const sentences = text.split(/[.!?]+/);
383
+ for (const sentence of sentences) {
384
+ if (sentence.includes(term)) {
385
+ return sentence.trim();
386
+ }
387
+ }
388
+ return 'Domain-specific term used in this project';
389
+ }
390
+
391
+ /**
392
+ * Generate glossary content
393
+ */
394
+ generateGlossaryContent(terms, framework) {
395
+ const termEntries = Object.entries(terms)
396
+ .filter(([term]) => term.length > 2)
397
+ .sort(([a], [b]) => a.localeCompare(b))
398
+ .map(([term, definition]) => `### ${term}\n\n${definition}\n`)
399
+ .join('\n');
400
+
401
+ return `# Project Glossary
402
+
403
+ **Framework:** ${this.getFrameworkName(framework)}
404
+ **Generated:** ${new Date().toISOString()}
405
+
406
+ This glossary defines domain-specific terms and technical concepts used throughout this project.
407
+
408
+ ## Terms
409
+
410
+ ${termEntries || '### (No terms extracted)\n\nDomain terminology will be added as the project evolves.'}
411
+
412
+ ## Adding Terms
413
+
414
+ To add new terms to this glossary:
415
+ 1. Terms are automatically extracted from interview responses
416
+ 2. Manual additions can be made to this file
417
+ 3. Follow the format: \`### Term Name\\n\\nDefinition or explanation.\\n\`
418
+
419
+ ---
420
+
421
+ *Auto-generated from interview transcript. Manual edits will be preserved during re-generation.*
422
+ `;
423
+ }
424
+
425
+ /**
426
+ * Extract section from PRP content
427
+ */
428
+ extractPRPSection(content, sectionName) {
429
+ const regex = new RegExp(`##\\s*${sectionName}([\\s\\S]*?)(?=##|$)`, 'i');
430
+ const match = content.match(regex);
431
+ return match ? match[1].trim() : '';
432
+ }
433
+
434
+ /**
435
+ * Extract section from markdown content
436
+ */
437
+ extractSection(content, sectionName) {
438
+ if (!content) return '';
439
+
440
+ const regex = new RegExp(`##\\s*${sectionName}([\\s\\S]*?)(?=##|$)`, 'i');
441
+ const match = content.match(regex);
442
+ return match ? match[1].trim() : '';
443
+ }
444
+
445
+ /**
446
+ * Get default architecture content
447
+ */
448
+ getDefaultArchitecture() {
449
+ return `# System Architecture
450
+
451
+ **Generated:** ${new Date().toISOString()}
452
+
453
+ ## Overview
454
+
455
+ System architecture to be defined based on project requirements.
456
+
457
+ ## Components
458
+
459
+ To be defined during implementation.
460
+
461
+ ## Design Decisions
462
+
463
+ To be documented as architectural decisions are made.
464
+
465
+ ---
466
+
467
+ *This is a placeholder. Complete architecture details will be added as the project evolves.*
468
+ `;
469
+ }
470
+
471
+ /**
472
+ * Get framework display name
473
+ */
474
+ getFrameworkName(framework) {
475
+ const names = {
476
+ 'rapid': 'Rapid Development (PRP)',
477
+ 'balanced': 'Balanced (Specification-Driven)',
478
+ 'comprehensive': 'BMAD Comprehensive (Enterprise)'
479
+ };
480
+ return names[framework] || framework;
481
+ }
482
+ }
483
+
484
+ module.exports = ContextManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iservu-inc/adf-cli",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "CLI tool for AgentDevFramework - AI-assisted development framework with multi-provider AI support",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -27,6 +27,11 @@
27
27
  "windsurf",
28
28
  "cursor",
29
29
  "claude-code",
30
+ "zed",
31
+ "antigravity",
32
+ "andf",
33
+ "agents-md",
34
+ "mcp",
30
35
  "anthropic",
31
36
  "openai",
32
37
  "gemini",