claude-flow-novice 2.10.8 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/README.md +157 -0
- package/.claude/hooks/cfn-invoke-post-edit.sh +1 -1
- package/.claude/hooks/cfn-invoke-pre-edit.sh +88 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
- package/.claude/skills/cfn-backlog-management/SKILL.md +199 -0
- package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
- package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +7 -21
- package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +312 -0
- package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +480 -115
- package/claude-assets/agents/csuite/cto-agent.md +371 -0
- package/claude-assets/agents/marketing_hybrid/cost_tracker.md +13 -0
- package/claude-assets/agents/marketing_hybrid/docker_deployer.md +13 -0
- package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +13 -0
- package/claude-assets/hooks/cfn-invoke-post-edit.sh +1 -1
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh +88 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
- package/claude-assets/skills/cfn-backlog-management/SKILL.md +199 -0
- package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh +130 -0
- package/claude-assets/skills/pre-edit-backup/cleanup.sh +155 -0
- package/claude-assets/skills/pre-edit-backup/restore.sh +128 -0
- package/claude-assets/skills/pre-edit-backup/revert-file.sh +168 -0
- package/dist/agents/agent-loader.js +315 -0
- package/dist/agents/agent-loader.js.map +1 -1
- package/package.json +3 -2
- package/scripts/init-project.js +38 -3
- package/scripts/marketing_hybrid_deployment.sh +45 -0
- package/scripts/redis-prometheus-exporter.sh +33 -0
- package/scripts/track-zai-costs.sh +19 -0
- package/claude-assets/commands/agents/README.md +0 -10
- package/claude-assets/commands/agents/agent-capabilities.md +0 -21
- package/claude-assets/commands/agents/agent-coordination.md +0 -28
- package/claude-assets/commands/agents/agent-spawning.md +0 -28
- package/claude-assets/commands/agents/agent-types.md +0 -26
- package/claude-assets/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
- package/claude-assets/commands/analysis/README.md +0 -9
- package/claude-assets/commands/analysis/bottleneck-detect.md +0 -162
- package/claude-assets/commands/analysis/performance-bottlenecks.md +0 -59
- package/claude-assets/commands/analysis/performance-report.md +0 -25
- package/claude-assets/commands/analysis/token-efficiency.md +0 -45
- package/claude-assets/commands/analysis/token-usage.md +0 -25
- package/claude-assets/commands/automation/README.md +0 -9
- package/claude-assets/commands/automation/auto-agent.md +0 -122
- package/claude-assets/commands/automation/self-healing.md +0 -106
- package/claude-assets/commands/automation/session-memory.md +0 -90
- package/claude-assets/commands/automation/smart-agents.md +0 -73
- package/claude-assets/commands/automation/smart-spawn.md +0 -25
- package/claude-assets/commands/automation/workflow-select.md +0 -25
- package/claude-assets/commands/claude-md.js +0 -237
- package/claude-assets/commands/claude-soul.js +0 -28
- package/claude-assets/commands/cli-integration.js +0 -216
- package/claude-assets/commands/coordination/README.md +0 -9
- package/claude-assets/commands/coordination/agent-spawn.md +0 -25
- package/claude-assets/commands/coordination/coordination-system.md +0 -88
- package/claude-assets/commands/coordination/init.md +0 -44
- package/claude-assets/commands/coordination/orchestrate.md +0 -43
- package/claude-assets/commands/coordination/spawn.md +0 -45
- package/claude-assets/commands/coordination/swarm-init.md +0 -85
- package/claude-assets/commands/coordination/task-orchestrate.md +0 -25
- package/claude-assets/commands/github/README.md +0 -11
- package/claude-assets/commands/github/code-review-swarm.md +0 -514
- package/claude-assets/commands/github/code-review.md +0 -25
- package/claude-assets/commands/github/github-modes.md +0 -147
- package/claude-assets/commands/github/github-swarm.md +0 -121
- package/claude-assets/commands/github/issue-tracker.md +0 -292
- package/claude-assets/commands/github/issue-triage.md +0 -25
- package/claude-assets/commands/github/multi-repo-swarm.md +0 -519
- package/claude-assets/commands/github/pr-enhance.md +0 -26
- package/claude-assets/commands/github/pr-manager.md +0 -170
- package/claude-assets/commands/github/project-board-sync.md +0 -471
- package/claude-assets/commands/github/release-manager.md +0 -338
- package/claude-assets/commands/github/release-swarm.md +0 -544
- package/claude-assets/commands/github/repo-analyze.md +0 -25
- package/claude-assets/commands/github/repo-architect.md +0 -367
- package/claude-assets/commands/github/swarm-issue.md +0 -482
- package/claude-assets/commands/github/swarm-pr.md +0 -285
- package/claude-assets/commands/github/sync-coordinator.md +0 -301
- package/claude-assets/commands/github/workflow-automation.md +0 -442
- package/claude-assets/commands/github.js +0 -638
- package/claude-assets/commands/hive-mind/README.md +0 -17
- package/claude-assets/commands/hive-mind/hive-mind-consensus.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-init.md +0 -18
- package/claude-assets/commands/hive-mind/hive-mind-memory.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-metrics.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-resume.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-sessions.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-spawn.md +0 -21
- package/claude-assets/commands/hive-mind/hive-mind-status.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-stop.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind-wizard.md +0 -8
- package/claude-assets/commands/hive-mind/hive-mind.md +0 -27
- package/claude-assets/commands/hooks/README.md +0 -11
- package/claude-assets/commands/hooks/overview.md +0 -58
- package/claude-assets/commands/hooks/post-edit.md +0 -117
- package/claude-assets/commands/hooks/post-task.md +0 -112
- package/claude-assets/commands/hooks/pre-edit.md +0 -113
- package/claude-assets/commands/hooks/pre-task.md +0 -111
- package/claude-assets/commands/hooks/session-end.md +0 -118
- package/claude-assets/commands/hooks/session-start.md +0 -9
- package/claude-assets/commands/hooks/setup.md +0 -103
- package/claude-assets/commands/hooks.js +0 -651
- package/claude-assets/commands/index.js +0 -119
- package/claude-assets/commands/memory/README.md +0 -9
- package/claude-assets/commands/memory/memory-bank.md +0 -58
- package/claude-assets/commands/memory/memory-persist.md +0 -25
- package/claude-assets/commands/memory/memory-search.md +0 -25
- package/claude-assets/commands/memory/memory-usage.md +0 -25
- package/claude-assets/commands/memory/neural.md +0 -47
- package/claude-assets/commands/memory/usage.md +0 -46
- package/claude-assets/commands/monitoring/README.md +0 -9
- package/claude-assets/commands/monitoring/agent-metrics.md +0 -25
- package/claude-assets/commands/monitoring/agents.md +0 -44
- package/claude-assets/commands/monitoring/real-time-view.md +0 -25
- package/claude-assets/commands/monitoring/status.md +0 -46
- package/claude-assets/commands/monitoring/swarm-monitor.md +0 -25
- package/claude-assets/commands/neural.js +0 -572
- package/claude-assets/commands/optimization/README.md +0 -9
- package/claude-assets/commands/optimization/auto-topology.md +0 -62
- package/claude-assets/commands/optimization/cache-manage.md +0 -25
- package/claude-assets/commands/optimization/parallel-execute.md +0 -25
- package/claude-assets/commands/optimization/parallel-execution.md +0 -50
- package/claude-assets/commands/optimization/topology-optimize.md +0 -25
- package/claude-assets/commands/pair/README.md +0 -261
- package/claude-assets/commands/pair/commands.md +0 -546
- package/claude-assets/commands/pair/config.md +0 -510
- package/claude-assets/commands/pair/examples.md +0 -512
- package/claude-assets/commands/pair/modes.md +0 -348
- package/claude-assets/commands/pair/session.md +0 -407
- package/claude-assets/commands/pair/start.md +0 -209
- package/claude-assets/commands/parse-epic.js +0 -180
- package/claude-assets/commands/performance.js +0 -582
- package/claude-assets/commands/register-all-commands.js +0 -320
- package/claude-assets/commands/register-claude-md.js +0 -82
- package/claude-assets/commands/register-claude-soul.js +0 -80
- package/claude-assets/commands/sparc/analyzer.md +0 -52
- package/claude-assets/commands/sparc/architect.md +0 -53
- package/claude-assets/commands/sparc/batch-executor.md +0 -54
- package/claude-assets/commands/sparc/coder.md +0 -54
- package/claude-assets/commands/sparc/debugger.md +0 -54
- package/claude-assets/commands/sparc/designer.md +0 -53
- package/claude-assets/commands/sparc/documenter.md +0 -54
- package/claude-assets/commands/sparc/innovator.md +0 -54
- package/claude-assets/commands/sparc/memory-manager.md +0 -54
- package/claude-assets/commands/sparc/optimizer.md +0 -54
- package/claude-assets/commands/sparc/orchestrator.md +0 -132
- package/claude-assets/commands/sparc/researcher.md +0 -54
- package/claude-assets/commands/sparc/reviewer.md +0 -54
- package/claude-assets/commands/sparc/sparc-modes.md +0 -174
- package/claude-assets/commands/sparc/swarm-coordinator.md +0 -54
- package/claude-assets/commands/sparc/tdd.md +0 -54
- package/claude-assets/commands/sparc/tester.md +0 -54
- package/claude-assets/commands/sparc/workflow-manager.md +0 -54
- package/claude-assets/commands/sparc.js +0 -110
- package/claude-assets/commands/stream-chain/pipeline.md +0 -121
- package/claude-assets/commands/stream-chain/run.md +0 -70
- package/claude-assets/commands/swarm/README.md +0 -15
- package/claude-assets/commands/swarm/analysis.md +0 -95
- package/claude-assets/commands/swarm/development.md +0 -96
- package/claude-assets/commands/swarm/examples.md +0 -168
- package/claude-assets/commands/swarm/maintenance.md +0 -102
- package/claude-assets/commands/swarm/optimization.md +0 -117
- package/claude-assets/commands/swarm/research.md +0 -136
- package/claude-assets/commands/swarm/swarm-analysis.md +0 -8
- package/claude-assets/commands/swarm/swarm-background.md +0 -8
- package/claude-assets/commands/swarm/swarm-init.md +0 -19
- package/claude-assets/commands/swarm/swarm-modes.md +0 -8
- package/claude-assets/commands/swarm/swarm-monitor.md +0 -8
- package/claude-assets/commands/swarm/swarm-spawn.md +0 -19
- package/claude-assets/commands/swarm/swarm-status.md +0 -8
- package/claude-assets/commands/swarm/swarm-strategies.md +0 -8
- package/claude-assets/commands/swarm/swarm.md +0 -27
- package/claude-assets/commands/swarm/testing.md +0 -131
- package/claude-assets/commands/swarm.js +0 -423
- package/claude-assets/commands/testing/playwright-e2e.md +0 -288
- package/claude-assets/commands/training/README.md +0 -9
- package/claude-assets/commands/training/model-update.md +0 -25
- package/claude-assets/commands/training/neural-patterns.md +0 -74
- package/claude-assets/commands/training/neural-train.md +0 -25
- package/claude-assets/commands/training/pattern-learn.md +0 -25
- package/claude-assets/commands/training/specialization.md +0 -63
- package/claude-assets/commands/truth/start.md +0 -143
- package/claude-assets/commands/validate-commands.js +0 -223
- package/claude-assets/commands/verify/check.md +0 -50
- package/claude-assets/commands/verify/start.md +0 -128
- package/claude-assets/commands/workflow.js +0 -606
- package/claude-assets/commands/workflows/README.md +0 -9
- package/claude-assets/commands/workflows/development.md +0 -78
- package/claude-assets/commands/workflows/research.md +0 -63
- package/claude-assets/commands/workflows/workflow-create.md +0 -25
- package/claude-assets/commands/workflows/workflow-execute.md +0 -25
- package/claude-assets/commands/workflows/workflow-export.md +0 -25
- package/claude-assets/hooks/post-edit.config.json +0 -12
- package/claude-assets/skills/team-provider-routing/spawn-worker.sh +0 -91
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# swarm-init
|
|
2
|
-
|
|
3
|
-
Initialize a new swarm with specified topology.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
```bash
|
|
7
|
-
npx claude-flow-novice swarm init [options]
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
## Options
|
|
11
|
-
- `--topology <type>` - Swarm topology (mesh, hierarchical, ring, star)
|
|
12
|
-
- `--max-agents <n>` - Maximum agents
|
|
13
|
-
- `--strategy <type>` - Distribution strategy
|
|
14
|
-
|
|
15
|
-
## Examples
|
|
16
|
-
```bash
|
|
17
|
-
npx claude-flow-novice swarm init --topology mesh
|
|
18
|
-
npx claude-flow-novice swarm init --topology hierarchical --max-agents 8
|
|
19
|
-
```
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# swarm-spawn
|
|
2
|
-
|
|
3
|
-
Spawn agents in the swarm.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
```bash
|
|
7
|
-
npx claude-flow-novice swarm spawn [options]
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
## Options
|
|
11
|
-
- `--type <type>` - Agent type
|
|
12
|
-
- `--count <n>` - Number to spawn
|
|
13
|
-
- `--capabilities <list>` - Agent capabilities
|
|
14
|
-
|
|
15
|
-
## Examples
|
|
16
|
-
```bash
|
|
17
|
-
npx claude-flow-novice swarm spawn --type coder --count 3
|
|
18
|
-
npx claude-flow-novice swarm spawn --type researcher --capabilities "web-search,analysis"
|
|
19
|
-
```
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# swarm
|
|
2
|
-
|
|
3
|
-
Main swarm orchestration command for Claude Flow.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
```bash
|
|
7
|
-
npx claude-flow-novice swarm <objective> [options]
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
## Options
|
|
11
|
-
- `--strategy <type>` - Execution strategy (research, development, analysis, testing)
|
|
12
|
-
- `--mode <type>` - Coordination mode (centralized, distributed, hierarchical, mesh)
|
|
13
|
-
- `--max-agents <n>` - Maximum number of agents (default: 5)
|
|
14
|
-
- `--claude` - Open Claude Code CLI with swarm prompt
|
|
15
|
-
- `--parallel` - Enable parallel execution
|
|
16
|
-
|
|
17
|
-
## Examples
|
|
18
|
-
```bash
|
|
19
|
-
# Basic swarm
|
|
20
|
-
npx claude-flow-novice swarm "Build REST API"
|
|
21
|
-
|
|
22
|
-
# With strategy
|
|
23
|
-
npx claude-flow-novice swarm "Research AI patterns" --strategy research
|
|
24
|
-
|
|
25
|
-
# Open in Claude Code
|
|
26
|
-
npx claude-flow-novice swarm "Build API" --claude
|
|
27
|
-
```
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# Testing Swarm Strategy
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Comprehensive testing through distributed execution.
|
|
5
|
-
|
|
6
|
-
## Activation
|
|
7
|
-
|
|
8
|
-
### Using MCP Tools
|
|
9
|
-
```javascript
|
|
10
|
-
// Initialize testing swarm
|
|
11
|
-
mcp__claude-flow__swarm_init({
|
|
12
|
-
"topology": "star",
|
|
13
|
-
"maxAgents": 7,
|
|
14
|
-
"strategy": "parallel"
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
// Orchestrate testing task
|
|
18
|
-
mcp__claude-flow__task_orchestrate({
|
|
19
|
-
"task": "test application",
|
|
20
|
-
"strategy": "parallel",
|
|
21
|
-
"priority": "high"
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Using CLI (Fallback)
|
|
26
|
-
`npx claude-flow-novice swarm "test application" --strategy testing`
|
|
27
|
-
|
|
28
|
-
## Agent Roles
|
|
29
|
-
|
|
30
|
-
### Agent Spawning with MCP
|
|
31
|
-
```javascript
|
|
32
|
-
// Spawn testing agents
|
|
33
|
-
mcp__claude-flow__agent_spawn({
|
|
34
|
-
"type": "tester",
|
|
35
|
-
"name": "Unit Tester",
|
|
36
|
-
"capabilities": ["unit-testing", "mocking", "coverage"]
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
mcp__claude-flow__agent_spawn({
|
|
40
|
-
"type": "tester",
|
|
41
|
-
"name": "Integration Tester",
|
|
42
|
-
"capabilities": ["integration", "api-testing", "contract-testing"]
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
mcp__claude-flow__agent_spawn({
|
|
46
|
-
"type": "tester",
|
|
47
|
-
"name": "E2E Tester",
|
|
48
|
-
"capabilities": ["e2e", "ui-testing", "user-flows"]
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
mcp__claude-flow__agent_spawn({
|
|
52
|
-
"type": "tester",
|
|
53
|
-
"name": "Performance Tester",
|
|
54
|
-
"capabilities": ["load-testing", "stress-testing", "benchmarking"]
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
mcp__claude-flow__agent_spawn({
|
|
58
|
-
"type": "monitor",
|
|
59
|
-
"name": "Security Tester",
|
|
60
|
-
"capabilities": ["security-testing", "penetration-testing", "vulnerability-scanning"]
|
|
61
|
-
})
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Test Coverage
|
|
65
|
-
|
|
66
|
-
### Coverage Analysis
|
|
67
|
-
```javascript
|
|
68
|
-
// Quality assessment
|
|
69
|
-
mcp__claude-flow__quality_assess({
|
|
70
|
-
"target": "test-coverage",
|
|
71
|
-
"criteria": ["line-coverage", "branch-coverage", "function-coverage"]
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
// Edge case detection
|
|
75
|
-
mcp__claude-flow__pattern_recognize({
|
|
76
|
-
"data": testScenarios,
|
|
77
|
-
"patterns": ["edge-case", "boundary-condition", "error-path"]
|
|
78
|
-
})
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Test Execution
|
|
82
|
-
```javascript
|
|
83
|
-
// Parallel test execution
|
|
84
|
-
mcp__claude-flow__parallel_execute({
|
|
85
|
-
"tasks": [
|
|
86
|
-
{ "id": "unit-tests", "command": "npm run test:unit" },
|
|
87
|
-
{ "id": "integration-tests", "command": "npm run test:integration" },
|
|
88
|
-
{ "id": "e2e-tests", "command": "npm run test:e2e" }
|
|
89
|
-
]
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
// Batch processing for test suites
|
|
93
|
-
mcp__claude-flow__batch_process({
|
|
94
|
-
"items": testSuites,
|
|
95
|
-
"operation": "execute-test-suite"
|
|
96
|
-
})
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Performance Testing
|
|
100
|
-
```javascript
|
|
101
|
-
// Run performance benchmarks
|
|
102
|
-
mcp__claude-flow__benchmark_run({
|
|
103
|
-
"suite": "performance-tests"
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
// Security scanning
|
|
107
|
-
mcp__claude-flow__security_scan({
|
|
108
|
-
"target": "application",
|
|
109
|
-
"depth": "comprehensive"
|
|
110
|
-
})
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Monitoring and Reporting
|
|
114
|
-
```javascript
|
|
115
|
-
// Monitor test execution
|
|
116
|
-
mcp__claude-flow__swarm_monitor({
|
|
117
|
-
"swarmId": "testing-swarm",
|
|
118
|
-
"interval": 2000
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
// Generate test report
|
|
122
|
-
mcp__claude-flow__performance_report({
|
|
123
|
-
"format": "detailed",
|
|
124
|
-
"timeframe": "current-run"
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
// Get test results
|
|
128
|
-
mcp__claude-flow__task_results({
|
|
129
|
-
"taskId": "test-execution-001"
|
|
130
|
-
})
|
|
131
|
-
```
|
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Swarm Management Slash Command
|
|
5
|
-
* Usage: /swarm <action> [options]
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { SlashCommand } from '../core/slash-command.js';
|
|
9
|
-
|
|
10
|
-
export class SwarmCommand extends SlashCommand {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('swarm', 'Manage AI agent swarms with various topologies and coordination patterns');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getUsage() {
|
|
16
|
-
return '/swarm <action> [options]';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getExamples() {
|
|
20
|
-
return [
|
|
21
|
-
'/swarm init mesh 8 - Initialize mesh topology with 8 agents',
|
|
22
|
-
'/swarm status - Get current swarm status',
|
|
23
|
-
'/swarm spawn researcher - Spawn a researcher agent',
|
|
24
|
-
'/swarm orchestrate "Build REST API" - Orchestrate a task',
|
|
25
|
-
'/swarm monitor - Monitor swarm activity',
|
|
26
|
-
'/swarm scale 12 - Scale swarm to 12 agents',
|
|
27
|
-
'/swarm destroy - Gracefully shutdown swarm'
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async execute(args, context) {
|
|
32
|
-
const [action, ...params] = args;
|
|
33
|
-
|
|
34
|
-
if (!action) {
|
|
35
|
-
return this.formatResponse({
|
|
36
|
-
success: false,
|
|
37
|
-
error: 'Action required',
|
|
38
|
-
usage: this.getUsage(),
|
|
39
|
-
availableActions: [
|
|
40
|
-
'init', 'status', 'spawn', 'orchestrate', 'monitor', 'scale', 'destroy'
|
|
41
|
-
]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
let result;
|
|
47
|
-
|
|
48
|
-
switch (action.toLowerCase()) {
|
|
49
|
-
case 'init':
|
|
50
|
-
result = await this.initSwarm(params);
|
|
51
|
-
break;
|
|
52
|
-
|
|
53
|
-
case 'status':
|
|
54
|
-
result = await this.getStatus(params);
|
|
55
|
-
break;
|
|
56
|
-
|
|
57
|
-
case 'spawn':
|
|
58
|
-
result = await this.spawnAgent(params);
|
|
59
|
-
break;
|
|
60
|
-
|
|
61
|
-
case 'orchestrate':
|
|
62
|
-
result = await this.orchestrateTask(params);
|
|
63
|
-
break;
|
|
64
|
-
|
|
65
|
-
case 'monitor':
|
|
66
|
-
result = await this.monitorSwarm(params);
|
|
67
|
-
break;
|
|
68
|
-
|
|
69
|
-
case 'scale':
|
|
70
|
-
result = await this.scaleSwarm(params);
|
|
71
|
-
break;
|
|
72
|
-
|
|
73
|
-
case 'destroy':
|
|
74
|
-
result = await this.destroySwarm(params);
|
|
75
|
-
break;
|
|
76
|
-
|
|
77
|
-
default:
|
|
78
|
-
result = {
|
|
79
|
-
success: false,
|
|
80
|
-
error: `Unknown action: ${action}`,
|
|
81
|
-
availableActions: [
|
|
82
|
-
'init', 'status', 'spawn', 'orchestrate', 'monitor', 'scale', 'destroy'
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return this.formatResponse(result);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
return this.formatResponse({
|
|
90
|
-
success: false,
|
|
91
|
-
error: error.message,
|
|
92
|
-
action: action
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async initSwarm(params) {
|
|
98
|
-
const [topology = 'mesh', maxAgents = '8', strategy = 'balanced'] = params;
|
|
99
|
-
|
|
100
|
-
const validTopologies = ['mesh', 'hierarchical', 'ring', 'star'];
|
|
101
|
-
if (!validTopologies.includes(topology)) {
|
|
102
|
-
return {
|
|
103
|
-
success: false,
|
|
104
|
-
error: `Invalid topology. Valid options: ${validTopologies.join(', ')}`
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const agentCount = parseInt(maxAgents);
|
|
109
|
-
if (isNaN(agentCount) || agentCount < 1 || agentCount > 100) {
|
|
110
|
-
return {
|
|
111
|
-
success: false,
|
|
112
|
-
error: 'Agent count must be between 1 and 100'
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
console.log(`🚀 Initializing ${topology} swarm with ${agentCount} agents...`);
|
|
117
|
-
|
|
118
|
-
const prompt = `
|
|
119
|
-
🚀 **SWARM INITIALIZATION**
|
|
120
|
-
|
|
121
|
-
**Configuration:**
|
|
122
|
-
- Topology: ${topology}
|
|
123
|
-
- Max Agents: ${agentCount}
|
|
124
|
-
- Strategy: ${strategy}
|
|
125
|
-
|
|
126
|
-
**Initialize the swarm with MCP tools:**
|
|
127
|
-
|
|
128
|
-
\`\`\`javascript
|
|
129
|
-
// Step 1: Initialize swarm coordination
|
|
130
|
-
mcp__claude-flow__swarm_init({
|
|
131
|
-
topology: "${topology}",
|
|
132
|
-
maxAgents: ${agentCount},
|
|
133
|
-
strategy: "${strategy}"
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// Step 2: Set up agent coordination patterns
|
|
137
|
-
mcp__claude-flow__coordination_sync({ swarmId: "swarm-${Date.now()}" });
|
|
138
|
-
\`\`\`
|
|
139
|
-
|
|
140
|
-
**Then use Claude Code's Task tool to spawn actual working agents:**
|
|
141
|
-
\`\`\`javascript
|
|
142
|
-
Task("Coordinator Agent", "Coordinate swarm activities and task distribution", "coordinator")
|
|
143
|
-
Task("Research Agent", "Analyze requirements and gather information", "researcher")
|
|
144
|
-
Task("Coder Agent", "Implement code and solutions", "coder")
|
|
145
|
-
Task("Tester Agent", "Create and run comprehensive tests", "tester")
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
**Execute this swarm initialization now**:
|
|
149
|
-
`;
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
success: true,
|
|
153
|
-
prompt: prompt,
|
|
154
|
-
topology: topology,
|
|
155
|
-
maxAgents: agentCount,
|
|
156
|
-
strategy: strategy,
|
|
157
|
-
swarmId: `swarm-${Date.now()}`
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async getStatus(params) {
|
|
162
|
-
const [verbose = 'false'] = params;
|
|
163
|
-
const isVerbose = verbose.toLowerCase() === 'true';
|
|
164
|
-
|
|
165
|
-
console.log('📊 Getting swarm status...');
|
|
166
|
-
|
|
167
|
-
const prompt = `
|
|
168
|
-
📊 **SWARM STATUS CHECK**
|
|
169
|
-
|
|
170
|
-
**Get current swarm information:**
|
|
171
|
-
|
|
172
|
-
\`\`\`javascript
|
|
173
|
-
// Check swarm status with MCP tools
|
|
174
|
-
mcp__claude-flow__swarm_status({ verbose: ${isVerbose} });
|
|
175
|
-
|
|
176
|
-
// Get agent metrics
|
|
177
|
-
mcp__claude-flow__agent_metrics({ metric: "all" });
|
|
178
|
-
|
|
179
|
-
// Check active tasks
|
|
180
|
-
mcp__claude-flow__task_status({ detailed: ${isVerbose} });
|
|
181
|
-
\`\`\`
|
|
182
|
-
|
|
183
|
-
**Execute this status check now**:
|
|
184
|
-
`;
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
success: true,
|
|
188
|
-
prompt: prompt,
|
|
189
|
-
verbose: isVerbose
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
async spawnAgent(params) {
|
|
194
|
-
const [type, ...nameParams] = params;
|
|
195
|
-
const name = nameParams.join(' ');
|
|
196
|
-
|
|
197
|
-
if (!type) {
|
|
198
|
-
return {
|
|
199
|
-
success: false,
|
|
200
|
-
error: 'Agent type required',
|
|
201
|
-
availableTypes: [
|
|
202
|
-
'researcher', 'coder', 'analyst', 'optimizer', 'coordinator',
|
|
203
|
-
'tester', 'reviewer', 'architect', 'documenter'
|
|
204
|
-
]
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
console.log(`🤖 Spawning ${type} agent${name ? ` named "${name}"` : ''}...`);
|
|
209
|
-
|
|
210
|
-
const prompt = `
|
|
211
|
-
🤖 **SPAWN AGENT**
|
|
212
|
-
|
|
213
|
-
**Agent Configuration:**
|
|
214
|
-
- Type: ${type}
|
|
215
|
-
- Name: ${name || `${type}-${Date.now()}`}
|
|
216
|
-
|
|
217
|
-
**Use both MCP coordination and Claude Code execution:**
|
|
218
|
-
|
|
219
|
-
\`\`\`javascript
|
|
220
|
-
// Step 1: Register agent with MCP coordination
|
|
221
|
-
mcp__claude-flow__agent_spawn({
|
|
222
|
-
type: "${type}",
|
|
223
|
-
name: "${name || `${type}-${Date.now()}`}",
|
|
224
|
-
capabilities: ["${type}-specific-capabilities"]
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
// Step 2: Spawn actual working agent with Claude Code's Task tool
|
|
228
|
-
Task("${name || `${type} Agent`}", "Execute ${type} tasks with coordination hooks", "${type}")
|
|
229
|
-
\`\`\`
|
|
230
|
-
|
|
231
|
-
**Agent Instructions:**
|
|
232
|
-
The agent should use hooks for coordination:
|
|
233
|
-
- Pre-task: \`npx claude-flow@alpha hooks pre-task\`
|
|
234
|
-
- Post-edit: \`npx claude-flow@alpha hooks post-edit\`
|
|
235
|
-
- Post-task: \`npx claude-flow@alpha hooks post-task\`
|
|
236
|
-
|
|
237
|
-
**Execute this agent spawn now**:
|
|
238
|
-
`;
|
|
239
|
-
|
|
240
|
-
return {
|
|
241
|
-
success: true,
|
|
242
|
-
prompt: prompt,
|
|
243
|
-
agentType: type,
|
|
244
|
-
agentName: name || `${type}-${Date.now()}`
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
async orchestrateTask(params) {
|
|
249
|
-
const task = params.join(' ');
|
|
250
|
-
|
|
251
|
-
if (!task) {
|
|
252
|
-
return {
|
|
253
|
-
success: false,
|
|
254
|
-
error: 'Task description required'
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
console.log(`🎯 Orchestrating task: ${task}`);
|
|
259
|
-
|
|
260
|
-
const prompt = `
|
|
261
|
-
🎯 **TASK ORCHESTRATION**
|
|
262
|
-
|
|
263
|
-
**Task:** ${task}
|
|
264
|
-
|
|
265
|
-
**Orchestrate with coordinated agents:**
|
|
266
|
-
|
|
267
|
-
\`\`\`javascript
|
|
268
|
-
// Step 1: Set up task orchestration
|
|
269
|
-
mcp__claude-flow__task_orchestrate({
|
|
270
|
-
task: "${task}",
|
|
271
|
-
strategy: "adaptive",
|
|
272
|
-
priority: "high"
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
// Step 2: Spawn coordinated agents with Claude Code's Task tool
|
|
276
|
-
Task("Task Coordinator", "Break down and coordinate: ${task}", "coordinator")
|
|
277
|
-
Task("Implementation Agent", "Execute main implementation for: ${task}", "coder")
|
|
278
|
-
Task("Quality Agent", "Ensure quality and testing for: ${task}", "tester")
|
|
279
|
-
Task("Review Agent", "Review and validate: ${task}", "reviewer")
|
|
280
|
-
\`\`\`
|
|
281
|
-
|
|
282
|
-
**Coordination Protocol:**
|
|
283
|
-
1. Each agent uses hooks for coordination
|
|
284
|
-
2. Shared memory for context and progress
|
|
285
|
-
3. Automatic load balancing and optimization
|
|
286
|
-
|
|
287
|
-
**Execute this task orchestration now**:
|
|
288
|
-
`;
|
|
289
|
-
|
|
290
|
-
return {
|
|
291
|
-
success: true,
|
|
292
|
-
prompt: prompt,
|
|
293
|
-
task: task,
|
|
294
|
-
taskId: `task-${Date.now()}`
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
async monitorSwarm(params) {
|
|
299
|
-
const [duration = '30'] = params;
|
|
300
|
-
const monitorDuration = parseInt(duration);
|
|
301
|
-
|
|
302
|
-
console.log(`👁️ Monitoring swarm for ${monitorDuration} seconds...`);
|
|
303
|
-
|
|
304
|
-
const prompt = `
|
|
305
|
-
👁️ **SWARM MONITORING**
|
|
306
|
-
|
|
307
|
-
**Monitor swarm activity:**
|
|
308
|
-
|
|
309
|
-
\`\`\`javascript
|
|
310
|
-
// Real-time swarm monitoring
|
|
311
|
-
mcp__claude-flow__swarm_monitor({
|
|
312
|
-
interval: 5,
|
|
313
|
-
duration: ${monitorDuration}
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Performance metrics
|
|
317
|
-
mcp__claude-flow__performance_report({ format: "detailed" });
|
|
318
|
-
|
|
319
|
-
// Agent performance
|
|
320
|
-
mcp__claude-flow__agent_metrics({ metric: "performance" });
|
|
321
|
-
\`\`\`
|
|
322
|
-
|
|
323
|
-
**Monitoring Dashboard:**
|
|
324
|
-
- Agent status and performance
|
|
325
|
-
- Task progress and completion
|
|
326
|
-
- Resource utilization
|
|
327
|
-
- Coordination efficiency
|
|
328
|
-
|
|
329
|
-
**Execute this monitoring now**:
|
|
330
|
-
`;
|
|
331
|
-
|
|
332
|
-
return {
|
|
333
|
-
success: true,
|
|
334
|
-
prompt: prompt,
|
|
335
|
-
duration: monitorDuration
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
async scaleSwarm(params) {
|
|
340
|
-
const [targetSize] = params;
|
|
341
|
-
const newSize = parseInt(targetSize);
|
|
342
|
-
|
|
343
|
-
if (isNaN(newSize) || newSize < 1 || newSize > 100) {
|
|
344
|
-
return {
|
|
345
|
-
success: false,
|
|
346
|
-
error: 'Target size must be between 1 and 100'
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
console.log(`📈 Scaling swarm to ${newSize} agents...`);
|
|
351
|
-
|
|
352
|
-
const prompt = `
|
|
353
|
-
📈 **SWARM SCALING**
|
|
354
|
-
|
|
355
|
-
**Scale to ${newSize} agents:**
|
|
356
|
-
|
|
357
|
-
\`\`\`javascript
|
|
358
|
-
// Auto-scale swarm
|
|
359
|
-
mcp__claude-flow__swarm_scale({
|
|
360
|
-
targetSize: ${newSize}
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
// Optimize topology for new size
|
|
364
|
-
mcp__claude-flow__topology_optimize();
|
|
365
|
-
|
|
366
|
-
// Rebalance tasks
|
|
367
|
-
mcp__claude-flow__load_balance({ tasks: ["current-tasks"] });
|
|
368
|
-
\`\`\`
|
|
369
|
-
|
|
370
|
-
**Scaling Strategy:**
|
|
371
|
-
- Graceful addition/removal of agents
|
|
372
|
-
- Automatic task redistribution
|
|
373
|
-
- Topology optimization
|
|
374
|
-
- Performance monitoring
|
|
375
|
-
|
|
376
|
-
**Execute this scaling now**:
|
|
377
|
-
`;
|
|
378
|
-
|
|
379
|
-
return {
|
|
380
|
-
success: true,
|
|
381
|
-
prompt: prompt,
|
|
382
|
-
targetSize: newSize
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
async destroySwarm(params) {
|
|
387
|
-
console.log('🛑 Destroying swarm...');
|
|
388
|
-
|
|
389
|
-
const prompt = `
|
|
390
|
-
🛑 **SWARM DESTRUCTION**
|
|
391
|
-
|
|
392
|
-
**Gracefully shutdown swarm:**
|
|
393
|
-
|
|
394
|
-
\`\`\`javascript
|
|
395
|
-
// Step 1: Complete current tasks
|
|
396
|
-
mcp__claude-flow__task_status({ detailed: true });
|
|
397
|
-
|
|
398
|
-
// Step 2: Save state and metrics
|
|
399
|
-
mcp__claude-flow__state_snapshot({ name: "final-state" });
|
|
400
|
-
|
|
401
|
-
// Step 3: Destroy swarm
|
|
402
|
-
mcp__claude-flow__swarm_destroy();
|
|
403
|
-
\`\`\`
|
|
404
|
-
|
|
405
|
-
**Shutdown Checklist:**
|
|
406
|
-
- ✅ Complete active tasks
|
|
407
|
-
- ✅ Save coordination state
|
|
408
|
-
- ✅ Export performance metrics
|
|
409
|
-
- ✅ Clean up resources
|
|
410
|
-
- ✅ Graceful agent termination
|
|
411
|
-
|
|
412
|
-
**Execute this shutdown now**:
|
|
413
|
-
`;
|
|
414
|
-
|
|
415
|
-
return {
|
|
416
|
-
success: true,
|
|
417
|
-
prompt: prompt,
|
|
418
|
-
action: 'destroy'
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export default SwarmCommand;
|