claude-flow 1.0.31 → 1.0.32
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.
- package/package.json +1 -1
- package/src/cli/command-registry.js +30 -12
- package/src/cli/simple-cli.js +13 -4
- package/src/cli/simple-commands/init.js +41 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +44 -2
- package/src/cli/simple-commands/sparc-modes/code.js +41 -3
- package/src/cli/simple-commands/sparc-modes/index.js +66 -5
- package/src/cli/simple-commands/sparc-modes/integration.js +18 -1
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +28 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +20 -4
- package/src/cli/simple-commands/sparc.js +79 -28
package/package.json
CHANGED
|
@@ -16,13 +16,22 @@ export const commandRegistry = new Map();
|
|
|
16
16
|
export function registerCoreCommands() {
|
|
17
17
|
commandRegistry.set('init', {
|
|
18
18
|
handler: initCommand,
|
|
19
|
-
description: 'Initialize Claude Code integration files',
|
|
19
|
+
description: 'Initialize Claude Code integration files and SPARC development environment',
|
|
20
20
|
usage: 'init [--force] [--minimal] [--sparc]',
|
|
21
21
|
examples: [
|
|
22
|
-
'init --sparc',
|
|
23
|
-
'init --
|
|
24
|
-
'init --
|
|
25
|
-
|
|
22
|
+
'npx claude-flow@latest init --sparc # Recommended: Full SPARC setup',
|
|
23
|
+
'init --sparc # Initialize with SPARC modes',
|
|
24
|
+
'init --force --minimal # Minimal setup, overwrite existing',
|
|
25
|
+
'init --sparc --force # Force SPARC setup'
|
|
26
|
+
],
|
|
27
|
+
details: `
|
|
28
|
+
The --sparc flag creates a complete development environment:
|
|
29
|
+
• .roomodes file containing 17 specialized SPARC modes
|
|
30
|
+
• CLAUDE.md for AI-readable project instructions
|
|
31
|
+
• Pre-configured modes: architect, code, tdd, debug, security, and more
|
|
32
|
+
• Ready for TDD workflows and automated code generation
|
|
33
|
+
|
|
34
|
+
First-time users should run: npx claude-flow@latest init --sparc`
|
|
26
35
|
});
|
|
27
36
|
|
|
28
37
|
commandRegistry.set('memory', {
|
|
@@ -40,12 +49,13 @@ export function registerCoreCommands() {
|
|
|
40
49
|
commandRegistry.set('sparc', {
|
|
41
50
|
handler: sparcCommand,
|
|
42
51
|
description: 'SPARC development mode operations',
|
|
43
|
-
usage: 'sparc
|
|
52
|
+
usage: 'sparc [subcommand] [options]',
|
|
44
53
|
examples: [
|
|
45
|
-
'sparc
|
|
46
|
-
'sparc
|
|
47
|
-
'sparc
|
|
48
|
-
'sparc
|
|
54
|
+
'sparc "orchestrate full app development" # Default: sparc orchestrator',
|
|
55
|
+
'sparc modes # List available modes',
|
|
56
|
+
'sparc run code "implement feature" # Run specific mode',
|
|
57
|
+
'sparc tdd "feature description" # TDD workflow',
|
|
58
|
+
'sparc info architect # Mode details'
|
|
49
59
|
]
|
|
50
60
|
});
|
|
51
61
|
|
|
@@ -184,12 +194,20 @@ export function showCommandHelp(name) {
|
|
|
184
194
|
|
|
185
195
|
console.log(`Command: ${name}`);
|
|
186
196
|
console.log(`Description: ${command.description}`);
|
|
187
|
-
console.log(`Usage: ${command.usage}`);
|
|
197
|
+
console.log(`Usage: claude-flow ${command.usage}`);
|
|
198
|
+
|
|
199
|
+
if (command.details) {
|
|
200
|
+
console.log(command.details);
|
|
201
|
+
}
|
|
188
202
|
|
|
189
203
|
if (command.examples.length > 0) {
|
|
190
204
|
console.log('\nExamples:');
|
|
191
205
|
for (const example of command.examples) {
|
|
192
|
-
|
|
206
|
+
if (example.startsWith('npx')) {
|
|
207
|
+
console.log(` ${example}`);
|
|
208
|
+
} else {
|
|
209
|
+
console.log(` claude-flow ${example}`);
|
|
210
|
+
}
|
|
193
211
|
}
|
|
194
212
|
}
|
|
195
213
|
}
|
package/src/cli/simple-cli.js
CHANGED
|
@@ -22,6 +22,14 @@ function printHelp() {
|
|
|
22
22
|
USAGE:
|
|
23
23
|
claude-flow <command> [options]
|
|
24
24
|
|
|
25
|
+
INSTALLATION & SETUP:
|
|
26
|
+
npx claude-flow@latest init --sparc # Initialize SPARC development environment
|
|
27
|
+
|
|
28
|
+
The --sparc flag creates:
|
|
29
|
+
• .roomodes file with 17 pre-configured SPARC modes
|
|
30
|
+
• CLAUDE.md for project instructions
|
|
31
|
+
• Ready-to-use TDD and code generation environment
|
|
32
|
+
|
|
25
33
|
KEY COMMANDS:
|
|
26
34
|
init [--sparc] Initialize project with Claude integration
|
|
27
35
|
agent spawn <type> [--name <name>] Create AI agent (researcher, coder, analyst)
|
|
@@ -38,10 +46,11 @@ COMMAND CATEGORIES:
|
|
|
38
46
|
Enterprise: project, deploy, cloud, security, analytics
|
|
39
47
|
|
|
40
48
|
QUICK START:
|
|
41
|
-
claude-flow init --sparc
|
|
42
|
-
claude-flow
|
|
43
|
-
claude-flow sparc
|
|
44
|
-
claude-flow sparc
|
|
49
|
+
npx claude-flow@latest init --sparc # First-time setup with SPARC modes
|
|
50
|
+
claude-flow sparc modes # List available development modes
|
|
51
|
+
claude-flow sparc "build app" # Run SPARC orchestrator (default)
|
|
52
|
+
claude-flow sparc run code "feature" # Run specific mode (auto-coder)
|
|
53
|
+
claude-flow sparc tdd "tests" # Run test-driven development
|
|
45
54
|
claude-flow memory store key "data" # Store information
|
|
46
55
|
claude-flow status # Check system status
|
|
47
56
|
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { printSuccess, printError, printWarning } from '../utils.js';
|
|
3
3
|
|
|
4
4
|
export async function initCommand(subArgs, flags) {
|
|
5
|
+
// Show help if requested
|
|
6
|
+
if (flags.help || flags.h || subArgs.includes('--help') || subArgs.includes('-h')) {
|
|
7
|
+
showInitHelp();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
// Parse init options
|
|
6
12
|
const initForce = subArgs.includes('--force') || subArgs.includes('-f') || flags.force;
|
|
7
13
|
const initMinimal = subArgs.includes('--minimal') || subArgs.includes('-m') || flags.minimal;
|
|
@@ -905,4 +911,39 @@ You can customize this environment by:
|
|
|
905
911
|
|
|
906
912
|
For more information, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
|
|
907
913
|
`;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function showInitHelp() {
|
|
917
|
+
console.log('Initialize Claude Code integration files');
|
|
918
|
+
console.log();
|
|
919
|
+
console.log('Usage: claude-flow init [options]');
|
|
920
|
+
console.log();
|
|
921
|
+
console.log('Options:');
|
|
922
|
+
console.log(' --sparc, -s Initialize with SPARC development environment (recommended)');
|
|
923
|
+
console.log(' --minimal, -m Create minimal configuration files');
|
|
924
|
+
console.log(' --force, -f Overwrite existing files');
|
|
925
|
+
console.log(' --help, -h Show this help message');
|
|
926
|
+
console.log();
|
|
927
|
+
console.log('Examples:');
|
|
928
|
+
console.log(' npx claude-flow@latest init --sparc # Recommended first-time setup');
|
|
929
|
+
console.log(' claude-flow init --sparc # Initialize with SPARC modes');
|
|
930
|
+
console.log(' claude-flow init --minimal # Minimal setup');
|
|
931
|
+
console.log(' claude-flow init --force # Overwrite existing files');
|
|
932
|
+
console.log();
|
|
933
|
+
console.log('What --sparc creates:');
|
|
934
|
+
console.log(' • .roomodes file with 17 specialized SPARC development modes');
|
|
935
|
+
console.log(' • CLAUDE.md with SPARC-enhanced project instructions');
|
|
936
|
+
console.log(' • memory/ directory for persistent context storage');
|
|
937
|
+
console.log(' • .roo/ directory with templates and workflows');
|
|
938
|
+
console.log(' • Pre-configured for TDD, architecture, and code generation');
|
|
939
|
+
console.log();
|
|
940
|
+
console.log('Available SPARC modes include:');
|
|
941
|
+
console.log(' - architect: System design and architecture');
|
|
942
|
+
console.log(' - code: Clean, modular implementation');
|
|
943
|
+
console.log(' - tdd: Test-driven development');
|
|
944
|
+
console.log(' - debug: Advanced debugging and optimization');
|
|
945
|
+
console.log(' - security-review: Security analysis and hardening');
|
|
946
|
+
console.log(' - And 12 more specialized modes...');
|
|
947
|
+
console.log();
|
|
948
|
+
console.log('Learn more: https://github.com/ruvnet/claude-code-flow');
|
|
908
949
|
}
|
|
@@ -36,7 +36,21 @@ export function getArchitectOrchestration(taskDescription, memoryNamespace) {
|
|
|
36
36
|
- Identify tasks for other SPARC modes
|
|
37
37
|
- Store plan: \`npx claude-flow memory store ${memoryNamespace}_implementation_plan "Phase 1: Core auth (tdd mode). Phase 2: User management (code mode). Phase 3: Integration (integration mode)."\`
|
|
38
38
|
|
|
39
|
-
5. **
|
|
39
|
+
5. **Directory Safety**
|
|
40
|
+
- **IMPORTANT**: All files should be created in the current working directory
|
|
41
|
+
- **DO NOT** create files in system directories or node_modules
|
|
42
|
+
- For named projects, create a subdirectory: \\\`mkdir project-name && cd project-name\\\`
|
|
43
|
+
- Use relative paths from your working directory
|
|
44
|
+
- Example structure:
|
|
45
|
+
\\\`\\\`\\\`
|
|
46
|
+
./ (current directory)
|
|
47
|
+
├── architecture/
|
|
48
|
+
│ ├── system-overview.md
|
|
49
|
+
│ └── api-specifications.md
|
|
50
|
+
└── implementation-plan.md
|
|
51
|
+
\\\`\\\`\\\`
|
|
52
|
+
|
|
53
|
+
6. **Deliverables**
|
|
40
54
|
- architecture/
|
|
41
55
|
- system-overview.md (with Mermaid diagrams)
|
|
42
56
|
- api-specifications.md (OpenAPI/AsyncAPI specs)
|
|
@@ -49,5 +63,33 @@ export function getArchitectOrchestration(taskDescription, memoryNamespace) {
|
|
|
49
63
|
After completing architecture, delegate to appropriate modes:
|
|
50
64
|
- \`npx claude-flow sparc run spec-pseudocode "Create detailed pseudocode for ${taskDescription}" --non-interactive\`
|
|
51
65
|
- \`npx claude-flow sparc run tdd "Implement core authentication module" --non-interactive\`
|
|
52
|
-
- \`npx claude-flow sparc run security-review "Review architecture for vulnerabilities" --non-interactive
|
|
66
|
+
- \`npx claude-flow sparc run security-review "Review architecture for vulnerabilities" --non-interactive\`
|
|
67
|
+
|
|
68
|
+
## 🏗️ Parallel Architecture Analysis with BatchTool
|
|
69
|
+
Leverage concurrent analysis for comprehensive system design:
|
|
70
|
+
|
|
71
|
+
\`\`\`bash
|
|
72
|
+
# Parallel architecture research and analysis
|
|
73
|
+
batchtool run --parallel --tag "architecture-${taskDescription}" \\
|
|
74
|
+
"npx claude-flow sparc run ask 'research scalability patterns for ${taskDescription}' --non-interactive" \\
|
|
75
|
+
"npx claude-flow sparc run security-review 'analyze security requirements' --non-interactive" \\
|
|
76
|
+
"npx claude-flow sparc run ask 'research integration patterns' --non-interactive" \\
|
|
77
|
+
"npx claude-flow sparc run ask 'analyze performance requirements' --non-interactive"
|
|
78
|
+
|
|
79
|
+
# Boomerang architecture refinement
|
|
80
|
+
batchtool orchestrate --boomerang --name "architecture-refinement" \\
|
|
81
|
+
--analyze "npx claude-flow sparc run architect 'initial system design' --non-interactive" \\
|
|
82
|
+
--review "npx claude-flow sparc run security-review 'review architecture' --non-interactive" \\
|
|
83
|
+
--refine "npx claude-flow sparc run architect 'refine based on security feedback' --non-interactive" \\
|
|
84
|
+
--validate "npx claude-flow sparc run integration 'validate integration points' --non-interactive" \\
|
|
85
|
+
--finalize "npx claude-flow sparc run docs-writer 'document final architecture' --non-interactive"
|
|
86
|
+
|
|
87
|
+
# Component-wise architecture development
|
|
88
|
+
batchtool run --component-parallel \\
|
|
89
|
+
--frontend "npx claude-flow sparc run architect 'design frontend architecture' --non-interactive" \\
|
|
90
|
+
--backend "npx claude-flow sparc run architect 'design backend architecture' --non-interactive" \\
|
|
91
|
+
--data "npx claude-flow sparc run architect 'design data architecture' --non-interactive" \\
|
|
92
|
+
--infra "npx claude-flow sparc run devops 'design infrastructure' --non-interactive" \\
|
|
93
|
+
--integrate "npx claude-flow sparc run integration 'design integration layer' --non-interactive:wait-for=all"
|
|
94
|
+
\`\`\``;
|
|
53
95
|
}
|
|
@@ -3,7 +3,9 @@ export function getCodeOrchestration(taskDescription, memoryNamespace) {
|
|
|
3
3
|
return `
|
|
4
4
|
## Task Orchestration Steps
|
|
5
5
|
|
|
6
|
-
1. **
|
|
6
|
+
1. **Project Directory Setup & Context Review** (5 mins)
|
|
7
|
+
- Verify current working directory and create project structure
|
|
8
|
+
- For named projects (e.g., "hello-world"), create as subdirectory
|
|
7
9
|
- Review implementation task: "${taskDescription}"
|
|
8
10
|
- Query architecture and pseudocode:
|
|
9
11
|
\`\`\`bash
|
|
@@ -16,7 +18,8 @@ export function getCodeOrchestration(taskDescription, memoryNamespace) {
|
|
|
16
18
|
- Check for any blocking dependencies
|
|
17
19
|
|
|
18
20
|
2. **Project Setup & Configuration** (10 mins)
|
|
19
|
-
- Initialize project structure
|
|
21
|
+
- Initialize project structure in current directory or subdirectory
|
|
22
|
+
- IMPORTANT: Use pwd to verify you're NOT in node_modules/
|
|
20
23
|
- Set up environment configuration (NO hardcoded values):
|
|
21
24
|
- Create .env.example with all required variables
|
|
22
25
|
- Set up config/ directory with environment loaders
|
|
@@ -55,7 +58,15 @@ export function getCodeOrchestration(taskDescription, memoryNamespace) {
|
|
|
55
58
|
- Update README with setup instructions
|
|
56
59
|
- Store completion: \`npx claude-flow memory store ${memoryNamespace}_code_complete "Implementation complete. All modules < 500 lines. No hardcoded secrets. Ready for testing and integration."\`
|
|
57
60
|
|
|
61
|
+
## Directory Safety Check
|
|
62
|
+
Before creating any files:
|
|
63
|
+
1. Run \`pwd\` to verify current directory
|
|
64
|
+
2. Ensure you're NOT in /node_modules/ or any system directory
|
|
65
|
+
3. If creating a named project, create it as a subdirectory
|
|
66
|
+
4. Example: For "hello-world", create ./hello-world/ in current directory
|
|
67
|
+
|
|
58
68
|
## Deliverables
|
|
69
|
+
All files should be created relative to the current working directory:
|
|
59
70
|
- src/
|
|
60
71
|
- domain/ (business logic, < 500 lines per file)
|
|
61
72
|
- application/ (use cases, < 500 lines per file)
|
|
@@ -81,5 +92,32 @@ export function getCodeOrchestration(taskDescription, memoryNamespace) {
|
|
|
81
92
|
After implementation, delegate to:
|
|
82
93
|
- \`npx claude-flow sparc run tdd "Write comprehensive tests for ${taskDescription}" --non-interactive\`
|
|
83
94
|
- \`npx claude-flow sparc run integration "Integrate ${taskDescription} with existing systems" --non-interactive\`
|
|
84
|
-
- \`npx claude-flow sparc run security-review "Security audit for ${taskDescription}" --non-interactive
|
|
95
|
+
- \`npx claude-flow sparc run security-review "Security audit for ${taskDescription}" --non-interactive\`
|
|
96
|
+
|
|
97
|
+
## 🚀 Parallel Development with BatchTool
|
|
98
|
+
Accelerate development by running multiple tasks concurrently:
|
|
99
|
+
|
|
100
|
+
\`\`\`bash
|
|
101
|
+
# Parallel feature implementation
|
|
102
|
+
batchtool run --parallel --max-concurrent 4 \\
|
|
103
|
+
"npx claude-flow sparc run code 'implement user model' --non-interactive" \\
|
|
104
|
+
"npx claude-flow sparc run code 'implement auth middleware' --non-interactive" \\
|
|
105
|
+
"npx claude-flow sparc run code 'implement API endpoints' --non-interactive" \\
|
|
106
|
+
"npx claude-flow sparc run code 'implement database schema' --non-interactive"
|
|
107
|
+
|
|
108
|
+
# Boomerang pattern for feature development
|
|
109
|
+
batchtool orchestrate --boomerang \\
|
|
110
|
+
--research "npx claude-flow sparc run ask 'best practices for ${taskDescription}' --non-interactive" \\
|
|
111
|
+
--design "npx claude-flow sparc run architect 'design ${taskDescription}' --non-interactive" \\
|
|
112
|
+
--implement "npx claude-flow sparc run code 'build ${taskDescription}' --non-interactive" \\
|
|
113
|
+
--test "npx claude-flow sparc run tdd 'test ${taskDescription}' --non-interactive" \\
|
|
114
|
+
--optimize "npx claude-flow sparc run optimization 'optimize ${taskDescription}' --non-interactive"
|
|
115
|
+
|
|
116
|
+
# Concurrent module development with dependencies
|
|
117
|
+
batchtool run --dependency-aware \\
|
|
118
|
+
--task "auth:npx claude-flow sparc run code 'auth module' --non-interactive" \\
|
|
119
|
+
--task "user:npx claude-flow sparc run code 'user module' --non-interactive" \\
|
|
120
|
+
--task "api:npx claude-flow sparc run code 'API layer' --non-interactive:depends=auth,user" \\
|
|
121
|
+
--task "tests:npx claude-flow sparc run tdd 'all tests' --non-interactive:depends=api"
|
|
122
|
+
\`\`\``;
|
|
85
123
|
}
|
|
@@ -64,12 +64,23 @@ export function getModeOrchestration(modeSlug, taskDescription, memoryNamespace)
|
|
|
64
64
|
*/
|
|
65
65
|
export function createSparcPrompt(mode, taskDescription, memoryNamespace) {
|
|
66
66
|
const orchestration = getModeOrchestration(mode.slug, taskDescription, memoryNamespace);
|
|
67
|
+
const cwd = Deno.cwd();
|
|
67
68
|
|
|
68
69
|
return `# ${mode.name} - Task Execution
|
|
69
70
|
|
|
70
71
|
## 🎯 Your Mission
|
|
71
72
|
Build exactly what the user requested: "${taskDescription}"
|
|
72
73
|
|
|
74
|
+
## 📁 IMPORTANT: Project Directory
|
|
75
|
+
**Current Working Directory:** ${cwd}
|
|
76
|
+
|
|
77
|
+
⚠️ **CRITICAL INSTRUCTIONS:**
|
|
78
|
+
- Create ALL project files in the current working directory: ${cwd}
|
|
79
|
+
- NEVER create files in node_modules/ or any claude-flow directories
|
|
80
|
+
- If the task specifies a project name (e.g., "hello-world"), create it as a subdirectory in ${cwd}
|
|
81
|
+
- Use paths relative to ${cwd} for all file operations
|
|
82
|
+
- Example: If creating "hello-world" app, use ${cwd}/hello-world/
|
|
83
|
+
|
|
73
84
|
## 🚀 Your Role
|
|
74
85
|
${mode.roleDefinition}
|
|
75
86
|
|
|
@@ -110,20 +121,70 @@ npx claude-flow agent list
|
|
|
110
121
|
npx claude-flow monitor
|
|
111
122
|
\`\`\`
|
|
112
123
|
|
|
124
|
+
### 🚀 Parallel Execution with BatchTool
|
|
125
|
+
Use BatchTool to orchestrate multiple SPARC modes concurrently in a boomerang pattern:
|
|
126
|
+
|
|
127
|
+
\`\`\`bash
|
|
128
|
+
# Example: Parallel development workflow
|
|
129
|
+
batchtool run --parallel \\
|
|
130
|
+
"npx claude-flow sparc run architect 'design user authentication system' --non-interactive" \\
|
|
131
|
+
"npx claude-flow sparc run security-review 'analyze authentication requirements' --non-interactive" \\
|
|
132
|
+
"npx claude-flow sparc run spec-pseudocode 'create auth flow pseudocode' --non-interactive"
|
|
133
|
+
|
|
134
|
+
# Boomerang Pattern: Research → Design → Implement → Test → Refine
|
|
135
|
+
batchtool orchestrate --boomerang \\
|
|
136
|
+
--phase1 "npx claude-flow sparc run ask 'research best auth practices' --non-interactive" \\
|
|
137
|
+
--phase2 "npx claude-flow sparc run architect 'design based on research' --non-interactive" \\
|
|
138
|
+
--phase3 "npx claude-flow sparc run code 'implement auth system' --non-interactive" \\
|
|
139
|
+
--phase4 "npx claude-flow sparc run tdd 'test auth implementation' --non-interactive" \\
|
|
140
|
+
--phase5 "npx claude-flow sparc run optimization 'refine auth performance' --non-interactive"
|
|
141
|
+
|
|
142
|
+
# Concurrent Feature Development
|
|
143
|
+
batchtool run --concurrent --max-parallel 3 \\
|
|
144
|
+
"npx claude-flow sparc run code 'implement login feature' --non-interactive" \\
|
|
145
|
+
"npx claude-flow sparc run code 'implement registration feature' --non-interactive" \\
|
|
146
|
+
"npx claude-flow sparc run code 'implement password reset' --non-interactive" \\
|
|
147
|
+
"npx claude-flow sparc run tdd 'create auth test suite' --non-interactive"
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
#### Boomerang Orchestration Pattern
|
|
151
|
+
The boomerang pattern allows for iterative development where results from one phase inform the next:
|
|
152
|
+
1. **Research Phase**: Gather requirements and best practices
|
|
153
|
+
2. **Design Phase**: Create architecture based on research
|
|
154
|
+
3. **Implementation Phase**: Build according to design
|
|
155
|
+
4. **Testing Phase**: Validate implementation
|
|
156
|
+
5. **Refinement Phase**: Optimize based on test results
|
|
157
|
+
6. **Loop Back**: Results feed back to improve the cycle
|
|
158
|
+
|
|
159
|
+
Benefits of --non-interactive mode with BatchTool:
|
|
160
|
+
- No manual intervention required
|
|
161
|
+
- Parallel execution of independent tasks
|
|
162
|
+
- Automatic result collection and aggregation
|
|
163
|
+
- Progress tracking across all concurrent operations
|
|
164
|
+
- Efficient resource utilization
|
|
165
|
+
|
|
113
166
|
## ⚡ Execution Guidelines
|
|
114
167
|
|
|
115
168
|
1. **Focus on User's Project**
|
|
116
169
|
- Build what they asked for, not improvements to claude-flow
|
|
117
|
-
- Create files in the current directory
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
170
|
+
- Create files ONLY in the current working directory: ${cwd}
|
|
171
|
+
- NEVER create files in node_modules/ or system directories
|
|
172
|
+
- If creating a named project, make it a subdirectory of ${cwd}
|
|
173
|
+
- Use appropriate project structure relative to ${cwd}
|
|
174
|
+
|
|
175
|
+
2. **Directory Rules**
|
|
176
|
+
- Current directory: ${cwd}
|
|
177
|
+
- Create new projects as: ${cwd}/<project-name>/
|
|
178
|
+
- Use relative paths from ${cwd} for all operations
|
|
179
|
+
- Verify you're in the correct directory before creating files
|
|
180
|
+
|
|
181
|
+
3. **Quality Standards**
|
|
121
182
|
- Keep all files under 500 lines
|
|
122
183
|
- Never hardcode secrets or credentials
|
|
123
184
|
- Use environment variables and config files
|
|
124
185
|
- Write clean, maintainable code
|
|
125
186
|
|
|
126
|
-
|
|
187
|
+
4. **Communication**
|
|
127
188
|
- Store progress updates in memory
|
|
128
189
|
- Document key decisions
|
|
129
190
|
- Ask for clarification if needed
|
|
@@ -30,7 +30,24 @@ export function getIntegrationOrchestration(taskDescription, memoryNamespace) {
|
|
|
30
30
|
- Check performance metrics
|
|
31
31
|
- Validate data integrity
|
|
32
32
|
|
|
33
|
-
5. **
|
|
33
|
+
5. **Directory Safety**
|
|
34
|
+
- **IMPORTANT**: All integration files should be created in the current working directory
|
|
35
|
+
- **DO NOT** create files in system directories or node_modules
|
|
36
|
+
- For named projects, create a subdirectory: \`mkdir project-name && cd project-name\`
|
|
37
|
+
- Use relative paths from your working directory
|
|
38
|
+
- Suggested structure for integration code:
|
|
39
|
+
\`\`\`
|
|
40
|
+
./ (current directory)
|
|
41
|
+
├── integrations/
|
|
42
|
+
│ ├── adapters/
|
|
43
|
+
│ ├── transformers/
|
|
44
|
+
│ └── handlers/
|
|
45
|
+
├── config/
|
|
46
|
+
└── tests/
|
|
47
|
+
└── integration/
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
6. **Deliverables**
|
|
34
51
|
- Integration layer code
|
|
35
52
|
- Configuration templates
|
|
36
53
|
- Integration test suite
|
|
@@ -5,6 +5,34 @@ export function getSparcOrchestratorOrchestration(taskDescription, memoryNamespa
|
|
|
5
5
|
|
|
6
6
|
Welcome! I'm your SPARC Orchestrator, ready to break down "${taskDescription}" into manageable subtasks following the SPARC methodology.
|
|
7
7
|
|
|
8
|
+
## 🎯 BatchTool Parallel Orchestration
|
|
9
|
+
For maximum efficiency, I can orchestrate multiple SPARC modes concurrently using BatchTool:
|
|
10
|
+
|
|
11
|
+
\`\`\`bash
|
|
12
|
+
# Full SPARC Workflow with BatchTool (Boomerang Pattern)
|
|
13
|
+
batchtool orchestrate --boomerang --name "${taskDescription}" \\
|
|
14
|
+
--phase1-parallel \\
|
|
15
|
+
"npx claude-flow sparc run ask 'research requirements for ${taskDescription}' --non-interactive" \\
|
|
16
|
+
"npx claude-flow sparc run security-review 'identify security needs for ${taskDescription}' --non-interactive" \\
|
|
17
|
+
--phase2-sequential \\
|
|
18
|
+
"npx claude-flow sparc run spec-pseudocode 'create specifications from research' --non-interactive" \\
|
|
19
|
+
"npx claude-flow sparc run architect 'design system architecture' --non-interactive" \\
|
|
20
|
+
--phase3-parallel \\
|
|
21
|
+
"npx claude-flow sparc run code 'implement core features' --non-interactive" \\
|
|
22
|
+
"npx claude-flow sparc run code 'implement authentication' --non-interactive" \\
|
|
23
|
+
"npx claude-flow sparc run code 'implement data layer' --non-interactive" \\
|
|
24
|
+
--phase4-sequential \\
|
|
25
|
+
"npx claude-flow sparc run integration 'integrate all components' --non-interactive" \\
|
|
26
|
+
"npx claude-flow sparc run tdd 'comprehensive testing' --non-interactive" \\
|
|
27
|
+
--phase5-parallel \\
|
|
28
|
+
"npx claude-flow sparc run optimization 'performance tuning' --non-interactive" \\
|
|
29
|
+
"npx claude-flow sparc run docs-writer 'create documentation' --non-interactive" \\
|
|
30
|
+
"npx claude-flow sparc run devops 'deployment setup' --non-interactive"
|
|
31
|
+
|
|
32
|
+
# Monitor all parallel executions
|
|
33
|
+
batchtool monitor --dashboard
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
8
36
|
## Task Orchestration Steps
|
|
9
37
|
|
|
10
38
|
1. **Project Analysis & Planning** (15 mins)
|
|
@@ -6,11 +6,11 @@ export function getTddOrchestration(taskDescription, memoryNamespace) {
|
|
|
6
6
|
1. **Test Planning & Analysis** (10 mins)
|
|
7
7
|
- Analyze requirements: "${taskDescription}"
|
|
8
8
|
- Query existing code and architecture:
|
|
9
|
-
|
|
9
|
+
\\\`\\\`\\\`bash
|
|
10
10
|
npx claude-flow memory query ${memoryNamespace}_architecture
|
|
11
11
|
npx claude-flow memory query ${memoryNamespace}_implementation
|
|
12
12
|
npx claude-flow memory query ${memoryNamespace}_tech_specs
|
|
13
|
-
|
|
13
|
+
\\\`\\\`\\\`
|
|
14
14
|
- Define test boundaries and acceptance criteria
|
|
15
15
|
- Plan test structure (unit, integration, e2e)
|
|
16
16
|
- Identify test doubles needed (mocks, stubs, spies)
|
|
@@ -18,13 +18,13 @@ export function getTddOrchestration(taskDescription, memoryNamespace) {
|
|
|
18
18
|
|
|
19
19
|
2. **Red Phase - Write Failing Tests** (20 mins)
|
|
20
20
|
- Create comprehensive test structure:
|
|
21
|
-
|
|
21
|
+
\\\`\\\`\\\`
|
|
22
22
|
tests/
|
|
23
23
|
├── unit/ # Isolated component tests
|
|
24
24
|
├── integration/ # Component interaction tests
|
|
25
25
|
├── e2e/ # End-to-end workflow tests
|
|
26
26
|
└── fixtures/ # Test data and mocks
|
|
27
|
-
|
|
27
|
+
\\\`\\\`\\\`
|
|
28
28
|
- Write tests following London School TDD:
|
|
29
29
|
- Start with behavior/contract tests
|
|
30
30
|
- Use test doubles for dependencies
|
|
@@ -65,6 +65,22 @@ export function getTddOrchestration(taskDescription, memoryNamespace) {
|
|
|
65
65
|
- Validate against acceptance criteria
|
|
66
66
|
- Store completion: \`npx claude-flow memory store ${memoryNamespace}_tdd_complete "TDD cycle complete. Coverage: 95%. All acceptance criteria met. Tests documented. CI/CD ready."\`
|
|
67
67
|
|
|
68
|
+
## Directory Safety
|
|
69
|
+
- **IMPORTANT**: All test files should be created in the current working directory
|
|
70
|
+
- **DO NOT** create files in system directories or node_modules
|
|
71
|
+
- For named projects, create a subdirectory: \\\`mkdir project-name && cd project-name\\\`
|
|
72
|
+
- Use relative paths from your working directory
|
|
73
|
+
- Test files should follow project structure:
|
|
74
|
+
\\\`\\\`\\\`
|
|
75
|
+
./ (current directory)
|
|
76
|
+
├── tests/
|
|
77
|
+
│ ├── unit/
|
|
78
|
+
│ ├── integration/
|
|
79
|
+
│ └── e2e/
|
|
80
|
+
├── coverage/
|
|
81
|
+
└── docs/
|
|
82
|
+
\\\`\\\`\\\`
|
|
83
|
+
|
|
68
84
|
## Deliverables
|
|
69
85
|
- tests/
|
|
70
86
|
- unit/ (isolated component tests)
|
|
@@ -5,8 +5,8 @@ import { createSparcPrompt } from './sparc-modes/index.js';
|
|
|
5
5
|
export async function sparcCommand(subArgs, flags) {
|
|
6
6
|
const sparcCmd = subArgs[0];
|
|
7
7
|
|
|
8
|
-
// Show help if requested
|
|
9
|
-
if (flags.help || flags.h || sparcCmd === '--help' || sparcCmd === '-h' || !sparcCmd) {
|
|
8
|
+
// Show help if requested or no args
|
|
9
|
+
if (flags.help || flags.h || sparcCmd === '--help' || sparcCmd === '-h' || (!sparcCmd && Object.keys(flags).length === 0)) {
|
|
10
10
|
showSparcHelp();
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -22,6 +22,8 @@ export async function sparcCommand(subArgs, flags) {
|
|
|
22
22
|
mergedArgs.push('--verbose');
|
|
23
23
|
} else if (key === 'no-permissions') {
|
|
24
24
|
mergedArgs.push('--no-permissions');
|
|
25
|
+
} else if (key === 'enable-permissions') {
|
|
26
|
+
mergedArgs.push('--enable-permissions');
|
|
25
27
|
} else if (key === 'namespace') {
|
|
26
28
|
mergedArgs.push('--namespace', value);
|
|
27
29
|
} else if (key === 'config') {
|
|
@@ -31,7 +33,19 @@ export async function sparcCommand(subArgs, flags) {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
// Check if first arg is a known subcommand
|
|
37
|
+
const knownSubcommands = ['modes', 'info', 'run', 'tdd'];
|
|
38
|
+
|
|
39
|
+
if (!knownSubcommands.includes(sparcCmd)) {
|
|
40
|
+
// If not a known subcommand, treat it as a task description for sparc orchestrator
|
|
41
|
+
// Insert 'run' and 'sparc' to make it: ['run', 'sparc', ...rest of args]
|
|
42
|
+
mergedArgs.unshift('run', 'sparc');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Now process the command
|
|
46
|
+
const actualCmd = mergedArgs[0];
|
|
47
|
+
|
|
48
|
+
switch (actualCmd) {
|
|
35
49
|
case 'modes':
|
|
36
50
|
await listSparcModes(mergedArgs);
|
|
37
51
|
break;
|
|
@@ -178,6 +192,14 @@ async function runSparcMode(subArgs, flags) {
|
|
|
178
192
|
console.log(`📋 Task: ${taskDescription}`);
|
|
179
193
|
|
|
180
194
|
const isNonInteractive = subArgs.includes('--non-interactive') || subArgs.includes('-n');
|
|
195
|
+
const enablePermissions = subArgs.includes('--enable-permissions');
|
|
196
|
+
|
|
197
|
+
if (!enablePermissions) {
|
|
198
|
+
console.log(`⚡ Permissions: Auto-skipped (--dangerously-skip-permissions)`);
|
|
199
|
+
} else {
|
|
200
|
+
console.log(`✅ Permissions: Enabled (will prompt for actions)`);
|
|
201
|
+
}
|
|
202
|
+
|
|
181
203
|
if (isNonInteractive) {
|
|
182
204
|
console.log(`🚀 Running in non-interactive mode with stream-json output`);
|
|
183
205
|
console.log();
|
|
@@ -262,25 +284,24 @@ function buildToolsFromGroups(groups) {
|
|
|
262
284
|
async function executeClaude(enhancedTask, toolsList, instanceId, memoryNamespace, subArgs) {
|
|
263
285
|
// Check for non-interactive mode
|
|
264
286
|
const isNonInteractive = subArgs.includes('--non-interactive') || subArgs.includes('-n');
|
|
287
|
+
const enablePermissions = subArgs.includes('--enable-permissions');
|
|
265
288
|
|
|
266
289
|
// Build arguments array correctly
|
|
267
290
|
const claudeArgs = [];
|
|
291
|
+
claudeArgs.push(enhancedTask);
|
|
268
292
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
// The enhanced task contains the full SPARC prompt with orchestration
|
|
272
|
-
claudeArgs.push(enhancedTask);
|
|
293
|
+
// Add --dangerously-skip-permissions by default unless --enable-permissions is set
|
|
294
|
+
if (!enablePermissions) {
|
|
273
295
|
claudeArgs.push('--dangerously-skip-permissions');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (isNonInteractive) {
|
|
299
|
+
// Non-interactive mode: add additional flags
|
|
274
300
|
claudeArgs.push('-p'); // Use short form for print
|
|
275
301
|
claudeArgs.push('--output-format', 'stream-json');
|
|
276
302
|
claudeArgs.push('--verbose');
|
|
277
303
|
} else {
|
|
278
|
-
// Interactive mode
|
|
279
|
-
claudeArgs.push(enhancedTask);
|
|
280
|
-
if (subArgs.includes('--no-permissions')) {
|
|
281
|
-
claudeArgs.push('--dangerously-skip-permissions');
|
|
282
|
-
}
|
|
283
|
-
|
|
304
|
+
// Interactive mode - check for verbose flag
|
|
284
305
|
if (subArgs.includes('--verbose') || subArgs.includes('-v')) {
|
|
285
306
|
claudeArgs.push('--verbose');
|
|
286
307
|
}
|
|
@@ -294,23 +315,28 @@ async function executeClaude(enhancedTask, toolsList, instanceId, memoryNamespac
|
|
|
294
315
|
claudeArgs.push('--mcp-config', subArgs[configIndex + 1]);
|
|
295
316
|
}
|
|
296
317
|
|
|
297
|
-
//
|
|
298
|
-
if (isNonInteractive) {
|
|
318
|
+
// Show debug info for non-interactive mode or when verbose
|
|
319
|
+
if (isNonInteractive || subArgs.includes('--verbose') || subArgs.includes('-v')) {
|
|
299
320
|
console.log('\n🔍 Debug: Executing claude with:');
|
|
300
321
|
console.log('Command: claude');
|
|
322
|
+
console.log('Permissions:', enablePermissions ? '✅ Enabled (will prompt)' : '⚡ Skipped (--dangerously-skip-permissions)');
|
|
323
|
+
console.log('Mode:', isNonInteractive ? '🤖 Non-interactive' : '💬 Interactive');
|
|
301
324
|
console.log('Args array length:', claudeArgs.length);
|
|
302
325
|
console.log('First arg (prompt) length:', claudeArgs[0].length, 'characters');
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
326
|
+
|
|
327
|
+
if (isNonInteractive) {
|
|
328
|
+
console.log('First 200 chars of prompt:', claudeArgs[0].substring(0, 200) + '...');
|
|
329
|
+
console.log('\nAll arguments:');
|
|
330
|
+
claudeArgs.forEach((arg, i) => {
|
|
331
|
+
if (i === 0) {
|
|
332
|
+
console.log(` [0] <SPARC prompt with ${arg.length} characters>`);
|
|
333
|
+
} else {
|
|
334
|
+
console.log(` [${i}] ${arg}`);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
console.log('\nFull command structure:');
|
|
338
|
+
console.log('claude "<SPARC prompt>" ' + claudeArgs.slice(1).join(' '));
|
|
339
|
+
}
|
|
314
340
|
console.log();
|
|
315
341
|
}
|
|
316
342
|
|
|
@@ -370,12 +396,14 @@ async function executeClaude(enhancedTask, toolsList, instanceId, memoryNamespac
|
|
|
370
396
|
|
|
371
397
|
function showSparcHelp() {
|
|
372
398
|
console.log('SPARC commands:');
|
|
399
|
+
console.log(' <task> Run SPARC orchestrator (default mode)');
|
|
373
400
|
console.log(' modes List available SPARC development modes');
|
|
374
401
|
console.log(' info <mode> Show detailed information about a mode');
|
|
375
402
|
console.log(' run <mode> <task> Execute a task in specified SPARC mode');
|
|
376
403
|
console.log(' tdd <task> Run Test-Driven Development workflow');
|
|
377
404
|
console.log();
|
|
378
405
|
console.log('Examples:');
|
|
406
|
+
console.log(' claude-flow sparc "orchestrate app development" # Uses sparc orchestrator');
|
|
379
407
|
console.log(' claude-flow sparc modes --verbose');
|
|
380
408
|
console.log(' claude-flow sparc info architect');
|
|
381
409
|
console.log(' claude-flow sparc run code "implement user authentication"');
|
|
@@ -383,19 +411,42 @@ function showSparcHelp() {
|
|
|
383
411
|
console.log(' claude-flow sparc run tdd "create test suite" --namespace tests');
|
|
384
412
|
console.log(' claude-flow sparc tdd "payment processing system" --interactive');
|
|
385
413
|
console.log();
|
|
414
|
+
console.log('Parallel Execution with BatchTool:');
|
|
415
|
+
console.log(' # Run multiple SPARC modes concurrently');
|
|
416
|
+
console.log(' batchtool run --parallel \\');
|
|
417
|
+
console.log(' "npx claude-flow sparc run code \'user service\' --non-interactive" \\');
|
|
418
|
+
console.log(' "npx claude-flow sparc run code \'auth service\' --non-interactive" \\');
|
|
419
|
+
console.log(' "npx claude-flow sparc run tdd \'test suite\' --non-interactive"');
|
|
420
|
+
console.log();
|
|
421
|
+
console.log(' # Boomerang orchestration pattern');
|
|
422
|
+
console.log(' batchtool orchestrate --boomerang \\');
|
|
423
|
+
console.log(' --research "npx claude-flow sparc run ask \'requirements\' --non-interactive" \\');
|
|
424
|
+
console.log(' --design "npx claude-flow sparc run architect \'system\' --non-interactive" \\');
|
|
425
|
+
console.log(' --implement "npx claude-flow sparc run code \'features\' --non-interactive" \\');
|
|
426
|
+
console.log(' --test "npx claude-flow sparc run tdd \'validation\' --non-interactive"');
|
|
427
|
+
console.log();
|
|
386
428
|
console.log('Flags:');
|
|
387
429
|
console.log(' --dry-run, -d Show configuration without executing');
|
|
388
430
|
console.log(' --verbose, -v Show detailed output');
|
|
389
431
|
console.log(' --interactive, -i Run TDD workflow interactively');
|
|
390
432
|
console.log(' --non-interactive, -n Run in non-interactive mode with stream-json output');
|
|
391
|
-
console.log(' --
|
|
433
|
+
console.log(' --enable-permissions Enable permission prompts (default: skip permissions)');
|
|
392
434
|
console.log(' --namespace <ns> Use custom memory namespace (default: mode slug)');
|
|
393
435
|
console.log(' --config <path> Use custom MCP configuration file');
|
|
394
436
|
console.log();
|
|
437
|
+
console.log('Permission Behavior:');
|
|
438
|
+
console.log(' By default, SPARC runs with --dangerously-skip-permissions for efficiency');
|
|
439
|
+
console.log(' Use --enable-permissions to restore permission prompts if needed');
|
|
440
|
+
console.log();
|
|
395
441
|
console.log('Non-Interactive Mode:');
|
|
396
442
|
console.log(' When using --non-interactive, claude will be executed with:');
|
|
397
|
-
console.log(' - --dangerously-skip-permissions (
|
|
443
|
+
console.log(' - --dangerously-skip-permissions (unless --enable-permissions is set)');
|
|
398
444
|
console.log(' - -p (print mode for streaming output)');
|
|
399
445
|
console.log(' - --output-format stream-json (structured output format)');
|
|
400
446
|
console.log(' - --verbose (detailed execution logs)');
|
|
447
|
+
console.log();
|
|
448
|
+
console.log('Boomerang Pattern:');
|
|
449
|
+
console.log(' A cyclical orchestration where outputs from one phase feed into the next:');
|
|
450
|
+
console.log(' Research → Design → Implement → Test → Optimize → Loop back');
|
|
451
|
+
console.log(' Perfect for iterative development with continuous refinement');
|
|
401
452
|
}
|