MCPcopy Create free account
hub / github.com/SethGammon/Citadel / main

Function main

scripts/memory-compile.js:69–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67}
68
69function main() {
70 const args = parseArgs(process.argv);
71 if (args.help) {
72 process.stdout.write(`${usage()}\n`);
73 return;
74 }
75
76 if (args.mode === 'compile') {
77 const result = compileMemoryBlocks(args.projectRoot);
78 const lint = lintMemoryBlocks(args.projectRoot);
79 if (args.json) process.stdout.write(`${JSON.stringify({ ...result, lint }, null, 2)}\n`);
80 else process.stdout.write(renderCompile(args.projectRoot, result, lint));
81 process.exitCode = lint.pass ? 0 : 1;
82 return;
83 }
84
85 if (args.mode === 'lint') {
86 const lint = lintMemoryBlocks(args.projectRoot);
87 if (args.json) process.stdout.write(`${JSON.stringify(lint, null, 2)}\n`);
88 else process.stdout.write(renderCompile(args.projectRoot, { blocks: lint.blocks, indexPath: path.join(args.projectRoot, '.planning', 'memory', 'index.json') }, lint));
89 process.exitCode = lint.pass ? 0 : 1;
90 return;
91 }
92
93 if (args.mode === 'list') {
94 const blocks = loadMemoryBlocks(args.projectRoot, args);
95 if (args.json) process.stdout.write(`${JSON.stringify(blocks, null, 2)}\n`);
96 else process.stdout.write(renderList(args.projectRoot, blocks));
97 return;
98 }
99
100 process.stderr.write(`${usage()}\n`);
101 process.exitCode = 2;
102}
103
104if (require.main === module) {
105 main();

Callers 1

memory-compile.jsFile · 0.70

Calls 7

compileMemoryBlocksFunction · 0.85
lintMemoryBlocksFunction · 0.85
renderCompileFunction · 0.85
loadMemoryBlocksFunction · 0.85
parseArgsFunction · 0.70
usageFunction · 0.70
renderListFunction · 0.70

Tested by

no test coverage detected