fix: Claude Code 1.0.51+ hooks compatibility and migration command (#247)

* fix: update hooks format for Claude Code 1.0.51+ compatibility

- Changed hooks from object format to array format (PreToolUse, PostToolUse, Stop)
- Added migration script for existing users
- Updated settings.json template in init command
- Removed unsupported fields (mcpServers, features, performance)
- Added @alpha tag to npx commands in hooks

Fixes #235

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: implement hive-mind resume functionality (alpha.50)

- Add HiveMindSessionManager for session persistence
- Implement auto-save middleware with 30-second intervals
- Add 'hive-mind resume <session-id>' command
- Add 'hive-mind sessions' command to list sessions
- Integrate session tracking into spawn workflow
- Add comprehensive test suite (80+ tests)
- Update documentation and fix README
- Bump version to 2.0.0-alpha.50

Fixes #232

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>

* chore: bump version to 2.0.0-alpha.51

- Update version strings in all CLI files
- Prepare for npm publication

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add migrate-hooks command and bump to alpha.52

- Added migrate-hooks CLI command to migrate settings.json format
- Wraps the migration script for easy CLI access
- Updated version to 2.0.0-alpha.52
- Added command to help text and registry

Addresses issue #235 and discussion #237

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add release notes for alpha.52

- Document hooks format migration
- List all fixes and acknowledgments
- Provide upgrade instructions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Claude Code 1.0.51+ hooks compatibility and migration command

- Updated hooks format from object to array structure for Claude Code 1.0.51+
- Added migrate-hooks CLI command for automatic migration
- Fixed MCP server fallback issues caused by invalid settings
- Removed unsupported fields (mcpServers, features, performance)
- Updated templates to generate correct settings format
- Added migration script with backup functionality

Fixes #235, #236, #237

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
rUvandClaude authored and GitHub committed 2025-07-14 11:15:20 -04:00
1 parent 01fe4a6557
commit a703fdbe64
10 files changed
+337 -3

No files matched your search

+3
View File
@@ -22,6 +22,7 @@ import { hookSafetyCommand } from './simple-commands/hook-safety.js';
import { hiveMindCommand } from './simple-commands/hive-mind.js';
import hiveMindOptimizeCommand from './simple-commands/hive-mind-optimize.js';
import { showUnifiedMetrics, fixTaskAttribution } from './simple-commands/swarm-metrics-integration.js';
import { migrateHooksCommand, migrateHooksCommandConfig } from './simple-commands/migrate-hooks.js';
// Note: TypeScript imports commented out for Node.js compatibility
// import { ruvSwarmAction } from './commands/ruv-swarm.ts';
// import { configIntegrationAction } from './commands/config-integration.ts';
@@ -468,6 +469,8 @@ SAFE ALTERNATIVES:
For more information: https://github.com/ruvnet/claude-flow/issues/166`
});
commandRegistry.set('migrate-hooks', migrateHooksCommandConfig);
commandRegistry.set('hive', {
handler: async (args, flags) => {
try {
+2 -1
View File
@@ -3,7 +3,7 @@
* Provides clear, actionable command documentation
*/
export const VERSION = '2.0.0-alpha.51';
export const VERSION = '2.0.0-alpha.52';
export const MAIN_HELP = `
🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
@@ -50,6 +50,7 @@ USAGE:
analysis <command> Performance & usage analytics (3 commands)
automation <command> Intelligent agent & workflow management (3 commands)
hooks <command> Lifecycle event management (5 commands)
migrate-hooks Migrate settings.json to Claude Code 1.0.51+ format
monitoring <command> Real-time system monitoring (3 commands)
optimization <command> Performance & topology optimization (3 commands)
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env node
/**
* CLI command wrapper for migrate-hooks script
*/
import { execSync } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
import { promises as fs } from 'fs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export async function migrateHooksCommand(flags, args) {
console.log('🔄 Claude Flow Hooks Migration\n');
try {
// Find the migration script
const scriptPath = path.join(__dirname, '../../../scripts/migrate-hooks.js');
// Check if script exists
try {
await fs.access(scriptPath);
} catch {
console.error('❌ Migration script not found. Please ensure you have the latest version.');
process.exit(1);
}
// Build command with any additional arguments
const command = ['node', scriptPath];
if (args.length > 0) {
command.push(...args);
}
// Execute the migration script
execSync(command.join(' '), {
stdio: 'inherit',
cwd: process.cwd()
});
} catch (error) {
console.error('❌ Migration failed:', error.message);
process.exit(1);
}
}
// Export the command configuration
export const migrateHooksCommandConfig = {
handler: migrateHooksCommand,
description: 'Migrate settings.json hooks to Claude Code 1.0.51+ format',
usage: 'migrate-hooks [settings-file]',
examples: [
'claude-flow migrate-hooks # Migrate all found settings.json files',
'claude-flow migrate-hooks .claude/settings.json # Migrate specific file'
],
details: `
Migrates old hooks format to new Claude Code 1.0.51+ format:
• Converts object-based hooks to array-based format
• Creates backup before making changes
• Removes unsupported fields (mcpServers, features, performance)
• Searches common locations if no file specified
The migration is safe and creates backups of original files.`
};