@lunora/cli 1.0.0-alpha.201 → 1.0.0-alpha.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/index.d.mts +36 -6
  3. package/dist/index.d.ts +36 -6
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_chunks/handler.mjs +1 -1
  6. package/dist/packem_chunks/handler13.mjs +1 -1
  7. package/dist/packem_chunks/handler14.mjs +1 -1
  8. package/dist/packem_chunks/handler17.mjs +1 -1
  9. package/dist/packem_chunks/handler19.mjs +1 -1
  10. package/dist/packem_chunks/handler2.mjs +2 -2
  11. package/dist/packem_chunks/handler21.mjs +2 -2
  12. package/dist/packem_chunks/handler25.mjs +2 -2
  13. package/dist/packem_chunks/handler26.mjs +4 -4
  14. package/dist/packem_chunks/handler3.mjs +1 -1
  15. package/dist/packem_chunks/handler4.mjs +1 -1
  16. package/dist/packem_chunks/handler7.mjs +3 -3
  17. package/dist/packem_chunks/planDevCommand.mjs +6 -6
  18. package/dist/packem_chunks/runCodegenCommand.mjs +3 -3
  19. package/dist/packem_chunks/runDeployCommand.mjs +1 -1
  20. package/dist/packem_chunks/runInitCommand.mjs +11 -11
  21. package/dist/packem_shared/COMMANDS-D-2fKisr.mjs +1 -0
  22. package/dist/packem_shared/cli-HouJioGN.mjs +3 -0
  23. package/dist/packem_shared/{commands-BOgN2nF7.mjs → commands-BNKj7r1R.mjs} +7 -7
  24. package/dist/packem_shared/{lint-ignore-report-CDbcbtv7.mjs → lint-ignore-report-ajVhvqY-.mjs} +1 -1
  25. package/dist/packem_shared/runAddCommand-D1Dj8-pK.mjs +1 -0
  26. package/dist/packem_shared/wrangler-secrets-CCdt0mUl.mjs +1 -0
  27. package/package.json +7 -8
  28. package/dist/packem_shared/COMMANDS-su5nmqYP.mjs +0 -1
  29. package/dist/packem_shared/cli-RB-BoDnW.mjs +0 -3
  30. package/dist/packem_shared/detect-package-manager-DSaAqRof.mjs +0 -1
  31. package/dist/packem_shared/post-codegen-hook-DRdEoTsQ.mjs +0 -1
  32. package/dist/packem_shared/runAddCommand-BXz-PXbb.mjs +0 -1
  33. package/dist/packem_shared/wrangler-secrets-CE7jcf8E.mjs +0 -1
