diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f80a3a903..54e0240a45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,46 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.0-alpha.66] - 2025-01-20 + +### 🔧 Bug Fixes +- **Hooks Command**: Fixed "command.toLowerCase is not a function" error in hooks pre-command +- **ARM64 Support**: Improved ARM64 compatibility for better-sqlite3 on macOS (#378) +- Added type checking for command parameter in hooks to handle empty/missing values +- Enhanced postinstall script with ARM64 detection and automatic rebuild + +### 🚀 New Features +- Automatic SQLite binding verification and rebuild for Apple Silicon Macs +- Graceful fallback to in-memory storage if SQLite bindings fail +- Better error handling and user feedback during installation + +### 🏗️ Infrastructure +- Added `node20-macos-arm64` target to pkg configuration +- Improved boolean parameter parsing in hooks commands +- Enhanced platform detection for ARM64 architecture + +### 📚 Documentation +- Added ARM64 troubleshooting guide +- Updated hooks command usage examples + +## [2.0.0-alpha.65] - 2025-01-20 + +### 🔧 Bug Fixes +- **CRITICAL**: Fixed "table agents has no column named role" error in hive-mind wizard (#403) +- Added missing `role` column to agents table schema in init/index.js +- Fixed TypeScript build errors preventing compilation +- Resolved ILogger interface issues and async/await problems +- Fixed missing type definitions in multiple modules + +### 🏗️ Infrastructure +- **Database Schema**: Synchronized agents table schema across all modules +- **Build System**: Fixed critical TypeScript compilation errors +- **Type Safety**: Added proper type annotations throughout codebase + +### 📚 Documentation +- Added migration instructions for existing databases +- Updated test suite with schema validation tests + ## [2.0.0-alpha.64] - 2025-01-18 ### 🔧 Bug Fixes diff --git a/NPM_PUBLISH_ALPHA_66.sh b/NPM_PUBLISH_ALPHA_66.sh new file mode 100644 index 0000000000..188cf9a4bc --- /dev/null +++ b/NPM_PUBLISH_ALPHA_66.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Script to publish alpha.66 to npm + +echo "Publishing claude-flow v2.0.0-alpha.66 to npm..." + +# Ensure we're in the right directory +cd /workspaces/claude-code-flow + +# Update npm version +npm version 2.0.0-alpha.66 --allow-same-version + +# Run prepublishOnly script +npm run update-version + +# Publish with alpha tag +npm publish --tag alpha --access public + +# Verify publication +echo "Verifying publication..." +npm view claude-flow@alpha version + +echo "Done! Alpha.66 should now be available." \ No newline at end of file diff --git a/PUBLISH_ALPHA_66.md b/PUBLISH_ALPHA_66.md new file mode 100644 index 0000000000..cb6ae7eed6 --- /dev/null +++ b/PUBLISH_ALPHA_66.md @@ -0,0 +1,73 @@ +# Alpha.66 Release Instructions + +## Changes Included + +### 1. Hooks Command Fix +- Fixed "command.toLowerCase is not a function" error +- Added type checking for command parameter +- Improved boolean parameter parsing + +### 2. ARM64 macOS Support (#378) +- Added automatic SQLite binding verification +- Enhanced postinstall script with ARM64 detection +- Graceful fallback to in-memory storage if bindings fail +- Added node20-macos-arm64 to pkg targets + +## Files Modified +1. `package.json` - Version updated to 2.0.0-alpha.66 +2. `CHANGELOG.md` - Added alpha.66 release notes +3. `src/cli/simple-commands/hooks.js` - Fixed toLowerCase error +4. `src/cli/help-text.js` - Updated version +5. `src/cli/simple-cli.js` - Updated version +6. `scripts/install-arm64.js` - Added ARM64 compatibility script + +## Publishing Steps + +```bash +# 1. Update version in bin +npm run update-version + +# 2. Commit changes +git add -A +git commit -m "chore: Release v2.0.0-alpha.66" + +# 3. Push to branch +git push origin alpha-66 + +# 4. Publish to npm +npm publish --tag alpha + +# 5. Verify publication +npm view claude-flow@alpha version +# Should show: 2.0.0-alpha.66 + +# 6. Test the fixes +npx claude-flow@alpha hooks pre-command --command "test" --validate-safety true +# Should work without toLowerCase error +``` + +## Testing + +### Test Hooks Fix: +```bash +# Test with empty command +npx claude-flow@alpha hooks pre-command --command "" --validate-safety true + +# Test with valid command +npx claude-flow@alpha hooks pre-command --command "echo test" --validate-safety true +``` + +### Test ARM64 Support: +On Apple Silicon Mac: +```bash +npm install -g claude-flow@alpha +# Should detect ARM64 and attempt to rebuild SQLite bindings +``` + +## GitHub Actions + +After publishing: +1. Create GitHub release v2.0.0-alpha.66 +2. Update issue #415 (alpha.66 planning) +3. Close PR #378 as merged +4. Create PR for alpha-66 branch \ No newline at end of file diff --git a/bin/claude-flow b/bin/claude-flow index f0592a612d..32b6962e24 100755 --- a/bin/claude-flow +++ b/bin/claude-flow @@ -1,7 +1,7 @@ #!/bin/sh # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime -VERSION="2.0.0-alpha.64" +VERSION="2.0.0-alpha.66" # Determine the correct path based on how the script is invoked if [ -L "$0" ]; then diff --git a/package.json b/package.json index 27748e709a..bc5087c3a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-flow", - "version": "2.0.0-alpha.64", + "version": "2.0.0-alpha.66", "description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)", "main": "cli.mjs", "bin": { @@ -45,7 +45,7 @@ "format": "prettier --write 'src/**/*.{ts,js,json}'", "diagnostics": "node -e \"import('./dist/monitoring/diagnostics.js').then(m => m.DiagnosticManager.quickDiagnostic().then(console.log))\"", "health-check": "node -e \"import('./dist/monitoring/health-check.js').then(m => new m.HealthCheckManager().performHealthCheck().then(console.log))\"", - "postinstall": "node scripts/install.js", + "postinstall": "node scripts/install.js && node scripts/install-arm64.js", "prepublishOnly": "npm run update-version", "publish:alpha": "npm publish --tag alpha", "publish:major": "npm version major && npm publish", diff --git a/scripts/install-arm64.js b/scripts/install-arm64.js new file mode 100644 index 0000000000..3f17fbe61d --- /dev/null +++ b/scripts/install-arm64.js @@ -0,0 +1,78 @@ +#!/usr/bin/env node + +import os from 'node:os'; +import { spawn } from 'node:child_process'; + +// Check if SQLite bindings are working +async function checkSqliteBindings() { + try { + const Database = await import('better-sqlite3'); + const db = new Database.default(':memory:'); + db.close(); + return true; + } catch (error) { + return false; + } +} + +// Attempt to rebuild better-sqlite3 for ARM64 +async function rebuildSqlite() { + console.log('🔧 Rebuilding better-sqlite3 for ARM64...'); + + return new Promise((resolve) => { + const rebuild = spawn('npm', ['rebuild', 'better-sqlite3'], { + stdio: 'inherit', + shell: true + }); + + rebuild.on('close', (code) => { + if (code === 0) { + console.log('✅ Successfully rebuilt better-sqlite3 for ARM64'); + resolve(true); + } else { + console.log('⚠️ Failed to rebuild better-sqlite3'); + resolve(false); + } + }); + + rebuild.on('error', () => { + console.log('⚠️ Failed to rebuild better-sqlite3'); + resolve(false); + }); + }); +} + +// Main installation logic +async function main() { + const platform = os.platform(); + const arch = os.arch(); + + // Only run on ARM64 macOS + if (platform === 'darwin' && arch === 'arm64') { + console.log('🍎 Detected Apple Silicon (ARM64) Mac'); + + const bindingsWork = await checkSqliteBindings(); + + if (!bindingsWork) { + console.log('⚠️ SQLite bindings not working for ARM64'); + const rebuildSuccess = await rebuildSqlite(); + + if (!rebuildSuccess) { + console.log(''); + console.log('⚠️ Unable to rebuild SQLite bindings for ARM64'); + console.log('📝 Claude-Flow will fall back to in-memory storage'); + console.log(''); + console.log('To fix this issue, you can try:'); + console.log('1. Install Xcode Command Line Tools: xcode-select --install'); + console.log('2. Manually rebuild: cd node_modules/better-sqlite3 && npm run build-release'); + console.log('3. Use Rosetta 2: arch -x86_64 npm install'); + console.log(''); + } + } else { + console.log('✅ SQLite bindings are working correctly'); + } + } +} + +// Run the installation enhancement +main().catch(console.error); \ No newline at end of file diff --git a/src/cli/commands/hive-mind/pause.ts b/src/cli/commands/hive-mind/pause.ts index 310394345b..0ebc10c65f 100644 --- a/src/cli/commands/hive-mind/pause.ts +++ b/src/cli/commands/hive-mind/pause.ts @@ -40,7 +40,7 @@ export const pauseCommand = new Command('pause') } console.log(chalk.cyan(`Pausing session ${sessionId}...`)); - const result = sessionManager.pauseSession(sessionId); + const result = await sessionManager.pauseSession(sessionId); if (result) { console.log(chalk.green(`✓ Session ${sessionId} paused successfully`)); @@ -50,9 +50,10 @@ export const pauseCommand = new Command('pause') } } else { // Interactive selection - const sessions = sessionManager.getActiveSessions().filter((s) => s.status === 'active'); + const sessions = await sessionManager.getActiveSessions(); + const activeSessions = sessions.filter((s: any) => s.status === 'active'); - if (sessions.length === 0) { + if (activeSessions.length === 0) { console.log(chalk.yellow('No active sessions found to pause')); return; } @@ -62,7 +63,7 @@ export const pauseCommand = new Command('pause') type: 'list', name: 'sessionId', message: 'Select session to pause:', - choices: sessions.map((s) => ({ + choices: activeSessions.map((s: any) => ({ name: `${s.swarm_name} (${s.id}) - ${s.completion_percentage}% complete`, value: s.id, })), @@ -70,7 +71,7 @@ export const pauseCommand = new Command('pause') ]); console.log(chalk.cyan(`Pausing session ${sessionId}...`)); - const result = sessionManager.pauseSession(sessionId); + const result = await sessionManager.pauseSession(sessionId); if (result) { console.log(chalk.green(`✓ Session paused successfully`)); diff --git a/src/cli/commands/hive-mind/ps.ts b/src/cli/commands/hive-mind/ps.ts index e059df87e6..28e46d2f71 100644 --- a/src/cli/commands/hive-mind/ps.ts +++ b/src/cli/commands/hive-mind/ps.ts @@ -22,7 +22,7 @@ export const psCommand = new Command('ps') ? sessionManager.getActiveSessionsWithProcessInfo() : sessionManager .getActiveSessionsWithProcessInfo() - .filter((s) => s.status === 'active' || s.status === 'paused'); + .filter((s: any) => s.status === 'active' || s.status === 'paused'); if (sessions.length === 0) { console.log(chalk.yellow('No sessions found')); @@ -108,9 +108,9 @@ export const psCommand = new Command('ps') } // Summary - const activeSessions = sessions.filter((s) => s.status === 'active').length; - const pausedSessions = sessions.filter((s) => s.status === 'paused').length; - const totalProcesses = sessions.reduce((sum, s) => sum + s.total_processes, 0); + const activeSessions = sessions.filter((s: any) => s.status === 'active').length; + const pausedSessions = sessions.filter((s: any) => s.status === 'paused').length; + const totalProcesses = sessions.reduce((sum: any, s: any) => sum + s.total_processes, 0); console.log('\n' + chalk.bold('Summary:')); console.log(chalk.gray(` Active sessions: ${activeSessions}`)); diff --git a/src/cli/commands/hive-mind/resume.ts b/src/cli/commands/hive-mind/resume.ts index 200a777e74..22532680bb 100644 --- a/src/cli/commands/hive-mind/resume.ts +++ b/src/cli/commands/hive-mind/resume.ts @@ -30,9 +30,10 @@ export const resumeCommand = new Command('resume') console.log(chalk.gray(`Progress: ${session.statistics.completionPercentage}%`)); } else { // Interactive selection - const sessions = sessionManager.getActiveSessions().filter((s) => s.status === 'paused'); + const sessions = await sessionManager.getActiveSessions(); + const pausedSessions = sessions.filter((s: any) => s.status === 'paused'); - if (sessions.length === 0) { + if (pausedSessions.length === 0) { console.log(chalk.yellow('No paused sessions found to resume')); return; } @@ -42,7 +43,7 @@ export const resumeCommand = new Command('resume') type: 'list', name: 'sessionId', message: 'Select session to resume:', - choices: sessions.map((s) => ({ + choices: pausedSessions.map((s: any) => ({ name: `${s.swarm_name} (${s.id}) - ${s.completion_percentage}% complete`, value: s.id, })), diff --git a/src/cli/commands/hive-mind/stop.ts b/src/cli/commands/hive-mind/stop.ts index bc6361bfda..cc2853ffca 100644 --- a/src/cli/commands/hive-mind/stop.ts +++ b/src/cli/commands/hive-mind/stop.ts @@ -99,7 +99,7 @@ export const stopCommand = new Command('stop') type: 'list', name: 'sessionId', message: 'Select session to stop:', - choices: sessions.map((s) => ({ + choices: sessions.map((s: any) => ({ name: `${s.swarm_name} (${s.id}) - ${s.total_processes} process(es)`, value: s.id, })), diff --git a/src/cli/help-text.js b/src/cli/help-text.js index 382d4e5eb6..4f6bcb6ac7 100644 --- a/src/cli/help-text.js +++ b/src/cli/help-text.js @@ -5,7 +5,7 @@ import { HelpFormatter } from './help-formatter.js'; -export const VERSION = '2.0.0-alpha.64'; +export const VERSION = '2.0.0-alpha.66'; export const MAIN_HELP = ` 🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform diff --git a/src/cli/repl.ts b/src/cli/repl.ts index fd4fdc83c8..58dcc59a46 100644 --- a/src/cli/repl.ts +++ b/src/cli/repl.ts @@ -378,11 +378,15 @@ export async function startREPL(options: any = {}): Promise { // Main REPL loop while (true) { try { - const prompt = createPrompt(context); - const input = await prompt.prompt({ - message: prompt, - suggestions: (input: string) => completer.complete(input), - }); + const promptString = createPrompt(context); + const { input } = await inquirer.prompt([ + { + type: 'input', + name: 'input', + message: promptString, + transformer: (input: string) => input, + }, + ]); if (!input.trim()) { continue; @@ -682,10 +686,14 @@ async function handleAgentSpawn(args: string[]): Promise { const type = args[0]; const name = args[1] || - (await prompt.prompt({ - message: 'Agent name:', - default: `${type}-agent`, - })); + (await inquirer.prompt([ + { + type: 'input', + name: 'name', + message: 'Agent name:', + default: `${type}-agent`, + }, + ])).name; console.log(chalk.yellow('Spawning agent...')); @@ -849,10 +857,14 @@ async function showTaskStatus(taskId: string): Promise { } async function handleTaskCancel(taskId: string): Promise { - const confirmed = await confirm.prompt({ - message: `Cancel task ${taskId}?`, - default: false, - }); + const { confirmed } = await inquirer.prompt([ + { + type: 'confirm', + name: 'confirmed', + message: `Cancel task ${taskId}?`, + default: false, + }, + ]); if (!confirmed) { console.log(chalk.gray('Cancellation cancelled')); @@ -957,10 +969,14 @@ async function handleSessionSave(args: string[]): Promise { const name = args.length > 0 ? args.join(' ') - : await prompt.prompt({ - message: 'Session name:', - default: `session-${new Date().toISOString().split('T')[0]}`, - }); + : (await inquirer.prompt([ + { + type: 'input', + name: 'name', + message: 'Session name:', + default: `session-${new Date().toISOString().split('T')[0]}`, + }, + ])).name; console.log(chalk.yellow('Saving session...')); await new Promise((resolve) => setTimeout(resolve, 1000)); @@ -972,10 +988,14 @@ async function handleSessionSave(args: string[]): Promise { } async function handleSessionRestore(sessionId: string): Promise { - const confirmed = await confirm.prompt({ - message: `Restore session ${sessionId}?`, - default: false, - }); + const { confirmed } = await inquirer.prompt([ + { + type: 'confirm', + name: 'confirmed', + message: `Restore session ${sessionId}?`, + default: false, + }, + ]); if (!confirmed) { console.log(chalk.gray('Restore cancelled')); @@ -1032,7 +1052,9 @@ async function showWorkflowList(): Promise { console.log(chalk.cyan.bold(`Workflows (${workflows.length})`)); console.log('─'.repeat(50)); - const table = new Table().header(['ID', 'Name', 'Status', 'Progress']).border(true); + const table = new Table({ + head: ['ID', 'Name', 'Status', 'Progress'], + }); for (const workflow of workflows) { const statusIcon = formatStatusIndicator(workflow.status); diff --git a/src/cli/simple-cli.js b/src/cli/simple-cli.js index 7c1b499c43..009fc83d0b 100644 --- a/src/cli/simple-cli.js +++ b/src/cli/simple-cli.js @@ -27,7 +27,7 @@ import process from 'process'; import readline from 'readline'; import { getMainHelp, getCommandHelp, getStandardizedCommandHelp } from './help-text.js'; -const VERSION = '2.0.0-alpha.64'; +const VERSION = '2.0.0-alpha.66'; function printHelp(plain = false) { console.log(getMainHelp(plain)); diff --git a/src/cli/simple-cli.ts b/src/cli/simple-cli.ts index 1b54d7950b..de01de31ed 100644 --- a/src/cli/simple-cli.ts +++ b/src/cli/simple-cli.ts @@ -232,7 +232,7 @@ async function main() { case 'spawn': // Convenience alias for agent spawn const spawnType = subArgs[0] || 'general'; - const spawnName = flags.name || `agent-${Date.now()}`; + const spawnName = (flags as any).name || `agent-${Date.now()}`; printSuccess(`Spawning ${spawnType} agent: ${spawnName}`); console.log('🤖 Agent would be created with the following configuration:'); @@ -2070,14 +2070,14 @@ async function startRepl() { console.log('Type "help" for available commands, "exit" to quit\n'); const replState = { - history: [], + history: [] as string[], historyIndex: -1, currentSession: null, context: { - agents: [], - tasks: [], - terminals: [], - memory: {}, + agents: [] as any[], + tasks: [] as any[], + terminals: [] as any[], + memory: {} as Record, }, }; @@ -2147,7 +2147,7 @@ Shortcuts: config: async (key: string) => { try { - const config = JSON.parse(await fs.readFile('claude-flow.config.json')); + const config = JSON.parse(await fs.readFile('claude-flow.config.json', 'utf-8')); if (key) { const keys = key.split('.'); let value = config; @@ -2220,8 +2220,8 @@ Shortcuts: const args = parts.slice(1); // Handle built-in REPL commands - if (replCommands[command]) { - await replCommands[command](...args); + if (command in replCommands) { + await (replCommands as any)[command](...args); return true; } @@ -3289,6 +3289,7 @@ For more information about SPARC methodology, see: https://github.com/ruvnet/cla `; } -if (import.meta.main) { +// Run main if executed directly +if (import.meta.url === `file://${process.argv[1]}`) { await main(); } diff --git a/src/cli/simple-commands/hooks.js b/src/cli/simple-commands/hooks.js index 7281069144..6698fd78d6 100644 --- a/src/cli/simple-commands/hooks.js +++ b/src/cli/simple-commands/hooks.js @@ -297,10 +297,10 @@ async function preEditCommand(subArgs, flags) { async function preBashCommand(subArgs, flags) { const options = flags; - const command = options.command || subArgs.slice(1).join(' '); + const command = options.command || subArgs.slice(1).join(' ') || ''; const workingDir = options.cwd || process.cwd(); - const validateSafety = options['validate-safety'] || options.validate || false; - const prepareResources = options['prepare-resources'] || false; + const validateSafety = options['validate-safety'] === true || options['validate-safety'] === 'true' || options.validate === true || options.validate === 'true' || false; + const prepareResources = options['prepare-resources'] === true || options['prepare-resources'] === 'true' || false; console.log(`🔧 Executing pre-bash hook...`); console.log(`📜 Command: ${command}`); @@ -328,9 +328,11 @@ async function preBashCommand(subArgs, flags) { 'chmod 777', ]; - const isDangerous = dangerousCommands.some((dangerous) => - command.toLowerCase().includes(dangerous.toLowerCase()), - ); + const isDangerous = command && typeof command === 'string' && command.length > 0 + ? dangerousCommands.some((dangerous) => + command.toLowerCase().includes(dangerous.toLowerCase()), + ) + : false; safetyResult = isDangerous ? 'dangerous' : 'safe'; diff --git a/src/cli/simple-orchestrator.ts b/src/cli/simple-orchestrator.ts index 6db26e6552..b1057d520b 100644 --- a/src/cli/simple-orchestrator.ts +++ b/src/cli/simple-orchestrator.ts @@ -476,7 +476,8 @@ function startWebUI(host: string, port: number) { app.post('/api/command', express.json(), (req, res) => { const { command } = req.body; if (!command) { - return res.status(400).json({ error: 'Command is required' }); + res.status(400).json({ error: 'Command is required' }); + return; } // Execute command and return immediately diff --git a/src/cli/ui/compatible-ui.ts b/src/cli/ui/compatible-ui.ts index f3338dd434..9cb247147d 100644 --- a/src/cli/ui/compatible-ui.ts +++ b/src/cli/ui/compatible-ui.ts @@ -90,7 +90,7 @@ export class CompatibleUI { case 'h': case 'help': case '?': - this.outputHelp(); + this.showHelp(); break; case 's': diff --git a/src/cli/ui/index.ts b/src/cli/ui/index.ts index 00eee464b5..2cef2086a7 100644 --- a/src/cli/ui/index.ts +++ b/src/cli/ui/index.ts @@ -24,7 +24,9 @@ export { * Main UI launcher that automatically selects the best available UI */ export async function launchBestUI(): Promise { - const { checkUISupport, launchUI, handleRawModeError } = await import('./fallback-handler.js'); + const fallbackHandler = await import('./fallback-handler.js'); + const { checkUISupport, handleRawModeError } = fallbackHandler; + const launchUI = (fallbackHandler as any).launchUI; const support = checkUISupport(); if (support.supported) { @@ -40,7 +42,7 @@ export async function launchBestUI(): Promise { } } } else { - const { launchUI: launchCompatibleUI } = await import('./compatible-ui.ts'); + const { launchUI: launchCompatibleUI } = await import('./compatible-ui.js'); console.log('🔄 Using compatible UI mode for this environment'); await launchCompatibleUI(); } diff --git a/src/cli/utils/environment-detector.ts b/src/cli/utils/environment-detector.ts index b72bbcdfa8..95217a8b71 100644 --- a/src/cli/utils/environment-detector.ts +++ b/src/cli/utils/environment-detector.ts @@ -223,10 +223,10 @@ function showEnvironmentWarnings(env: ExecutionEnvironment): void { export function applySmartDefaults>( options: T, env?: ExecutionEnvironment, -): T & { appliedDefaults: string[] } { +): T & { appliedDefaults: string[]; skipPermissions?: boolean; dangerouslySkipPermissions?: boolean; nonInteractive?: boolean; json?: boolean; noColor?: boolean; } { const environment = env || detectExecutionEnvironment({ skipWarnings: true }); const appliedDefaults: string[] = []; - const enhanced = { ...options, appliedDefaults }; + const enhanced = { ...options, appliedDefaults } as T & { appliedDefaults: string[]; skipPermissions?: boolean; dangerouslySkipPermissions?: boolean; nonInteractive?: boolean; json?: boolean; noColor?: boolean; }; // Apply defaults based on environment if ( diff --git a/src/core/logger.ts b/src/core/logger.ts index 33e2f246bf..25ef674d07 100644 --- a/src/core/logger.ts +++ b/src/core/logger.ts @@ -15,6 +15,7 @@ export interface ILogger { warn(message: string, meta?: unknown): void; error(message: string, error?: unknown): void; configure(config: LoggingConfig): Promise; + level?: string; } export enum LogLevel { @@ -45,6 +46,10 @@ export class Logger implements ILogger { private currentFileIndex = 0; private isClosing = false; + get level(): string { + return this.config.level; + } + constructor( config: LoggingConfig = { level: 'info', diff --git a/test-alpha-63/.claude/commands/analysis/README.md b/test-alpha-63/.claude/commands/analysis/README.md deleted file mode 100644 index 1eb295c1a8..0000000000 --- a/test-alpha-63/.claude/commands/analysis/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Analysis Commands - -Commands for analysis operations in Claude Flow. - -## Available Commands - -- [bottleneck-detect](./bottleneck-detect.md) -- [token-usage](./token-usage.md) -- [performance-report](./performance-report.md) diff --git a/test-alpha-63/.claude/commands/analysis/bottleneck-detect.md b/test-alpha-63/.claude/commands/analysis/bottleneck-detect.md deleted file mode 100644 index 85c8595eb6..0000000000 --- a/test-alpha-63/.claude/commands/analysis/bottleneck-detect.md +++ /dev/null @@ -1,162 +0,0 @@ -# bottleneck detect - -Analyze performance bottlenecks in swarm operations and suggest optimizations. - -## Usage - -```bash -npx claude-flow bottleneck detect [options] -``` - -## Options - -- `--swarm-id, -s ` - Analyze specific swarm (default: current) -- `--time-range, -t ` - Analysis period: 1h, 24h, 7d, all (default: 1h) -- `--threshold ` - Bottleneck threshold percentage (default: 20) -- `--export, -e ` - Export analysis to file -- `--fix` - Apply automatic optimizations - -## Examples - -### Basic bottleneck detection - -```bash -npx claude-flow bottleneck detect -``` - -### Analyze specific swarm - -```bash -npx claude-flow bottleneck detect --swarm-id swarm-123 -``` - -### Last 24 hours with export - -```bash -npx claude-flow bottleneck detect -t 24h -e bottlenecks.json -``` - -### Auto-fix detected issues - -```bash -npx claude-flow bottleneck detect --fix --threshold 15 -``` - -## Metrics Analyzed - -### Communication Bottlenecks - -- Message queue delays -- Agent response times -- Coordination overhead -- Memory access patterns - -### Processing Bottlenecks - -- Task completion times -- Agent utilization rates -- Parallel execution efficiency -- Resource contention - -### Memory Bottlenecks - -- Cache hit rates -- Memory access patterns -- Storage I/O performance -- Neural pattern loading - -### Network Bottlenecks - -- API call latency -- MCP communication delays -- External service timeouts -- Concurrent request limits - -## Output Format - -``` -🔍 Bottleneck Analysis Report -━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -📊 Summary -├── Time Range: Last 1 hour -├── Agents Analyzed: 6 -├── Tasks Processed: 42 -└── Critical Issues: 2 - -🚨 Critical Bottlenecks -1. Agent Communication (35% impact) - └── coordinator → coder-1 messages delayed by 2.3s avg - -2. Memory Access (28% impact) - └── Neural pattern loading taking 1.8s per access - -⚠️ Warning Bottlenecks -1. Task Queue (18% impact) - └── 5 tasks waiting > 10s for assignment - -💡 Recommendations -1. Switch to hierarchical topology (est. 40% improvement) -2. Enable memory caching (est. 25% improvement) -3. Increase agent concurrency to 8 (est. 20% improvement) - -✅ Quick Fixes Available -Run with --fix to apply: -- Enable smart caching -- Optimize message routing -- Adjust agent priorities -``` - -## Automatic Fixes - -When using `--fix`, the following optimizations may be applied: - -1. **Topology Optimization** - - - Switch to more efficient topology - - Adjust communication patterns - - Reduce coordination overhead - -2. **Caching Enhancement** - - - Enable memory caching - - Optimize cache strategies - - Preload common patterns - -3. **Concurrency Tuning** - - - Adjust agent counts - - Optimize parallel execution - - Balance workload distribution - -4. **Priority Adjustment** - - Reorder task queues - - Prioritize critical paths - - Reduce wait times - -## Performance Impact - -Typical improvements after bottleneck resolution: - -- **Communication**: 30-50% faster message delivery -- **Processing**: 20-40% reduced task completion time -- **Memory**: 40-60% fewer cache misses -- **Overall**: 25-45% performance improvement - -## Integration with Claude Code - -```javascript -// Check for bottlenecks in Claude Code -mcp__claude-flow__bottleneck_detect { - timeRange: "1h", - threshold: 20, - autoFix: false -} -``` - -## See Also - -- `performance report` - Detailed performance analysis -- `token usage` - Token optimization analysis -- `swarm monitor` - Real-time monitoring -- `cache manage` - Cache optimization diff --git a/test-alpha-63/.claude/commands/analysis/performance-report.md b/test-alpha-63/.claude/commands/analysis/performance-report.md deleted file mode 100644 index 04b8d9e9ac..0000000000 --- a/test-alpha-63/.claude/commands/analysis/performance-report.md +++ /dev/null @@ -1,25 +0,0 @@ -# performance-report - -Generate comprehensive performance reports for swarm operations. - -## Usage -```bash -npx claude-flow analysis performance-report [options] -``` - -## Options -- `--format ` - Report format (json, html, markdown) -- `--include-metrics` - Include detailed metrics -- `--compare ` - Compare with previous swarm - -## Examples -```bash -# Generate HTML report -npx claude-flow analysis performance-report --format html - -# Compare swarms -npx claude-flow analysis performance-report --compare swarm-123 - -# Full metrics report -npx claude-flow analysis performance-report --include-metrics --format markdown -``` diff --git a/test-alpha-63/.claude/commands/analysis/token-usage.md b/test-alpha-63/.claude/commands/analysis/token-usage.md deleted file mode 100644 index 5d6f2b9cff..0000000000 --- a/test-alpha-63/.claude/commands/analysis/token-usage.md +++ /dev/null @@ -1,25 +0,0 @@ -# token-usage - -Analyze token usage patterns and optimize for efficiency. - -## Usage -```bash -npx claude-flow analysis token-usage [options] -``` - -## Options -- `--period