claude-flow 2.0.0-alpha.65 → 2.0.0-alpha.66

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/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.0-alpha.66] - 2025-01-20
9
+
10
+ ### 🔧 Bug Fixes
11
+ - **Hooks Command**: Fixed "command.toLowerCase is not a function" error in hooks pre-command
12
+ - **ARM64 Support**: Improved ARM64 compatibility for better-sqlite3 on macOS (#378)
13
+ - Added type checking for command parameter in hooks to handle empty/missing values
14
+ - Enhanced postinstall script with ARM64 detection and automatic rebuild
15
+
16
+ ### 🚀 New Features
17
+ - Automatic SQLite binding verification and rebuild for Apple Silicon Macs
18
+ - Graceful fallback to in-memory storage if SQLite bindings fail
19
+ - Better error handling and user feedback during installation
20
+
21
+ ### 🏗️ Infrastructure
22
+ - Added `node20-macos-arm64` target to pkg configuration
23
+ - Improved boolean parameter parsing in hooks commands
24
+ - Enhanced platform detection for ARM64 architecture
25
+
26
+ ### 📚 Documentation
27
+ - Added ARM64 troubleshooting guide
28
+ - Updated hooks command usage examples
29
+
8
30
  ## [2.0.0-alpha.65] - 2025-01-20
9
31
 
10
32
  ### 🔧 Bug Fixes
package/bin/claude-flow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
 
4
- VERSION="2.0.0-alpha.65"
4
+ VERSION="2.0.0-alpha.66"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.0.0-alpha.65",
3
+ "version": "2.0.0-alpha.66",
4
4
  "description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)",
5
5
  "main": "cli.mjs",
6
6
  "bin": {
@@ -45,7 +45,7 @@
45
45
  "format": "prettier --write 'src/**/*.{ts,js,json}'",
46
46
  "diagnostics": "node -e \"import('./dist/monitoring/diagnostics.js').then(m => m.DiagnosticManager.quickDiagnostic().then(console.log))\"",
47
47
  "health-check": "node -e \"import('./dist/monitoring/health-check.js').then(m => new m.HealthCheckManager().performHealthCheck().then(console.log))\"",
48
- "postinstall": "node scripts/install.js",
48
+ "postinstall": "node scripts/install.js && node scripts/install-arm64.js",
49
49
  "prepublishOnly": "npm run update-version",
50
50
  "publish:alpha": "npm publish --tag alpha",
51
51
  "publish:major": "npm version major && npm publish",
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ import os from 'node:os';
4
+ import { spawn } from 'node:child_process';
5
+
6
+ // Check if SQLite bindings are working
7
+ async function checkSqliteBindings() {
8
+ try {
9
+ const Database = await import('better-sqlite3');
10
+ const db = new Database.default(':memory:');
11
+ db.close();
12
+ return true;
13
+ } catch (error) {
14
+ return false;
15
+ }
16
+ }
17
+
18
+ // Attempt to rebuild better-sqlite3 for ARM64
19
+ async function rebuildSqlite() {
20
+ console.log('🔧 Rebuilding better-sqlite3 for ARM64...');
21
+
22
+ return new Promise((resolve) => {
23
+ const rebuild = spawn('npm', ['rebuild', 'better-sqlite3'], {
24
+ stdio: 'inherit',
25
+ shell: true
26
+ });
27
+
28
+ rebuild.on('close', (code) => {
29
+ if (code === 0) {
30
+ console.log('✅ Successfully rebuilt better-sqlite3 for ARM64');
31
+ resolve(true);
32
+ } else {
33
+ console.log('⚠️ Failed to rebuild better-sqlite3');
34
+ resolve(false);
35
+ }
36
+ });
37
+
38
+ rebuild.on('error', () => {
39
+ console.log('⚠️ Failed to rebuild better-sqlite3');
40
+ resolve(false);
41
+ });
42
+ });
43
+ }
44
+
45
+ // Main installation logic
46
+ async function main() {
47
+ const platform = os.platform();
48
+ const arch = os.arch();
49
+
50
+ // Only run on ARM64 macOS
51
+ if (platform === 'darwin' && arch === 'arm64') {
52
+ console.log('🍎 Detected Apple Silicon (ARM64) Mac');
53
+
54
+ const bindingsWork = await checkSqliteBindings();
55
+
56
+ if (!bindingsWork) {
57
+ console.log('⚠️ SQLite bindings not working for ARM64');
58
+ const rebuildSuccess = await rebuildSqlite();
59
+
60
+ if (!rebuildSuccess) {
61
+ console.log('');
62
+ console.log('⚠️ Unable to rebuild SQLite bindings for ARM64');
63
+ console.log('📝 Claude-Flow will fall back to in-memory storage');
64
+ console.log('');
65
+ console.log('To fix this issue, you can try:');
66
+ console.log('1. Install Xcode Command Line Tools: xcode-select --install');
67
+ console.log('2. Manually rebuild: cd node_modules/better-sqlite3 && npm run build-release');
68
+ console.log('3. Use Rosetta 2: arch -x86_64 npm install');
69
+ console.log('');
70
+ }
71
+ } else {
72
+ console.log('✅ SQLite bindings are working correctly');
73
+ }
74
+ }
75
+ }
76
+
77
+ // Run the installation enhancement
78
+ main().catch(console.error);
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { HelpFormatter } from './help-formatter.js';
7
7
 
8
- export const VERSION = '2.0.0-alpha.65';
8
+ export const VERSION = '2.0.0-alpha.66';
9
9
 
10
10
  export const MAIN_HELP = `
11
11
  🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
@@ -27,7 +27,7 @@ import process from 'process';
27
27
  import readline from 'readline';
28
28
  import { getMainHelp, getCommandHelp, getStandardizedCommandHelp } from './help-text.js';
29
29
 
30
- const VERSION = '2.0.0-alpha.65';
30
+ const VERSION = '2.0.0-alpha.66';
31
31
 
32
32
  function printHelp(plain = false) {
33
33
  console.log(getMainHelp(plain));
@@ -297,10 +297,10 @@ async function preEditCommand(subArgs, flags) {
297
297
 
298
298
  async function preBashCommand(subArgs, flags) {
299
299
  const options = flags;
300
- const command = options.command || subArgs.slice(1).join(' ');
300
+ const command = options.command || subArgs.slice(1).join(' ') || '';
301
301
  const workingDir = options.cwd || process.cwd();
302
- const validateSafety = options['validate-safety'] || options.validate || false;
303
- const prepareResources = options['prepare-resources'] || false;
302
+ const validateSafety = options['validate-safety'] === true || options['validate-safety'] === 'true' || options.validate === true || options.validate === 'true' || false;
303
+ const prepareResources = options['prepare-resources'] === true || options['prepare-resources'] === 'true' || false;
304
304
 
305
305
  console.log(`🔧 Executing pre-bash hook...`);
306
306
  console.log(`📜 Command: ${command}`);
@@ -328,9 +328,11 @@ async function preBashCommand(subArgs, flags) {
328
328
  'chmod 777',
329
329
  ];
330
330
 
331
- const isDangerous = dangerousCommands.some((dangerous) =>
332
- command.toLowerCase().includes(dangerous.toLowerCase()),
333
- );
331
+ const isDangerous = command && typeof command === 'string' && command.length > 0
332
+ ? dangerousCommands.some((dangerous) =>
333
+ command.toLowerCase().includes(dangerous.toLowerCase()),
334
+ )
335
+ : false;
334
336
 
335
337
  safetyResult = isDangerous ? 'dangerous' : 'safe';
336
338