(projectRoot, capsule)
| 457 | } |
| 458 | |
| 459 | function 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 | |
| 475 | function main() { |
| 476 | const args = parseArgs(process.argv.slice(2)); |
no test coverage detected