claude-flow 2.7.41 → 2.7.42

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/claude-flow CHANGED
@@ -2,7 +2,7 @@
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
  # Enhanced with NPX cache error handling and retry logic
4
4
 
5
- VERSION="2.7.41"
5
+ VERSION="2.7.42"
6
6
 
7
7
  # Determine the correct path based on how the script is invoked
8
8
  if [ -L "$0" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.7.41",
3
+ "version": "2.7.42",
4
4
  "description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": "cli.mjs",
@@ -32,15 +32,26 @@ let sqliteAvailable = false;
32
32
  async function loadSqlite() {
33
33
  if (Database !== null) return sqliteAvailable;
34
34
  try {
35
- const sqlite = await import('better-sqlite3');
36
- Database = sqlite.default;
35
+ // Try createRequire first for CommonJS modules (better-sqlite3 is CommonJS)
36
+ const { createRequire } = await import('module');
37
+ const require = createRequire(import.meta.url);
38
+ Database = require('better-sqlite3');
37
39
  // Test if bindings work by creating a temp in-memory database
38
40
  const testDb = new Database(':memory:');
39
41
  testDb.close();
40
42
  sqliteAvailable = true;
41
- } catch (err) {
42
- sqliteAvailable = false;
43
- Database = null;
43
+ } catch (requireErr) {
44
+ // Fallback to dynamic import if createRequire fails
45
+ try {
46
+ const sqlite = await import('better-sqlite3');
47
+ Database = sqlite.default || sqlite;
48
+ const testDb = new Database(':memory:');
49
+ testDb.close();
50
+ sqliteAvailable = true;
51
+ } catch (err) {
52
+ sqliteAvailable = false;
53
+ Database = null;
54
+ }
44
55
  }
45
56
  return sqliteAvailable;
46
57
  }
@@ -516,6 +527,16 @@ async function spawnSwarmWizard() {
516
527
  * Spawn a hive mind swarm
517
528
  */
518
529
  async function spawnSwarm(args, flags) {
530
+ // Load SQLite before using Database constructor
531
+ const hasSqlite = await loadSqlite();
532
+ if (!hasSqlite) {
533
+ console.error(chalk.red('Error: SQLite is required for hive-mind spawn'));
534
+ console.log(chalk.yellow('Please ensure better-sqlite3 is properly installed:'));
535
+ console.log(chalk.gray(' npm install better-sqlite3'));
536
+ console.log(chalk.gray(' # or for ARM64/M1: npm rebuild better-sqlite3'));
537
+ return;
538
+ }
539
+
519
540
  const objective = args.join(' ').trim();
520
541
 
521
542
  // Check for non-interactive mode FIRST
@@ -1167,6 +1188,12 @@ async function showStatus(flags) {
1167
1188
  * Show consensus decisions
1168
1189
  */
1169
1190
  async function showConsensus(flags) {
1191
+ // Load SQLite before using Database constructor
1192
+ const hasSqlite = await loadSqlite();
1193
+ if (!hasSqlite) {
1194
+ console.error(chalk.red('Error: SQLite is required for this command'));
1195
+ return;
1196
+ }
1170
1197
  try {
1171
1198
  const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
1172
1199
  const db = new Database(dbPath);
@@ -1261,6 +1288,12 @@ async function showConsensus(flags) {
1261
1288
  * Show performance metrics
1262
1289
  */
1263
1290
  async function showMetrics(flags) {
1291
+ // Load SQLite before using Database constructor
1292
+ const hasSqlite = await loadSqlite();
1293
+ if (!hasSqlite) {
1294
+ console.error(chalk.red('Error: SQLite is required for this command'));
1295
+ return;
1296
+ }
1264
1297
  try {
1265
1298
  const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
1266
1299
  const db = new Database(dbPath);
@@ -1722,6 +1755,12 @@ export async function hiveMindCommand(args, flags) {
1722
1755
  * List all memories in the collective memory store
1723
1756
  */
1724
1757
  async function listMemories() {
1758
+ // Load SQLite before using Database constructor
1759
+ const hasSqlite = await loadSqlite();
1760
+ if (!hasSqlite) {
1761
+ console.error(chalk.red('Error: SQLite is required for this command'));
1762
+ return;
1763
+ }
1725
1764
  try {
1726
1765
  console.log(chalk.blue('\nšŸ“‹ Collective Memory Store\n'));
1727
1766
 
@@ -1791,6 +1830,12 @@ async function listMemories() {
1791
1830
  * Search memories by keyword
1792
1831
  */
1793
1832
  async function searchMemories() {
1833
+ // Load SQLite before using Database constructor
1834
+ const hasSqlite = await loadSqlite();
1835
+ if (!hasSqlite) {
1836
+ console.error(chalk.red('Error: SQLite is required for this command'));
1837
+ return;
1838
+ }
1794
1839
  try {
1795
1840
  const { searchTerm } = await inquirer.prompt([
1796
1841
  {