@sparkleideas/ruv-swarm 1.0.21 → 1.0.22
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/bin/ruv-swarm-clean.js +62 -62
- package/bin/ruv-swarm-memory.js +2 -2
- package/bin/ruv-swarm-secure-heartbeat.js +46 -46
- package/bin/ruv-swarm-secure.js +43 -43
- package/package.json +1 -1
- package/src/benchmark.js +4 -4
- package/src/claude-flow-enhanced.js +2 -2
- package/src/claude-integration/advanced-commands.js +7 -7
- package/src/claude-integration/core.js +4 -4
- package/src/claude-integration/docs.js +59 -59
- package/src/claude-integration/env-template.js +4 -4
- package/src/claude-integration/index.js +3 -3
- package/src/claude-integration/remote.js +1 -1
- package/src/cli-diagnostics.js +13 -13
- package/src/diagnostics.js +1 -1
- package/src/errors.js +1 -1
- package/src/github-coordinator/gh-cli-coordinator.js +1 -1
- package/src/hooks/cli.js +2 -2
- package/src/hooks/index.js +13 -13
- package/src/index-enhanced.d.ts +2 -2
- package/src/index-enhanced.js +3 -3
- package/src/logger.js +2 -2
- package/src/logging-config.js +1 -1
- package/src/mcp-tools-benchmarks.js +1 -1
- package/src/neural.js +3 -3
- package/src/performance-benchmarks.js +1 -1
- package/src/performance.js +11 -11
- package/src/persistence-pooled.js +1 -1
- package/src/persistence.js +2 -2
- package/src/security.js +1 -1
- package/src/sqlite-pool.js +1 -1
- package/src/wasm-loader.js +1 -1
|
@@ -57,7 +57,7 @@ class ClaudeDocsGenerator {
|
|
|
57
57
|
}
|
|
58
58
|
return await this.mergeClaudeMd(filePath, noBackup);
|
|
59
59
|
}
|
|
60
|
-
const content = `# Claude Code Configuration for
|
|
60
|
+
const content = `# Claude Code Configuration for ruv-swarm
|
|
61
61
|
|
|
62
62
|
## 🎯 IMPORTANT: Separation of Responsibilities
|
|
63
63
|
|
|
@@ -68,7 +68,7 @@ class ClaudeDocsGenerator {
|
|
|
68
68
|
- ✅ **ALL actual implementation** work
|
|
69
69
|
- ✅ **Project navigation** and code analysis
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### ruv-swarm MCP Tools Handle:
|
|
72
72
|
- 🧠 **Coordination only** - Orchestrating Claude Code's actions
|
|
73
73
|
- 💾 **Memory management** - Persistent state across sessions
|
|
74
74
|
- 🤖 **Neural features** - Cognitive patterns and learning
|
|
@@ -144,12 +144,12 @@ Message 6: Write "package.json"
|
|
|
144
144
|
|
|
145
145
|
### 1. Add MCP Server (Stdio - No Port Needed)
|
|
146
146
|
\`\`\`bash
|
|
147
|
-
# Add
|
|
148
|
-
claude mcp add
|
|
147
|
+
# Add ruv-swarm MCP server to Claude Code using stdio
|
|
148
|
+
claude mcp add ruv-swarm npx ruv-swarm mcp start
|
|
149
149
|
\`\`\`
|
|
150
150
|
|
|
151
151
|
### 2. Use MCP Tools for Coordination in Claude Code
|
|
152
|
-
Once configured,
|
|
152
|
+
Once configured, ruv-swarm MCP tools enhance Claude Code's coordination:
|
|
153
153
|
|
|
154
154
|
**Initialize a swarm:**
|
|
155
155
|
- Use the \`mcp__ruv-swarm__swarm_init\` tool to set up coordination topology
|
|
@@ -215,10 +215,10 @@ Once configured, @sparkleideas/ruv-swarm MCP tools enhance Claude Code's coordin
|
|
|
215
215
|
|
|
216
216
|
**What Actually Happens:**
|
|
217
217
|
1. The swarm sets up a coordination framework
|
|
218
|
-
2. Each agent MUST use
|
|
219
|
-
- \`npx
|
|
220
|
-
- \`npx
|
|
221
|
-
- \`npx
|
|
218
|
+
2. Each agent MUST use ruv-swarm hooks for coordination:
|
|
219
|
+
- \`npx ruv-swarm hook pre-task\` before starting
|
|
220
|
+
- \`npx ruv-swarm hook post-edit\` after each file operation
|
|
221
|
+
- \`npx ruv-swarm hook notification\` to share decisions
|
|
222
222
|
3. Claude Code uses its native Read, WebSearch, and Task tools
|
|
223
223
|
4. The swarm coordinates through shared memory and hooks
|
|
224
224
|
5. Results are synthesized by Claude Code with full coordination history
|
|
@@ -248,7 +248,7 @@ Once configured, @sparkleideas/ruv-swarm MCP tools enhance Claude Code's coordin
|
|
|
248
248
|
- Post-edit hooks for progress tracking
|
|
249
249
|
- Memory storage for cross-agent coordination
|
|
250
250
|
3. Claude Code uses Write, Edit, Bash tools for implementation
|
|
251
|
-
4. Agents share progress through
|
|
251
|
+
4. Agents share progress through ruv-swarm memory
|
|
252
252
|
5. All code is written by Claude Code with full coordination
|
|
253
253
|
|
|
254
254
|
## Best Practices for Coordination
|
|
@@ -276,7 +276,7 @@ The swarm provides persistent memory that helps Claude Code:
|
|
|
276
276
|
|
|
277
277
|
## Performance Benefits
|
|
278
278
|
|
|
279
|
-
When using
|
|
279
|
+
When using ruv-swarm coordination with Claude Code:
|
|
280
280
|
- **84.8% SWE-Bench solve rate** - Better problem-solving through coordination
|
|
281
281
|
- **32.3% token reduction** - Efficient task breakdown reduces redundancy
|
|
282
282
|
- **2.8-4.4x speed improvement** - Parallel coordination strategies
|
|
@@ -284,7 +284,7 @@ When using @sparkleideas/ruv-swarm coordination with Claude Code:
|
|
|
284
284
|
|
|
285
285
|
## Claude Code Hooks Integration
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
ruv-swarm includes powerful hooks that automate coordination:
|
|
288
288
|
|
|
289
289
|
### Pre-Operation Hooks
|
|
290
290
|
- **Auto-assign agents** before file edits based on file type
|
|
@@ -345,7 +345,7 @@ See \`.claude/commands/\` for detailed documentation on all features.
|
|
|
345
345
|
1. **SPAWN ALL AGENTS IN ONE BATCH** - Use multiple tool calls in a SINGLE message
|
|
346
346
|
2. **EXECUTE TASKS IN PARALLEL** - Never wait for one task before starting another
|
|
347
347
|
3. **USE BATCHTOOL FOR EVERYTHING** - Multiple operations = Single message with multiple tools
|
|
348
|
-
4. **ALL AGENTS MUST USE COORDINATION TOOLS** - Every spawned agent MUST use
|
|
348
|
+
4. **ALL AGENTS MUST USE COORDINATION TOOLS** - Every spawned agent MUST use ruv-swarm hooks and memory
|
|
349
349
|
|
|
350
350
|
## 📋 MANDATORY AGENT COORDINATION PROTOCOL
|
|
351
351
|
|
|
@@ -356,27 +356,27 @@ When you spawn an agent using the Task tool, that agent MUST:
|
|
|
356
356
|
**1️⃣ BEFORE Starting Work:**
|
|
357
357
|
\`\`\`bash
|
|
358
358
|
# Check previous work and load context
|
|
359
|
-
npx
|
|
360
|
-
npx
|
|
359
|
+
npx ruv-swarm hook pre-task --description "[agent task]" --auto-spawn-agents false
|
|
360
|
+
npx ruv-swarm hook session-restore --session-id "swarm-[id]" --load-memory true
|
|
361
361
|
\`\`\`
|
|
362
362
|
|
|
363
363
|
**2️⃣ DURING Work (After EVERY Major Step):**
|
|
364
364
|
\`\`\`bash
|
|
365
365
|
# Store progress in memory after each file operation
|
|
366
|
-
npx
|
|
366
|
+
npx ruv-swarm hook post-edit --file "[filepath]" --memory-key "swarm/[agent]/[step]"
|
|
367
367
|
|
|
368
368
|
# Store decisions and findings
|
|
369
|
-
npx
|
|
369
|
+
npx ruv-swarm hook notification --message "[what was done]" --telemetry true
|
|
370
370
|
|
|
371
371
|
# Check coordination with other agents
|
|
372
|
-
npx
|
|
372
|
+
npx ruv-swarm hook pre-search --query "[what to check]" --cache-results true
|
|
373
373
|
\`\`\`
|
|
374
374
|
|
|
375
375
|
**3️⃣ AFTER Completing Work:**
|
|
376
376
|
\`\`\`bash
|
|
377
377
|
# Save all results and learnings
|
|
378
|
-
npx
|
|
379
|
-
npx
|
|
378
|
+
npx ruv-swarm hook post-task --task-id "[task]" --analyze-performance true
|
|
379
|
+
npx ruv-swarm hook session-end --export-metrics true --generate-summary true
|
|
380
380
|
\`\`\`
|
|
381
381
|
|
|
382
382
|
### 🎯 AGENT PROMPT TEMPLATE
|
|
@@ -387,10 +387,10 @@ When spawning agents, ALWAYS include these coordination instructions:
|
|
|
387
387
|
You are the [Agent Type] agent in a coordinated swarm.
|
|
388
388
|
|
|
389
389
|
MANDATORY COORDINATION:
|
|
390
|
-
1. START: Run \`npx
|
|
391
|
-
2. DURING: After EVERY file operation, run \`npx
|
|
392
|
-
3. MEMORY: Store ALL decisions using \`npx
|
|
393
|
-
4. END: Run \`npx
|
|
390
|
+
1. START: Run \`npx ruv-swarm hook pre-task --description "[your task]"\`
|
|
391
|
+
2. DURING: After EVERY file operation, run \`npx ruv-swarm hook post-edit --file "[file]" --memory-key "agent/[step]"\`
|
|
392
|
+
3. MEMORY: Store ALL decisions using \`npx ruv-swarm hook notification --message "[decision]"\`
|
|
393
|
+
4. END: Run \`npx ruv-swarm hook post-task --task-id "[task]" --analyze-performance true\`
|
|
394
394
|
|
|
395
395
|
Your specific task: [detailed task description]
|
|
396
396
|
|
|
@@ -615,7 +615,7 @@ Agent Activity:
|
|
|
615
615
|
|
|
616
616
|
---
|
|
617
617
|
|
|
618
|
-
Remember:
|
|
618
|
+
Remember: **ruv-swarm coordinates, Claude Code creates!** Start with \`mcp__ruv-swarm__swarm_init\` to enhance your development workflow.
|
|
619
619
|
`;
|
|
620
620
|
|
|
621
621
|
// Write the new content
|
|
@@ -821,7 +821,7 @@ Remember: All code is written by Claude Code using its native tools!`,
|
|
|
821
821
|
// Hook commands
|
|
822
822
|
'hooks/overview.md': {
|
|
823
823
|
title: 'Claude Code Hooks Overview',
|
|
824
|
-
content: `# Claude Code Hooks for
|
|
824
|
+
content: `# Claude Code Hooks for ruv-swarm
|
|
825
825
|
|
|
826
826
|
## Purpose
|
|
827
827
|
Automatically coordinate, format, and learn from Claude Code operations using hooks.
|
|
@@ -860,7 +860,7 @@ Hooks are configured in \`.claude/settings.json\`:
|
|
|
860
860
|
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
861
861
|
"hooks": [{
|
|
862
862
|
"type": "command",
|
|
863
|
-
"command": "npx
|
|
863
|
+
"command": "npx ruv-swarm hook pre-edit --file '\${tool.params.file_path}'"
|
|
864
864
|
}]
|
|
865
865
|
}
|
|
866
866
|
]
|
|
@@ -882,13 +882,13 @@ Hooks are configured in \`.claude/settings.json\`:
|
|
|
882
882
|
},
|
|
883
883
|
'hooks/setup.md': {
|
|
884
884
|
title: 'Setting Up Hooks',
|
|
885
|
-
content: `# Setting Up
|
|
885
|
+
content: `# Setting Up ruv-swarm Hooks
|
|
886
886
|
|
|
887
887
|
## Quick Start
|
|
888
888
|
|
|
889
889
|
### 1. Initialize with Hooks
|
|
890
890
|
\`\`\`bash
|
|
891
|
-
npx
|
|
891
|
+
npx ruv-swarm init --claude --force
|
|
892
892
|
\`\`\`
|
|
893
893
|
|
|
894
894
|
This automatically creates:
|
|
@@ -899,10 +899,10 @@ This automatically creates:
|
|
|
899
899
|
### 2. Test Hook Functionality
|
|
900
900
|
\`\`\`bash
|
|
901
901
|
# Test pre-edit hook
|
|
902
|
-
npx
|
|
902
|
+
npx ruv-swarm hook pre-edit --file test.js --ensure-coordination
|
|
903
903
|
|
|
904
904
|
# Test session summary
|
|
905
|
-
npx
|
|
905
|
+
npx ruv-swarm hook session-end --generate-summary
|
|
906
906
|
\`\`\`
|
|
907
907
|
|
|
908
908
|
### 3. Customize Hooks
|
|
@@ -917,7 +917,7 @@ Edit \`.claude/settings.json\` to customize:
|
|
|
917
917
|
"matcher": "^Write$",
|
|
918
918
|
"hooks": [{
|
|
919
919
|
"type": "command",
|
|
920
|
-
"command": "npx
|
|
920
|
+
"command": "npx ruv-swarm hook custom-pre-write --file '\${tool.params.file_path}'"
|
|
921
921
|
}]
|
|
922
922
|
}
|
|
923
923
|
]
|
|
@@ -956,7 +956,7 @@ Example blocking response:
|
|
|
956
956
|
export RUV_SWARM_HOOK_DEBUG=true
|
|
957
957
|
|
|
958
958
|
# Test specific hook
|
|
959
|
-
npx
|
|
959
|
+
npx ruv-swarm hook pre-edit --file app.js --debug
|
|
960
960
|
\`\`\`
|
|
961
961
|
|
|
962
962
|
## Common Patterns
|
|
@@ -970,7 +970,7 @@ Already configured by default for common file types.
|
|
|
970
970
|
"matcher": "^(Write|Edit)$",
|
|
971
971
|
"hooks": [{
|
|
972
972
|
"type": "command",
|
|
973
|
-
"command": "npx
|
|
973
|
+
"command": "npx ruv-swarm hook check-protected --file '\${tool.params.file_path}'"
|
|
974
974
|
}]
|
|
975
975
|
}
|
|
976
976
|
\`\`\`
|
|
@@ -1062,7 +1062,7 @@ ${config.details}
|
|
|
1062
1062
|
},
|
|
1063
1063
|
permissions: {
|
|
1064
1064
|
allow: [
|
|
1065
|
-
'Bash(npx
|
|
1065
|
+
'Bash(npx ruv-swarm *)',
|
|
1066
1066
|
'Bash(npm run lint)',
|
|
1067
1067
|
'Bash(npm run test:*)',
|
|
1068
1068
|
'Bash(npm test *)',
|
|
@@ -1087,9 +1087,9 @@ ${config.details}
|
|
|
1087
1087
|
},
|
|
1088
1088
|
hooks: {},
|
|
1089
1089
|
mcpServers: {
|
|
1090
|
-
'
|
|
1090
|
+
'ruv-swarm': {
|
|
1091
1091
|
command: 'npx',
|
|
1092
|
-
args: ['
|
|
1092
|
+
args: ['ruv-swarm', 'mcp', 'start'],
|
|
1093
1093
|
env: {
|
|
1094
1094
|
RUV_SWARM_HOOKS_ENABLED: 'false',
|
|
1095
1095
|
RUV_SWARM_TELEMETRY_ENABLED: 'true',
|
|
@@ -1207,13 +1207,13 @@ ${config.details}
|
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
1209
|
/**
|
|
1210
|
-
* Merge
|
|
1210
|
+
* Merge ruv-swarm content with existing CLAUDE.md
|
|
1211
1211
|
*/
|
|
1212
1212
|
async mergeClaudeMd(filePath, noBackup = false) {
|
|
1213
1213
|
try {
|
|
1214
1214
|
const existingContent = await fs.readFile(filePath, 'utf8');
|
|
1215
1215
|
|
|
1216
|
-
console.log('📝 Merging
|
|
1216
|
+
console.log('📝 Merging ruv-swarm configuration with existing CLAUDE.md');
|
|
1217
1217
|
|
|
1218
1218
|
// Create backup first (unless disabled)
|
|
1219
1219
|
if (!noBackup) {
|
|
@@ -1222,7 +1222,7 @@ ${config.details}
|
|
|
1222
1222
|
console.log('📝 Skipping backup creation (disabled by --no-backup)');
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
-
// Generate new
|
|
1225
|
+
// Generate new ruv-swarm content
|
|
1226
1226
|
const ruvSwarmContent = this.getRuvSwarmContent();
|
|
1227
1227
|
|
|
1228
1228
|
// Intelligent merging
|
|
@@ -1231,7 +1231,7 @@ ${config.details}
|
|
|
1231
1231
|
// Write merged content
|
|
1232
1232
|
await fs.writeFile(filePath, mergedContent);
|
|
1233
1233
|
|
|
1234
|
-
console.log('✅ Successfully merged
|
|
1234
|
+
console.log('✅ Successfully merged ruv-swarm configuration with existing CLAUDE.md');
|
|
1235
1235
|
|
|
1236
1236
|
return { file: 'CLAUDE.md', success: true, action: 'merged' };
|
|
1237
1237
|
} catch (error) {
|
|
@@ -1241,11 +1241,11 @@ ${config.details}
|
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
/**
|
|
1244
|
-
* Get the
|
|
1244
|
+
* Get the ruv-swarm specific content (full content from generateClaudeMd)
|
|
1245
1245
|
*/
|
|
1246
1246
|
getRuvSwarmContent() {
|
|
1247
|
-
// Return the complete
|
|
1248
|
-
const content = `# Claude Code Configuration for
|
|
1247
|
+
// Return the complete ruv-swarm configuration content
|
|
1248
|
+
const content = `# Claude Code Configuration for ruv-swarm
|
|
1249
1249
|
|
|
1250
1250
|
## 🎯 IMPORTANT: Separation of Responsibilities
|
|
1251
1251
|
|
|
@@ -1256,7 +1256,7 @@ ${config.details}
|
|
|
1256
1256
|
- ✅ **ALL actual implementation** work
|
|
1257
1257
|
- ✅ **Project navigation** and code analysis
|
|
1258
1258
|
|
|
1259
|
-
###
|
|
1259
|
+
### ruv-swarm MCP Tools Handle:
|
|
1260
1260
|
- 🧠 **Coordination only** - Orchestrating Claude Code's actions
|
|
1261
1261
|
- 💾 **Memory management** - Persistent state across sessions
|
|
1262
1262
|
- 🤖 **Neural features** - Cognitive patterns and learning
|
|
@@ -1332,12 +1332,12 @@ Message 6: Write "package.json"
|
|
|
1332
1332
|
|
|
1333
1333
|
### 1. Add MCP Server (Stdio - No Port Needed)
|
|
1334
1334
|
\`\`\`bash
|
|
1335
|
-
# Add
|
|
1336
|
-
claude mcp add
|
|
1335
|
+
# Add ruv-swarm MCP server to Claude Code using stdio
|
|
1336
|
+
claude mcp add ruv-swarm npx ruv-swarm mcp start
|
|
1337
1337
|
\`\`\`
|
|
1338
1338
|
|
|
1339
1339
|
### 2. Use MCP Tools for Coordination in Claude Code
|
|
1340
|
-
Once configured,
|
|
1340
|
+
Once configured, ruv-swarm MCP tools enhance Claude Code's coordination:
|
|
1341
1341
|
|
|
1342
1342
|
**Initialize a swarm:**
|
|
1343
1343
|
- Use the \`mcp__ruv-swarm__swarm_init\` tool to set up coordination topology
|
|
@@ -1396,7 +1396,7 @@ Once configured, @sparkleideas/ruv-swarm MCP tools enhance Claude Code's coordin
|
|
|
1396
1396
|
|
|
1397
1397
|
## Performance Benefits
|
|
1398
1398
|
|
|
1399
|
-
When using
|
|
1399
|
+
When using ruv-swarm coordination with Claude Code:
|
|
1400
1400
|
- **84.8% SWE-Bench solve rate** - Better problem-solving through coordination
|
|
1401
1401
|
- **32.3% token reduction** - Efficient task breakdown reduces redundancy
|
|
1402
1402
|
- **2.8-4.4x speed improvement** - Parallel coordination strategies
|
|
@@ -1410,24 +1410,24 @@ When using @sparkleideas/ruv-swarm coordination with Claude Code:
|
|
|
1410
1410
|
|
|
1411
1411
|
---
|
|
1412
1412
|
|
|
1413
|
-
Remember:
|
|
1413
|
+
Remember: **ruv-swarm coordinates, Claude Code creates!** Start with \`mcp__ruv-swarm__swarm_init\` to enhance your development workflow.`;
|
|
1414
1414
|
|
|
1415
1415
|
return content;
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
1418
|
/**
|
|
1419
|
-
* Intelligently combine
|
|
1419
|
+
* Intelligently combine ruv-swarm content with existing content
|
|
1420
1420
|
*/
|
|
1421
1421
|
intelligentMerge(existingContent, ruvSwarmContent) {
|
|
1422
1422
|
const existingLines = existingContent.split('\n');
|
|
1423
1423
|
const newLines = ruvSwarmContent.split('\n');
|
|
1424
1424
|
|
|
1425
|
-
// Check if
|
|
1425
|
+
// Check if ruv-swarm content already exists
|
|
1426
1426
|
const ruvSwarmSectionIndex = this.findRuvSwarmSection(existingLines);
|
|
1427
1427
|
|
|
1428
1428
|
if (ruvSwarmSectionIndex !== -1) {
|
|
1429
|
-
// Replace existing
|
|
1430
|
-
console.log('📝 Updating existing
|
|
1429
|
+
// Replace existing ruv-swarm section
|
|
1430
|
+
console.log('📝 Updating existing ruv-swarm section in CLAUDE.md');
|
|
1431
1431
|
const sectionEnd = this.findSectionEnd(existingLines, ruvSwarmSectionIndex);
|
|
1432
1432
|
|
|
1433
1433
|
// Replace the section
|
|
@@ -1436,19 +1436,19 @@ Remember: **@sparkleideas/ruv-swarm coordinates, Claude Code creates!** Start wi
|
|
|
1436
1436
|
|
|
1437
1437
|
return [...beforeSection, ...newLines, '', ...afterSection].join('\n');
|
|
1438
1438
|
}
|
|
1439
|
-
// Intelligently insert
|
|
1440
|
-
console.log('📝 Integrating
|
|
1439
|
+
// Intelligently insert ruv-swarm content
|
|
1440
|
+
console.log('📝 Integrating ruv-swarm configuration into existing CLAUDE.md');
|
|
1441
1441
|
return this.intelligentInsert(existingLines, newLines);
|
|
1442
1442
|
|
|
1443
1443
|
}
|
|
1444
1444
|
|
|
1445
1445
|
/**
|
|
1446
|
-
* Find existing
|
|
1446
|
+
* Find existing ruv-swarm section in content
|
|
1447
1447
|
*/
|
|
1448
1448
|
findRuvSwarmSection(lines) {
|
|
1449
1449
|
for (let i = 0; i < lines.length; i++) {
|
|
1450
1450
|
const line = lines[i].toLowerCase();
|
|
1451
|
-
if (line.includes('
|
|
1451
|
+
if (line.includes('ruv-swarm') && (line.startsWith('#') || line.includes('claude code configuration'))) {
|
|
1452
1452
|
return i;
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
@@ -1502,7 +1502,7 @@ Remember: **@sparkleideas/ruv-swarm coordinates, Claude Code creates!** Start wi
|
|
|
1502
1502
|
findSectionEnd(lines, startIndex) {
|
|
1503
1503
|
// Look for next top-level heading or end of file
|
|
1504
1504
|
for (let i = startIndex + 1; i < lines.length; i++) {
|
|
1505
|
-
if (lines[i].startsWith('# ') && !lines[i].includes('
|
|
1505
|
+
if (lines[i].startsWith('# ') && !lines[i].includes('ruv-swarm')) {
|
|
1506
1506
|
return i;
|
|
1507
1507
|
}
|
|
1508
1508
|
// Also check for horizontal rules that might separate sections
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Environment variable template for
|
|
2
|
+
* Environment variable template for ruv-swarm projects
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
const envTemplate = `#
|
|
5
|
+
const envTemplate = `# ruv-swarm Configuration
|
|
6
6
|
NODE_ENV=development
|
|
7
7
|
|
|
8
8
|
# Git Integration
|
|
9
9
|
RUV_SWARM_AUTO_COMMIT=true
|
|
10
10
|
RUV_SWARM_AUTO_PUSH=false
|
|
11
11
|
RUV_SWARM_COMMIT_PREFIX=feat
|
|
12
|
-
RUV_SWARM_GIT_AUTHOR
|
|
12
|
+
RUV_SWARM_GIT_AUTHOR=ruv-swarm
|
|
13
13
|
|
|
14
14
|
# Agent Reports
|
|
15
15
|
RUV_SWARM_GENERATE_REPORTS=true
|
|
16
|
-
RUV_SWARM_REPORT_DIR
|
|
16
|
+
RUV_SWARM_REPORT_DIR=.ruv-swarm/agent-reports
|
|
17
17
|
|
|
18
18
|
# Memory & Learning
|
|
19
19
|
RUV_SWARM_MEMORY_PERSIST=true
|
|
@@ -17,7 +17,7 @@ class ClaudeIntegrationOrchestrator {
|
|
|
17
17
|
noBackup: options.noBackup || false,
|
|
18
18
|
interactive: options.interactive !== false, // Default to true
|
|
19
19
|
workingDir: options.workingDir || process.cwd(),
|
|
20
|
-
packageName: options.packageName || '
|
|
20
|
+
packageName: options.packageName || 'ruv-swarm',
|
|
21
21
|
...options,
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -80,7 +80,7 @@ class ClaudeIntegrationOrchestrator {
|
|
|
80
80
|
success: true,
|
|
81
81
|
manualSetup: true,
|
|
82
82
|
instructions: [
|
|
83
|
-
'Run: claude mcp add
|
|
83
|
+
'Run: claude mcp add ruv-swarm npx ruv-swarm mcp start',
|
|
84
84
|
'Test with: mcp__ruv-swarm__agent_spawn',
|
|
85
85
|
],
|
|
86
86
|
};
|
|
@@ -97,7 +97,7 @@ class ClaudeIntegrationOrchestrator {
|
|
|
97
97
|
|
|
98
98
|
console.log('\n🔗 Next steps:');
|
|
99
99
|
if (results.modules.core.manualSetup) {
|
|
100
|
-
console.log(' 1. claude mcp add
|
|
100
|
+
console.log(' 1. claude mcp add ruv-swarm npx ruv-swarm mcp start');
|
|
101
101
|
console.log(' 2. Test with MCP tools: mcp__ruv-swarm__agent_spawn');
|
|
102
102
|
} else {
|
|
103
103
|
console.log(' 1. Test with MCP tools: mcp__ruv-swarm__agent_spawn');
|
|
@@ -9,7 +9,7 @@ import path from 'path';
|
|
|
9
9
|
class RemoteWrapperGenerator {
|
|
10
10
|
constructor(options = {}) {
|
|
11
11
|
this.workingDir = options.workingDir || process.cwd();
|
|
12
|
-
this.packageName = options.packageName || '
|
|
12
|
+
this.packageName = options.packageName || 'ruv-swarm';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
package/src/cli-diagnostics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Diagnostic CLI for
|
|
4
|
-
* Usage: npx
|
|
3
|
+
* Diagnostic CLI for ruv-swarm
|
|
4
|
+
* Usage: npx ruv-swarm diagnose [options]
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { diagnostics } from './diagnostics.js';
|
|
@@ -249,9 +249,9 @@ function showLoggingConfig(logger) {
|
|
|
249
249
|
console.log(' LOG_DIR - Log directory path');
|
|
250
250
|
|
|
251
251
|
console.log('\n💡 Examples:');
|
|
252
|
-
console.log(' LOG_LEVEL=DEBUG npx
|
|
253
|
-
console.log(' MCP_LOG_LEVEL=TRACE TOOLS_LOG_LEVEL=DEBUG npx
|
|
254
|
-
console.log(' LOG_TO_FILE=true LOG_DIR=./mylogs npx
|
|
252
|
+
console.log(' LOG_LEVEL=DEBUG npx ruv-swarm mcp start');
|
|
253
|
+
console.log(' MCP_LOG_LEVEL=TRACE TOOLS_LOG_LEVEL=DEBUG npx ruv-swarm mcp start');
|
|
254
|
+
console.log(' LOG_TO_FILE=true LOG_DIR=./mylogs npx ruv-swarm mcp start');
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
function formatReportForConsole(report) {
|
|
@@ -285,7 +285,7 @@ function formatReportForConsole(report) {
|
|
|
285
285
|
|
|
286
286
|
function formatReportAsMarkdown(report) {
|
|
287
287
|
const lines = [
|
|
288
|
-
'#
|
|
288
|
+
'# ruv-swarm Diagnostic Report',
|
|
289
289
|
'',
|
|
290
290
|
`Generated: ${report.timestamp}`,
|
|
291
291
|
'',
|
|
@@ -325,9 +325,9 @@ function formatReportAsMarkdown(report) {
|
|
|
325
325
|
|
|
326
326
|
function showHelp() {
|
|
327
327
|
console.log(`
|
|
328
|
-
🔍
|
|
328
|
+
🔍 ruv-swarm Diagnostics
|
|
329
329
|
|
|
330
|
-
Usage: npx
|
|
330
|
+
Usage: npx ruv-swarm diagnose <command> [options]
|
|
331
331
|
|
|
332
332
|
Commands:
|
|
333
333
|
test Run diagnostic tests
|
|
@@ -347,11 +347,11 @@ Commands:
|
|
|
347
347
|
help Show this help message
|
|
348
348
|
|
|
349
349
|
Examples:
|
|
350
|
-
npx
|
|
351
|
-
npx
|
|
352
|
-
npx
|
|
353
|
-
npx
|
|
354
|
-
npx
|
|
350
|
+
npx ruv-swarm diagnose test
|
|
351
|
+
npx ruv-swarm diagnose report --output=report.json
|
|
352
|
+
npx ruv-swarm diagnose monitor --duration=120
|
|
353
|
+
npx ruv-swarm diagnose logs --pattern="connection.*failed"
|
|
354
|
+
npx ruv-swarm diagnose config
|
|
355
355
|
`);
|
|
356
356
|
}
|
|
357
357
|
|
package/src/diagnostics.js
CHANGED
package/src/errors.js
CHANGED
package/src/hooks/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* CLI handler for
|
|
5
|
-
* Usage: npx
|
|
4
|
+
* CLI handler for ruv-swarm hooks
|
|
5
|
+
* Usage: npx ruv-swarm hook <type> [options]
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { handleHook } from './index.js';
|
package/src/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Claude Code Hooks Implementation for
|
|
2
|
+
* Claude Code Hooks Implementation for ruv-swarm
|
|
3
3
|
* Provides automated coordination, formatting, and learning capabilities
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -480,7 +480,7 @@ class RuvSwarmHooks {
|
|
|
480
480
|
|
|
481
481
|
// Persist configuration
|
|
482
482
|
if (persistConfig) {
|
|
483
|
-
const configDir = path.join(process.cwd(), '
|
|
483
|
+
const configDir = path.join(process.cwd(), '.ruv-swarm');
|
|
484
484
|
await fs.mkdir(configDir, { recursive: true });
|
|
485
485
|
await fs.writeFile(
|
|
486
486
|
path.join(configDir, 'swarm-config.json'),
|
|
@@ -523,7 +523,7 @@ class RuvSwarmHooks {
|
|
|
523
523
|
this.sessionData.agents.set(agentId, agent);
|
|
524
524
|
|
|
525
525
|
// Persist roster
|
|
526
|
-
const rosterPath = path.join(process.cwd(), '
|
|
526
|
+
const rosterPath = path.join(process.cwd(), '.ruv-swarm', 'agent-roster.json');
|
|
527
527
|
const roster = Array.from(this.sessionData.agents.values());
|
|
528
528
|
await fs.writeFile(rosterPath, JSON.stringify(roster, null, 2));
|
|
529
529
|
}
|
|
@@ -612,7 +612,7 @@ class RuvSwarmHooks {
|
|
|
612
612
|
|
|
613
613
|
// Save neural weights
|
|
614
614
|
if (saveWeights) {
|
|
615
|
-
const weightsDir = path.join(process.cwd(), '
|
|
615
|
+
const weightsDir = path.join(process.cwd(), '.ruv-swarm', 'neural-weights');
|
|
616
616
|
await fs.mkdir(weightsDir, { recursive: true });
|
|
617
617
|
|
|
618
618
|
const weightData = {
|
|
@@ -662,7 +662,7 @@ class RuvSwarmHooks {
|
|
|
662
662
|
// Generate detailed report
|
|
663
663
|
let reportPath = null;
|
|
664
664
|
if (generateReport) {
|
|
665
|
-
const reportDir = path.join(process.cwd(), '
|
|
665
|
+
const reportDir = path.join(process.cwd(), '.ruv-swarm', 'agent-reports');
|
|
666
666
|
await fs.mkdir(reportDir, { recursive: true });
|
|
667
667
|
|
|
668
668
|
const sanitizedAgent = agentName.replace(/[^a-zA-Z0-9-]/g, '-').toLowerCase();
|
|
@@ -702,7 +702,7 @@ ${this.getModifiedFilesList()}
|
|
|
702
702
|
${this.sessionData.learnings.length > 0 ? this.sessionData.learnings.map(l => `- ${l.type || 'General'}: ${l.description || JSON.stringify(l)}`).join('\n') : 'No specific learnings captured'}
|
|
703
703
|
|
|
704
704
|
---
|
|
705
|
-
*Generated by
|
|
705
|
+
*Generated by ruv-swarm agent coordination system*
|
|
706
706
|
`;
|
|
707
707
|
|
|
708
708
|
await fs.writeFile(reportPath, report);
|
|
@@ -739,7 +739,7 @@ ${this.extractBulletPoints(output)}
|
|
|
739
739
|
- Efficiency: ${this.calculateEfficiency({ completionTime: Date.now() - this.sessionData.startTime }).rating}
|
|
740
740
|
${reportPath ? `\n## Report\nDetailed report: ${path.relative(process.cwd(), reportPath)}` : ''}
|
|
741
741
|
|
|
742
|
-
🤖 Generated by
|
|
742
|
+
🤖 Generated by ruv-swarm agent coordination
|
|
743
743
|
Co-Authored-By: ${agentName} <agent@ruv-swarm.ai>`;
|
|
744
744
|
|
|
745
745
|
// Commit using heredoc to handle complex messages
|
|
@@ -888,7 +888,7 @@ EOF
|
|
|
888
888
|
};
|
|
889
889
|
|
|
890
890
|
try {
|
|
891
|
-
const sessionDir = path.join(process.cwd(), '
|
|
891
|
+
const sessionDir = path.join(process.cwd(), '.ruv-swarm');
|
|
892
892
|
|
|
893
893
|
// Load memory state
|
|
894
894
|
if (loadMemory) {
|
|
@@ -1005,7 +1005,7 @@ EOF
|
|
|
1005
1005
|
async checkSwarmStatus() {
|
|
1006
1006
|
try {
|
|
1007
1007
|
// Check if swarm is initialized via file or global state
|
|
1008
|
-
const statusFile = path.join(process.cwd(), '
|
|
1008
|
+
const statusFile = path.join(process.cwd(), '.ruv-swarm', 'status.json');
|
|
1009
1009
|
const exists = await fs.access(statusFile).then(() => true).catch(() => false);
|
|
1010
1010
|
|
|
1011
1011
|
if (exists) {
|
|
@@ -1140,7 +1140,7 @@ EOF
|
|
|
1140
1140
|
const duration = Date.now() - this.sessionData.startTime;
|
|
1141
1141
|
const agentList = Array.from(this.sessionData.agents.values());
|
|
1142
1142
|
|
|
1143
|
-
return `#
|
|
1143
|
+
return `# ruv-swarm Session Summary
|
|
1144
1144
|
Date: ${new Date().toISOString()}
|
|
1145
1145
|
Duration: ${this.formatDuration(duration)}
|
|
1146
1146
|
Token Reduction: ${this.sessionData.metrics.tokensSaved} tokens
|
|
@@ -1489,7 +1489,7 @@ ${this.sessionData.learnings.slice(-5).map(l =>
|
|
|
1489
1489
|
}
|
|
1490
1490
|
|
|
1491
1491
|
async updateKnowledgeBase(type, data) {
|
|
1492
|
-
const kbPath = path.join(process.cwd(), '
|
|
1492
|
+
const kbPath = path.join(process.cwd(), '.ruv-swarm', 'knowledge-base.json');
|
|
1493
1493
|
|
|
1494
1494
|
// Load existing knowledge base
|
|
1495
1495
|
let kb = {};
|
|
@@ -1573,7 +1573,7 @@ ${this.sessionData.learnings.slice(-5).map(l =>
|
|
|
1573
1573
|
|
|
1574
1574
|
async getSwarmStatus() {
|
|
1575
1575
|
try {
|
|
1576
|
-
const statusPath = path.join(process.cwd(), '
|
|
1576
|
+
const statusPath = path.join(process.cwd(), '.ruv-swarm', 'status.json');
|
|
1577
1577
|
if (await fs.access(statusPath).then(() => true).catch(() => false)) {
|
|
1578
1578
|
return JSON.parse(await fs.readFile(statusPath, 'utf-8'));
|
|
1579
1579
|
}
|
|
@@ -1593,7 +1593,7 @@ ${this.sessionData.learnings.slice(-5).map(l =>
|
|
|
1593
1593
|
sendTelemetry(event, data) {
|
|
1594
1594
|
// In production, this would send to telemetry service
|
|
1595
1595
|
// For now, just log to telemetry file
|
|
1596
|
-
const telemetryPath = path.join(process.cwd(), '
|
|
1596
|
+
const telemetryPath = path.join(process.cwd(), '.ruv-swarm', 'telemetry.jsonl');
|
|
1597
1597
|
|
|
1598
1598
|
const telemetryEvent = {
|
|
1599
1599
|
event,
|
package/src/index-enhanced.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TypeScript definitions for enhanced
|
|
2
|
+
* TypeScript definitions for enhanced ruv-swarm NPX package
|
|
3
3
|
* Complete WASM integration with neural networks and forecasting
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
declare module '
|
|
6
|
+
declare module 'ruv-swarm' {
|
|
7
7
|
// Main RuvSwarm class
|
|
8
8
|
export class RuvSwarm {
|
|
9
9
|
constructor();
|