#!/usr/bin/env node 'use strict'; // Collision-safe, all-or-nothing writer for the .stories/ planning ledger. // Usage: node ledger.js --root [options] const fs = require('fs'); const os = require('os'); const path = require('path'); const { execFileSync } = require('child_process'); const SLUG = /^[a-z0-9]+(-[a-z0-9]+)*$/; const STORY_FILE = /^([a-z0-9]+(?:-[a-z0-9]+)*)-([1-9][0-9]*)\.md$/; const EPIC_FILE = /^epics\/([a-z0-9]+(?:-[a-z0-9]+)*)\.md$/; const SPRINT_FILE = /^sprints\/sprint-([1-9][0-9]*)\.md$/; const STATUSES = ['todo', 'in-progress', 'review', 'done']; const SPRINT_VALUE = /^(unassigned|[1-9][0-9]*)$/; const POINTS = ['1', '2', '3', '5', '8']; const BACKUP = /^backup-[0-9]+$/; const DERIVED = '