Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
One-time setup that gathers your project's design context and saves it to CLAUDE.md for future sessions.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/live-resume.mjs
1#!/usr/bin/env node2/**3* Recover the next agent action from the durable live-session journal.4*/56import { createLiveSessionStore } from './live-session-store.mjs';78function parseArgs(argv) {9const out = { id: null };10for (let i = 0; i < argv.length; i++) {11const arg = argv[i];12if (arg === '--id') out.id = argv[++i];13else if (arg.startsWith('--id=')) out.id = arg.slice('--id='.length);14else if (arg === '--help' || arg === '-h') out.help = true;15}16return out;17}1819export async function resumeCli() {20const args = parseArgs(process.argv.slice(2));21if (args.help) {22console.log(`Usage: node live-resume.mjs [--id SESSION_ID]\n\nPrint the active durable session checkpoint and the next safe agent action.`);23return;24}2526const store = createLiveSessionStore({ cwd: process.cwd(), sessionId: args.id || undefined });27const snapshot = args.id ? store.getSnapshot(args.id) : store.listActiveSessions()[0] || null;28if (!snapshot) {29console.log(JSON.stringify({ active: false, nextAction: 'No active durable live session found.' }, null, 2));30return;31}3233const pending = snapshot.pendingEvent || null;34const nextAction = pending35? `Run live-poll.mjs, handle ${pending.type} ${pending.id}, then acknowledge with live-poll.mjs --reply ${pending.id} done.`36: snapshot.phase === 'carbonize_required'37? `Finish carbonize cleanup${snapshot.sourceFile ? ` in ${snapshot.sourceFile}` : ''}, then run live-complete.mjs --id ${snapshot.id}.`38: snapshot.phase === 'accept_requested'39? `Run live-complete.mjs --id ${snapshot.id} after verifying the accepted variant is written.`40: `Inspect ${snapshot.id}; no pending agent event is currently queued.`;4142console.log(JSON.stringify({ active: true, snapshot, pendingEvent: pending, nextAction }, null, 2));43}4445const _running = process.argv[1];46if (_running?.endsWith('live-resume.mjs') || _running?.endsWith('live-resume.mjs/')) {47resumeCli();48}49