claude-flow 2.0.0-alpha.7 ā 2.0.0-alpha.9
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/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
5
|
[](https://github.com/ruvnet/claude-code-flow)
|
|
6
|
-
[](https://www.npmjs.com/package/claude-flow)
|
|
7
7
|
[](https://github.com/ruvnet/claude-code-flow)
|
|
8
8
|
[](https://github.com/ruvnet/ruv-FANN)
|
|
9
9
|
[](https://github.com/ruvnet/claude-code-flow)
|
|
@@ -50,7 +50,7 @@ Instead of promising "AI magic," Claude Flow delivers practical improvements:
|
|
|
50
50
|
|
|
51
51
|
---
|
|
52
52
|
|
|
53
|
-
## š **What's New in v2.0.0-alpha.
|
|
53
|
+
## š **What's New in v2.0.0-alpha.8**
|
|
54
54
|
|
|
55
55
|
### š **Automatic MCP Setup (NEW!)**
|
|
56
56
|
- **Smart Detection** - Automatically detects Claude Code CLI installation
|
package/package.json
CHANGED
|
@@ -348,7 +348,9 @@ export class HiveMindCore extends EventEmitter {
|
|
|
348
348
|
* Create and distribute task with performance optimization
|
|
349
349
|
*/
|
|
350
350
|
async createTask(description, priority = 5, metadata = {}) {
|
|
351
|
-
const
|
|
351
|
+
const timestamp = Date.now();
|
|
352
|
+
const randomPart = Math.random().toString(36).substring(2, 11); // Use substring instead of substr
|
|
353
|
+
const taskId = `task-${timestamp}-${randomPart}`;
|
|
352
354
|
const createdAt = Date.now();
|
|
353
355
|
|
|
354
356
|
const task = {
|
|
@@ -384,7 +384,26 @@ async function spawnSwarm(args, flags) {
|
|
|
384
384
|
mkdirSync(dbDir, { recursive: true });
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
|
|
387
|
+
// Check if database file exists and try to create a clean one if needed
|
|
388
|
+
let db;
|
|
389
|
+
try {
|
|
390
|
+
db = new Database(dbPath);
|
|
391
|
+
// Test the database with a simple query
|
|
392
|
+
db.prepare('SELECT 1').get();
|
|
393
|
+
} catch (error) {
|
|
394
|
+
console.warn('Database issue detected, recreating...', error.message);
|
|
395
|
+
// Remove corrupted database
|
|
396
|
+
if (existsSync(dbPath)) {
|
|
397
|
+
try {
|
|
398
|
+
const fs = await import('fs');
|
|
399
|
+
fs.unlinkSync(dbPath);
|
|
400
|
+
} catch (e) {
|
|
401
|
+
console.warn('Could not remove corrupted database:', e.message);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Create new database
|
|
405
|
+
db = new Database(dbPath);
|
|
406
|
+
}
|
|
388
407
|
|
|
389
408
|
// Initialize database schema if not exists
|
|
390
409
|
db.exec(`
|
|
@@ -422,8 +441,10 @@ async function spawnSwarm(args, flags) {
|
|
|
422
441
|
);
|
|
423
442
|
`);
|
|
424
443
|
|
|
425
|
-
// Create swarm record
|
|
426
|
-
const
|
|
444
|
+
// Create swarm record with safe ID generation
|
|
445
|
+
const timestamp = Date.now();
|
|
446
|
+
const randomPart = Math.random().toString(36).substring(2, 11); // Use substring instead of substr
|
|
447
|
+
const swarmId = `swarm-${timestamp}-${randomPart}`;
|
|
427
448
|
db.prepare(`
|
|
428
449
|
INSERT INTO swarms (id, name, objective, queen_type)
|
|
429
450
|
VALUES (?, ?, ?, ?)
|
|
@@ -116,7 +116,7 @@ export async function initCommand(subArgs, flags) {
|
|
|
116
116
|
// Default to enhanced Claude Flow v2 init
|
|
117
117
|
// Use --basic flag for old behavior
|
|
118
118
|
if (!flags.basic && !flags.minimal && !flags.sparc) {
|
|
119
|
-
return await enhancedClaudeFlowInit(flags);
|
|
119
|
+
return await enhancedClaudeFlowInit(flags, subArgs);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// Check for validation and rollback commands
|
|
@@ -494,17 +494,17 @@ export async function initCommand(subArgs, flags) {
|
|
|
494
494
|
console.log(' ⢠Monitor performance with real-time metrics');
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
// Check for Claude Code and set up MCP servers
|
|
498
|
-
if (!
|
|
497
|
+
// Check for Claude Code and set up MCP servers (always enabled by default)
|
|
498
|
+
if (!dryRun && isClaudeCodeInstalled()) {
|
|
499
499
|
console.log('\nš Claude Code CLI detected!');
|
|
500
|
-
const
|
|
500
|
+
const skipMcp = args && args.includes && args.includes('--skip-mcp');
|
|
501
501
|
|
|
502
|
-
if (
|
|
503
|
-
await setupMcpServers(
|
|
502
|
+
if (!skipMcp) {
|
|
503
|
+
await setupMcpServers(dryRun);
|
|
504
504
|
} else {
|
|
505
505
|
console.log(' ā¹ļø Skipping MCP setup (--skip-mcp flag used)');
|
|
506
506
|
}
|
|
507
|
-
} else if (!
|
|
507
|
+
} else if (!dryRun && !isClaudeCodeInstalled()) {
|
|
508
508
|
console.log('\nā ļø Claude Code CLI not detected!');
|
|
509
509
|
console.log(' š„ Install with: npm install -g @anthropics/claude-code');
|
|
510
510
|
console.log(' š Then add MCP servers manually with:');
|
|
@@ -591,6 +591,10 @@ async function handleBatchInit(subArgs, flags) {
|
|
|
591
591
|
async function enhancedInitCommand(subArgs, flags) {
|
|
592
592
|
console.log('š”ļø Starting enhanced initialization with validation and rollback...');
|
|
593
593
|
|
|
594
|
+
// Store parameters to avoid scope issues in async context
|
|
595
|
+
const args = subArgs || [];
|
|
596
|
+
const options = flags || {};
|
|
597
|
+
|
|
594
598
|
// Get the working directory
|
|
595
599
|
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
596
600
|
|
|
@@ -602,19 +606,19 @@ async function enhancedInitCommand(subArgs, flags) {
|
|
|
602
606
|
|
|
603
607
|
try {
|
|
604
608
|
// Parse options
|
|
605
|
-
const
|
|
606
|
-
force:
|
|
607
|
-
minimal:
|
|
608
|
-
sparc:
|
|
609
|
-
skipPreValidation:
|
|
610
|
-
skipBackup:
|
|
611
|
-
validateOnly:
|
|
609
|
+
const initOptions = {
|
|
610
|
+
force: args.includes('--force') || args.includes('-f') || options.force,
|
|
611
|
+
minimal: args.includes('--minimal') || args.includes('-m') || options.minimal,
|
|
612
|
+
sparc: args.includes('--sparc') || args.includes('-s') || options.sparc,
|
|
613
|
+
skipPreValidation: args.includes('--skip-pre-validation'),
|
|
614
|
+
skipBackup: args.includes('--skip-backup'),
|
|
615
|
+
validateOnly: args.includes('--validate-only')
|
|
612
616
|
};
|
|
613
617
|
|
|
614
618
|
// Phase 1: Pre-initialization validation
|
|
615
|
-
if (!
|
|
619
|
+
if (!initOptions.skipPreValidation) {
|
|
616
620
|
console.log('\nš Phase 1: Pre-initialization validation...');
|
|
617
|
-
const preValidation = await validationSystem.validatePreInit(
|
|
621
|
+
const preValidation = await validationSystem.validatePreInit(initOptions);
|
|
618
622
|
|
|
619
623
|
if (!preValidation.success) {
|
|
620
624
|
printError('Pre-initialization validation failed:');
|
|
@@ -945,13 +949,17 @@ async function setupCoordinationSystem(workingDir) {
|
|
|
945
949
|
/**
|
|
946
950
|
* Enhanced Claude Flow v2.0.0 initialization
|
|
947
951
|
*/
|
|
948
|
-
async function enhancedClaudeFlowInit(flags) {
|
|
952
|
+
async function enhancedClaudeFlowInit(flags, subArgs = []) {
|
|
949
953
|
console.log('š Initializing Claude Flow v2.0.0 with enhanced features...');
|
|
950
954
|
|
|
951
955
|
const workingDir = process.cwd();
|
|
952
956
|
const force = flags.force || flags.f;
|
|
953
957
|
const dryRun = flags.dryRun || flags['dry-run'] || flags.d;
|
|
954
958
|
|
|
959
|
+
// Store parameters to avoid scope issues in async context
|
|
960
|
+
const args = subArgs || [];
|
|
961
|
+
const options = flags || {};
|
|
962
|
+
|
|
955
963
|
// Import fs module for Node.js
|
|
956
964
|
const fs = await import('fs/promises');
|
|
957
965
|
const { chmod } = fs;
|
|
@@ -1099,15 +1107,15 @@ ${commands.map(cmd => `- [${cmd}](./${cmd}.md)`).join('\n')}
|
|
|
1099
1107
|
printSuccess('ā Initialized memory system');
|
|
1100
1108
|
}
|
|
1101
1109
|
|
|
1102
|
-
// Check for Claude Code and set up MCP servers
|
|
1110
|
+
// Check for Claude Code and set up MCP servers (always enabled by default)
|
|
1103
1111
|
if (!dryRun && isClaudeCodeInstalled()) {
|
|
1104
1112
|
console.log('\nš Claude Code CLI detected!');
|
|
1105
|
-
const
|
|
1113
|
+
const skipMcp = (options && options['skip-mcp']) || (args && args.includes && args.includes('--skip-mcp'));
|
|
1106
1114
|
|
|
1107
|
-
if (
|
|
1115
|
+
if (!skipMcp) {
|
|
1108
1116
|
await setupMcpServers(dryRun);
|
|
1109
1117
|
} else {
|
|
1110
|
-
console.log(' ā¹ļø Skipping MCP setup (
|
|
1118
|
+
console.log(' ā¹ļø Skipping MCP setup (--skip-mcp flag used)');
|
|
1111
1119
|
console.log('\n š To add MCP servers manually:');
|
|
1112
1120
|
console.log(' claude mcp add claude-flow claude-flow mcp start');
|
|
1113
1121
|
console.log(' claude mcp add ruv-swarm npx ruv-swarm mcp start');
|