claude-flow-novice 1.1.8 → 1.1.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 (30) hide show
  1. package/dist/mcp/mcp-server-novice.js +10 -2
  2. package/dist/src/cli/simple-commands/hooks/session-start-soul.js +271 -0
  3. package/dist/src/slash-commands/README.md +157 -0
  4. package/dist/src/slash-commands/claude-md.js +237 -0
  5. package/dist/src/slash-commands/claude-soul.js +562 -0
  6. package/dist/src/slash-commands/cli-integration.js +216 -0
  7. package/dist/src/slash-commands/github.js +638 -0
  8. package/dist/src/slash-commands/hooks.js +648 -0
  9. package/dist/src/slash-commands/index.js +115 -0
  10. package/dist/src/slash-commands/neural.js +572 -0
  11. package/dist/src/slash-commands/performance.js +582 -0
  12. package/dist/src/slash-commands/register-all-commands.js +314 -0
  13. package/dist/src/slash-commands/register-claude-md.js +82 -0
  14. package/dist/src/slash-commands/register-claude-soul.js +80 -0
  15. package/dist/src/slash-commands/sparc.js +110 -0
  16. package/dist/src/slash-commands/swarm.js +423 -0
  17. package/dist/src/slash-commands/validate-commands.js +223 -0
  18. package/dist/src/slash-commands/workflow.js +606 -0
  19. package/package.json +8 -7
  20. package/src/slash-commands/cli-integration.js +216 -0
  21. package/src/slash-commands/github.js +638 -0
  22. package/src/slash-commands/hooks.js +648 -0
  23. package/src/slash-commands/index.js +115 -0
  24. package/src/slash-commands/neural.js +572 -0
  25. package/src/slash-commands/performance.js +582 -0
  26. package/src/slash-commands/register-all-commands.js +314 -0
  27. package/src/slash-commands/sparc.js +110 -0
  28. package/src/slash-commands/swarm.js +423 -0
  29. package/src/slash-commands/validate-commands.js +223 -0
  30. package/src/slash-commands/workflow.js +606 -0
@@ -565,11 +565,19 @@ async function main() {
565
565
  console.error(`[${new Date().toISOString()}] INFO [claude-flow-novice-mcp] Server starting with ${toolCount} essential tools`);
566
566
  }
567
567
 
