@iservu-inc/adf-cli 0.11.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.
@@ -0,0 +1,16 @@
1
+ # OpenSpec Delta: [Spec Name]
2
+
3
+ ## ➕ ADDED Requirements
4
+ ### Requirement: [Name]
5
+ Description using SHALL/MUST.
6
+ #### Scenario: [Context]
7
+ - WHEN [Action]
8
+ - THEN [Outcome]
9
+
10
+ ## 🔄 MODIFIED Requirements
11
+ ### Requirement: [Name]
12
+ *Original requirement reference*
13
+ Updated description.
14
+
15
+ ## ➖ REMOVED Requirements
16
+ - [Requirement Name]
@@ -0,0 +1,18 @@
1
+ # OpenSpec Change Proposal: [Feature Name]
2
+
3
+ ## 🎯 Purpose
4
+ Briefly describe WHY this change is needed and what problem it solves.
5
+
6
+ ## 📝 Proposed Changes
7
+ High-level summary of the functional changes.
8
+
9
+ ## 🗄️ Technical Approach
10
+ - Architecture decisions
11
+ - Impacted components
12
+ - New dependencies (if any)
13
+
14
+ ## 🚧 Verification Plan
15
+ - [ ] Syntax check
16
+ - [ ] Unit tests
17
+ - [ ] Integration tests
18
+ - [ ] Manual verification
@@ -0,0 +1,21 @@
1
+ # OpenSpec Implementation Tasks: [Feature Name]
2
+
3
+ ## 🛠️ Task Breakdown
4
+
5
+ ### Phase 1: Setup & Infrastructure
6
+ - [ ] 1.1 Task Description
7
+ - [ ] 1.2 Task Description
8
+
9
+ ### Phase 2: Implementation
10
+ - [ ] 2.1 Task Description
11
+ - [ ] 2.2 Task Description
12
+
13
+ ### Phase 3: Testing & Validation
14
+ - [ ] 3.1 Task Description
15
+ - [ ] 3.2 Task Description
16
+
17
+ ## ✅ Definition of Done
18
+ - All tasks marked complete
19
+ - Tests passing (>80% coverage)
20
+ - Documentation updated
21
+ - Change ready for archive
@@ -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.11.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",
@@ -74,13 +74,27 @@ This will help users make data-driven decisions and improve productivity.
74
74
  // Verify content
75
75
  const content = await fs.readFile(generatedPath, 'utf-8');
76
76
 
77
- expect(content).toContain('# Test Analytics Dashboard');
78
- expect(content).toContain('## Overview');
77
+ // Check YAML frontmatter (ANDF standard)
78
+ expect(content).toContain('---');
79
+ expect(content).toContain('name: Test Analytics Dashboard Developer');
80
+ expect(content).toContain('description: Expert developer');
81
+ expect(content).toContain('tools:');
82
+ expect(content).toContain('project_context');
83
+
84
+ // Check ANDF-compliant headers
85
+ expect(content).toContain('# AGENTS.md - The Agent Manifest');
86
+ expect(content).toContain('## 1. Operational Rules (High Priority)');
87
+ expect(content).toContain('## 2. Build & Test Commands');
88
+ expect(content).toContain('## 3. Project Structure');
89
+ expect(content).toContain('## 4. Workflow Directives');
90
+ expect(content).toContain('## 5. Project Context');
91
+ expect(content).toContain('## 6. Key Context Files');
92
+ expect(content).toContain('## 7. AI Agent Instructions');
93
+
94
+ // Check content references
79
95
  expect(content).toContain('React dashboard');
80
- expect(content).toContain('## Tech Stack');
81
- expect(content).toContain('## Build Commands');
82
96
  expect(content).toContain('npm install');
83
- expect(content).toContain('## AI Agent Instructions');
97
+ expect(content).toContain('.context/memory/architecture.md');
84
98
  expect(content).toContain('.adf/sessions/test-session/outputs/prp.md');
85
99
  expect(content).toContain('Generated by');
86
100
  expect(content).toContain('ADF CLI');
@@ -143,13 +157,25 @@ Microservices architecture with API gateway.
143
157
  // Verify content
144
158
  const content = await fs.readFile(generatedPath, 'utf-8');
145
159
 
146
- expect(content).toContain('## Constitution');
160
+ // Check YAML frontmatter
161
+ expect(content).toContain('---');
162
+ expect(content).toContain('name:');
163
+ expect(content).toContain('Project Architect');
164
+ expect(content).toContain('tools:');
165
+
166
+ // Check ANDF-compliant headers
167
+ expect(content).toContain('# AGENTS.md - The Agent Manifest');
168
+ expect(content).toContain('## 1. Operational Rules (High Priority)');
169
+ expect(content).toContain('## 5. Constitution & Constraints');
170
+ expect(content).toContain('## 6. Technical Overview');
171
+
172
+ // Check content
147
173
  expect(content).toContain('User privacy is paramount');
148
- expect(content).toContain('## Tech Stack');
149
174
  expect(content).toContain('React 18');
150
175
  expect(content).toContain('constitution.md');
151
176
  expect(content).toContain('specification.md');
152
177
  expect(content).toContain('plan.md');
178
+ expect(content).toContain('.context/memory/architecture.md');
153
179
  });
154
180
  });
155
181
 
@@ -195,13 +221,24 @@ Modular monolith architecture with separate domains.
195
221
  // Verify content
196
222
  const content = await fs.readFile(generatedPath, 'utf-8');
197
223
 
198
- expect(content).toContain('## Product Overview');
224
+ // Check YAML frontmatter
225
+ expect(content).toContain('---');
226
+ expect(content).toContain('name:');
227
+ expect(content).toContain('Solutions Architect');
228
+ expect(content).toContain('tools:');
229
+
230
+ // Check ANDF-compliant headers
231
+ expect(content).toContain('# AGENTS.md - The Agent Manifest');
232
+ expect(content).toContain('## 1. Operational Rules (High Priority)');
233
+ expect(content).toContain('## 5. Product Vision & Requirements');
234
+ expect(content).toContain('## 6. Quality Standards');
235
+
236
+ // Check content
199
237
  expect(content).toContain('e-commerce platform');
200
- expect(content).toContain('## Goals and Objectives');
201
238
  expect(content).toContain('Enable online sales');
202
- expect(content).toContain('## Security Notes');
203
239
  expect(content).toContain('prd.md');
204
240
  expect(content).toContain('architecture.md');
241
+ expect(content).toContain('.context/memory/architecture.md');
205
242
  });
206
243
  });
207
244