#!/usr/bin/env node
import {c,k,f as f$1}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-XHJ27CER.js';import*as n from'fs';import*as f from'path';import o from'chalk';import y from'ora';async function w(t,r){let m=process.cwd(),i=f.join(m,".premise");console.log(o.blue(`
\u{1F4F8} Creating Snapshot...
`));let e=y("Loading .premise file...").start();try{n.existsSync(i)||(e.fail(".premise file not found"),console.log(o.yellow(`
Run "paradigm init" first to create a .premise file
`)),process.exit(1));let{data:s,errors:a}=c(i);if(a.length>0){e.warn("Warnings parsing .premise file");for(let d of a)console.log(o.yellow(`  \u26A0 ${d}`));}s||(e.fail("Failed to parse .premise file"),process.exit(1)),e.text="Creating snapshot...";let l=k(s,t,r),h=l.snapshots?.length||0;n.writeFileSync(i,f$1(l)),e.succeed(`Created snapshot "${t}"`),console.log(o.white(`
Snapshot Details`)),console.log(o.gray("\u2500".repeat(40))),console.log(`  Name:         ${o.cyan(t)}`),r&&console.log(`  Description:  ${o.gray(r)}`),console.log(`  Nodes:        ${o.cyan(s.nodes.length.toString())}`),console.log(`  Connections:  ${o.cyan(s.connections.length.toString())}`),console.log(`  Total:        ${o.cyan(h.toString())} snapshot(s)`),console.log("");}catch(s){e.fail("Failed to create snapshot"),console.log(o.red(`Error: ${s.message}
`)),process.exit(1);}}export{w as premiseSnapshotCommand};