@@ -0,0 +1,3 @@
1
+ import{mkdirSync as O,readFileSync as w,lstatSync as A,writeFileSync as D}from"node:fs";import{join as u,dirname as f}from"node:path";import{fileURLToPath as B}from"node:url";import{resolveHint as E,isLunoraError as S,flattenHint as L,findSolutionByMessage as _}from"@lunora/errors";import{createCerebro as I}from"@visulima/cerebro";import j from"@visulima/cerebro/command/completion";import T from"@visulima/cerebro/command/version";import{A as p}from"./api-spec-lYyq4vL6.mjs";import{T as s}from"./deploy-target-D9GPy_tq.mjs";import{SDK_LANGUAGES as P}from"@lunora/codegen";import{createLogger as k}from"./createLogger-hGafwf-3.mjs";import{VisulimaError as U,renderError as M}from"@visulima/error";import{homedir as W}from"node:os";import{addArgsFor as K,detectPackageManager as J}from"@lunora/config";const F={argument:{description:"Feature or registry item: ai | auth | email | storage | crons | presence | queue | workflow | flags | backup | …",name:"feature",type:String},description:"Add a feature or registry item (ai, auth, email, storage, crons, …) to the current Lunora project",examples:[["lunora add auth","Add authentication (asks which provider)"],["lunora add auth --provider clerk","Add Clerk auth without prompting"],["lunora add auth-ui","Add copy-in auth screens for your framework (auto-detected)"],["lunora add email","Add transactional email (Cloudflare Email Workers + dev mail catcher)"],["lunora add storage","Add the R2 storage registry item (asks for the bucket name)"],["lunora add storage --bucket my-app-uploads","Add storage with a bucket name, no prompt"],["lunora add crons","Add the scheduled-jobs registry item"],["lunora add storage --ref alpha","Add an item from the alpha branch's registry"]],group:"Project",loader:()=>import("../packem_chunks/handler.mjs").then(e=>({default:e.execute})),name:"add",options:[{description:"auth: provider to use without prompting (auth | clerk | auth0)",name:"provider",type:String},{description:"auth: D1 database name to use without prompting (lowercase alphanumeric + hyphens)",name:"db",type:String},{description:"storage: R2 bucket name to use without prompting (lowercase alphanumeric + hyphens)",name:"bucket",type:String},{description:"email: verified destination address to use without prompting",name:"mail-to",type:String},{description:"Skip prompts (auth provider, DB name, bucket name, mail destination) and use the defaults",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Output format: pretty (default) or json",name:"format",type:String}]},y="lunora.advisor.map.json",H={description:"Score your app's advisor findings into a health map, and gate CI on it",examples:[["lunora advisor","Score the app and write lunora.advisor.map.json"],["lunora advisor --all","Show every procedure as a check matrix"],["lunora advisor --entry messages#sendMessage","Inspect one procedure"],["lunora advisor --min-score 80","Exit non-zero when the score drops below 80"],["lunora advisor --baseline","Fail on any regression against the committed map"]],group:"Develop",loader:()=>import("../packem_chunks/handler19.mjs").then(e=>({default:e.execute})),name:"advisor",options:[{description:"Show every procedure as a check matrix, not just the ones with findings",name:"all",type:Boolean},{description:`Compare against a committed map and fail on regression (default ${y})`,name:"baseline",type:String},{description:"Inspect a single procedure by `file#exportName`",name:"entry",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Exit non-zero when the global score is below this value (0-100)",name:"min-score",type:String},{description:`Where to write the map (default ${y})`,name:"out",type:String},{description:"Write the map artifact to disk (default true; use --no-write to skip)",name:"no-write",type:Boolean}]},$={description:"Run wrangler dry-run and report bundle size, top modules, and _generated files",examples:[["lunora analyze","Report the worker bundle size + heaviest modules"]],group:"Deploy",loader:()=>import("../packem_chunks/handler2.mjs").then(e=>({default:e.execute})),name:"analyze",options:[{description:"Emit a JSON report instead of human text",name:"json",type:Boolean}]},V={argument:{description:"create | list | restore <id|file> | retention | prune | pitr",name:"subcommand",type:String},description:"Managed snapshot backups (create | list | restore) to a directory or an R2 bucket, plus native point-in-time recovery (pitr)",examples:[["lunora backup create","Snapshot every table to a backup file"],["lunora backup list","List recorded snapshots"],["lunora backup restore <id>","Restore a snapshot by id"],["lunora backup create --bucket default","Snapshot into an R2 bucket instead of a directory"],["lunora backup restore <id> --bucket default --verify","Restore from R2, checksum first"],["lunora backup retention","Show what the platform's retention would delete next"],["lunora backup prune","Delete the snapshots past the retention window (the only command that deletes backups)"],["lunora backup pitr --at 2026-06-01T00:00:00Z","Point-in-time recovery (≤30 days)"]],group:"Data",loader:()=>import("../packem_chunks/handler23.mjs").then(e=>({default:e.execute})),name:"backup",options:[{description:"Backup directory (default .lunora-backups)",name:"dir",type:String},{description:"Store snapshots in this R2 bucket instead of a directory (use `default` for the app's default bucket)",name:"bucket",type:String},{description:"Key prefix for bucket-backed snapshots (default backups/)",name:"prefix",type:String},{description:"restore: verify the snapshot's checksum before importing anything",name:"verify",type:Boolean},{description:"Comma-separated table allowlist (create)",name:"tables",type:String},{description:"pitr: time to read/restore to (ISO or epoch-ms, ≤30 days)",name:"at",type:String},{description:"pitr --restore: explicit bookmark to restore to (wins over --at)",name:"bookmark",type:String},{description:"pitr: perform a restore instead of just reading the bookmark",name:"restore",type:Boolean},{description:"pitr --restore: restart the shard now so recovery applies immediately",name:"restart",type:Boolean},{description:"pitr: target shard key (default: root shard)",name:"shard",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Confirm a destructive step without prompting: a production pitr --restore, or backup prune",name:"yes",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},G={description:"Codegen + validate + bundle the Worker to disk without deploying",examples:[["lunora build","Bundle to .lunora/build without deploying"],["lunora build --out-dir dist-worker","Bundle to a custom directory"],["lunora build --emit-bindings bindings.json","Also write what the bundle needs provisioned, for an external deployer"]],group:"Deploy",loader:()=>import("../packem_chunks/handler20.mjs").then(e=>({default:e.execute})),name:"build",options:[{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Write a JSON manifest of the bindings + crons the bundle needs to this path, for an IaC program to consume",name:"emit-bindings",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Directory to write the bundled Worker to (default .lunora/build)",name:"out-dir",type:String},s]},q={description:"Run codegen for lunora/ functions and schema",examples:[["lunora codegen","Generate lunora/_generated/ from your schema + functions"]],group:"Develop",loader:()=>import("../packem_chunks/runCodegenCommand.mjs").then(e=>({default:e.execute})),name:"codegen",options:[{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Fail on ERROR-level advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail on ERROR-level advisories (the gate defaults to on in CI, off locally)",name:"no-strict-advisories",type:Boolean},s]},z={argument:{description:"<build|push|images|list|info|delete> [args…]",name:"args",type:String},description:"Build/push container images and manage container instances (wraps wrangler containers)",examples:[["lunora containers build ./containers/transcoder --tag transcoder:v1","Build a container image with the local Docker engine"],["lunora containers build ./containers/transcoder --tag transcoder:v1 --push","Build and push to the Cloudflare Registry in one step"],["lunora containers push transcoder:v1","Push a locally-tagged image to the Cloudflare Registry"],["lunora containers images list","List images in your Cloudflare Registry"],["lunora containers images delete transcoder:v1","Delete an image to free registry storage"]],group:"Deploy",loader:()=>import("../packem_chunks/handler3.mjs").then(e=>({default:e.execute})),name:"containers",options:[{description:"build: push the image to the Cloudflare Registry after building",name:"push",type:Boolean},{description:"build: name:tag for the image (forwarded to wrangler --tag)",name:"tag",type:String},{description:"Cloudflare environment name",name:"env",type:String}]},Y={description:"Codegen, validate wrangler, then wrangler deploy",examples:[["lunora deploy","Deploy to Cloudflare"],["lunora deploy --env production","Deploy to a named environment"],["lunora deploy --dry-run","Validate + bundle without publishing"],["lunora deploy --migrate","Deploy, then run pending data migrations"]],group:"Deploy",loader:()=>import("../packem_chunks/runDeployCommand.mjs").then(e=>({default:e.execute})),name:"deploy",options:[{description:"Override the schema-drift gate (deploy even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Validate, bundle, and run pre-deploy gates without publishing (wrangler deploy --dry-run)",name:"dry-run",type:Boolean},{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"After the deploy, probe the new version's health route (/_lunora/health/ready, falling back to /_lunora/health) and fail if it never answers",name:"health-check",type:Boolean},{description:"After a successful deploy, run pending data migrations against the live worker",name:"migrate",type:Boolean},{description:"Skip codegen + the schema-drift gate (assumes `lunora build`/`prepare` already ran in this CI run). Wrangler still bundles the worker.",name:"prebuilt",type:Boolean},{description:"Admin bearer token for --migrate (falls back to LUNORA_ADMIN_TOKEN)",name:"migrate-token",type:String},{description:"Worker URL for --migrate (REQUIRED with --migrate; the deploy target URL is not captured automatically)",name:"migrate-url",type:String},{description:"Confirm running the production data migration triggered by --migrate (required with --migrate)",name:"migrate-yes",type:Boolean},{description:"Fail the deploy on ERROR-level codegen advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail the deploy on ERROR-level codegen advisories (the gate defaults to on in CI, off locally). Never downgrades platform diagnostics.",name:"no-strict-advisories",type:Boolean},{description:"Upload a preview version (wrangler versions upload) instead of going live — prints a preview URL; doesn't shift production traffic",name:"preview",type:Boolean},s,{description:"Deploy to a temporary Cloudflare account when unauthenticated (wrangler deploy --temporary; live ~60min, then claim or it's deleted). Wrangler errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},Q={argument:{description:"list | inspect <version-id> | rollback [version-id] | promote <version-id>",name:"subcommand",type:String},description:"List deployments and roll back / promote / inspect Worker versions",examples:[["lunora deployments list","Show the 10 most recent deployments"],["lunora deployments inspect <version-id>","View a specific Worker version"],["lunora deployments rollback --yes","Roll back to the previous version"],["lunora deployments promote <version-id> --yes","Send 100% of traffic to a version"]],group:"Deploy",loader:()=>import("../packem_chunks/handler4.mjs").then(e=>({default:e.execute})),name:"deployments",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Display `list` output as JSON",name:"json",type:Boolean},{description:"Reason/description recorded with a rollback or promote",name:"message",type:String},{description:"Confirm a rollback or promote (required — these change live traffic)",name:"yes",type:Boolean}]},X={argument:{description:"Optional subcommand: stop (shut the running dev server down) | status (report it) | logs (print its captured output)",name:"args",type:String},description:"Run the dev stack: wrangler worker + studio + codegen watch",examples:[["lunora dev","Run the worker + studio + codegen watch"],["lunora dev --background","Run detached: blocks until ready, prints URL + PID, then returns"],["lunora dev stop","Stop the background/tracked dev server (idempotent)"],["lunora dev status","Report the running dev server (URL, PID, uptime)"],["lunora dev logs","Print the captured dev-server log (background runs)"],["lunora dev --json","Machine-readable JSON log lines (also LUNORA_LOG_JSON=1)"],["lunora dev --no-studio","Skip the embedded studio server"],["lunora dev --worker-port 8080","Use a custom wrangler dev port"],["lunora dev --remote","Proxy D1/KV/R2 to the deployed worker (also LUNORA_REMOTE=1)"]],group:"Develop",loader:()=>import("../packem_chunks/planDevCommand.mjs").then(e=>({default:e.execute})),name:"dev",options:[{description:`Which API spec(s) codegen emits: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Studio server port (default 6173)",name:"port",type:Number},s,{description:"wrangler dev port (default 8787)",name:"worker-port",type:Number},{description:"Run the dev server as a managed background process (auto-enabled when an AI agent is detected; LUNORA_AGENT_MODE=0 disables)",name:"background",type:Boolean},{description:"Emit machine-readable JSON log lines (also LUNORA_LOG_JSON=1; auto-enabled for AI agents)",name:"json",type:Boolean},{description:"How many trailing lines `lunora dev logs` prints (default 100, 0 = all)",name:"lines",type:Number},{description:"Don't start the embedded studio server",name:"no-studio",type:Boolean},{description:"Don't spawn wrangler dev — an external task runner owns the worker; codegen watch + studio still run",name:"no-worker",type:Boolean},{description:"Don't run codegen — no watch, no startup generate (or set LUNORA_CODEGEN=0)",name:"no-codegen",type:Boolean},{description:"Proxy D1/KV/R2 bindings to the deployed worker (or set LUNORA_REMOTE=1)",name:"remote",type:Boolean}]},Z={argument:{description:"Optional path under the docs site (e.g. addons/studio)",name:"section",type:String},description:"Open the Lunora docs in your browser (optional [section] path)",examples:[["lunora docs","Open the Lunora docs"],["lunora docs addons/studio","Open a specific docs section"]],group:"Project",loader:()=>import("../packem_chunks/handler5.mjs").then(e=>({default:e.execute})),name:"docs"},ee={description:"Preflight the current Lunora project (wrangler bindings, placeholders, dev secrets)",examples:[["lunora doctor","Run the project preflight checks"],["lunora doctor --format json","Emit the findings as a machine-readable JSON document"]],group:"Project",loader:()=>import("../packem_chunks/handler6.mjs").then(e=>({default:e.execute})),name:"doctor",options:[{description:"Output format: pretty (default) or json",name:"format",type:String}]},te={argument:{description:"list | get <KEY> | set <KEY> <VALUE> | unset <KEY> | generate [KEY] | push | diff | doctor",name:"subcommand",type:String},description:"Manage .dev.vars and sync secrets via wrangler (list | get | set | unset | generate | push | diff | doctor)",examples:[["lunora env list","List .dev.vars keys"],["lunora env set API_KEY secret","Set a local variable"],["lunora env generate","Generate strong values for the project's secrets (print KEY=value)"],["lunora env generate AUTH_SECRET --set","Generate one secret and write it to .dev.vars"],["lunora env push --yes","Upload secrets to Cloudflare"],["lunora env diff","Compare local .dev.vars keys against Cloudflare"]],group:"Data",loader:()=>import("../packem_chunks/handler7.mjs").then(e=>({default:e.execute})),name:"env",options:[{description:"Target this Cloudflare environment for `push`/`diff` (passes --env <name> to wrangler)",name:"env",type:String},{description:"Alias for --env production",name:"prod",type:Boolean},{description:"For `generate` — write the generated secrets into .dev.vars instead of printing them",name:"set",type:Boolean},{description:"Push secrets to a temporary-account deployment when unauthenticated (wrangler secret put --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Required for `push` — confirms uploading secrets to Cloudflare",name:"yes",type:Boolean}]},re={description:"Run every *.eval.ts under evals/ via @lunora/testing's evaluate/agentHarness — no live worker needed",examples:[["lunora eval","Run every eval under evals/, print the aggregate table"],["lunora eval --threshold 0.8","Non-zero exit if any eval's average score falls below 0.8"],["lunora eval --dir evals/support --format json","Run a subset and emit a machine-readable result"]],group:"Develop",loader:()=>import("../packem_chunks/handler24.mjs").then(e=>({default:e.execute})),name:"eval",options:[{description:"Directory to discover *.eval.ts files under (default evals/)",name:"dir",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Score gate every eval's average must meet ([0,1]); a per-eval `threshold` export wins over this for that eval",name:"threshold",type:Number}]},oe={argument:{description:"Optional path (alias for --out)",name:"path",type:String},description:"Stream NDJSON of every shard-local + global table from the worker",examples:[["lunora export --out backup.ndjson","Dump every table to an NDJSON file"],["lunora export --tables messages,users","Export only specific tables"]],group:"Data",loader:()=>import("../packem_chunks/handler8.mjs").then(e=>({default:e.execute})),name:"export",options:[{description:"Output file path (`-` for stdout, default)",name:"out",type:String},{description:"Comma-separated table allowlist",name:"tables",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},ne={argument:{description:"Source NDJSON file, or a `npx convex export --path <dir>` directory",name:"file",type:String},description:"Bulk-insert rows from an NDJSON file — or a Convex export directory — via the worker's admin endpoint",examples:[["lunora import backup.ndjson","Bulk-insert rows from an NDJSON file"],["lunora import ./convex-export","Import a `npx convex export --path` directory (ids are preserved, so no remapping)"],["lunora import ./convex-export --with-storage","Also migrate blobs (verified sha256 upload) + `{ $storage }` refs"],["lunora import ./convex-export --scan","Write a candidate `lunora/import-convex.json` storage-column mapping (imports nothing)"],["lunora import ./snapshot.zip --with-storage --verify","Import a `npx convex export --path` zip snapshot with blob + row-parity checks"],["lunora import ./supabase-csv --from supabase","Import a directory of `COPY … TO STDOUT WITH CSV HEADER` dumps"],["lunora import ./firestore-json --from firebase --verify","Import Firestore documents (REST/Admin-SDK JSON) with row-parity checks"]],group:"Data",loader:()=>import("../packem_chunks/handler9.mjs").then(e=>({default:e.execute})),name:"import",options:[{description:"Source reader for a dump that cannot be detected: supabase | firebase (Convex and NDJSON are auto-detected)",name:"from",type:String},{description:"Wrap each bare doc as `{table:<name>,doc:...}`",name:"table",type:String},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"Also migrate file storage — Convex `_storage` blobs, or a Supabase/Firebase bucket (verified upload)",name:"with-storage",type:Boolean},{description:"Directory of storage objects to upload alongside the rows (Firebase: after `gcloud storage cp -r`)",name:"storage-dir",type:String},{description:"Write a candidate `lunora/import-convex.json` storage-column mapping and exit",name:"scan",type:Boolean},{description:"Verify row parity + dangling-storage after import (non-zero exit on mismatch)",name:"verify",type:Boolean},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Confirm bulk-writing production (required with --prod)",name:"yes",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},ae={description:"Print resolved project config: @lunora/* versions, wrangler summary, schema overview",examples:[["lunora info","Print resolved project config"],["lunora info --json","Emit a JSON snapshot"]],group:"Project",loader:()=>import("../packem_chunks/handler10.mjs").then(e=>({default:e.execute})),name:"info",options:[{description:"Emit a JSON snapshot instead of human text",name:"json",type:Boolean}]},ie={argument:{description:"Project name",name:"name",type:String},description:"Scaffold a new Lunora project",examples:[["lunora init my-app","Scaffold with the default (vite) template"],["lunora init my-app -t next","Scaffold a Next.js app"],["lunora init my-app -t tanstack-start-react","Scaffold a TanStack Start (React) app"],["lunora init my-app -t tanstack-start-solid","Scaffold a TanStack Start (Solid) app"],["lunora init my-app -t solid-v2","Scaffold a Solid 2.0 SPA"],["lunora init my-app --ref alpha","Scaffold from the alpha branch's templates"],["lunora init --here","Add Lunora to the current project"],["lunora init my-app --ci github","Scaffold + add a GitHub Actions deploy pipeline"],["lunora init my-app --ci gitlab","Scaffold + add a GitLab CI deploy pipeline"]],group:"Project",loader:()=>import("../packem_chunks/runInitCommand.mjs").then(e=>({default:e.execute})),name:"init",options:[{alias:"t",description:"Bespoke template (standalone | astro | next | nuxt | solid-v2 | sveltekit | tanstack-start-react | tanstack-start-solid | vinext | vinext-pages). For a Solid 1.x / React / Vue / Svelte SPA use --vite react|vue|solid|svelte.",name:"template",type:String},{description:"Scaffold via the create-vite overlay for a framework (react | vue | solid | svelte | vanilla) — official create-vite base + Lunora layer",name:"vite",type:String},{description:"Local templates root to copy from (offline-friendly; expects <type>/ subdirs)",name:"from",type:String},{description:"Override the remote template source (e.g. gh:owner/repo/sub#ref)",name:"source",type:String},{description:"Fetch templates from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https:// (e.g. local file://)",name:"allow-unsafe-source",type:Boolean},{description:"Add Lunora to the current project: detect the framework, patch the config, scaffold lunora/, print per-framework wiring steps",name:"here",type:Boolean},{alias:"i",description:"After scaffolding, offer to add auth + email (defaults on when stdin is a TTY)",name:"interactive",type:Boolean},{alias:"y",description:"Skip the auth/email offer; scaffold only",name:"yes",type:Boolean},{description:"Also scaffold a CI deploy pipeline: github (.github/workflows/deploy.yml) or gitlab (.gitlab-ci.yml)",name:"ci",type:String},{description:"Add features non-interactively after scaffolding (comma-separated): ai | auth | backup | browser | cloudflare-access | crons | email | flags | hyperdrive | payment | presence | queue | storage | workflow",name:"add",type:String},{description:"Walk through every step (prompts + output) without writing files, installing, or running git",name:"dry-run",type:Boolean}]},se={description:"Report write-conflict hot-spots, error rates, and latency outliers from a running Worker",examples:[["lunora insights","Report against the local dev worker"],["lunora insights --shard channel:demo","Scope the report to one shard"],["lunora insights --json","Emit the raw report as JSON"],["lunora insights --prod --url https://app.example.com --token $LUNORA_ADMIN_TOKEN","Report against production"]],group:"Develop",loader:()=>import("../packem_chunks/handler11.mjs").then(e=>({default:e.execute})),name:"insights",options:[{description:"Explicit shard key (defaults to the root shard)",name:"shard",type:String},{description:"Max rows per section (default 10)",name:"limit",type:String},{description:"Emit a JSON report instead of human text",name:"json",type:Boolean},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (or LUNORA_ADMIN_TOKEN)",name:"token",type:String}]},le={description:"Scaffold lunora/schema.ts (and list/get procedures) from an existing Postgres or MySQL database",examples:[["lunora introspect --url postgres://localhost/shop","Scaffold a schema + procedures from every table"],["lunora introspect --tables users,orders","Introspect only these tables (DATABASE_URL is read by default)"],["lunora introspect --dry-run","Print what would be written without touching the filesystem"],["lunora introspect --no-procedures --force","Regenerate just the schema, overwriting the existing file"]],group:"Data",loader:()=>import("../packem_chunks/handler25.mjs").then(e=>({default:e.execute})),name:"introspect",options:[{description:"Database connection string (default: $DATABASE_URL)",name:"url",type:String},{description:"Postgres schema (default `public`) or MySQL database name",name:"schema",type:String},{description:"Comma-separated table allow-list (default: every base table)",name:"tables",type:String},{description:"Also emit list/get procedure modules per table (default true; --no-procedures to skip)",name:"procedures",type:Boolean},{description:"Overwrite files that already exist",name:"force",type:Boolean},{description:"Print what would be written without writing it",name:"dry-run",type:Boolean}]},pe={description:"Link this checkout to its deployed Worker (writes .lunora/project.json)",examples:[["lunora link --url https://app.acme.workers.dev","Link to a deployed Worker URL"],["lunora link --url https://app.acme.workers.dev --env production","Link a named environment"],["lunora link --remove","Remove the link"]],group:"Deploy",loader:()=>import("../packem_chunks/handler12.mjs").then(e=>({default:e.execute})),name:"link",options:[{description:"Cloudflare environment name to record alongside the link",name:"env",type:String},{description:"Worker name (defaults to the `name` in wrangler config)",name:"name",type:String},{description:"Remove the existing link (.lunora/project.json)",name:"remove",type:Boolean},{description:"Deployed Worker URL to link (e.g. https://app.acme.workers.dev)",name:"url",type:String}]},de={argument:{description:"Worker name (defaults to the name in wrangler config)",name:"worker",type:String},description:"Stream live logs from a deployed Worker, or read the durable log archive with --durable",group:"Deploy",loader:()=>import("../packem_chunks/handler21.mjs").then(e=>({default:e.execute})),name:"logs",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Substring filter on log messages",name:"search",type:String},{description:"Filter by invocation status: ok, error, or canceled",name:"status",type:String},s,{description:"Tail a temporary-account deployment when unauthenticated (wrangler tail --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Read the durable log archive (pipelineLogSink → R2) via R2 SQL instead of tailing live",name:"durable",type:Boolean},{description:"durable: Iceberg table the Pipeline writes to (required with --durable)",name:"table",type:String},{description:"durable: Iceberg namespace (R2 Data Catalog database) the table lives in",name:"namespace",type:String},{description:"durable: lower time bound (epoch-millis or ISO 8601), inclusive",name:"since",type:String},{description:"durable: upper time bound (epoch-millis or ISO 8601), inclusive",name:"until",type:String},{description:"durable: exact severity filter (trace|debug|log|info|warn|error|fatal)",name:"level",type:String},{description:"durable: severity floor — this level and every more-severe one",name:"min-level",type:String},{description:"durable: keep function paths starting with this prefix (LIKE 'prefix%')",name:"function-prefix",type:String},{description:"durable: trace-id filter",name:"trace-id",type:String},{description:"durable: shard-key filter",name:"shard-key",type:String},{description:"durable: user-id filter",name:"user-id",type:String},{description:"durable: max rows (clamped to 1–10000; default 500)",name:"limit",type:String},{description:"durable: resume after a prior page — the opaque cursor token printed by the previous page (bare epoch-millis also accepted for back-compat)",name:"cursor",type:String},{description:"durable: emit one JSON object per line instead of a table",name:"ndjson",type:Boolean}]},ce={argument:{description:"install [client…] | uninstall [client…] | serve",name:"args",type:String},description:"Connect your AI editor to Lunora over MCP (docs search + this project's dev server)",examples:[["lunora mcp install","Install into every MCP client already configured here"],["lunora mcp install claude-code cursor","Install into specific clients"],["lunora mcp install --list","List the supported clients and their config files"],["lunora mcp install --docs-only","Install only the hosted documentation server"],["lunora mcp install --print","Show the config that would be written, without writing it"],["lunora mcp install --global","Force every server into the machine-wide config"],["lunora mcp uninstall","Remove Lunora's MCP servers from every supported client"],["lunora mcp uninstall cursor","Remove them from one client"],["lunora mcp uninstall --print","Show what would be removed, without removing it"],["lunora mcp serve","Run the stdio MCP server (this is what your editor spawns)"],["lunora mcp serve --allow-writes","Also expose the mutation/action tools"],["lunora mcp serve --token $LUNORA_ADMIN_TOKEN","Expose the observability tools (logs, issues, advisories, insights, migrations) too"]],group:"Develop",loader:()=>import("../packem_chunks/handler26.mjs").then(e=>({default:e.execute})),name:"mcp",options:[{description:"install: replace entries that already exist",name:"force",type:Boolean},{description:"install: list the supported clients and their config files",name:"list",type:Boolean},{description:"install/uninstall: print what would change instead of writing it",name:"print",type:Boolean},{description:"install/uninstall: only the hosted documentation server",name:"docs-only",type:Boolean},{description:"install/uninstall: only this project's local server",name:"local-only",type:Boolean},{description:"install/uninstall: the machine-wide config (install default: docs server global, local server per-project)",name:"global",type:Boolean},{description:"install/uninstall: this project's config instead of the machine-wide one",name:"project",type:Boolean},{description:"serve: also expose the mutation/action tools (default: read-only)",name:"allow-writes",type:Boolean},{description:"serve: skip the documentation tools",name:"no-docs",type:Boolean},{description:"Docs site origin backing the documentation tools (default https://lunora.sh)",name:"docs-url",type:String},{description:"serve: deployment URL to expose (default: the running dev server)",name:"url",type:String},{description:"serve: bearer token (default: LUNORA_ADMIN_TOKEN from the environment or .dev.vars). Also gates the observability tools (logs, issues, advisories, query insights, migration status) — without a token they are not exposed at all",name:"token",type:String}]},ue={argument:{description:"generate | create | up | down | status | d1-to-hyperdrive [name|id]",name:"subcommand",type:String},description:"Schema (generate), online data (create | up | down | status), and backend (d1-to-hyperdrive) migrations",examples:[["lunora migrate generate","Diff lunora/schema.ts and emit a SQL migration"],["lunora migrate create add_users_email","Scaffold a data migration"],["lunora migrate up backfill-names","Run a data migration across shards"],["lunora migrate status backfill-names","Report a migration's per-shard status"],["lunora migrate d1-to-hyperdrive --from-url https://old --to-url https://new","Copy .global() data from D1 to Hyperdrive"]],group:"Data",loader:()=>import("../packem_chunks/runMigrateGenerateCommand.mjs").then(e=>({default:e.execute})),name:"migrate",options:[{description:"Migration name slug (e.g. add_users_email)",name:"name",type:String},{description:"Target table for `create` (prompted for interactively when omitted)",name:"table",type:String},{description:"Preview a data migration without rewriting rows",name:"dry-run",type:Boolean},{description:"Rows per batch for a data migration",name:"batch-size",type:Number},{description:"Cap batches processed this run (maps to the runner's maxBatches)",name:"steps",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Required with --prod for up/down — confirms running against production",name:"yes",type:Boolean},{description:"d1-to-hyperdrive: source (D1) worker URL (defaults to --url)",name:"from-url",type:String},{description:"d1-to-hyperdrive: source admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"from-token",type:String},{description:"d1-to-hyperdrive: target (Hyperdrive) worker URL (defaults to --url)",name:"to-url",type:String},{description:"d1-to-hyperdrive: target admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"to-token",type:String},{description:"d1-to-hyperdrive: comma-separated .global() tables to move (default: all global tables)",name:"tables",type:String},{description:"d1-to-hyperdrive: keep the intermediate NDJSON dump at this path",name:"out",type:String}]},me={description:"Run codegen + binding reconcile + wrangler validation (no Vite) — for CI",examples:[["lunora prepare","Codegen + binding reconcile + validate (CI, before deploy)"]],group:"Deploy",loader:()=>import("../packem_chunks/handler13.mjs").then(e=>({default:e.execute})),name:"prepare",options:[{description:"Override the schema-drift gate (proceed even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},s,{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},ge={argument:{description:"<add|list|view|build> [item names…]",name:"args",type:String},description:"Component registry: add/list/view items, or build the catalog",examples:[["lunora registry list","List available registry items"],["lunora registry add presence","Scaffold a registry item into lunora/"],["lunora registry build --check","Verify the committed catalog is current"]],group:"Project",loader:()=>import("../packem_chunks/handler14.mjs").then(e=>({default:e.execute})),name:"registry",options:[{description:"add: print the plan and stop without writing",name:"dry-run",type:Boolean},{description:"add: preview the file changes (content diff) and write nothing",name:"diff",type:Boolean},{description:"add: force-overwrite existing files (take the incoming copy)",name:"overwrite",type:Boolean},{description:"add: skip the package.json mutation confirmation prompt",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Emit JSON output (add plan / list)",name:"json",type:Boolean},{description:"build: output path for the catalog (default <root>/index.json)",name:"out",type:String},{description:"build: verify the index is current instead of rewriting it",name:"check",type:Boolean}]},he={description:"Clear local Miniflare state (and .lunora-cache with --all)",examples:[["lunora reset","Clear local Miniflare state"],["lunora reset --all","Also remove .lunora-cache"]],group:"Develop",loader:()=>import("../packem_chunks/runResetCommand.mjs").then(e=>({default:e.execute})),name:"reset",options:[{description:"Also remove .lunora-cache",name:"all",type:Boolean},{description:"Skip the confirmation prompt (required when stdin is not a TTY)",name:"yes",type:Boolean}]},fe={argument:{description:"install | check",name:"subcommand",type:String},description:"Install the Lunora agent skills (AI rules) into .agents/skills/, or check they're present",examples:[["lunora rules install","Copy the Lunora agent skills into .agents/skills/"],["lunora rules install --overwrite","Reinstall, replacing edited skill files"],["lunora rules check","Report which Lunora skills are installed"],["lunora rules check --strict","Exit non-zero when rules are missing (CI gate)"],["lunora rules install --dir packages/app","Install into a specific root instead of the workspace root"]],group:"Project",loader:()=>import("../packem_chunks/handler15.mjs").then(e=>({default:e.execute})),name:"rules",options:[{description:"Install/check root (default: the detected workspace root, not the current directory)",name:"dir",type:String},{description:"install: overwrite skill files that already exist (default: skip them)",name:"overwrite",type:Boolean},{description:"check: exit non-zero when the rules are missing (for CI gating)",name:"strict",type:Boolean}]},ye={argument:{description:"Function path (e.g. messages:send)",name:"functionPath",type:String},description:"Send a single RPC to a running Lunora Worker",examples:[[`lunora run messages:send --args '{"text":"hi"}'`,"Call a function with JSON args"],["lunora run messages:list --shard channel:demo","Target a specific shard"],["lunora run messages:list --as user_123","Run as an authenticated user (needed when the app gates on identity)"]],group:"Develop",loader:()=>import("../packem_chunks/runRpcCommand.mjs").then(e=>({default:e.execute})),name:"run",options:[{description:"JSON-encoded args object",name:"args",type:String},{description:"Run as this user id — dispatches through the admin-gated `runAs` op so identity-gated apps accept the call",name:"as",type:String},{description:`JSON-encoded extra identity claims to forge alongside --as (e.g. '{"org":"acme"}')`,name:"claims",type:String},{description:"Explicit shard key",name:"shard",type:String},{description:"Worker URL (defaults to the running dev server, else http://localhost:8787)",name:"url",type:String},{description:"Admin bearer for --as (prefer LUNORA_ADMIN_TOKEN or .dev.vars; --token is visible to other local processes via the process table)",name:"token",type:String}]},ve={argument:{description:"<generate>",name:"args",type:String},description:"Generate a self-contained typed client SDK for another language from the project's OpenRPC surface",examples:[["lunora sdk generate --lang python","Emit a Python SDK, transport included, into ./sdk/python"],["lunora sdk generate --lang go --out ./clients/go","Choose the language and output directory"],["lunora sdk generate --lang dart","A Flutter-ready Dart client — live queries arrive as a Stream"],["lunora sdk generate --lang kotlin","Any of the registered targets; --lang lists them"],["lunora sdk generate --lang rust --from ./sdks","Copy the transport from a local checkout instead of fetching it"]],group:"Project",loader:()=>import("../packem_chunks/handler22.mjs").then(e=>({default:e.execute})),name:"sdk",options:[{description:`Target language: ${P.join(" | ")}`,name:"lang",type:String},{description:"Output directory (default ./sdk/<lang>)",name:"out",type:String},{description:"Path to the OpenRPC document (default ./lunora/_generated/openrpc.json)",name:"spec",type:String},{description:"Copy the transport from a local directory of per-language transports (the repo's `sdks/`) instead of fetching it",name:"from",type:String},{description:"Git ref to fetch the transport from (default: this CLI's own release tag, so the transport matches the generated surface)",name:"ref",type:String},{description:"Override the remote transport source base (default gh:anolilab/lunora/sdks)",name:"source",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean}]},be={description:"Generate deterministic fake data from lunora/schema.ts and bulk-insert it via the worker's admin endpoint",examples:[["lunora seed","Seed every table with the default row count"],["lunora seed --table posts --count 50","Seed 50 posts; FK-parent tables are seeded automatically"],["lunora seed --reset","Wipe local .wrangler/state, then seed from scratch"],["lunora seed --seed 7 --dry-run","Print the NDJSON for seed 7 without inserting"],["lunora seed --seed 7 --now 1785000000000","Byte-identical rows across runs (pins the clock too)"]],group:"Data",loader:()=>import("../packem_chunks/handler16.mjs").then(e=>({default:e.execute})),name:"seed",options:[{description:"Rows per table (default 10)",name:"count",type:Number},{description:"Seed only this table; its FK-parent tables are seeded automatically",name:"table",type:String},{description:"Deterministic seed — same value yields identical rows (default 0)",name:"seed",type:Number},{description:"Epoch-ms reference for time columns (createdAt, expiresAt, …). Pin it with --seed for byte-identical rows across runs; defaults to now",name:"now",type:Number},{description:"Print the generated NDJSON instead of inserting",name:"dry-run",type:Boolean},{description:"Wipe local .wrangler/state before seeding (local dev only)",name:"reset",type:Boolean},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Skip the confirmation prompt when seeding a non-local/production target",name:"yes",type:Boolean}]},we={description:"Validate wrangler.jsonc + codegen dry-run + tsc --noEmit (no files written)",examples:[["lunora verify","Validate wrangler + codegen + tsc"],["lunora verify --no-typecheck","Skip the TypeScript type-check"],["lunora verify --health-url https://my-app.workers.dev","Also probe the deployment's /_lunora/health"]],group:"Deploy",loader:()=>import("../packem_chunks/handler17.mjs").then(e=>({default:e.execute})),name:"verify",options:[{description:"Treat breaking schema drift as a warning instead of a failure",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Probe this deployment's /_lunora/health endpoint (off by default; keeps verify offline-safe)",name:"health-url",type:String},{description:"Skip the TypeScript type-check step",name:"no-typecheck",type:Boolean},s]},Se={description:"Open the Lunora studio in your browser (local dev by default, --remote for production)",examples:[["lunora view","Open the studio for local dev"],["lunora view --remote","Open the deployed studio"]],group:"Project",loader:()=>import("../packem_chunks/handler18.mjs").then(e=>({default:e.execute})),name:"view",options:[{description:"Open the deployed worker URL instead of localhost",name:"remote",type:Boolean}]},ke={filterStacktrace:()=>!1,hideErrorCodeView:!0},xe=(e,t={})=>{const r=e instanceof Error?e.message:String(e),o=E(S(e)?{code:e.code,hint:e.hint,message:r}:r),n=new U({hint:o===void 0?void 0:L(o).split(`
2
+ `),message:t.reason===void 0?r:`${t.reason}: ${r}`,name:e instanceof Error&&e.name.length>0?e.name:"Error"});return n.stack="",M(n,ke)},Ce=(e,t)=>{const r=Array.from({length:t.length+1},(o,n)=>n);for(let o=1;o<=e.length;o+=1){let n=r[0]??0;r[0]=o;for(let a=1;a<=t.length;a+=1){const i=r[a]??0,d=e[o-1]===t[a-1]?0:1;r[a]=Math.min((r[a-1]??0)+1,i+1,n+d),n=i}}return r[t.length]??0},Ne=(e,t)=>{let r,o=Number.POSITIVE_INFINITY;for(const a of t){const i=Ce(e,a);i<o&&(o=i,r=a)}const n=Math.max(2,Math.ceil(e.length/3));return r!==void 0&&o<=n?r:void 0},Re=e=>`https://registry.npmjs.org/@lunora/cli/${e}`,Oe=1440*60*1e3,Ae=1500,De="0.0.0",Be=/^v/u,Ee=new Set(["alpha","beta","next"]),m=e=>{const t=e.trim().replace(Be,""),r=t.indexOf("-");return r===-1?{core:t,prerelease:""}:{core:t.slice(0,r),prerelease:t.slice(r+1)}},v=e=>{const[t,r,o]=m(e).core.split(".").map(n=>{const a=Number.parseInt(n,10);return Number.isFinite(a)?a:0});return[t??0,r??0,o??0]},Le=(e,t)=>{const r=Number.parseInt(e,10),o=Number.parseInt(t,10);return String(r)===e&&String(o)===t?r>o?1:-1:e>t?1:-1},_e=(e,t)=>{if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;const r=e.split("."),o=t.split(".");for(let n=0;n<Math.max(r.length,o.length);n+=1){const a=r[n],i=o[n];if(a===void 0||i===void 0)return a===void 0?-1:1;if(a!==i)return Le(a,i)}return 0},Ie=(e,t)=>{const r=v(e),o=v(t);for(let n=0;n<3;n+=1)if((r[n]??0)!==(o[n]??0))return(r[n]??0)>(o[n]??0)?1:-1;return _e(m(e).prerelease,m(t).prerelease)},je=e=>{const t=m(e).prerelease.split(".")[0]??"";return Ee.has(t)?t:"latest"},Te=(e,t)=>Ie(t,e)>0,Pe=(e,t,r)=>t-e<r,Ue=(e,t,r="latest",o)=>{const n=`Update available for @lunora/cli: ${e} → ${t}`;if(o===void 0)return`${n} — add @lunora/cli@${r} as a dev dependency to update`;const{args:a,command:i}=K(o,[`@lunora/cli@${r}`],{dev:!0});return`${n} — run \`${i} ${a.join(" ")}\``},x=e=>u(e,"lunora-cli-update.json"),Me=e=>{const t=e.XDG_CACHE_HOME&&e.XDG_CACHE_HOME.length>0?e.XDG_CACHE_HOME:u(W(),".cache"),r=u(t,"lunora");try{O(r,{mode:448,recursive:!0})}catch{}return r},We=e=>{try{const t=JSON.parse(w(x(e),"utf8"));if(t!==null&&typeof t=="object"){const{checkedAt:r,latest:o}=t;if(typeof o=="string"&&typeof r=="number"){const{tag:n}=t;return{checkedAt:r,latest:o,...typeof n=="string"?{tag:n}:{}}}}}catch{}},b=(e,t)=>{try{const r=x(e);try{if(A(r).isSymbolicLink())return}catch{}D(r,`${JSON.stringify(t)}
3
+ `,"utf8")}catch{}},Ke=async(e,t)=>{try{const r=await e(Re(t),{signal:AbortSignal.timeout(Ae)});if(!r.ok)return;const o=await r.json(),n=o!==null&&typeof o=="object"?o.version:void 0;return typeof n=="string"?n:void 0}catch{return}},Je=(e,t,r)=>e===De||!r||t.CI!==void 0||t.LUNORA_NO_UPDATE_NOTIFIER!==void 0,Fe=async e=>{const t=e.env??process.env,r=e.isTTY??process.stdout.isTTY;if(Je(e.current,t,r))return;const o=e.cacheDir??Me(t),n=(e.now??Date.now)(),a=e.ttlMs??Oe,i=je(e.current),d=We(o),R=d?.tag??"latest",g=d!==void 0&&R===i?d:void 0;let c=g?.latest;if(g===void 0||!Pe(g.checkedAt,n,a)){const h=await Ke(e.fetchImpl??globalThis.fetch,i);h===void 0?b(o,{checkedAt:n,latest:e.current,tag:i}):(c=h,b(o,{checkedAt:n,latest:h,tag:i}))}c!==void 0&&Te(e.current,c)&&e.logger.warn(Ue(e.current,c,i,e.manager))},He=["init","add","dev","codegen","build","deploy","containers","prepare","link","deployments","logs","run","insights","reset","migrate","export","import","seed","backup","eval","verify","info","doctor","env","analyze","view","docs","registry","rules","mcp"],$e=8,Ve=()=>{try{let e=f(B(import.meta.url));for(let t=0;t<$e;t+=1){try{const o=JSON.parse(w(u(e,"package.json"),"utf8")),n=o!==null&&typeof o=="object"?o:void 0;if(n?.name==="@lunora/cli"&&typeof n.version=="string"&&n.version.length>0)return n.version}catch{}const r=f(e);if(r===e)break;e=r}}catch{}return"0.0.0"},C=Ve(),Ge=[ie,F,X,q,H,G,Y,z,me,pe,Q,de,ye,se,he,ue,oe,ne,be,le,V,re,we,ae,ee,te,$,Se,Z,ge,fe,ce,ve],N=[...Ge,T,j],mt=N.map(e=>e.name),l=e=>e.replaceAll("{",String.raw`\{`).replaceAll("}",String.raw`\}`),qe=e=>e.every(t=>typeof t=="string")?e.map(t=>l(t)):e.map(t=>typeof t=="string"?[l(t)]:t.map(r=>l(r))),ze=e=>({...e,...e.argument===void 0?{}:{argument:{...e.argument,description:l(e.argument.description??"")}},...e.description===void 0?{}:{description:l(e.description)},...e.examples===void 0?{}:{examples:qe(e.examples)},...e.options===void 0?{}:{options:e.options.map(t=>({...t,description:l(t.description??"")}))}}),Ye=e=>{const t={value:0},r=I("lunora",{argv:e.argv===void 0?void 0:[...e.argv],cwd:e.cwd,exit:o=>{t.value=typeof o=="number"?o:0},logger:e.logger,packageName:"@lunora/cli",packageVersion:C});for(const o of N)r.addCommand(ze(o));return{cli:r,exitCode:t}},Qe=/Command "(?<name>[^"]+)" not found/u,Xe=e=>{const t=k(),r=e instanceof Error?e.message:String(e),o=Qe.exec(r);if(!o?.groups){S(e)||_(r)!==void 0?t.error(xe(e)):t.error(r);return}const n=o.groups.name??"",a=Ne(n,He);t.error(`Unknown command "${n}".${a===void 0?"":` Did you mean "${a}"?`}`),t.info("Run `lunora --help` to list commands, or `lunora docs` to open the documentation.")},gt=async(e={})=>{const{cli:t,exitCode:r}=Ye(e);try{await t.run({shouldExitProcess:!1})}catch(n){return Xe(n),1}let o;try{o=J(process.cwd())}catch{}return await Fe({current:C,logger:k(),manager:o}),r.value};export{He as C,y as D,mt as R,C as V,gt as r};
@@ -1,6 +1,6 @@
1
- import{existsSync as m,readFileSync as h,writeFileSync as $,mkdirSync as S,lstatSync as q}from"node:fs";import{join as l,relative as J,dirname as w}from"@visulima/path";import{i as U,d as G}from"./detect-package-manager-DSaAqRof.mjs";import{DEV_VARS_FILE as H,parseDevVariableEntries as Y,writeDevVariablesFileAtomically as z}from"@lunora/config";import{modify as F,applyEdits as T,parse as X}from"jsonc-parser";import{d as Q,s as j,e as Z,f as K,c as ee,g as ne}from"./resolve-DZAGzg67.mjs";import{b as te}from"./tui-prompts-Dd0pDuNr.mjs";import{collectCatalog as re,buildRegistryIndex as se}from"./buildRegistryIndex-Zi3bBqpc.mjs";import{findWranglerFile as ie,readWranglerJsonc as oe}from"@lunora/config/cloudflare";import{LunoraError as x}from"@lunora/errors";import{insertSchemaExtension as ae}from"./insertSchemaExtension-DY4pA8wE.mjs";import{createHash as ce}from"node:crypto";const C=e=>{if(!e.startsWith("workspace:"))return e;const n=e.slice(10);return n===""||n==="*"||n==="^"||n==="~"?Q():n},de=new Set(["@lunora/client","@lunora/do","@lunora/ratelimit","@lunora/runtime","@lunora/server","@lunora/values"]),ue=/(['"])@lunora\/(client|do|ratelimit|runtime|server|values)(\/[^'"]*)?\1/gu,fe=e=>{const n=l(e,"package.json");if(!m(n))return!1;try{const t=JSON.parse(h(n,"utf8"));return t.dependencies?.lunorash!==void 0||t.devDependencies?.lunorash!==void 0}catch{return!1}},le=e=>e.replaceAll(ue,(n,t,i,r)=>`${t}lunorash/${i}${r??""}${t}`),O=(e,n,t,i="dependencies",r=!1)=>{const s=Object.entries(e);if(s.length===0)return[];const o=l(n,"package.json");if(!m(o))return t.warn(`package.json not found at ${o} — skipping dependency updates`),[];let a=h(o,"utf8");const c=JSON.parse(a),d=[];for(const[u,f]of s){if(r&&de.has(u)){t.info(`dep provided by the lunorash umbrella, skipping: ${u}`);continue}if(c.dependencies?.[u]!==void 0||c.devDependencies?.[u]!==void 0){t.info(`dep already present: ${u}`);continue}const p=F(a,[i,u],C(f),{formattingOptions:{insertSpaces:!0,tabSize:4}});a=T(a,p),d.push(u)}return d.length>0&&($(o,a,"utf8"),t.success(`added ${String(d.length)} ${i==="devDependencies"?"devDependency(ies)":"dependency(ies)"} to package.json: ${d.join(", ")}`)),d},pe=(e,n,t)=>{if(e.length===0)return[];const i=l(n,H),r=m(i)?h(i,"utf8"):"",s=new Set(Y(r).map(d=>d.key)),o=[],a=[],c=[];for(const d of e)d.secret&&a.push(d.name),!s.has(d.name)&&(d.description&&c.push(`# ${d.description}`),c.push(`${d.name}=${d.secret?"":d.value??""}`),o.push(d.name));if(o.length>0){const d=r===""||r.endsWith(`
1
+ import{existsSync as m,readFileSync as h,writeFileSync as $,mkdirSync as S,lstatSync as q}from"node:fs";import{join as l,relative as J,dirname as w}from"@visulima/path";import{DEV_VARS_FILE as U,parseDevVariableEntries as G,writeDevVariablesFileAtomically as H,installArgsFor as Y,detectPackageManager as z}from"@lunora/config";import{modify as F,applyEdits as T,parse as X}from"jsonc-parser";import{d as Q,s as j,e as Z,f as K,c as ee,g as ne}from"./resolve-DZAGzg67.mjs";import{b as te}from"./tui-prompts-Dd0pDuNr.mjs";import{collectCatalog as re,buildRegistryIndex as se}from"./buildRegistryIndex-Zi3bBqpc.mjs";import{findWranglerFile as ie,readWranglerJsonc as oe}from"@lunora/config/cloudflare";import{LunoraError as x}from"@lunora/errors";import{insertSchemaExtension as ae}from"./insertSchemaExtension-DY4pA8wE.mjs";import{createHash as ce}from"node:crypto";const C=e=>{if(!e.startsWith("workspace:"))return e;const n=e.slice(10);return n===""||n==="*"||n==="^"||n==="~"?Q():n},de=new Set(["@lunora/client","@lunora/do","@lunora/ratelimit","@lunora/runtime","@lunora/server","@lunora/values"]),ue=/(['"])@lunora\/(client|do|ratelimit|runtime|server|values)(\/[^'"]*)?\1/gu,fe=e=>{const n=l(e,"package.json");if(!m(n))return!1;try{const t=JSON.parse(h(n,"utf8"));return t.dependencies?.lunorash!==void 0||t.devDependencies?.lunorash!==void 0}catch{return!1}},le=e=>e.replaceAll(ue,(n,t,i,r)=>`${t}lunorash/${i}${r??""}${t}`),O=(e,n,t,i="dependencies",r=!1)=>{const s=Object.entries(e);if(s.length===0)return[];const o=l(n,"package.json");if(!m(o))return t.warn(`package.json not found at ${o} — skipping dependency updates`),[];let a=h(o,"utf8");const c=JSON.parse(a),d=[];for(const[u,f]of s){if(r&&de.has(u)){t.info(`dep provided by the lunorash umbrella, skipping: ${u}`);continue}if(c.dependencies?.[u]!==void 0||c.devDependencies?.[u]!==void 0){t.info(`dep already present: ${u}`);continue}const p=F(a,[i,u],C(f),{formattingOptions:{insertSpaces:!0,tabSize:4}});a=T(a,p),d.push(u)}return d.length>0&&($(o,a,"utf8"),t.success(`added ${String(d.length)} ${i==="devDependencies"?"devDependency(ies)":"dependency(ies)"} to package.json: ${d.join(", ")}`)),d},pe=(e,n,t)=>{if(e.length===0)return[];const i=l(n,U),r=m(i)?h(i,"utf8"):"",s=new Set(G(r).map(d=>d.key)),o=[],a=[],c=[];for(const d of e)d.secret&&a.push(d.name),!s.has(d.name)&&(d.description&&c.push(`# ${d.description}`),c.push(`${d.name}=${d.secret?"":d.value??""}`),o.push(d.name));if(o.length>0){const d=r===""||r.endsWith(`
2
2
  `)?r:`${r}
3
- `;z(i,`${d}${c.join(`
3
+ `;H(i,`${d}${c.join(`
4
4
  `)}
5
5
  `),t.success(`scaffolded ${String(o.length)} env var(s) into .dev.vars: ${o.join(", ")}`)}return a.length>0&&t.info(`set secret value(s) locally in .dev.vars, then for production: ${a.map(d=>`wrangler secret put ${d}`).join("; ")}`),o},R=new Set(["ai","analytics_engine_datasets","browser","d1_databases","durable_objects","hyperdrive","kv_namespaces","mtls_certificates","queues","r2_buckets","send_email","services","vars","vectorize","version_metadata","workflows"]),me=["binding","name","queue","pattern"],D=e=>{if(!(typeof e!="object"||e===null))for(const n of me){const t=e[n];if(typeof t=="string"&&t.length>0)return`${n}:${t}`}},he=(e,n,t,i)=>{const r=new Set(e.map(a=>JSON.stringify(a))),s=new Set(e.map(a=>D(a)).filter(a=>a!==void 0)),o=[];for(const a of n){if(r.has(JSON.stringify(a)))continue;const c=D(a);if(c!==void 0&&s.has(c)){i.warn(`${c.replace(":"," ")} already exists in ${t} — keeping the project's entry and skipping the registry item's. Reconcile by hand if the item needs different settings.`);continue}c!==void 0&&s.add(c),o.push(a)}return o},N=e=>Array.isArray(e),ge=(e,n)=>{let t=X(e);for(const i of n){if(typeof t!="object"||t===null)return;t=t[i]}return t},$e=(e,n)=>{const t=e[0];return t!==void 0&&R.has(t)?!0:(n.warn(`skipping binding "${e.join(".")}" — only resource bindings (${[...R].join(", ")}) may be written, not exec/entrypoint keys`),!1)},B=Symbol("skip-binding"),ve=(e,n,t)=>{const{value:i}=n;if(!N(i))return i;const r=ge(e,n.path);if(!N(r))return i;const s=he(r,i,n.path.join("."),t);return s.length===0?B:[...r,...s]},ye=(e,n,t)=>{if(e.length===0)return[];const r=["wrangler.jsonc","wrangler.json"].map(a=>l(n,a)).find(a=>m(a));if(!r)return t.warn("wrangler.jsonc not found — skipping binding updates"),[];let s=h(r,"utf8");const o=[];for(const a of e){if(!$e(a.path,t))continue;const c=ve(s,a,t);if(c===B)continue;const d=F(s,[...a.path],c,{formattingOptions:{insertSpaces:!0,tabSize:4}});d.length!==0&&(s=T(s,d),o.push(a.path.join(".")))}return o.length>0&&($(r,s,"utf8"),t.success(`applied ${String(o.length)} binding(s) to ${r}: ${o.join(", ")}`)),o},we=(e,n,t,i=!1)=>{const r=[],s=[];return e.deps&&r.push(...O(e.deps,n,t,"dependencies",i)),e.devDependencies&&r.push(...O(e.devDependencies,n,t,"devDependencies",i)),e.bindings&&s.push(...ye(e.bindings,n,t)),e.envVars&&pe(e.envVars,n,t),{bindings:s,deps:r}},ke=async(e,n)=>{const t=e.some(({manifest:d})=>Object.keys(d.deps??{}).length>0||Object.keys(d.devDependencies??{}).length>0),i=e.some(({manifest:d})=>(d.bindings??[]).length>0),r=n.source!==void 0&&n.source.length>0;if(!t&&!i&&!r||n.yes)return!0;const s=[];t&&s.push("add dependencies to package.json"),i&&s.push("write wrangler.jsonc bindings"),r&&s.push(`come from a non-default source (${String(n.source)})`);const o=s.join(", ");if(!process.stdin.isTTY&&n.confirm===void 0)return n.logger.error(`add: stdin is not a TTY and the requested items ${o} — re-run with --yes to confirm`),!1;const c=await(n.confirm??te)(`The requested items ${o}. Continue?`);return c||n.logger.info("add: aborted"),c},b=1,be=".lunora-registry.json",V=e=>l(e,"lunora",be),Se=e=>typeof e!="object"||e===null||!("items"in e)?!1:typeof e.items=="object"&&e.items!==null,y=e=>ce("sha256").update(e).digest("hex"),xe=e=>{const n=V(e);if(!m(n))return{items:{},version:b};try{const t=JSON.parse(h(n,"utf8"));if(Se(t))return{items:t.items,version:b}}catch{}return{items:{},version:b}},je=(e,n)=>{$(V(e),`${JSON.stringify(n,void 0,2)}
6
6
  `,"utf8")},A=(e,n,t,i)=>{const r=e.items[n]??{files:{}};e.items[n]=r,r.files[t]=y(i)},Ee=(e,n,t)=>e.items[n]?.files[t],_=3,L=e=>e===""?[]:e.split(`
@@ -12,8 +12,8 @@ export const schema = defineSchema({});
12
12
  `)?"":`
13
13
  `;return $(r.entryPath,`${r.source}${o}${s.join(`
14
14
  `)}
15
- `,"utf8"),t.success(`wrote ${String(s.length)} entrypoint re-export(s) to ${J(n,r.entryPath)}`),s.length},I=(e,n,t,i={})=>{const r=[],s=[],o=[],a=[],c=xe(n),d=fe(n);for(const{directory:u,manifest:f}of e){for(const g of f.files){const v=_e(g,f.name,u,n,t,c,i,d);(v.kind==="written"?r:s).push(v.path)}if(f.entrypointReexports!==void 0&&Te(f.entrypointReexports,n,t,i.diff===!0),i.diff)continue;const p=we(f,n,t,d);o.push(...p.deps),a.push(...p.bindings)}return!i.diff&&Object.keys(c.items).length>0&&je(n,c),{bindings:a,deps:o,skipped:s,written:r}},k=()=>({bindings:[],code:0,deps:[],skipped:[],written:[]}),nn=(e,n,t,i,r)=>e.bindings?{...e,bindings:e.bindings.map(s=>{if(s.path[0]!==n||!Array.isArray(s.value))return s;const o=s.value;return{...s,value:o.map(a=>typeof a=="object"&&a!==null&&a[t.key]===t.value?{...a,[i]:r}:a)}})}:e,W=(e,n)=>{const t=n.title??n.description;e.info(`plan: ${n.name}${t?` — ${t}`:""}`);for(const s of n.files)e.info(` file ${s.to} (${s.merge})`);const i=new Map,r=s=>{const o=i.get(s);if(o!==void 0)return o;const a=C(s);return i.set(s,a),a};for(const[s,o]of Object.entries(n.deps??{}))e.info(` dep ${s}@${r(o)}`);for(const[s,o]of Object.entries(n.devDependencies??{}))e.info(` dev ${s}@${r(o)}`);for(const s of n.bindings??[])e.info(` bind ${s.path.join(".")} = ${JSON.stringify(s.value)}`);for(const s of n.envVars??[]){const o=s.secret?" (secret)":` = ${JSON.stringify(s.value??"")}`;e.info(` env ${s.name}${o}`)}for(const s of n.entrypointReexports??[]){const o=`./lunora/${s.module}`,a=s.comment?` // ${s.comment}`:"";e.info(` entry ${o}${a}`)}},Ce=e=>{const n=e.map(({manifest:t})=>({bindings:(t.bindings??[]).map(i=>({path:i.path.join("."),value:i.value})),deps:Object.keys(t.deps??{}),devDependencies:Object.keys(t.devDependencies??{}),entrypointReexports:(t.entrypointReexports??[]).map(i=>({module:i.module,...i.comment?{comment:i.comment}:{}})),envVars:(t.envVars??[]).map(i=>({name:i.name,...i.secret?{secret:!0}:{value:i.value??""}})),files:t.files.map(i=>({merge:i.merge,to:i.to})),name:t.name,requires:t.requires??[],title:t.title}));process.stdout.write(`${JSON.stringify({items:n},void 0,2)}
16
- `)},Be=e=>{try{const{args:n,command:t}=U(G(e));return`${t} ${n.join(" ")}`}catch{return"<your-package-manager> install"}},Ve=(e,n,t,i,r,s)=>{r.success(`add complete: ${String(t)} written, ${String(i)} skipped`),r.info("next steps:"),r.info(" lunora codegen # regenerate _generated/ so the new tables/functions appear"),n.length>0&&r.info(` ${Be(s)} # install newly-added dependencies`);for(const{manifest:o}of e)o.docs&&r.info(`${o.name}: ${o.docs}`)},We=async e=>{const n=k(),t=j("list",e);if(t)return e.logger.error(t),{...n,code:1};let i=()=>{};try{const r=await K(e);i=r.cleanup;const s=re(r.root);if(e.json)return process.stdout.write(`${JSON.stringify(s,void 0,2)}
17
- `),n;e.logger.info(`available registry items (${String(s.length)}):`);for(const o of s)e.logger.info(` ${o.name}${o.description?` — ${o.description}`:""}`);return n}catch(r){return e.logger.error(`list failed: ${r instanceof Error?r.message:String(r)}`),{...n,code:1}}finally{i()}},tn=async e=>{const n=e.cwd??process.cwd(),t=k();if(e.list)return We(e);if(e.names.length===0)return e.logger.error("add requires at least one item name. Usage: lunora registry add <name> [...names]"),{...t,code:1};const i=j("add",e);if(i)return e.logger.error(i),{...t,code:1};let r=[];try{const{cleanups:s,items:o}=await Z(e.names,e);r=s;const{transformManifest:a}=e,c=a?o.map(g=>({...g,manifest:a(g.manifest)})):o;for(const{manifest:g}of c)W(e.logger,g);if(e.json&&Ce(c),e.dryRun)return e.logger.info("dry-run: stopping before any files are written"),t;if(e.diff)return I(c,n,e.logger,{diff:!0}),e.logger.info("diff: preview only — re-run without --diff to apply"),t;if(!await ke(c,e))return{...t,code:1};const{bindings:d,deps:u,skipped:f,written:p}=I(c,n,e.logger,{overwrite:e.overwrite});return Ve(c,u,p.length,f.length,e.logger,n),{bindings:d,code:0,deps:u,skipped:f,written:p}}catch(s){return e.logger.error(`add failed: ${s instanceof Error?s.message:String(s)}`),{...t,code:1}}finally{for(const s of r)s()}},rn=async e=>{const n=k();if(e.names.length===0)return e.logger.error("view requires an item name. Usage: lunora registry view <name>"),{...n,code:1};const t=j("view",e);if(t)return e.logger.error(t),{...n,code:1};const i=[];try{for(const r of e.names){const{cleanup:s,directory:o}=await ee(r,e);i.push(s);const a=ne(o,r);W(e.logger,a);for(const c of a.files){e.logger.info(`--- ${c.to} (${c.merge}) ---`);const d=E(o,c,!1,r);for(const u of d.split(`
18
- `))e.logger.info(u)}}return n}catch(r){return e.logger.error(`view failed: ${r instanceof Error?r.message:String(r)}`),{...n,code:1}}finally{for(const r of i)r()}},sn=async e=>{const n=k(),t=e.from;if(t===void 0)return e.logger.error("registry build requires --from <registry root>"),{...n,code:1};if(!m(t))return e.logger.error(`registry root not found: ${t}`),{...n,code:1};const i=se(t),r=e.out??l(t,"index.json");if(e.check){const s=m(r)?JSON.parse(h(r,"utf8")):{items:[]};return JSON.stringify(s.items??[])!==JSON.stringify(i.items)?(e.logger.error(`registry: ${r} is stale — run \`lunora registry build\` to regenerate it`),{...n,code:1}):(e.logger.success(`registry: ${r} is up to date (${String(i.items.length)} items)`),n)}return $(r,`${JSON.stringify({$schema:"./schema/registry.schema.json",...i},void 0,4)}
19
- `,"utf8"),e.logger.success(`registry: wrote ${r} (${String(i.items.length)} items)`),n};export{sn as a,rn as b,tn as r,nn as s};
15
+ `,"utf8"),t.success(`wrote ${String(s.length)} entrypoint re-export(s) to ${J(n,r.entryPath)}`),s.length},I=(e,n,t,i={})=>{const r=[],s=[],o=[],a=[],c=xe(n),d=fe(n);for(const{directory:u,manifest:f}of e){for(const g of f.files){const v=_e(g,f.name,u,n,t,c,i,d);(v.kind==="written"?r:s).push(v.path)}if(f.entrypointReexports!==void 0&&Te(f.entrypointReexports,n,t,i.diff===!0),i.diff)continue;const p=we(f,n,t,d);o.push(...p.deps),a.push(...p.bindings)}return!i.diff&&Object.keys(c.items).length>0&&je(n,c),{bindings:a,deps:o,skipped:s,written:r}},k=()=>({bindings:[],code:0,deps:[],skipped:[],written:[]}),en=(e,n,t,i,r)=>e.bindings?{...e,bindings:e.bindings.map(s=>{if(s.path[0]!==n||!Array.isArray(s.value))return s;const o=s.value;return{...s,value:o.map(a=>typeof a=="object"&&a!==null&&a[t.key]===t.value?{...a,[i]:r}:a)}})}:e,W=(e,n)=>{const t=n.title??n.description;e.info(`plan: ${n.name}${t?` — ${t}`:""}`);for(const s of n.files)e.info(` file ${s.to} (${s.merge})`);const i=new Map,r=s=>{const o=i.get(s);if(o!==void 0)return o;const a=C(s);return i.set(s,a),a};for(const[s,o]of Object.entries(n.deps??{}))e.info(` dep ${s}@${r(o)}`);for(const[s,o]of Object.entries(n.devDependencies??{}))e.info(` dev ${s}@${r(o)}`);for(const s of n.bindings??[])e.info(` bind ${s.path.join(".")} = ${JSON.stringify(s.value)}`);for(const s of n.envVars??[]){const o=s.secret?" (secret)":` = ${JSON.stringify(s.value??"")}`;e.info(` env ${s.name}${o}`)}for(const s of n.entrypointReexports??[]){const o=`./lunora/${s.module}`,a=s.comment?` // ${s.comment}`:"";e.info(` entry ${o}${a}`)}},Ce=e=>{const n=e.map(({manifest:t})=>({bindings:(t.bindings??[]).map(i=>({path:i.path.join("."),value:i.value})),deps:Object.keys(t.deps??{}),devDependencies:Object.keys(t.devDependencies??{}),entrypointReexports:(t.entrypointReexports??[]).map(i=>({module:i.module,...i.comment?{comment:i.comment}:{}})),envVars:(t.envVars??[]).map(i=>({name:i.name,...i.secret?{secret:!0}:{value:i.value??""}})),files:t.files.map(i=>({merge:i.merge,to:i.to})),name:t.name,requires:t.requires??[],title:t.title}));process.stdout.write(`${JSON.stringify({items:n},void 0,2)}
16
+ `)},Be=e=>{try{const{args:n,command:t}=Y(z(e));return`${t} ${n.join(" ")}`}catch{return"<your-package-manager> install"}},Ve=(e,n,t,i,r,s)=>{r.success(`add complete: ${String(t)} written, ${String(i)} skipped`),r.info("next steps:"),r.info(" lunora codegen # regenerate _generated/ so the new tables/functions appear"),n.length>0&&r.info(` ${Be(s)} # install newly-added dependencies`);for(const{manifest:o}of e)o.docs&&r.info(`${o.name}: ${o.docs}`)},We=async e=>{const n=k(),t=j("list",e);if(t)return e.logger.error(t),{...n,code:1};let i=()=>{};try{const r=await K(e);i=r.cleanup;const s=re(r.root);if(e.json)return process.stdout.write(`${JSON.stringify(s,void 0,2)}
17
+ `),n;e.logger.info(`available registry items (${String(s.length)}):`);for(const o of s)e.logger.info(` ${o.name}${o.description?` — ${o.description}`:""}`);return n}catch(r){return e.logger.error(`list failed: ${r instanceof Error?r.message:String(r)}`),{...n,code:1}}finally{i()}},nn=async e=>{const n=e.cwd??process.cwd(),t=k();if(e.list)return We(e);if(e.names.length===0)return e.logger.error("add requires at least one item name. Usage: lunora registry add <name> [...names]"),{...t,code:1};const i=j("add",e);if(i)return e.logger.error(i),{...t,code:1};let r=[];try{const{cleanups:s,items:o}=await Z(e.names,e);r=s;const{transformManifest:a}=e,c=a?o.map(g=>({...g,manifest:a(g.manifest)})):o;for(const{manifest:g}of c)W(e.logger,g);if(e.json&&Ce(c),e.dryRun)return e.logger.info("dry-run: stopping before any files are written"),t;if(e.diff)return I(c,n,e.logger,{diff:!0}),e.logger.info("diff: preview only — re-run without --diff to apply"),t;if(!await ke(c,e))return{...t,code:1};const{bindings:d,deps:u,skipped:f,written:p}=I(c,n,e.logger,{overwrite:e.overwrite});return Ve(c,u,p.length,f.length,e.logger,n),{bindings:d,code:0,deps:u,skipped:f,written:p}}catch(s){return e.logger.error(`add failed: ${s instanceof Error?s.message:String(s)}`),{...t,code:1}}finally{for(const s of r)s()}},tn=async e=>{const n=k();if(e.names.length===0)return e.logger.error("view requires an item name. Usage: lunora registry view <name>"),{...n,code:1};const t=j("view",e);if(t)return e.logger.error(t),{...n,code:1};const i=[];try{for(const r of e.names){const{cleanup:s,directory:o}=await ee(r,e);i.push(s);const a=ne(o,r);W(e.logger,a);for(const c of a.files){e.logger.info(`--- ${c.to} (${c.merge}) ---`);const d=E(o,c,!1,r);for(const u of d.split(`
18
+ `))e.logger.info(u)}}return n}catch(r){return e.logger.error(`view failed: ${r instanceof Error?r.message:String(r)}`),{...n,code:1}}finally{for(const r of i)r()}},rn=async e=>{const n=k(),t=e.from;if(t===void 0)return e.logger.error("registry build requires --from <registry root>"),{...n,code:1};if(!m(t))return e.logger.error(`registry root not found: ${t}`),{...n,code:1};const i=se(t),r=e.out??l(t,"index.json");if(e.check){const s=m(r)?JSON.parse(h(r,"utf8")):{items:[]};return JSON.stringify(s.items??[])!==JSON.stringify(i.items)?(e.logger.error(`registry: ${r} is stale — run \`lunora registry build\` to regenerate it`),{...n,code:1}):(e.logger.success(`registry: ${r} is up to date (${String(i.items.length)} items)`),n)}return $(r,`${JSON.stringify({$schema:"./schema/registry.schema.json",...i},void 0,4)}
19
+ `,"utf8"),e.logger.success(`registry: wrote ${r} (${String(i.items.length)} items)`),n};export{rn as a,tn as b,nn as r,en as s};
@@ -1,2 +1,2 @@
1
- import{s as Ye}from"./commands-BOgN2nF7.mjs";var M={exports:{}},se,rr;function X(){if(rr)return se;rr=1;const r="2.0.0",i=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,a=i-6;return se={MAX_LENGTH:i,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:a,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},se}var ne,tr;function H(){return tr||(tr=1,ne=process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...i)=>console.error("SEMVER",...i):()=>{}),ne}var sr;function B(){return sr||(sr=1,(function(r,i){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:a}=X(),h=H();i=r.exports={};const u=i.re=[],f=i.safeRe=[],n=i.src=[],R=i.safeSrc=[],e=i.t={};let o=0;const c="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",a],[c,s]],L=O=>{for(const[P,_]of m)O=O.split(`${P}*`).join(`${P}{0,${_}}`).split(`${P}+`).join(`${P}{1,${_}}`);return O},E=(O,P,_)=>{const G=L(P),y=o++;h(O,y,P),e[O]=y,n[y]=P,R[y]=G,u[y]=new RegExp(P,_?"g":void 0),f[y]=new RegExp(G,_?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),E("MAINVERSION",`(${n[e.NUMERICIDENTIFIER]})\\.(${n[e.NUMERICIDENTIFIER]})\\.(${n[e.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${n[e.NUMERICIDENTIFIERLOOSE]})\\.(${n[e.NUMERICIDENTIFIERLOOSE]})\\.(${n[e.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${n[e.NONNUMERICIDENTIFIER]}|${n[e.NUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${n[e.NONNUMERICIDENTIFIER]}|${n[e.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASE",`(?:-(${n[e.PRERELEASEIDENTIFIER]}(?:\\.${n[e.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${n[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${n[e.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${c}+`),E("BUILD",`(?:\\+(${n[e.BUILDIDENTIFIER]}(?:\\.${n[e.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${n[e.MAINVERSION]}${n[e.PRERELEASE]}?${n[e.BUILD]}?`),E("FULL",`^${n[e.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${n[e.MAINVERSIONLOOSE]}${n[e.PRERELEASELOOSE]}?${n[e.BUILD]}?`),E("LOOSE",`^${n[e.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${n[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${n[e.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${n[e.XRANGEIDENTIFIER]})(?:\\.(${n[e.XRANGEIDENTIFIER]})(?:\\.(${n[e.XRANGEIDENTIFIER]})(?:${n[e.PRERELEASE]})?${n[e.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${n[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[e.XRANGEIDENTIFIERLOOSE]})(?:${n[e.PRERELEASELOOSE]})?${n[e.BUILD]}?)?)?`),E("XRANGE",`^${n[e.GTLT]}\\s*${n[e.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${n[e.GTLT]}\\s*${n[e.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`),E("COERCE",`${n[e.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",n[e.COERCEPLAIN]+`(?:${n[e.PRERELEASE]})?(?:${n[e.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",n[e.COERCE],!0),E("COERCERTLFULL",n[e.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${n[e.LONETILDE]}\\s+`,!0),i.tildeTrimReplace="$1~",E("TILDE",`^${n[e.LONETILDE]}${n[e.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${n[e.LONETILDE]}${n[e.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${n[e.LONECARET]}\\s+`,!0),i.caretTrimReplace="$1^",E("CARET",`^${n[e.LONECARET]}${n[e.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${n[e.LONECARET]}${n[e.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${n[e.GTLT]}\\s*(${n[e.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${n[e.GTLT]}\\s*(${n[e.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${n[e.GTLT]}\\s*(${n[e.LOOSEPLAIN]}|${n[e.XRANGEPLAIN]})`,!0),i.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${n[e.XRANGEPLAIN]})\\s+-\\s+(${n[e.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${n[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${n[e.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(M,M.exports)),M.exports}var ie,nr;function ze(){if(nr)return ie;nr=1;const r=Object.freeze({loose:!0}),i=Object.freeze({});return ie=s=>s?typeof s!="object"?r:s:i,ie}var ae,ir;function zr(){if(ir)return ae;ir=1;const r=/^[0-9]+$/,i=(s,a)=>{if(typeof s=="number"&&typeof a=="number")return s===a?0:s<a?-1:1;const h=r.test(s),u=r.test(a);return h&&u&&(s=+s,a=+a),s===a?0:h&&!u?-1:u&&!h?1:s<a?-1:1};return ae={compareIdentifiers:i,rcompareIdentifiers:(s,a)=>i(a,s)},ae}var oe,ar;function j(){if(ar)return oe;ar=1;const r=H(),{MAX_LENGTH:i,MAX_SAFE_INTEGER:t}=X(),{safeRe:s,t:a}=B(),h=ze(),{compareIdentifiers:u}=zr(),f=(R,e)=>{const o=e.split(".");if(o.length>R.length)return!1;for(let c=0;c<o.length;c++)if(u(R[c],o[c])!==0)return!1;return!0};class n{constructor(e,o){if(o=h(o),e instanceof n){if(e.loose===!!o.loose&&e.includePrerelease===!!o.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,o),this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease;const c=e.trim().match(o.loose?s[a.LOOSE]:s[a.FULL]);if(!c)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const L=+m;if(L>=0&&L<t)return L}return m}):this.prerelease=[],this.build=c[5]?c[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof n)){if(typeof e=="string"&&e===this.version)return 0;e=new n(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof n||(e=new n(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof n||(e=new n(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let o=0;do{const c=this.prerelease[o],m=e.prerelease[o];if(r("prerelease compare",o,c,m),c===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(c===void 0)return-1;if(c===m)continue;return u(c,m)}while(++o)}compareBuild(e){e instanceof n||(e=new n(e,this.options));let o=0;do{const c=this.build[o],m=e.build[o];if(r("build compare",o,c,m),c===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(c===void 0)return-1;if(c===m)continue;return u(c,m)}while(++o)}inc(e,o,c){if(e.startsWith("pre")){if(!o&&c===!1)throw new Error("invalid increment argument: identifier is empty");if(o){const m=`-${o}`.match(this.options.loose?s[a.PRERELEASELOOSE]:s[a.PRERELEASE]);if(!m||m[1]!==o)throw new Error(`invalid identifier: ${o}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",o,c);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",o,c);break;case"prepatch":this.prerelease.length=0,this.inc("patch",o,c),this.inc("pre",o,c);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",o,c),this.inc("pre",o,c);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const m=Number(c)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let L=this.prerelease.length;for(;--L>=0;)typeof this.prerelease[L]=="number"&&(this.prerelease[L]++,L=-2);if(L===-1){if(o===this.prerelease.join(".")&&c===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(o){let L=[o,m];if(c===!1&&(L=[o]),f(this.prerelease,o)){const E=this.prerelease[o.split(".").length];isNaN(E)&&(this.prerelease=L)}else this.prerelease=L}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return oe=n,oe}var ue,or;function V(){if(or)return ue;or=1;const r=j();return ue=(t,s,a=!1)=>{if(t instanceof r)return t;try{return new r(t,s)}catch(h){if(!a)return null;throw h}},ue}var ce,ur;function tt(){if(ur)return ce;ur=1;const r=V();return ce=(t,s)=>{const a=r(t,s);return a?a.version:null},ce}var le,cr;function st(){if(cr)return le;cr=1;const r=V();return le=(t,s)=>{const a=r(t.trim().replace(/^[=v]+/,""),s);return a?a.version:null},le}var fe,lr;function nt(){if(lr)return fe;lr=1;const r=j();return fe=(t,s,a,h,u)=>{typeof a=="string"&&(u=h,h=a,a=void 0);try{return new r(t instanceof r?t.version:t,a).inc(s,h,u).version}catch{return null}},fe}var he,fr;function it(){if(fr)return he;fr=1;const r=V();return he=(t,s)=>{const a=r(t,null,!0),h=r(s,null,!0),u=a.compare(h);if(u===0)return null;const f=u>0,n=f?a:h,R=f?h:a,e=!!n.prerelease.length;if(!!R.prerelease.length&&!e){if(!R.patch&&!R.minor)return"major";if(R.compareMain(n)===0)return R.minor&&!R.patch?"minor":"patch"}const c=e?"pre":"";return a.major!==h.major?c+"major":a.minor!==h.minor?c+"minor":a.patch!==h.patch?c+"patch":"prerelease"},he}var Ee,hr;function at(){if(hr)return Ee;hr=1;const r=j();return Ee=(t,s)=>new r(t,s).major,Ee}var pe,Er;function ot(){if(Er)return pe;Er=1;const r=j();return pe=(t,s)=>new r(t,s).minor,pe}var me,pr;function ut(){if(pr)return me;pr=1;const r=j();return me=(t,s)=>new r(t,s).patch,me}var Re,mr;function ct(){if(mr)return Re;mr=1;const r=V();return Re=(t,s)=>{const a=r(t,s);return a&&a.prerelease.length?a.prerelease:null},Re}var de,Rr;function U(){if(Rr)return de;Rr=1;const r=j();return de=(t,s,a)=>new r(t,a).compare(new r(s,a)),de}var ve,dr;function lt(){if(dr)return ve;dr=1;const r=U();return ve=(t,s,a)=>r(s,t,a),ve}var $e,vr;function ft(){if(vr)return $e;vr=1;const r=U();return $e=(t,s)=>r(t,s,!0),$e}var Ie,$r;function Ke(){if($r)return Ie;$r=1;const r=j();return Ie=(t,s,a)=>{const h=new r(t,a),u=new r(s,a);return h.compare(u)||h.compareBuild(u)},Ie}var Le,Ir;function ht(){if(Ir)return Le;Ir=1;const r=Ke();return Le=(t,s)=>t.sort((a,h)=>r(a,h,s)),Le}var Ne,Lr;function Et(){if(Lr)return Ne;Lr=1;const r=Ke();return Ne=(t,s)=>t.sort((a,h)=>r(h,a,s)),Ne}var Se,Nr;function W(){if(Nr)return Se;Nr=1;const r=U();return Se=(t,s,a)=>r(t,s,a)>0,Se}var Oe,Sr;function Ze(){if(Sr)return Oe;Sr=1;const r=U();return Oe=(t,s,a)=>r(t,s,a)<0,Oe}var Ae,Or;function Kr(){if(Or)return Ae;Or=1;const r=U();return Ae=(t,s,a)=>r(t,s,a)===0,Ae}var Te,Ar;function Zr(){if(Ar)return Te;Ar=1;const r=U();return Te=(t,s,a)=>r(t,s,a)!==0,Te}var ge,Tr;function Je(){if(Tr)return ge;Tr=1;const r=U();return ge=(t,s,a)=>r(t,s,a)>=0,ge}var we,gr;function Qe(){if(gr)return we;gr=1;const r=U();return we=(t,s,a)=>r(t,s,a)<=0,we}var Pe,wr;function Jr(){if(wr)return Pe;wr=1;const r=Kr(),i=Zr(),t=W(),s=Je(),a=Ze(),h=Qe();return Pe=(f,n,R,e)=>{switch(n){case"===":return typeof f=="object"&&(f=f.version),typeof R=="object"&&(R=R.version),f===R;case"!==":return typeof f=="object"&&(f=f.version),typeof R=="object"&&(R=R.version),f!==R;case"":case"=":case"==":return r(f,R,e);case"!=":return i(f,R,e);case">":return t(f,R,e);case">=":return s(f,R,e);case"<":return a(f,R,e);case"<=":return h(f,R,e);default:throw new TypeError(`Invalid operator: ${n}`)}},Pe}var Ce,Pr;function pt(){if(Pr)return Ce;Pr=1;const r=j(),i=V(),{safeRe:t,t:s}=B();return Ce=(h,u)=>{if(h instanceof r)return h;if(typeof h=="number"&&(h=String(h)),typeof h!="string")return null;u=u||{};let f=null;if(!u.rtl)f=h.match(u.includePrerelease?t[s.COERCEFULL]:t[s.COERCE]);else{const m=u.includePrerelease?t[s.COERCERTLFULL]:t[s.COERCERTL];let L;for(;(L=m.exec(h))&&(!f||f.index+f[0].length!==h.length);)(!f||L.index+L[0].length!==f.index+f[0].length)&&(f=L),m.lastIndex=L.index+L[1].length+L[2].length;m.lastIndex=-1}if(f===null)return null;const n=f[2],R=f[3]||"0",e=f[4]||"0",o=u.includePrerelease&&f[5]?`-${f[5]}`:"",c=u.includePrerelease&&f[6]?`+${f[6]}`:"";return i(`${n}.${R}.${e}${o}${c}`,u)},Ce}var qe,Cr;function mt(){if(Cr)return qe;Cr=1;const r=V(),i=X(),t=j(),s=(f,n,R)=>{if(!i.RELEASE_TYPES.includes(n))return null;const e=a(f,R);return e&&h(e,n)},a=(f,n)=>{const R=f instanceof t?f.version:f;return r(R,n)},h=(f,n)=>{if(u(n))return f.version;switch(f.prerelease=[],n){case"major":f.minor=0,f.patch=0;break;case"minor":f.patch=0;break}return f.format()},u=f=>f.startsWith("pre");return qe=s,qe}var De,qr;function Rt(){if(qr)return De;qr=1;class r{constructor(){this.max=1e3,this.map=new Map}get(t){const s=this.map.get(t);if(s!==void 0)return this.map.delete(t),this.map.set(t,s),s}delete(t){return this.map.delete(t)}set(t,s){if(!this.delete(t)&&s!==void 0){if(this.map.size>=this.max){const h=this.map.keys().next().value;this.delete(h)}this.map.set(t,s)}return this}}return De=r,De}var _e,Dr;function F(){if(Dr)return _e;Dr=1;const r=/\s+/g;class i{constructor(l,$){if($=a($),l instanceof i)return l.loose===!!$.loose&&l.includePrerelease===!!$.includePrerelease?l:new i(l.raw,$);if(l instanceof h)return this.raw=l.value,this.set=[[l]],this.formatted=void 0,this;if(this.options=$,this.loose=!!$.loose,this.includePrerelease=!!$.includePrerelease,this.raw=l.trim().replace(r," "),this.set=this.raw.split("||").map(v=>this.parseRange(v.trim())).filter(v=>v.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const v=this.set[0];if(this.set=this.set.filter(S=>!P(S[0])),this.set.length===0)this.set=[v];else if(this.set.length>1){for(const S of this.set)if(S.length===1&&_(S[0])){this.set=[S];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let l=0;l<this.set.length;l++){l>0&&(this.formatted+="||");const $=this.set[l];for(let v=0;v<$.length;v++)v>0&&(this.formatted+=" "),this.formatted+=$[v].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(l){l=l.replace(O,"");const v=((this.options.includePrerelease&&L)|(this.options.loose&&E))+":"+l,S=s.get(v);if(S)return S;const d=this.options.loose,I=d?n[e.HYPHENRANGELOOSE]:n[e.HYPHENRANGE];l=l.replace(I,re(this.options.includePrerelease)),u("hyphen replace",l),l=l.replace(n[e.COMPARATORTRIM],o),u("comparator trim",l),l=l.replace(n[e.TILDETRIM],c),u("tilde trim",l),l=l.replace(n[e.CARETTRIM],m),u("caret trim",l);let g=l.split(" ").map(q=>y(q,this.options)).join(" ").split(/\s+/).map(q=>ee(q,this.options));d&&(g=g.filter(q=>(u("loose invalid filter",q,this.options),!!q.match(n[e.COMPARATORLOOSE])))),u("range list",g);const A=new Map,w=g.map(q=>new h(q,this.options));for(const q of w){if(P(q))return[q];A.set(q.value,q)}A.size>1&&A.has("")&&A.delete("");const b=[...A.values()];return s.set(v,b),b}intersects(l,$){if(!(l instanceof i))throw new TypeError("a Range is required");return this.set.some(v=>G(v,$)&&l.set.some(S=>G(S,$)&&v.every(d=>S.every(I=>d.intersects(I,$)))))}test(l){if(!l)return!1;if(typeof l=="string")try{l=new f(l,this.options)}catch{return!1}for(let $=0;$<this.set.length;$++)if(te(this.set[$],l,this.options))return!0;return!1}}_e=i;const t=Rt(),s=new t,a=ze(),h=Y(),u=H(),f=j(),{safeRe:n,src:R,t:e,comparatorTrimReplace:o,tildeTrimReplace:c,caretTrimReplace:m}=B(),{FLAG_INCLUDE_PRERELEASE:L,FLAG_LOOSE:E}=X(),O=new RegExp(R[e.BUILD],"g"),P=p=>p.value==="<0.0.0-0",_=p=>p.value==="",G=(p,l)=>{let $=!0;const v=p.slice();let S=v.pop();for(;$&&v.length;)$=v.every(d=>S.intersects(d,l)),S=v.pop();return $},y=(p,l)=>(p=p.replace(n[e.BUILD],""),u("comp",p,l),p=k(p,l),u("caret",p),p=D(p,l),u("tildes",p),p=Z(p,l),u("xrange",p),p=Q(p,l),u("stars",p),p),T=p=>!p||p.toLowerCase()==="x"||p==="*",C=(p,l,$)=>T(p)&&!T(l)||T(l)&&$&&!T($),D=(p,l)=>p.trim().split(/\s+/).map($=>N($,l)).join(" "),N=(p,l)=>{const $=l.loose?n[e.TILDELOOSE]:n[e.TILDE],v=l.includePrerelease?"-0":"";return p.replace($,(S,d,I,g,A)=>{u("tilde",p,S,d,I,g,A);let w;return T(d)?w="":T(I)?w=`>=${d}.0.0${v} <${+d+1}.0.0-0`:T(g)?w=`>=${d}.${I}.0${v} <${d}.${+I+1}.0-0`:A?(u("replaceTilde pr",A),w=`>=${d}.${I}.${g}-${A} <${d}.${+I+1}.0-0`):w=`>=${d}.${I}.${g} <${d}.${+I+1}.0-0`,u("tilde return",w),w})},k=(p,l)=>p.trim().split(/\s+/).map($=>K($,l)).join(" "),K=(p,l)=>{u("caret",p,l);const $=l.loose?n[e.CARETLOOSE]:n[e.CARET],v=l.includePrerelease?"-0":"";return p.replace($,(S,d,I,g,A)=>{u("caret",p,S,d,I,g,A);let w;return T(d)?w="":T(I)?w=`>=${d}.0.0${v} <${+d+1}.0.0-0`:T(g)?d==="0"?w=`>=${d}.${I}.0${v} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.0${v} <${+d+1}.0.0-0`:A?(u("replaceCaret pr",A),d==="0"?I==="0"?w=`>=${d}.${I}.${g}-${A} <${d}.${I}.${+g+1}-0`:w=`>=${d}.${I}.${g}-${A} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.${g}-${A} <${+d+1}.0.0-0`):(u("no pr"),d==="0"?I==="0"?w=`>=${d}.${I}.${g} <${d}.${I}.${+g+1}-0`:w=`>=${d}.${I}.${g} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.${g} <${+d+1}.0.0-0`),u("caret return",w),w})},Z=(p,l)=>(u("replaceXRanges",p,l),p.split(/\s+/).map($=>J($,l)).join(" ")),J=(p,l)=>{p=p.trim();const $=l.loose?n[e.XRANGELOOSE]:n[e.XRANGE];return p.replace($,(v,S,d,I,g,A)=>{if(u("xRange",p,v,S,d,I,g,A),C(d,I,g))return p;const w=T(d),b=w||T(I),q=b||T(g),x=q;return S==="="&&x&&(S=""),A=l.includePrerelease?"-0":"",w?S===">"||S==="<"?v="<0.0.0-0":v="*":S&&x?(b&&(I=0),g=0,S===">"?(S=">=",b?(d=+d+1,I=0,g=0):(I=+I+1,g=0)):S==="<="&&(S="<",b?d=+d+1:I=+I+1),S==="<"&&(A="-0"),v=`${S+d}.${I}.${g}${A}`):b?v=`>=${d}.0.0${A} <${+d+1}.0.0-0`:q&&(v=`>=${d}.${I}.0${A} <${d}.${+I+1}.0-0`),u("xRange return",v),v})},Q=(p,l)=>(u("replaceStars",p,l),p.trim().replace(n[e.STAR],"")),ee=(p,l)=>(u("replaceGTE0",p,l),p.trim().replace(n[l.includePrerelease?e.GTE0PRE:e.GTE0],"")),re=p=>(l,$,v,S,d,I,g,A,w,b,q,x)=>(T(v)?$="":T(S)?$=`>=${v}.0.0${p?"-0":""}`:T(d)?$=`>=${v}.${S}.0${p?"-0":""}`:I?$=`>=${$}`:$=`>=${$}${p?"-0":""}`,T(w)?A="":T(b)?A=`<${+w+1}.0.0-0`:T(q)?A=`<${w}.${+b+1}.0-0`:x?A=`<=${w}.${b}.${q}-${x}`:p?A=`<${w}.${b}.${+q+1}-0`:A=`<=${A}`,`${$} ${A}`.trim()),te=(p,l,$)=>{for(let v=0;v<p.length;v++)if(!p[v].test(l))return!1;if(l.prerelease.length&&!$.includePrerelease){for(let v=0;v<p.length;v++)if(u(p[v].semver),p[v].semver!==h.ANY&&p[v].semver.prerelease.length>0){const S=p[v].semver;if(S.major===l.major&&S.minor===l.minor&&S.patch===l.patch)return!0}return!1}return!0};return _e}var ye,_r;function Y(){if(_r)return ye;_r=1;const r=Symbol("SemVer ANY");class i{static get ANY(){return r}constructor(e,o){if(o=t(o),e instanceof i){if(e.loose===!!o.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,o),this.options=o,this.loose=!!o.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const o=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],c=e.match(o);if(!c)throw new TypeError(`Invalid comparator: ${e}`);this.operator=c[1]!==void 0?c[1]:"",this.operator==="="&&(this.operator=""),c[2]?this.semver=new f(c[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if(typeof e=="string")try{e=new f(e,this.options)}catch{return!1}return h(e,this.operator,this.semver,this.options)}intersects(e,o){if(!(e instanceof i))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new n(e.value,o).test(this.value):e.operator===""?e.value===""?!0:new n(this.value,o).test(e.semver):(o=t(o),o.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!o.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||h(this.semver,"<",e.semver,o)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||h(this.semver,">",e.semver,o)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}ye=i;const t=ze(),{safeRe:s,t:a}=B(),h=Jr(),u=H(),f=j(),n=F();return ye}var je,yr;function z(){if(yr)return je;yr=1;const r=F();return je=(t,s,a)=>{try{s=new r(s,a)}catch{return!1}return s.test(t)},je}var Ge,jr;function dt(){if(jr)return Ge;jr=1;const r=F();return Ge=(t,s)=>new r(t,s).set.map(a=>a.map(h=>h.value).join(" ").trim().split(" ")),Ge}var be,Gr;function vt(){if(Gr)return be;Gr=1;const r=j(),i=F();return be=(s,a,h)=>{let u=null,f=null,n=null;try{n=new i(a,h)}catch{return null}return s.forEach(R=>{n.test(R)&&(!u||f.compare(R)===-1)&&(u=R,f=new r(u,h))}),u},be}var Ue,br;function $t(){if(br)return Ue;br=1;const r=j(),i=F();return Ue=(s,a,h)=>{let u=null,f=null,n=null;try{n=new i(a,h)}catch{return null}return s.forEach(R=>{n.test(R)&&(!u||f.compare(R)===1)&&(u=R,f=new r(u,h))}),u},Ue}var Fe,Ur;function It(){if(Ur)return Fe;Ur=1;const r=j(),i=F(),t=W();return Fe=(a,h)=>{a=new i(a,h);let u=new r("0.0.0");if(a.test(u)||(u=new r("0.0.0-0"),a.test(u)))return u;u=null;for(let f=0;f<a.set.length;++f){const n=a.set[f];let R=null;n.forEach(e=>{const o=new r(e.semver.version);switch(e.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!R||t(o,R))&&(R=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),R&&(!u||t(u,R))&&(u=R)}return u&&a.test(u)?u:null},Fe}var Ve,Fr;function Lt(){if(Fr)return Ve;Fr=1;const r=F();return Ve=(t,s)=>{try{return new r(t,s).range||"*"}catch{return null}},Ve}var ke,Vr;function er(){if(Vr)return ke;Vr=1;const r=j(),i=Y(),{ANY:t}=i,s=F(),a=z(),h=W(),u=Ze(),f=Qe(),n=Je();return ke=(e,o,c,m)=>{e=new r(e,m),o=new s(o,m);let L,E,O,P,_;switch(c){case">":L=h,E=f,O=u,P=">",_=">=";break;case"<":L=u,E=n,O=h,P="<",_="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,o,m))return!1;for(let G=0;G<o.set.length;++G){const y=o.set[G];let T=null,C=null;if(y.forEach(D=>{D.semver===t&&(D=new i(">=0.0.0")),T=T||D,C=C||D,L(D.semver,T.semver,m)?T=D:O(D.semver,C.semver,m)&&(C=D)}),T.operator===P||T.operator===_||(!C.operator||C.operator===P)&&E(e,C.semver))return!1;if(C.operator===_&&O(e,C.semver))return!1}return!0},ke}var xe,kr;function Nt(){if(kr)return xe;kr=1;const r=er();return xe=(t,s,a)=>r(t,s,">",a),xe}var Xe,xr;function St(){if(xr)return Xe;xr=1;const r=er();return Xe=(t,s,a)=>r(t,s,"<",a),Xe}var Be,Xr;function Ot(){if(Xr)return Be;Xr=1;const r=F();return Be=(t,s,a)=>(t=new r(t,a),s=new r(s,a),t.intersects(s,a)),Be}var Me,Br;function At(){if(Br)return Me;Br=1;const r=z(),i=U();return Me=(t,s,a)=>{const h=[];let u=null,f=null;const n=t.sort((c,m)=>i(c,m,a));for(const c of n)r(c,s,a)?(f=c,u||(u=c)):(f&&h.push([u,f]),f=null,u=null);u&&h.push([u,null]);const R=[];for(const[c,m]of h)c===m?R.push(c):!m&&c===n[0]?R.push("*"):m?c===n[0]?R.push(`<=${m}`):R.push(`${c} - ${m}`):R.push(`>=${c}`);const e=R.join(" || "),o=typeof s.raw=="string"?s.raw:String(s);return e.length<o.length?e:s},Me}var He,Mr;function Tt(){if(Mr)return He;Mr=1;const r=F(),i=Y(),{ANY:t}=i,s=z(),a=U(),h=(o,c,m={})=>{if(o===c)return!0;o=new r(o,m),c=new r(c,m);let L=!1;e:for(const E of o.set){for(const O of c.set){const P=n(E,O,m);if(L=L||P!==null,P)continue e}if(L)return!1}return!0},u=[new i(">=0.0.0-0")],f=[new i(">=0.0.0")],n=(o,c,m)=>{if(o===c)return!0;if(o.length===1&&o[0].semver===t){if(c.length===1&&c[0].semver===t)return!0;m.includePrerelease?o=u:o=f}if(c.length===1&&c[0].semver===t){if(m.includePrerelease)return!0;c=f}const L=new Set;let E,O;for(const N of o)N.operator===">"||N.operator===">="?E=R(E,N,m):N.operator==="<"||N.operator==="<="?O=e(O,N,m):L.add(N.semver);if(L.size>1)return null;let P;if(E&&O){if(P=a(E.semver,O.semver,m),P>0)return null;if(P===0&&(E.operator!==">="||O.operator!=="<="))return null}for(const N of L){if(E&&!s(N,String(E),m)||O&&!s(N,String(O),m))return null;for(const k of c)if(!s(N,String(k),m))return!1;return!0}let _,G,y,T,C=O&&!m.includePrerelease&&O.semver.prerelease.length?O.semver:!1,D=E&&!m.includePrerelease&&E.semver.prerelease.length?E.semver:!1;C&&C.prerelease.length===1&&O.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(const N of c){if(T=T||N.operator===">"||N.operator===">=",y=y||N.operator==="<"||N.operator==="<=",E){if(D&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===D.major&&N.semver.minor===D.minor&&N.semver.patch===D.patch&&(D=!1),N.operator===">"||N.operator===">="){if(_=R(E,N,m),_===N&&_!==E)return!1}else if(E.operator===">="&&!N.test(E.semver))return!1}if(O){if(C&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===C.major&&N.semver.minor===C.minor&&N.semver.patch===C.patch&&(C=!1),N.operator==="<"||N.operator==="<="){if(G=e(O,N,m),G===N&&G!==O)return!1}else if(O.operator==="<="&&!N.test(O.semver))return!1}if(!N.operator&&(O||E)&&P!==0)return!1}return!(E&&y&&!O&&P!==0||O&&T&&!E&&P!==0||D||C)},R=(o,c,m)=>{if(!o)return c;const L=a(o.semver,c.semver,m);return L>0?o:L<0||c.operator===">"&&o.operator===">="?c:o},e=(o,c,m)=>{if(!o)return c;const L=a(o.semver,c.semver,m);return L<0?o:L>0||c.operator==="<"&&o.operator==="<="?c:o};return He=h,He}var We,Hr;function gt(){if(Hr)return We;Hr=1;const r=B(),i=X(),t=j(),s=zr(),a=V(),h=tt(),u=st(),f=nt(),n=it(),R=at(),e=ot(),o=ut(),c=ct(),m=U(),L=lt(),E=ft(),O=Ke(),P=ht(),_=Et(),G=W(),y=Ze(),T=Kr(),C=Zr(),D=Je(),N=Qe(),k=Jr(),K=pt(),Z=mt(),J=Y(),Q=F(),ee=z(),re=dt(),te=vt(),p=$t(),l=It(),$=Lt(),v=er(),S=Nt(),d=St(),I=Ot(),g=At(),A=Tt();return We={parse:a,valid:h,clean:u,inc:f,diff:n,major:R,minor:e,patch:o,prerelease:c,compare:m,rcompare:L,compareLoose:E,compareBuild:O,sort:P,rsort:_,gt:G,lt:y,eq:T,neq:C,gte:D,lte:N,cmp:k,coerce:K,truncate:Z,Comparator:J,Range:Q,satisfies:ee,toComparators:re,maxSatisfying:te,minSatisfying:p,minVersion:l,validRange:$,outside:v,gtr:S,ltr:d,intersects:I,simplifyRange:g,subset:A,SemVer:t,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers},We}var Wr=gt();const wt=[{description:"Email + password on better-auth (default)",label:"Email & password",value:"auth"},{description:"Clerk-hosted auth",label:"Clerk",value:"auth-clerk"},{description:"Auth0 (OIDC)",label:"Auth0",value:"auth-auth0"}],Yr="auth",Bt=async r=>await r("Which auth provider?",wt,{default:Yr})??Yr,Mt="mail",Ht=[{description:"Next, react-router, TanStack Start, Astro islands",label:"React",value:"auth-ui-react"},{description:"Nuxt, Vue + Vite",label:"Vue",value:"auth-ui-vue"},{description:"SvelteKit, Svelte + Vite",label:"Svelte",value:"auth-ui-svelte"},{description:"TanStack Start Solid, Solid 1.x + Vite",label:"Solid",value:"auth-ui-solid"},{description:"Solid 2.0 + Vite (@solidjs/web)",label:"Solid 2",value:"auth-ui-solid-v2"},{description:"Analog",label:"Angular",value:"auth-ui-angular"}],Wt="auth-ui-react",Pt=r=>Object.hasOwn(r,"react-native")||Object.hasOwn(r,"@lunora/react-native")||Object.hasOwn(r,"expo"),Ct=r=>{if(!(r===void 0||Wr.validRange(r)===null))return Wr.minVersion(r)?.major},qt=r=>Object.hasOwn(r,"@solidjs/web")||(Ct(r["solid-js"])??0)>=2,Yt=r=>{const i=t=>Object.hasOwn(r,t);if(!Pt(r)){if(qt(r))return"auth-ui-solid-v2";if(i("@lunora/react"))return"auth-ui-react";if(i("@lunora/vue"))return"auth-ui-vue";if(i("@lunora/svelte"))return"auth-ui-svelte";if(i("@lunora/solid"))return"auth-ui-solid";if(i("@lunora/angular"))return"auth-ui-angular";if(i("react")||i("next"))return"auth-ui-react";if(i("vue")||i("nuxt"))return"auth-ui-vue";if(i("svelte")||i("@sveltejs/kit"))return"auth-ui-svelte";if(i("solid-js"))return"auth-ui-solid";if(i("@angular/core"))return"auth-ui-angular"}},zt=r=>{const i=r.trim();if(i==="")return;const t=i.toLowerCase();return t==="auth-ui"||t==="auth-ui-"?{kind:"auth-ui"}:t==="auth"?{kind:"auth"}:t==="email"||t==="mail"?{kind:"email"}:{item:t,kind:"item"}},Dt=/[^a-z0-9]+/u,Qr=(r,i,t)=>{let s=r.toLowerCase().split(Dt).filter(Boolean).join("-").slice(0,t);return s.endsWith("-")&&(s=s.slice(0,-1)),s.length>=i?s:void 0},_t="DB",yt="Name your D1 database (run `wrangler d1 create` to get its id, then put it in wrangler.jsonc)",et=r=>Qr(r,1,64),jt="lunora-db",Gt=r=>et(`${r}-db`)??jt,Kt=async(r,i)=>{const t=Gt(i);return et(await r(yt,{default:t,placeholder:t}))??t},Zt=(r,i)=>Ye(r,"d1_databases",{key:"binding",value:_t},"database_name",i),bt="SEND_EMAIL",Jt="Verified destination email for production delivery (blank = set it later in wrangler.jsonc)",Ut=r=>{const i=r.trim();if(i.length===0||i.includes(" "))return!1;const t=i.indexOf("@");if(t<=0||t!==i.lastIndexOf("@"))return!1;const s=i.slice(t+1);return s.length>=3&&s.includes(".")&&!s.startsWith(".")&&!s.endsWith(".")},Qt=(r,i)=>{const t=r.trim();if(t!==""){if(!Ut(t)){i(`"${t}" doesn't look like an email — leaving the placeholder; set destination_address in wrangler.jsonc.`);return}return t}},es=(r,i)=>Ye(r,"send_email",{key:"name",value:bt},"destination_address",i),Ft="UPLOADS",Vt="Name your R2 bucket (you can rename it in wrangler.jsonc later)",rt=r=>Qr(r,3,63),kt="lunora-uploads",xt=r=>rt(`${r}-uploads`)??kt,rs=async(r,i)=>{const t=xt(i);return rt(await r(Vt,{default:t,placeholder:t}))??t},ts=(r,i)=>Ye(r,"r2_buckets",{key:"binding",value:Ft},"bucket_name",i),ss=(r,i)=>{for(const t of r)(t.status==="created"||t.status==="updated")&&i.success(`${t.status} ${t.path} — ${t.tool} now skips Lunora's generated files`),t.status==="failed"&&i.warn(`could not configure ${t.tool} to skip Lunora's generated files: ${t.message??"unknown error"}. Add the entries by hand, or re-run once the path is writable.`),t.status==="manual"&&t.snippet!==void 0&&i.warn(`${t.path} needs an entry so ${t.tool} skips Lunora's generated files — add:
1
+ import{s as Ye}from"./commands-BNKj7r1R.mjs";var M={exports:{}},se,rr;function X(){if(rr)return se;rr=1;const r="2.0.0",i=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,a=i-6;return se={MAX_LENGTH:i,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:a,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},se}var ne,tr;function H(){return tr||(tr=1,ne=process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...i)=>console.error("SEMVER",...i):()=>{}),ne}var sr;function B(){return sr||(sr=1,(function(r,i){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:a}=X(),h=H();i=r.exports={};const u=i.re=[],f=i.safeRe=[],n=i.src=[],R=i.safeSrc=[],e=i.t={};let o=0;const c="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",a],[c,s]],L=O=>{for(const[P,_]of m)O=O.split(`${P}*`).join(`${P}{0,${_}}`).split(`${P}+`).join(`${P}{1,${_}}`);return O},E=(O,P,_)=>{const G=L(P),y=o++;h(O,y,P),e[O]=y,n[y]=P,R[y]=G,u[y]=new RegExp(P,_?"g":void 0),f[y]=new RegExp(G,_?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),E("MAINVERSION",`(${n[e.NUMERICIDENTIFIER]})\\.(${n[e.NUMERICIDENTIFIER]})\\.(${n[e.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${n[e.NUMERICIDENTIFIERLOOSE]})\\.(${n[e.NUMERICIDENTIFIERLOOSE]})\\.(${n[e.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${n[e.NONNUMERICIDENTIFIER]}|${n[e.NUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${n[e.NONNUMERICIDENTIFIER]}|${n[e.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASE",`(?:-(${n[e.PRERELEASEIDENTIFIER]}(?:\\.${n[e.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${n[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${n[e.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${c}+`),E("BUILD",`(?:\\+(${n[e.BUILDIDENTIFIER]}(?:\\.${n[e.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${n[e.MAINVERSION]}${n[e.PRERELEASE]}?${n[e.BUILD]}?`),E("FULL",`^${n[e.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${n[e.MAINVERSIONLOOSE]}${n[e.PRERELEASELOOSE]}?${n[e.BUILD]}?`),E("LOOSE",`^${n[e.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${n[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${n[e.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${n[e.XRANGEIDENTIFIER]})(?:\\.(${n[e.XRANGEIDENTIFIER]})(?:\\.(${n[e.XRANGEIDENTIFIER]})(?:${n[e.PRERELEASE]})?${n[e.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${n[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[e.XRANGEIDENTIFIERLOOSE]})(?:${n[e.PRERELEASELOOSE]})?${n[e.BUILD]}?)?)?`),E("XRANGE",`^${n[e.GTLT]}\\s*${n[e.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${n[e.GTLT]}\\s*${n[e.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`),E("COERCE",`${n[e.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",n[e.COERCEPLAIN]+`(?:${n[e.PRERELEASE]})?(?:${n[e.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",n[e.COERCE],!0),E("COERCERTLFULL",n[e.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${n[e.LONETILDE]}\\s+`,!0),i.tildeTrimReplace="$1~",E("TILDE",`^${n[e.LONETILDE]}${n[e.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${n[e.LONETILDE]}${n[e.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${n[e.LONECARET]}\\s+`,!0),i.caretTrimReplace="$1^",E("CARET",`^${n[e.LONECARET]}${n[e.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${n[e.LONECARET]}${n[e.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${n[e.GTLT]}\\s*(${n[e.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${n[e.GTLT]}\\s*(${n[e.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${n[e.GTLT]}\\s*(${n[e.LOOSEPLAIN]}|${n[e.XRANGEPLAIN]})`,!0),i.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${n[e.XRANGEPLAIN]})\\s+-\\s+(${n[e.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${n[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${n[e.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(M,M.exports)),M.exports}var ie,nr;function ze(){if(nr)return ie;nr=1;const r=Object.freeze({loose:!0}),i=Object.freeze({});return ie=s=>s?typeof s!="object"?r:s:i,ie}var ae,ir;function zr(){if(ir)return ae;ir=1;const r=/^[0-9]+$/,i=(s,a)=>{if(typeof s=="number"&&typeof a=="number")return s===a?0:s<a?-1:1;const h=r.test(s),u=r.test(a);return h&&u&&(s=+s,a=+a),s===a?0:h&&!u?-1:u&&!h?1:s<a?-1:1};return ae={compareIdentifiers:i,rcompareIdentifiers:(s,a)=>i(a,s)},ae}var oe,ar;function j(){if(ar)return oe;ar=1;const r=H(),{MAX_LENGTH:i,MAX_SAFE_INTEGER:t}=X(),{safeRe:s,t:a}=B(),h=ze(),{compareIdentifiers:u}=zr(),f=(R,e)=>{const o=e.split(".");if(o.length>R.length)return!1;for(let c=0;c<o.length;c++)if(u(R[c],o[c])!==0)return!1;return!0};class n{constructor(e,o){if(o=h(o),e instanceof n){if(e.loose===!!o.loose&&e.includePrerelease===!!o.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,o),this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease;const c=e.trim().match(o.loose?s[a.LOOSE]:s[a.FULL]);if(!c)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const L=+m;if(L>=0&&L<t)return L}return m}):this.prerelease=[],this.build=c[5]?c[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof n)){if(typeof e=="string"&&e===this.version)return 0;e=new n(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof n||(e=new n(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof n||(e=new n(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let o=0;do{const c=this.prerelease[o],m=e.prerelease[o];if(r("prerelease compare",o,c,m),c===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(c===void 0)return-1;if(c===m)continue;return u(c,m)}while(++o)}compareBuild(e){e instanceof n||(e=new n(e,this.options));let o=0;do{const c=this.build[o],m=e.build[o];if(r("build compare",o,c,m),c===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(c===void 0)return-1;if(c===m)continue;return u(c,m)}while(++o)}inc(e,o,c){if(e.startsWith("pre")){if(!o&&c===!1)throw new Error("invalid increment argument: identifier is empty");if(o){const m=`-${o}`.match(this.options.loose?s[a.PRERELEASELOOSE]:s[a.PRERELEASE]);if(!m||m[1]!==o)throw new Error(`invalid identifier: ${o}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",o,c);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",o,c);break;case"prepatch":this.prerelease.length=0,this.inc("patch",o,c),this.inc("pre",o,c);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",o,c),this.inc("pre",o,c);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const m=Number(c)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let L=this.prerelease.length;for(;--L>=0;)typeof this.prerelease[L]=="number"&&(this.prerelease[L]++,L=-2);if(L===-1){if(o===this.prerelease.join(".")&&c===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(o){let L=[o,m];if(c===!1&&(L=[o]),f(this.prerelease,o)){const E=this.prerelease[o.split(".").length];isNaN(E)&&(this.prerelease=L)}else this.prerelease=L}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return oe=n,oe}var ue,or;function V(){if(or)return ue;or=1;const r=j();return ue=(t,s,a=!1)=>{if(t instanceof r)return t;try{return new r(t,s)}catch(h){if(!a)return null;throw h}},ue}var ce,ur;function tt(){if(ur)return ce;ur=1;const r=V();return ce=(t,s)=>{const a=r(t,s);return a?a.version:null},ce}var le,cr;function st(){if(cr)return le;cr=1;const r=V();return le=(t,s)=>{const a=r(t.trim().replace(/^[=v]+/,""),s);return a?a.version:null},le}var fe,lr;function nt(){if(lr)return fe;lr=1;const r=j();return fe=(t,s,a,h,u)=>{typeof a=="string"&&(u=h,h=a,a=void 0);try{return new r(t instanceof r?t.version:t,a).inc(s,h,u).version}catch{return null}},fe}var he,fr;function it(){if(fr)return he;fr=1;const r=V();return he=(t,s)=>{const a=r(t,null,!0),h=r(s,null,!0),u=a.compare(h);if(u===0)return null;const f=u>0,n=f?a:h,R=f?h:a,e=!!n.prerelease.length;if(!!R.prerelease.length&&!e){if(!R.patch&&!R.minor)return"major";if(R.compareMain(n)===0)return R.minor&&!R.patch?"minor":"patch"}const c=e?"pre":"";return a.major!==h.major?c+"major":a.minor!==h.minor?c+"minor":a.patch!==h.patch?c+"patch":"prerelease"},he}var Ee,hr;function at(){if(hr)return Ee;hr=1;const r=j();return Ee=(t,s)=>new r(t,s).major,Ee}var pe,Er;function ot(){if(Er)return pe;Er=1;const r=j();return pe=(t,s)=>new r(t,s).minor,pe}var me,pr;function ut(){if(pr)return me;pr=1;const r=j();return me=(t,s)=>new r(t,s).patch,me}var Re,mr;function ct(){if(mr)return Re;mr=1;const r=V();return Re=(t,s)=>{const a=r(t,s);return a&&a.prerelease.length?a.prerelease:null},Re}var de,Rr;function U(){if(Rr)return de;Rr=1;const r=j();return de=(t,s,a)=>new r(t,a).compare(new r(s,a)),de}var ve,dr;function lt(){if(dr)return ve;dr=1;const r=U();return ve=(t,s,a)=>r(s,t,a),ve}var $e,vr;function ft(){if(vr)return $e;vr=1;const r=U();return $e=(t,s)=>r(t,s,!0),$e}var Ie,$r;function Ke(){if($r)return Ie;$r=1;const r=j();return Ie=(t,s,a)=>{const h=new r(t,a),u=new r(s,a);return h.compare(u)||h.compareBuild(u)},Ie}var Le,Ir;function ht(){if(Ir)return Le;Ir=1;const r=Ke();return Le=(t,s)=>t.sort((a,h)=>r(a,h,s)),Le}var Ne,Lr;function Et(){if(Lr)return Ne;Lr=1;const r=Ke();return Ne=(t,s)=>t.sort((a,h)=>r(h,a,s)),Ne}var Se,Nr;function W(){if(Nr)return Se;Nr=1;const r=U();return Se=(t,s,a)=>r(t,s,a)>0,Se}var Oe,Sr;function Ze(){if(Sr)return Oe;Sr=1;const r=U();return Oe=(t,s,a)=>r(t,s,a)<0,Oe}var Ae,Or;function Kr(){if(Or)return Ae;Or=1;const r=U();return Ae=(t,s,a)=>r(t,s,a)===0,Ae}var Te,Ar;function Zr(){if(Ar)return Te;Ar=1;const r=U();return Te=(t,s,a)=>r(t,s,a)!==0,Te}var ge,Tr;function Je(){if(Tr)return ge;Tr=1;const r=U();return ge=(t,s,a)=>r(t,s,a)>=0,ge}var we,gr;function Qe(){if(gr)return we;gr=1;const r=U();return we=(t,s,a)=>r(t,s,a)<=0,we}var Pe,wr;function Jr(){if(wr)return Pe;wr=1;const r=Kr(),i=Zr(),t=W(),s=Je(),a=Ze(),h=Qe();return Pe=(f,n,R,e)=>{switch(n){case"===":return typeof f=="object"&&(f=f.version),typeof R=="object"&&(R=R.version),f===R;case"!==":return typeof f=="object"&&(f=f.version),typeof R=="object"&&(R=R.version),f!==R;case"":case"=":case"==":return r(f,R,e);case"!=":return i(f,R,e);case">":return t(f,R,e);case">=":return s(f,R,e);case"<":return a(f,R,e);case"<=":return h(f,R,e);default:throw new TypeError(`Invalid operator: ${n}`)}},Pe}var Ce,Pr;function pt(){if(Pr)return Ce;Pr=1;const r=j(),i=V(),{safeRe:t,t:s}=B();return Ce=(h,u)=>{if(h instanceof r)return h;if(typeof h=="number"&&(h=String(h)),typeof h!="string")return null;u=u||{};let f=null;if(!u.rtl)f=h.match(u.includePrerelease?t[s.COERCEFULL]:t[s.COERCE]);else{const m=u.includePrerelease?t[s.COERCERTLFULL]:t[s.COERCERTL];let L;for(;(L=m.exec(h))&&(!f||f.index+f[0].length!==h.length);)(!f||L.index+L[0].length!==f.index+f[0].length)&&(f=L),m.lastIndex=L.index+L[1].length+L[2].length;m.lastIndex=-1}if(f===null)return null;const n=f[2],R=f[3]||"0",e=f[4]||"0",o=u.includePrerelease&&f[5]?`-${f[5]}`:"",c=u.includePrerelease&&f[6]?`+${f[6]}`:"";return i(`${n}.${R}.${e}${o}${c}`,u)},Ce}var qe,Cr;function mt(){if(Cr)return qe;Cr=1;const r=V(),i=X(),t=j(),s=(f,n,R)=>{if(!i.RELEASE_TYPES.includes(n))return null;const e=a(f,R);return e&&h(e,n)},a=(f,n)=>{const R=f instanceof t?f.version:f;return r(R,n)},h=(f,n)=>{if(u(n))return f.version;switch(f.prerelease=[],n){case"major":f.minor=0,f.patch=0;break;case"minor":f.patch=0;break}return f.format()},u=f=>f.startsWith("pre");return qe=s,qe}var De,qr;function Rt(){if(qr)return De;qr=1;class r{constructor(){this.max=1e3,this.map=new Map}get(t){const s=this.map.get(t);if(s!==void 0)return this.map.delete(t),this.map.set(t,s),s}delete(t){return this.map.delete(t)}set(t,s){if(!this.delete(t)&&s!==void 0){if(this.map.size>=this.max){const h=this.map.keys().next().value;this.delete(h)}this.map.set(t,s)}return this}}return De=r,De}var _e,Dr;function F(){if(Dr)return _e;Dr=1;const r=/\s+/g;class i{constructor(l,$){if($=a($),l instanceof i)return l.loose===!!$.loose&&l.includePrerelease===!!$.includePrerelease?l:new i(l.raw,$);if(l instanceof h)return this.raw=l.value,this.set=[[l]],this.formatted=void 0,this;if(this.options=$,this.loose=!!$.loose,this.includePrerelease=!!$.includePrerelease,this.raw=l.trim().replace(r," "),this.set=this.raw.split("||").map(v=>this.parseRange(v.trim())).filter(v=>v.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const v=this.set[0];if(this.set=this.set.filter(S=>!P(S[0])),this.set.length===0)this.set=[v];else if(this.set.length>1){for(const S of this.set)if(S.length===1&&_(S[0])){this.set=[S];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let l=0;l<this.set.length;l++){l>0&&(this.formatted+="||");const $=this.set[l];for(let v=0;v<$.length;v++)v>0&&(this.formatted+=" "),this.formatted+=$[v].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(l){l=l.replace(O,"");const v=((this.options.includePrerelease&&L)|(this.options.loose&&E))+":"+l,S=s.get(v);if(S)return S;const d=this.options.loose,I=d?n[e.HYPHENRANGELOOSE]:n[e.HYPHENRANGE];l=l.replace(I,re(this.options.includePrerelease)),u("hyphen replace",l),l=l.replace(n[e.COMPARATORTRIM],o),u("comparator trim",l),l=l.replace(n[e.TILDETRIM],c),u("tilde trim",l),l=l.replace(n[e.CARETTRIM],m),u("caret trim",l);let g=l.split(" ").map(q=>y(q,this.options)).join(" ").split(/\s+/).map(q=>ee(q,this.options));d&&(g=g.filter(q=>(u("loose invalid filter",q,this.options),!!q.match(n[e.COMPARATORLOOSE])))),u("range list",g);const A=new Map,w=g.map(q=>new h(q,this.options));for(const q of w){if(P(q))return[q];A.set(q.value,q)}A.size>1&&A.has("")&&A.delete("");const b=[...A.values()];return s.set(v,b),b}intersects(l,$){if(!(l instanceof i))throw new TypeError("a Range is required");return this.set.some(v=>G(v,$)&&l.set.some(S=>G(S,$)&&v.every(d=>S.every(I=>d.intersects(I,$)))))}test(l){if(!l)return!1;if(typeof l=="string")try{l=new f(l,this.options)}catch{return!1}for(let $=0;$<this.set.length;$++)if(te(this.set[$],l,this.options))return!0;return!1}}_e=i;const t=Rt(),s=new t,a=ze(),h=Y(),u=H(),f=j(),{safeRe:n,src:R,t:e,comparatorTrimReplace:o,tildeTrimReplace:c,caretTrimReplace:m}=B(),{FLAG_INCLUDE_PRERELEASE:L,FLAG_LOOSE:E}=X(),O=new RegExp(R[e.BUILD],"g"),P=p=>p.value==="<0.0.0-0",_=p=>p.value==="",G=(p,l)=>{let $=!0;const v=p.slice();let S=v.pop();for(;$&&v.length;)$=v.every(d=>S.intersects(d,l)),S=v.pop();return $},y=(p,l)=>(p=p.replace(n[e.BUILD],""),u("comp",p,l),p=k(p,l),u("caret",p),p=D(p,l),u("tildes",p),p=Z(p,l),u("xrange",p),p=Q(p,l),u("stars",p),p),T=p=>!p||p.toLowerCase()==="x"||p==="*",C=(p,l,$)=>T(p)&&!T(l)||T(l)&&$&&!T($),D=(p,l)=>p.trim().split(/\s+/).map($=>N($,l)).join(" "),N=(p,l)=>{const $=l.loose?n[e.TILDELOOSE]:n[e.TILDE],v=l.includePrerelease?"-0":"";return p.replace($,(S,d,I,g,A)=>{u("tilde",p,S,d,I,g,A);let w;return T(d)?w="":T(I)?w=`>=${d}.0.0${v} <${+d+1}.0.0-0`:T(g)?w=`>=${d}.${I}.0${v} <${d}.${+I+1}.0-0`:A?(u("replaceTilde pr",A),w=`>=${d}.${I}.${g}-${A} <${d}.${+I+1}.0-0`):w=`>=${d}.${I}.${g} <${d}.${+I+1}.0-0`,u("tilde return",w),w})},k=(p,l)=>p.trim().split(/\s+/).map($=>K($,l)).join(" "),K=(p,l)=>{u("caret",p,l);const $=l.loose?n[e.CARETLOOSE]:n[e.CARET],v=l.includePrerelease?"-0":"";return p.replace($,(S,d,I,g,A)=>{u("caret",p,S,d,I,g,A);let w;return T(d)?w="":T(I)?w=`>=${d}.0.0${v} <${+d+1}.0.0-0`:T(g)?d==="0"?w=`>=${d}.${I}.0${v} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.0${v} <${+d+1}.0.0-0`:A?(u("replaceCaret pr",A),d==="0"?I==="0"?w=`>=${d}.${I}.${g}-${A} <${d}.${I}.${+g+1}-0`:w=`>=${d}.${I}.${g}-${A} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.${g}-${A} <${+d+1}.0.0-0`):(u("no pr"),d==="0"?I==="0"?w=`>=${d}.${I}.${g} <${d}.${I}.${+g+1}-0`:w=`>=${d}.${I}.${g} <${d}.${+I+1}.0-0`:w=`>=${d}.${I}.${g} <${+d+1}.0.0-0`),u("caret return",w),w})},Z=(p,l)=>(u("replaceXRanges",p,l),p.split(/\s+/).map($=>J($,l)).join(" ")),J=(p,l)=>{p=p.trim();const $=l.loose?n[e.XRANGELOOSE]:n[e.XRANGE];return p.replace($,(v,S,d,I,g,A)=>{if(u("xRange",p,v,S,d,I,g,A),C(d,I,g))return p;const w=T(d),b=w||T(I),q=b||T(g),x=q;return S==="="&&x&&(S=""),A=l.includePrerelease?"-0":"",w?S===">"||S==="<"?v="<0.0.0-0":v="*":S&&x?(b&&(I=0),g=0,S===">"?(S=">=",b?(d=+d+1,I=0,g=0):(I=+I+1,g=0)):S==="<="&&(S="<",b?d=+d+1:I=+I+1),S==="<"&&(A="-0"),v=`${S+d}.${I}.${g}${A}`):b?v=`>=${d}.0.0${A} <${+d+1}.0.0-0`:q&&(v=`>=${d}.${I}.0${A} <${d}.${+I+1}.0-0`),u("xRange return",v),v})},Q=(p,l)=>(u("replaceStars",p,l),p.trim().replace(n[e.STAR],"")),ee=(p,l)=>(u("replaceGTE0",p,l),p.trim().replace(n[l.includePrerelease?e.GTE0PRE:e.GTE0],"")),re=p=>(l,$,v,S,d,I,g,A,w,b,q,x)=>(T(v)?$="":T(S)?$=`>=${v}.0.0${p?"-0":""}`:T(d)?$=`>=${v}.${S}.0${p?"-0":""}`:I?$=`>=${$}`:$=`>=${$}${p?"-0":""}`,T(w)?A="":T(b)?A=`<${+w+1}.0.0-0`:T(q)?A=`<${w}.${+b+1}.0-0`:x?A=`<=${w}.${b}.${q}-${x}`:p?A=`<${w}.${b}.${+q+1}-0`:A=`<=${A}`,`${$} ${A}`.trim()),te=(p,l,$)=>{for(let v=0;v<p.length;v++)if(!p[v].test(l))return!1;if(l.prerelease.length&&!$.includePrerelease){for(let v=0;v<p.length;v++)if(u(p[v].semver),p[v].semver!==h.ANY&&p[v].semver.prerelease.length>0){const S=p[v].semver;if(S.major===l.major&&S.minor===l.minor&&S.patch===l.patch)return!0}return!1}return!0};return _e}var ye,_r;function Y(){if(_r)return ye;_r=1;const r=Symbol("SemVer ANY");class i{static get ANY(){return r}constructor(e,o){if(o=t(o),e instanceof i){if(e.loose===!!o.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,o),this.options=o,this.loose=!!o.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const o=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],c=e.match(o);if(!c)throw new TypeError(`Invalid comparator: ${e}`);this.operator=c[1]!==void 0?c[1]:"",this.operator==="="&&(this.operator=""),c[2]?this.semver=new f(c[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if(typeof e=="string")try{e=new f(e,this.options)}catch{return!1}return h(e,this.operator,this.semver,this.options)}intersects(e,o){if(!(e instanceof i))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new n(e.value,o).test(this.value):e.operator===""?e.value===""?!0:new n(this.value,o).test(e.semver):(o=t(o),o.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!o.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||h(this.semver,"<",e.semver,o)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||h(this.semver,">",e.semver,o)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}ye=i;const t=ze(),{safeRe:s,t:a}=B(),h=Jr(),u=H(),f=j(),n=F();return ye}var je,yr;function z(){if(yr)return je;yr=1;const r=F();return je=(t,s,a)=>{try{s=new r(s,a)}catch{return!1}return s.test(t)},je}var Ge,jr;function dt(){if(jr)return Ge;jr=1;const r=F();return Ge=(t,s)=>new r(t,s).set.map(a=>a.map(h=>h.value).join(" ").trim().split(" ")),Ge}var be,Gr;function vt(){if(Gr)return be;Gr=1;const r=j(),i=F();return be=(s,a,h)=>{let u=null,f=null,n=null;try{n=new i(a,h)}catch{return null}return s.forEach(R=>{n.test(R)&&(!u||f.compare(R)===-1)&&(u=R,f=new r(u,h))}),u},be}var Ue,br;function $t(){if(br)return Ue;br=1;const r=j(),i=F();return Ue=(s,a,h)=>{let u=null,f=null,n=null;try{n=new i(a,h)}catch{return null}return s.forEach(R=>{n.test(R)&&(!u||f.compare(R)===1)&&(u=R,f=new r(u,h))}),u},Ue}var Fe,Ur;function It(){if(Ur)return Fe;Ur=1;const r=j(),i=F(),t=W();return Fe=(a,h)=>{a=new i(a,h);let u=new r("0.0.0");if(a.test(u)||(u=new r("0.0.0-0"),a.test(u)))return u;u=null;for(let f=0;f<a.set.length;++f){const n=a.set[f];let R=null;n.forEach(e=>{const o=new r(e.semver.version);switch(e.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!R||t(o,R))&&(R=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),R&&(!u||t(u,R))&&(u=R)}return u&&a.test(u)?u:null},Fe}var Ve,Fr;function Lt(){if(Fr)return Ve;Fr=1;const r=F();return Ve=(t,s)=>{try{return new r(t,s).range||"*"}catch{return null}},Ve}var ke,Vr;function er(){if(Vr)return ke;Vr=1;const r=j(),i=Y(),{ANY:t}=i,s=F(),a=z(),h=W(),u=Ze(),f=Qe(),n=Je();return ke=(e,o,c,m)=>{e=new r(e,m),o=new s(o,m);let L,E,O,P,_;switch(c){case">":L=h,E=f,O=u,P=">",_=">=";break;case"<":L=u,E=n,O=h,P="<",_="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,o,m))return!1;for(let G=0;G<o.set.length;++G){const y=o.set[G];let T=null,C=null;if(y.forEach(D=>{D.semver===t&&(D=new i(">=0.0.0")),T=T||D,C=C||D,L(D.semver,T.semver,m)?T=D:O(D.semver,C.semver,m)&&(C=D)}),T.operator===P||T.operator===_||(!C.operator||C.operator===P)&&E(e,C.semver))return!1;if(C.operator===_&&O(e,C.semver))return!1}return!0},ke}var xe,kr;function Nt(){if(kr)return xe;kr=1;const r=er();return xe=(t,s,a)=>r(t,s,">",a),xe}var Xe,xr;function St(){if(xr)return Xe;xr=1;const r=er();return Xe=(t,s,a)=>r(t,s,"<",a),Xe}var Be,Xr;function Ot(){if(Xr)return Be;Xr=1;const r=F();return Be=(t,s,a)=>(t=new r(t,a),s=new r(s,a),t.intersects(s,a)),Be}var Me,Br;function At(){if(Br)return Me;Br=1;const r=z(),i=U();return Me=(t,s,a)=>{const h=[];let u=null,f=null;const n=t.sort((c,m)=>i(c,m,a));for(const c of n)r(c,s,a)?(f=c,u||(u=c)):(f&&h.push([u,f]),f=null,u=null);u&&h.push([u,null]);const R=[];for(const[c,m]of h)c===m?R.push(c):!m&&c===n[0]?R.push("*"):m?c===n[0]?R.push(`<=${m}`):R.push(`${c} - ${m}`):R.push(`>=${c}`);const e=R.join(" || "),o=typeof s.raw=="string"?s.raw:String(s);return e.length<o.length?e:s},Me}var He,Mr;function Tt(){if(Mr)return He;Mr=1;const r=F(),i=Y(),{ANY:t}=i,s=z(),a=U(),h=(o,c,m={})=>{if(o===c)return!0;o=new r(o,m),c=new r(c,m);let L=!1;e:for(const E of o.set){for(const O of c.set){const P=n(E,O,m);if(L=L||P!==null,P)continue e}if(L)return!1}return!0},u=[new i(">=0.0.0-0")],f=[new i(">=0.0.0")],n=(o,c,m)=>{if(o===c)return!0;if(o.length===1&&o[0].semver===t){if(c.length===1&&c[0].semver===t)return!0;m.includePrerelease?o=u:o=f}if(c.length===1&&c[0].semver===t){if(m.includePrerelease)return!0;c=f}const L=new Set;let E,O;for(const N of o)N.operator===">"||N.operator===">="?E=R(E,N,m):N.operator==="<"||N.operator==="<="?O=e(O,N,m):L.add(N.semver);if(L.size>1)return null;let P;if(E&&O){if(P=a(E.semver,O.semver,m),P>0)return null;if(P===0&&(E.operator!==">="||O.operator!=="<="))return null}for(const N of L){if(E&&!s(N,String(E),m)||O&&!s(N,String(O),m))return null;for(const k of c)if(!s(N,String(k),m))return!1;return!0}let _,G,y,T,C=O&&!m.includePrerelease&&O.semver.prerelease.length?O.semver:!1,D=E&&!m.includePrerelease&&E.semver.prerelease.length?E.semver:!1;C&&C.prerelease.length===1&&O.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(const N of c){if(T=T||N.operator===">"||N.operator===">=",y=y||N.operator==="<"||N.operator==="<=",E){if(D&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===D.major&&N.semver.minor===D.minor&&N.semver.patch===D.patch&&(D=!1),N.operator===">"||N.operator===">="){if(_=R(E,N,m),_===N&&_!==E)return!1}else if(E.operator===">="&&!N.test(E.semver))return!1}if(O){if(C&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===C.major&&N.semver.minor===C.minor&&N.semver.patch===C.patch&&(C=!1),N.operator==="<"||N.operator==="<="){if(G=e(O,N,m),G===N&&G!==O)return!1}else if(O.operator==="<="&&!N.test(O.semver))return!1}if(!N.operator&&(O||E)&&P!==0)return!1}return!(E&&y&&!O&&P!==0||O&&T&&!E&&P!==0||D||C)},R=(o,c,m)=>{if(!o)return c;const L=a(o.semver,c.semver,m);return L>0?o:L<0||c.operator===">"&&o.operator===">="?c:o},e=(o,c,m)=>{if(!o)return c;const L=a(o.semver,c.semver,m);return L<0?o:L>0||c.operator==="<"&&o.operator==="<="?c:o};return He=h,He}var We,Hr;function gt(){if(Hr)return We;Hr=1;const r=B(),i=X(),t=j(),s=zr(),a=V(),h=tt(),u=st(),f=nt(),n=it(),R=at(),e=ot(),o=ut(),c=ct(),m=U(),L=lt(),E=ft(),O=Ke(),P=ht(),_=Et(),G=W(),y=Ze(),T=Kr(),C=Zr(),D=Je(),N=Qe(),k=Jr(),K=pt(),Z=mt(),J=Y(),Q=F(),ee=z(),re=dt(),te=vt(),p=$t(),l=It(),$=Lt(),v=er(),S=Nt(),d=St(),I=Ot(),g=At(),A=Tt();return We={parse:a,valid:h,clean:u,inc:f,diff:n,major:R,minor:e,patch:o,prerelease:c,compare:m,rcompare:L,compareLoose:E,compareBuild:O,sort:P,rsort:_,gt:G,lt:y,eq:T,neq:C,gte:D,lte:N,cmp:k,coerce:K,truncate:Z,Comparator:J,Range:Q,satisfies:ee,toComparators:re,maxSatisfying:te,minSatisfying:p,minVersion:l,validRange:$,outside:v,gtr:S,ltr:d,intersects:I,simplifyRange:g,subset:A,SemVer:t,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers},We}var Wr=gt();const wt=[{description:"Email + password on better-auth (default)",label:"Email & password",value:"auth"},{description:"Clerk-hosted auth",label:"Clerk",value:"auth-clerk"},{description:"Auth0 (OIDC)",label:"Auth0",value:"auth-auth0"}],Yr="auth",Bt=async r=>await r("Which auth provider?",wt,{default:Yr})??Yr,Mt="mail",Ht=[{description:"Next, react-router, TanStack Start, Astro islands",label:"React",value:"auth-ui-react"},{description:"Nuxt, Vue + Vite",label:"Vue",value:"auth-ui-vue"},{description:"SvelteKit, Svelte + Vite",label:"Svelte",value:"auth-ui-svelte"},{description:"TanStack Start Solid, Solid 1.x + Vite",label:"Solid",value:"auth-ui-solid"},{description:"Solid 2.0 + Vite (@solidjs/web)",label:"Solid 2",value:"auth-ui-solid-v2"},{description:"Analog",label:"Angular",value:"auth-ui-angular"}],Wt="auth-ui-react",Pt=r=>Object.hasOwn(r,"react-native")||Object.hasOwn(r,"@lunora/react-native")||Object.hasOwn(r,"expo"),Ct=r=>{if(!(r===void 0||Wr.validRange(r)===null))return Wr.minVersion(r)?.major},qt=r=>Object.hasOwn(r,"@solidjs/web")||(Ct(r["solid-js"])??0)>=2,Yt=r=>{const i=t=>Object.hasOwn(r,t);if(!Pt(r)){if(qt(r))return"auth-ui-solid-v2";if(i("@lunora/react"))return"auth-ui-react";if(i("@lunora/vue"))return"auth-ui-vue";if(i("@lunora/svelte"))return"auth-ui-svelte";if(i("@lunora/solid"))return"auth-ui-solid";if(i("@lunora/angular"))return"auth-ui-angular";if(i("react")||i("next"))return"auth-ui-react";if(i("vue")||i("nuxt"))return"auth-ui-vue";if(i("svelte")||i("@sveltejs/kit"))return"auth-ui-svelte";if(i("solid-js"))return"auth-ui-solid";if(i("@angular/core"))return"auth-ui-angular"}},zt=r=>{const i=r.trim();if(i==="")return;const t=i.toLowerCase();return t==="auth-ui"||t==="auth-ui-"?{kind:"auth-ui"}:t==="auth"?{kind:"auth"}:t==="email"||t==="mail"?{kind:"email"}:{item:t,kind:"item"}},Dt=/[^a-z0-9]+/u,Qr=(r,i,t)=>{let s=r.toLowerCase().split(Dt).filter(Boolean).join("-").slice(0,t);return s.endsWith("-")&&(s=s.slice(0,-1)),s.length>=i?s:void 0},_t="DB",yt="Name your D1 database (run `wrangler d1 create` to get its id, then put it in wrangler.jsonc)",et=r=>Qr(r,1,64),jt="lunora-db",Gt=r=>et(`${r}-db`)??jt,Kt=async(r,i)=>{const t=Gt(i);return et(await r(yt,{default:t,placeholder:t}))??t},Zt=(r,i)=>Ye(r,"d1_databases",{key:"binding",value:_t},"database_name",i),bt="SEND_EMAIL",Jt="Verified destination email for production delivery (blank = set it later in wrangler.jsonc)",Ut=r=>{const i=r.trim();if(i.length===0||i.includes(" "))return!1;const t=i.indexOf("@");if(t<=0||t!==i.lastIndexOf("@"))return!1;const s=i.slice(t+1);return s.length>=3&&s.includes(".")&&!s.startsWith(".")&&!s.endsWith(".")},Qt=(r,i)=>{const t=r.trim();if(t!==""){if(!Ut(t)){i(`"${t}" doesn't look like an email — leaving the placeholder; set destination_address in wrangler.jsonc.`);return}return t}},es=(r,i)=>Ye(r,"send_email",{key:"name",value:bt},"destination_address",i),Ft="UPLOADS",Vt="Name your R2 bucket (you can rename it in wrangler.jsonc later)",rt=r=>Qr(r,3,63),kt="lunora-uploads",xt=r=>rt(`${r}-uploads`)??kt,rs=async(r,i)=>{const t=xt(i);return rt(await r(Vt,{default:t,placeholder:t}))??t},ts=(r,i)=>Ye(r,"r2_buckets",{key:"binding",value:Ft},"bucket_name",i),ss=(r,i)=>{for(const t of r)(t.status==="created"||t.status==="updated")&&i.success(`${t.status} ${t.path} — ${t.tool} now skips Lunora's generated files`),t.status==="failed"&&i.warn(`could not configure ${t.tool} to skip Lunora's generated files: ${t.message??"unknown error"}. Add the entries by hand, or re-run once the path is writable.`),t.status==="manual"&&t.snippet!==void 0&&i.warn(`${t.path} needs an entry so ${t.tool} skips Lunora's generated files — add:
2
2
  ${t.snippet}`)};export{Ht as A,Yr as D,Mt as E,Jt as M,et as a,Gt as b,Kt as c,xt as d,ss as e,Bt as f,Yt as g,Wt as h,Pt as i,wt as j,es as k,Zt as l,zt as n,rs as p,Qt as r,rt as s,ts as w};
@@ -0,0 +1 @@
1
+ import{r as n,a as o,b as i}from"./commands-BNKj7r1R.mjs";import"./buildRegistryIndex-Zi3bBqpc.mjs";import"./resolve-DZAGzg67.mjs";export{n as runAddCommand,o as runBuildIndexCommand,i as runRegistryViewCommand};
@@ -0,0 +1 @@
1
+ import{resolveDeployDriver as c,resolveProjectTarget as d,execArgsFor as l,detectPackageManager as i}from"@lunora/config";import{defaultSpawner as m}from"./createRecordingSpawner-DJlNacZ6.mjs";const u=async(e,t,o)=>{try{const r=await m({args:t,captureStderr:!0,captureStdoutSilently:!0,command:e,cwd:o});return{code:r.code,stderr:r.stderr??"",stdout:r.stdout??""}}catch(r){return{code:1,stderr:r instanceof Error?r.message:String(r),stdout:""}}},f=e=>{let t;try{t=JSON.parse(e)}catch{return}return Array.isArray(t)?[...t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"&&r.length>0)].toSorted((r,n)=>r.localeCompare(n)):void 0},y=async e=>{const t=c(d(e.cwd)).toolchain?.secretList({environment:e.env,temporary:e.temporary});if(t===void 0)return{error:"deploy target has no command-line toolchain",names:[],ok:!1};const{args:o,command:r}=l(i(e.cwd),t.tool,t.args),a=await(e.runner??u)(r,o,e.cwd);if(a.code!==0)return{error:a.stderr.trim()||`wrangler secret list exited ${String(a.code)}`,names:[],ok:!1};const s=f(a.stdout);return s===void 0?{error:"could not parse `wrangler secret list --format json` output",names:[],ok:!1}:{names:s,ok:!0}};export{y as l};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/cli",
3
- "version": "1.0.0-alpha.201",
3
+ "version": "1.0.0-alpha.203",
4
4
  "description": "The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -52,20 +52,19 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@bomb.sh/tab": "0.0.22",
55
- "@lunora/advisor": "1.0.0-alpha.96",
55
+ "@lunora/advisor": "1.0.0-alpha.97",
56
56
  "@lunora/bindings": "1.0.0-alpha.40",
57
- "@lunora/codegen": "1.0.0-alpha.136",
58
- "@lunora/config": "1.0.0-alpha.168",
57
+ "@lunora/codegen": "1.0.0-alpha.137",
58
+ "@lunora/config": "1.0.0-alpha.170",
59
59
  "@lunora/container": "1.0.0-alpha.35",
60
- "@lunora/d1": "1.0.0-alpha.94",
60
+ "@lunora/d1": "1.0.0-alpha.95",
61
61
  "@lunora/errors": "1.0.0-alpha.24",
62
- "@lunora/mcp": "1.0.0-alpha.93",
62
+ "@lunora/mcp": "1.0.0-alpha.94",
63
63
  "@lunora/runtime": "1.0.0-alpha.78",
64
- "@lunora/seed": "1.0.0-alpha.90",
64
+ "@lunora/seed": "1.0.0-alpha.91",
65
65
  "@visulima/cerebro": "3.0.6",
66
66
  "@visulima/error": "6.1.0",
67
67
  "@visulima/fs": "6.0.0",
68
- "@visulima/package": "5.0.12",
69
68
  "@visulima/pail": "4.1.1",
70
69
  "@visulima/path": "4.0.0",
71
70
  "@visulima/spinner": "1.0.1",
@@ -1 +0,0 @@
1
- import{C as o,R as s,V as C,r as N}from"./cli-RB-BoDnW.mjs";import"./detect-package-manager-DSaAqRof.mjs";import"./createLogger-hGafwf-3.mjs";export{o as COMMANDS,s as REGISTERED_COMMAND_NAMES,C as VERSION,N as runCli};
@@ -1,3 +0,0 @@
1
- import{mkdirSync as O,readFileSync as w,lstatSync as A,writeFileSync as D}from"node:fs";import{join as u,dirname as f}from"node:path";import{fileURLToPath as B}from"node:url";import{resolveHint as E,isLunoraError as S,flattenHint as L,findSolutionByMessage as _}from"@lunora/errors";import{createCerebro as I}from"@visulima/cerebro";import j from"@visulima/cerebro/command/completion";import T from"@visulima/cerebro/command/version";import{A as p}from"./api-spec-lYyq4vL6.mjs";import{T as s}from"./deploy-target-D9GPy_tq.mjs";import{SDK_LANGUAGES as P}from"@lunora/codegen";import{b as U,d as M}from"./detect-package-manager-DSaAqRof.mjs";import{createLogger as k}from"./createLogger-hGafwf-3.mjs";import{VisulimaError as W,renderError as K}from"@visulima/error";import{homedir as J}from"node:os";const F={argument:{description:"Feature or registry item: ai | auth | email | storage | crons | presence | queue | workflow | flags | backup | …",name:"feature",type:String},description:"Add a feature or registry item (ai, auth, email, storage, crons, …) to the current Lunora project",examples:[["lunora add auth","Add authentication (asks which provider)"],["lunora add auth --provider clerk","Add Clerk auth without prompting"],["lunora add auth-ui","Add copy-in auth screens for your framework (auto-detected)"],["lunora add email","Add transactional email (Cloudflare Email Workers + dev mail catcher)"],["lunora add storage","Add the R2 storage registry item (asks for the bucket name)"],["lunora add storage --bucket my-app-uploads","Add storage with a bucket name, no prompt"],["lunora add crons","Add the scheduled-jobs registry item"],["lunora add storage --ref alpha","Add an item from the alpha branch's registry"]],group:"Project",loader:()=>import("../packem_chunks/handler.mjs").then(e=>({default:e.execute})),name:"add",options:[{description:"auth: provider to use without prompting (auth | clerk | auth0)",name:"provider",type:String},{description:"auth: D1 database name to use without prompting (lowercase alphanumeric + hyphens)",name:"db",type:String},{description:"storage: R2 bucket name to use without prompting (lowercase alphanumeric + hyphens)",name:"bucket",type:String},{description:"email: verified destination address to use without prompting",name:"mail-to",type:String},{description:"Skip prompts (auth provider, DB name, bucket name, mail destination) and use the defaults",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Output format: pretty (default) or json",name:"format",type:String}]},y="lunora.advisor.map.json",H={description:"Score your app's advisor findings into a health map, and gate CI on it",examples:[["lunora advisor","Score the app and write lunora.advisor.map.json"],["lunora advisor --all","Show every procedure as a check matrix"],["lunora advisor --entry messages#sendMessage","Inspect one procedure"],["lunora advisor --min-score 80","Exit non-zero when the score drops below 80"],["lunora advisor --baseline","Fail on any regression against the committed map"]],group:"Develop",loader:()=>import("../packem_chunks/handler19.mjs").then(e=>({default:e.execute})),name:"advisor",options:[{description:"Show every procedure as a check matrix, not just the ones with findings",name:"all",type:Boolean},{description:`Compare against a committed map and fail on regression (default ${y})`,name:"baseline",type:String},{description:"Inspect a single procedure by `file#exportName`",name:"entry",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Exit non-zero when the global score is below this value (0-100)",name:"min-score",type:String},{description:`Where to write the map (default ${y})`,name:"out",type:String},{description:"Write the map artifact to disk (default true; use --no-write to skip)",name:"no-write",type:Boolean}]},$={description:"Run wrangler dry-run and report bundle size, top modules, and _generated files",examples:[["lunora analyze","Report the worker bundle size + heaviest modules"]],group:"Deploy",loader:()=>import("../packem_chunks/handler2.mjs").then(e=>({default:e.execute})),name:"analyze",options:[{description:"Emit a JSON report instead of human text",name:"json",type:Boolean}]},V={argument:{description:"create | list | restore <id|file> | retention | prune | pitr",name:"subcommand",type:String},description:"Managed snapshot backups (create | list | restore) to a directory or an R2 bucket, plus native point-in-time recovery (pitr)",examples:[["lunora backup create","Snapshot every table to a backup file"],["lunora backup list","List recorded snapshots"],["lunora backup restore <id>","Restore a snapshot by id"],["lunora backup create --bucket default","Snapshot into an R2 bucket instead of a directory"],["lunora backup restore <id> --bucket default --verify","Restore from R2, checksum first"],["lunora backup retention","Show what the platform's retention would delete next"],["lunora backup prune","Delete the snapshots past the retention window (the only command that deletes backups)"],["lunora backup pitr --at 2026-06-01T00:00:00Z","Point-in-time recovery (≤30 days)"]],group:"Data",loader:()=>import("../packem_chunks/handler23.mjs").then(e=>({default:e.execute})),name:"backup",options:[{description:"Backup directory (default .lunora-backups)",name:"dir",type:String},{description:"Store snapshots in this R2 bucket instead of a directory (use `default` for the app's default bucket)",name:"bucket",type:String},{description:"Key prefix for bucket-backed snapshots (default backups/)",name:"prefix",type:String},{description:"restore: verify the snapshot's checksum before importing anything",name:"verify",type:Boolean},{description:"Comma-separated table allowlist (create)",name:"tables",type:String},{description:"pitr: time to read/restore to (ISO or epoch-ms, ≤30 days)",name:"at",type:String},{description:"pitr --restore: explicit bookmark to restore to (wins over --at)",name:"bookmark",type:String},{description:"pitr: perform a restore instead of just reading the bookmark",name:"restore",type:Boolean},{description:"pitr --restore: restart the shard now so recovery applies immediately",name:"restart",type:Boolean},{description:"pitr: target shard key (default: root shard)",name:"shard",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Confirm a destructive step without prompting: a production pitr --restore, or backup prune",name:"yes",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},G={description:"Codegen + validate + bundle the Worker to disk without deploying",examples:[["lunora build","Bundle to .lunora/build without deploying"],["lunora build --out-dir dist-worker","Bundle to a custom directory"],["lunora build --emit-bindings bindings.json","Also write what the bundle needs provisioned, for an external deployer"]],group:"Deploy",loader:()=>import("../packem_chunks/handler20.mjs").then(e=>({default:e.execute})),name:"build",options:[{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Write a JSON manifest of the bindings + crons the bundle needs to this path, for an IaC program to consume",name:"emit-bindings",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Directory to write the bundled Worker to (default .lunora/build)",name:"out-dir",type:String},s]},q={description:"Run codegen for lunora/ functions and schema",examples:[["lunora codegen","Generate lunora/_generated/ from your schema + functions"]],group:"Develop",loader:()=>import("../packem_chunks/runCodegenCommand.mjs").then(e=>({default:e.execute})),name:"codegen",options:[{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Fail on ERROR-level advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail on ERROR-level advisories (the gate defaults to on in CI, off locally)",name:"no-strict-advisories",type:Boolean},s]},z={argument:{description:"<build|push|images|list|info|delete> [args…]",name:"args",type:String},description:"Build/push container images and manage container instances (wraps wrangler containers)",examples:[["lunora containers build ./containers/transcoder --tag transcoder:v1","Build a container image with the local Docker engine"],["lunora containers build ./containers/transcoder --tag transcoder:v1 --push","Build and push to the Cloudflare Registry in one step"],["lunora containers push transcoder:v1","Push a locally-tagged image to the Cloudflare Registry"],["lunora containers images list","List images in your Cloudflare Registry"],["lunora containers images delete transcoder:v1","Delete an image to free registry storage"]],group:"Deploy",loader:()=>import("../packem_chunks/handler3.mjs").then(e=>({default:e.execute})),name:"containers",options:[{description:"build: push the image to the Cloudflare Registry after building",name:"push",type:Boolean},{description:"build: name:tag for the image (forwarded to wrangler --tag)",name:"tag",type:String},{description:"Cloudflare environment name",name:"env",type:String}]},Y={description:"Codegen, validate wrangler, then wrangler deploy",examples:[["lunora deploy","Deploy to Cloudflare"],["lunora deploy --env production","Deploy to a named environment"],["lunora deploy --dry-run","Validate + bundle without publishing"],["lunora deploy --migrate","Deploy, then run pending data migrations"]],group:"Deploy",loader:()=>import("../packem_chunks/runDeployCommand.mjs").then(e=>({default:e.execute})),name:"deploy",options:[{description:"Override the schema-drift gate (deploy even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Validate, bundle, and run pre-deploy gates without publishing (wrangler deploy --dry-run)",name:"dry-run",type:Boolean},{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"After the deploy, probe the new version's health route (/_lunora/health/ready, falling back to /_lunora/health) and fail if it never answers",name:"health-check",type:Boolean},{description:"After a successful deploy, run pending data migrations against the live worker",name:"migrate",type:Boolean},{description:"Skip codegen + the schema-drift gate (assumes `lunora build`/`prepare` already ran in this CI run). Wrangler still bundles the worker.",name:"prebuilt",type:Boolean},{description:"Admin bearer token for --migrate (falls back to LUNORA_ADMIN_TOKEN)",name:"migrate-token",type:String},{description:"Worker URL for --migrate (REQUIRED with --migrate; the deploy target URL is not captured automatically)",name:"migrate-url",type:String},{description:"Confirm running the production data migration triggered by --migrate (required with --migrate)",name:"migrate-yes",type:Boolean},{description:"Fail the deploy on ERROR-level codegen advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail the deploy on ERROR-level codegen advisories (the gate defaults to on in CI, off locally). Never downgrades platform diagnostics.",name:"no-strict-advisories",type:Boolean},{description:"Upload a preview version (wrangler versions upload) instead of going live — prints a preview URL; doesn't shift production traffic",name:"preview",type:Boolean},s,{description:"Deploy to a temporary Cloudflare account when unauthenticated (wrangler deploy --temporary; live ~60min, then claim or it's deleted). Wrangler errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},Q={argument:{description:"list | inspect <version-id> | rollback [version-id] | promote <version-id>",name:"subcommand",type:String},description:"List deployments and roll back / promote / inspect Worker versions",examples:[["lunora deployments list","Show the 10 most recent deployments"],["lunora deployments inspect <version-id>","View a specific Worker version"],["lunora deployments rollback --yes","Roll back to the previous version"],["lunora deployments promote <version-id> --yes","Send 100% of traffic to a version"]],group:"Deploy",loader:()=>import("../packem_chunks/handler4.mjs").then(e=>({default:e.execute})),name:"deployments",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Display `list` output as JSON",name:"json",type:Boolean},{description:"Reason/description recorded with a rollback or promote",name:"message",type:String},{description:"Confirm a rollback or promote (required — these change live traffic)",name:"yes",type:Boolean}]},X={argument:{description:"Optional subcommand: stop (shut the running dev server down) | status (report it) | logs (print its captured output)",name:"args",type:String},description:"Run the dev stack: wrangler worker + studio + codegen watch",examples:[["lunora dev","Run the worker + studio + codegen watch"],["lunora dev --background","Run detached: blocks until ready, prints URL + PID, then returns"],["lunora dev stop","Stop the background/tracked dev server (idempotent)"],["lunora dev status","Report the running dev server (URL, PID, uptime)"],["lunora dev logs","Print the captured dev-server log (background runs)"],["lunora dev --json","Machine-readable JSON log lines (also LUNORA_LOG_JSON=1)"],["lunora dev --no-studio","Skip the embedded studio server"],["lunora dev --worker-port 8080","Use a custom wrangler dev port"],["lunora dev --remote","Proxy D1/KV/R2 to the deployed worker (also LUNORA_REMOTE=1)"]],group:"Develop",loader:()=>import("../packem_chunks/planDevCommand.mjs").then(e=>({default:e.execute})),name:"dev",options:[{description:`Which API spec(s) codegen emits: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Studio server port (default 6173)",name:"port",type:Number},s,{description:"wrangler dev port (default 8787)",name:"worker-port",type:Number},{description:"Run the dev server as a managed background process (auto-enabled when an AI agent is detected; LUNORA_AGENT_MODE=0 disables)",name:"background",type:Boolean},{description:"Emit machine-readable JSON log lines (also LUNORA_LOG_JSON=1; auto-enabled for AI agents)",name:"json",type:Boolean},{description:"How many trailing lines `lunora dev logs` prints (default 100, 0 = all)",name:"lines",type:Number},{description:"Don't start the embedded studio server",name:"no-studio",type:Boolean},{description:"Don't spawn wrangler dev — an external task runner owns the worker; codegen watch + studio still run",name:"no-worker",type:Boolean},{description:"Don't run codegen — no watch, no startup generate (or set LUNORA_CODEGEN=0)",name:"no-codegen",type:Boolean},{description:"Proxy D1/KV/R2 bindings to the deployed worker (or set LUNORA_REMOTE=1)",name:"remote",type:Boolean}]},Z={argument:{description:"Optional path under the docs site (e.g. addons/studio)",name:"section",type:String},description:"Open the Lunora docs in your browser (optional [section] path)",examples:[["lunora docs","Open the Lunora docs"],["lunora docs addons/studio","Open a specific docs section"]],group:"Project",loader:()=>import("../packem_chunks/handler5.mjs").then(e=>({default:e.execute})),name:"docs"},ee={description:"Preflight the current Lunora project (wrangler bindings, placeholders, dev secrets)",examples:[["lunora doctor","Run the project preflight checks"],["lunora doctor --format json","Emit the findings as a machine-readable JSON document"]],group:"Project",loader:()=>import("../packem_chunks/handler6.mjs").then(e=>({default:e.execute})),name:"doctor",options:[{description:"Output format: pretty (default) or json",name:"format",type:String}]},te={argument:{description:"list | get <KEY> | set <KEY> <VALUE> | unset <KEY> | generate [KEY] | push | diff | doctor",name:"subcommand",type:String},description:"Manage .dev.vars and sync secrets via wrangler (list | get | set | unset | generate | push | diff | doctor)",examples:[["lunora env list","List .dev.vars keys"],["lunora env set API_KEY secret","Set a local variable"],["lunora env generate","Generate strong values for the project's secrets (print KEY=value)"],["lunora env generate AUTH_SECRET --set","Generate one secret and write it to .dev.vars"],["lunora env push --yes","Upload secrets to Cloudflare"],["lunora env diff","Compare local .dev.vars keys against Cloudflare"]],group:"Data",loader:()=>import("../packem_chunks/handler7.mjs").then(e=>({default:e.execute})),name:"env",options:[{description:"Target this Cloudflare environment for `push`/`diff` (passes --env <name> to wrangler)",name:"env",type:String},{description:"Alias for --env production",name:"prod",type:Boolean},{description:"For `generate` — write the generated secrets into .dev.vars instead of printing them",name:"set",type:Boolean},{description:"Push secrets to a temporary-account deployment when unauthenticated (wrangler secret put --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Required for `push` — confirms uploading secrets to Cloudflare",name:"yes",type:Boolean}]},re={description:"Run every *.eval.ts under evals/ via @lunora/testing's evaluate/agentHarness — no live worker needed",examples:[["lunora eval","Run every eval under evals/, print the aggregate table"],["lunora eval --threshold 0.8","Non-zero exit if any eval's average score falls below 0.8"],["lunora eval --dir evals/support --format json","Run a subset and emit a machine-readable result"]],group:"Develop",loader:()=>import("../packem_chunks/handler24.mjs").then(e=>({default:e.execute})),name:"eval",options:[{description:"Directory to discover *.eval.ts files under (default evals/)",name:"dir",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Score gate every eval's average must meet ([0,1]); a per-eval `threshold` export wins over this for that eval",name:"threshold",type:Number}]},oe={argument:{description:"Optional path (alias for --out)",name:"path",type:String},description:"Stream NDJSON of every shard-local + global table from the worker",examples:[["lunora export --out backup.ndjson","Dump every table to an NDJSON file"],["lunora export --tables messages,users","Export only specific tables"]],group:"Data",loader:()=>import("../packem_chunks/handler8.mjs").then(e=>({default:e.execute})),name:"export",options:[{description:"Output file path (`-` for stdout, default)",name:"out",type:String},{description:"Comma-separated table allowlist",name:"tables",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},ne={argument:{description:"Source NDJSON file, or a `npx convex export --path <dir>` directory",name:"file",type:String},description:"Bulk-insert rows from an NDJSON file — or a Convex export directory — via the worker's admin endpoint",examples:[["lunora import backup.ndjson","Bulk-insert rows from an NDJSON file"],["lunora import ./convex-export","Import a `npx convex export --path` directory (ids are preserved, so no remapping)"],["lunora import ./convex-export --with-storage","Also migrate blobs (verified sha256 upload) + `{ $storage }` refs"],["lunora import ./convex-export --scan","Write a candidate `lunora/import-convex.json` storage-column mapping (imports nothing)"],["lunora import ./snapshot.zip --with-storage --verify","Import a `npx convex export --path` zip snapshot with blob + row-parity checks"],["lunora import ./supabase-csv --from supabase","Import a directory of `COPY … TO STDOUT WITH CSV HEADER` dumps"],["lunora import ./firestore-json --from firebase --verify","Import Firestore documents (REST/Admin-SDK JSON) with row-parity checks"]],group:"Data",loader:()=>import("../packem_chunks/handler9.mjs").then(e=>({default:e.execute})),name:"import",options:[{description:"Source reader for a dump that cannot be detected: supabase | firebase (Convex and NDJSON are auto-detected)",name:"from",type:String},{description:"Wrap each bare doc as `{table:<name>,doc:...}`",name:"table",type:String},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"Also migrate file storage — Convex `_storage` blobs, or a Supabase/Firebase bucket (verified upload)",name:"with-storage",type:Boolean},{description:"Directory of storage objects to upload alongside the rows (Firebase: after `gcloud storage cp -r`)",name:"storage-dir",type:String},{description:"Write a candidate `lunora/import-convex.json` storage-column mapping and exit",name:"scan",type:Boolean},{description:"Verify row parity + dangling-storage after import (non-zero exit on mismatch)",name:"verify",type:Boolean},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Confirm bulk-writing production (required with --prod)",name:"yes",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},ae={description:"Print resolved project config: @lunora/* versions, wrangler summary, schema overview",examples:[["lunora info","Print resolved project config"],["lunora info --json","Emit a JSON snapshot"]],group:"Project",loader:()=>import("../packem_chunks/handler10.mjs").then(e=>({default:e.execute})),name:"info",options:[{description:"Emit a JSON snapshot instead of human text",name:"json",type:Boolean}]},ie={argument:{description:"Project name",name:"name",type:String},description:"Scaffold a new Lunora project",examples:[["lunora init my-app","Scaffold with the default (vite) template"],["lunora init my-app -t next","Scaffold a Next.js app"],["lunora init my-app -t tanstack-start-react","Scaffold a TanStack Start (React) app"],["lunora init my-app -t tanstack-start-solid","Scaffold a TanStack Start (Solid) app"],["lunora init my-app -t solid-v2","Scaffold a Solid 2.0 SPA"],["lunora init my-app --ref alpha","Scaffold from the alpha branch's templates"],["lunora init --here","Add Lunora to the current project"],["lunora init my-app --ci github","Scaffold + add a GitHub Actions deploy pipeline"],["lunora init my-app --ci gitlab","Scaffold + add a GitLab CI deploy pipeline"]],group:"Project",loader:()=>import("../packem_chunks/runInitCommand.mjs").then(e=>({default:e.execute})),name:"init",options:[{alias:"t",description:"Bespoke template (standalone | astro | next | nuxt | solid-v2 | sveltekit | tanstack-start-react | tanstack-start-solid | vinext | vinext-pages). For a Solid 1.x / React / Vue / Svelte SPA use --vite react|vue|solid|svelte.",name:"template",type:String},{description:"Scaffold via the create-vite overlay for a framework (react | vue | solid | svelte | vanilla) — official create-vite base + Lunora layer",name:"vite",type:String},{description:"Local templates root to copy from (offline-friendly; expects <type>/ subdirs)",name:"from",type:String},{description:"Override the remote template source (e.g. gh:owner/repo/sub#ref)",name:"source",type:String},{description:"Fetch templates from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https:// (e.g. local file://)",name:"allow-unsafe-source",type:Boolean},{description:"Add Lunora to the current project: detect the framework, patch the config, scaffold lunora/, print per-framework wiring steps",name:"here",type:Boolean},{alias:"i",description:"After scaffolding, offer to add auth + email (defaults on when stdin is a TTY)",name:"interactive",type:Boolean},{alias:"y",description:"Skip the auth/email offer; scaffold only",name:"yes",type:Boolean},{description:"Also scaffold a CI deploy pipeline: github (.github/workflows/deploy.yml) or gitlab (.gitlab-ci.yml)",name:"ci",type:String},{description:"Add features non-interactively after scaffolding (comma-separated): ai | auth | backup | browser | cloudflare-access | crons | email | flags | hyperdrive | payment | presence | queue | storage | workflow",name:"add",type:String},{description:"Walk through every step (prompts + output) without writing files, installing, or running git",name:"dry-run",type:Boolean}]},se={description:"Report write-conflict hot-spots, error rates, and latency outliers from a running Worker",examples:[["lunora insights","Report against the local dev worker"],["lunora insights --shard channel:demo","Scope the report to one shard"],["lunora insights --json","Emit the raw report as JSON"],["lunora insights --prod --url https://app.example.com --token $LUNORA_ADMIN_TOKEN","Report against production"]],group:"Develop",loader:()=>import("../packem_chunks/handler11.mjs").then(e=>({default:e.execute})),name:"insights",options:[{description:"Explicit shard key (defaults to the root shard)",name:"shard",type:String},{description:"Max rows per section (default 10)",name:"limit",type:String},{description:"Emit a JSON report instead of human text",name:"json",type:Boolean},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (or LUNORA_ADMIN_TOKEN)",name:"token",type:String}]},le={description:"Scaffold lunora/schema.ts (and list/get procedures) from an existing Postgres or MySQL database",examples:[["lunora introspect --url postgres://localhost/shop","Scaffold a schema + procedures from every table"],["lunora introspect --tables users,orders","Introspect only these tables (DATABASE_URL is read by default)"],["lunora introspect --dry-run","Print what would be written without touching the filesystem"],["lunora introspect --no-procedures --force","Regenerate just the schema, overwriting the existing file"]],group:"Data",loader:()=>import("../packem_chunks/handler25.mjs").then(e=>({default:e.execute})),name:"introspect",options:[{description:"Database connection string (default: $DATABASE_URL)",name:"url",type:String},{description:"Postgres schema (default `public`) or MySQL database name",name:"schema",type:String},{description:"Comma-separated table allow-list (default: every base table)",name:"tables",type:String},{description:"Also emit list/get procedure modules per table (default true; --no-procedures to skip)",name:"procedures",type:Boolean},{description:"Overwrite files that already exist",name:"force",type:Boolean},{description:"Print what would be written without writing it",name:"dry-run",type:Boolean}]},pe={description:"Link this checkout to its deployed Worker (writes .lunora/project.json)",examples:[["lunora link --url https://app.acme.workers.dev","Link to a deployed Worker URL"],["lunora link --url https://app.acme.workers.dev --env production","Link a named environment"],["lunora link --remove","Remove the link"]],group:"Deploy",loader:()=>import("../packem_chunks/handler12.mjs").then(e=>({default:e.execute})),name:"link",options:[{description:"Cloudflare environment name to record alongside the link",name:"env",type:String},{description:"Worker name (defaults to the `name` in wrangler config)",name:"name",type:String},{description:"Remove the existing link (.lunora/project.json)",name:"remove",type:Boolean},{description:"Deployed Worker URL to link (e.g. https://app.acme.workers.dev)",name:"url",type:String}]},de={argument:{description:"Worker name (defaults to the name in wrangler config)",name:"worker",type:String},description:"Stream live logs from a deployed Worker, or read the durable log archive with --durable",group:"Deploy",loader:()=>import("../packem_chunks/handler21.mjs").then(e=>({default:e.execute})),name:"logs",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Substring filter on log messages",name:"search",type:String},{description:"Filter by invocation status: ok, error, or canceled",name:"status",type:String},s,{description:"Tail a temporary-account deployment when unauthenticated (wrangler tail --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Read the durable log archive (pipelineLogSink → R2) via R2 SQL instead of tailing live",name:"durable",type:Boolean},{description:"durable: Iceberg table the Pipeline writes to (required with --durable)",name:"table",type:String},{description:"durable: Iceberg namespace (R2 Data Catalog database) the table lives in",name:"namespace",type:String},{description:"durable: lower time bound (epoch-millis or ISO 8601), inclusive",name:"since",type:String},{description:"durable: upper time bound (epoch-millis or ISO 8601), inclusive",name:"until",type:String},{description:"durable: exact severity filter (trace|debug|log|info|warn|error|fatal)",name:"level",type:String},{description:"durable: severity floor — this level and every more-severe one",name:"min-level",type:String},{description:"durable: keep function paths starting with this prefix (LIKE 'prefix%')",name:"function-prefix",type:String},{description:"durable: trace-id filter",name:"trace-id",type:String},{description:"durable: shard-key filter",name:"shard-key",type:String},{description:"durable: user-id filter",name:"user-id",type:String},{description:"durable: max rows (clamped to 1–10000; default 500)",name:"limit",type:String},{description:"durable: resume after a prior page — the opaque cursor token printed by the previous page (bare epoch-millis also accepted for back-compat)",name:"cursor",type:String},{description:"durable: emit one JSON object per line instead of a table",name:"ndjson",type:Boolean}]},ce={argument:{description:"install [client…] | uninstall [client…] | serve",name:"args",type:String},description:"Connect your AI editor to Lunora over MCP (docs search + this project's dev server)",examples:[["lunora mcp install","Install into every MCP client already configured here"],["lunora mcp install claude-code cursor","Install into specific clients"],["lunora mcp install --list","List the supported clients and their config files"],["lunora mcp install --docs-only","Install only the hosted documentation server"],["lunora mcp install --print","Show the config that would be written, without writing it"],["lunora mcp install --global","Force every server into the machine-wide config"],["lunora mcp uninstall","Remove Lunora's MCP servers from every supported client"],["lunora mcp uninstall cursor","Remove them from one client"],["lunora mcp uninstall --print","Show what would be removed, without removing it"],["lunora mcp serve","Run the stdio MCP server (this is what your editor spawns)"],["lunora mcp serve --allow-writes","Also expose the mutation/action tools"],["lunora mcp serve --token $LUNORA_ADMIN_TOKEN","Expose the observability tools (logs, issues, advisories, insights, migrations) too"]],group:"Develop",loader:()=>import("../packem_chunks/handler26.mjs").then(e=>({default:e.execute})),name:"mcp",options:[{description:"install: replace entries that already exist",name:"force",type:Boolean},{description:"install: list the supported clients and their config files",name:"list",type:Boolean},{description:"install/uninstall: print what would change instead of writing it",name:"print",type:Boolean},{description:"install/uninstall: only the hosted documentation server",name:"docs-only",type:Boolean},{description:"install/uninstall: only this project's local server",name:"local-only",type:Boolean},{description:"install/uninstall: the machine-wide config (install default: docs server global, local server per-project)",name:"global",type:Boolean},{description:"install/uninstall: this project's config instead of the machine-wide one",name:"project",type:Boolean},{description:"serve: also expose the mutation/action tools (default: read-only)",name:"allow-writes",type:Boolean},{description:"serve: skip the documentation tools",name:"no-docs",type:Boolean},{description:"Docs site origin backing the documentation tools (default https://lunora.sh)",name:"docs-url",type:String},{description:"serve: deployment URL to expose (default: the running dev server)",name:"url",type:String},{description:"serve: bearer token (default: LUNORA_ADMIN_TOKEN from the environment or .dev.vars). Also gates the observability tools (logs, issues, advisories, query insights, migration status) — without a token they are not exposed at all",name:"token",type:String}]},ue={argument:{description:"generate | create | up | down | status | d1-to-hyperdrive [name|id]",name:"subcommand",type:String},description:"Schema (generate), online data (create | up | down | status), and backend (d1-to-hyperdrive) migrations",examples:[["lunora migrate generate","Diff lunora/schema.ts and emit a SQL migration"],["lunora migrate create add_users_email","Scaffold a data migration"],["lunora migrate up backfill-names","Run a data migration across shards"],["lunora migrate status backfill-names","Report a migration's per-shard status"],["lunora migrate d1-to-hyperdrive --from-url https://old --to-url https://new","Copy .global() data from D1 to Hyperdrive"]],group:"Data",loader:()=>import("../packem_chunks/runMigrateGenerateCommand.mjs").then(e=>({default:e.execute})),name:"migrate",options:[{description:"Migration name slug (e.g. add_users_email)",name:"name",type:String},{description:"Target table for `create` (prompted for interactively when omitted)",name:"table",type:String},{description:"Preview a data migration without rewriting rows",name:"dry-run",type:Boolean},{description:"Rows per batch for a data migration",name:"batch-size",type:Number},{description:"Cap batches processed this run (maps to the runner's maxBatches)",name:"steps",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Required with --prod for up/down — confirms running against production",name:"yes",type:Boolean},{description:"d1-to-hyperdrive: source (D1) worker URL (defaults to --url)",name:"from-url",type:String},{description:"d1-to-hyperdrive: source admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"from-token",type:String},{description:"d1-to-hyperdrive: target (Hyperdrive) worker URL (defaults to --url)",name:"to-url",type:String},{description:"d1-to-hyperdrive: target admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"to-token",type:String},{description:"d1-to-hyperdrive: comma-separated .global() tables to move (default: all global tables)",name:"tables",type:String},{description:"d1-to-hyperdrive: keep the intermediate NDJSON dump at this path",name:"out",type:String}]},me={description:"Run codegen + binding reconcile + wrangler validation (no Vite) — for CI",examples:[["lunora prepare","Codegen + binding reconcile + validate (CI, before deploy)"]],group:"Deploy",loader:()=>import("../packem_chunks/handler13.mjs").then(e=>({default:e.execute})),name:"prepare",options:[{description:"Override the schema-drift gate (proceed even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},s,{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},ge={argument:{description:"<add|list|view|build> [item names…]",name:"args",type:String},description:"Component registry: add/list/view items, or build the catalog",examples:[["lunora registry list","List available registry items"],["lunora registry add presence","Scaffold a registry item into lunora/"],["lunora registry build --check","Verify the committed catalog is current"]],group:"Project",loader:()=>import("../packem_chunks/handler14.mjs").then(e=>({default:e.execute})),name:"registry",options:[{description:"add: print the plan and stop without writing",name:"dry-run",type:Boolean},{description:"add: preview the file changes (content diff) and write nothing",name:"diff",type:Boolean},{description:"add: force-overwrite existing files (take the incoming copy)",name:"overwrite",type:Boolean},{description:"add: skip the package.json mutation confirmation prompt",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Emit JSON output (add plan / list)",name:"json",type:Boolean},{description:"build: output path for the catalog (default <root>/index.json)",name:"out",type:String},{description:"build: verify the index is current instead of rewriting it",name:"check",type:Boolean}]},he={description:"Clear local Miniflare state (and .lunora-cache with --all)",examples:[["lunora reset","Clear local Miniflare state"],["lunora reset --all","Also remove .lunora-cache"]],group:"Develop",loader:()=>import("../packem_chunks/runResetCommand.mjs").then(e=>({default:e.execute})),name:"reset",options:[{description:"Also remove .lunora-cache",name:"all",type:Boolean},{description:"Skip the confirmation prompt (required when stdin is not a TTY)",name:"yes",type:Boolean}]},fe={argument:{description:"install | check",name:"subcommand",type:String},description:"Install the Lunora agent skills (AI rules) into .agents/skills/, or check they're present",examples:[["lunora rules install","Copy the Lunora agent skills into .agents/skills/"],["lunora rules install --overwrite","Reinstall, replacing edited skill files"],["lunora rules check","Report which Lunora skills are installed"],["lunora rules check --strict","Exit non-zero when rules are missing (CI gate)"],["lunora rules install --dir packages/app","Install into a specific root instead of the workspace root"]],group:"Project",loader:()=>import("../packem_chunks/handler15.mjs").then(e=>({default:e.execute})),name:"rules",options:[{description:"Install/check root (default: the detected workspace root, not the current directory)",name:"dir",type:String},{description:"install: overwrite skill files that already exist (default: skip them)",name:"overwrite",type:Boolean},{description:"check: exit non-zero when the rules are missing (for CI gating)",name:"strict",type:Boolean}]},ye={argument:{description:"Function path (e.g. messages:send)",name:"functionPath",type:String},description:"Send a single RPC to a running Lunora Worker",examples:[[`lunora run messages:send --args '{"text":"hi"}'`,"Call a function with JSON args"],["lunora run messages:list --shard channel:demo","Target a specific shard"],["lunora run messages:list --as user_123","Run as an authenticated user (needed when the app gates on identity)"]],group:"Develop",loader:()=>import("../packem_chunks/runRpcCommand.mjs").then(e=>({default:e.execute})),name:"run",options:[{description:"JSON-encoded args object",name:"args",type:String},{description:"Run as this user id — dispatches through the admin-gated `runAs` op so identity-gated apps accept the call",name:"as",type:String},{description:`JSON-encoded extra identity claims to forge alongside --as (e.g. '{"org":"acme"}')`,name:"claims",type:String},{description:"Explicit shard key",name:"shard",type:String},{description:"Worker URL (defaults to the running dev server, else http://localhost:8787)",name:"url",type:String},{description:"Admin bearer for --as (prefer LUNORA_ADMIN_TOKEN or .dev.vars; --token is visible to other local processes via the process table)",name:"token",type:String}]},ve={argument:{description:"<generate>",name:"args",type:String},description:"Generate a self-contained typed client SDK for another language from the project's OpenRPC surface",examples:[["lunora sdk generate --lang python","Emit a Python SDK, transport included, into ./sdk/python"],["lunora sdk generate --lang go --out ./clients/go","Choose the language and output directory"],["lunora sdk generate --lang dart","A Flutter-ready Dart client — live queries arrive as a Stream"],["lunora sdk generate --lang kotlin","Any of the registered targets; --lang lists them"],["lunora sdk generate --lang rust --from ./sdks","Copy the transport from a local checkout instead of fetching it"]],group:"Project",loader:()=>import("../packem_chunks/handler22.mjs").then(e=>({default:e.execute})),name:"sdk",options:[{description:`Target language: ${P.join(" | ")}`,name:"lang",type:String},{description:"Output directory (default ./sdk/<lang>)",name:"out",type:String},{description:"Path to the OpenRPC document (default ./lunora/_generated/openrpc.json)",name:"spec",type:String},{description:"Copy the transport from a local directory of per-language transports (the repo's `sdks/`) instead of fetching it",name:"from",type:String},{description:"Git ref to fetch the transport from (default: this CLI's own release tag, so the transport matches the generated surface)",name:"ref",type:String},{description:"Override the remote transport source base (default gh:anolilab/lunora/sdks)",name:"source",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean}]},be={description:"Generate deterministic fake data from lunora/schema.ts and bulk-insert it via the worker's admin endpoint",examples:[["lunora seed","Seed every table with the default row count"],["lunora seed --table posts --count 50","Seed 50 posts; FK-parent tables are seeded automatically"],["lunora seed --reset","Wipe local .wrangler/state, then seed from scratch"],["lunora seed --seed 7 --dry-run","Print the NDJSON for seed 7 without inserting"],["lunora seed --seed 7 --now 1785000000000","Byte-identical rows across runs (pins the clock too)"]],group:"Data",loader:()=>import("../packem_chunks/handler16.mjs").then(e=>({default:e.execute})),name:"seed",options:[{description:"Rows per table (default 10)",name:"count",type:Number},{description:"Seed only this table; its FK-parent tables are seeded automatically",name:"table",type:String},{description:"Deterministic seed — same value yields identical rows (default 0)",name:"seed",type:Number},{description:"Epoch-ms reference for time columns (createdAt, expiresAt, …). Pin it with --seed for byte-identical rows across runs; defaults to now",name:"now",type:Number},{description:"Print the generated NDJSON instead of inserting",name:"dry-run",type:Boolean},{description:"Wipe local .wrangler/state before seeding (local dev only)",name:"reset",type:Boolean},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Skip the confirmation prompt when seeding a non-local/production target",name:"yes",type:Boolean}]},we={description:"Validate wrangler.jsonc + codegen dry-run + tsc --noEmit (no files written)",examples:[["lunora verify","Validate wrangler + codegen + tsc"],["lunora verify --no-typecheck","Skip the TypeScript type-check"],["lunora verify --health-url https://my-app.workers.dev","Also probe the deployment's /_lunora/health"]],group:"Deploy",loader:()=>import("../packem_chunks/handler17.mjs").then(e=>({default:e.execute})),name:"verify",options:[{description:"Treat breaking schema drift as a warning instead of a failure",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${p} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Probe this deployment's /_lunora/health endpoint (off by default; keeps verify offline-safe)",name:"health-url",type:String},{description:"Skip the TypeScript type-check step",name:"no-typecheck",type:Boolean},s]},Se={description:"Open the Lunora studio in your browser (local dev by default, --remote for production)",examples:[["lunora view","Open the studio for local dev"],["lunora view --remote","Open the deployed studio"]],group:"Project",loader:()=>import("../packem_chunks/handler18.mjs").then(e=>({default:e.execute})),name:"view",options:[{description:"Open the deployed worker URL instead of localhost",name:"remote",type:Boolean}]},ke={filterStacktrace:()=>!1,hideErrorCodeView:!0},xe=(e,t={})=>{const r=e instanceof Error?e.message:String(e),o=E(S(e)?{code:e.code,hint:e.hint,message:r}:r),n=new W({hint:o===void 0?void 0:L(o).split(`
2
- `),message:t.reason===void 0?r:`${t.reason}: ${r}`,name:e instanceof Error&&e.name.length>0?e.name:"Error"});return n.stack="",K(n,ke)},Ce=(e,t)=>{const r=Array.from({length:t.length+1},(o,n)=>n);for(let o=1;o<=e.length;o+=1){let n=r[0]??0;r[0]=o;for(let a=1;a<=t.length;a+=1){const i=r[a]??0,d=e[o-1]===t[a-1]?0:1;r[a]=Math.min((r[a-1]??0)+1,i+1,n+d),n=i}}return r[t.length]??0},Ne=(e,t)=>{let r,o=Number.POSITIVE_INFINITY;for(const a of t){const i=Ce(e,a);i<o&&(o=i,r=a)}const n=Math.max(2,Math.ceil(e.length/3));return r!==void 0&&o<=n?r:void 0},Re=e=>`https://registry.npmjs.org/@lunora/cli/${e}`,Oe=1440*60*1e3,Ae=1500,De="0.0.0",Be=/^v/u,Ee=new Set(["alpha","beta","next"]),m=e=>{const t=e.trim().replace(Be,""),r=t.indexOf("-");return r===-1?{core:t,prerelease:""}:{core:t.slice(0,r),prerelease:t.slice(r+1)}},v=e=>{const[t,r,o]=m(e).core.split(".").map(n=>{const a=Number.parseInt(n,10);return Number.isFinite(a)?a:0});return[t??0,r??0,o??0]},Le=(e,t)=>{const r=Number.parseInt(e,10),o=Number.parseInt(t,10);return String(r)===e&&String(o)===t?r>o?1:-1:e>t?1:-1},_e=(e,t)=>{if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;const r=e.split("."),o=t.split(".");for(let n=0;n<Math.max(r.length,o.length);n+=1){const a=r[n],i=o[n];if(a===void 0||i===void 0)return a===void 0?-1:1;if(a!==i)return Le(a,i)}return 0},Ie=(e,t)=>{const r=v(e),o=v(t);for(let n=0;n<3;n+=1)if((r[n]??0)!==(o[n]??0))return(r[n]??0)>(o[n]??0)?1:-1;return _e(m(e).prerelease,m(t).prerelease)},je=e=>{const t=m(e).prerelease.split(".")[0]??"";return Ee.has(t)?t:"latest"},Te=(e,t)=>Ie(t,e)>0,Pe=(e,t,r)=>t-e<r,Ue=(e,t,r="latest",o)=>{const n=`Update available for @lunora/cli: ${e} → ${t}`;if(o===void 0)return`${n} — add @lunora/cli@${r} as a dev dependency to update`;const{args:a,command:i}=U(o,[`@lunora/cli@${r}`],{dev:!0});return`${n} — run \`${i} ${a.join(" ")}\``},x=e=>u(e,"lunora-cli-update.json"),Me=e=>{const t=e.XDG_CACHE_HOME&&e.XDG_CACHE_HOME.length>0?e.XDG_CACHE_HOME:u(J(),".cache"),r=u(t,"lunora");try{O(r,{mode:448,recursive:!0})}catch{}return r},We=e=>{try{const t=JSON.parse(w(x(e),"utf8"));if(t!==null&&typeof t=="object"){const{checkedAt:r,latest:o}=t;if(typeof o=="string"&&typeof r=="number"){const{tag:n}=t;return{checkedAt:r,latest:o,...typeof n=="string"?{tag:n}:{}}}}}catch{}},b=(e,t)=>{try{const r=x(e);try{if(A(r).isSymbolicLink())return}catch{}D(r,`${JSON.stringify(t)}
3
- `,"utf8")}catch{}},Ke=async(e,t)=>{try{const r=await e(Re(t),{signal:AbortSignal.timeout(Ae)});if(!r.ok)return;const o=await r.json(),n=o!==null&&typeof o=="object"?o.version:void 0;return typeof n=="string"?n:void 0}catch{return}},Je=(e,t,r)=>e===De||!r||t.CI!==void 0||t.LUNORA_NO_UPDATE_NOTIFIER!==void 0,Fe=async e=>{const t=e.env??process.env,r=e.isTTY??process.stdout.isTTY;if(Je(e.current,t,r))return;const o=e.cacheDir??Me(t),n=(e.now??Date.now)(),a=e.ttlMs??Oe,i=je(e.current),d=We(o),R=d?.tag??"latest",g=d!==void 0&&R===i?d:void 0;let c=g?.latest;if(g===void 0||!Pe(g.checkedAt,n,a)){const h=await Ke(e.fetchImpl??globalThis.fetch,i);h===void 0?b(o,{checkedAt:n,latest:e.current,tag:i}):(c=h,b(o,{checkedAt:n,latest:h,tag:i}))}c!==void 0&&Te(e.current,c)&&e.logger.warn(Ue(e.current,c,i,e.manager))},He=["init","add","dev","codegen","build","deploy","containers","prepare","link","deployments","logs","run","insights","reset","migrate","export","import","seed","backup","eval","verify","info","doctor","env","analyze","view","docs","registry","rules","mcp"],$e=8,Ve=()=>{try{let e=f(B(import.meta.url));for(let t=0;t<$e;t+=1){try{const o=JSON.parse(w(u(e,"package.json"),"utf8")),n=o!==null&&typeof o=="object"?o:void 0;if(n?.name==="@lunora/cli"&&typeof n.version=="string"&&n.version.length>0)return n.version}catch{}const r=f(e);if(r===e)break;e=r}}catch{}return"0.0.0"},C=Ve(),Ge=[ie,F,X,q,H,G,Y,z,me,pe,Q,de,ye,se,he,ue,oe,ne,be,le,V,re,we,ae,ee,te,$,Se,Z,ge,fe,ce,ve],N=[...Ge,T,j],mt=N.map(e=>e.name),l=e=>e.replaceAll("{",String.raw`\{`).replaceAll("}",String.raw`\}`),qe=e=>e.every(t=>typeof t=="string")?e.map(t=>l(t)):e.map(t=>typeof t=="string"?[l(t)]:t.map(r=>l(r))),ze=e=>({...e,...e.argument===void 0?{}:{argument:{...e.argument,description:l(e.argument.description??"")}},...e.description===void 0?{}:{description:l(e.description)},...e.examples===void 0?{}:{examples:qe(e.examples)},...e.options===void 0?{}:{options:e.options.map(t=>({...t,description:l(t.description??"")}))}}),Ye=e=>{const t={value:0},r=I("lunora",{argv:e.argv===void 0?void 0:[...e.argv],cwd:e.cwd,exit:o=>{t.value=typeof o=="number"?o:0},logger:e.logger,packageName:"@lunora/cli",packageVersion:C});for(const o of N)r.addCommand(ze(o));return{cli:r,exitCode:t}},Qe=/Command "(?<name>[^"]+)" not found/u,Xe=e=>{const t=k(),r=e instanceof Error?e.message:String(e),o=Qe.exec(r);if(!o?.groups){S(e)||_(r)!==void 0?t.error(xe(e)):t.error(r);return}const n=o.groups.name??"",a=Ne(n,He);t.error(`Unknown command "${n}".${a===void 0?"":` Did you mean "${a}"?`}`),t.info("Run `lunora --help` to list commands, or `lunora docs` to open the documentation.")},gt=async(e={})=>{const{cli:t,exitCode:r}=Ye(e);try{await t.run({shouldExitProcess:!1})}catch(n){return Xe(n),1}let o;try{o=M(process.cwd())}catch{}return await Fe({current:C,logger:k(),manager:o}),r.value};export{He as C,y as D,mt as R,C as V,gt as r};