@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
package/CHANGELOG.md CHANGED
@@ -7,6 +7,298 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2025-10-03
11
+
12
+ ### šŸš€ MAJOR RELEASE: Tool Configuration Generators
13
+
14
+ This release adds comprehensive tool configuration generation for all major AI coding environments. The ADF CLI now automatically generates optimized configurations for Windsurf, Cursor, VS Code, and the universal AGENTS.md standard.
15
+
16
+ ### Added
17
+
18
+ **Universal Standard:**
19
+ - **AGENTS.md Generator** - Universal AI agent configuration standard
20
+ - Works with OpenAI Codex, Cursor, Windsurf, Google Gemini/Jules, Factory
21
+ - Supported by 20,000+ open-source projects
22
+ - Automatically generated from framework outputs (PRP, Balanced, BMAD)
23
+ - Nested file support for monorepos
24
+
25
+ **Windsurf (Codeium) Generator:**
26
+ - `.windsurfrules` - Legacy format with 12,000 character limit compliance
27
+ - `.windsurf/rules/` - Modern modular rules system
28
+ - `project-context.md` - Project overview and tech stack
29
+ - `architecture.md` - System architecture patterns
30
+ - `coding-standards.md` - Code style and best practices
31
+ - `.windsurf/workflows/` - Cascade AI workflows
32
+ - `review-requirements.md` - Requirements review workflow
33
+ - `implement-feature.md` - Feature implementation workflow (Balanced/BMAD)
34
+
35
+ **Cursor AI Generator:**
36
+ - `.cursor/rules` - Modern primary configuration format
37
+ - `.cursorrules` - Legacy deprecation notice with migration path
38
+ - `.cursor/mcp.json` - Model Context Protocol support (optional, prepared for future)
39
+ - Custom modes: architect, implementer, reviewer
40
+ - Framework-specific context and instructions
41
+
42
+ **VS Code Generator:**
43
+ - `.github/copilot-instructions.md` - GitHub Copilot instructions
44
+ - `.vscode/settings.json` - Custom chat modes
45
+ - Architect mode - Focus on system design
46
+ - Implementer mode - Feature implementation with TDD
47
+ - Reviewer mode - Code review against requirements
48
+ - Preserves existing settings while adding chat modes
49
+ - Language Model API integration ready
50
+
51
+ **Base Architecture:**
52
+ - `ToolConfigGenerator` - Base class with shared utilities
53
+ - Framework output loading (PRP, Balanced, BMAD)
54
+ - Section extraction and parsing
55
+ - Template variable substitution
56
+ - Project metadata detection
57
+
58
+ **Integration:**
59
+ - Enhanced `adf deploy` command to generate all configurations
60
+ - `adf deploy windsurf` - Generates Windsurf configs + AGENTS.md
61
+ - `adf deploy cursor` - Generates Cursor configs + AGENTS.md
62
+ - `adf deploy vscode` - Generates VS Code configs + AGENTS.md
63
+ - AGENTS.md always generated (universal standard)
64
+ - Automatic session detection and framework identification
65
+ - Error recovery with warning messages
66
+
67
+ **Comprehensive Testing:**
68
+ - 24 new unit tests for generators (57 total tests)
69
+ - Test coverage maintained at 78%
70
+ - Tests for all 3 frameworks (PRP, Balanced, BMAD)
71
+ - Tests for all 3 tool generators
72
+ - Template variable substitution tests
73
+ - File preservation tests (VS Code settings)
74
+
75
+ ### New Files
76
+
77
+ **Generators:**
78
+ - `lib/generators/tool-config-generator.js` - Base class for all generators
79
+ - `lib/generators/agents-md-generator.js` - Universal AGENTS.md standard
80
+ - `lib/generators/windsurf-generator.js` - Windsurf configuration generator
81
+ - `lib/generators/cursor-generator.js` - Cursor configuration generator
82
+ - `lib/generators/vscode-generator.js` - VS Code configuration generator
83
+ - `lib/generators/index.js` - Generator exports and unified API
84
+
85
+ **Tests:**
86
+ - `tests/agents-md-generator.test.js` - 5 tests for AGENTS.md
87
+ - `tests/windsurf-generator.test.js` - 7 tests for Windsurf
88
+ - `tests/cursor-generator.test.js` - 6 tests for Cursor
89
+ - `tests/vscode-generator.test.js` - 6 tests for VS Code
90
+
91
+ **Documentation:**
92
+ - `.project/docs/tool-integrations/RESEARCH-FINDINGS.md` - 500+ line research document
93
+ - `.project/docs/tool-integrations/IDE-CUSTOMIZATIONS.md` - Tool customization guide
94
+ - `.project/chats/current/2025-10-03_AGENTS-MD-AND-TOOL-GENERATORS.md` - Session documentation
95
+
96
+ ### Changed
97
+
98
+ **Deploy Command:**
99
+ - Enhanced to call tool-specific generators based on selected tool
100
+ - Added progress messages for each generation phase
101
+ - Improved error handling with graceful fallbacks
102
+ - Displays generated file counts and paths
103
+
104
+ **Framework Support:**
105
+ - All generators support PRP (Rapid) framework
106
+ - All generators support Balanced framework
107
+ - All generators support BMAD (Comprehensive) framework
108
+ - Automatic framework detection from session metadata
109
+
110
+ ### Generated File Structure
111
+
112
+ When running `adf deploy <tool>`, the following files are created:
113
+
114
+ **Always Generated:**
115
+ ```
116
+ AGENTS.md # Universal standard
117
+ ```
118
+
119
+ **Windsurf:**
120
+ ```
121
+ .windsurfrules # Legacy format
122
+ .windsurf/
123
+ ā”œā”€ā”€ rules/
124
+ │ ā”œā”€ā”€ project-context.md
125
+ │ ā”œā”€ā”€ architecture.md
126
+ │ └── coding-standards.md
127
+ └── workflows/
128
+ ā”œā”€ā”€ review-requirements.md
129
+ └── implement-feature.md # Balanced/BMAD only
130
+ ```
131
+
132
+ **Cursor:**
133
+ ```
134
+ .cursor/
135
+ ā”œā”€ā”€ rules # Primary config
136
+ └── mcp.json # Optional (prepared)
137
+ .cursorrules # Deprecation notice
138
+ ```
139
+
140
+ **VS Code:**
141
+ ```
142
+ .github/
143
+ └── copilot-instructions.md # GitHub Copilot
144
+ .vscode/
145
+ └── settings.json # Custom chat modes
146
+ ```
147
+
148
+ ### Technical Details
149
+
150
+ **Template Variables:**
151
+ - `PROJECT_NAME` - Project name from metadata
152
+ - `SESSION_ID` - Unique session identifier
153
+ - `FRAMEWORK` - rapid/balanced/comprehensive
154
+ - Framework-specific variables (PRP_GOAL, CONSTITUTION_PRINCIPLES, PRD_OVERVIEW, etc.)
155
+ - Automatic tech stack extraction
156
+ - Code style and testing approach detection
157
+
158
+ **Character Limits:**
159
+ - Windsurf rules: 12,000 characters per file (enforced via file splitting)
160
+ - Other tools: No enforced limits
161
+
162
+ **Context Awareness:**
163
+ - Architect mode: References architecture and specification
164
+ - Implementer mode: References implementation details and tasks
165
+ - Reviewer mode: References constitution and quality standards
166
+ - All modes: Full access to framework outputs via file paths
167
+
168
+ ### Breaking Changes
169
+
170
+ None - fully backward compatible with v0.2.x
171
+
172
+ ### Migration Guide
173
+
174
+ Existing projects can immediately benefit from the new generators:
175
+
176
+ 1. Run `adf deploy <tool>` in your project directory
177
+ 2. Configurations will be generated from existing `.adf/sessions/` data
178
+ 3. All tools will recognize and use the new configurations
179
+ 4. No manual migration needed
180
+
181
+ ### Next Steps
182
+
183
+ - **Phase 3**: Enhanced MCP integration for all tools
184
+ - **Phase 4**: Live project monitoring and real-time updates
185
+ - **Phase 5**: Multi-framework project support
186
+
187
+ ## [0.2.0] - 2025-10-03
188
+
189
+ ### šŸš€ MAJOR RELEASE: Quality-Based Progress Tracking & Resume Capability
190
+
191
+ This is a **paradigm shift** in how ADF CLI measures progress. Instead of counting questions, we now measure **information richness** - recognizing that 3 thorough answers can be worth more than 20 shallow ones.
192
+
193
+ ### Added
194
+
195
+ **Quality-Based Progress System:**
196
+ - Information Richness Score (0-100%) - weighted metric combining completion and quality
197
+ - Real-time answer quality analysis with 0-100 scoring
198
+ - Quality metrics tracking: word count, keywords, required elements, detail level, technical depth
199
+ - Automatic follow-up question skipping for high-quality answers (score >= 85)
200
+ - Quality feedback displayed to users after each answer
201
+
202
+ **Resume Capability:**
203
+ - Full session save/quit/resume from exact point of interruption
204
+ - Session Manager to detect and list resumable sessions
205
+ - User prompted to resume or start new on `adf init`
206
+ - All context preserved: answers, transcript, quality metrics, current block
207
+
208
+ **Triple-Redundant Auto-Save:**
209
+ - Main progress file: `_progress.json`
210
+ - Backup file: `_progress.backup.json`
211
+ - Append-only log: `_progress-log.md`
212
+ - Emergency fallback: `_emergency-{timestamp}.json` (if all else fails)
213
+ - Auto-save after every answer, block completion, and state change
214
+
215
+ **Comprehensive Testing:**
216
+ - 33 unit tests with 78% code coverage
217
+ - Test coverage: 78% statements, 63% branches, 77% functions, 79% lines
218
+ - Tests for quality analyzer, progress tracker, session manager
219
+ - Emergency recovery scenarios tested
220
+
221
+ **Project Documentation:**
222
+ - Complete `.project/` documentation structure
223
+ - Chat history tracking (current and completed)
224
+ - Architecture documentation (system design, data flow)
225
+ - Framework methodologies documentation
226
+ - Tool integrations specification
227
+ - Project vision and goals
228
+
229
+ ### New Files
230
+
231
+ - `lib/frameworks/answer-quality-analyzer.js` - Comprehensive quality scoring engine
232
+ - `lib/frameworks/progress-tracker.js` - Real-time progress with quality metrics
233
+ - `lib/frameworks/session-manager.js` - Session listing and resume prompts
234
+ - `tests/answer-quality-analyzer.test.js` - 16 unit tests
235
+ - `tests/progress-tracker.test.js` - 12 unit tests
236
+ - `tests/session-manager.test.js` - 5 unit tests
237
+ - `jest.config.js` - Jest testing configuration
238
+ - `.project/chats/` - Chat history tracking
239
+ - `.project/docs/` - Complete project documentation
240
+
241
+ ### Changed
242
+
243
+ **Interviewer Engine:**
244
+ - Integrated quality analyzer - evaluates every answer
245
+ - Auto-save after each answer with quality metrics
246
+ - Block start/complete/skip tracking
247
+ - Quality feedback display to users
248
+ - Smart follow-up skipping based on quality
249
+
250
+ **Init Command:**
251
+ - Session resume detection on startup
252
+ - Prompts user to resume or start new
253
+ - Framework parameter tracking for resume
254
+
255
+ **Progress Display:**
256
+ - Old: `"3/20 questions (15%)"`
257
+ - New: `"šŸ“Š Information Richness: ✨ 75% | Avg Quality: 82%"`
258
+ - Shows blocks, questions, words, and quality metrics
259
+ - Emoji indicators for richness levels (🌟 ✨ šŸ’« ⭐)
260
+
261
+ ### Quality Scoring System
262
+
263
+ **Metrics (0-100 total):**
264
+ - Word count: up to 30 points (50+ words = max)
265
+ - Keyword presence: up to 20 points
266
+ - Required elements: up to 25 points (platform, tech, user interaction, etc.)
267
+ - Detail level: up to 15 points (bullets, examples, multiple sentences)
268
+ - Technical depth: up to 10 points (tech stack, versions, tools)
269
+
270
+ **Thresholds:**
271
+ - Score >= 70: Comprehensive answer
272
+ - Score >= 85: Can skip follow-up questions
273
+
274
+ **Information Richness Formula:**
275
+ ```
276
+ informationRichness = (completionFactor * 0.4) + (qualityFactor * 0.6) * 100
277
+ ```
278
+ Weighted 60% toward quality, 40% toward completion.
279
+
280
+ ### Breaking Changes
281
+
282
+ None - fully backward compatible with v0.1.x
283
+
284
+ ### Technical Debt Addressed
285
+
286
+ - Bulletproof data persistence (zero data loss)
287
+ - Comprehensive error recovery
288
+ - Test coverage for core components
289
+ - Project documentation structure
290
+
291
+ ### Next Steps
292
+
293
+ - **Option B (Phase 2)**: IDE Tool Integrations
294
+ - Windsurf customizations (.windsurfrules, memories, workflows)
295
+ - Cursor customizations (.cursorrules, modes, MCP, hooks)
296
+ - VS Code customizations (copilot-instructions, chat modes, tools API)
297
+
298
+ ### Migration Guide
299
+
300
+ No migration needed. Existing sessions from v0.1.x will continue to work. New features will be available for new sessions created with v0.2.0.
301
+
10
302
  ## [0.1.6] - 2025-10-02
