Files
cortex/src/cli/index.ts
omigamedev 5f7692f5f6 Add structured sections and hierarchical navigation
Add --section flag to add/update commands for structured node content,
render sections and inline children in show, and add memory children command.
2026-02-02 22:29:23 +01:00

44 lines
1.3 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 { closeDb } from '../core/db';
const program = new Command();
program
.name('memory')
.description('Cortex — AI project memory & knowledge graph')
.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.hook('postAction', () => {
closeDb();
});
program.parseAsync(process.argv).catch((err) => {
console.error(err);
closeDb();
process.exit(1);
});