mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
Add tests and documentation for CodexLens LSP tool
- Introduced a new test script for the CodexLens LSP tool to validate core functionalities including symbol search, find definition, find references, and get hover. - Created comprehensive documentation for the MCP endpoint design, detailing the architecture, features, and integration with the CCW MCP Manager. - Developed a detailed implementation plan for transitioning to a real LSP server, outlining phases, architecture, and acceptance criteria.
This commit is contained in:
57
ccw/test-cli-history-migration.js
Normal file
57
ccw/test-cli-history-migration.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Test script for CLI History Store migration fix
|
||||
* Tests that:
|
||||
* 1. New database creation includes all columns (no migration logs)
|
||||
* 2. Old database upgrade shows batch migration log (once)
|
||||
* 3. Subsequent initializations are silent
|
||||
*/
|
||||
|
||||
import { CliHistoryStore, closeAllStores } from './dist/tools/cli-history-store.js';
|
||||
import { existsSync, mkdirSync, rmSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
const testDir = join(process.cwd(), '.test-cli-history');
|
||||
|
||||
// Clean up test directory
|
||||
if (existsSync(testDir)) {
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
}
|
||||
mkdirSync(testDir, { recursive: true });
|
||||
|
||||
console.log('=== Test 1: New database creation (should have NO migration logs) ===\n');
|
||||
const store1 = new CliHistoryStore(testDir);
|
||||
console.log('\n✓ Test 1 passed: No migration logs for new database\n');
|
||||
|
||||
// Close store
|
||||
closeAllStores();
|
||||
|
||||
console.log('=== Test 2: Subsequent initialization (should be silent) ===\n');
|
||||
const store2 = new CliHistoryStore(testDir);
|
||||
console.log('\n✓ Test 2 passed: Subsequent initialization is silent\n');
|
||||
|
||||
// Verify table structure
|
||||
const db = store2.db;
|
||||
const turnsInfo = db.prepare('PRAGMA table_info(turns)').all();
|
||||
const columnNames = turnsInfo.map(col => col.name);
|
||||
|
||||
console.log('=== Verifying turns table columns ===');
|
||||
const requiredColumns = [
|
||||
'id', 'conversation_id', 'turn_number', 'timestamp', 'prompt',
|
||||
'duration_ms', 'status', 'exit_code', 'stdout', 'stderr', 'truncated',
|
||||
'cached', 'stdout_full', 'stderr_full', 'parsed_output', 'final_output'
|
||||
];
|
||||
|
||||
const missingColumns = requiredColumns.filter(col => !columnNames.includes(col));
|
||||
if (missingColumns.length > 0) {
|
||||
console.error('✗ Missing columns:', missingColumns.join(', '));
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('✓ All required columns present:', requiredColumns.join(', '));
|
||||
}
|
||||
|
||||
closeAllStores();
|
||||
|
||||
// Clean up
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
|
||||
console.log('\n=== All tests passed! ===\n');
|
||||
Reference in New Issue
Block a user