claude-flow-novice 1.3.0 → 1.3.2
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/.claude-flow-novice/preferences/generation.json +147 -0
- package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
- package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
- package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
- package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
- package/.claude-flow-novice/preferences/project-local.json +91 -0
- package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
- package/.claude-flow-novice/preferences/team-shared.json +195 -0
- package/.claude-flow-novice/preferences/user-global.json +247 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
- package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
- package/CLAUDE.md +81 -0
- package/README-NPM.md +0 -0
- package/package.json +11 -7
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/migration/README.md +434 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
- package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
- package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
- package/src/cli/simple-commands/__tests__/task.test.js +8 -0
- package/src/cli/simple-commands/agent.js +216 -0
- package/src/cli/simple-commands/analysis.js +570 -0
- package/src/cli/simple-commands/automation-executor.js +1603 -0
- package/src/cli/simple-commands/automation.js +627 -0
- package/src/cli/simple-commands/batch-manager.js +338 -0
- package/src/cli/simple-commands/claude-telemetry.js +311 -0
- package/src/cli/simple-commands/claude-track.js +102 -0
- package/src/cli/simple-commands/concurrent-display.js +348 -0
- package/src/cli/simple-commands/config.js +319 -0
- package/src/cli/simple-commands/coordination.js +307 -0
- package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
- package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
- package/src/cli/simple-commands/fix-hook-variables.js +363 -0
- package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
- package/src/cli/simple-commands/github/github-api.js +624 -0
- package/src/cli/simple-commands/github/init.js +543 -0
- package/src/cli/simple-commands/github.js +377 -0
- package/src/cli/simple-commands/goal.js +145 -0
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
- package/src/cli/simple-commands/hive-mind/communication.js +740 -0
- package/src/cli/simple-commands/hive-mind/core.js +1031 -0
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
- package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
- package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
- package/src/cli/simple-commands/hive-mind/queen.js +809 -0
- package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
- package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
- package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
- package/src/cli/simple-commands/hive-mind.js +3112 -0
- package/src/cli/simple-commands/hive.js +140 -0
- package/src/cli/simple-commands/hook-safety.js +671 -0
- package/src/cli/simple-commands/hooks.js +1268 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
- package/src/cli/simple-commands/init/README.md +106 -0
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
- package/src/cli/simple-commands/init/agent-copier.js +347 -0
- package/src/cli/simple-commands/init/batch-init.js +663 -0
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
- package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
- package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
- package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
- package/src/cli/simple-commands/init/help.js +110 -0
- package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
- package/src/cli/simple-commands/init/index.js +1953 -0
- package/src/cli/simple-commands/init/performance-monitor.js +344 -0
- package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
- package/src/cli/simple-commands/init/rollback/index.js +399 -0
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
- package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
- package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
- package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
- package/src/cli/simple-commands/init/sparc-structure.js +68 -0
- package/src/cli/simple-commands/init/template-copier.js +640 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
- package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
- package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
- package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
- package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
- package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
- package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
- package/src/cli/simple-commands/init/templates/coordination.md +16 -0
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
- package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
- package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
- package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
- package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
- package/src/cli/simple-commands/init/templates/settings.json +109 -0
- package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
- package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
- package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
- package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
- package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
- package/src/cli/simple-commands/init/validation/index.js +388 -0
- package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
- package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
- package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
- package/src/cli/simple-commands/init.js +4 -0
- package/src/cli/simple-commands/mcp-health.js +163 -0
- package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
- package/src/cli/simple-commands/mcp.js +420 -0
- package/src/cli/simple-commands/memory-consolidation.js +631 -0
- package/src/cli/simple-commands/memory.js +345 -0
- package/src/cli/simple-commands/migrate-hooks.js +63 -0
- package/src/cli/simple-commands/monitor.js +417 -0
- package/src/cli/simple-commands/neural.js +148 -0
- package/src/cli/simple-commands/pair-autofix-only.js +755 -0
- package/src/cli/simple-commands/pair-basic.js +751 -0
- package/src/cli/simple-commands/pair-old.js +623 -0
- package/src/cli/simple-commands/pair-working.js +849 -0
- package/src/cli/simple-commands/pair.js +849 -0
- package/src/cli/simple-commands/performance-hooks.js +149 -0
- package/src/cli/simple-commands/performance-metrics.js +601 -0
- package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
- package/src/cli/simple-commands/process-ui.js +274 -0
- package/src/cli/simple-commands/realtime-update-system.js +659 -0
- package/src/cli/simple-commands/sparc/architecture.js +1750 -0
- package/src/cli/simple-commands/sparc/commands.js +575 -0
- package/src/cli/simple-commands/sparc/completion.js +1831 -0
- package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
- package/src/cli/simple-commands/sparc/index.js +321 -0
- package/src/cli/simple-commands/sparc/phase-base.js +430 -0
- package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
- package/src/cli/simple-commands/sparc/refinement.js +1856 -0
- package/src/cli/simple-commands/sparc/specification.js +736 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
- package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
- package/src/cli/simple-commands/sparc-modes/code.js +148 -0
- package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
- package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
- package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
- package/src/cli/simple-commands/sparc-modes/index.js +201 -0
- package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
- package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
- package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
- package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
- package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
- package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
- package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
- package/src/cli/simple-commands/sparc.js +530 -0
- package/src/cli/simple-commands/start-ui.js +147 -0
- package/src/cli/simple-commands/start-wrapper.js +285 -0
- package/src/cli/simple-commands/start.js +2 -0
- package/src/cli/simple-commands/status.js +303 -0
- package/src/cli/simple-commands/stream-chain-clean.js +221 -0
- package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
- package/src/cli/simple-commands/stream-chain-real.js +408 -0
- package/src/cli/simple-commands/stream-chain-working.js +323 -0
- package/src/cli/simple-commands/stream-chain.js +491 -0
- package/src/cli/simple-commands/stream-processor.js +340 -0
- package/src/cli/simple-commands/swarm-executor.js +253 -0
- package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
- package/src/cli/simple-commands/swarm-ui.js +741 -0
- package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
- package/src/cli/simple-commands/swarm.js +2277 -0
- package/src/cli/simple-commands/task.js +228 -0
- package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
- package/src/cli/simple-commands/timestamp-fix.js +104 -0
- package/src/cli/simple-commands/token-tracker.js +372 -0
- package/src/cli/simple-commands/tool-execution-framework.js +555 -0
- package/src/cli/simple-commands/train-and-stream.js +354 -0
- package/src/cli/simple-commands/training-pipeline.js +874 -0
- package/src/cli/simple-commands/training.js +288 -0
- package/src/cli/simple-commands/verification-hooks.js +336 -0
- package/src/cli/simple-commands/verification-integration.js +464 -0
- package/src/cli/simple-commands/verification-training-integration.js +646 -0
- package/src/cli/simple-commands/verification.js +551 -0
- package/src/cli/simple-commands/web-server.js +929 -0
- package/src/cli/simple-commands/webui-validator.js +136 -0
- package/src/language/README.md +503 -0
- package/src/language/claude-md-generator.js +618 -0
- package/src/language/cli.js +422 -0
- package/src/language/example.js +347 -0
- package/src/language/integration-system.js +619 -0
- package/src/language/language-detector.js +581 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// sparc-commands.js - SPARC-specific slash commands
|
|
2
|
+
|
|
3
|
+
// Create SPARC mode slash command
|
|
4
|
+
export function createSparcSlashCommand(mode) {
|
|
5
|
+
// Extract the full description without truncation
|
|
6
|
+
const fullDescription =
|
|
7
|
+
mode.roleDefinition.length > 100
|
|
8
|
+
? `${mode.roleDefinition.substring(0, 97)}...`
|
|
9
|
+
: mode.roleDefinition;
|
|
10
|
+
|
|
11
|
+
return `---
|
|
12
|
+
name: sparc-${mode.slug}
|
|
13
|
+
description: ${mode.name} - ${fullDescription}
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# ${mode.name}
|
|
17
|
+
|
|
18
|
+
## Role Definition
|
|
19
|
+
${mode.roleDefinition}
|
|
20
|
+
|
|
21
|
+
## Custom Instructions
|
|
22
|
+
${mode.customInstructions}
|
|
23
|
+
|
|
24
|
+
## Available Tools
|
|
25
|
+
${
|
|
26
|
+
Array.isArray(mode.groups)
|
|
27
|
+
? mode.groups
|
|
28
|
+
.map((g) => {
|
|
29
|
+
if (typeof g === 'string') {
|
|
30
|
+
return `- **${g}**: ${getToolDescription(g)}`;
|
|
31
|
+
} else if (Array.isArray(g)) {
|
|
32
|
+
return `- **${g[0]}**: ${g[1]?.description || getToolDescription(g[0])} ${g[1]?.fileRegex ? `(Files matching: ${g[1].fileRegex})` : ''}`;
|
|
33
|
+
}
|
|
34
|
+
return `- ${JSON.stringify(g)}`;
|
|
35
|
+
})
|
|
36
|
+
.join('\n')
|
|
37
|
+
: 'None'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Option 1: Using MCP Tools (Preferred in Claude Code)
|
|
43
|
+
\`\`\`javascript
|
|
44
|
+
mcp__claude-flow__sparc_mode {
|
|
45
|
+
mode: "${mode.slug}",
|
|
46
|
+
task_description: "${getExampleTask(mode.slug)}",
|
|
47
|
+
options: {
|
|
48
|
+
namespace: "${mode.slug}",
|
|
49
|
+
non_interactive: false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
### Option 2: Using NPX CLI (Fallback when MCP not available)
|
|
55
|
+
\`\`\`bash
|
|
56
|
+
# Use when running from terminal or MCP tools unavailable
|
|
57
|
+
npx claude-flow sparc run ${mode.slug} "${getExampleTask(mode.slug)}"
|
|
58
|
+
|
|
59
|
+
# For alpha features
|
|
60
|
+
npx claude-flow@alpha sparc run ${mode.slug} "${getExampleTask(mode.slug)}"
|
|
61
|
+
|
|
62
|
+
# With namespace
|
|
63
|
+
npx claude-flow sparc run ${mode.slug} "your task" --namespace ${mode.slug}
|
|
64
|
+
|
|
65
|
+
# Non-interactive mode
|
|
66
|
+
npx claude-flow sparc run ${mode.slug} "your task" --non-interactive
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
### Option 3: Local Installation
|
|
70
|
+
\`\`\`bash
|
|
71
|
+
# If claude-flow is installed locally
|
|
72
|
+
./claude-flow sparc run ${mode.slug} "${getExampleTask(mode.slug)}"
|
|
73
|
+
\`\`\`
|
|
74
|
+
|
|
75
|
+
## Memory Integration
|
|
76
|
+
|
|
77
|
+
### Using MCP Tools (Preferred)
|
|
78
|
+
\`\`\`javascript
|
|
79
|
+
// Store mode-specific context
|
|
80
|
+
mcp__claude-flow__memory_usage {
|
|
81
|
+
action: "store",
|
|
82
|
+
key: "${mode.slug}_context",
|
|
83
|
+
value: "important decisions",
|
|
84
|
+
namespace: "${mode.slug}"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Query previous work
|
|
88
|
+
mcp__claude-flow__memory_search {
|
|
89
|
+
pattern: "${mode.slug}",
|
|
90
|
+
namespace: "${mode.slug}",
|
|
91
|
+
limit: 5
|
|
92
|
+
}
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
### Using NPX CLI (Fallback)
|
|
96
|
+
\`\`\`bash
|
|
97
|
+
# Store mode-specific context
|
|
98
|
+
npx claude-flow memory store "${mode.slug}_context" "important decisions" --namespace ${mode.slug}
|
|
99
|
+
|
|
100
|
+
# Query previous work
|
|
101
|
+
npx claude-flow memory query "${mode.slug}" --limit 5
|
|
102
|
+
\`\`\`
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Helper function to get tool descriptions
|
|
107
|
+
function getToolDescription(tool) {
|
|
108
|
+
const toolDescriptions = {
|
|
109
|
+
read: 'File reading and viewing',
|
|
110
|
+
edit: 'File modification and creation',
|
|
111
|
+
browser: 'Web browsing capabilities',
|
|
112
|
+
mcp: 'Model Context Protocol tools',
|
|
113
|
+
command: 'Command execution',
|
|
114
|
+
};
|
|
115
|
+
return toolDescriptions[tool] || 'Tool access';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Helper function to get example tasks
|
|
119
|
+
function getExampleTask(slug) {
|
|
120
|
+
const examples = {
|
|
121
|
+
architect: 'design microservices architecture',
|
|
122
|
+
code: 'implement REST API endpoints',
|
|
123
|
+
tdd: 'create user authentication tests',
|
|
124
|
+
debug: 'fix memory leak in service',
|
|
125
|
+
'security-review': 'audit API security',
|
|
126
|
+
'docs-writer': 'create API documentation',
|
|
127
|
+
integration: 'connect payment service',
|
|
128
|
+
'post-deployment-monitoring-mode': 'monitor production metrics',
|
|
129
|
+
'refinement-optimization-mode': 'optimize database queries',
|
|
130
|
+
devops: 'deploy to AWS Lambda',
|
|
131
|
+
'supabase-admin': 'create user authentication schema',
|
|
132
|
+
'spec-pseudocode': 'define payment flow requirements',
|
|
133
|
+
mcp: 'integrate with external API',
|
|
134
|
+
swarm: 'build complete feature with tests',
|
|
135
|
+
sparc: 'orchestrate authentication system',
|
|
136
|
+
ask: 'help me choose the right mode',
|
|
137
|
+
tutorial: 'guide me through SPARC methodology',
|
|
138
|
+
};
|
|
139
|
+
return examples[slug] || 'implement feature';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Create main SPARC command
|
|
143
|
+
export function createMainSparcCommand(modes) {
|
|
144
|
+
const modeList = modes.map((m) => `- \`/sparc-${m.slug}\` - ${m.name}`).join('\n');
|
|
145
|
+
|
|
146
|
+
// Find the sparc orchestrator mode for its full description
|
|
147
|
+
const sparcMode = modes.find((m) => m.slug === 'sparc');
|
|
148
|
+
const sparcDescription = sparcMode
|
|
149
|
+
? sparcMode.roleDefinition
|
|
150
|
+
: 'SPARC orchestrator for complex workflows';
|
|
151
|
+
const sparcInstructions = sparcMode ? sparcMode.customInstructions : '';
|
|
152
|
+
|
|
153
|
+
return `---
|
|
154
|
+
name: sparc
|
|
155
|
+
description: Execute SPARC methodology workflows with Claude-Flow
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
# ⚡️ SPARC Development Methodology
|
|
159
|
+
|
|
160
|
+
${sparcDescription}
|
|
161
|
+
|
|
162
|
+
## SPARC Workflow
|
|
163
|
+
|
|
164
|
+
${sparcInstructions.split('\n').slice(0, 10).join('\n')}
|
|
165
|
+
|
|
166
|
+
## Available SPARC Modes
|
|
167
|
+
|
|
168
|
+
${modeList}
|
|
169
|
+
|
|
170
|
+
## Quick Start
|
|
171
|
+
|
|
172
|
+
### Option 1: Using MCP Tools (Preferred in Claude Code)
|
|
173
|
+
\`\`\`javascript
|
|
174
|
+
// Run SPARC orchestrator (default)
|
|
175
|
+
mcp__claude-flow__sparc_mode {
|
|
176
|
+
mode: "sparc",
|
|
177
|
+
task_description: "build complete authentication system"
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Run a specific mode
|
|
181
|
+
mcp__claude-flow__sparc_mode {
|
|
182
|
+
mode: "architect",
|
|
183
|
+
task_description: "design API structure"
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// TDD workflow
|
|
187
|
+
mcp__claude-flow__sparc_mode {
|
|
188
|
+
mode: "tdd",
|
|
189
|
+
task_description: "implement user authentication",
|
|
190
|
+
options: {workflow: "full"}
|
|
191
|
+
}
|
|
192
|
+
\`\`\`
|
|
193
|
+
|
|
194
|
+
### Option 2: Using NPX CLI (Fallback when MCP not available)
|
|
195
|
+
\`\`\`bash
|
|
196
|
+
# Run SPARC orchestrator (default)
|
|
197
|
+
npx claude-flow sparc "build complete authentication system"
|
|
198
|
+
|
|
199
|
+
# Run a specific mode
|
|
200
|
+
npx claude-flow sparc run architect "design API structure"
|
|
201
|
+
npx claude-flow sparc run tdd "implement user service"
|
|
202
|
+
|
|
203
|
+
# Execute full TDD workflow
|
|
204
|
+
npx claude-flow sparc tdd "implement user authentication"
|
|
205
|
+
|
|
206
|
+
# List all modes with details
|
|
207
|
+
npx claude-flow sparc modes --verbose
|
|
208
|
+
|
|
209
|
+
# For alpha features
|
|
210
|
+
npx claude-flow@alpha sparc run <mode> "your task"
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
### Option 3: Local Installation
|
|
214
|
+
\`\`\`bash
|
|
215
|
+
# If claude-flow is installed locally
|
|
216
|
+
./claude-flow sparc "build complete authentication system"
|
|
217
|
+
./claude-flow sparc run architect "design API structure"
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
## SPARC Methodology Phases
|
|
221
|
+
|
|
222
|
+
1. **📋 Specification**: Define requirements, constraints, and acceptance criteria
|
|
223
|
+
2. **🧠 Pseudocode**: Create detailed logic flows and algorithmic planning
|
|
224
|
+
3. **🏗️ Architecture**: Design system structure, APIs, and component boundaries
|
|
225
|
+
4. **🔄 Refinement**: Implement with TDD (Red-Green-Refactor cycle)
|
|
226
|
+
5. **✅ Completion**: Integrate, document, and validate against requirements
|
|
227
|
+
|
|
228
|
+
## Memory Integration
|
|
229
|
+
|
|
230
|
+
### Using MCP Tools (Preferred)
|
|
231
|
+
\`\`\`javascript
|
|
232
|
+
// Store specifications
|
|
233
|
+
mcp__claude-flow__memory_usage {
|
|
234
|
+
action: "store",
|
|
235
|
+
key: "spec_auth",
|
|
236
|
+
value: "OAuth2 + JWT requirements",
|
|
237
|
+
namespace: "spec"
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Store architectural decisions
|
|
241
|
+
mcp__claude-flow__memory_usage {
|
|
242
|
+
action: "store",
|
|
243
|
+
key: "arch_decisions",
|
|
244
|
+
value: "Microservices with API Gateway",
|
|
245
|
+
namespace: "architecture"
|
|
246
|
+
}
|
|
247
|
+
\`\`\`
|
|
248
|
+
|
|
249
|
+
### Using NPX CLI (Fallback)
|
|
250
|
+
\`\`\`bash
|
|
251
|
+
# Store specifications
|
|
252
|
+
npx claude-flow memory store "spec_auth" "OAuth2 + JWT requirements" --namespace spec
|
|
253
|
+
|
|
254
|
+
# Store architectural decisions
|
|
255
|
+
./claude-flow memory store "arch_api" "RESTful microservices design" --namespace arch
|
|
256
|
+
|
|
257
|
+
# Query previous work
|
|
258
|
+
./claude-flow memory query "authentication" --limit 10
|
|
259
|
+
|
|
260
|
+
# Export project memory
|
|
261
|
+
./claude-flow memory export sparc-project-backup.json
|
|
262
|
+
\`\`\`
|
|
263
|
+
|
|
264
|
+
## Advanced Swarm Mode
|
|
265
|
+
|
|
266
|
+
For complex tasks requiring multiple agents with timeout-free execution:
|
|
267
|
+
\`\`\`bash
|
|
268
|
+
# Development swarm with monitoring
|
|
269
|
+
./claude-flow swarm "Build e-commerce platform" --strategy development --monitor --review
|
|
270
|
+
|
|
271
|
+
# Background optimization swarm
|
|
272
|
+
./claude-flow swarm "Optimize system performance" --strategy optimization --background
|
|
273
|
+
|
|
274
|
+
# Distributed research swarm
|
|
275
|
+
./claude-flow swarm "Analyze market trends" --strategy research --distributed --ui
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
## Non-Interactive Mode
|
|
279
|
+
|
|
280
|
+
For CI/CD integration and automation:
|
|
281
|
+
\`\`\`bash
|
|
282
|
+
./claude-flow sparc run code "implement API" --non-interactive
|
|
283
|
+
./claude-flow sparc tdd "user tests" --non-interactive --enable-permissions
|
|
284
|
+
\`\`\`
|
|
285
|
+
|
|
286
|
+
## Best Practices
|
|
287
|
+
|
|
288
|
+
✅ **Modular Design**: Keep files under 500 lines
|
|
289
|
+
✅ **Environment Safety**: Never hardcode secrets or env values
|
|
290
|
+
✅ **Test-First**: Always write tests before implementation
|
|
291
|
+
✅ **Memory Usage**: Store important decisions and context
|
|
292
|
+
✅ **Task Completion**: All tasks should end with \`attempt_completion\`
|
|
293
|
+
|
|
294
|
+
See \`/claude-flow-help\` for all available commands.
|
|
295
|
+
`;
|
|
296
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// copy-revised-templates.js - Copy the revised template files from repository
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
// Source directory for revised templates (repository root .claude/commands)
|
|
11
|
+
const REPO_TEMPLATES_DIR = path.join(__dirname, '../../../../.claude/commands');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copy revised template files from repository to target project
|
|
15
|
+
*/
|
|
16
|
+
export async function copyRevisedTemplates(targetDir, options = {}) {
|
|
17
|
+
const results = {
|
|
18
|
+
success: true,
|
|
19
|
+
copiedFiles: [],
|
|
20
|
+
skippedFiles: [],
|
|
21
|
+
errors: [],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const targetCommandsDir = path.join(targetDir, '.claude/commands');
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
// Ensure target directory exists
|
|
28
|
+
await fs.promises.mkdir(targetCommandsDir, { recursive: true });
|
|
29
|
+
|
|
30
|
+
// Copy all template files recursively
|
|
31
|
+
await copyDirectoryRecursive(REPO_TEMPLATES_DIR, targetCommandsDir, options, results);
|
|
32
|
+
|
|
33
|
+
// Copy additional .claude files if they exist
|
|
34
|
+
const additionalFiles = [
|
|
35
|
+
{ source: '../config.json', target: '.claude/config.json' },
|
|
36
|
+
{ source: '../settings.json', target: '.claude/settings.json' },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
for (const file of additionalFiles) {
|
|
40
|
+
const sourcePath = path.join(REPO_TEMPLATES_DIR, file.source);
|
|
41
|
+
const targetPath = path.join(targetDir, file.target);
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(sourcePath)) {
|
|
44
|
+
try {
|
|
45
|
+
const targetDirPath = path.dirname(targetPath);
|
|
46
|
+
await fs.promises.mkdir(targetDirPath, { recursive: true });
|
|
47
|
+
|
|
48
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
49
|
+
await fs.promises.copyFile(sourcePath, targetPath);
|
|
50
|
+
results.copiedFiles.push(file.target);
|
|
51
|
+
if (!options.dryRun) {
|
|
52
|
+
console.log(` ✓ Copied ${file.target}`);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
results.skippedFiles.push(file.target);
|
|
56
|
+
if (!options.dryRun) {
|
|
57
|
+
console.log(` ⏭️ Skipped ${file.target} (already exists)`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
results.errors.push(`Failed to copy ${file.target}: ${err.message}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
results.success = results.errors.length === 0;
|
|
67
|
+
} catch (err) {
|
|
68
|
+
results.success = false;
|
|
69
|
+
results.errors.push(`Failed to copy revised templates: ${err.message}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return results;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Recursively copy directory contents
|
|
77
|
+
*/
|
|
78
|
+
async function copyDirectoryRecursive(sourceDir, targetDir, options, results) {
|
|
79
|
+
try {
|
|
80
|
+
const entries = await fs.promises.readdir(sourceDir, { withFileTypes: true });
|
|
81
|
+
|
|
82
|
+
for (const entry of entries) {
|
|
83
|
+
const sourcePath = path.join(sourceDir, entry.name);
|
|
84
|
+
const targetPath = path.join(targetDir, entry.name);
|
|
85
|
+
|
|
86
|
+
if (entry.isDirectory()) {
|
|
87
|
+
// Create directory and recurse
|
|
88
|
+
await fs.promises.mkdir(targetPath, { recursive: true });
|
|
89
|
+
await copyDirectoryRecursive(sourcePath, targetPath, options, results);
|
|
90
|
+
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
91
|
+
// Copy markdown files
|
|
92
|
+
try {
|
|
93
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
94
|
+
if (!options.dryRun) {
|
|
95
|
+
await fs.promises.copyFile(sourcePath, targetPath);
|
|
96
|
+
}
|
|
97
|
+
const relativePath = path.relative(targetDir, targetPath);
|
|
98
|
+
results.copiedFiles.push(relativePath);
|
|
99
|
+
if (!options.dryRun && options.verbose) {
|
|
100
|
+
console.log(` ✓ Copied ${relativePath}`);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
const relativePath = path.relative(targetDir, targetPath);
|
|
104
|
+
results.skippedFiles.push(relativePath);
|
|
105
|
+
if (!options.dryRun && options.verbose) {
|
|
106
|
+
console.log(` ⏭️ Skipped ${relativePath} (already exists)`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
results.errors.push(`Failed to copy ${entry.name}: ${err.message}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} catch (err) {
|
|
115
|
+
results.errors.push(`Failed to read directory ${sourceDir}: ${err.message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Copy only specific categories
|
|
121
|
+
*/
|
|
122
|
+
export async function copyRevisedTemplatesByCategory(targetDir, categories, options = {}) {
|
|
123
|
+
const results = {
|
|
124
|
+
success: true,
|
|
125
|
+
copiedFiles: [],
|
|
126
|
+
skippedFiles: [],
|
|
127
|
+
errors: [],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
for (const category of categories) {
|
|
131
|
+
const sourceCategoryDir = path.join(REPO_TEMPLATES_DIR, category);
|
|
132
|
+
const targetCategoryDir = path.join(targetDir, '.claude/commands', category);
|
|
133
|
+
|
|
134
|
+
if (fs.existsSync(sourceCategoryDir)) {
|
|
135
|
+
await fs.promises.mkdir(targetCategoryDir, { recursive: true });
|
|
136
|
+
await copyDirectoryRecursive(sourceCategoryDir, targetCategoryDir, options, results);
|
|
137
|
+
} else {
|
|
138
|
+
results.errors.push(`Category '${category}' not found in templates`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
results.success = results.errors.length === 0;
|
|
143
|
+
return results;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Validate that source templates exist
|
|
148
|
+
*/
|
|
149
|
+
export function validateTemplatesExist() {
|
|
150
|
+
if (!fs.existsSync(REPO_TEMPLATES_DIR)) {
|
|
151
|
+
return {
|
|
152
|
+
valid: false,
|
|
153
|
+
error: `Template directory not found: ${REPO_TEMPLATES_DIR}`,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const requiredCategories = ['analysis', 'github', 'sparc', 'coordination'];
|
|
158
|
+
const missingCategories = [];
|
|
159
|
+
|
|
160
|
+
for (const category of requiredCategories) {
|
|
161
|
+
const categoryPath = path.join(REPO_TEMPLATES_DIR, category);
|
|
162
|
+
if (!fs.existsSync(categoryPath)) {
|
|
163
|
+
missingCategories.push(category);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (missingCategories.length > 0) {
|
|
168
|
+
return {
|
|
169
|
+
valid: false,
|
|
170
|
+
error: `Missing required template categories: ${missingCategories.join(', ')}`,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return { valid: true };
|
|
175
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// executable-wrapper.js - Create local executable wrapper
|
|
2
|
+
|
|
3
|
+
import { writeFile, chmod } from 'fs/promises';
|
|
4
|
+
import { platform } from 'os';
|
|
5
|
+
|
|
6
|
+
export async function createLocalExecutable(workingDir, dryRun = false) {
|
|
7
|
+
try {
|
|
8
|
+
if (platform() === 'win32') {
|
|
9
|
+
// Create Windows batch file
|
|
10
|
+
const wrapperScript = `@echo off
|
|
11
|
+
REM Claude-Flow local wrapper
|
|
12
|
+
REM This script ensures claude-flow runs from your project directory
|
|
13
|
+
|
|
14
|
+
set PROJECT_DIR=%CD%
|
|
15
|
+
set PWD=%PROJECT_DIR%
|
|
16
|
+
set CLAUDE_WORKING_DIR=%PROJECT_DIR%
|
|
17
|
+
|
|
18
|
+
REM Try to find claude-flow binary
|
|
19
|
+
REM Check common locations for npm/npx installations
|
|
20
|
+
|
|
21
|
+
REM 1. Local node_modules (npm install claude-flow)
|
|
22
|
+
if exist "%PROJECT_DIR%\\node_modules\\.bin\\claude-flow.cmd" (
|
|
23
|
+
cd /d "%PROJECT_DIR%"
|
|
24
|
+
"%PROJECT_DIR%\\node_modules\\.bin\\claude-flow.cmd" %*
|
|
25
|
+
exit /b %ERRORLEVEL%
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
REM 2. Parent directory node_modules (monorepo setup)
|
|
29
|
+
if exist "%PROJECT_DIR%\\..\\node_modules\\.bin\\claude-flow.cmd" (
|
|
30
|
+
cd /d "%PROJECT_DIR%"
|
|
31
|
+
"%PROJECT_DIR%\\..\\node_modules\\.bin\\claude-flow.cmd" %*
|
|
32
|
+
exit /b %ERRORLEVEL%
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
REM 3. Global installation (npm install -g claude-flow)
|
|
36
|
+
where claude-flow >nul 2>nul
|
|
37
|
+
if %ERRORLEVEL% EQU 0 (
|
|
38
|
+
cd /d "%PROJECT_DIR%"
|
|
39
|
+
claude-flow %*
|
|
40
|
+
exit /b %ERRORLEVEL%
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
REM 4. Fallback to npx (will download if needed)
|
|
44
|
+
cd /d "%PROJECT_DIR%"
|
|
45
|
+
npx claude-flow@latest %*
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
// Write the Windows batch file
|
|
49
|
+
if (!dryRun) {
|
|
50
|
+
await writeFile(`${workingDir}/claude-flow.cmd`, wrapperScript, 'utf8');
|
|
51
|
+
console.log(' ✓ Created local claude-flow.cmd executable wrapper');
|
|
52
|
+
console.log(' You can now use: claude-flow instead of npx claude-flow');
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
// Check if we're in development mode (claude-code-flow repo)
|
|
56
|
+
const isDevelopment = workingDir.includes('claude-code-flow');
|
|
57
|
+
const devBinPath = isDevelopment
|
|
58
|
+
? workingDir.split('claude-code-flow')[0] + 'claude-code-flow/bin/claude-flow'
|
|
59
|
+
: '';
|
|
60
|
+
|
|
61
|
+
// Create Unix/Linux/Mac shell script
|
|
62
|
+
const wrapperScript = `#!/usr/bin/env bash
|
|
63
|
+
# Claude-Flow local wrapper
|
|
64
|
+
# This script ensures claude-flow runs from your project directory
|
|
65
|
+
|
|
66
|
+
# Save the current directory
|
|
67
|
+
PROJECT_DIR="\${PWD}"
|
|
68
|
+
|
|
69
|
+
# Set environment to ensure correct working directory
|
|
70
|
+
export PWD="\${PROJECT_DIR}"
|
|
71
|
+
export CLAUDE_WORKING_DIR="\${PROJECT_DIR}"
|
|
72
|
+
|
|
73
|
+
# Try to find claude-flow binary
|
|
74
|
+
# Check common locations for npm/npx installations
|
|
75
|
+
|
|
76
|
+
${
|
|
77
|
+
isDevelopment
|
|
78
|
+
? `# Development mode - use local bin
|
|
79
|
+
if [ -f "${devBinPath}" ]; then
|
|
80
|
+
cd "\${PROJECT_DIR}"
|
|
81
|
+
exec "${devBinPath}" "$@"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
`
|
|
85
|
+
: ''
|
|
86
|
+
}# 1. Local node_modules (npm install claude-flow)
|
|
87
|
+
if [ -f "\${PROJECT_DIR}/node_modules/.bin/claude-flow" ]; then
|
|
88
|
+
cd "\${PROJECT_DIR}"
|
|
89
|
+
exec "\${PROJECT_DIR}/node_modules/.bin/claude-flow" "$@"
|
|
90
|
+
|
|
91
|
+
# 2. Parent directory node_modules (monorepo setup)
|
|
92
|
+
elif [ -f "\${PROJECT_DIR}/../node_modules/.bin/claude-flow" ]; then
|
|
93
|
+
cd "\${PROJECT_DIR}"
|
|
94
|
+
exec "\${PROJECT_DIR}/../node_modules/.bin/claude-flow" "$@"
|
|
95
|
+
|
|
96
|
+
# 3. Global installation (npm install -g claude-flow)
|
|
97
|
+
elif command -v claude-flow &> /dev/null; then
|
|
98
|
+
cd "\${PROJECT_DIR}"
|
|
99
|
+
exec claude-flow "$@"
|
|
100
|
+
|
|
101
|
+
# 4. Fallback to npx (will download if needed)
|
|
102
|
+
else
|
|
103
|
+
cd "\${PROJECT_DIR}"
|
|
104
|
+
exec npx claude-flow@latest "$@"
|
|
105
|
+
fi
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
// Write the wrapper script
|
|
109
|
+
if (!dryRun) {
|
|
110
|
+
await writeFile(`${workingDir}/claude-flow`, wrapperScript, 'utf8');
|
|
111
|
+
|
|
112
|
+
// Make it executable
|
|
113
|
+
await chmod(`${workingDir}/claude-flow`, 0o755);
|
|
114
|
+
|
|
115
|
+
console.log(' ✓ Created local claude-flow executable wrapper');
|
|
116
|
+
console.log(' You can now use: ./claude-flow instead of npx claude-flow');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} catch (err) {
|
|
120
|
+
console.log(` ⚠️ Could not create local executable: ${err.message}`);
|
|
121
|
+
}
|
|
122
|
+
}
|