claude-flow-novice 2.10.9 → 2.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 (180) hide show
  1. package/.claude/commands/README.md +157 -0
  2. package/.claude/hooks/cfn-invoke-post-edit.sh +1 -1
  3. package/.claude/skills/cfn-backlog-management/SKILL.md +199 -0
  4. package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
  5. package/.claude/skills/cfn-changelog-management/SKILL.md +349 -0
  6. package/.claude/skills/cfn-changelog-management/add-changelog-entry.sh +200 -0
  7. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +7 -21
  8. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +312 -0
  9. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +480 -115
  10. package/claude-assets/hooks/cfn-invoke-post-edit.sh +1 -1
  11. package/claude-assets/skills/cfn-backlog-management/SKILL.md +199 -0
  12. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
  13. package/claude-assets/skills/cfn-changelog-management/SKILL.md +349 -0
  14. package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +200 -0
  15. package/dist/cli/config-manager.js.map +1 -1
  16. package/package.json +4 -2
  17. package/scripts/init-project.js +38 -3
  18. package/claude-assets/commands/agents/README.md +0 -10
  19. package/claude-assets/commands/agents/agent-capabilities.md +0 -21
  20. package/claude-assets/commands/agents/agent-coordination.md +0 -28
  21. package/claude-assets/commands/agents/agent-spawning.md +0 -28
  22. package/claude-assets/commands/agents/agent-types.md +0 -26
  23. package/claude-assets/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
  24. package/claude-assets/commands/analysis/README.md +0 -9
  25. package/claude-assets/commands/analysis/bottleneck-detect.md +0 -162
  26. package/claude-assets/commands/analysis/performance-bottlenecks.md +0 -59
  27. package/claude-assets/commands/analysis/performance-report.md +0 -25
  28. package/claude-assets/commands/analysis/token-efficiency.md +0 -45
  29. package/claude-assets/commands/analysis/token-usage.md +0 -25
  30. package/claude-assets/commands/automation/README.md +0 -9
  31. package/claude-assets/commands/automation/auto-agent.md +0 -122
  32. package/claude-assets/commands/automation/self-healing.md +0 -106
  33. package/claude-assets/commands/automation/session-memory.md +0 -90
  34. package/claude-assets/commands/automation/smart-agents.md +0 -73
  35. package/claude-assets/commands/automation/smart-spawn.md +0 -25
  36. package/claude-assets/commands/automation/workflow-select.md +0 -25
  37. package/claude-assets/commands/claude-md.js +0 -237
  38. package/claude-assets/commands/claude-soul.js +0 -28
  39. package/claude-assets/commands/cli-integration.js +0 -216
  40. package/claude-assets/commands/coordination/README.md +0 -9
  41. package/claude-assets/commands/coordination/agent-spawn.md +0 -25
  42. package/claude-assets/commands/coordination/coordination-system.md +0 -88
  43. package/claude-assets/commands/coordination/init.md +0 -44
  44. package/claude-assets/commands/coordination/orchestrate.md +0 -43
  45. package/claude-assets/commands/coordination/spawn.md +0 -45
  46. package/claude-assets/commands/coordination/swarm-init.md +0 -85
  47. package/claude-assets/commands/coordination/task-orchestrate.md +0 -25
  48. package/claude-assets/commands/github/README.md +0 -11
  49. package/claude-assets/commands/github/code-review-swarm.md +0 -514
  50. package/claude-assets/commands/github/code-review.md +0 -25
  51. package/claude-assets/commands/github/github-modes.md +0 -147
  52. package/claude-assets/commands/github/github-swarm.md +0 -121
  53. package/claude-assets/commands/github/issue-tracker.md +0 -292
  54. package/claude-assets/commands/github/issue-triage.md +0 -25
  55. package/claude-assets/commands/github/multi-repo-swarm.md +0 -519
  56. package/claude-assets/commands/github/pr-enhance.md +0 -26
  57. package/claude-assets/commands/github/pr-manager.md +0 -170
  58. package/claude-assets/commands/github/project-board-sync.md +0 -471
  59. package/claude-assets/commands/github/release-manager.md +0 -338
  60. package/claude-assets/commands/github/release-swarm.md +0 -544
  61. package/claude-assets/commands/github/repo-analyze.md +0 -25
  62. package/claude-assets/commands/github/repo-architect.md +0 -367
  63. package/claude-assets/commands/github/swarm-issue.md +0 -482
  64. package/claude-assets/commands/github/swarm-pr.md +0 -285
  65. package/claude-assets/commands/github/sync-coordinator.md +0 -301
  66. package/claude-assets/commands/github/workflow-automation.md +0 -442
  67. package/claude-assets/commands/github.js +0 -638
  68. package/claude-assets/commands/hive-mind/README.md +0 -17
  69. package/claude-assets/commands/hive-mind/hive-mind-consensus.md +0 -8
  70. package/claude-assets/commands/hive-mind/hive-mind-init.md +0 -18
  71. package/claude-assets/commands/hive-mind/hive-mind-memory.md +0 -8
  72. package/claude-assets/commands/hive-mind/hive-mind-metrics.md +0 -8
  73. package/claude-assets/commands/hive-mind/hive-mind-resume.md +0 -8
  74. package/claude-assets/commands/hive-mind/hive-mind-sessions.md +0 -8
  75. package/claude-assets/commands/hive-mind/hive-mind-spawn.md +0 -21
  76. package/claude-assets/commands/hive-mind/hive-mind-status.md +0 -8
  77. package/claude-assets/commands/hive-mind/hive-mind-stop.md +0 -8
  78. package/claude-assets/commands/hive-mind/hive-mind-wizard.md +0 -8
  79. package/claude-assets/commands/hive-mind/hive-mind.md +0 -27
  80. package/claude-assets/commands/hooks/README.md +0 -11
  81. package/claude-assets/commands/hooks/overview.md +0 -58
  82. package/claude-assets/commands/hooks/post-edit.md +0 -117
  83. package/claude-assets/commands/hooks/post-task.md +0 -112
  84. package/claude-assets/commands/hooks/pre-edit.md +0 -113
  85. package/claude-assets/commands/hooks/pre-task.md +0 -111
  86. package/claude-assets/commands/hooks/session-end.md +0 -118
  87. package/claude-assets/commands/hooks/session-start.md +0 -9
  88. package/claude-assets/commands/hooks/setup.md +0 -103
  89. package/claude-assets/commands/hooks.js +0 -651
  90. package/claude-assets/commands/index.js +0 -119
  91. package/claude-assets/commands/memory/README.md +0 -9
  92. package/claude-assets/commands/memory/memory-bank.md +0 -58
  93. package/claude-assets/commands/memory/memory-persist.md +0 -25
  94. package/claude-assets/commands/memory/memory-search.md +0 -25
  95. package/claude-assets/commands/memory/memory-usage.md +0 -25
  96. package/claude-assets/commands/memory/neural.md +0 -47
  97. package/claude-assets/commands/memory/usage.md +0 -46
  98. package/claude-assets/commands/monitoring/README.md +0 -9
  99. package/claude-assets/commands/monitoring/agent-metrics.md +0 -25
  100. package/claude-assets/commands/monitoring/agents.md +0 -44
  101. package/claude-assets/commands/monitoring/real-time-view.md +0 -25
  102. package/claude-assets/commands/monitoring/status.md +0 -46
  103. package/claude-assets/commands/monitoring/swarm-monitor.md +0 -25
  104. package/claude-assets/commands/neural.js +0 -572
  105. package/claude-assets/commands/optimization/README.md +0 -9
  106. package/claude-assets/commands/optimization/auto-topology.md +0 -62
  107. package/claude-assets/commands/optimization/cache-manage.md +0 -25
  108. package/claude-assets/commands/optimization/parallel-execute.md +0 -25
  109. package/claude-assets/commands/optimization/parallel-execution.md +0 -50
  110. package/claude-assets/commands/optimization/topology-optimize.md +0 -25
  111. package/claude-assets/commands/pair/README.md +0 -261
  112. package/claude-assets/commands/pair/commands.md +0 -546
  113. package/claude-assets/commands/pair/config.md +0 -510
  114. package/claude-assets/commands/pair/examples.md +0 -512
  115. package/claude-assets/commands/pair/modes.md +0 -348
  116. package/claude-assets/commands/pair/session.md +0 -407
  117. package/claude-assets/commands/pair/start.md +0 -209
  118. package/claude-assets/commands/parse-epic.js +0 -180
  119. package/claude-assets/commands/performance.js +0 -582
  120. package/claude-assets/commands/register-all-commands.js +0 -320
  121. package/claude-assets/commands/register-claude-md.js +0 -82
  122. package/claude-assets/commands/register-claude-soul.js +0 -80
  123. package/claude-assets/commands/sparc/analyzer.md +0 -52
  124. package/claude-assets/commands/sparc/architect.md +0 -53
  125. package/claude-assets/commands/sparc/batch-executor.md +0 -54
  126. package/claude-assets/commands/sparc/coder.md +0 -54
  127. package/claude-assets/commands/sparc/debugger.md +0 -54
  128. package/claude-assets/commands/sparc/designer.md +0 -53
  129. package/claude-assets/commands/sparc/documenter.md +0 -54
  130. package/claude-assets/commands/sparc/innovator.md +0 -54
  131. package/claude-assets/commands/sparc/memory-manager.md +0 -54
  132. package/claude-assets/commands/sparc/optimizer.md +0 -54
  133. package/claude-assets/commands/sparc/orchestrator.md +0 -132
  134. package/claude-assets/commands/sparc/researcher.md +0 -54
  135. package/claude-assets/commands/sparc/reviewer.md +0 -54
  136. package/claude-assets/commands/sparc/sparc-modes.md +0 -174
  137. package/claude-assets/commands/sparc/swarm-coordinator.md +0 -54
  138. package/claude-assets/commands/sparc/tdd.md +0 -54
  139. package/claude-assets/commands/sparc/tester.md +0 -54
  140. package/claude-assets/commands/sparc/workflow-manager.md +0 -54
  141. package/claude-assets/commands/sparc.js +0 -110
  142. package/claude-assets/commands/stream-chain/pipeline.md +0 -121
  143. package/claude-assets/commands/stream-chain/run.md +0 -70
  144. package/claude-assets/commands/swarm/README.md +0 -15
  145. package/claude-assets/commands/swarm/analysis.md +0 -95
  146. package/claude-assets/commands/swarm/development.md +0 -96
  147. package/claude-assets/commands/swarm/examples.md +0 -168
  148. package/claude-assets/commands/swarm/maintenance.md +0 -102
  149. package/claude-assets/commands/swarm/optimization.md +0 -117
  150. package/claude-assets/commands/swarm/research.md +0 -136
  151. package/claude-assets/commands/swarm/swarm-analysis.md +0 -8
  152. package/claude-assets/commands/swarm/swarm-background.md +0 -8
  153. package/claude-assets/commands/swarm/swarm-init.md +0 -19
  154. package/claude-assets/commands/swarm/swarm-modes.md +0 -8
  155. package/claude-assets/commands/swarm/swarm-monitor.md +0 -8
  156. package/claude-assets/commands/swarm/swarm-spawn.md +0 -19
  157. package/claude-assets/commands/swarm/swarm-status.md +0 -8
  158. package/claude-assets/commands/swarm/swarm-strategies.md +0 -8
  159. package/claude-assets/commands/swarm/swarm.md +0 -27
  160. package/claude-assets/commands/swarm/testing.md +0 -131
  161. package/claude-assets/commands/swarm.js +0 -423
  162. package/claude-assets/commands/testing/playwright-e2e.md +0 -288
  163. package/claude-assets/commands/training/README.md +0 -9
  164. package/claude-assets/commands/training/model-update.md +0 -25
  165. package/claude-assets/commands/training/neural-patterns.md +0 -74
  166. package/claude-assets/commands/training/neural-train.md +0 -25
  167. package/claude-assets/commands/training/pattern-learn.md +0 -25
  168. package/claude-assets/commands/training/specialization.md +0 -63
  169. package/claude-assets/commands/truth/start.md +0 -143
  170. package/claude-assets/commands/validate-commands.js +0 -223
  171. package/claude-assets/commands/verify/check.md +0 -50
  172. package/claude-assets/commands/verify/start.md +0 -128
  173. package/claude-assets/commands/workflow.js +0 -606
  174. package/claude-assets/commands/workflows/README.md +0 -9
  175. package/claude-assets/commands/workflows/development.md +0 -78
  176. package/claude-assets/commands/workflows/research.md +0 -63
  177. package/claude-assets/commands/workflows/workflow-create.md +0 -25
  178. package/claude-assets/commands/workflows/workflow-execute.md +0 -25
  179. package/claude-assets/commands/workflows/workflow-export.md +0 -25
  180. package/claude-assets/hooks/post-edit.config.json +0 -23
