refactor: Remove semantic search and vector embedding functionality

Removes @xenova/transformers dependency, vector storage tables, embedding generation, and semantic search APIs. Simplifies context building to use only FTS search. Eliminates visualizer server, postinstall model download, and related CLI commands. Reduces package size and complexity while maintaining core static analysis capabilities.
This commit is contained in:
Colby McHenry
2026-04-07 14:59:48 -05:00
parent 7507605be5
commit 453c39d774
16 changed files with 12 additions and 4424 deletions
-63
View File
@@ -1078,69 +1078,6 @@ program
}
});
/**
* codegraph visualize [path]
*/
program
.command('visualize [path]')
.description('Open interactive graph visualization in your browser')
.option('-p, --port <port>', 'Port to listen on (default: auto)', parseInt)
.option('--no-open', 'Do not open browser automatically')
.action(async (pathArg: string | undefined, options: { port?: number; open?: boolean }) => {
const projectPath = resolveProjectPath(pathArg);
try {
if (!isInitialized(projectPath)) {
error(`CodeGraph not initialized in ${projectPath}`);
info('Run "codegraph init -i" first');
process.exit(1);
}
const { default: CodeGraph } = await loadCodeGraph();
const cg = await CodeGraph.open(projectPath);
const stats = cg.getStats();
console.log(chalk.bold('\n CodeGraph Explorer\n'));
info(`Project: ${projectPath}`);
info(`Indexed: ${formatNumber(stats.nodeCount)} nodes, ${formatNumber(stats.edgeCount)} edges, ${formatNumber(stats.fileCount)} files\n`);
const { VisualizerServer } = await import('../visualizer/server');
const server = new VisualizerServer(cg);
const { url } = await server.start({ port: options.port, openBrowser: options.open !== false });
success(`Visualizer running at ${chalk.cyan(url)}`);
console.log(chalk.dim(' Press Ctrl+C to stop\n'));
// Open browser
if (options.open !== false) {
const openCmd = process.platform === 'darwin' ? 'open' :
process.platform === 'win32' ? 'start' : 'xdg-open';
spawn(openCmd, [url], { detached: true, stdio: 'ignore' }).unref();
}
// Handle shutdown — force exit on second Ctrl+C
let shuttingDown = false;
const shutdown = () => {
if (shuttingDown) {
process.exit(1);
}
shuttingDown = true;
console.log(chalk.dim('\n Shutting down...'));
server.stop().then(() => {
cg.close();
process.exit(0);
}).catch(() => process.exit(1));
// Force exit after 2s if graceful shutdown hangs
setTimeout(() => process.exit(1), 2000).unref();
};
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
} catch (err) {
error(`Failed to start visualizer: ${err instanceof Error ? err.message : String(err)}`);
process.exit(1);
}
});
/**
* codegraph mark-dirty [path]
*