- Add project type detection (Node.js, Python, Rust, Go, generic) - Add file scanner with ignore patterns and hash tracking - Add TypeScript/JavaScript parser (exports, imports, classes, functions) - Add Python parser (imports, classes, functions, __all__) - Add relationship mapper for import dependencies - Add architecture summary generation with tech stack detection - Add incremental update support via file hash comparison - Add CLI command: cortex index [path] [--update] [--dry-run] - Add MCP tools: memory_index, memory_components
59 lines
2.0 KiB
JavaScript
59 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
import { Command } from 'commander';
|
|
import { addCommand } from './commands/add';
|
|
import { queryCommand } from './commands/query';
|
|
import { linkCommand } from './commands/link';
|
|
import { showCommand } from './commands/show';
|
|
import { listCommand } from './commands/list';
|
|
import { updateCommand } from './commands/update';
|
|
import { removeCommand } from './commands/remove';
|
|
import { graphCommand } from './commands/graph';
|
|
import { serveCommand } from './commands/serve';
|
|
import { decayCommand } from './commands/decay';
|
|
import { childrenCommand } from './commands/children';
|
|
import { historyCommand } from './commands/history';
|
|
import { diffCommand } from './commands/diff';
|
|
import { restoreCommand } from './commands/restore';
|
|
import { captureCommand, captureHookCommand, configCommand } from './commands/capture';
|
|
import { contextCommand, contextHookCommand } from './commands/context';
|
|
import { indexCommand } from './commands/index-cmd';
|
|
import { closeDb } from '../core/db';
|
|
|
|
const program = new Command();
|
|
|
|
program
|
|
.name('cortex')
|
|
.description('Cortex — AI project memory & knowledge graph\n\nStore, link, and search project knowledge as a graph of typed nodes.')
|
|
.version('1.0.0');
|
|
|
|
program.addCommand(addCommand);
|
|
program.addCommand(queryCommand);
|
|
program.addCommand(linkCommand);
|
|
program.addCommand(showCommand);
|
|
program.addCommand(listCommand);
|
|
program.addCommand(updateCommand);
|
|
program.addCommand(removeCommand);
|
|
program.addCommand(graphCommand);
|
|
program.addCommand(serveCommand);
|
|
program.addCommand(decayCommand);
|
|
program.addCommand(childrenCommand);
|
|
program.addCommand(historyCommand);
|
|
program.addCommand(diffCommand);
|
|
program.addCommand(restoreCommand);
|
|
program.addCommand(captureCommand);
|
|
program.addCommand(captureHookCommand);
|
|
program.addCommand(contextCommand);
|
|
program.addCommand(contextHookCommand);
|
|
program.addCommand(configCommand);
|
|
program.addCommand(indexCommand);
|
|
|
|
program.hook('postAction', () => {
|
|
closeDb();
|
|
});
|
|
|
|
program.parseAsync(process.argv).catch((err) => {
|
|
console.error(err);
|
|
closeDb();
|
|
process.exit(1);
|
|
});
|