mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
- Reorganize v3/ into implementation/ subfolders: - planning/, architecture/, migration/, integration/ - security/, adrs/, research/, swarm-plans/ - Add 15-agent concurrent swarm implementation plans: - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x) - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies - Update .claude/settings.json with proper hooks format - Add bash aliases for claude --dangerously-skip-permissions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
576 lines
17 KiB
JavaScript
576 lines
17 KiB
JavaScript
// SPARC Command Variations
|
|
// Specialized SPARC commands for different development scenarios
|
|
|
|
import { SparcMethodology } from './index.js';
|
|
|
|
/**
|
|
* SPARC Development Command
|
|
* Full-stack development workflow with TDD
|
|
*/
|
|
export async function sparcDev(taskDescription, options = {}) {
|
|
console.log('🚀 SPARC Development Workflow');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-dev',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
autoRemediation: true,
|
|
mode: 'development',
|
|
focus: ['specification', 'architecture', 'refinement'],
|
|
qualityGates: {
|
|
testCoverage: 85,
|
|
codeQuality: 80,
|
|
performance: 200, // ms
|
|
},
|
|
tddCycles: true,
|
|
continuousIntegration: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Development completed');
|
|
console.log(`📊 Test Coverage: ${result.refinement?.testResults?.coverage?.toFixed(1)}%`);
|
|
console.log(`🎯 Code Quality: ${result.refinement?.codeQuality?.overall?.toFixed(1)}/100`);
|
|
console.log(`⚡ Performance: ${result.refinement?.performance?.responseTime?.average}ms`);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Development failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC API Command
|
|
* API-focused development with OpenAPI specs
|
|
*/
|
|
export async function sparcApi(taskDescription, options = {}) {
|
|
console.log('🔌 SPARC API Development');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-api',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'api',
|
|
focus: ['specification', 'architecture', 'refinement'],
|
|
specializations: {
|
|
specification: 'api_requirements',
|
|
architecture: 'api_design',
|
|
refinement: 'api_testing',
|
|
},
|
|
qualityGates: {
|
|
apiCoverage: 100,
|
|
responseTime: 100, // ms
|
|
securityScore: 90,
|
|
},
|
|
generateOpenAPI: true,
|
|
includeAuthentication: true,
|
|
includeValidation: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC API Development completed');
|
|
console.log(`🔌 API Endpoints: ${result.architecture?.apiDesign?.endpoints?.length || 0}`);
|
|
console.log(`🔒 Security Score: ${result.refinement?.security?.score || 0}/100`);
|
|
console.log(`📋 OpenAPI Spec: Generated`);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC API Development failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC UI Command
|
|
* Frontend/UI development with component architecture
|
|
*/
|
|
export async function sparcUi(taskDescription, options = {}) {
|
|
console.log('🎨 SPARC UI Development');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-ui',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'ui',
|
|
focus: ['specification', 'pseudocode', 'architecture', 'refinement'],
|
|
specializations: {
|
|
specification: 'ux_requirements',
|
|
pseudocode: 'ui_flows',
|
|
architecture: 'component_design',
|
|
refinement: 'ui_testing',
|
|
},
|
|
qualityGates: {
|
|
accessibility: 95,
|
|
performance: 3000, // ms load time
|
|
responsiveness: 100,
|
|
},
|
|
includeAccessibility: true,
|
|
includeResponsiveDesign: true,
|
|
includeComponentLibrary: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC UI Development completed');
|
|
console.log(`🎨 Components: ${result.architecture?.components?.length || 0}`);
|
|
console.log(
|
|
`♿ Accessibility: ${result.refinement?.validation?.usability?.accessibility?.score || 0}%`,
|
|
);
|
|
console.log(
|
|
`📱 Responsive: ${result.refinement?.validation?.compatibility?.devices?.score || 0}%`,
|
|
);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC UI Development failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Test Command
|
|
* Test-driven development with comprehensive testing
|
|
*/
|
|
export async function sparcTest(taskDescription, options = {}) {
|
|
console.log('🧪 SPARC Test-Driven Development');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-test',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'testing',
|
|
focus: ['specification', 'refinement'],
|
|
specializations: {
|
|
specification: 'test_requirements',
|
|
refinement: 'comprehensive_testing',
|
|
},
|
|
qualityGates: {
|
|
testCoverage: 95,
|
|
mutationScore: 80,
|
|
performanceTests: 100,
|
|
},
|
|
tddCycles: true,
|
|
includeUnitTests: true,
|
|
includeIntegrationTests: true,
|
|
includeE2ETests: true,
|
|
includePerformanceTests: true,
|
|
includeMutationTesting: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Test Development completed');
|
|
console.log(`🧪 Test Coverage: ${result.refinement?.testResults?.coverage?.toFixed(1)}%`);
|
|
console.log(`🔬 Test Types: Unit, Integration, E2E, Performance`);
|
|
console.log(`⚡ TDD Cycles: ${result.refinement?.tddCycles?.length || 0}`);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Test Development failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Refactor Command
|
|
* Code refactoring and optimization
|
|
*/
|
|
export async function sparcRefactor(taskDescription, options = {}) {
|
|
console.log('🔄 SPARC Refactoring');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-refactor',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'refactoring',
|
|
focus: ['architecture', 'refinement'],
|
|
specializations: {
|
|
architecture: 'refactoring_design',
|
|
refinement: 'code_optimization',
|
|
},
|
|
qualityGates: {
|
|
codeQuality: 90,
|
|
performance: 150, // ms improvement
|
|
maintainability: 85,
|
|
},
|
|
preserveFunctionality: true,
|
|
incremental: true,
|
|
safetyFirst: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Refactoring completed');
|
|
console.log(
|
|
`📈 Quality Improvement: +${result.refinement?.refactoring?.after?.overall - result.refinement?.refactoring?.before?.overall || 0} points`,
|
|
);
|
|
console.log(
|
|
`⚡ Performance Gain: ${result.refinement?.optimizations?.length || 0} optimizations applied`,
|
|
);
|
|
console.log(
|
|
`🔧 Refactoring Techniques: ${result.refinement?.refactoring?.techniques?.length || 0}`,
|
|
);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Refactoring failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Research Command
|
|
* Research and analysis workflow
|
|
*/
|
|
export async function sparcResearch(taskDescription, options = {}) {
|
|
console.log('🔍 SPARC Research & Analysis');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-research',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'research',
|
|
focus: ['specification', 'pseudocode'],
|
|
specializations: {
|
|
specification: 'research_requirements',
|
|
pseudocode: 'analysis_workflow',
|
|
},
|
|
qualityGates: {
|
|
comprehensiveness: 90,
|
|
accuracy: 95,
|
|
relevance: 85,
|
|
},
|
|
includeWebSearch: true,
|
|
includeDataAnalysis: true,
|
|
includeLiteratureReview: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Research completed');
|
|
console.log(`📚 Sources Analyzed: ${result.specification?.userStories?.length || 0}`);
|
|
console.log(`📊 Analysis Workflows: ${result.pseudocode?.algorithms?.length || 0}`);
|
|
console.log(
|
|
`🎯 Research Quality: ${result.specification?.requirements?.filter((r) => r.fulfilled)?.length || 0} requirements validated`,
|
|
);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Research failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Data Command
|
|
* Data engineering and analytics workflow
|
|
*/
|
|
export async function sparcData(taskDescription, options = {}) {
|
|
console.log('📊 SPARC Data Engineering');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-data',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'data',
|
|
focus: ['specification', 'architecture', 'refinement'],
|
|
specializations: {
|
|
specification: 'data_requirements',
|
|
architecture: 'data_architecture',
|
|
refinement: 'data_validation',
|
|
},
|
|
qualityGates: {
|
|
dataQuality: 95,
|
|
performance: 1000, // ms query time
|
|
accuracy: 99,
|
|
},
|
|
includeDataModeling: true,
|
|
includeETL: true,
|
|
includeValidation: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Data Engineering completed');
|
|
console.log(`📊 Data Models: ${result.architecture?.dataModel?.entities?.length || 0}`);
|
|
console.log(`🔄 ETL Pipelines: ${result.architecture?.integrationPoints?.length || 0}`);
|
|
console.log(`✅ Data Quality: ${result.refinement?.validation?.score || 0}/100`);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Data Engineering failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Security Command
|
|
* Security-focused development and auditing
|
|
*/
|
|
export async function sparcSecurity(taskDescription, options = {}) {
|
|
console.log('🔒 SPARC Security Development');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-security',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'security',
|
|
focus: ['specification', 'architecture', 'refinement'],
|
|
specializations: {
|
|
specification: 'security_requirements',
|
|
architecture: 'security_architecture',
|
|
refinement: 'security_testing',
|
|
},
|
|
qualityGates: {
|
|
securityScore: 95,
|
|
vulnerabilities: 0,
|
|
compliance: 100,
|
|
},
|
|
includeSecurityReview: true,
|
|
includePenetrationTesting: true,
|
|
includeComplianceCheck: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Security Development completed');
|
|
console.log(`🔒 Security Score: ${result.refinement?.security?.score || 0}/100`);
|
|
console.log(`🛡️ Vulnerabilities: ${result.refinement?.security?.vulnerabilities?.length || 0}`);
|
|
console.log(
|
|
`📋 Compliance: ${Object.values(result.refinement?.security?.compliance || {}).filter((c) => c).length}/3 standards`,
|
|
);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Security Development failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC DevOps Command
|
|
* DevOps and deployment workflow
|
|
*/
|
|
export async function sparcDevOps(taskDescription, options = {}) {
|
|
console.log('⚙️ SPARC DevOps Workflow');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-devops',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'devops',
|
|
focus: ['architecture', 'completion'],
|
|
specializations: {
|
|
architecture: 'deployment_architecture',
|
|
completion: 'devops_deployment',
|
|
},
|
|
qualityGates: {
|
|
deployment: 100,
|
|
monitoring: 100,
|
|
automation: 90,
|
|
},
|
|
includeCI: true,
|
|
includeCD: true,
|
|
includeMonitoring: true,
|
|
includeInfrastructureAsCode: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC DevOps completed');
|
|
console.log(
|
|
`🚀 Deployments: ${result.completion?.deployment?.environments?.length || 0} environments`,
|
|
);
|
|
console.log(
|
|
`📊 Monitoring: ${result.completion?.monitoring?.alerts?.length || 0} alerts configured`,
|
|
);
|
|
console.log(
|
|
`🤖 Automation: ${result.completion?.deployment?.successful ? 'Successful' : 'Pending'}`,
|
|
);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC DevOps failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SPARC Performance Command
|
|
* Performance optimization and monitoring
|
|
*/
|
|
export async function sparcPerformance(taskDescription, options = {}) {
|
|
console.log('⚡ SPARC Performance Optimization');
|
|
|
|
const sparcOptions = {
|
|
...options,
|
|
namespace: options.namespace || 'sparc-performance',
|
|
swarmEnabled: options.swarm || false,
|
|
neuralLearning: options.learning !== false,
|
|
mode: 'performance',
|
|
focus: ['architecture', 'refinement'],
|
|
specializations: {
|
|
architecture: 'performance_architecture',
|
|
refinement: 'performance_optimization',
|
|
},
|
|
qualityGates: {
|
|
responseTime: 100, // ms
|
|
throughput: 1000, // req/s
|
|
resourceUsage: 70, // %
|
|
},
|
|
includeLoadTesting: true,
|
|
includeProfiler: true,
|
|
includeCaching: true,
|
|
includeOptimization: true,
|
|
};
|
|
|
|
const sparc = new SparcMethodology(taskDescription, sparcOptions);
|
|
|
|
try {
|
|
const result = await sparc.execute();
|
|
|
|
console.log('\n✅ SPARC Performance Optimization completed');
|
|
console.log(
|
|
`⚡ Response Time: ${result.refinement?.performance?.responseTime?.average || 0}ms`,
|
|
);
|
|
console.log(
|
|
`🚀 Throughput: ${result.refinement?.performance?.throughput?.requestsPerSecond || 0} req/s`,
|
|
);
|
|
console.log(`📈 Optimizations: ${result.refinement?.optimizations?.length || 0} applied`);
|
|
|
|
return result;
|
|
} catch (error) {
|
|
console.error('❌ SPARC Performance Optimization failed:', error.message);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Command factory for creating SPARC command variations
|
|
*/
|
|
export const sparcCommands = {
|
|
dev: sparcDev,
|
|
api: sparcApi,
|
|
ui: sparcUi,
|
|
test: sparcTest,
|
|
refactor: sparcRefactor,
|
|
research: sparcResearch,
|
|
data: sparcData,
|
|
security: sparcSecurity,
|
|
devops: sparcDevOps,
|
|
performance: sparcPerformance,
|
|
};
|
|
|
|
/**
|
|
* Get available SPARC command variations
|
|
*/
|
|
export function getSparcCommands() {
|
|
return Object.keys(sparcCommands);
|
|
}
|
|
|
|
/**
|
|
* Execute a SPARC command variation
|
|
*/
|
|
export async function executeSparcCommand(command, taskDescription, options = {}) {
|
|
if (!sparcCommands[command]) {
|
|
throw new Error(
|
|
`Unknown SPARC command: ${command}. Available commands: ${getSparcCommands().join(', ')}`,
|
|
);
|
|
}
|
|
|
|
return await sparcCommands[command](taskDescription, options);
|
|
}
|
|
|
|
/**
|
|
* Get help for SPARC command variations
|
|
*/
|
|
export function getSparcCommandHelp(command) {
|
|
const helpTexts = {
|
|
dev: 'Full-stack development workflow with TDD and quality gates',
|
|
api: 'API-focused development with OpenAPI specifications and security',
|
|
ui: 'Frontend/UI development with component architecture and accessibility',
|
|
test: 'Test-driven development with comprehensive testing strategies',
|
|
refactor: 'Code refactoring and optimization while preserving functionality',
|
|
research: 'Research and analysis workflow with data gathering',
|
|
data: 'Data engineering and analytics with quality validation',
|
|
security: 'Security-focused development with auditing and compliance',
|
|
devops: 'DevOps workflow with CI/CD and infrastructure automation',
|
|
performance: 'Performance optimization with load testing and monitoring',
|
|
};
|
|
|
|
return helpTexts[command] || 'Unknown command';
|
|
}
|
|
|
|
/**
|
|
* Show help for all SPARC command variations
|
|
*/
|
|
export function showSparcCommandsHelp() {
|
|
console.log('🎯 SPARC Command Variations:');
|
|
console.log();
|
|
|
|
for (const [command, helpText] of Object.entries(
|
|
getSparcCommands().reduce((acc, cmd) => {
|
|
acc[cmd] = getSparcCommandHelp(cmd);
|
|
return acc;
|
|
}, {}),
|
|
)) {
|
|
console.log(` sparc-${command.padEnd(12)} ${helpText}`);
|
|
}
|
|
|
|
console.log();
|
|
console.log('Usage:');
|
|
console.log(' claude-flow sparc-<command> "<task-description>" [options]');
|
|
console.log();
|
|
console.log('Examples:');
|
|
console.log(' claude-flow sparc-dev "build user authentication system"');
|
|
console.log(' claude-flow sparc-api "create REST API for e-commerce" --swarm');
|
|
console.log(' claude-flow sparc-test "comprehensive testing for payment module"');
|
|
console.log(' claude-flow sparc-security "security audit for web application"');
|
|
}
|
|
|
|
export default {
|
|
sparcCommands,
|
|
getSparcCommands,
|
|
executeSparcCommand,
|
|
getSparcCommandHelp,
|
|
showSparcCommandsHelp,
|
|
};
|