11
303
 
12
304
  ### Fixed
package/jest.config.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ testEnvironment: 'node',
3
+ testMatch: ['**/tests/**/*.test.js'],
4
+ collectCoverageFrom: [
5
+ 'lib/frameworks/answer-quality-analyzer.js',
6
+ 'lib/frameworks/progress-tracker.js',
7
+ 'lib/frameworks/session-manager.js',
8
+ '!lib/**/*.test.js',
9
+ '!**/node_modules/**'
10
+ ],
11
+ coverageThreshold: {
12
+ global: {
13
+ branches: 60,
14
+ functions: 70,
15
+ lines: 70,
16
+ statements: 70
17
+ }
18
+ },
19
+ testTimeout: 10000
20
+ };
@@ -2,6 +2,12 @@ const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
4
  const ora = require('ora');
5
+ const {
6
+ generateAgentsMd,
7
+ generateWindsurf,
8
+ generateCursor,
9
+ generateVSCode
10
+ } = require('../generators');
5
11
 
6
12
  const TOOLS = {
7
13
  windsurf: { name: 'Windsurf', configFile: '.windsurfrules' },
@@ -15,6 +21,60 @@ const TOOLS = {
15
21
  'codex-cli': { name: 'Codex CLI', configFile: '.codex/config.json' }
16
22
  };
17
23
 
24
+ /**
25
+ * Find the latest completed session
26
+ */
27
+ async function findLatestSession(cwd) {
28
+ const sessionsDir = path.join(cwd, '.adf', 'sessions');
29
+
30
+ if (!await fs.pathExists(sessionsDir)) {
31
+ return null;
32
+ }
33
+
34
+ const sessions = await fs.readdir(sessionsDir);
35
+ if (sessions.length === 0) {
36
+ return null;
37
+ }
38
+
39
+ // Find most recent session with outputs
40
+ let latestSession = null;
41
+ let latestTime = 0;
42
+
43
+ for (const sessionId of sessions) {
44
+ const sessionPath = path.join(sessionsDir, sessionId);
45
+ const outputsPath = path.join(sessionPath, 'outputs');
46
+
47
+ if (await fs.pathExists(outputsPath)) {
48
+ const stats = await fs.stat(sessionPath);
49
+ if (stats.mtimeMs > latestTime) {
50
+ latestTime = stats.mtimeMs;
51
+ latestSession = sessionPath;
52
+ }
53
+ }
54
+ }
55
+
56
+ return latestSession;
57
+ }
58
+
59
+ /**
60
+ * Get framework type from session metadata
61
+ */
62
+ async function getFrameworkFromSession(sessionPath) {
63
+ const metadataPath = path.join(sessionPath, '_metadata.json');
64
+ if (await fs.pathExists(metadataPath)) {
65
+ const metadata = await fs.readJson(metadataPath);
66
+ return metadata.framework;
67
+ }
68
+
69
+ const progressPath = path.join(sessionPath, '_progress.json');
70
+ if (await fs.pathExists(progressPath)) {
71
+ const progress = await fs.readJson(progressPath);
72
+ return progress.framework;
73
+ }
74
+
75
+ return 'balanced'; // Default fallback
76
+ }
77
+
18
78
  async function deployToTool(tool, options = {}) {
19
79
  const cwd = process.cwd();
20
80
  const adfDir = path.join(cwd, '.adf');
@@ -26,22 +86,80 @@ async function deployToTool(tool, options = {}) {
26
86
  process.exit(1);
27
87
  }
28
88
 
29
- // Read context to get workflow
89
+ // Find latest session
90
+ const sessionPath = await findLatestSession(cwd);
91
+ if (!sessionPath) {
92
+ console.error(chalk.red('\nāŒ Error: No completed sessions found.'));
93
+ console.log(chalk.yellow('Run "adf init" to create requirements first.\n'));
94
+ process.exit(1);
95
+ }
96
+
97
+ const framework = await getFrameworkFromSession(sessionPath);
98
+
99
+ // Read context to get workflow (legacy support)
30
100
  const contextPath = path.join(adfDir, 'context.json');
31
101
  let context = {};
32
102
  if (await fs.pathExists(contextPath)) {
33
103
  context = await fs.readJson(contextPath);
34
104
  }
35
105
 
36
- const workflow = context.workflow || 'balanced';
106
+ const workflow = framework || context.workflow || 'balanced';
37
107
 
38
- // Deploy logic (simplified - will be implemented based on actual deploy script)
39
108
  const spinner = options.silent ? null : ora(`Deploying to ${TOOLS[tool]?.name || tool}...`).start();
40
109
 
41
110
  try {
111
+ // Generate AGENTS.md (universal standard)
112
+ if (!options.silent) {
113
+ if (spinner) spinner.text = 'Generating AGENTS.md...';
114
+ }
115
+
116
+ try {
117
+ await generateAgentsMd(sessionPath, cwd, framework);
118
+ if (!options.silent && !spinner) {
119
+ console.log(chalk.green('āœ“ Generated AGENTS.md'));
120
+ }
121
+ } catch (error) {
122
+ console.warn(chalk.yellow(`\nāš ļø Warning: Could not generate AGENTS.md: ${error.message}`));
123
+ }
124
+
125
+ // Generate tool-specific configurations
126
+ if (spinner) spinner.text = `Generating ${TOOLS[tool]?.name || tool} configurations...`;
127
+
128
+ try {
129
+ let generatedFiles = {};
130
+
131
+ if (tool === 'windsurf') {
132
+ generatedFiles = await generateWindsurf(sessionPath, cwd, framework);
133
+ if (!options.silent && !spinner) {
134
+ console.log(chalk.green('āœ“ Generated Windsurf configurations'));
135
+ console.log(chalk.gray(` - .windsurfrules (legacy)`));
136
+ console.log(chalk.gray(` - .windsurf/rules/*.md (${generatedFiles.rules?.length || 0} files)`));
137
+ console.log(chalk.gray(` - .windsurf/workflows/*.md (${generatedFiles.workflows?.length || 0} files)`));
138
+ }
139
+ } else if (tool === 'cursor') {
140
+ generatedFiles = await generateCursor(sessionPath, cwd, framework);
141
+ if (!options.silent && !spinner) {
142
+ console.log(chalk.green('āœ“ Generated Cursor configurations'));
143
+ console.log(chalk.gray(` - .cursor/rules`));
144
+ console.log(chalk.gray(` - .cursorrules (deprecation notice)`));
145
+ }
146
+ } else if (tool === 'vscode' || tool === 'vscode-insider') {
147
+ generatedFiles = await generateVSCode(sessionPath, cwd, framework);
148
+ if (!options.silent && !spinner) {
149
+ console.log(chalk.green('āœ“ Generated VS Code configurations'));
150
+ console.log(chalk.gray(` - .github/copilot-instructions.md`));
151
+ console.log(chalk.gray(` - .vscode/settings.json (custom chat modes)`));
152
+ }
153
+ }
154
+ } catch (error) {
155
+ console.warn(chalk.yellow(`\nāš ļø Warning: Could not generate ${TOOLS[tool]?.name || tool} configurations: ${error.message}`));
156
+ }
157
+
42
158
  // Get agents based on workflow
43
159
  const agentsList = getAgentsForWorkflow(workflow);
44
160
 
161
+ if (spinner) spinner.text = `Deploying to ${TOOLS[tool]?.name || tool}...`;
162
+
45
163
  // Copy agents
46
164
  const agentsDir = path.join(cwd, '.framework', 'agents');
47
165
  await fs.ensureDir(agentsDir);
@@ -82,6 +200,7 @@ async function deployToTool(tool, options = {}) {
82
200
  }
83
201
 
84
202
  if (!options.silent) {
203
+ console.log(chalk.gray(` Generated: AGENTS.md (universal AI agent config)`));
85
204
  console.log(chalk.gray(` Agents: ${agentsList.join(', ')}`));
86
205
  console.log(chalk.gray(` Config: ${toolConfig?.configFile || 'N/A'}\n`));
87
206
  }
@@ -5,18 +5,33 @@ const chalk = require('chalk');
5
5
  const ora = require('ora');
6
6
  const {
7
7
  detectProjectType,
8
- getWorkflowRecommendation,
9
- generateContextFile
8
+ getWorkflowRecommendation
10
9
  } = require('../utils/project-detector');
11
- const { copyTemplates } = require('../utils/copy-templates');
10
+ const Interviewer = require('../frameworks/interviewer');
11
+ const SessionManager = require('../frameworks/session-manager');
12
12
  const { deployToTool } = require('./deploy');
13
13
 
14
14
  async function init(options) {
15
- console.log(chalk.cyan.bold('\nšŸš€ AgentDevFramework Initialization\n'));
15
+ console.log(chalk.cyan.bold('\nšŸš€ AgentDevFramework - Software Development Requirements\n'));
16
16
 
17
17
  const cwd = process.cwd();
18
18
  const adfDir = path.join(cwd, '.adf');
19
19
 
20
+ // Check for resumable sessions FIRST (before asking to overwrite)
21
+ const sessionManager = new SessionManager(cwd);
22
+ const existingSession = await sessionManager.promptToResume();
23
+
24
+ if (existingSession) {
25
+ // Resume existing session
26
+ const interviewer = new Interviewer(existingSession.progress.framework || 'balanced', cwd, existingSession);
27
+ const sessionPath = await interviewer.start();
28
+
29
+ console.log(chalk.green.bold('\n✨ Requirements gathering complete!\n'));
30
+ console.log(chalk.cyan(`šŸ“ Session saved to: ${sessionPath}\n`));
31
+
32
+ return;
33
+ }
34
+
20
35
  // Check if already initialized
21
36
  if (await fs.pathExists(adfDir)) {
22
37
  const { overwrite } = await inquirer.prompt([
@@ -41,132 +56,59 @@ async function init(options) {
41
56
  const projectType = await detectProjectType(cwd);
42
57
  spinner.succeed(`Project type: ${chalk.green(projectType.type)}`);
43
58
 
44
- // Determine workflow
59
+ // Determine workflow/framework
45
60
  let workflow;
46
61
 
47
62
  if (options.rapid) {
48
63
  workflow = 'rapid';
49
- console.log(chalk.blue('Using Level 1 (Rapid Development) - from --rapid flag'));
64
+ console.log(chalk.blue('\nUsing: PRP Framework (Rapid Development) - from --rapid flag'));
50
65
  } else if (options.balanced) {
51
66
  workflow = 'balanced';
52
- console.log(chalk.blue('Using Level 2 (Balanced) - from --balanced flag'));
67
+ console.log(chalk.blue('\nUsing: PRP + Spec-Kit (Balanced) - from --balanced flag'));
53
68
  } else if (options.comprehensive) {
54
69
  workflow = 'comprehensive';
55
- console.log(chalk.blue('Using Level 3 (Comprehensive) - from --comprehensive flag'));
70
+ console.log(chalk.blue('\nUsing: BMAD Framework (Comprehensive) - from --comprehensive flag'));
56
71
  } else {
57
72
  // Interactive workflow selection
58
73
  workflow = await getWorkflowRecommendation(projectType);
59
74
  }
60
75
 
61
- // Gather documentation URLs (optional)
62
- const { hasDocs } = await inquirer.prompt([
63
- {
64
- type: 'confirm',
65
- name: 'hasDocs',
66
- message: 'Do you have documentation URLs to include?',
67
- default: false
68
- }
69
- ]);
70
-
71
- let documentationUrls = [];
72
- if (hasDocs) {
73
- const { urls } = await inquirer.prompt([
74
- {
75
- type: 'input',
76
- name: 'urls',
77
- message: 'Enter documentation URLs (comma-separated):',
78
- filter: (input) => input.split(',').map(url => url.trim()).filter(Boolean)
79
- }
80
- ]);
81
- documentationUrls = urls;
82
- }
83
-
84
- // Gather local documentation files (optional)
85
- const { hasLocalDocs } = await inquirer.prompt([
86
- {
87
- type: 'confirm',
88
- name: 'hasLocalDocs',
89
- message: 'Do you have local documentation files to include? (use "." as the project root folder & add like so "./docs/")',
90
- default: false
91
- }
92
- ]);
76
+ // Create .adf directory
77
+ await fs.ensureDir(adfDir);
93
78
 
94
- let documentationFiles = [];
95
- if (hasLocalDocs) {
96
- const { files } = await inquirer.prompt([
97
- {
98
- type: 'input',
99
- name: 'files',
100
- message: 'Enter local documentation paths (comma-separated, e.g., ./docs/, ./README.md):',
101
- filter: (input) => input.split(',').map(file => file.trim()).filter(Boolean)
102
- }
103
- ]);
104
- documentationFiles = files;
105
- }
79
+ // Start AI-guided interview
80
+ console.log(chalk.gray('\n' + '━'.repeat(60)) + '\n');
106
81
 
107
- // Copy framework templates
108
- const copySpinner = ora('Copying framework files...').start();
109
- await copyTemplates(cwd);
110
- copySpinner.succeed('Framework files copied to .adf/');
111
-
112
- // Generate context file
113
- const context = generateContextFile({
114
- workflow,
115
- projectType: projectType.type,
116
- documentationUrls,
117
- documentationFiles,
118
- timestamp: new Date().toISOString()
119
- });
120
-
121
- await fs.writeJson(path.join(adfDir, 'context.json'), context, { spaces: 2 });
122
- console.log(chalk.green('āœ“ Created .adf/context.json'));
123
-
124
- // Copy .env.template to project root
125
- const envTemplateSrc = path.join(__dirname, '../templates/.env.template');
126
- const envTemplateDest = path.join(cwd, '.env.template');
127
-
128
- if (await fs.pathExists(envTemplateSrc)) {
129
- await fs.copy(envTemplateSrc, envTemplateDest);
130
- console.log(chalk.green('āœ“ Created .env.template'));
131
- }
82
+ const interviewer = new Interviewer(workflow, cwd);
83
+ const sessionPath = await interviewer.start();
132
84
 
133
- // Deploy to tool if specified
134
- let deployNow = false;
85
+ // Show next steps
86
+ console.log(chalk.cyan('šŸ“‹ Next Steps:\n'));
87
+ console.log(chalk.gray(` 1. Review your requirements: ${sessionPath}/outputs/`));
88
+ console.log(chalk.gray(` 2. Share the output files with your AI coding assistant`));
89
+ console.log(chalk.gray(` 3. Start building based on the detailed requirements\n`));
135
90
 
91
+ // Optional: Deploy to tool
136
92
  if (options.tool) {
137
93
  console.log('');
138
94
  await deployToTool(options.tool, { silent: false });
139
- deployNow = true;
140
95
  } else {
141
- // Ask if they want to deploy now
142
- const response = await inquirer.prompt([
96
+ const { deployNow } = await inquirer.prompt([
143
97
  {
144
98
  type: 'confirm',
145
99
  name: 'deployNow',
146
- message: 'Deploy to a development tool now?',
147
- default: true
100
+ message: 'Deploy framework to a development tool?',
101
+ default: false
148
102
  }
149
103
  ]);
150
104
 
151
- deployNow = response.deployNow;
152
-
153
105
  if (deployNow) {
154
106
  const { tool } = await inquirer.prompt([
155
107
  {
156
108
  type: 'list',
157
109
  name: 'tool',
158
- message: 'Select deployment tool:',
159
- choices: [
160
- 'windsurf',
161
- 'cursor',
162
- 'vscode',
163
- 'vscode-insider',
164
- 'kiro',
165
- 'trae',
166
- 'claude-code',
167
- 'gemini-cli',
168
- 'codex-cli'
169
- ]
110
+ message: 'Select tool:',
111
+ choices: ['windsurf', 'cursor', 'vscode', 'claude-code', 'gemini-cli']
170
112
  }
171
113
  ]);
172
114
 
@@ -175,21 +117,7 @@ async function init(options) {
175
117
  }
176
118
  }
177
119
 
178
- // Success message
179
- console.log(chalk.green.bold('\n✨ Initialization complete!\n'));
180
-
181
- console.log(chalk.cyan('Next steps:'));
182
- console.log(chalk.gray(' 1. Review .adf/context.json'));
183
- console.log(chalk.gray(' 2. Copy .env.template to .env and configure'));
184
- if (!deployNow) {
185
- console.log(chalk.gray(' 3. Run "adf deploy <tool>" to deploy to your editor'));
186
- console.log(chalk.gray(' 4. Check documentation: .adf/shared/templates/\n'));
187
- } else {
188
- console.log(chalk.gray(' 3. Check documentation: .adf/shared/templates/\n'));
189
- }
190
-
191
- console.log(chalk.blue(`Workflow: ${workflow === 'rapid' ? 'Level 1 (Rapid)' : workflow === 'balanced' ? 'Level 2 (Balanced)' : 'Level 3 (Comprehensive)'}`));
192
- console.log(chalk.gray('Run "adf deploy --list" to see available tools\n'));
120
+ console.log(chalk.green.bold('\nāœ… All done! Happy coding! šŸš€\n'));
193
121
  }
194
122
 
195
123
  module.exports = init;