Files
ruflo/test-fallback-simulation.mjs
T
rUvandClaude a703fdbe64 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>
2025-07-14 11:15:20 -04:00

56 lines
1.9 KiB
JavaScript
Executable File

#!/usr/bin/env node
import { createRequire } from 'module';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Create a require function for this ES module
const require = createRequire(import.meta.url);
// Mock better-sqlite3 to simulate it being missing
const Module = require('module');
const originalRequire = Module.prototype.require;
Module.prototype.require = function(id) {
if (id === 'better-sqlite3') {
throw new Error('Cannot find module \'better-sqlite3\' - Simulating missing native module');
}
return originalRequire.apply(this, arguments);
};
// Import after mocking
import('./src/memory/enhanced-memory.js').then(async ({ EnhancedMemory }) => {
console.log('🧪 Testing SQLite Fallback Mechanism\n');
const memory = new EnhancedMemory();
try {
await memory.initialize();
console.log('✅ Memory initialized successfully');
console.log(`📊 Using fallback: ${memory.useFallback ? 'YES (in-memory)' : 'NO (SQLite)'}`);
// Test basic operations
console.log('\n🔧 Testing memory operations:');
await memory.store('test-key', 'test-value', { namespace: 'test' });
console.log('✅ Store operation successful');
const value = await memory.retrieve('test-key', { namespace: 'test' });
console.log(`✅ Retrieve operation successful: ${value}`);
const items = await memory.list({ namespace: 'test' });
console.log(`✅ List operation successful: ${items.length} items`);
console.log('\n🎉 All operations completed successfully!');
console.log('💡 The fallback mechanism is working correctly.');
} catch (error) {
console.error('❌ Error:', error.message);
process.exit(1);
}
}).catch(err => {
console.error('Failed to import:', err);
});