568
- if (require.main === module) {
568
+ // ES module entry point detection
569
+ import { fileURLToPath } from 'url';
570
+ import { dirname } from 'path';
571
+
572
+ const __filename = fileURLToPath(import.meta.url);
573
+ const __dirname = dirname(__filename);
574
+
575
+ // Check if this file is being run directly
576
+ if (import.meta.url === `file://${process.argv[1]}`) {
569
577
  main().catch((error) => {
570
578
  console.error(`[${new Date().toISOString()}] FATAL [claude-flow-novice-mcp] ${error.message}`);
571
579
  process.exit(1);
572
580
  });
573
581
  }
574
582
 
575
- module.exports = { ClaudeFlowNoviceMCPServer };
583
+ export { ClaudeFlowNoviceMCPServer };
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Claude Code Session Start Hook - Soul Integration
5
+ *
6
+ * Automatically feeds claude-soul.md content into Claude Code sessions
7
+ * Handles graceful errors when the file is missing
8
+ */
9
+
10
+ import fs from 'fs/promises';
11
+ import path from 'path';
12
+ import { printSuccess, printError, printWarning } from '../../utils.js';
13
+
14
+ export class SessionStartSoulHook {
15
+ constructor(projectPath = process.cwd()) {
16
+ this.projectPath = projectPath;
17
+ this.claudeSoulPath = path.join(projectPath, 'claude-soul.md');
18
+ this.hookName = 'session-start-soul';
19
+ }
20
+
21
+ /**
22
+ * Execute the session start hook
23
+ */
24
+ async execute(options = {}) {
25
+ const {
26
+ silent = false,
27
+ generateMissing = true,
28
+ fallbackToDefault = true
29
+ } = options;
30
+
31
+ try {
32
+ if (!silent) {
33
+ console.log('🚀 Session Start: Loading project soul...');
34
+ }
35
+
36
+ const soulContent = await this.loadOrGenerateSoul({
37
+ generateMissing,
38
+ fallbackToDefault
39
+ });
40
+
41
+ if (soulContent) {
42
+ // Log the soul loading for integration tracking
43
+ await this.logSoulLoad(soulContent, { silent });
44
+
45
+ if (!silent) {
46
+ printSuccess('✅ Project soul available for Claude Code session');
47
+ console.log(`📖 Soul file: claude-soul.md (${soulContent.length} chars)`);
48
+ }
49
+
50
+ return {
51
+ success: true,
52
+ action: 'soul-loaded',
53
+ contentLength: soulContent.length,
54
+ source: await this.fileExists(this.claudeSoulPath) ? 'file' : 'generated'
55
+ };
56
+ } else {
57
+ if (!silent) {
58
+ printWarning('⚠️ No project soul available - continuing without soul context');
59
+ }
60
+
61
+ return {
62
+ success: true,
63
+ action: 'no-soul',
64
+ message: 'Session started without soul context'
65
+ };
66
+ }
67
+
68
+ } catch (error) {
69
+ if (!silent) {
70
+ printError(`❌ Session start soul hook failed: ${error.message}`);
71
+ }
72
+
73
+ return {
74
+ success: false,
75
+ action: 'error',
76
+ error: error.message
77
+ };
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Load existing soul or generate one if missing
83
+ */
84
+ async loadOrGenerateSoul(options = {}) {
85
+ const { generateMissing = true, fallbackToDefault = true } = options;
86
+
87
+ try {
88
+ // Try to load existing soul file
89
+ if (await this.fileExists(this.claudeSoulPath)) {
90
+ const content = await fs.readFile(this.claudeSoulPath, 'utf8');
91
+ console.log('📖 Loading existing claude-soul.md');
92
+ return content;
93
+ }
94
+
95
+ // File doesn't exist - handle based on options
96
+ if (generateMissing) {
97
+ console.log('🔄 claude-soul.md not found, generating...');
98
+ return await this.generateDefaultSoul();
99
+ }
100
+
101
+ if (fallbackToDefault) {
102
+ console.log('🔄 Using minimal project soul...');
103
+ return this.getMinimalSoul();
104
+ }
105
+
106
+ return null;
107
+
108
+ } catch (error) {
109
+ console.warn(`⚠️ Could not load project soul: ${error.message}`);
110
+
111
+ if (fallbackToDefault) {
112
+ return this.getMinimalSoul();
113
+ }
114
+
115
+ return null;
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Generate a default soul document
121
+ */
122
+ async generateDefaultSoul() {
123
+ try {
124
+ // Import the soul generator
125
+ const { ClaudeSoulSlashCommand } = await import('../../slash-commands/claude-soul.js');
126
+ const generator = new ClaudeSoulSlashCommand(this.projectPath);
127
+
128
+ const result = await generator.execute({ backup: false });
129
+
130
+ if (result.success) {
131
+ const content = await fs.readFile(this.claudeSoulPath, 'utf8');
132
+ console.log('✅ Generated claude-soul.md for session');
133
+ return content;
134
+ } else {
135
+ throw new Error(`Soul generation failed: ${result.error}`);
136
+ }
137
+
138
+ } catch (error) {
139
+ console.warn(`⚠️ Could not generate soul: ${error.message}`);
140
+ return this.getMinimalSoul();
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Get minimal soul content as fallback
146
+ */
147
+ getMinimalSoul() {
148
+ const projectName = path.basename(this.projectPath);
149
+
150
+ return `# ${projectName} - Project Soul
151
+
152
+ ## WHY - The Purpose
153
+ This project aims to solve important problems through software.
154
+
155
+ ## WHAT - The Essence
156
+ A software project focused on delivering value through clean, maintainable code.
157
+
158
+ ## HOW - The Approach
159
+ Following best practices and iterative development.
160
+
161
+ ## SOUL - The Spirit
162
+ Committed to quality, simplicity, and user-centric design.
163
+
164
+ ---
165
+ *Minimal soul context - generate full claude-soul.md for complete project essence*
166
+ `;
167
+ }
168
+
169
+ /**
170
+ * Log soul loading for integration tracking
171
+ */
172
+ async logSoulLoad(soulContent, options = {}) {
173
+ const { silent = false } = options;
174
+
175
+ try {
176
+ if (!silent) {
177
+ console.log('📋 Project soul ready for Claude Code session context');
178
+ }
179
+
180
+ // Log hook execution for integration with other systems
181
+ await this.logHookExecution(soulContent);
182
+
183
+ } catch (error) {
184
+ console.warn(`⚠️ Could not log soul loading: ${error.message}`);
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Log hook execution for integration with other systems
190
+ */
191
+ async logHookExecution(soulContent) {
192
+ try {
193
+ // Try to use memory store if available
194
+ const { SqliteMemoryStore } = await import('../../../memory/sqlite-store.js');
195
+ const store = new SqliteMemoryStore();
196
+ await store.initialize();
197
+
198
+ const hookData = {
199
+ hookName: this.hookName,
200
+ executedAt: new Date().toISOString(),
201
+ soulContentLength: soulContent.length,
202
+ soulPreview: soulContent.substring(0, 200) + '...',
203
+ projectPath: this.projectPath
204
+ };
205
+
206
+ await store.store(`session-start:${Date.now()}`, hookData, {
207
+ namespace: 'session-hooks',
208
+ metadata: { type: 'session-start', hook: this.hookName }
209
+ });
210
+
211
+ store.close();
212
+
213
+ } catch (error) {
214
+ // Silent fail - memory store is optional
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Check if file exists
220
+ */
221
+ async fileExists(filePath) {
222
+ try {
223
+ await fs.access(filePath);
224
+ return true;
225
+ } catch {
226
+ return false;
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Clean up (no files to clean since we use claude-soul.md directly)
232
+ */
233
+ async cleanup() {
234
+ // No cleanup needed since we read claude-soul.md directly
235
+ console.log('🧹 Session soul cleanup completed (no temporary files)');
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Execute the session start soul hook
241
+ */
242
+ export async function executeSessionStartSoulHook(args = {}) {
243
+ const hook = new SessionStartSoulHook();
244
+
245
+ const options = {
246
+ silent: args.silent || args.includes('--silent'),
247
+ generateMissing: !args.includes('--no-generate'),
248
+ fallbackToDefault: !args.includes('--no-fallback')
249
+ };
250
+
251
+ return await hook.execute(options);
252
+ }
253
+
254
+ /**
255
+ * Execute session end cleanup
256
+ */
257
+ export async function executeSessionEndSoulHook() {
258
+ const hook = new SessionStartSoulHook();
259
+ return await hook.cleanup();
260
+ }
261
+
262
+ // For direct execution
263
+ if (import.meta.url === `file://${process.argv[1]}`) {
264
+ const args = process.argv.slice(2);
265
+
266
+ if (args.includes('--cleanup') || args.includes('cleanup')) {
267
+ executeSessionEndSoulHook();
268
+ } else {
269
+ executeSessionStartSoulHook(args);
270
+ }
271
+ }
@@ -0,0 +1,157 @@
1
+ # CLAUDE.md Slash Command System
2
+
3
+ ## 🎯 Simple, Focused CLAUDE.md Generation
4
+
5
+ A lightweight slash command system for generating CLAUDE.md files with NPX protection.
6
+
7
+ ## 📋 Features
8
+
9
+ ### ✅ **Simple Slash Command**
10
+ ```bash
11
+ /claude-md # Generate CLAUDE.md for current project
12
+ /claude-md --preview # Show what would be generated
13
+ /claude-md --force # Overwrite without confirmation
14
+ /claude-md --detect # Auto-detect project and show recommendations
15
+ /claude-md --no-backup # Skip backup creation
16
+ ```
17
+
18
+ ### 🛡️ **NPX Protection System**
19
+ - **Problem**: NPX installs overwrite customized CLAUDE.md files
20
+ - **Solution**: Generate `claude-copy-to-main.md` when existing CLAUDE.md detected
21
+ - **Benefit**: User customizations are never lost
22
+
23
+ ### 🔄 **Integration Flow**
24
+
25
+ **Normal Usage (Slash Command):**
26
+ 1. User runs `/claude-md`
27
+ 2. System detects project type
28
+ 3. Generates appropriate CLAUDE.md
29
+ 4. Creates backup if file exists
30
+
31
+ **NPX Install Protection:**
32
+ 1. NPX installs claude-flow-novice
33
+ 2. `postinstall` script runs
34
+ 3. Detects existing CLAUDE.md
35
+ 4. Creates `claude-copy-to-main.md` instead
36
+ 5. User manually merges desired changes
37
+
38
+ ## 🏗️ Architecture
39
+
40
+ ### **Files:**
41
+ - `claude-md.js` - Core slash command implementation
42
+ - `register-claude-md.js` - Slash command registration
43
+ - `../npx/claude-md-protection.js` - NPX protection logic
44
+ - `../../scripts/post-install-claude-md.js` - Post-install hook
45
+
46
+ ### **Integration Points:**
47
+ - **Existing Generator**: Uses `../language/claude-md-generator.js`
48
+ - **Language Detection**: Uses `../language/language-detector.js`
49
+ - **Preferences**: Reads `.claude-flow-novice/preferences/generation.json`
50
+ - **Package.json**: `postinstall` script triggers protection
51
+
52
+ ## 🎮 Usage Examples
53
+
54
+ ### **Basic Generation:**
55
+ ```bash
56
+ # Generate CLAUDE.md for current project
57
+ /claude-md
58
+
59
+ # Output:
60
+ # 🚀 Generating CLAUDE.md...
61
+ # ✅ CLAUDE.md generated successfully
62
+ ```
63
+
64
+ ### **Preview Mode:**
65
+ ```bash
66
+ # See what would be generated
67
+ /claude-md --preview
68
+
69
+ # Output:
70
+ # 📄 CLAUDE.md Preview:
71
+ # ══════════════════════════════════════════════════
72
+ # # Claude Code Configuration - JavaScript Project
73
+ # ...
74
+ # ══════════════════════════════════════════════════
75
+ # 📊 Total length: 2,847 characters
76
+ ```
77
+
78
+ ### **NPX Protection:**
79
+ ```bash
80
+ # When NPX detects existing CLAUDE.md
81
+ npm install claude-flow-novice
82
+
83
+ # Output:
84
+ # 🛡️ NPX Protection Activated
85
+ # 📄 Generated: claude-copy-to-main.md
86
+ # 💡 Your existing CLAUDE.md is protected from overwrite
87
+ # 🔄 Review and merge changes manually as needed
88
+ ```
89
+
90
+ ## 🧠 Smart Detection
91
+
92
+ ### **Project Type Detection:**
93
+ - Analyzes `package.json`, file patterns, and directory structure
94
+ - Detects frameworks (React, Express, Django, etc.)
95
+ - Suggests appropriate CLAUDE.md configurations
96
+
97
+ ### **Confidence Levels:**
98
+ - **High (>70%)**: Automatic generation recommended
99
+ - **Medium (30-70%)**: Generate with user confirmation
100
+ - **Low (<30%)**: Manual review suggested
101
+
102
+ ## 🔧 Configuration
103
+
104
+ ### **Generation Preferences:**
105
+ `.claude-flow-novice/preferences/generation.json`:
106
+ ```json
107
+ {
108
+ "autoGenerate": true,
109
+ "includeFrameworkSpecific": true,
110
+ "includeBestPractices": true,
111
+ "backupExisting": true,
112
+ "confidenceThreshold": 0.3
113
+ }
114
+ ```
115
+
116
+ ### **NPX Detection:**
117
+ - Environment variables (`NPX_INSTALL=true`)
118
+ - Temporary directory patterns (`/.npm/_npx/`)
119
+ - Package.json analysis (fresh installs)
120
+
121
+ ## 🎯 Design Principles
122
+
123
+ ### **Keep It Simple:**
124
+ - Single focused command
125
+ - Minimal configuration
126
+ - Clear user feedback
127
+ - No feature bloat
128
+
129
+ ### **Protect User Work:**
130
+ - Never overwrite without permission
131
+ - Always offer backup options
132
+ - Provide clear merge instructions
133
+ - Preserve customizations
134
+
135
+ ### **Smart Defaults:**
136
+ - Auto-detect project type
137
+ - Use appropriate templates
138
+ - Respect user preferences
139
+ - Fail safely
140
+
141
+ ## 🚀 Future Enhancements
142
+
143
+ ### **Potential Improvements (If Needed):**
144
+ - Interactive confirmation prompts
145
+ - Template customization options
146
+ - Multi-project detection
147
+ - Advanced merge assistance
148
+
149
+ ### **Not Planned (Avoiding Bloat):**
150
+ - SQLite analysis integration
151
+ - Multi-file scaffolding
152
+ - Complex workflow automation
153
+ - Enterprise features
154
+
155
+ ---
156
+
157
+ **Simple, focused, and protective - exactly what CLAUDE.md generation should be!** 🎯
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLAUDE.md Slash Command
5
+ *
6
+ * Simple wrapper around the existing CLAUDE.md generator with NPX protection
7
+ * Keeps it focused and lightweight - no bloat!
8
+ */
9
+
10
+ import { ClaudeMdGenerator } from '../language/claude-md-generator.js';
11
+ import { LanguageDetector } from '../language/language-detector.js';
12
+ import fs from 'fs/promises';
13
+ import path from 'path';
14
+
15
+ export class ClaudeMdSlashCommand {
16
+ constructor(projectPath = process.cwd()) {
17
+ this.projectPath = projectPath;
18
+ this.claudeMdPath = path.join(projectPath, 'CLAUDE.md');
19
+ this.copyToMainPath = path.join(projectPath, 'claude-copy-to-main.md');
20
+ }
21
+
22
+ /**
23
+ * Main slash command execution
24
+ */
25
+ async execute(options = {}) {
26
+ const {
27
+ backup = true,
28
+ preview = false,
29
+ force = false,
30
+ isNpxInstall = false
31
+ } = options;
32
+
33
+ try {
34
+ console.log('🚀 Generating CLAUDE.md...');
35
+
36
+ // Step 1: Detect if this is an NPX install scenario
37
+ const existingClaudeExists = await this.fileExists(this.claudeMdPath);
38
+ const shouldUseNpxProtection = isNpxInstall && existingClaudeExists;
39
+
40
+ // Step 2: Generate content using existing system
41
+ const generator = new ClaudeMdGenerator(this.projectPath, {
42
+ backupExisting: backup && !shouldUseNpxProtection,
43
+ preserveCustomSections: true
44
+ });
45
+
46
+ const newContent = await generator.generateClaudeMd();
47
+
48
+ // Step 3: Handle NPX protection
49
+ if (shouldUseNpxProtection) {
50
+ await this.handleNpxProtection(newContent);
51
+ return {
52
+ success: true,
53
+ action: 'npx-protection',
54
+ file: 'claude-copy-to-main.md',
55
+ message: 'Generated claude-copy-to-main.md to protect your existing CLAUDE.md'
56
+ };
57
+ }
58
+
59
+ // Step 4: Handle preview mode
60
+ if (preview) {
61
+ return {
62
+ success: true,
63
+ action: 'preview',
64
+ content: newContent,
65
+ message: 'Preview generated successfully'
66
+ };
67
+ }
68
+
69
+ // Step 5: Handle force/confirmation for existing files
70
+ if (existingClaudeExists && !force) {
71
+ const shouldOverwrite = await this.confirmOverwrite();
72
+ if (!shouldOverwrite) {
73
+ return {
74
+ success: false,
75
+ action: 'cancelled',
76
+ message: 'Generation cancelled by user'
77
+ };
78
+ }
79
+ }
80
+
81
+ // Step 6: Write the file
82
+ await fs.writeFile(this.claudeMdPath, newContent, 'utf8');
83
+
84
+ console.log('✅ CLAUDE.md generated successfully');
85
+ return {
86
+ success: true,
87
+ action: 'generated',
88
+ file: 'CLAUDE.md',
89
+ length: newContent.length
90
+ };
91
+
92
+ } catch (error) {
93
+ console.error('❌ CLAUDE.md generation failed:', error.message);
94
+ return {
95
+ success: false,
96
+ action: 'error',
97
+ error: error.message
98
+ };
99
+ }
100
+ }
101
+
102
+ /**
103
+ * NPX Protection: Generate claude-copy-to-main.md instead of overwriting
104
+ */
105
+ async handleNpxProtection(newContent) {
106
+ const protectedContent = this.createProtectedContent(newContent);
107
+
108
+ await fs.writeFile(this.copyToMainPath, protectedContent, 'utf8');
109
+
110
+ console.log('🛡️ NPX Protection Activated');
111
+ console.log('📄 Generated: claude-copy-to-main.md');
112
+ console.log('💡 Your existing CLAUDE.md is protected from overwrite');
113
+ console.log('🔄 Review and merge changes manually as needed');
114
+ }
115
+
116
+ /**
117
+ * Create content for the protected file with merge instructions
118
+ */
119
+ createProtectedContent(newContent) {
120
+ return `# 🛡️ NPX-Protected CLAUDE.md Content
121
+
122
+ ## 📋 Merge Instructions
123
+
124
+ This file was generated because you have an existing CLAUDE.md file.
125
+ To protect your customizations from being overwritten by NPX installs,
126
+ the new content is provided here for manual review and merging.
127
+
128
+ ### 🔄 How to Merge:
129
+ 1. Review the content below
130
+ 2. Copy sections you want to your main CLAUDE.md
131
+ 3. Delete this file when done
132
+ 4. Your customizations remain safe!
133
+
134
+ ---
135
+
136
+ # Generated CLAUDE.md Content
137
+
138
+ ${newContent}
139
+
140
+ ---
141
+
142
+ ## 🗑️ Cleanup
143
+ Delete this file after merging: \`rm claude-copy-to-main.md\`
144
+ `;
145
+ }
146
+
147
+ /**
148
+ * Simple confirmation prompt for overwriting existing files
149
+ */
150
+ async confirmOverwrite() {
151
+ // In a real implementation, this would use readline or similar
152
+ // For now, return true (could be enhanced with proper prompting)
153
+ console.log('⚠️ CLAUDE.md exists. Use --force to overwrite or --preview to see changes.');
154
+ return false;
155
+ }
156
+
157
+ /**
158
+ * Check if file exists
159
+ */
160
+ async fileExists(filePath) {
161
+ try {
162
+ await fs.access(filePath);
163
+ return true;
164
+ } catch {
165
+ return false;
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Show preview of what would be generated
171
+ */
172
+ async showPreview() {
173
+ const result = await this.execute({ preview: true });
174
+
175
+ if (result.success) {
176
+ console.log('📄 CLAUDE.md Preview:');
177
+ console.log('━'.repeat(50));
178
+ console.log(result.content.substring(0, 1000) + '...');
179
+ console.log('━'.repeat(50));
180
+ console.log(`📊 Total length: ${result.content.length} characters`);
181
+ }
182
+
183
+ return result;
184
+ }
185
+
186
+ /**
187
+ * Auto-detect project and suggest generation
188
+ */
189
+ async autoDetectAndSuggest() {
190
+ const detector = new LanguageDetector(this.projectPath);
191
+ const detection = await detector.detectProject();
192
+
193
+ console.log('🔍 Project Detection Results:');
194
+ console.log(` Type: ${detection.projectType}`);
195
+ console.log(` Confidence: ${(detection.confidence * 100).toFixed(1)}%`);
196
+
197
+ if (detection.confidence > 0.7) {
198
+ console.log('💡 High confidence - CLAUDE.md generation recommended');
199
+ return true;
200
+ } else {
201
+ console.log('⚠️ Low confidence - manual review recommended');
202
+ return false;
203
+ }
204
+ }
205
+ }
206
+
207
+ /**
208
+ * CLI Interface for slash command
209
+ */
210
+ export async function executeClaudeMdCommand(args = {}) {
211
+ const command = new ClaudeMdSlashCommand();
212
+
213
+ // Handle different command modes
214
+ if (args.preview) {
215
+ return await command.showPreview();
216
+ }
217
+
218
+ if (args.detect) {
219
+ return await command.autoDetectAndSuggest();
220
+ }
221
+
222
+ // Default: generate CLAUDE.md
223
+ return await command.execute(args);
224
+ }
225
+
226
+ // For direct execution
227
+ if (import.meta.url === `file://${process.argv[1]}`) {
228
+ const args = {
229
+ preview: process.argv.includes('--preview'),
230
+ force: process.argv.includes('--force'),
231
+ backup: !process.argv.includes('--no-backup'),
232
+ detect: process.argv.includes('--detect'),
233
+ isNpxInstall: process.env.NPX_INSTALL === 'true'
234
+ };
235
+
236
+ executeClaudeMdCommand(args);
237
+ }