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.
This commit is contained in:
2026-02-02 22:29:23 +01:00
parent f1b59a2d1a
commit 5f7692f5f6
6 changed files with 125 additions and 1 deletions

View File

@@ -30,6 +30,23 @@ export const showCommand = new Command('show')
if (node.isStale) console.log(chalk.red('STALE'));
if (node.content) console.log(`\n${node.content}`);
// Render structured sections
if (node.metadata?.sections && Array.isArray(node.metadata.sections)) {
for (const sec of node.metadata.sections) {
console.log(`\n${chalk.bold(`── ${sec.label} ──`)}`);
if (sec.body) console.log(sec.body);
}
}
// Inline children (outgoing 'contains' edges)
const children = conns.outgoing.filter(c => c.type === 'contains');
if (children.length) {
console.log(chalk.bold('\nChildren:'));
for (const c of children) {
console.log(` ${c.node.id.slice(0, 8)} [${c.node.kind}] ${c.node.title}`);
}
}
if (conns.outgoing.length) {
console.log(chalk.bold('\nOutgoing:'));
for (const c of conns.outgoing) {