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

Function writeApprovalCapsule

scripts/next-action.js:459–473  ·  view source on GitHub ↗
(projectRoot, capsule)

Source from the content-addressed store, hash-verified

457}
458
459function writeApprovalCapsule(projectRoot, capsule) {
460 if (!capsule) return null;
461 const outDir = path.join(projectRoot, '.planning', 'approval-capsules');
462 fs.mkdirSync(outDir, { recursive: true });
463 const filename = `${compactTimestamp(capsule.generatedAt)}-${slugify(capsule.action.command || capsule.action.label)}.md`;
464 const outPath = path.join(outDir, filename);
465 const latestPath = path.join(outDir, 'latest.md');
466 const relativePath = normalizePath(path.relative(projectRoot, outPath));
467 capsule.path = relativePath;
468 capsule.latestPath = normalizePath(path.relative(projectRoot, latestPath));
469 const rendered = renderApprovalCapsule(capsule);
470 fs.writeFileSync(outPath, rendered, 'utf8');
471 fs.writeFileSync(latestPath, rendered, 'utf8');
472 return relativePath;
473}
474
475function main() {
476 const args = parseArgs(process.argv.slice(2));

Callers 4

assessStackFunction · 0.85
buildConsoleFunction · 0.85
mainFunction · 0.85

Calls 4

compactTimestampFunction · 0.85
renderApprovalCapsuleFunction · 0.85
slugifyFunction · 0.70
normalizePathFunction · 0.70

Tested by

no test coverage detected