mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
feat: Update Claude Code slash commands to use ./claude-flow wrapper and include detailed SPARC mode descriptions
- Updated all slash command examples to use ./claude-flow instead of npx claude-flow - Enhanced SPARC mode slash commands with full roleDefinition and customInstructions from .roomodes - Improved slash command formatting with emojis and better organization - Added comprehensive examples and memory integration guidance - Enhanced swarm command with detailed agent types and coordination modes - Fixed syntax error in sparc-commands.js 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
ee2f417673
commit
aac3653abc
4 files changed
+1037
No files matched your search
@@ -0,0 +1,437 @@
|
||||
// claude-flow-commands.js - Claude-Flow specific slash commands
|
||||
|
||||
// Create Claude-Flow specific commands
|
||||
export async function createClaudeFlowCommands(workingDir) {
|
||||
// Help command
|
||||
const helpCommand = `---
|
||||
name: claude-flow-help
|
||||
description: Show Claude-Flow commands and usage
|
||||
---
|
||||
|
||||
# Claude-Flow Commands
|
||||
|
||||
## 🌊 Claude-Flow: Agent Orchestration Platform
|
||||
|
||||
Claude-Flow is the ultimate multi-terminal orchestration platform that revolutionizes how you work with Claude Code.
|
||||
|
||||
## Core Commands
|
||||
|
||||
### 🚀 System Management
|
||||
- \`./claude-flow start\` - Start orchestration system
|
||||
- \`./claude-flow start --ui\` - Start with interactive process management UI
|
||||
- \`./claude-flow status\` - Check system status
|
||||
- \`./claude-flow monitor\` - Real-time monitoring
|
||||
- \`./claude-flow stop\` - Stop orchestration
|
||||
|
||||
### 🤖 Agent Management
|
||||
- \`./claude-flow agent spawn <type>\` - Create new agent
|
||||
- \`./claude-flow agent list\` - List active agents
|
||||
- \`./claude-flow agent info <id>\` - Agent details
|
||||
- \`./claude-flow agent terminate <id>\` - Stop agent
|
||||
|
||||
### 📋 Task Management
|
||||
- \`./claude-flow task create <type> "description"\` - Create task
|
||||
- \`./claude-flow task list\` - List all tasks
|
||||
- \`./claude-flow task status <id>\` - Task status
|
||||
- \`./claude-flow task cancel <id>\` - Cancel task
|
||||
- \`./claude-flow task workflow <file>\` - Execute workflow
|
||||
|
||||
### 🧠 Memory Operations
|
||||
- \`./claude-flow memory store "key" "value"\` - Store data
|
||||
- \`./claude-flow memory query "search"\` - Search memory
|
||||
- \`./claude-flow memory stats\` - Memory statistics
|
||||
- \`./claude-flow memory export <file>\` - Export memory
|
||||
- \`./claude-flow memory import <file>\` - Import memory
|
||||
|
||||
### ⚡ SPARC Development
|
||||
- \`./claude-flow sparc "task"\` - Run SPARC orchestrator
|
||||
- \`./claude-flow sparc modes\` - List all 17+ SPARC modes
|
||||
- \`./claude-flow sparc run <mode> "task"\` - Run specific mode
|
||||
- \`./claude-flow sparc tdd "feature"\` - TDD workflow
|
||||
- \`./claude-flow sparc info <mode>\` - Mode details
|
||||
|
||||
### 🐝 Swarm Coordination
|
||||
- \`./claude-flow swarm "task" --strategy <type>\` - Start swarm
|
||||
- \`./claude-flow swarm "task" --background\` - Long-running swarm
|
||||
- \`./claude-flow swarm "task" --monitor\` - With monitoring
|
||||
- \`./claude-flow swarm "task" --ui\` - Interactive UI
|
||||
- \`./claude-flow swarm "task" --distributed\` - Distributed coordination
|
||||
|
||||
### 🌍 MCP Integration
|
||||
- \`./claude-flow mcp status\` - MCP server status
|
||||
- \`./claude-flow mcp tools\` - List available tools
|
||||
- \`./claude-flow mcp config\` - Show configuration
|
||||
- \`./claude-flow mcp logs\` - View MCP logs
|
||||
|
||||
### 🤖 Claude Integration
|
||||
- \`./claude-flow claude spawn "task"\` - Spawn Claude with enhanced guidance
|
||||
- \`./claude-flow claude batch <file>\` - Execute workflow configuration
|
||||
|
||||
## 🌟 Quick Examples
|
||||
|
||||
### Initialize with SPARC:
|
||||
\`\`\`bash
|
||||
npx -y claude-flow@latest init --sparc
|
||||
\`\`\`
|
||||
|
||||
### Start a development swarm:
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Build REST API" --strategy development --monitor --review
|
||||
\`\`\`
|
||||
|
||||
### Run TDD workflow:
|
||||
\`\`\`bash
|
||||
./claude-flow sparc tdd "user authentication"
|
||||
\`\`\`
|
||||
|
||||
### Store project context:
|
||||
\`\`\`bash
|
||||
./claude-flow memory store "project_requirements" "e-commerce platform specs" --namespace project
|
||||
\`\`\`
|
||||
|
||||
### Spawn specialized agents:
|
||||
\`\`\`bash
|
||||
./claude-flow agent spawn researcher --name "Senior Researcher" --priority 8
|
||||
./claude-flow agent spawn developer --name "Lead Developer" --priority 9
|
||||
\`\`\`
|
||||
|
||||
## 🎯 Best Practices
|
||||
- Use \`./claude-flow\` instead of \`npx claude-flow\` after initialization
|
||||
- Store important context in memory for cross-session persistence
|
||||
- Use swarm mode for complex tasks requiring multiple agents
|
||||
- Enable monitoring for real-time progress tracking
|
||||
- Use background mode for tasks > 30 minutes
|
||||
|
||||
## 📚 Resources
|
||||
- Documentation: https://github.com/ruvnet/claude-code-flow/docs
|
||||
- Examples: https://github.com/ruvnet/claude-code-flow/examples
|
||||
- Issues: https://github.com/ruvnet/claude-code-flow/issues
|
||||
`;
|
||||
|
||||
await Deno.writeTextFile(`${workingDir}/.claude/commands/claude-flow-help.md`, helpCommand);
|
||||
console.log(' ✓ Created slash command: /claude-flow-help');
|
||||
|
||||
// Memory command
|
||||
const memoryCommand = `---
|
||||
name: claude-flow-memory
|
||||
description: Interact with Claude-Flow memory system
|
||||
---
|
||||
|
||||
# 🧠 Claude-Flow Memory System
|
||||
|
||||
The memory system provides persistent storage for cross-session and cross-agent collaboration with CRDT-based conflict resolution.
|
||||
|
||||
## Store Information
|
||||
\`\`\`bash
|
||||
# Store with default namespace
|
||||
./claude-flow memory store "key" "value"
|
||||
|
||||
# Store with specific namespace
|
||||
./claude-flow memory store "architecture_decisions" "microservices with API gateway" --namespace arch
|
||||
\`\`\`
|
||||
|
||||
## Query Memory
|
||||
\`\`\`bash
|
||||
# Search across all namespaces
|
||||
./claude-flow memory query "authentication"
|
||||
|
||||
# Search with filters
|
||||
./claude-flow memory query "API design" --namespace arch --limit 10
|
||||
\`\`\`
|
||||
|
||||
## Memory Statistics
|
||||
\`\`\`bash
|
||||
# Show overall statistics
|
||||
./claude-flow memory stats
|
||||
|
||||
# Show namespace-specific stats
|
||||
./claude-flow memory stats --namespace project
|
||||
\`\`\`
|
||||
|
||||
## Export/Import
|
||||
\`\`\`bash
|
||||
# Export all memory
|
||||
./claude-flow memory export full-backup.json
|
||||
|
||||
# Export specific namespace
|
||||
./claude-flow memory export project-backup.json --namespace project
|
||||
|
||||
# Import memory
|
||||
./claude-flow memory import backup.json
|
||||
\`\`\`
|
||||
|
||||
## Cleanup Operations
|
||||
\`\`\`bash
|
||||
# Clean entries older than 30 days
|
||||
./claude-flow memory cleanup --days 30
|
||||
|
||||
# Clean specific namespace
|
||||
./claude-flow memory cleanup --namespace temp --days 7
|
||||
\`\`\`
|
||||
|
||||
## 🗂️ Namespaces
|
||||
- **default** - General storage
|
||||
- **agents** - Agent-specific data and state
|
||||
- **tasks** - Task information and results
|
||||
- **sessions** - Session history and context
|
||||
- **swarm** - Swarm coordination and objectives
|
||||
- **project** - Project-specific context
|
||||
- **spec** - Requirements and specifications
|
||||
- **arch** - Architecture decisions
|
||||
- **impl** - Implementation notes
|
||||
- **test** - Test results and coverage
|
||||
- **debug** - Debug logs and fixes
|
||||
|
||||
## 🎯 Best Practices
|
||||
|
||||
### Naming Conventions
|
||||
- Use descriptive, searchable keys
|
||||
- Include timestamp for time-sensitive data
|
||||
- Prefix with component name for clarity
|
||||
|
||||
### Organization
|
||||
- Use namespaces to categorize data
|
||||
- Store related data together
|
||||
- Keep values concise but complete
|
||||
|
||||
### Maintenance
|
||||
- Regular backups with export
|
||||
- Clean old data periodically
|
||||
- Monitor storage statistics
|
||||
- Compress large values
|
||||
|
||||
## Examples
|
||||
|
||||
### Store SPARC context:
|
||||
\`\`\`bash
|
||||
./claude-flow memory store "spec_auth_requirements" "OAuth2 + JWT with refresh tokens" --namespace spec
|
||||
./claude-flow memory store "arch_api_design" "RESTful microservices with GraphQL gateway" --namespace arch
|
||||
./claude-flow memory store "test_coverage_auth" "95% coverage, all tests passing" --namespace test
|
||||
\`\`\`
|
||||
|
||||
### Query project decisions:
|
||||
\`\`\`bash
|
||||
./claude-flow memory query "authentication" --namespace arch --limit 5
|
||||
./claude-flow memory query "test results" --namespace test
|
||||
\`\`\`
|
||||
|
||||
### Backup project memory:
|
||||
\`\`\`bash
|
||||
./claude-flow memory export project-$(date +%Y%m%d).json --namespace project
|
||||
\`\`\`
|
||||
`;
|
||||
|
||||
await Deno.writeTextFile(`${workingDir}/.claude/commands/claude-flow-memory.md`, memoryCommand);
|
||||
console.log(' ✓ Created slash command: /claude-flow-memory');
|
||||
|
||||
// Swarm command
|
||||
const swarmCommand = `---
|
||||
name: claude-flow-swarm
|
||||
description: Coordinate multi-agent swarms for complex tasks
|
||||
---
|
||||
|
||||
# 🐝 Claude-Flow Swarm Coordination
|
||||
|
||||
Advanced multi-agent coordination system with timeout-free execution, distributed memory sharing, and intelligent load balancing.
|
||||
|
||||
## Basic Usage
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "your complex task" --strategy <type> [options]
|
||||
\`\`\`
|
||||
|
||||
## 🎯 Swarm Strategies
|
||||
- **auto** - Automatic strategy selection based on task analysis
|
||||
- **development** - Code implementation with review and testing
|
||||
- **research** - Information gathering and synthesis
|
||||
- **analysis** - Data processing and pattern identification
|
||||
- **testing** - Comprehensive quality assurance
|
||||
- **optimization** - Performance tuning and refactoring
|
||||
- **maintenance** - System updates and bug fixes
|
||||
|
||||
## 🤖 Agent Types
|
||||
- **coordinator** - Plans and delegates tasks to other agents
|
||||
- **developer** - Writes code and implements solutions
|
||||
- **researcher** - Gathers and analyzes information
|
||||
- **analyzer** - Identifies patterns and generates insights
|
||||
- **tester** - Creates and runs tests for quality assurance
|
||||
- **reviewer** - Performs code and design reviews
|
||||
- **documenter** - Creates documentation and guides
|
||||
- **monitor** - Tracks performance and system health
|
||||
- **specialist** - Domain-specific expert agents
|
||||
|
||||
## 🔄 Coordination Modes
|
||||
- **centralized** - Single coordinator manages all agents (default)
|
||||
- **distributed** - Multiple coordinators share management
|
||||
- **hierarchical** - Tree structure with nested coordination
|
||||
- **mesh** - Peer-to-peer agent collaboration
|
||||
- **hybrid** - Mixed coordination strategies
|
||||
|
||||
## ⚙️ Common Options
|
||||
- \`--strategy <type>\` - Execution strategy
|
||||
- \`--mode <type>\` - Coordination mode
|
||||
- \`--max-agents <n>\` - Maximum concurrent agents (default: 5)
|
||||
- \`--timeout <minutes>\` - Timeout in minutes (default: 60)
|
||||
- \`--background\` - Run in background for tasks > 30 minutes
|
||||
- \`--monitor\` - Enable real-time monitoring
|
||||
- \`--ui\` - Launch terminal UI interface
|
||||
- \`--parallel\` - Enable parallel execution
|
||||
- \`--distributed\` - Enable distributed coordination
|
||||
- \`--review\` - Enable peer review process
|
||||
- \`--testing\` - Include automated testing
|
||||
- \`--encryption\` - Enable data encryption
|
||||
- \`--verbose\` - Detailed logging output
|
||||
- \`--dry-run\` - Show configuration without executing
|
||||
|
||||
## 🌟 Examples
|
||||
|
||||
### Development Swarm with Review
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Build e-commerce REST API" \\
|
||||
--strategy development \\
|
||||
--monitor \\
|
||||
--review \\
|
||||
--testing
|
||||
\`\`\`
|
||||
|
||||
### Long-Running Research Swarm
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Analyze AI market trends 2024-2025" \\
|
||||
--strategy research \\
|
||||
--background \\
|
||||
--distributed \\
|
||||
--max-agents 8
|
||||
\`\`\`
|
||||
|
||||
### Performance Optimization Swarm
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Optimize database queries and API performance" \\
|
||||
--strategy optimization \\
|
||||
--testing \\
|
||||
--parallel \\
|
||||
--monitor
|
||||
\`\`\`
|
||||
|
||||
### Enterprise Development Swarm
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Implement secure payment processing system" \\
|
||||
--strategy development \\
|
||||
--mode distributed \\
|
||||
--max-agents 10 \\
|
||||
--parallel \\
|
||||
--monitor \\
|
||||
--review \\
|
||||
--testing \\
|
||||
--encryption \\
|
||||
--verbose
|
||||
\`\`\`
|
||||
|
||||
### Testing and QA Swarm
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Comprehensive security audit and testing" \\
|
||||
--strategy testing \\
|
||||
--review \\
|
||||
--verbose \\
|
||||
--max-agents 6
|
||||
\`\`\`
|
||||
|
||||
## 📊 Monitoring and Control
|
||||
|
||||
### Real-time monitoring:
|
||||
\`\`\`bash
|
||||
# Monitor swarm activity
|
||||
./claude-flow monitor
|
||||
|
||||
# Monitor specific component
|
||||
./claude-flow monitor --focus swarm
|
||||
\`\`\`
|
||||
|
||||
### Check swarm status:
|
||||
\`\`\`bash
|
||||
# Overall system status
|
||||
./claude-flow status
|
||||
|
||||
# Detailed swarm status
|
||||
./claude-flow status --verbose
|
||||
\`\`\`
|
||||
|
||||
### View agent activity:
|
||||
\`\`\`bash
|
||||
# List all agents
|
||||
./claude-flow agent list
|
||||
|
||||
# Agent details
|
||||
./claude-flow agent info <agent-id>
|
||||
\`\`\`
|
||||
|
||||
## 💾 Memory Integration
|
||||
|
||||
Swarms automatically use distributed memory for collaboration:
|
||||
|
||||
\`\`\`bash
|
||||
# Store swarm objectives
|
||||
./claude-flow memory store "swarm_objective" "Build scalable API" --namespace swarm
|
||||
|
||||
# Query swarm progress
|
||||
./claude-flow memory query "swarm_progress" --namespace swarm
|
||||
|
||||
# Export swarm memory
|
||||
./claude-flow memory export swarm-results.json --namespace swarm
|
||||
\`\`\`
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
### Timeout-Free Execution
|
||||
- Background mode for long-running tasks
|
||||
- State persistence across sessions
|
||||
- Automatic checkpoint recovery
|
||||
|
||||
### Work Stealing & Load Balancing
|
||||
- Dynamic task redistribution
|
||||
- Automatic agent scaling
|
||||
- Resource-aware scheduling
|
||||
|
||||
### Circuit Breakers & Fault Tolerance
|
||||
- Automatic retry with exponential backoff
|
||||
- Graceful degradation
|
||||
- Health monitoring and recovery
|
||||
|
||||
### Real-Time Collaboration
|
||||
- Cross-agent communication
|
||||
- Shared memory access
|
||||
- Event-driven coordination
|
||||
|
||||
### Enterprise Security
|
||||
- Role-based access control
|
||||
- Audit logging
|
||||
- Data encryption
|
||||
- Input validation
|
||||
|
||||
## 🔧 Advanced Configuration
|
||||
|
||||
### Dry run to preview:
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "Test task" --dry-run --strategy development
|
||||
\`\`\`
|
||||
|
||||
### Custom quality thresholds:
|
||||
\`\`\`bash
|
||||
./claude-flow swarm "High quality API" \\
|
||||
--strategy development \\
|
||||
--quality-threshold 0.95
|
||||
\`\`\`
|
||||
|
||||
### Scheduling algorithms:
|
||||
- FIFO (First In, First Out)
|
||||
- Priority-based
|
||||
- Deadline-driven
|
||||
- Shortest Job First
|
||||
- Critical Path
|
||||
- Resource-aware
|
||||
- Adaptive
|
||||
|
||||
For detailed documentation, see: https://github.com/ruvnet/claude-code-flow/docs/swarm-system.md
|
||||
`;
|
||||
|
||||
await Deno.writeTextFile(`${workingDir}/.claude/commands/claude-flow-swarm.md`, swarmCommand);
|
||||
console.log(' ✓ Created slash command: /claude-flow-swarm');
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
// sparc-commands.js - SPARC-specific slash commands
|
||||
|
||||
// Create SPARC mode slash command
|
||||
export function createSparcSlashCommand(mode) {
|
||||
// Extract the full description without truncation
|
||||
const fullDescription = mode.roleDefinition.length > 100
|
||||
? `${mode.roleDefinition.substring(0, 97)}...`
|
||||
: mode.roleDefinition;
|
||||
|
||||
return `---
|
||||
name: sparc-${mode.slug}
|
||||
description: ${mode.name} - ${fullDescription}
|
||||
---
|
||||
|
||||
# ${mode.name}
|
||||
|
||||
## Role Definition
|
||||
${mode.roleDefinition}
|
||||
|
||||
## Custom Instructions
|
||||
${mode.customInstructions}
|
||||
|
||||
## Available Tools
|
||||
${Array.isArray(mode.groups) ? mode.groups.map(g => {
|
||||
if (typeof g === 'string') {
|
||||
return `- **${g}**: ${getToolDescription(g)}`;
|
||||
} else if (Array.isArray(g)) {
|
||||
return `- **${g[0]}**: ${g[1]?.description || getToolDescription(g[0])} ${g[1]?.fileRegex ? `(Files matching: ${g[1].fileRegex})` : ''}`;
|
||||
}
|
||||
return `- ${JSON.stringify(g)}`;
|
||||
}).join('\n') : 'None'}
|
||||
|
||||
## Usage
|
||||
|
||||
To use this SPARC mode, you can:
|
||||
|
||||
1. **Run directly**: \`./claude-flow sparc run ${mode.slug} "your task"\`
|
||||
2. **TDD shorthand** (if applicable): \`./claude-flow sparc ${mode.slug} "your task"\`
|
||||
3. **Use in workflow**: Include \`${mode.slug}\` in your SPARC workflow
|
||||
4. **Delegate tasks**: Use \`new_task\` to assign work to this mode
|
||||
|
||||
## Example Commands
|
||||
|
||||
\`\`\`bash
|
||||
# Run this specific mode
|
||||
./claude-flow sparc run ${mode.slug} "${getExampleTask(mode.slug)}"
|
||||
|
||||
# Use with memory namespace
|
||||
./claude-flow sparc run ${mode.slug} "your task" --namespace ${mode.slug}
|
||||
|
||||
# Non-interactive mode for automation
|
||||
./claude-flow sparc run ${mode.slug} "your task" --non-interactive
|
||||
\`\`\`
|
||||
|
||||
## Memory Integration
|
||||
|
||||
\`\`\`bash
|
||||
# Store mode-specific context
|
||||
./claude-flow memory store "${mode.slug}_context" "important decisions" --namespace ${mode.slug}
|
||||
|
||||
# Query previous work
|
||||
./claude-flow memory query "${mode.slug}" --limit 5
|
||||
\`\`\`
|
||||
`;
|
||||
}
|
||||
|
||||
// Helper function to get tool descriptions
|
||||
function getToolDescription(tool) {
|
||||
const toolDescriptions = {
|
||||
'read': 'File reading and viewing',
|
||||
'edit': 'File modification and creation',
|
||||
'browser': 'Web browsing capabilities',
|
||||
'mcp': 'Model Context Protocol tools',
|
||||
'command': 'Command execution'
|
||||
};
|
||||
return toolDescriptions[tool] || 'Tool access';
|
||||
}
|
||||
|
||||
// Helper function to get example tasks
|
||||
function getExampleTask(slug) {
|
||||
const examples = {
|
||||
'architect': 'design microservices architecture',
|
||||
'code': 'implement REST API endpoints',
|
||||
'tdd': 'create user authentication tests',
|
||||
'debug': 'fix memory leak in service',
|
||||
'security-review': 'audit API security',
|
||||
'docs-writer': 'create API documentation',
|
||||
'integration': 'connect payment service',
|
||||
'post-deployment-monitoring-mode': 'monitor production metrics',
|
||||
'refinement-optimization-mode': 'optimize database queries',
|
||||
'devops': 'deploy to AWS Lambda',
|
||||
'supabase-admin': 'create user authentication schema',
|
||||
'spec-pseudocode': 'define payment flow requirements',
|
||||
'mcp': 'integrate with external API',
|
||||
'swarm': 'build complete feature with tests',
|
||||
'sparc': 'orchestrate authentication system',
|
||||
'ask': 'help me choose the right mode',
|
||||
'tutorial': 'guide me through SPARC methodology'
|
||||
};
|
||||
return examples[slug] || 'implement feature';
|
||||
}
|
||||
|
||||
// Create main SPARC command
|
||||
export function createMainSparcCommand(modes) {
|
||||
const modeList = modes.map(m => `- \`/sparc-${m.slug}\` - ${m.name}`).join('\n');
|
||||
|
||||
// Find the sparc orchestrator mode for its full description
|
||||
const sparcMode = modes.find(m => m.slug === 'sparc');
|
||||
const sparcDescription = sparcMode ? sparcMode.roleDefinition : 'SPARC orchestrator for complex workflows';
|
||||
const sparcInstructions = sparcMode ? sparcMode.customInstructions : '';
|
||||
|
||||
return `---
|
||||
name: sparc
|
||||
description: Execute SPARC methodology workflows with Claude-Flow
|
||||
---
|
||||
|
||||
# ⚡️ SPARC Development Methodology
|
||||
|
||||
${sparcDescription}
|
||||
|
||||
## SPARC Workflow
|
||||
|
||||
${sparcInstructions.split('\n').slice(0, 10).join('\n')}
|
||||
|
||||
## Available SPARC Modes
|
||||
|
||||
${modeList}
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Run SPARC orchestrator (default):
|
||||
\`\`\`bash
|
||||
./claude-flow sparc "build complete authentication system"
|
||||
\`\`\`
|
||||
|
||||
### Run a specific mode:
|
||||
\`\`\`bash
|
||||
./claude-flow sparc run <mode> "your task"
|
||||
./claude-flow sparc run architect "design API structure"
|
||||
./claude-flow sparc run tdd "implement user service"
|
||||
\`\`\`
|
||||
|
||||
### Execute full TDD workflow:
|
||||
\`\`\`bash
|
||||
./claude-flow sparc tdd "implement user authentication"
|
||||
\`\`\`
|
||||
|
||||
### List all modes with details:
|
||||
\`\`\`bash
|
||||
./claude-flow sparc modes --verbose
|
||||
\`\`\`
|
||||
|
||||
## SPARC Methodology Phases
|
||||
|
||||
1. **📋 Specification**: Define requirements, constraints, and acceptance criteria
|
||||
2. **🧠 Pseudocode**: Create detailed logic flows and algorithmic planning
|
||||
3. **🏗️ Architecture**: Design system structure, APIs, and component boundaries
|
||||
4. **🔄 Refinement**: Implement with TDD (Red-Green-Refactor cycle)
|
||||
5. **✅ Completion**: Integrate, document, and validate against requirements
|
||||
|
||||
## Memory Integration
|
||||
|
||||
Use memory commands to persist context across SPARC sessions:
|
||||
\`\`\`bash
|
||||
# Store specifications
|
||||
./claude-flow memory store "spec_auth" "OAuth2 + JWT requirements" --namespace spec
|
||||
|
||||
# Store architectural decisions
|
||||
./claude-flow memory store "arch_api" "RESTful microservices design" --namespace arch
|
||||
|
||||
# Query previous work
|
||||
./claude-flow memory query "authentication" --limit 10
|
||||
|
||||
# Export project memory
|
||||
./claude-flow memory export sparc-project-backup.json
|
||||
\`\`\`
|
||||
|
||||
## Advanced Swarm Mode
|
||||
|
||||
For complex tasks requiring multiple agents with timeout-free execution:
|
||||
\`\`\`bash
|
||||
# Development swarm with monitoring
|
||||
./claude-flow swarm "Build e-commerce platform" --strategy development --monitor --review
|
||||
|
||||
# Background optimization swarm
|
||||
./claude-flow swarm "Optimize system performance" --strategy optimization --background
|
||||
|
||||
# Distributed research swarm
|
||||
./claude-flow swarm "Analyze market trends" --strategy research --distributed --ui
|
||||
\`\`\`
|
||||
|
||||
## Non-Interactive Mode
|
||||
|
||||
For CI/CD integration and automation:
|
||||
\`\`\`bash
|
||||
./claude-flow sparc run code "implement API" --non-interactive
|
||||
./claude-flow sparc tdd "user tests" --non-interactive --enable-permissions
|
||||
\`\`\`
|
||||
|
||||
## Best Practices
|
||||
|
||||
✅ **Modular Design**: Keep files under 500 lines
|
||||
✅ **Environment Safety**: Never hardcode secrets or env values
|
||||
✅ **Test-First**: Always write tests before implementation
|
||||
✅ **Memory Usage**: Store important decisions and context
|
||||
✅ **Task Completion**: All tasks should end with \`attempt_completion\`
|
||||
|
||||
See \`/claude-flow-help\` for all available commands.
|
||||
`;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// help.js - Help text for init command
|
||||
|
||||
export function showInitHelp() {
|
||||
console.log('Initialize Claude Code integration files');
|
||||
console.log();
|
||||
console.log('Usage: claude-flow init [options]');
|
||||
console.log();
|
||||
console.log('Options:');
|
||||
console.log(' --sparc, -s Initialize with SPARC development environment (recommended)');
|
||||
console.log(' --minimal, -m Create minimal configuration files');
|
||||
console.log(' --force, -f Overwrite existing files');
|
||||
console.log(' --help, -h Show this help message');
|
||||
console.log();
|
||||
console.log('Examples:');
|
||||
console.log(' npx claude-flow@latest init --sparc # Recommended first-time setup');
|
||||
console.log(' claude-flow init --sparc # Initialize with SPARC modes');
|
||||
console.log(' claude-flow init --minimal # Minimal setup');
|
||||
console.log(' claude-flow init --force # Overwrite existing files');
|
||||
console.log();
|
||||
console.log('What --sparc creates:');
|
||||
console.log(' • .claude/commands/ directory with 20+ Claude Code slash commands');
|
||||
console.log(' • CLAUDE.md with SPARC-enhanced project instructions');
|
||||
console.log(' • memory/ directory for persistent context storage');
|
||||
console.log(' • coordination/ directory for agent orchestration');
|
||||
console.log(' • ./claude-flow local executable wrapper');
|
||||
console.log(' • Pre-configured for TDD, architecture, and code generation');
|
||||
console.log();
|
||||
console.log('Claude Code Slash Commands Created:');
|
||||
console.log(' • /sparc - Execute SPARC methodology workflows');
|
||||
console.log(' • /sparc-<mode> - Run specific SPARC modes (17+ modes)');
|
||||
console.log(' • /claude-flow-help - Show all claude-flow commands');
|
||||
console.log(' • /claude-flow-memory - Interact with memory system');
|
||||
console.log(' • /claude-flow-swarm - Coordinate multi-agent swarms');
|
||||
console.log();
|
||||
console.log('Available SPARC modes:');
|
||||
console.log(' • architect - System design and architecture');
|
||||
console.log(' • code - Clean, modular implementation');
|
||||
console.log(' • tdd - Test-driven development');
|
||||
console.log(' • debug - Advanced debugging and optimization');
|
||||
console.log(' • security-review - Security analysis and hardening');
|
||||
console.log(' • docs-writer - Documentation creation');
|
||||
console.log(' • integration - System integration');
|
||||
console.log(' • swarm - Multi-agent coordination');
|
||||
console.log(' • spec-pseudocode - Requirements and specifications');
|
||||
console.log(' • devops - Deployment and infrastructure');
|
||||
console.log(' • And 7+ more specialized modes...');
|
||||
console.log();
|
||||
console.log('Learn more: https://github.com/ruvnet/claude-code-flow');
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
// claude-md.js - CLAUDE.md templates
|
||||
|
||||
export function createMinimalClaudeMd() {
|
||||
return `# Claude Code Configuration
|
||||
|
||||
## Build Commands
|
||||
- \`npm run build\`: Build the project
|
||||
- \`npm run test\`: Run tests
|
||||
- \`npm run lint\`: Run linter
|
||||
|
||||
## Code Style
|
||||
- Use TypeScript/ES modules
|
||||
- Follow project conventions
|
||||
- Run typecheck before committing
|
||||
|
||||
## Project Info
|
||||
This is a Claude-Flow AI agent orchestration system.
|
||||
`;
|
||||
}
|
||||
|
||||
export function createFullClaudeMd() {
|
||||
return `# Claude Code Configuration
|
||||
|
||||
## Build Commands
|
||||
- \`npm run build\`: Build the project using Deno compile
|
||||
- \`npm run test\`: Run the full test suite
|
||||
- \`npm run lint\`: Run ESLint and format checks
|
||||
- \`npm run typecheck\`: Run TypeScript type checking
|
||||
- \`./claude-flow start\`: Start the orchestration system
|
||||
- \`./claude-flow --help\`: Show all available commands
|
||||
|
||||
## Code Style Preferences
|
||||
- Use ES modules (import/export) syntax, not CommonJS (require)
|
||||
- Destructure imports when possible (e.g., \`import { foo } from 'bar'\`)
|
||||
- Use TypeScript for all new code
|
||||
- Follow existing naming conventions (camelCase for variables, PascalCase for classes)
|
||||
- Add JSDoc comments for public APIs
|
||||
- Use async/await instead of Promise chains
|
||||
- Prefer const/let over var
|
||||
|
||||
## Workflow Guidelines
|
||||
- Always run typecheck after making code changes
|
||||
- Run tests before committing changes
|
||||
- Use meaningful commit messages following conventional commits
|
||||
- Create feature branches for new functionality
|
||||
- Ensure all tests pass before merging
|
||||
|
||||
## Project Architecture
|
||||
This is a Claude-Flow AI agent orchestration system with the following components:
|
||||
- **CLI Interface**: Command-line tools for managing the system
|
||||
- **Orchestrator**: Core engine for coordinating agents and tasks
|
||||
- **Memory System**: Persistent storage and retrieval of information
|
||||
- **Terminal Management**: Automated terminal session handling
|
||||
- **MCP Integration**: Model Context Protocol server for Claude integration
|
||||
- **Agent Coordination**: Multi-agent task distribution and management
|
||||
|
||||
## Important Notes
|
||||
- Use \`claude --dangerously-skip-permissions\` for unattended operation
|
||||
- The system supports both daemon and interactive modes
|
||||
- Memory persistence is handled automatically
|
||||
- All components are event-driven for scalability
|
||||
|
||||
## Debugging
|
||||
- Check logs in \`./claude-flow.log\`
|
||||
- Use \`./claude-flow status\` to check system health
|
||||
- Monitor with \`./claude-flow monitor\` for real-time updates
|
||||
- Verbose output available with \`--verbose\` flag on most commands
|
||||
`;
|
||||
}
|
||||
|
||||
export function createSparcClaudeMd() {
|
||||
return `# Claude Code Configuration - SPARC Development Environment
|
||||
|
||||
## Project Overview
|
||||
This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
|
||||
|
||||
## SPARC Development Commands
|
||||
|
||||
### Core SPARC Commands
|
||||
- \`./claude-flow sparc modes\`: List all available SPARC development modes
|
||||
- \`./claude-flow sparc run <mode> "<task>"\`: Execute specific SPARC mode for a task
|
||||
- \`./claude-flow sparc tdd "<feature>"\`: Run complete TDD workflow using SPARC methodology
|
||||
- \`./claude-flow sparc info <mode>\`: Get detailed information about a specific mode
|
||||
|
||||
### Standard Build Commands
|
||||
- \`npm run build\`: Build the project
|
||||
- \`npm run test\`: Run the test suite
|
||||
- \`npm run lint\`: Run linter and format checks
|
||||
- \`npm run typecheck\`: Run TypeScript type checking
|
||||
|
||||
## SPARC Methodology Workflow
|
||||
|
||||
### 1. Specification Phase
|
||||
\`\`\`bash
|
||||
# Create detailed specifications and requirements
|
||||
./claude-flow sparc run spec-pseudocode "Define user authentication requirements"
|
||||
\`\`\`
|
||||
- Define clear functional requirements
|
||||
- Document edge cases and constraints
|
||||
- Create user stories and acceptance criteria
|
||||
- Establish non-functional requirements
|
||||
|
||||
### 2. Pseudocode Phase
|
||||
\`\`\`bash
|
||||
# Develop algorithmic logic and data flows
|
||||
./claude-flow sparc run spec-pseudocode "Create authentication flow pseudocode"
|
||||
\`\`\`
|
||||
- Break down complex logic into steps
|
||||
- Define data structures and interfaces
|
||||
- Plan error handling and edge cases
|
||||
- Create modular, testable components
|
||||
|
||||
### 3. Architecture Phase
|
||||
\`\`\`bash
|
||||
# Design system architecture and component structure
|
||||
./claude-flow sparc run architect "Design authentication service architecture"
|
||||
\`\`\`
|
||||
- Create system diagrams and component relationships
|
||||
- Define API contracts and interfaces
|
||||
- Plan database schemas and data flows
|
||||
- Establish security and scalability patterns
|
||||
|
||||
### 4. Refinement Phase (TDD Implementation)
|
||||
\`\`\`bash
|
||||
# Execute Test-Driven Development cycle
|
||||
./claude-flow sparc tdd "implement user authentication system"
|
||||
\`\`\`
|
||||
|
||||
**TDD Cycle:**
|
||||
1. **Red**: Write failing tests first
|
||||
2. **Green**: Implement minimal code to pass tests
|
||||
3. **Refactor**: Optimize and clean up code
|
||||
4. **Repeat**: Continue until feature is complete
|
||||
|
||||
### 5. Completion Phase
|
||||
\`\`\`bash
|
||||
# Integration, documentation, and validation
|
||||
./claude-flow sparc run integration "integrate authentication with user management"
|
||||
\`\`\`
|
||||
- Integrate all components
|
||||
- Perform end-to-end testing
|
||||
- Create comprehensive documentation
|
||||
- Validate against original requirements
|
||||
|
||||
## SPARC Mode Reference
|
||||
|
||||
### Development Modes
|
||||
- **\`architect\`**: System design and architecture planning
|
||||
- **\`code\`**: Clean, modular code implementation
|
||||
- **\`tdd\`**: Test-driven development and testing
|
||||
- **\`spec-pseudocode\`**: Requirements and algorithmic planning
|
||||
- **\`integration\`**: System integration and coordination
|
||||
|
||||
### Quality Assurance Modes
|
||||
- **\`debug\`**: Troubleshooting and bug resolution
|
||||
- **\`security-review\`**: Security analysis and vulnerability assessment
|
||||
- **\`refinement-optimization-mode\`**: Performance optimization and refactoring
|
||||
|
||||
### Support Modes
|
||||
- **\`docs-writer\`**: Documentation creation and maintenance
|
||||
- **\`devops\`**: Deployment and infrastructure management
|
||||
- **\`mcp\`**: External service integration
|
||||
- **\`swarm\`**: Multi-agent coordination for complex tasks
|
||||
|
||||
## Claude Code Slash Commands
|
||||
|
||||
Claude Code slash commands are available in \`.claude/commands/\`:
|
||||
|
||||
### Project Commands
|
||||
- \`/sparc\`: Execute SPARC methodology workflows
|
||||
- \`/sparc-<mode>\`: Run specific SPARC mode (e.g., /sparc-architect)
|
||||
- \`/claude-flow-help\`: Show all Claude-Flow commands
|
||||
- \`/claude-flow-memory\`: Interact with memory system
|
||||
- \`/claude-flow-swarm\`: Coordinate multi-agent swarms
|
||||
|
||||
### Using Slash Commands
|
||||
1. Type \`/\` in Claude Code to see available commands
|
||||
2. Select a command or type its name
|
||||
3. Commands are context-aware and project-specific
|
||||
4. Custom commands can be added to \`.claude/commands/\`
|
||||
|
||||
## Code Style and Best Practices
|
||||
|
||||
### SPARC Development Principles
|
||||
- **Modular Design**: Keep files under 500 lines, break into logical components
|
||||
- **Environment Safety**: Never hardcode secrets or environment-specific values
|
||||
- **Test-First**: Always write tests before implementation (Red-Green-Refactor)
|
||||
- **Clean Architecture**: Separate concerns, use dependency injection
|
||||
- **Documentation**: Maintain clear, up-to-date documentation
|
||||
|
||||
### Coding Standards
|
||||
- Use TypeScript for type safety and better tooling
|
||||
- Follow consistent naming conventions (camelCase for variables, PascalCase for classes)
|
||||
- Implement proper error handling and logging
|
||||
- Use async/await for asynchronous operations
|
||||
- Prefer composition over inheritance
|
||||
|
||||
### Memory and State Management
|
||||
- Use claude-flow memory system for persistent state across sessions
|
||||
- Store progress and findings using namespaced keys
|
||||
- Query previous work before starting new tasks
|
||||
- Export/import memory for backup and sharing
|
||||
|
||||
## SPARC Memory Integration
|
||||
|
||||
### Memory Commands for SPARC Development
|
||||
\`\`\`bash
|
||||
# Store project specifications
|
||||
./claude-flow memory store spec_auth "User authentication requirements and constraints"
|
||||
|
||||
# Store architectural decisions
|
||||
./claude-flow memory store arch_decisions "Database schema and API design choices"
|
||||
|
||||
# Store test results and coverage
|
||||
./claude-flow memory store test_coverage "Authentication module: 95% coverage, all tests passing"
|
||||
|
||||
# Query previous work
|
||||
./claude-flow memory query auth_implementation
|
||||
|
||||
# Export project memory
|
||||
./claude-flow memory export project_backup.json
|
||||
\`\`\`
|
||||
|
||||
### Memory Namespaces
|
||||
- **\`spec\`**: Requirements and specifications
|
||||
- **\`arch\`**: Architecture and design decisions
|
||||
- **\`impl\`**: Implementation notes and code patterns
|
||||
- **\`test\`**: Test results and coverage reports
|
||||
- **\`debug\`**: Bug reports and resolution notes
|
||||
|
||||
## Workflow Examples
|
||||
|
||||
### Feature Development Workflow
|
||||
\`\`\`bash
|
||||
# 1. Start with specification
|
||||
./claude-flow sparc run spec-pseudocode "User profile management feature"
|
||||
|
||||
# 2. Design architecture
|
||||
./claude-flow sparc run architect "Profile service architecture with data validation"
|
||||
|
||||
# 3. Implement with TDD
|
||||
./claude-flow sparc tdd "user profile CRUD operations"
|
||||
|
||||
# 4. Security review
|
||||
./claude-flow sparc run security-review "profile data access and validation"
|
||||
|
||||
# 5. Integration testing
|
||||
./claude-flow sparc run integration "profile service with authentication system"
|
||||
|
||||
# 6. Documentation
|
||||
./claude-flow sparc run docs-writer "profile service API documentation"
|
||||
\`\`\`
|
||||
|
||||
### Bug Fix Workflow
|
||||
\`\`\`bash
|
||||
# 1. Debug and analyze
|
||||
./claude-flow sparc run debug "authentication token expiration issue"
|
||||
|
||||
# 2. Write regression tests
|
||||
./claude-flow sparc run tdd "token refresh mechanism tests"
|
||||
|
||||
# 3. Implement fix
|
||||
./claude-flow sparc run code "fix token refresh in authentication service"
|
||||
|
||||
# 4. Security review
|
||||
./claude-flow sparc run security-review "token handling security implications"
|
||||
\`\`\`
|
||||
|
||||
## Configuration Files
|
||||
|
||||
### Claude Code Integration
|
||||
- **\`.claude/commands/\`**: Claude Code slash commands for all SPARC modes
|
||||
- **\`.claude/logs/\`**: Conversation and session logs
|
||||
|
||||
### SPARC Configuration
|
||||
- **\`.roomodes\`**: SPARC mode definitions and configurations (auto-generated)
|
||||
- **\`.roo/\`**: SPARC templates and workflows (auto-generated)
|
||||
|
||||
### Claude-Flow Configuration
|
||||
- **\`memory/\`**: Persistent memory and session data
|
||||
- **\`coordination/\`**: Multi-agent coordination settings
|
||||
- **\`CLAUDE.md\`**: Project instructions for Claude Code
|
||||
|
||||
## Git Workflow Integration
|
||||
|
||||
### Commit Strategy with SPARC
|
||||
- **Specification commits**: After completing requirements analysis
|
||||
- **Architecture commits**: After design phase completion
|
||||
- **TDD commits**: After each Red-Green-Refactor cycle
|
||||
- **Integration commits**: After successful component integration
|
||||
- **Documentation commits**: After completing documentation updates
|
||||
|
||||
### Branch Strategy
|
||||
- **\`feature/sparc-<feature-name>\`**: Feature development with SPARC methodology
|
||||
- **\`hotfix/sparc-<issue>\`**: Bug fixes using SPARC debugging workflow
|
||||
- **\`refactor/sparc-<component>\`**: Refactoring using optimization mode
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common SPARC Issues
|
||||
- **Mode not found**: Check \`.roomodes\` file exists and is valid JSON
|
||||
- **Memory persistence**: Ensure \`memory/\` directory has write permissions
|
||||
- **Tool access**: Verify required tools are available for the selected mode
|
||||
- **Namespace conflicts**: Use unique memory namespaces for different features
|
||||
|
||||
### Debug Commands
|
||||
\`\`\`bash
|
||||
# Check SPARC configuration
|
||||
./claude-flow sparc modes
|
||||
|
||||
# Verify memory system
|
||||
./claude-flow memory stats
|
||||
|
||||
# Check system status
|
||||
./claude-flow status
|
||||
|
||||
# View detailed mode information
|
||||
./claude-flow sparc info <mode-name>
|
||||
\`\`\`
|
||||
|
||||
## Project Architecture
|
||||
|
||||
This SPARC-enabled project follows a systematic development approach:
|
||||
- **Clear separation of concerns** through modular design
|
||||
- **Test-driven development** ensuring reliability and maintainability
|
||||
- **Iterative refinement** for continuous improvement
|
||||
- **Comprehensive documentation** for team collaboration
|
||||
- **AI-assisted development** through specialized SPARC modes
|
||||
|
||||
## Important Notes
|
||||
|
||||
- Always run tests before committing (\`npm run test\`)
|
||||
- Use SPARC memory system to maintain context across sessions
|
||||
- Follow the Red-Green-Refactor cycle during TDD phases
|
||||
- Document architectural decisions in memory for future reference
|
||||
- Regular security reviews for any authentication or data handling code
|
||||
- Claude Code slash commands provide quick access to SPARC modes
|
||||
|
||||
For more information about SPARC methodology, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
|
||||
`;
|
||||
}
|
||||
Reference in new issue
Block a user