@@ -1,106 +0,0 @@
1
- # Self-Healing Workflows
2
-
3
- ## Purpose
4
- Automatically detect and recover from errors without interrupting your flow.
5
-
6
- ## Self-Healing Features
7
-
8
- ### 1. Error Detection
9
- Monitors for:
10
- - Failed commands
11
- - Syntax errors
12
- - Missing dependencies
13
- - Broken tests
14
-
15
- ### 2. Automatic Recovery
16
-
17
- **Missing Dependencies:**
18
- ```
19
- Error: Cannot find module 'express'
20
- → Automatically runs: npm install express
21
- → Retries original command
22
- ```
23
-
24
- **Syntax Errors:**
25
- ```
26
- Error: Unexpected token
27
- → Analyzes error location
28
- → Suggests fix through analyzer agent
29
- → Applies fix with confirmation
30
- ```
31
-
32
- **Test Failures:**
33
- ```
34
- Test failed: "user authentication"
35
- → Spawns debugger agent
36
- → Analyzes failure cause
37
- → Implements fix
38
- → Re-runs tests
39
- ```
40
-
41
- ### 3. Learning from Failures
42
- Each recovery improves future prevention:
43
- - Patterns saved to knowledge base
44
- - Similar errors prevented proactively
45
- - Recovery strategies optimized
46
-
47
- **Pattern Storage:**
48
- ```javascript
49
- // Store error patterns
50
- mcp__claude-flow__memory_usage({
51
- "action": "store",
52
- "key": "error-pattern-" + Date.now(),
53
- "value": JSON.stringify(errorData),
54
- "namespace": "error-patterns",
55
- "ttl": 2592000 // 30 days
56
- })
57
-
58
- // Analyze patterns
59
- mcp__claude-flow__neural_patterns({
60
- "action": "analyze",
61
- "operation": "error-recovery",
62
- "outcome": "success"
63
- })
64
- ```
65
-
66
- ## Self-Healing Integration
67
-
68
- ### MCP Tool Coordination
69
- ```javascript
70
- // Initialize self-healing swarm
71
- mcp__claude-flow__swarm_init({
72
- "topology": "star",
73
- "maxAgents": 4,
74
- "strategy": "adaptive"
75
- })
76
-
77
- // Spawn recovery agents
78
- mcp__claude-flow__agent_spawn({
79
- "type": "monitor",
80
- "name": "Error Monitor",
81
- "capabilities": ["error-detection", "recovery"]
82
- })
83
-
84
- // Orchestrate recovery
85
- mcp__claude-flow__task_orchestrate({
86
- "task": "recover from error",
87
- "strategy": "sequential",
88
- "priority": "critical"
89
- })
90
- ```
91
-
92
- ### Fallback Hook Configuration
93
- ```json
94
- {
95
- "PostToolUse": [{
96
- "matcher": "^Bash$",
97
- "command": "npx claude-flow-novice hook post-bash --exit-code '${tool.result.exitCode}' --auto-recover"
98
- }]
99
- }
100
- ```
101
-
102
- ## Benefits
103
- - 🛡️ Resilient workflows
104
- - 🔄 Automatic recovery
105
- - 📚 Learns from errors
106
- - ⏱️ Saves debugging time
@@ -1,90 +0,0 @@
1
- # Cross-Session Memory
2
-
3
- ## Purpose
4
- Maintain context and learnings across Claude Code sessions for continuous improvement.
5
-
6
- ## Memory Features
7
-
8
- ### 1. Automatic State Persistence
9
- At session end, automatically saves:
10
- - Active agents and specializations
11
- - Task history and patterns
12
- - Performance metrics
13
- - Neural network weights
14
- - Knowledge base updates
15
-
16
- ### 2. Session Restoration
17
- ```javascript
18
- // Using MCP tools for memory operations
19
- mcp__claude-flow__memory_usage({
20
- "action": "retrieve",
21
- "key": "session-state",
22
- "namespace": "sessions"
23
- })
24
-
25
- // Restore swarm state
26
- mcp__claude-flow__context_restore({
27
- "snapshotId": "sess-123"
28
- })
29
- ```
30
-
31
- **Fallback with npx:**
32
- ```bash
33
- npx claude-flow-novice hook session-restore --session-id "sess-123"
34
- ```
35
-
36
- ### 3. Memory Types
37
-
38
- **Project Memory:**
39
- - File relationships
40
- - Common edit patterns
41
- - Testing approaches
42
- - Build configurations
43
-
44
- **Agent Memory:**
45
- - Specialization levels
46
- - Task success rates
47
- - Optimization strategies
48
- - Error patterns
49
-
50
- **Performance Memory:**
51
- - Bottleneck history
52
- - Optimization results
53
- - Token usage patterns
54
- - Efficiency trends
55
-
56
- ### 4. Privacy & Control
57
- ```javascript
58
- // List memory contents
59
- mcp__claude-flow__memory_usage({
60
- "action": "list",
61
- "namespace": "sessions"
62
- })
63
-
64
- // Delete specific memory
65
- mcp__claude-flow__memory_usage({
66
- "action": "delete",
67
- "key": "session-123",
68
- "namespace": "sessions"
69
- })
70
-
71
- // Backup memory
72
- mcp__claude-flow__memory_backup({
73
- "path": "./backups/memory-backup.json"
74
- })
75
- ```
76
-
77
- **Manual control:**
78
- ```bash
79
- # View stored memory
80
- ls .claude-flow/memory/
81
-
82
- # Disable memory
83
- export CLAUDE_FLOW_MEMORY_PERSIST=false
84
- ```
85
-
86
- ## Benefits
87
- - 🧠 Contextual awareness
88
- - 📈 Cumulative learning
89
- - ⚡ Faster task completion
90
- - 🎯 Personalized optimization
@@ -1,73 +0,0 @@
1
- # Smart Agent Auto-Spawning
2
-
3
- ## Purpose
4
- Automatically spawn the right agents at the right time without manual intervention.
5
-
6
- ## Auto-Spawning Triggers
7
-
8
- ### 1. File Type Detection
9
- When editing files, agents auto-spawn:
10
- - **JavaScript/TypeScript**: Coder agent
11
- - **Markdown**: Researcher agent
12
- - **JSON/YAML**: Analyst agent
13
- - **Multiple files**: Coordinator agent
14
-
15
- ### 2. Task Complexity
16
- ```
17
- Simple task: "Fix typo"
18
- → Single coordinator agent
19
-
20
- Complex task: "Implement OAuth with Google"
21
- → Architect + Coder + Tester + Researcher
22
- ```
23
-
24
- ### 3. Dynamic Scaling
25
- The system monitors workload and spawns additional agents when:
26
- - Task queue grows
27
- - Complexity increases
28
- - Parallel opportunities exist
29
-
30
- **Status Monitoring:**
31
- ```javascript
32
- // Check swarm health
33
- mcp__claude-flow__swarm_status({
34
- "swarmId": "current"
35
- })
36
-
37
- // Monitor agent performance
38
- mcp__claude-flow__agent_metrics({
39
- "agentId": "agent-123"
40
- })
41
- ```
42
-
43
- ## Configuration
44
-
45
- ### MCP Tool Integration
46
- Uses Claude Flow MCP tools for agent coordination:
47
- ```javascript
48
- // Initialize swarm with appropriate topology
49
- mcp__claude-flow__swarm_init({
50
- "topology": "mesh",
51
- "maxAgents": 8,
52
- "strategy": "auto"
53
- })
54
-
55
- // Spawn agents based on file type
56
- mcp__claude-flow__agent_spawn({
57
- "type": "coder",
58
- "name": "JavaScript Handler",
59
- "capabilities": ["javascript", "typescript"]
60
- })
61
- ```
62
-
63
- ### Fallback Configuration
64
- If MCP tools are unavailable:
65
- ```bash
66
- npx claude-flow-novice hook pre-task --auto-spawn-agents
67
- ```
68
-
69
- ## Benefits
70
- - 🤖 Zero manual agent management
71
- - 🎯 Perfect agent selection
72
- - 📈 Dynamic scaling
73
- - 💾 Resource efficiency
@@ -1,25 +0,0 @@
1
- # smart-spawn
2
-
3
- Intelligently spawn agents based on workload analysis.
4
-
5
- ## Usage
6
- ```bash
7
- npx claude-flow-novice automation smart-spawn [options]
8
- ```
9
-
10
- ## Options
11
- - `--analyze` - Analyze before spawning
12
- - `--threshold <n>` - Spawn threshold
13
- - `--topology <type>` - Preferred topology
14
-
15
- ## Examples
16
- ```bash
17
- # Smart spawn with analysis
18
- npx claude-flow-novice automation smart-spawn --analyze
19
-
20
- # Set spawn threshold
21
- npx claude-flow-novice automation smart-spawn --threshold 5
22
-
23
- # Force topology
24
- npx claude-flow-novice automation smart-spawn --topology hierarchical
25
- ```
@@ -1,25 +0,0 @@
1
- # workflow-select
2
-
3
- Automatically select optimal workflow based on task type.
4
-
5
- ## Usage
6
- ```bash
7
- npx claude-flow-novice automation workflow-select [options]
8
- ```
9
-
10
- ## Options
11
- - `--task <description>` - Task description
12
- - `--constraints <list>` - Workflow constraints
13
- - `--preview` - Preview without executing
14
-
15
- ## Examples
16
- ```bash
17
- # Select workflow for task
18
- npx claude-flow-novice automation workflow-select --task "Deploy to production"
19
-
20
- # With constraints
21
- npx claude-flow-novice automation workflow-select --constraints "no-downtime,rollback"
22
-
23
- # Preview mode
24
- npx claude-flow-novice automation workflow-select --task "Database migration" --preview
25
- ```
@@ -1,237 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * CLAUDE-SOUL.md Slash Command
5
- *
6
- * Interactive questionnaire to create a project soul document.
7
- * Guides users through defining their project's who, what, when, where, why
8
- * to provide context for AI agents when they hit roadblocks.
9
- * Document size: 250-500 words focusing on project essence and decision context.
10
- */
11
-
12
- // Import from the main implementation
13
- import { executeClaudeSoulCommand } from '../../src/slash-commands/claude-soul.js';
14
-
15
- // Parse arguments
16
- const args = {
17
- preview: process.argv.includes('--preview'),
18
- force: process.argv.includes('--force'),
19
- backup: !process.argv.includes('--no-backup'),
20
- interactive: !process.argv.includes('--no-interactive'),
21
- help: process.argv.includes('--help') || process.argv.includes('-h')
22
- };
23
-
24
- // Execute the command
25
- executeClaudeSoulCommand(args).catch(error => {
26
- console.error('Error:', error.message);
27
- process.exit(1);
28
- });