/** * cli:menu-node — execute.ts * * Loads the tree ONCE (lib/ba-menu-tree.loadMenuTree) and dispatches to the * operation. Every operation computes its plan in memory (Staging) and writes * only in `mode: write` with an empty `blocked[]`. */ import { loadMenuTree } from '../../../../lib/ba-menu-tree.js' import { runAdd } from './add.js' import { runDelete } from './delete.js' import { runRename } from './rename.js' import type { MenuNodeInput, MenuNodeReport, ResolvedScope } from './types.js' export function executeMenuNode(spec: MenuNodeInput, scope: ResolvedScope): MenuNodeReport { const tree = loadMenuTree(scope.baRoot) switch (spec.op) { case 'add': return runAdd(spec, scope, tree) case 'rename': return runRename(spec, scope, tree) case 'delete': return runDelete(spec, scope, tree) } }