@lunora/cli 1.0.0-alpha.397 → 1.0.0-alpha.399

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 (62) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/index.d.mts +2 -1
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_chunks/dispatch.mjs +1 -1
  6. package/dist/packem_chunks/handler.mjs +1 -1
  7. package/dist/packem_chunks/handler10.mjs +1 -1
  8. package/dist/packem_chunks/handler11.mjs +1 -1
  9. package/dist/packem_chunks/handler12.mjs +1 -1
  10. package/dist/packem_chunks/handler13.mjs +1 -1
  11. package/dist/packem_chunks/handler14.mjs +1 -1
  12. package/dist/packem_chunks/handler15.mjs +1 -1
  13. package/dist/packem_chunks/handler16.mjs +1 -1
  14. package/dist/packem_chunks/handler17.mjs +1 -1
  15. package/dist/packem_chunks/handler18.mjs +1 -1
  16. package/dist/packem_chunks/handler19.mjs +1 -1
  17. package/dist/packem_chunks/handler2.mjs +1 -1
  18. package/dist/packem_chunks/handler20.mjs +1 -1
  19. package/dist/packem_chunks/handler21.mjs +1 -1
  20. package/dist/packem_chunks/handler22.mjs +1 -1
  21. package/dist/packem_chunks/handler23.mjs +2 -2
  22. package/dist/packem_chunks/handler24.mjs +4 -4
  23. package/dist/packem_chunks/handler25.mjs +2 -2
  24. package/dist/packem_chunks/handler26.mjs +4 -4
  25. package/dist/packem_chunks/handler27.mjs +1 -1
  26. package/dist/packem_chunks/handler3.mjs +1 -1
  27. package/dist/packem_chunks/handler4.mjs +3 -3
  28. package/dist/packem_chunks/handler5.mjs +1 -1
  29. package/dist/packem_chunks/handler6.mjs +1 -1
  30. package/dist/packem_chunks/handler7.mjs +1 -1
  31. package/dist/packem_chunks/handler8.mjs +1 -1
  32. package/dist/packem_chunks/handler9.mjs +1 -1
  33. package/dist/packem_chunks/runCodegenCommand.mjs +2 -2
  34. package/dist/packem_chunks/runDeployCommand.mjs +5 -5
  35. package/dist/packem_chunks/runDevCommand.mjs +2 -2
  36. package/dist/packem_chunks/runInitCommand.mjs +13 -12
  37. package/dist/packem_chunks/runResetCommand.mjs +1 -1
  38. package/dist/packem_chunks/runRpcCommand.mjs +1 -1
  39. package/dist/packem_shared/COMMANDS-DOm5ZPh9.mjs +1 -0
  40. package/dist/packem_shared/api-spec-lYyq4vL6.mjs +1 -0
  41. package/dist/packem_shared/cli-iQlT9BYV.mjs +2 -0
  42. package/dist/packem_shared/cli-manifest-DoQ_3bzs.mjs +1 -0
  43. package/dist/packem_shared/{command-CAXl2A1S.mjs → command-BgjsvUFg.mjs} +1 -1
  44. package/dist/packem_shared/{commands-DgUDxkA8.mjs → commands-DvSfLvyt.mjs} +5 -5
  45. package/dist/packem_shared/createLogger-4TujevyB.mjs +2 -0
  46. package/dist/packem_shared/deploy-target-resolve-BTCW1Iv4.mjs +1 -0
  47. package/dist/packem_shared/{output-format-B4eQHi5y.mjs → output-format-DWe_tkTR.mjs} +1 -1
  48. package/dist/packem_shared/plan-Bx3GZGOH.mjs +5 -0
  49. package/dist/packem_shared/{planDevCommand-D8sm56hO.mjs → planDevCommand-BvTaFyy9.mjs} +1 -1
  50. package/dist/packem_shared/{resolve-BrsV4Qyc.mjs → resolve-Bdc9KEUv.mjs} +1 -1
  51. package/dist/packem_shared/runAddCommand-BChdJQ5L.mjs +1 -0
  52. package/dist/packem_shared/{storage-DWhTX8eS.mjs → storage-DNzYhXR-.mjs} +1 -1
  53. package/dist/packem_shared/wrangler-secrets-CTQPpalP.mjs +1 -0
  54. package/package.json +10 -10
  55. package/dist/packem_shared/COMMANDS-BfZ2tXpc.mjs +0 -1
  56. package/dist/packem_shared/cli-DH-MMo4C.mjs +0 -2
  57. package/dist/packem_shared/cli-manifest-CRet0egA.mjs +0 -1
  58. package/dist/packem_shared/createLogger-Cl18I8AX.mjs +0 -2
  59. package/dist/packem_shared/deploy-target-DCWwiuAe.mjs +0 -1
  60. package/dist/packem_shared/plan-Dl57T11P.mjs +0 -5
  61. package/dist/packem_shared/runAddCommand-DTvfp4h2.mjs +0 -1
  62. package/dist/packem_shared/wrangler-secrets-3chIVv3H.mjs +0 -1
@@ -0,0 +1,2 @@
1
+ import{isLunoraError as L,findSolutionByMessage as I}from"@lunora/errors";import{createCerebro as j}from"@visulima/cerebro";import _ from"@visulima/cerebro/command/completion";import T from"@visulima/cerebro/command/version";import{O as s}from"./output-format-DWe_tkTR.mjs";import{A as m}from"./api-spec-lYyq4vL6.mjs";import{deployTargetIds as P,DEFAULT_DEPLOY_TARGET as U,addArgsFor as M,detectPackageManager as W}from"@lunora/config/cli";import{SDK_LANGUAGES as $}from"@lunora/codegen/sdk";import{r as F}from"./cli-manifest-DoQ_3bzs.mjs";import{EXIT_CODE as y,exitCodeForError as J}from"./EXIT_CODE-D_XCixv8.mjs";import{setCommandLogger as S,createLogger as v}from"./createLogger-4TujevyB.mjs";import{r as K}from"./render-lunora-error-C3OJY5wk.mjs";import{mkdirSync as z,readFileSync as G,lstatSync as H,writeFileSync as V}from"node:fs";import{homedir as q}from"node:os";import{join as b}from"node:path";const Y={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},s]},k="lunora.advisor.map.json",Q={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/handler17.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 ${k})`,name:"baseline",type:String},{description:"Inspect a single procedure by `file#exportName`",name:"entry",type:String},s,{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 ${k})`,name:"out",type:String},{description:"Write the map artifact to disk (the default)",name:"write",type:Boolean},{description:"Don't write the map artifact to disk — report only",name:"no-write",type:Boolean}]},X={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:[s]},Z={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 list --format json","Same, as a single JSON document on stdout"],["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/handler21.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},s,{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}]},ee=(()=>{const e=P();return e.length>1?`${e.join(" | ")} (default ${U})`:e.join(" | ")})(),p={description:`Deploy target: ${ee}. Also settable as "target" in lunora.config.*`,name:"target",type:String},te={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/handler18.mjs").then(e=>({default:e.execute})),name:"build",options:[{description:"Override the schema-drift gate for this run (build even with breaking schema drift and no migration; the committed baseline is not advanced)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${m} (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},s,{description:"Directory to write the bundled Worker to (default .lunora/build)",name:"out-dir",type:String},{description:"Fail the build 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 build on ERROR-level codegen advisories (the gate defaults to on in CI, off locally). Never downgrades platform diagnostics.",name:"no-strict-advisories",type:Boolean},p]},re=[{name:"alerts",summary:"usage alerts that catch a runaway bill",usage:"[status | setup | test]"},{name:"ai-gateway",summary:"create or reuse an AI Gateway for ctx.ai and write its id into wrangler vars",usage:""},{name:"containers",summary:"build and push container images, manage instances (wraps wrangler containers)",usage:"<build|push|images|list|info|delete> [args…]"},{name:"deployments",summary:"deployment history; roll back or promote Worker versions",usage:"list | inspect <version-id> | rollback [version-id] | promote <version-id>"},{name:"profile",summary:"capture an on-demand CPU or heap profile (pprof) from the live Worker or one of its Durable Objects",usage:"[worker]"}],R={argument:{description:`${re.map(e=>e.name).join(" | ")}, then the tool's own arguments`,name:"tool",type:String},description:"Cloudflare-only tools: usage alerts, AI Gateway, containers, deployments, profiling",examples:[["lunora cloudflare","List the tools"],["lunora cloudflare alerts","Show last month's usage and which products have an alert"],["lunora cloudflare alerts setup --email ops@example.com --dry-run","Show the alerts setup would create, without creating them"],["lunora cloudflare alerts setup --email ops@example.com --multiplier 5 --yes","Create or update the alerts at 5x last month"],["lunora cloudflare alerts setup --email ops@example.com --threshold do-duration=500000 --yes","Also alert on Durable Objects duration at a limit you choose"],["lunora cloudflare alerts test","Show what Cloudflare has delivered to your alert destinations"],["lunora cloudflare ai-gateway","Create (or reuse) a gateway named after the worker and wire it into wrangler vars"],["lunora cloudflare ai-gateway --id my-gateway --no-logs","Use an explicit gateway id, with prompt/response log collection off"],["lunora cloudflare ai-gateway --dry-run","Print what would be created and written, without calling Cloudflare"],["lunora cloudflare containers build ./containers/transcoder --tag transcoder:v1 --push","Build an image and push it to the Cloudflare Registry"],["lunora cloudflare containers images list","List images in your Cloudflare Registry"],["lunora cloudflare containers list --format json","List container instances as JSON (also `info`, `images list`)"],["lunora cloudflare containers images delete transcoder:v1","Delete an image to free registry storage"],["lunora cloudflare deployments list","Show the 10 most recent deployments"],["lunora cloudflare deployments inspect <version-id>","View a specific Worker version"],["lunora cloudflare deployments rollback --yes","Roll back to the previous version"],["lunora cloudflare deployments promote <version-id> --yes","Send 100% of traffic to a version"],["lunora cloudflare profile","Capture a 10s CPU profile of the latest version into ./<worker>-cpu-<time>.pprof.gz"],["lunora cloudflare profile --type heap --duration-ms 30000 --out heap.pprof.gz","Capture a 30s heap (allocation) profile"],["lunora cloudflare profile --namespace-id <id> --actor-id <64-hex>","Profile one Durable Object instance"]],group:"Deploy",loader:()=>import("../packem_chunks/handler27.mjs").then(e=>({default:e.execute})),name:"cloudflare",options:[{description:"alerts setup: email address to notify. Repeatable",lazyMultiple:!0,name:"email",type:String},{description:"alerts setup / test: Cloudflare webhook destination id. Repeatable",lazyMultiple:!0,name:"webhook",type:String},{description:"alerts setup: alert at this many times last month's usage (default 3)",name:"multiplier",type:String},{description:"alerts setup: set one metric's limit yourself, in the product's unit: <metric>=<n>. Repeatable",lazyMultiple:!0,name:"threshold",type:String},{description:"alerts setup: accept the floor for a metric whose usage could not be read",name:"allow-floor",type:Boolean},{description:"alerts setup: replace an updated alert's recipients instead of adding to them",name:"replace-recipients",type:Boolean},{description:"alerts setup / ai-gateway: show the plan without creating, updating or writing anything",name:"dry-run",type:Boolean},{description:"alerts setup: apply the plan without asking (required when stdin is not a TTY). deployments rollback / promote: confirm the traffic change (required)",name:"yes",type:Boolean},{description:"ai-gateway: gateway id (default: the worker `name` from wrangler.jsonc)",name:"id",type:String},{description:"ai-gateway: collect request/response logs in the gateway (default)",name:"logs",type:Boolean},{description:"ai-gateway: create the gateway with log collection off (prompts and responses are not stored)",name:"no-logs",type:Boolean},{description:"containers build: name:tag for the image (forwarded to wrangler --tag)",name:"tag",type:String},{description:"containers build: push the image to the Cloudflare Registry after building",name:"push",type:Boolean},{description:"containers / deployments / profile: Cloudflare environment name",name:"env",type:String},{description:"profile: capture window in ms, 1000–50000 (default 10000)",name:"duration-ms",type:String},{description:"profile: cpu (default) or heap",name:"type",type:String},{description:"profile: Worker version id to profile (default latest)",name:"version-id",type:String},{description:"profile: file to write the gzip pprof to (default <worker>-<type>-<time>.pprof.gz)",name:"out",type:String},{description:"profile: Durable Object namespace id (with --actor-id)",name:"namespace-id",type:String},{description:"profile: Durable Object instance id, 64 hex characters (with --namespace-id)",name:"actor-id",type:String},{description:"deployments rollback / promote: reason recorded with the change",name:"message",type:String},{...s,description:"Output format: pretty (default) or json (containers: list | info | images list; deployments: list only)"},p]},oe={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: ${m} (default openapi)`,name:"api-spec",type:String},s,{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},p]},ae={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 --migrate-yes --migrate-url <url>","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 for this run (deploy even with breaking schema drift and no migration; the committed baseline is not advanced — use --update-schema-baseline to accept the new shape)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${m} (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},s,{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},{description:"Deploy only the app, not the lunora.config services it binds (they deploy first by default)",name:"skip-services",type:Boolean},p,{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}]},ne={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, ready/starting)"],["lunora dev status --json","Same as JSON — poll `.ready` to gate a dependent step in a task graph"],["lunora dev logs","Print the captured dev-server log (background runs)"],["lunora dev --json","Stream machine-readable JSON log LINES (a stream, not a --format json document)"],["lunora dev --emit-bindings dev-manifest.json","Write what this worker needs + where it serves, for a task runner"],["lunora dev --no-studio","Skip the embedded studio server"],["lunora dev --worker-port 8080","Use a custom wrangler dev port"],["lunora dev --inspector-port 9235","Pin wrangler's devtools inspector port instead of letting it walk up from 9229"],["lunora dev --remote","Proxy D1/KV/R2 to the deployed worker (also LUNORA_REMOTE=1)"],["lunora dev --local","Start no remote proxy session, e.g. in CI where a service's `ai` binding has no credentials"],["lunora dev --tunnel","Share the worker on a public *.trycloudflare.com URL (needs cloudflared ≥ 2026.9.3)"],["lunora dev --tunnel --allow-mail you@example.com","Same, but visitors must confirm an allowed email with a one-time PIN"]],group:"Develop",loader:()=>import("../packem_chunks/runDevCommand.mjs").then(e=>({default:e.execute})),name:"dev",options:[{description:`Which API spec(s) codegen emits: ${m} (default openapi)`,name:"api-spec",type:String},{description:"Write the binding manifest (plus the dev origin) to <file>, for a supervisor that owns the rest of the graph",name:"emit-bindings",type:String},{description:"wrangler dev inspector port, for `wrangler dev` only (defaults to `dev.inspector_port` in wrangler.jsonc; unset, wrangler probes upward from 9229 and can take a sibling worker's pinned port)",name:"inspector-port",type:Number},{description:"Studio server port (default 6173)",name:"port",type:Number},p,{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:"Machine-readable JSON log lines while the server runs, and a JSON result for `dev status`/`dev stop` (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:"Serve the embedded studio at /__lunora (default)",name:"studio",type:Boolean},{description:"Don't start the embedded studio server",name:"no-studio",type:Boolean},{description:"Spawn wrangler dev for the worker (default)",name:"worker",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:"Run codegen on startup and watch for changes (default)",name:"codegen",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},{description:"Pass --local to wrangler dev: no remote proxy session, so an `ai` binding (in the app or a service) cannot stop dev from starting without Cloudflare credentials — it fails when called instead",name:"local",type:Boolean},{description:"Share the worker through a Cloudflare quick tunnel (*.trycloudflare.com, needs cloudflared ≥ 2026.9.3). PUBLIC unless --allow-mail is given",name:"tunnel",type:Boolean},{description:"With --tunnel: only these emails get in, after a one-time PIN (passed to cloudflared as --allowed-mail). Repeatable; accepts a comma list and '*@domain'",lazyMultiple:!0,name:"allow-mail",type:String}]},ie={argument:{description:"Optional path under the docs site (e.g. packages/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 packages/studio","Open a specific docs section"]],group:"Project",loader:()=>import("../packem_chunks/handler3.mjs").then(e=>({default:e.execute})),name:"docs"},se={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"],["lunora doctor --fix","Create the D1 databases the config names and mint the local dev secrets"],["lunora doctor --fix --dry-run","Show what --fix would create or write, without doing it"]],group:"Project",loader:()=>import("../packem_chunks/handler25.mjs").then(e=>({default:e.execute})),name:"doctor",options:[s,{description:"Resolve what can be resolved: create placeholder D1 databases, mint missing .dev.vars secrets",name:"fix",type:Boolean},{description:"With --fix: print the changes without making them",name:"dry-run",type:Boolean}]},le={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"],["lunora env diff --format json","Same, as a single JSON document on stdout"]],group:"Data",loader:()=>import("../packem_chunks/handler4.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},s,{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}]},de={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/handler22.mjs").then(e=>({default:e.execute})),name:"eval",options:[{description:"Directory to discover *.eval.ts files under (default evals/)",name:"dir",type:String},s,{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}]},pe={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"],["lunora export --out backup.ndjson --format json","Write the dump to a file and report rows/bytes as JSON"]],group:"Data",loader:()=>import("../packem_chunks/handler5.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},{...s,description:"Output format: pretty (default) or json — json needs --out <file>, since stdout carries the NDJSON"},{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}]},ce={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/handler6.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},s,{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}]},ue={description:"Print resolved project config: @lunora/* versions, wrangler summary, schema overview",examples:[["lunora info","Print resolved project config"],["lunora info --format json","Emit a JSON snapshot"],["lunora info --bindings","List what this Worker needs provisioned: bindings, crons, vars"],["lunora info --bindings --format json","Emit the manifest a deployer or task runner consumes"],["lunora info --bindings --out reqs.json","Write that manifest to a file"]],group:"Project",loader:()=>import("../packem_chunks/handler7.mjs").then(e=>({default:e.execute})),name:"info",options:[{description:"Report only what this Worker needs provisioned, as the binding manifest",name:"bindings",type:Boolean},s,{description:"With --bindings: write the manifest to <file> instead of stdout",name:"out",type:String}]},me={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 -t rspack-react","Scaffold a React SPA on Rsbuild"],["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:"Template: analog | astro | expo | next | nuxt | react-router | rspack-react | solid-v2 | standalone | sveltekit | tanstack-start-react | tanstack-start-react-rspack | tanstack-start-solid | vinext | vinext-pages. Also accepts an overlay framework (react | vue | solid | svelte), same as --vite.",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 | auth-ui | 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}]},he={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 --format 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/handler8.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},s,{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}]},ge={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/handler24.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 (the default)",name:"procedures",type:Boolean},{description:"Emit only the schema — skip the per-table list/get procedure modules",name:"no-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},s]},fe={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/handler9.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}]},ye={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/handler23.mjs").then(e=>({default:e.execute})),name:"logs",options:[{description:"Cloudflare environment name",name:"env",type:String},s,{description:"Substring filter on log messages",name:"search",type:String},{description:"Filter by invocation status: ok, error, or canceled",name:"status",type:String},p,{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}]},ve={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: expose the documentation tools (default)",name:"docs",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}]},be={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 status backfill-names --format json","Same, as a single JSON document on stdout"],["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/dispatch.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},s,{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}]},we={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/handler10.mjs").then(e=>({default:e.execute})),name:"prepare",options:[{description:"Override the schema-drift gate for this run (proceed even with breaking schema drift and no migration; the committed baseline is not advanced)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${m} (default openapi)`,name:"api-spec",type:String},{description:"Fail on ERROR-level codegen advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail on ERROR-level codegen advisories (the gate defaults to on in CI, off locally). Never downgrades platform diagnostics.",name:"no-strict-advisories",type:Boolean},p,{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},Se={description:"Capture an on-demand CPU or heap profile (pprof) from a running Node-target app",examples:[["lunora profile --target node --url https://app.example.com/__profile","Capture a 10 s CPU profile of the app"],["lunora profile --target node --url http://localhost:3000/__profile --type heap --duration-ms 30000","Capture a 30 s heap profile of a local app"],["lunora profile --target node --url https://app.example.com/__profile --out cpu.pprof.gz","Write the profile to a named file"]],group:"Develop",loader:()=>import("../packem_chunks/handler19.mjs").then(e=>({default:e.execute})),name:"profile",options:[{description:"Capture window in ms, 1000–50000 (default 10000)",name:"duration-ms",type:String},{description:"cpu (default) or heap",name:"type",type:String},{description:"File to write the gzip pprof to (default profile-<type>-<time>.pprof.gz)",name:"out",type:String},{description:"Full URL of the profile route the app mounts createNodeProfileHandler on",name:"url",type:String},{description:"Admin bearer token (or LUNORA_ADMIN_TOKEN)",name:"token",type:String},p]},ke={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 --from ./registry --check","Verify the committed catalog is current"]],group:"Project",loader:()=>import("../packem_chunks/handler11.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},{...s,description:"Output format: pretty (default) or json (add plan / list)"},{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}]},xe={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}]},Ce={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/handler12.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}]},Re={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)"],["lunora run messages:list --format json","Emit the RPC result as a single JSON document on stdout"]],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},s,{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}]},Oe={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/handler20.mjs").then(e=>({default:e.execute})),name:"sdk",options:[{description:`Target language: ${$.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}]},Ne={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 --format json","Report generated / inserted / conflicts per table as JSON"],["lunora seed --seed 7 --now 1785000000000","Byte-identical rows across runs (pins the clock too)"]],group:"Data",loader:()=>import("../packem_chunks/handler13.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},s,{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}]},Ae={argument:{description:"prune",name:"subcommand",type:String},description:"Maintain the shard registry: prune shards that no longer hold any rows of their .shardBy() table",examples:[["lunora shards prune --dry-run","Show which registered shards are empty, without removing anything"],["lunora shards prune","Remove the empty shards from the registry"],["lunora shards prune --tables messages","Only prune the shards listed for `messages`"],["lunora shards prune --prod --url https://app.example.com","Prune production"]],group:"Data",loader:()=>import("../packem_chunks/handler14.mjs").then(e=>({default:e.execute})),name:"shards",options:[{description:"Comma-separated .shardBy() tables (default: all of them)",name:"tables",type:String},{description:"Report what would be pruned without changing the registry",name:"dry-run",type:Boolean},s,{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (defaults to the running dev server)",name:"url",type:String},{description:"Admin bearer token (or LUNORA_ADMIN_TOKEN)",name:"token",type:String}]},De={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"],["lunora verify --env production","Validate the env.production view, as `lunora deploy --env production` will"]],group:"Deploy",loader:()=>import("../packem_chunks/handler15.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: ${m} (default openapi)`,name:"api-spec",type:String},{description:"Cloudflare environment name — validate the env.<name> view of wrangler.jsonc, as `lunora deploy --env` does",name:"env",type:String},s,{description:"Probe this deployment's /_lunora/health endpoint (off by default; keeps verify offline-safe)",name:"health-url",type:String},{description:"Fail verification on ERROR-level codegen advisories even locally (the gate already defaults to on in CI)",name:"strict-advisories",type:Boolean},{description:"Don't fail verification 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:"Run the TypeScript type-check step (default)",name:"typecheck",type:Boolean},{description:"Skip the TypeScript type-check step",name:"no-typecheck",type:Boolean},p]},Be={description:"Open the Lunora studio in your browser (the running dev server's, or the default local one)",examples:[["lunora view","Open the studio for the running dev server"]],group:"Project",loader:()=>import("../packem_chunks/handler16.mjs").then(e=>({default:e.execute})),name:"view"},Ee=(e,t)=>{const r=Array.from({length:t.length+1},(o,a)=>a);for(let o=1;o<=e.length;o+=1){let a=r[0]??0;r[0]=o;for(let n=1;n<=t.length;n+=1){const i=r[n]??0,l=e[o-1]===t[n-1]?0:1;r[n]=Math.min((r[n-1]??0)+1,i+1,a+l),a=i}}return r[t.length]??0},O=(e,t)=>{let r,o=Number.POSITIVE_INFINITY;for(const n of t){const i=Ee(e,n);i<o&&(o=i,r=n)}const a=Math.max(2,Math.ceil(e.length/3));return r!==void 0&&o<=a?r:void 0},Le=e=>`https://registry.npmjs.org/@lunora/cli/${e}`,Ie=1440*60*1e3,je=1500,_e="0.0.0",Te=/^v/u,Pe=new Set(["alpha","beta","next"]),g=e=>{const t=e.trim().replace(Te,""),r=t.indexOf("-");return r===-1?{core:t,prerelease:""}:{core:t.slice(0,r),prerelease:t.slice(r+1)}},x=e=>{const[t,r,o]=g(e).core.split(".").map(a=>{const n=Number.parseInt(a,10);return Number.isFinite(n)?n:0});return[t??0,r??0,o??0]},Ue=(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},Me=(e,t)=>{if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;const r=e.split("."),o=t.split(".");for(let a=0;a<Math.max(r.length,o.length);a+=1){const n=r[a],i=o[a];if(n===void 0||i===void 0)return n===void 0?-1:1;if(n!==i)return Ue(n,i)}return 0},We=(e,t)=>{const r=x(e),o=x(t);for(let a=0;a<3;a+=1)if((r[a]??0)!==(o[a]??0))return(r[a]??0)>(o[a]??0)?1:-1;return Me(g(e).prerelease,g(t).prerelease)},$e=e=>{const t=g(e).prerelease.split(".")[0]??"";return Pe.has(t)?t:"latest"},Fe=(e,t)=>We(t,e)>0,Je=(e,t,r)=>t-e<r,Ke=(e,t,r="latest",o)=>{const a=`Update available for @lunora/cli: ${e} → ${t}`;if(o===void 0)return`${a} — add @lunora/cli@${r} as a dev dependency to update`;const{args:n,command:i}=M(o,[`@lunora/cli@${r}`],{dev:!0});return`${a} — run \`${i} ${n.join(" ")}\``},N=e=>b(e,"lunora-cli-update.json"),ze=e=>{const t=e.XDG_CACHE_HOME&&e.XDG_CACHE_HOME.length>0?e.XDG_CACHE_HOME:b(q(),".cache"),r=b(t,"lunora");try{z(r,{mode:448,recursive:!0})}catch{}return r},Ge=e=>{try{const t=JSON.parse(G(N(e),"utf8"));if(t!==null&&typeof t=="object"){const{checkedAt:r,latest:o}=t;if(typeof o=="string"&&typeof r=="number"){const{tag:a}=t;return{checkedAt:r,latest:o,...typeof a=="string"?{tag:a}:{}}}}}catch{}},C=(e,t)=>{try{const r=N(e);try{if(H(r).isSymbolicLink())return}catch{}V(r,`${JSON.stringify(t)}
2
+ `,"utf8")}catch{}},He=async(e,t)=>{try{const r=await e(Le(t),{signal:AbortSignal.timeout(je)});if(!r.ok)return;const o=await r.json(),a=o!==null&&typeof o=="object"?o.version:void 0;return typeof a=="string"?a:void 0}catch{return}},Ve=(e,t,r)=>e===_e||!r||t.CI!==void 0||t.LUNORA_NO_UPDATE_NOTIFIER!==void 0,qe=async e=>{const t=e.env??process.env,r=e.isTTY??process.stdout.isTTY;if(Ve(e.current,t,r))return;const o=e.cacheDir??ze(t),a=(e.now??Date.now)(),n=e.ttlMs??Ie,i=$e(e.current),l=Ge(o),c=l?.tag??"latest",d=l!==void 0&&c===i?l:void 0;let h=d?.latest;if(d===void 0||!Je(d.checkedAt,a,n)){const f=await He(e.fetchImpl??globalThis.fetch,i);f===void 0?C(o,{checkedAt:a,latest:e.current,tag:i}):(h=f,C(o,{checkedAt:a,latest:f,tag:i}))}h!==void 0&&Fe(e.current,h)&&e.logger.warn(Ke(e.current,h,i,e.manager))},A=["init","add","dev","codegen","build","deploy","prepare","link","cloudflare","logs","run","insights","profile","reset","migrate","export","import","seed","shards","backup","eval","verify","info","doctor","env","analyze","view","docs","registry","rules","mcp"],D=F(),Ye=[me,Y,ne,oe,Q,te,ae,we,fe,R,ye,Re,he,Se,xe,be,pe,ce,Ne,Ae,ge,Z,de,De,ue,se,le,X,Be,ie,ke,Ce,ve,Oe],B=[...Ye,T,_],Ct=B.map(e=>e.name),u=e=>e.replaceAll("{",String.raw`\{`).replaceAll("}",String.raw`\}`),Qe=e=>e.every(t=>typeof t=="string")?e.map(t=>u(t)):e.map(t=>typeof t=="string"?[u(t)]:t.map(r=>u(r))),Xe=e=>({...e,...e.argument===void 0?{}:{argument:{...e.argument,description:u(e.argument.description??"")}},...e.description===void 0?{}:{description:u(e.description)},...e.examples===void 0?{}:{examples:Qe(e.examples)},...e.options===void 0?{}:{options:e.options.map(t=>({...t,description:u(t.description??"")}))}}),Ze=e=>{const t={value:0},r=j("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:D});for(const o of B)r.addCommand(Xe(o));return{cli:r,exitCode:t}},et=/Command "(?<name>[^"]+)" not found/u,w={ai:{absorbs:"gateway",to:"cloudflare ai-gateway"},alerts:{to:"cloudflare alerts"},containers:{to:"cloudflare containers"},deployments:{to:"cloudflare deployments"}},tt=new Set((R.options??[]).filter(e=>e.type!==Boolean).map(e=>`--${e.name}`)),rt=/^[\w@%+=:,./-]+$/u,ot=e=>rt.test(e)?e:`'${e.replaceAll("'",String.raw`'\''`)}'`,at=(e,t)=>{const r=e.indexOf(t);return r===-1?[...e]:[...e.slice(0,r),...e.slice(r+1)]},nt=(e,t)=>e.findIndex((r,o)=>r===t&&(o===0||!tt.has(e[o-1]??""))),it=e=>{const t=O(e,[...A,...Object.keys(w)]);return t!==void 0&&Object.hasOwn(w,t)?t:void 0},E=(e,t,r)=>{const o=it(e),a=o===void 0?void 0:w[o];if(o===void 0||a===void 0)return;const n=e===o?"":`\`lunora ${e}\` is not a command. `;let i=[...t];if(a.absorbs!==void 0){const d=nt(i,a.absorbs);if(d===-1&&r===void 0)return`${n}\`lunora ${o}\` had one subcommand, \`${a.absorbs}\`; it moved to \`lunora ${a.to}\`.`;i=d===-1?i:[...i.slice(0,d),...i.slice(d+1)]}const l=a.absorbs===void 0?o:`${o} ${a.absorbs}`,c=r??["lunora",a.to,...i.map(d=>ot(d))].join(" ");return`${n}\`lunora ${l}\` moved to \`lunora ${a.to}\`. Run: ${c}`},st=(e,t)=>{const r=v(),o=e instanceof Error?e.message:String(e),a=et.exec(o);if(!a?.groups)return L(e)||I(o)!==void 0?r.error(K(e)):r.error(o),J(e);const n=a.groups.name??"",i=n.split(" ")[0]??"",l=E(i,at(t,i));if(l!==void 0)return r.error(l),y.USAGE;const c=O(n,A);return r.error(`Unknown command "${n}".${c===void 0?"":` Did you mean "${c}"?`}`),r.info("Run `lunora --help` to list commands, or `lunora docs` to open the documentation."),y.USAGE},lt=e=>({debug:t=>{e.debug(t)},error:t=>{e.error(t)},info:t=>{e.info(t)},success:t=>{e.info(t)},warn:t=>{e.warn(t)}}),Rt=async(e={})=>{const{cli:t,exitCode:r}=Ze(e);e.logger!==void 0&&S(lt(e.logger));const o=e.argv??process.argv.slice(2);try{const n=o[0]==="help"&&o[1]!==void 0?E(o[1],o.slice(2),"lunora help cloudflare"):void 0;if(n!==void 0)return v().error(n),y.USAGE;await t.run({shouldExitProcess:!1})}catch(n){return st(n,o)}finally{S(void 0)}let a;try{a=W(process.cwd())}catch{}return await qe({current:D,logger:v(),manager:a}),r.value};export{A as C,k as D,Ct as R,D as V,re as a,Rt as r};
@@ -0,0 +1 @@
1
+ import{fileURLToPath as s}from"node:url";import{readProjectManifest as e}from"@lunora/config/cli";import{findUpSync as a}from"@visulima/fs";import{dirname as t}from"@visulima/path";const m=(i=t(s(import.meta.url)))=>{const o=a(n=>e(n)?.name==="@lunora/cli"?"package.json":void 0,{cwd:i});return o===void 0?void 0:t(o)};let r;const p=()=>{if(r===void 0){const i=m(),o=i===void 0?void 0:e(i)?.version;r=typeof o=="string"&&o!==""?o:"0.0.0"}return r};export{m as f,p as r};
@@ -1 +1 @@
1
- import{isLunoraError as p,findSolutionByMessage as d}from"@lunora/errors";import{EXIT_CODE as c,exitCodeForError as f}from"./EXIT_CODE-D_XCixv8.mjs";import{createLogger as g}from"./createLogger-Cl18I8AX.mjs";import{p as u,l as E,a as C}from"./output-format-B4eQHi5y.mjs";import{P as L}from"./prompt-cancelled-BvsNxg_Q.mjs";import{r as F}from"./render-lunora-error-C3OJY5wk.mjs";const m=(t,r)=>{t!=="json"||r.delegated===!0||C({code:r.code,data:r.data,error:r.error})},O=t=>async r=>{const s=g(),a=u(r.commandName,r.options.format);if("error"in a){s.error(a.error),r.process.exit(c.USAGE);return}const{format:o}=a;try{const e=await t({argument:r.argument,cwd:r.process.cwd,format:o,logger:E(o,s),options:r.options});m(o,e),r.process.exit(e.code)}catch(e){if(e instanceof L){r.process.exit(c.CANCELLED);return}const n=e instanceof Error?e.message:String(e),i=f(e);s.error(p(e)||d(n)!==void 0?F(e):n),m(o,{code:i,error:n}),r.process.exit(i)}};export{O as d};
1
+ import{isLunoraError as p,findSolutionByMessage as d}from"@lunora/errors";import{EXIT_CODE as c,exitCodeForError as f}from"./EXIT_CODE-D_XCixv8.mjs";import{createLogger as g}from"./createLogger-4TujevyB.mjs";import{p as u,l as E,a as C}from"./output-format-DWe_tkTR.mjs";import{P as L}from"./prompt-cancelled-BvsNxg_Q.mjs";import{r as F}from"./render-lunora-error-C3OJY5wk.mjs";const m=(t,r)=>{t!=="json"||r.delegated===!0||C({code:r.code,data:r.data,error:r.error})},O=t=>async r=>{const s=g(),a=u(r.commandName,r.options.format);if("error"in a){s.error(a.error),r.process.exit(c.USAGE);return}const{format:o}=a;try{const e=await t({argument:r.argument,cwd:r.process.cwd,format:o,logger:E(o,s),options:r.options});m(o,e),r.process.exit(e.code)}catch(e){if(e instanceof L){r.process.exit(c.CANCELLED);return}const n=e instanceof Error?e.message:String(e),i=f(e);s.error(p(e)||d(n)!==void 0?F(e):n),m(o,{code:i,error:n}),r.process.exit(i)}};export{O as d};
@@ -1,13 +1,13 @@
1
- import{existsSync as $,readFileSync as k,writeFileSync as y,mkdirSync as R,lstatSync as _}from"node:fs";import{join as g,relative as T,dirname as b}from"@visulima/path";import{EXIT_CODE as m}from"./EXIT_CODE-D_XCixv8.mjs";import{c as V,d as M,s as j,e as q,f as J,g as B,h as H,j as P,b as X,k as Y}from"./resolve-BrsV4Qyc.mjs";import{s as u,c as z,b as Q}from"./catalog-CahzmDLV.mjs";import{projectUsesUmbrella as Z,installArgsFor as K,detectPackageManager as ee}from"@lunora/config";import{findWranglerFile as re,readWranglerJsonc as te}from"@lunora/config/cloudflare";import{LunoraError as N}from"@lunora/errors";import{insertSchemaExtension as ne}from"./insertSchemaExtension-DuiV6cba.mjs";import{createHash as se}from"node:crypto";const A=1,oe=".lunora-registry.json",G=e=>g(e,"lunora",oe),ie=e=>typeof e!="object"||e===null||!("items"in e)?!1:typeof e.items=="object"&&e.items!==null,x=e=>se("sha256").update(e).digest("hex"),ae=e=>{const t=G(e);if(!$(t))return{items:{},version:A};try{const n=JSON.parse(k(t,"utf8"));if(ie(n))return{items:n.items,version:A}}catch{}return{items:{},version:A}},ce=(e,t)=>{y(G(e),`${JSON.stringify(t,void 0,2)}
1
+ import{existsSync as $,readFileSync as k,writeFileSync as y,mkdirSync as R,lstatSync as _}from"node:fs";import{join as g,relative as T,dirname as b}from"@visulima/path";import{EXIT_CODE as m}from"./EXIT_CODE-D_XCixv8.mjs";import{c as V,d as M,s as j,e as q,f as J,g as B,h as H,j as P,b as X,k as Y}from"./resolve-Bdc9KEUv.mjs";import{s as u,c as z,b as Q}from"./catalog-CahzmDLV.mjs";import{projectUsesUmbrella as Z}from"@lunora/config";import{findWranglerFile as K,readWranglerJsonc as ee}from"@lunora/config/cloudflare";import{LunoraError as N}from"@lunora/errors";import{insertSchemaExtension as re}from"./insertSchemaExtension-DuiV6cba.mjs";import{createHash as te}from"node:crypto";import{installArgsFor as ne,detectPackageManager as se}from"@lunora/config/cli";const A=1,oe=".lunora-registry.json",G=e=>g(e,"lunora",oe),ie=e=>typeof e!="object"||e===null||!("items"in e)?!1:typeof e.items=="object"&&e.items!==null,x=e=>te("sha256").update(e).digest("hex"),ae=e=>{const t=G(e);if(!$(t))return{items:{},version:A};try{const n=JSON.parse(k(t,"utf8"));if(ie(n))return{items:n.items,version:A}}catch{}return{items:{},version:A}},ce=(e,t)=>{y(G(e),`${JSON.stringify(t,void 0,2)}
2
2
  `,"utf8")},C=(e,t,n,o)=>{const r=e.items[t]??{files:{}};e.items[t]=r,r.files[n]=x(o)},de=(e,t,n)=>e.items[t]?.files[n],F=3,I=e=>e===""?[]:e.split(`
3
3
  `),ue=(e,t)=>{const n=I(e),o=I(t);let r=0;for(;r<n.length&&r<o.length&&n[r]===o[r];)r+=1;let s=n.length,i=o.length;for(;s>r&&i>r&&n[s-1]===o[i-1];)s-=1,i-=1;if(r===s&&r===i)return[];const a=[];for(let c=Math.max(0,r-F);c<r;c+=1)a.push(` ${n[c]??""}`);for(let c=r;c<s;c+=1)a.push(`- ${n[c]??""}`);for(let c=r;c<i;c+=1)a.push(`+ ${o[c]??""}`);for(let c=i;c<Math.min(o.length,i+F);c+=1)a.push(` ${o[c]??""}`);return a},fe=/\.[cm]?[jt]sx?$/u,L=(e,t,n,o)=>{const r=g(e,t.from);if(_(r).isSymbolicLink())throw new N("INTERNAL",`registry item "${o}": refusing to read "${t.from}" — it is a symlink, not a regular file`);const s=k(r,"utf8");return n&&fe.test(t.to)?M(s):s},le=e=>`import { defineSchema } from "${e?"lunorash/server":"@lunora/server"}";
4
4
 
5
5
  export default defineSchema({});
6
- `,me=(e,t,n,o,r,s,i)=>{const a=g(o,"lunora","schema.ts");if(s)return r.info(`~ would merge .extend(${t}.extension) into lunora/schema.ts (and create ${e.to} if absent)`),{kind:"skipped",path:a};const c=g(o,e.to);$(c)||(R(b(c),{recursive:!0}),y(c,L(n,e,i,t),"utf8"));const d=$(a)?k(a,"utf8"):le(i),f=ne(d,t);if(f.ok)return R(b(a),{recursive:!0}),y(a,f.text,"utf8"),r.success(`merged .extend(${t}.extension) into lunora/schema.ts`),{kind:"written",path:a};if(f.reason==="already-applied")return r.warn(`lunora/schema.ts already extends "${t}" — skipping`),{kind:"skipped",path:a};throw f.reason==="invalid-identifier"?new N("INTERNAL",`schema-extension item "${t}" is not a valid JS identifier — it is spliced into lunora/schema.ts as \`import { ${t} }\` / \`.extend(${t}.extension)\`. Rename the item to a valid identifier (no leading digit, no "-").`):new N("INTERNAL",`schema-extension merge failed for "${t}": ${f.reason}`)},pe=(e,t,n,o,r)=>{const s=ue(t,n);if(s.length===0){r.info(`= ${e.to} (unchanged)`);return}r.info(`${o?"~":"+"} ${e.to}`);for(const i of s)r.info(` ${i}`)},he=(e,t,n,o,r,s,i,a)=>{const c=g(o,e.to),d=L(n,e,a,t),f=$(c),l=f?k(c,"utf8"):"",p=S=>(R(b(c),{recursive:!0}),y(c,d,"utf8"),C(s,t,e.to,d),r.success(`${S}: ${e.to}`),{kind:"written",path:c});if(i.diff)return pe(e,l,d,f,r),{kind:"skipped",path:c};if(!f)return p("write");const v=x(l);if(v===x(d))return C(s,t,e.to,d),r.warn(`skip (exists): ${e.to}`),{kind:"skipped",path:c};if(i.overwrite)return p("overwrite");const h=de(s,t,e.to);return h===void 0?(r.warn(`skip (exists, untracked): ${e.to} — refusing to overwrite a file lunora didn't add (use --overwrite to force)`),{kind:"skipped",path:c}):h===v?p("update"):h===x(d)?(r.warn(`skip (locally edited): ${e.to}`),{kind:"skipped",path:c}):(y(`${c}.new`,d,"utf8"),r.warn(`conflict: ${e.to} has local edits and an upstream update — wrote ${e.to}.new (use --overwrite to take theirs)`),{kind:"skipped",path:c})},ge=(e,t,n,o,r,s,i={},a=!1)=>e.merge==="schema-extension"?me(e,t,n,o,r,i.diff===!0,a):he(e,t,n,o,r,s,i,a),U=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],$e=e=>{const t=re(e);if(t===void 0)return;const{parsed:n}=te(t);return typeof n?.main=="string"?n.main:void 0},ye=e=>{const t=$e(e),n=t===void 0?U:[t,...U];for(const o of n){const r=g(e,o);if(!$(r))continue;const s=k(r,"utf8");if(!s.includes("createShardDO(")){if(o===t)break;continue}return{entryPath:r,main:o,source:s}}},ve=(e,t,n)=>{const o=T(b(e),g(t,"lunora",n)).replaceAll("\\","/");return o.startsWith(".")?o:`./${o}`},we=(e,t)=>{for(const n of e){const r=`Add \`export * from "${`./lunora/${n.module}.js`}"\` to your worker entry`,s=n.comment?` (${n.comment})`:"";t.warn(`${r}${s}`)}return 0},ke=(e,t,n,o)=>{const r=[];for(const s of e){const i=ve(t,n,s.module),a=i.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);new RegExp(String.raw`export\s+\*\s+from\s+["']${a}\.js["']`,"u").test(o)||(s.comment&&r.push(`
6
+ `,me=(e,t,n,o,r,s,i)=>{const a=g(o,"lunora","schema.ts");if(s)return r.info(`~ would merge .extend(${t}.extension) into lunora/schema.ts (and create ${e.to} if absent)`),{kind:"skipped",path:a};const c=g(o,e.to);$(c)||(R(b(c),{recursive:!0}),y(c,L(n,e,i,t),"utf8"));const d=$(a)?k(a,"utf8"):le(i),f=re(d,t);if(f.ok)return R(b(a),{recursive:!0}),y(a,f.text,"utf8"),r.success(`merged .extend(${t}.extension) into lunora/schema.ts`),{kind:"written",path:a};if(f.reason==="already-applied")return r.warn(`lunora/schema.ts already extends "${t}" — skipping`),{kind:"skipped",path:a};throw f.reason==="invalid-identifier"?new N("INTERNAL",`schema-extension item "${t}" is not a valid JS identifier — it is spliced into lunora/schema.ts as \`import { ${t} }\` / \`.extend(${t}.extension)\`. Rename the item to a valid identifier (no leading digit, no "-").`):new N("INTERNAL",`schema-extension merge failed for "${t}": ${f.reason}`)},pe=(e,t,n,o,r)=>{const s=ue(t,n);if(s.length===0){r.info(`= ${e.to} (unchanged)`);return}r.info(`${o?"~":"+"} ${e.to}`);for(const i of s)r.info(` ${i}`)},he=(e,t,n,o,r,s,i,a)=>{const c=g(o,e.to),d=L(n,e,a,t),f=$(c),l=f?k(c,"utf8"):"",p=S=>(R(b(c),{recursive:!0}),y(c,d,"utf8"),C(s,t,e.to,d),r.success(`${S}: ${e.to}`),{kind:"written",path:c});if(i.diff)return pe(e,l,d,f,r),{kind:"skipped",path:c};if(!f)return p("write");const v=x(l);if(v===x(d))return C(s,t,e.to,d),r.warn(`skip (exists): ${e.to}`),{kind:"skipped",path:c};if(i.overwrite)return p("overwrite");const h=de(s,t,e.to);return h===void 0?(r.warn(`skip (exists, untracked): ${e.to} — refusing to overwrite a file lunora didn't add (use --overwrite to force)`),{kind:"skipped",path:c}):h===v?p("update"):h===x(d)?(r.warn(`skip (locally edited): ${e.to}`),{kind:"skipped",path:c}):(y(`${c}.new`,d,"utf8"),r.warn(`conflict: ${e.to} has local edits and an upstream update — wrote ${e.to}.new (use --overwrite to take theirs)`),{kind:"skipped",path:c})},ge=(e,t,n,o,r,s,i={},a=!1)=>e.merge==="schema-extension"?me(e,t,n,o,r,i.diff===!0,a):he(e,t,n,o,r,s,i,a),U=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],$e=e=>{const t=K(e);if(t===void 0)return;const{parsed:n}=ee(t);return typeof n?.main=="string"?n.main:void 0},ye=e=>{const t=$e(e),n=t===void 0?U:[t,...U];for(const o of n){const r=g(e,o);if(!$(r))continue;const s=k(r,"utf8");if(!s.includes("createShardDO(")){if(o===t)break;continue}return{entryPath:r,main:o,source:s}}},ve=(e,t,n)=>{const o=T(b(e),g(t,"lunora",n)).replaceAll("\\","/");return o.startsWith(".")?o:`./${o}`},we=(e,t)=>{for(const n of e){const r=`Add \`export * from "${`./lunora/${n.module}.js`}"\` to your worker entry`,s=n.comment?` (${n.comment})`:"";t.warn(`${r}${s}`)}return 0},ke=(e,t,n,o)=>{const r=[];for(const s of e){const i=ve(t,n,s.module),a=i.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);new RegExp(String.raw`export\s+\*\s+from\s+["']${a}\.js["']`,"u").test(o)||(s.comment&&r.push(`
7
7
  // ${s.comment}`),r.push(`export * from "${i}.js";`))}return r},Se=(e,t,n,o)=>{if(e.length===0)return 0;const r=ye(t);if(r===void 0)return we(e,n);const s=ke(e,r.entryPath,t,r.source);if(s.length===0)return 0;if(o){for(const a of s)a!==""&&n.info(`~ entrypoint: ${a}`);return s.length}const i=r.source.endsWith(`
8
8
  `)?"":`
9
9
  `;return y(r.entryPath,`${r.source}${i}${s.join(`
10
10
  `)}
11
- `,"utf8"),n.success(`wrote ${String(s.length)} entrypoint re-export(s) to ${T(t,r.entryPath)}`),s.length},D=(e,t,n,o={})=>{const r=[],s=[],i=[],a=[],c=ae(t),d=Z(t);try{for(const{directory:f,manifest:l}of e){for(const v of l.files){const h=ge(v,l.name,f,t,n,c,o,d);(h.kind==="written"?r:s).push(h.path)}if(l.entrypointReexports!==void 0&&Se(l.entrypointReexports,t,n,o.diff===!0),o.diff)continue;const p=V(l,t,n,d,o.pinnedVersions);i.push(...p.deps),a.push(...p.bindings)}}finally{!o.diff&&Object.keys(c.items).length>0&&ce(t,c)}return{bindings:a,deps:i,skipped:s,written:r}},E=()=>({bindings:[],code:0,deps:[],skipped:[],written:[]}),De=(e,t,n,o,r)=>e.bindings?{...e,bindings:e.bindings.map(s=>{if(s.path[0]!==t||!Array.isArray(s.value))return s;const i=s.value;return{...s,value:i.map(a=>typeof a=="object"&&a!==null&&a[n.key]===n.value?{...a,[o]:r}:a)}})}:e,W=(e,t,n)=>{const o=t.title??t.description;e.info(`plan: ${u(t.name)}${o?` — ${u(o)}`:""}`);for(const r of t.files)e.info(` file ${u(r.to)} (${u(r.merge)})`);for(const[r,s]of Object.entries(t.deps??{}))e.info(` dep ${u(r)}@${u(P(s,n,r))}`);for(const[r,s]of Object.entries(t.devDependencies??{}))e.info(` dev ${u(r)}@${u(P(s,n,r))}`);for(const r of t.bindings??[])e.info(` bind ${u(r.path.join("."))} = ${u(JSON.stringify(r.value))}`);for(const r of t.envVars??[]){const s=r.secret?" (secret)":` = ${u(JSON.stringify(r.value??""))}`;e.info(` env ${u(r.name)}${s}`)}for(const r of t.entrypointReexports??[]){const s=`./lunora/${u(r.module)}`,i=r.comment?` // ${u(r.comment)}`:"";e.info(` entry ${s}${i}`)}},xe=e=>e.map(({manifest:t})=>({bindings:(t.bindings??[]).map(n=>({path:n.path.join("."),value:n.value})),deps:Object.keys(t.deps??{}),devDependencies:Object.keys(t.devDependencies??{}),entrypointReexports:(t.entrypointReexports??[]).map(n=>({module:n.module,...n.comment?{comment:n.comment}:{}})),envVars:(t.envVars??[]).map(n=>({name:n.name,...n.secret?{secret:!0}:{value:n.value??""}})),files:t.files.map(n=>({merge:n.merge,to:n.to})),name:t.name,requires:t.requires??[],title:t.title})),be=e=>{try{const{args:t,command:n}=K(ee(e));return`${n} ${t.join(" ")}`}catch{return"<your-package-manager> install"}},Ee=(e,t,n,o,r,s)=>{r.success(`add complete: ${String(n)} written, ${String(o)} skipped`),r.info("next steps:"),r.info(" lunora codegen # regenerate _generated/ so the new tables/functions appear"),t.length>0&&r.info(` ${be(s)} # install newly-added dependencies`);for(const{manifest:i}of e)i.docs&&r.info(`${u(i.name)}: ${u(i.docs)}`)},Ae=async e=>{const t=E(),n=j("list",e);if(n)return e.logger.error(n),{...t,code:m.USAGE,error:n};const{logger:o}=e;let r=()=>{};try{const s=await H(e);r=s.cleanup;const i=z(s.root);if(e.format==="json")return{...t,data:{items:i}};o.info(`available registry items (${String(i.length)}):`);for(const a of i)o.info(` ${a.name}${a.description?` — ${a.description}`:""}`);return t}catch(s){const i=u(`list failed: ${s instanceof Error?s.message:String(s)}`);return o.error(i),{...t,code:1,error:i}}finally{r()}},Te=async e=>{const t=e.cwd??process.cwd(),n=E();if(e.list)return Ae(e);const{logger:o}=e;if(e.names.length===0){const i="add requires at least one item name. Usage: lunora registry add <name> [...names]";return o.error(i),{...n,code:m.USAGE,error:i}}const r=j("add",e);if(r)return o.error(r),{...n,code:m.USAGE,error:r};let s=[];try{const{cleanups:i,items:a}=await q(e.names,e);s=i;const{transformManifest:c}=e,d=c?a.map(w=>({...w,manifest:c(w.manifest)})):a,f=await J(d.map(w=>w.manifest));for(const{manifest:w}of d)W(o,w,f);const l={items:xe(d)};if(e.dryRun)return o.info("dry-run: stopping before any files are written"),{...n,data:l};if(e.diff)return D(d,t,o,{diff:!0}),o.info("diff: preview only — re-run without --diff to apply"),{...n,data:l};const p=await B(d,e);if(!p.ok)return p.reason==="declined"?{...n,code:m.CANCELLED,data:l,error:"registry add: the package.json change was declined"}:{...n,code:m.USAGE,data:l,error:"registry add: stdin is not a TTY — re-run with --yes to confirm"};const{bindings:v,deps:h,skipped:S,written:O}=D(d,t,o,{overwrite:e.overwrite,pinnedVersions:f});return Ee(d,h,O.length,S.length,o,t),{bindings:v,code:0,data:l,deps:h,skipped:S,written:O}}catch(i){const a=u(`add failed: ${i instanceof Error?i.message:String(i)}`);return o.error(a),{...n,code:1,error:a}}finally{for(const i of s)i()}},Je=async e=>{const t=E();if(e.names.length===0){const r="view requires an item name. Usage: lunora registry view <name>";return e.logger.error(r),{...t,code:m.USAGE,error:r}}const n=j("view",e);if(n)return e.logger.error(n),{...t,code:m.USAGE,error:n};const o=[];try{for(const r of e.names){const{cleanup:s,directory:i}=await X(r,e);o.push(s);const a=Y(i,r);W(e.logger,a,await J([a]));for(const c of a.files){e.logger.info(`--- ${u(c.to)} (${u(c.merge)}) ---`);const d=L(i,c,!1,r);for(const f of d.split(`
12
- `))e.logger.info(u(f))}}return t}catch(r){return e.logger.error(u(`view failed: ${r instanceof Error?r.message:String(r)}`)),{...t,code:1}}finally{for(const r of o)r()}},Ge=async e=>{const t=E(),n=e.from;if(n===void 0){const s="registry build requires --from <registry root>";return e.logger.error(s),{...t,code:m.USAGE,error:s}}if(!$(n)){const s=`registry root not found: ${n}`;return e.logger.error(s),{...t,code:m.NOT_FOUND,error:s}}const o=Q(n),r=e.out??g(n,"index.json");if(e.check){const s=$(r)?JSON.parse(k(r,"utf8")):{items:[]};if(JSON.stringify(s.items??[])!==JSON.stringify(o.items)){const a=`registry: ${r} is stale — run \`lunora registry build\` to regenerate it`;return e.logger.error(a),{...t,code:m.USAGE,error:a}}return e.logger.success(`registry: ${r} is up to date (${String(o.items.length)} items)`),t}return y(r,`${JSON.stringify({$schema:"./schema/registry.schema.json",...o},void 0,4)}
13
- `,"utf8"),e.logger.success(`registry: wrote ${r} (${String(o.items.length)} items)`),t};export{Ge as a,Je as b,Te as r,De as s};
11
+ `,"utf8"),n.success(`wrote ${String(s.length)} entrypoint re-export(s) to ${T(t,r.entryPath)}`),s.length},D=(e,t,n,o={})=>{const r=[],s=[],i=[],a=[],c=ae(t),d=Z(t);try{for(const{directory:f,manifest:l}of e){for(const v of l.files){const h=ge(v,l.name,f,t,n,c,o,d);(h.kind==="written"?r:s).push(h.path)}if(l.entrypointReexports!==void 0&&Se(l.entrypointReexports,t,n,o.diff===!0),o.diff)continue;const p=V(l,t,n,d,o.pinnedVersions);i.push(...p.deps),a.push(...p.bindings)}}finally{!o.diff&&Object.keys(c.items).length>0&&ce(t,c)}return{bindings:a,deps:i,skipped:s,written:r}},E=()=>({bindings:[],code:0,deps:[],skipped:[],written:[]}),Te=(e,t,n,o,r)=>e.bindings?{...e,bindings:e.bindings.map(s=>{if(s.path[0]!==t||!Array.isArray(s.value))return s;const i=s.value;return{...s,value:i.map(a=>typeof a=="object"&&a!==null&&a[n.key]===n.value?{...a,[o]:r}:a)}})}:e,W=(e,t,n)=>{const o=t.title??t.description;e.info(`plan: ${u(t.name)}${o?` — ${u(o)}`:""}`);for(const r of t.files)e.info(` file ${u(r.to)} (${u(r.merge)})`);for(const[r,s]of Object.entries(t.deps??{}))e.info(` dep ${u(r)}@${u(P(s,n,r))}`);for(const[r,s]of Object.entries(t.devDependencies??{}))e.info(` dev ${u(r)}@${u(P(s,n,r))}`);for(const r of t.bindings??[])e.info(` bind ${u(r.path.join("."))} = ${u(JSON.stringify(r.value))}`);for(const r of t.envVars??[]){const s=r.secret?" (secret)":` = ${u(JSON.stringify(r.value??""))}`;e.info(` env ${u(r.name)}${s}`)}for(const r of t.entrypointReexports??[]){const s=`./lunora/${u(r.module)}`,i=r.comment?` // ${u(r.comment)}`:"";e.info(` entry ${s}${i}`)}},xe=e=>e.map(({manifest:t})=>({bindings:(t.bindings??[]).map(n=>({path:n.path.join("."),value:n.value})),deps:Object.keys(t.deps??{}),devDependencies:Object.keys(t.devDependencies??{}),entrypointReexports:(t.entrypointReexports??[]).map(n=>({module:n.module,...n.comment?{comment:n.comment}:{}})),envVars:(t.envVars??[]).map(n=>({name:n.name,...n.secret?{secret:!0}:{value:n.value??""}})),files:t.files.map(n=>({merge:n.merge,to:n.to})),name:t.name,requires:t.requires??[],title:t.title})),be=e=>{try{const{args:t,command:n}=ne(se(e));return`${n} ${t.join(" ")}`}catch{return"<your-package-manager> install"}},Ee=(e,t,n,o,r,s)=>{r.success(`add complete: ${String(n)} written, ${String(o)} skipped`),r.info("next steps:"),r.info(" lunora codegen # regenerate _generated/ so the new tables/functions appear"),t.length>0&&r.info(` ${be(s)} # install newly-added dependencies`);for(const{manifest:i}of e)i.docs&&r.info(`${u(i.name)}: ${u(i.docs)}`)},Ae=async e=>{const t=E(),n=j("list",e);if(n)return e.logger.error(n),{...t,code:m.USAGE,error:n};const{logger:o}=e;let r=()=>{};try{const s=await H(e);r=s.cleanup;const i=z(s.root);if(e.format==="json")return{...t,data:{items:i}};o.info(`available registry items (${String(i.length)}):`);for(const a of i)o.info(` ${a.name}${a.description?` — ${a.description}`:""}`);return t}catch(s){const i=u(`list failed: ${s instanceof Error?s.message:String(s)}`);return o.error(i),{...t,code:1,error:i}}finally{r()}},Je=async e=>{const t=e.cwd??process.cwd(),n=E();if(e.list)return Ae(e);const{logger:o}=e;if(e.names.length===0){const i="add requires at least one item name. Usage: lunora registry add <name> [...names]";return o.error(i),{...n,code:m.USAGE,error:i}}const r=j("add",e);if(r)return o.error(r),{...n,code:m.USAGE,error:r};let s=[];try{const{cleanups:i,items:a}=await q(e.names,e);s=i;const{transformManifest:c}=e,d=c?a.map(w=>({...w,manifest:c(w.manifest)})):a,f=await J(d.map(w=>w.manifest));for(const{manifest:w}of d)W(o,w,f);const l={items:xe(d)};if(e.dryRun)return o.info("dry-run: stopping before any files are written"),{...n,data:l};if(e.diff)return D(d,t,o,{diff:!0}),o.info("diff: preview only — re-run without --diff to apply"),{...n,data:l};const p=await B(d,e);if(!p.ok)return p.reason==="declined"?{...n,code:m.CANCELLED,data:l,error:"registry add: the package.json change was declined"}:{...n,code:m.USAGE,data:l,error:"registry add: stdin is not a TTY — re-run with --yes to confirm"};const{bindings:v,deps:h,skipped:S,written:O}=D(d,t,o,{overwrite:e.overwrite,pinnedVersions:f});return Ee(d,h,O.length,S.length,o,t),{bindings:v,code:0,data:l,deps:h,skipped:S,written:O}}catch(i){const a=u(`add failed: ${i instanceof Error?i.message:String(i)}`);return o.error(a),{...n,code:1,error:a}}finally{for(const i of s)i()}},Ge=async e=>{const t=E();if(e.names.length===0){const r="view requires an item name. Usage: lunora registry view <name>";return e.logger.error(r),{...t,code:m.USAGE,error:r}}const n=j("view",e);if(n)return e.logger.error(n),{...t,code:m.USAGE,error:n};const o=[];try{for(const r of e.names){const{cleanup:s,directory:i}=await X(r,e);o.push(s);const a=Y(i,r);W(e.logger,a,await J([a]));for(const c of a.files){e.logger.info(`--- ${u(c.to)} (${u(c.merge)}) ---`);const d=L(i,c,!1,r);for(const f of d.split(`
12
+ `))e.logger.info(u(f))}}return t}catch(r){return e.logger.error(u(`view failed: ${r instanceof Error?r.message:String(r)}`)),{...t,code:1}}finally{for(const r of o)r()}},We=async e=>{const t=E(),n=e.from;if(n===void 0){const s="registry build requires --from <registry root>";return e.logger.error(s),{...t,code:m.USAGE,error:s}}if(!$(n)){const s=`registry root not found: ${n}`;return e.logger.error(s),{...t,code:m.NOT_FOUND,error:s}}const o=Q(n),r=e.out??g(n,"index.json");if(e.check){const s=$(r)?JSON.parse(k(r,"utf8")):{items:[]};if(JSON.stringify(s.items??[])!==JSON.stringify(o.items)){const a=`registry: ${r} is stale — run \`lunora registry build\` to regenerate it`;return e.logger.error(a),{...t,code:m.USAGE,error:a}}return e.logger.success(`registry: ${r} is up to date (${String(o.items.length)} items)`),t}return y(r,`${JSON.stringify({$schema:"./schema/registry.schema.json",...o},void 0,4)}
13
+ `,"utf8"),e.logger.success(`registry: wrote ${r} (${String(o.items.length)} items)`),t};export{We as a,Ge as b,Je as r,Te as s};
@@ -0,0 +1,2 @@
1
+ import{STEP_BADGE_NAMES as i,LunoraReporter as u}from"@lunora/config/cli";import{JsonReporter as d}from"@visulima/pail/reporter/json";import{createPail as l}from"@visulima/pail/server";let n,c=!1,a;const P=r=>{a=r},p=()=>{if(c)return!0;const r=process.env.LUNORA_LOG_JSON;return r==="1"||r==="true"},f=r=>new r,m=()=>[f(p()?d:u)],_=()=>{c||(c=!0,n=void 0)},L=Object.fromEntries(i.map(r=>[r,{label:r,logLevel:"informational"}])),g=new WeakSet,E=r=>g.has(r),t=()=>(n??=l({reporters:m(),scope:["lunora"],stderr:process.stderr,stdout:process.stdout,types:L}),n),v=()=>{if(a!==void 0)return a;const r={debug:e=>{t().debug(e)},error:e=>{t().error(e)},info:e=>{t().info(e)},success:e=>{t().success(e)},warn:e=>{t().warn(e)}};return g.add(r),r},O=()=>{const r=(o,s)=>{process.stderr.write(`${o} ${s}
2
+ `)},e={debug:o=>{r("debug",o)},error:o=>{r("error",o)},info:o=>{r("info ",o)},success:o=>{r("ok ",o)},warn:o=>{r("warn ",o)}};return g.add(e),e},R=new Proxy({},{get(r,e){const o=t(),s=o[e];return typeof s=="function"?s.bind(o):s}}),J=(r,e)=>{t()[r](e)};export{v as createLogger,O as createStderrLogger,_ as forceJsonLogging,E as isProcessStreamLogger,J as logStep,R as pail,P as setCommandLogger};
@@ -0,0 +1 @@
1
+ import{resolveTargetOrThrow as n}from"@lunora/config";import{isRunnableTarget as a,runnableTargetIds as s}from"@lunora/config/cli";const g=(e,t)=>{try{return{target:n(e,t)}}catch(r){return{error:r instanceof Error?r.message:String(r)}}},c=(e,t)=>{const r=g(e,t);if(r.target===void 0)return r;if(!a(r.target)){const o=s();return{error:`deploy target "${r.target}" has no command-line toolchain, so the Lunora CLI cannot deploy or serve it — it can only generate for it (\`lunora codegen --target ${r.target}\`). Deployable targets: ${o.join(", ")}`}}return r};export{c as a,g as r};
@@ -1,2 +1,2 @@
1
- import{isProcessStreamLogger as o,createStderrLogger as e}from"./createLogger-Cl18I8AX.mjs";const n={description:"Output format: pretty (default) or json",name:"format",type:String},p=(r,t)=>t===void 0?{format:"pretty"}:t==="json"||t==="pretty"?{format:t}:{error:`${r}: unknown --format "${t}" — expected pretty | json`},a=(r,t)=>r==="json"&&o(t)?e():t,i=r=>{process.stdout.write(`${JSON.stringify(r,void 0,2)}
1
+ import{isProcessStreamLogger as o,createStderrLogger as e}from"./createLogger-4TujevyB.mjs";const n={description:"Output format: pretty (default) or json",name:"format",type:String},p=(r,t)=>t===void 0?{format:"pretty"}:t==="json"||t==="pretty"?{format:t}:{error:`${r}: unknown --format "${t}" — expected pretty | json`},a=(r,t)=>r==="json"&&o(t)?e():t,i=r=>{process.stdout.write(`${JSON.stringify(r,void 0,2)}
2
2
  `)};export{n as O,i as a,a as l,p};
@@ -0,0 +1,5 @@
1
+ import{existsSync as q,mkdirSync as Te,openSync as J,closeSync as X,statSync as Pe,readFileSync as Q,readSync as be}from"node:fs";import{join as C,dirname as _e}from"node:path";import{readServiceBindings as $e}from"@lunora/codegen";import{readLiveDevServerState as N,discoverContainerInfo as Re,streamContainerLogs as Ce,formatLunoraEvent as Ne,updateDevServerState as b,targetRunsOwnDevServer as O,resolveProjectTarget as Z,claimDevServerState as Oe,DEV_HANDOFF_ENV as De,clearDevServerState as y,readDevServerState as D,isDevServerReady as j,detectFramework as ee,readProjectDependencyNames as Ae,DEV_LOG_FILE_ENV as xe,DEV_DAEMON_ENV as Me,readProjectManifest as Ue,isRecordedProcessCurrent as Ge,DEV_LOG_FILE as Fe,CODEGEN_ENV as re,isCodegenDisabled as je,planToolchainInvocation as Ve,startCelldDevSession as We,resolveDeployDriver as te,DEV_VARS_FILE as ne,parseDevVariableEntries as Be}from"@lunora/config";import{warnCloudflareCliConfigOnce as Ke,findWranglerFile as L,readWranglerJsonc as A,materializeDevWranglerConfig as He,materializeServiceDevConfigs as ze}from"@lunora/config/cloudflare";import{createServer as Ye}from"node:net";import{networkInterfaces as qe}from"node:os";import{spawn as oe,spawnSync as T}from"node:child_process";import{setTimeout as w}from"node:timers/promises";import{EXIT_CODE as ie}from"./EXIT_CODE-D_XCixv8.mjs";import{a as h}from"./output-format-DWe_tkTR.mjs";import{spawnShellCompat as se,defaultSpawner as Je}from"./createRecordingSpawner-Ch7zuQQE.mjs";import{isLunoraError as Xe}from"@lunora/errors";import{s as V}from"./index-oHZBGBwB.mjs";import{createInterface as Qe}from"node:readline";import{detectPackageManager as x,execArgsFor as ae,toolchainExecArgs as ce,runScriptCommand as Ze}from"@lunora/config/cli";const er=12e4,_=250,rr=1e3,tr="LUNORA_DEV_READY_TIMEOUT_MS",nr=e=>{if(e!==void 0)return e;const r=Number(process.env[tr]??"");return Number.isFinite(r)&&r>0?r:er},or=async(e,r)=>{try{const n=AbortSignal.timeout(rr);return await(await fetch(new URL("/_lunora/status",e),{redirect:"manual",signal:r===void 0?n:AbortSignal.any([r,n])})).body?.cancel(),!0}catch{return!1}},le=async(e,r,n)=>{const t=Date.now()+n.timeoutMs;for(;n.signal?.aborted!==!0;){const o=r(N(e));if(o!==void 0)return o;if(Date.now()>=t)return;try{await w(n.intervalMs??500,void 0,{signal:n.signal})}catch{return}}},W=(e,r)=>{Qe({crlfDelay:Number.POSITIVE_INFINITY,input:e}).on("line",r)},ir=5e3,de=(e,r,n,t)=>{if(e.length===0)return;const o=Ne(e);if(o){t[o.level](`[lunora] ${o.text}`);return}const i=`[${r}] ${e}`;n==="stderr"?t.warn(i):t.info(i)},sr=(e,r,n=process.platform,t=T)=>{try{if(r==="SIGKILL"&&n==="win32"&&e.pid!==void 0){t("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"});return}e.kill(r)}catch{}},ue=(e,r,n)=>{const t=e.direct===!0?{args:[...e.args],command:e.command,shell:!1}:se(e.command,e.args),o=oe(t.command,t.args,{cwd:e.cwd??process.cwd(),env:e.env?{...process.env,...e.env}:process.env,shell:t.shell,stdio:[e.direct===!0?"ignore":"inherit","pipe","pipe"]});return W(o.stdout,i=>{r(i,"stdout")}),W(o.stderr,i=>{r(i,"stderr")}),{exited:new Promise(i=>{o.on("error",s=>{n?.(s),i(1)}),o.on("exit",(s,a)=>{i(s??(a?1:0))})}),kill:i=>{sr(o,i)}}},mt=(e,r)=>ue(e,(n,t)=>{de(n.trimEnd(),e.tag,t,r)},n=>{r.error(`[${e.tag}] failed to start: ${n.message}`)}),wt=(e,r)=>{if(process.env.LUNORA_CONTAINER_LOGS==="0")return;const t=Re(e,"lunora").containers.map(o=>({className:o.className,exportName:o.exportName}));if(t.length!==0)return Ce({containers:t,onLine:o=>{const i=`[container:${o.name}] ${o.text}`;o.level==="error"?r.warn(i):r.info(i)},onUnavailable:o=>{r.warn(`[container] Docker engine unreachable — container logs unavailable (${o})`)}})},ht=async e=>{e.readyProbe?.abort(),await e.tunnel?.close(),await e.codegen?.close().catch(()=>{}),e.containerLogs?.close(),await e.studio?.close().catch(()=>{});try{e.remoteCleanup?.(),e.serviceConfigCleanup?.()}catch{}},St=async e=>await new Promise(r=>{const n={},t=s=>{e.info(`received ${s} — shutting down`),n.sigint&&process.off("SIGINT",n.sigint),n.sigterm&&process.off("SIGTERM",n.sigterm),r(0)},o=()=>{t("SIGINT")},i=()=>{t("SIGTERM")};n.sigint=o,n.sigterm=i,process.on("SIGINT",o),process.on("SIGTERM",i)}),kt=async(e,r,n)=>{let t=0,o;const i=l=>{e.kill(l),r?.kill(l)},s=()=>{t+=1,t===1?(n.info("received SIGINT — shutting down (press Ctrl-C again to force-kill)"),i("SIGTERM"),o=setTimeout(()=>{i("SIGKILL")},ir),o.unref()):i("SIGKILL")},a=()=>{i("SIGTERM")};process.on("SIGINT",s),process.on("SIGTERM",a);const c=await Promise.race([e.exited.then(l=>({code:l,who:"worker"})),...r===void 0?[]:[r.exited.then(l=>({code:l,who:"sidecar"}))]]);return r!==void 0&&(c.who==="sidecar"?(n.warn("[worker] the Lunora sidecar (wrangler dev) exited — shutting down the framework dev server"),e.kill("SIGTERM")):r.kill("SIGTERM"),await Promise.allSettled([e.exited,r.exited])),o&&clearTimeout(o),process.off("SIGINT",s),process.off("SIGTERM",a),c.code},E="2026.9.3",ar="https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/",cr=/version (\S+)/u,B=/https:\/\/[\da-z-]+\.trycloudflare\.com/u,lr="1s",dr=5e3,K=async(e,r)=>await Promise.race([e.then(()=>!0),w(r,!1,{ref:!1})]),ur=6e4,fr='Vite answers 403 for hosts it does not know — add `server: { allowedHosts: [".trycloudflare.com"] }` to vite.config if the URL is blocked.',vr=async e=>{const r=`Install or update it: ${ar} (macOS: \`brew install cloudflared\`).`;let n;try{const o=await e({args:["--version"],captureStdoutSilently:!0,command:"cloudflared"});if(o.code!==0)return{message:`\`cloudflared --version\` exited ${String(o.code)}. ${r}`,ok:!1};n=o.stdout??""}catch(o){return Xe(o)&&o.code==="LOCAL_DEPENDENCY_MISSING"?{message:`--tunnel needs \`cloudflared\` ${E} or newer, and it is not on your PATH. ${r}`,ok:!1}:{message:`\`cloudflared --version\` could not run: ${o instanceof Error?o.message:String(o)}. ${r}`,ok:!1}}const t=V.coerce(cr.exec(n)?.[1])?.version;return t===void 0?{ok:!0,version:void 0}:V.gte(t,E)?{ok:!0,version:t}:{message:`--tunnel needs \`cloudflared\` ${E} or newer (protected quick tunnels); found ${t}. ${r}`,ok:!1}},gr=e=>{const r=[],n=[];for(const t of e??[]){const o=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);o.length>0&&(n.push(...o.filter(i=>!i.includes("@"))),r.push(o.join(",")))}return{entries:r,invalid:n}},pr=(e,r)=>["tunnel","--url",e,"--output","json","--grace-period",lr,...r.flatMap(n=>["--allowed-mail",n])],mr=e=>{let r;try{r=JSON.parse(e)}catch{r=void 0}if(typeof r=="object"&&r!==null){const n=r,t=typeof n.message=="string"?n.message:"";return{level:typeof n.level=="string"?n.level:void 0,text:t,url:B.exec(t)?.[0]}}return{level:void 0,text:e,url:B.exec(e)?.[0]}},wr=e=>{e.warn(" ⚠ PUBLIC TUNNEL: anyone with the tunnel URL can reach this dev server — there is no sign-in in front of it."),e.warn(" Protect it with a one-time-PIN email allow-list: lunora dev --tunnel --allow-mail you@example.com"),e.warn(" (repeat --allow-mail, pass a comma-separated list, or allow a whole domain with '*@example.com')")},hr=async(e,r,n,{intervalMs:t,timeoutMs:o=ur}={})=>{const i=await le(e,s=>s?.mode==="vite"?{origin:s.url,ownerPid:s.pid}:void 0,{intervalMs:t,signal:n,timeoutMs:o});return i===void 0&&!n.aborted&&r.warn(`--tunnel: the Vite dev server did not report its URL within ${String(o/1e3)}s — continuing without a tunnel.`),i},Sr=e=>{const{allowMail:r,cwd:n,logger:t}=e,o=r.length===0,i=new AbortController,{signal:s}=i,a=()=>s.aborted,c=e.closeTimeoutMs??dr;let l;const d=()=>{i.abort()};process.once("SIGINT",d),process.once("SIGTERM",d);const v=(async()=>{const u=await vr(e.spawner??Je);if(!u.ok){t.error(u.message),t.warn("continuing without a tunnel.");return}u.version===void 0&&t.warn(`could not read the cloudflared version — --tunnel needs ${E} or newer; trying anyway.`);const g=e.origin.kind==="fixed"?{origin:e.origin.origin,ownerPid:process.pid}:await hr(n,t,s);if(g===void 0||s.aborted)return;o&&wr(t),t.info(`starting a Cloudflare quick tunnel to ${g.origin}${o?"":" (email one-time-PIN protected)"}…`);let S;const U={failedToStart:!1},Le=k=>{if(k.length===0)return;const p=mr(k);if(p.url!==void 0&&S===void 0){S=p.url,t.success(` ➜ Tunnel: ${p.url}${o?" (PUBLIC)":""}`),o||t.info(` Allowed: ${r.join(", ")} — visitors confirm with a one-time PIN; a session lasts up to 4 hours`),e.origin.kind==="vite"&&t.info(` ${fr}`),b(n,{tunnelUrl:p.url},{expectedPid:g.ownerPid});return}p.level==="error"||p.level==="fatal"?t.warn(`[cloudflared] ${p.text}`):t.debug?.(`[cloudflared] ${p.text}`)},P=(e.startChild??ue)({args:pr(g.origin,r),command:"cloudflared",direct:!0},Le,k=>{U.failedToStart=!0,t.error(`could not start cloudflared (${k.message}) — continuing without a tunnel.`)});l=P;const G=()=>{P.kill("SIGTERM")};s.addEventListener("abort",G,{once:!0});const F=await P.exited;s.removeEventListener("abort",G),l=void 0,S!==void 0&&b(n,{tunnelUrl:void 0},{expectedPid:g.ownerPid}),!(a()||U.failedToStart)&&t.warn(S===void 0?`cloudflared exited (${String(F)}) before a tunnel URL was assigned — continuing without a tunnel.`:`cloudflared exited (${String(F)}) — the tunnel is closed; the dev server keeps running.`)})().catch(u=>{t.error(`--tunnel failed (${u instanceof Error?u.message:String(u)}) — continuing without a tunnel.`)});return{close:async()=>{if(process.off("SIGINT",d),process.off("SIGTERM",d),i.abort(),await K(v,c))return;const u=l;u!==void 0&&(t.warn(`cloudflared did not exit within ${String(c/1e3)}s of SIGTERM — force-killing it.`),u.kill("SIGKILL"),!await K(u.exited,c)&&t.error(`could not confirm that cloudflared stopped — ${o?"the PUBLIC tunnel":"the tunnel"} may still be reachable. Stop the \`cloudflared\` process manually.`))}}},It=e=>{const{cwd:r,logger:n,plan:t,tunnel:o}=e;if(o!==void 0)return Sr({allowMail:o.allowMail,cwd:r,logger:n,origin:t.flavor==="wrangler"?{kind:"fixed",origin:t.workerOrigin}:{kind:"vite"},spawner:o.spawner,startChild:o.startChild})},kr=(e,r)=>{const n=["dev"];if(e.apiSpec!==void 0&&n.push("--api-spec",e.apiSpec),e.port!==void 0&&n.push("--port",String(e.port)),e.workerPort!==void 0&&n.push("--worker-port",String(e.workerPort)),e.inspectorPort!==void 0&&n.push("--inspector-port",String(e.inspectorPort)),e.emitBindings!==void 0&&n.push("--emit-bindings",e.emitBindings),e.codegen===!1&&n.push("--no-codegen"),e.studio===!1&&n.push("--no-studio"),e.worker===!1&&n.push("--no-worker"),e.target!==void 0&&n.push("--target",e.target),e.tunnel===!0){n.push("--tunnel");for(const t of gr(e.allowMail).entries)n.push("--allow-mail",t)}return r&&n.push("--remote"),e.local===!0&&n.push("--local"),n},Ir=1e4,Er=100,yr=40,I=256*1024,Lr=new Set(["nuxt","sveltekit"]),Tr=["@lunora/rspack","@lunora/vite"],M=e=>{if(Lr.has(ee(e).framework))return"framework-worker";const r=Ae(e);return Tr.some(n=>r.has(n))?"vite":"wrangler"},fe=e=>{const r=x(e),n=Ue(e)?.scripts,t=typeof n=="object"&&n!==null?n.dev:void 0;if(typeof t!="string"||t.trim()===""||t.includes("lunora")){const o=ae(r,"vite",["dev"]);return{args:o.args,command:o.command}}return{args:["run","dev"],command:r}},Pr=e=>{Te(_e(e.logPath),{recursive:!0});const r=J(e.logPath,"w",384);let n;const t=se(e.command,e.args);try{n=oe(t.command,t.args,{cwd:e.cwd,detached:!0,env:e.env,shell:t.shell,stdio:["ignore",r,r],windowsHide:!0})}finally{X(r)}return n.unref(),{exited:new Promise(o=>{n.on("error",()=>{o(1)}),n.on("exit",(i,s)=>{o(i??(s?1:0))})}),pid:n.pid}},br=e=>{try{const{size:r}=Pe(e);if(r<=I)return Q(e,"utf8");const n=J(e,"r");try{const t=Buffer.alloc(I),o=be(n,t,0,I,r-I),i=t.toString("utf8",0,o);return i.slice(i.indexOf(`
2
+ `)+1)}finally{X(n)}}catch{return}},ve=(e,r)=>{const n=br(e);if(n===void 0)return[];const t=n.split(`
3
+ `);return t.at(-1)===""&&t.pop(),r>0?t.slice(-r):t},ge=(e,r)=>r?.logFile??C(e,Fe),pe=e=>{e.info(" Stop: lunora dev stop"),e.info(" Status: lunora dev status"),e.info(" Logs: lunora dev logs")},_r=(e,r)=>{Ke(r,n=>{e.warn(n)})},$r=(e,r)=>{e.warn(`Dev server already running at ${r.url} (pid ${String(r.pid)})`),pe(e)},Rr=(e,r)=>{e.success(`Dev server running at ${r.url} (pid ${String(r.pid)})`),r.studioUrl!==void 0&&e.info(` Studio: ${r.studioUrl}`),r.tunnelUrl!==void 0&&e.info(` Tunnel: ${r.tunnelUrl}`),pe(e)},Cr=3e4,Nr=async(e,r,n,t)=>{const o=await le(e,i=>i?.tunnelUrl,{intervalMs:n,timeoutMs:t});o===void 0?r.warn(" Tunnel: no URL yet — `lunora dev status` shows it once cloudflared reports one; `lunora dev logs` says why if it does not."):r.success(` Tunnel: ${o}`)},Or=async e=>{const{child:r,cwd:n,deadline:t,pollIntervalMs:o,probe:i}=e,s=r.exited.then(a=>({exitCode:a}));for(;Date.now()<t;){const a=N(n);if(a!==void 0&&a.pid!==process.pid&&await i(a.url))return{state:a,status:"ready"};const c=await Promise.race([s,w(o)]);if(c!==void 0)return{...c,status:"exited"}}return{status:"timeout"}},Dr=async e=>{const{cwd:r,logger:n}=e,t=ge(r,void 0),o=nr(e.readyTimeoutMs),i=(e.spawnDetached??Pr)({args:e.command.args,command:e.command.command,cwd:r,env:{...process.env,...e.env,[Me]:"1",[xe]:t,...process.env.FORCE_COLOR===void 0?{NO_COLOR:"1"}:{},...e.json?{LUNORA_LOG_JSON:"1"}:{}},logPath:t}),s=await Or({child:i,cwd:r,deadline:Date.now()+o,pollIntervalMs:e.pollIntervalMs??_,probe:e.probe??or});if(s.status==="ready")return Rr(n,s.state),e.tunnel===!0&&s.state.tunnelUrl===void 0&&await Nr(r,n,e.pollIntervalMs??_,e.tunnelUrlTimeoutMs??Cr),{code:0};if(s.status==="exited"){n.error(`dev server exited before becoming ready (exit code ${String(s.exitCode)}). Last output:`);for(const c of ve(t,yr))n.error(` ${c}`);return y(r,i.pid??process.pid),{code:s.exitCode===0?1:s.exitCode}}i.pid!==void 0&&D(r)?.pid===process.pid&&b(r,{logFile:t,pid:i.pid});const a=i.pid===void 0?"":` (pid ${String(i.pid)})`;return n.warn(`dev server did not confirm ready within ${String(Math.round(o/1e3))}s — it may still be compiling${a}. Check \`lunora dev status\` and \`lunora dev logs\`; \`lunora dev stop\` shuts it down.`),{code:ie.UNAVAILABLE}},me=e=>e.codegen!==!1&&!je(process.env[re]),we=e=>{const r={...e.remote===!0?{LUNORA_REMOTE:"1"}:{},...e.codegen===!1?{[re]:"0"}:{}};return Object.keys(r).length>0?{env:r}:{}},Et=async e=>{const{cwd:r,jsonLogs:n,logger:t,options:o,remote:i}=e,s=e.run??Dr,a=M(r),c=a==="vite"&&O(o.target??Z(r))?"wrangler":a,l=c==="wrangler"?`http://localhost:${String(o.workerPort??8787)}`:"http://localhost:5173",d=Oe(r,{background:!0,mode:"cli",pid:process.pid,startedAt:new Date().toISOString(),url:l});if(!d.ok)return d.existing!==void 0&&$r(t,d.existing),{code:0};const f={[De]:String(process.pid)};_r(t,r);try{return c==="vite"&&o.tunnel!==!0?await s({command:fe(r),cwd:r,env:{...we({...o,remote:i}).env,...f},json:n,logger:t}):await s({command:{args:[process.argv[1]??"lunora",...kr(o,i)],command:process.execPath},cwd:r,env:f,json:n,logger:t,tunnel:o.tunnel===!0})}finally{y(r,process.pid)}},Ar=e=>{try{const r=T("ps",["-o","pgid=","-p",String(e)],{encoding:"utf8"}),n=Number.parseInt(r.stdout.trim(),10);return Number.isInteger(n)&&n>0?n:void 0}catch{return}},xr=(e,r,n=process.platform,t=T)=>{if(n==="win32"){try{t("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"})}catch{}return}if(e.background===!0)try{r(-(Ar(e.pid)??e.pid),"SIGKILL");return}catch{}try{r(e.pid,"SIGKILL")}catch{}},Mr=(e,r)=>(r.json?h({pid:e.pid,stopped:!1}):r.logger.error(`dev server (pid ${String(e.pid)}) survived the force-kill — record kept; retry \`lunora dev stop\` or kill the process manually.`),{code:1}),Ur=async e=>{const{cwd:r,logger:n}=e,t=D(r),o=e.alive??(f=>f===t?.pid&&Ge(t)),i=e.signal??((f,v)=>{process.kill(f,v)}),s=e.pollIntervalMs??_,a=e.stopGraceMs??Ir,c=e.platform??process.platform,l=e.spawnSyncImpl??T;if(t===void 0||!o(t.pid))return t!==void 0&&y(r,t.pid),e.json?h({running:!1,stopped:!1}):n.info("No dev server running."),{code:0};try{i(t.pid,"SIGTERM")}catch{}const d=Date.now()+a;for(;o(t.pid)&&Date.now()<d;)await w(s);return o(t.pid)&&(xr(t,i,c,l),await w(s),o(t.pid))?Mr(t,e):(y(r,t.pid),e.json?h({pid:t.pid,stopped:!0}):n.success(`Stopped dev server (pid ${String(t.pid)}).`),{code:0})},Gr=e=>{const{cwd:r,logger:n}=e,t=N(r);if(t===void 0)return e.json?h({running:!1}):n.info("No dev server running."),{code:0};const o=e.now??Date.now,i=t.startedAt===void 0?Number.NaN:Date.parse(t.startedAt),s=Number.isFinite(i)?Math.max(0,Math.round((o()-i)/1e3)):void 0;if(e.json)return h({background:t.background===!0,logFile:t.logFile,mode:t.mode,pid:t.pid,ready:j(t),readyAt:t.readyAt,running:!0,startedAt:t.startedAt,studioUrl:t.studioUrl,tunnelUrl:t.tunnelUrl,uptimeSeconds:s,url:t.url}),{code:0};const a=[`pid ${String(t.pid)}`,...s===void 0?[]:[`uptime ${String(s)}s`],t.background===!0?"background":"foreground",j(t)?"ready":"starting"];return n.success(`Dev server running at ${t.url} (${a.join(", ")})`),t.studioUrl!==void 0&&n.info(` Studio: ${t.studioUrl}`),t.tunnelUrl!==void 0&&n.info(` Tunnel: ${t.tunnelUrl}`),t.logFile!==void 0&&n.info(` Logs: lunora dev logs (${t.logFile})`),{code:0}},Fr=e=>{const{cwd:r,logger:n}=e,t=D(r),o=ge(r,t);if(!q(o))return n.info("No dev server logs found — output is captured when the server runs in background mode (`lunora dev --background`)."),{code:0};const i=ve(o,e.lines??Er);return i.length>0&&process.stdout.write(`${i.join(`
4
+ `)}
5
+ `),{code:0}},yt=e=>{const{cwd:r,json:n,lines:t,logger:o,subcommand:i}=e;if(i==="stop")return Ur({cwd:r,json:n,logger:o});if(i==="status")return Gr({cwd:r,json:n,logger:o});if(i==="logs")return Fr({cwd:r,lines:t,logger:o});if(i!==void 0)return o.error(`dev: unknown subcommand "${i}" — expected stop | status | logs (or no subcommand to start the dev server)`),{code:ie.USAGE}},Lt=(e,r,n)=>O(e)?(r!=="wrangler"&&n.info(`target ${e} runs its own dev server, so lunora dev serves the worker on it — start the frontend's dev server separately`),"wrangler"):r,Tt=async e=>{const{logger:r}=e,n=await(e.start??We)({log:(i,{stream:s,tag:a})=>{de(i,a,s,r)},port:e.port,projectRoot:e.projectRoot});let t=()=>{};const o=new Promise(i=>{t=i});return{exited:Promise.race([o,n.exited]),kill:()=>{n.stop().then(()=>0,()=>1).then(t).catch(()=>{})}}},jr=e=>{const{cwd:r,driver:n,options:t,studioPort:o,workerPort:i}=e,{projectConfig:s,toolchain:a}=n;if(s===void 0||a===void 0)throw new Error(`deploy target "${n.id}" runs its own dev server but ships no config projection or toolchain for it`);if(t.remote===!0)throw new Error(`--remote proxies bindings to Cloudflare; ${n.name} has no remote bindings to proxy to`);t.inspectorPort!==void 0&&t.logger.warn(`--inspector-port is a wrangler dev flag; ${n.name} dev has no inspector to pin`);const{command:c,commit:l,projection:d}=Ve(n,r,"dev",v=>a.dev({configPath:v,extraArgs:["--port",String(i)]}));l(),d!==void 0&&d.dropped.length>0&&t.logger.info(`${n.name} ignores these wrangler keys, so its dev server runs without them: ${d.dropped.join(", ")}`);const f=ce(x(r),c);return{flavor:"wrangler",ipv4LoopbackForced:!1,remote:{bindings:[],cleanup:()=>{},enabled:!1,withheld:[]},runsCodegenWatch:me(t),celldSession:!0,studioEnabled:t.studio!==!1,studioPort:o,workerEnabled:t.worker!==!1,workerOrigin:`http://localhost:${String(i)}`,workerPort:i,wrangler:{args:f.args,command:f.command,cwd:r,tag:c.tool}}},Vr=64,he="127.0.0.1",Wr=65535,Br=(e,r=he)=>new Promise(n=>{const t=Ye();t.once("error",()=>{n(!1)}),t.once("listening",()=>{t.close(()=>{n(!0)})}),t.listen(e,r)}),Kr=async(e,r=he,n=Vr)=>{for(let t=e;t<e+n&&t<=Wr;t+=1)if(await Br(t,r))return t;return e},Se=(e=qe)=>Object.values(e()).some(r=>r?.some(n=>n.internal&&n.address==="::1")),$="wrangler.dev.jsonc",R=6173,m=8787,H=5173,ke=()=>{},Hr=(e,r)=>{if(!e.remote&&e.local===!0)return{args:[],plan:{bindings:[],cleanup:ke,enabled:!1,withheld:[]}};const t=(e.materializeDev??He)({projectRoot:r,remote:e.remote===!0}),i={bindings:t.remoteBindings.map(s=>`${s.binding} (${s.kind})`),cleanup:t.cleanup,enabled:e.remote===!0,reason:t.reason,withheld:t.withheld};return{args:t.configPath===void 0?[]:["--config",t.configPath],plan:i}},Ie=(e,r)=>{const n=[...new Set($e(r).services.map(s=>s.wranglerPath))],{cleanup:t,configPaths:o,withheld:i}=(e.materializeServiceConfigs??ze)(n,{projectRoot:r});return{args:o.flatMap(s=>["--config",s]),cleanup:t,withheld:i}},zr=(e,r,n)=>{const t=L(e);return r.length===0||t===void 0?[]:[...n.length>0?[]:["--config",t],...r]},Ee=e=>e.local===!0?["--local"]:[],z=e=>A(e).parsed?.dev?.ip,ye=(e,r,n)=>{if(n!==void 0){const o=C(e,n);if(q(o)&&z(o)!==void 0)return[]}const t=L(e);return t!==void 0&&z(t)!==void 0?[]:r()?[]:["--ip","127.0.0.1"]},Yr=new Set(["127.0.0.1","::1","[::1]","localhost"]),qr=(e,r)=>{let n;try{n=Q(C(e,ne),"utf8")}catch{return[]}const t=[];for(const o of Be(n)){let i;try{i=new URL(o.value)}catch{continue}Yr.has(i.hostname)&&i.port===String(r)&&t.push(o.key)}return t},Y=async(e,r)=>{if(e.workerPort!==void 0)return e.workerPort;const n=L(r);if(n!==void 0){const{parsed:i}=A(n);if(typeof i?.dev?.port=="number")return i.dev.port}const t=await(e.findFreePort??Kr)(m);if(t===m)return t;const o=qr(r,m);if(o.length>0)throw new Error(`port ${String(m)} is in use, but ${ne} pins the worker origin to it (${o.join(", ")}). Serving on ${String(t)} would leave those URLs pointing at nothing. Stop whatever holds ${String(m)}, or run \`lunora dev --worker-port ${String(t)}\` and update those values to match.`);return t},Jr=(e,r)=>{if(e.inspectorPort!==void 0)return e.inspectorPort;const n=L(r);if(n===void 0)return;const{parsed:t}=A(n),o=t?.dev?.inspector_port;return typeof o=="number"?o:void 0},Xr=(e,r,n)=>{const t=ye(r,e.hasIpv6Loopback??Se,$),o=te(e.target??Z(r));if(o.toolchain===void 0)throw new Error(`deploy target "${o.id}" has no dev server to run the worker sidecar`);const i=Ie(e,r),s=o.toolchain.dev({configPath:$,extraArgs:[...t,...Ee(e),"--var","WORKER_ENV:development",...i.args]}),a=ce(n,s);return{cleanup:i.cleanup,sidecar:{args:a.args,command:a.command,cwd:r,tag:"worker"}}},Qr=(e,r)=>{e.worker===!1&&e.logger.warn(`--no-worker does not apply to the ${r} flavor: Vite owns the worker, codegen and studio in-process. Run your framework's dev script instead.`),e.inspectorPort!==void 0&&e.logger.warn(r==="framework-worker"?`--inspector-port does not apply to the ${r} flavor: pin \`dev.inspector_port\` in ${$} — that is the config the worker sidecar runs.`:`--inspector-port does not apply to the ${r} flavor: Vite owns the worker. Pin it in vite.config — \`lunora({ cloudflare: { inspectorPort: ${String(e.inspectorPort)} } })\`.`),e.local===!0&&r==="vite"&&e.logger.warn("--local does not apply to the vite flavor: Vite owns the worker. Turn remote bindings off in vite.config — `lunora({ cloudflare: { remoteBindings: false } })`.")},Zr=e=>{const r=e.cwd??process.cwd(),n=x(r),t=e.flavor??M(r);if(t==="vite"||t==="framework-worker"){const v=fe(r),u=t==="framework-worker"?Xr(e,r,n):void 0,g=u?.sidecar;return Qr(e,t),{runsCodegenWatch:!1,flavor:t,ipv4LoopbackForced:!1,remote:{bindings:[],cleanup:ke,enabled:e.remote===!0,withheld:[]},...u?{serviceConfigCleanup:u.cleanup}:{},...g?{sidecar:g}:{},studioEnabled:!1,studioPort:e.port??R,workerEnabled:!0,workerOrigin:`http://localhost:${String(H)}`,workerPort:H,wrangler:{args:v.args,command:v.command,cwd:r,...we(e),tag:"vite"}}}const o=ee(r),i=o.framework==="none"?void 0:`this project uses ${o.framework} — the worker runs inside Vite there. run \`${Ze(n,"dev")}\` for the full app (frontend + HMR); \`lunora dev\` starts only the worker.`,s=e.workerPort??m,a=Hr(e,r),c=ye(r,e.hasIpv6Loopback??Se),l=e.inspectorPort===void 0?[]:["--inspector-port",String(e.inspectorPort)],d=Ie(e,r),f=ae(n,"wrangler",["dev","--port",String(s),...l,...c,...Ee(e),"--var","WORKER_ENV:development",...a.args,...zr(r,d.args,a.args)]);return{runsCodegenWatch:me(e),flavor:t,frameworkHint:i,ipv4LoopbackForced:c.length>0,remote:{...a.plan,withheld:[...a.plan.withheld,...d.withheld]},serviceConfigCleanup:d.cleanup,studioEnabled:e.studio!==!1,studioPort:e.port??R,workerEnabled:e.worker!==!1,workerOrigin:`http://localhost:${String(s)}`,workerPort:s,wrangler:{args:f.args,command:f.command,cwd:r,tag:"wrangler"}}},Pt=async e=>{const r=e.cwd??process.cwd();if(e.target!==void 0&&O(e.target))return jr({cwd:r,driver:te(e.target),options:e,studioPort:e.port??R,workerPort:await Y(e,r)});const n=e.flavor??M(r),t=n==="wrangler"?await Y(e,r):e.workerPort,o=n==="wrangler"?Jr(e,r):e.inspectorPort;return Zr({...e,cwd:r,flavor:n,inspectorPort:o,workerPort:t})};export{_ as P,yt as a,$r as b,wr as c,or as d,M as e,Lt as f,Pt as g,_r as h,It as i,mt as j,kt as k,me as l,Tt as m,gr as n,wt as o,Zr as p,Jr as q,nr as r,Et as s,ht as t,Y as u,St as w};
@@ -1 +1 @@
1
- import{g as r,p as a,q as s,u as l}from"./plan-Dl57T11P.mjs";export{r as buildDevPlan,a as planDevCommand,s as resolveInspectorPort,l as resolveWorkerPort};
1
+ import{g as r,p as a,q as s,u as l}from"./plan-Bx3GZGOH.mjs";export{r as buildDevPlan,a as planDevCommand,s as resolveInspectorPort,l as resolveWorkerPort};
@@ -1,4 +1,4 @@
1
- import{existsSync as p,readFileSync as g,writeFileSync as k,mkdtempSync as F,rmSync as w}from"node:fs";import{tmpdir as G}from"node:os";import{LunoraError as h}from"@lunora/errors";import{join as l}from"@visulima/path";import{downloadTemplate as W}from"giget";import{r as y}from"./cli-manifest-CRet0egA.mjs";import{DEV_VARS_FILE as z,parseDevVariableEntries as H,writeDevVariablesFileAtomically as J}from"@lunora/config";import{modify as j,applyEdits as N,parse as K}from"jsonc-parser";import{b as q}from"./tui-prompts-B3YwUhGw.mjs";import Y from"./parseManifest-CwPTKdtS.mjs";const Z="alpha",T="main",X=new Set(["alpha","beta","next"]),Q=/^[\w./@-]+$/,ee=e=>!e.includes("..")&&Q.test(e),O=e=>{if(e==="0.0.0")return Z;const t=e.split("+")[0]??e,n=t.indexOf("-");if(n!==-1){const[s]=t.slice(n+1).split(".");if(s!==void 0&&X.has(s))return s}return T},D=e=>{if(e!==void 0&&e.length>0){if(!ee(e))throw new h("INTERNAL",`invalid --ref "${e}" — a ref may contain letters, digits, ".", "_", "-", "/", "@" and must not contain "..".`);return e}return O(y())},I="anolilab/lunora",L=/^[0-9a-f]{40}$/iu,B=String.raw`\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)+)?(?:\+[0-9A-Za-z.-]+)?`,te=new RegExp(String.raw`^v?${B}$`,"u"),ne=new RegExp(String.raw`^(?:@[\w.-]+\/)?[\w.-]+@${B}$`,"u"),se=e=>L.test(e)||te.test(e)||ne.test(e),re=()=>{const e=process.env.GITHUB_TOKEN??process.env.GH_TOKEN;return e!==void 0&&e.length>0?{authorization:`Bearer ${e}`}:{}},oe=async(e,t=I)=>{try{const n=await fetch(`https://api.github.com/repos/${t}/commits/${encodeURIComponent(e)}`,{headers:{accept:"application/vnd.github+json","user-agent":"lunora-cli",...re()},signal:AbortSignal.timeout(1e4)});if(!n.ok)return;const s=await n.json();return typeof s.sha=="string"&&L.test(s.sha)?s.sha:void 0}catch{return}},ie=async(e,t,n)=>{if(se(t))return t;const s=await oe(t,e);return s===void 0?(n.warn(`could not pin ${e}#${t} to a commit — fetching the UNPINNED branch (set GITHUB_TOKEN if rate-limited).`),t):(n.info(`pinned ${e}#${t} → ${s}`),s)},ae=async(e,t)=>ie(I,D(e),t),Me=(e=y())=>`@lunora/cli@${e}`,ce="latest",P=(e=y())=>{const t=O(e);return t===T?ce:t},de="https://registry.npmjs.org",ue=()=>{const e=process.env.npm_config_registry,t=e!==void 0&&e.length>0?e:de;return t.endsWith("/")?t.slice(0,-1):t},fe=async(e,t)=>{try{const n=await fetch(`${ue()}/${e.replaceAll("/","%2F")}`,{headers:{accept:"application/vnd.npm.install-v1+json"},signal:AbortSignal.timeout(1e4)});return n.ok?(await n.json())["dist-tags"]?.[t]:void 0}catch{return}},le=async(e,t)=>{const n=new Map;return await Promise.all([...new Set(e)].map(async s=>{const o=await fe(s,t);o!==void 0&&n.set(s,o)})),n},pe=e=>{if(!e.startsWith("workspace:"))return!1;const t=e.slice(10);return t===""||t==="*"||t==="^"||t==="~"},he=(e,t,n)=>{if(!e.startsWith("workspace:"))return e;const s=e.slice(10);return s===""||s==="*"||s==="^"||s==="~"?(n===void 0?void 0:t?.get(n))??P():s},Ue=async e=>{const t=new Set;for(const n of e)for(const s of[n.deps,n.devDependencies])for(const[o,r]of Object.entries(s??{}))pe(r)&&t.add(o);return t.size===0?new Map:le([...t],P())},ge=new Set(["@lunora/client","@lunora/do","@lunora/ratelimit","@lunora/runtime","@lunora/server","@lunora/values"]),me=/(['"])@lunora\/(client|do|ratelimit|runtime|server|values)(\/[^'"]*)?\1/gu,Fe=e=>e.replaceAll(me,(t,n,s,o)=>`${n}lunorash/${s}${o??""}${n}`),$=(e,t,n,s="dependencies",o=!1,r)=>{const a=Object.entries(e);if(a.length===0)return[];const i=l(t,"package.json");if(!p(i))return n.warn(`package.json not found at ${i} — skipping dependency updates`),[];let d=g(i,"utf8");const c=JSON.parse(d),f=[];for(const[u,M]of a){if(o&&ge.has(u)){n.info(`dep provided by the lunorash umbrella, skipping: ${u}`);continue}if(c.dependencies?.[u]!==void 0||c.devDependencies?.[u]!==void 0){n.info(`dep already present: ${u}`);continue}const U=j(d,[s,u],he(M,r,u),{formattingOptions:{insertSpaces:!0,tabSize:4}});d=N(d,U),f.push(u)}return f.length>0&&(k(i,d,"utf8"),n.success(`added ${String(f.length)} ${s==="devDependencies"?"devDependency(ies)":"dependency(ies)"} to package.json: ${f.join(", ")}`)),f},ye=(e,t,n)=>{if(e.length===0)return[];const s=l(t,z),o=p(s)?g(s,"utf8"):"",r=new Set(H(o).map(c=>c.key)),a=[],i=[],d=[];for(const c of e)c.secret&&i.push(c.name),!r.has(c.name)&&(c.description&&d.push(`# ${c.description}`),d.push(`${c.name}=${c.secret?"":c.value??""}`),a.push(c.name));if(a.length>0){const c=o===""||o.endsWith(`
1
+ import{existsSync as p,readFileSync as g,writeFileSync as k,mkdtempSync as F,rmSync as w}from"node:fs";import{tmpdir as G}from"node:os";import{LunoraError as h}from"@lunora/errors";import{join as l}from"@visulima/path";import{downloadTemplate as W}from"giget";import{r as y}from"./cli-manifest-DoQ_3bzs.mjs";import{DEV_VARS_FILE as z,parseDevVariableEntries as H,writeDevVariablesFileAtomically as J}from"@lunora/config";import{modify as j,applyEdits as N,parse as K}from"jsonc-parser";import{b as q}from"./tui-prompts-B3YwUhGw.mjs";import Y from"./parseManifest-CwPTKdtS.mjs";const Z="alpha",T="main",X=new Set(["alpha","beta","next"]),Q=/^[\w./@-]+$/,ee=e=>!e.includes("..")&&Q.test(e),O=e=>{if(e==="0.0.0")return Z;const t=e.split("+")[0]??e,n=t.indexOf("-");if(n!==-1){const[s]=t.slice(n+1).split(".");if(s!==void 0&&X.has(s))return s}return T},D=e=>{if(e!==void 0&&e.length>0){if(!ee(e))throw new h("INTERNAL",`invalid --ref "${e}" — a ref may contain letters, digits, ".", "_", "-", "/", "@" and must not contain "..".`);return e}return O(y())},I="anolilab/lunora",L=/^[0-9a-f]{40}$/iu,B=String.raw`\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)+)?(?:\+[0-9A-Za-z.-]+)?`,te=new RegExp(String.raw`^v?${B}$`,"u"),ne=new RegExp(String.raw`^(?:@[\w.-]+\/)?[\w.-]+@${B}$`,"u"),se=e=>L.test(e)||te.test(e)||ne.test(e),re=()=>{const e=process.env.GITHUB_TOKEN??process.env.GH_TOKEN;return e!==void 0&&e.length>0?{authorization:`Bearer ${e}`}:{}},oe=async(e,t=I)=>{try{const n=await fetch(`https://api.github.com/repos/${t}/commits/${encodeURIComponent(e)}`,{headers:{accept:"application/vnd.github+json","user-agent":"lunora-cli",...re()},signal:AbortSignal.timeout(1e4)});if(!n.ok)return;const s=await n.json();return typeof s.sha=="string"&&L.test(s.sha)?s.sha:void 0}catch{return}},ie=async(e,t,n)=>{if(se(t))return t;const s=await oe(t,e);return s===void 0?(n.warn(`could not pin ${e}#${t} to a commit — fetching the UNPINNED branch (set GITHUB_TOKEN if rate-limited).`),t):(n.info(`pinned ${e}#${t} → ${s}`),s)},ae=async(e,t)=>ie(I,D(e),t),Me=(e=y())=>`@lunora/cli@${e}`,ce="latest",P=(e=y())=>{const t=O(e);return t===T?ce:t},de="https://registry.npmjs.org",ue=()=>{const e=process.env.npm_config_registry,t=e!==void 0&&e.length>0?e:de;return t.endsWith("/")?t.slice(0,-1):t},fe=async(e,t)=>{try{const n=await fetch(`${ue()}/${e.replaceAll("/","%2F")}`,{headers:{accept:"application/vnd.npm.install-v1+json"},signal:AbortSignal.timeout(1e4)});return n.ok?(await n.json())["dist-tags"]?.[t]:void 0}catch{return}},le=async(e,t)=>{const n=new Map;return await Promise.all([...new Set(e)].map(async s=>{const o=await fe(s,t);o!==void 0&&n.set(s,o)})),n},pe=e=>{if(!e.startsWith("workspace:"))return!1;const t=e.slice(10);return t===""||t==="*"||t==="^"||t==="~"},he=(e,t,n)=>{if(!e.startsWith("workspace:"))return e;const s=e.slice(10);return s===""||s==="*"||s==="^"||s==="~"?(n===void 0?void 0:t?.get(n))??P():s},Ue=async e=>{const t=new Set;for(const n of e)for(const s of[n.deps,n.devDependencies])for(const[o,r]of Object.entries(s??{}))pe(r)&&t.add(o);return t.size===0?new Map:le([...t],P())},ge=new Set(["@lunora/client","@lunora/do","@lunora/ratelimit","@lunora/runtime","@lunora/server","@lunora/values"]),me=/(['"])@lunora\/(client|do|ratelimit|runtime|server|values)(\/[^'"]*)?\1/gu,Fe=e=>e.replaceAll(me,(t,n,s,o)=>`${n}lunorash/${s}${o??""}${n}`),$=(e,t,n,s="dependencies",o=!1,r)=>{const a=Object.entries(e);if(a.length===0)return[];const i=l(t,"package.json");if(!p(i))return n.warn(`package.json not found at ${i} — skipping dependency updates`),[];let d=g(i,"utf8");const c=JSON.parse(d),f=[];for(const[u,M]of a){if(o&&ge.has(u)){n.info(`dep provided by the lunorash umbrella, skipping: ${u}`);continue}if(c.dependencies?.[u]!==void 0||c.devDependencies?.[u]!==void 0){n.info(`dep already present: ${u}`);continue}const U=j(d,[s,u],he(M,r,u),{formattingOptions:{insertSpaces:!0,tabSize:4}});d=N(d,U),f.push(u)}return f.length>0&&(k(i,d,"utf8"),n.success(`added ${String(f.length)} ${s==="devDependencies"?"devDependency(ies)":"dependency(ies)"} to package.json: ${f.join(", ")}`)),f},ye=(e,t,n)=>{if(e.length===0)return[];const s=l(t,z),o=p(s)?g(s,"utf8"):"",r=new Set(H(o).map(c=>c.key)),a=[],i=[],d=[];for(const c of e)c.secret&&i.push(c.name),!r.has(c.name)&&(c.description&&d.push(`# ${c.description}`),d.push(`${c.name}=${c.secret?"":c.value??""}`),a.push(c.name));if(a.length>0){const c=o===""||o.endsWith(`
2
2
  `)?o:`${o}
3
3
  `;J(s,`${c}${d.join(`
4
4
  `)}
@@ -0,0 +1 @@
1
+ import"./EXIT_CODE-D_XCixv8.mjs";import"./resolve-Bdc9KEUv.mjs";import"./catalog-CahzmDLV.mjs";import{r as n,a as i,b as t}from"./commands-DvSfLvyt.mjs";export{n as runAddCommand,i as runBuildIndexCommand,t as runRegistryViewCommand};
@@ -1 +1 @@
1
- import{s}from"./index-oHZBGBwB.mjs";import{s as n}from"./commands-DgUDxkA8.mjs";const c=[{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"}],r="auth",E=async t=>await t("Which auth provider?",c,{default:r})??r,O="mail",g=[{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"}],j="auth-ui-react",d=t=>Object.hasOwn(t,"react-native")||Object.hasOwn(t,"@lunora/react-native")||Object.hasOwn(t,"expo"),B="auth-ui has no React Native port — the screens render DOM elements and a stylesheet, which Metro has nothing to mount. Build the screens with React Native primitives against the same better-auth client (`@lunora/react-native/auth`); `lunora add auth` still installs the server half.",h=t=>{if(!(t===void 0||s.validRange(t)===null))return s.minVersion(t)?.major},v=t=>Object.hasOwn(t,"@solidjs/web")||(h(t["solid-js"])??0)>=2,U=t=>{const e=a=>Object.hasOwn(t,a);if(!d(t)){if(v(t))return"auth-ui-solid-v2";if(e("@lunora/react"))return"auth-ui-react";if(e("@lunora/vue"))return"auth-ui-vue";if(e("@lunora/svelte"))return"auth-ui-svelte";if(e("@lunora/solid"))return"auth-ui-solid";if(e("@lunora/angular"))return"auth-ui-angular";if(e("react")||e("next"))return"auth-ui-react";if(e("vue")||e("nuxt"))return"auth-ui-vue";if(e("svelte")||e("@sveltejs/kit"))return"auth-ui-svelte";if(e("solid-js"))return"auth-ui-solid";if(e("@angular/core"))return"auth-ui-angular"}},L=t=>{const e=t.trim();if(e==="")return;const a=e.toLowerCase();return a==="auth-ui"||a==="auth-ui-"?{kind:"auth-ui"}:a==="auth"?{kind:"auth"}:a==="email"||a==="mail"?{kind:"email"}:{item:a,kind:"item"}},m=/[^a-z0-9]+/u,u=(t,e,a)=>{let i=t.toLowerCase().split(m).filter(Boolean).join("-").slice(0,a);return i.endsWith("-")&&(i=i.slice(0,-1)),i.length>=e?i:void 0},f="DB",A="Name your D1 database (run `wrangler d1 create` to get its id, then put it in wrangler.jsonc)",o=t=>u(t,1,64),b="lunora-db",_=t=>o(`${t}-db`)??b,M=async(t,e)=>{const a=_(e);return o(await t(A,{default:a,placeholder:a}))??a},R=(t,e)=>n(t,"d1_databases",{key:"binding",value:f},"database_name",e),N="SEND_EMAIL",P="Verified destination email for production delivery (blank = set it later in wrangler.jsonc)",p=t=>{const e=t.trim();if(e.length===0||e.includes(" "))return!1;const a=e.indexOf("@");if(a<=0||a!==e.lastIndexOf("@"))return!1;const i=e.slice(a+1);return i.length>=3&&i.includes(".")&&!i.startsWith(".")&&!i.endsWith(".")},y=(t,e)=>{const a=t.trim();if(a!==""){if(!p(a)){e(`"${a}" doesn't look like an email — leaving the placeholder; set destination_address in wrangler.jsonc.`);return}return a}},V=(t,e)=>n(t,"send_email",{key:"name",value:N},"destination_address",e),I="UPLOADS",S="Name your R2 bucket (you can rename it in wrangler.jsonc later)",l=t=>u(t,3,63),T="lunora-uploads",k=t=>l(`${t}-uploads`)??T,C=async(t,e)=>{const a=k(e);return l(await t(S,{default:a,placeholder:a}))??a},x=(t,e)=>n(t,"r2_buckets",{key:"binding",value:I},"bucket_name",e);export{B as A,r as D,O as E,P as M,o as a,_ as b,M as c,k as d,E as e,U as f,j as g,g as h,d as i,c as j,V as k,R as l,L as n,C as p,y as r,l as s,x as w};
1
+ import{s}from"./index-oHZBGBwB.mjs";import{s as n}from"./commands-DvSfLvyt.mjs";const c=[{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"}],r="auth",E=async t=>await t("Which auth provider?",c,{default:r})??r,O="mail",g=[{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"}],j="auth-ui-react",d=t=>Object.hasOwn(t,"react-native")||Object.hasOwn(t,"@lunora/react-native")||Object.hasOwn(t,"expo"),B="auth-ui has no React Native port — the screens render DOM elements and a stylesheet, which Metro has nothing to mount. Build the screens with React Native primitives against the same better-auth client (`@lunora/react-native/auth`); `lunora add auth` still installs the server half.",h=t=>{if(!(t===void 0||s.validRange(t)===null))return s.minVersion(t)?.major},v=t=>Object.hasOwn(t,"@solidjs/web")||(h(t["solid-js"])??0)>=2,U=t=>{const e=a=>Object.hasOwn(t,a);if(!d(t)){if(v(t))return"auth-ui-solid-v2";if(e("@lunora/react"))return"auth-ui-react";if(e("@lunora/vue"))return"auth-ui-vue";if(e("@lunora/svelte"))return"auth-ui-svelte";if(e("@lunora/solid"))return"auth-ui-solid";if(e("@lunora/angular"))return"auth-ui-angular";if(e("react")||e("next"))return"auth-ui-react";if(e("vue")||e("nuxt"))return"auth-ui-vue";if(e("svelte")||e("@sveltejs/kit"))return"auth-ui-svelte";if(e("solid-js"))return"auth-ui-solid";if(e("@angular/core"))return"auth-ui-angular"}},L=t=>{const e=t.trim();if(e==="")return;const a=e.toLowerCase();return a==="auth-ui"||a==="auth-ui-"?{kind:"auth-ui"}:a==="auth"?{kind:"auth"}:a==="email"||a==="mail"?{kind:"email"}:{item:a,kind:"item"}},m=/[^a-z0-9]+/u,u=(t,e,a)=>{let i=t.toLowerCase().split(m).filter(Boolean).join("-").slice(0,a);return i.endsWith("-")&&(i=i.slice(0,-1)),i.length>=e?i:void 0},f="DB",A="Name your D1 database (run `wrangler d1 create` to get its id, then put it in wrangler.jsonc)",o=t=>u(t,1,64),b="lunora-db",_=t=>o(`${t}-db`)??b,M=async(t,e)=>{const a=_(e);return o(await t(A,{default:a,placeholder:a}))??a},R=(t,e)=>n(t,"d1_databases",{key:"binding",value:f},"database_name",e),N="SEND_EMAIL",P="Verified destination email for production delivery (blank = set it later in wrangler.jsonc)",p=t=>{const e=t.trim();if(e.length===0||e.includes(" "))return!1;const a=e.indexOf("@");if(a<=0||a!==e.lastIndexOf("@"))return!1;const i=e.slice(a+1);return i.length>=3&&i.includes(".")&&!i.startsWith(".")&&!i.endsWith(".")},y=(t,e)=>{const a=t.trim();if(a!==""){if(!p(a)){e(`"${a}" doesn't look like an email — leaving the placeholder; set destination_address in wrangler.jsonc.`);return}return a}},V=(t,e)=>n(t,"send_email",{key:"name",value:N},"destination_address",e),I="UPLOADS",S="Name your R2 bucket (you can rename it in wrangler.jsonc later)",l=t=>u(t,3,63),T="lunora-uploads",k=t=>l(`${t}-uploads`)??T,C=async(t,e)=>{const a=k(e);return l(await t(S,{default:a,placeholder:a}))??a},x=(t,e)=>n(t,"r2_buckets",{key:"binding",value:I},"bucket_name",e);export{B as A,r as D,O as E,P as M,o as a,_ as b,M as c,k as d,E as e,U as f,j as g,g as h,d as i,c as j,V as k,R as l,L as n,C as p,y as r,l as s,x as w};
@@ -0,0 +1 @@
1
+ import{resolveDeployDriver as c,resolveProjectTarget as d}from"@lunora/config";import{defaultSpawner as l}from"./createRecordingSpawner-Ch7zuQQE.mjs";import{toolchainExecArgs as i,detectPackageManager as m}from"@lunora/config/cli";const u=async(e,t,o)=>{try{const r=await l({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,a)=>r.localeCompare(a)):void 0},S=async e=>{const t=c(d(e.cwd)),o=t.toolchain?.secretList?.({environment:e.env,temporary:e.temporary});if(o===void 0)return{error:`deploy target "${t.id}" has no secret store to list`,names:[],ok:!1};const{args:r,command:a}=i(m(e.cwd),o),s=await(e.runner??u)(a,r,e.cwd);if(s.code!==0)return{error:s.stderr.trim()||`wrangler secret list exited ${String(s.code)}`,names:[],ok:!1};const n=f(s.stdout);return n===void 0?{error:"could not parse `wrangler secret list --format json` output",names:[],ok:!1}:{names:n,ok:!0}};export{S as l};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/cli",
3
- "version": "1.0.0-alpha.397",
3
+ "version": "1.0.0-alpha.399",
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,16 +52,16 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@bomb.sh/tab": "0.0.22",
55
- "@lunora/advisor": "1.0.0-alpha.216",
56
- "@lunora/bindings": "1.0.0-alpha.112",
57
- "@lunora/codegen": "1.0.0-alpha.302",
58
- "@lunora/config": "1.0.0-alpha.350",
59
- "@lunora/container": "1.0.0-alpha.75",
60
- "@lunora/d1": "1.0.0-alpha.179",
55
+ "@lunora/advisor": "1.0.0-alpha.225",
56
+ "@lunora/bindings": "1.0.0-alpha.115",
57
+ "@lunora/codegen": "1.0.0-alpha.315",
58
+ "@lunora/config": "1.0.0-alpha.363",
59
+ "@lunora/container": "1.0.0-alpha.77",
60
+ "@lunora/d1": "1.0.0-alpha.182",
61
61
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
62
- "@lunora/mcp": "1.0.0-alpha.241",
63
- "@lunora/runtime": "1.0.0-alpha.199",
64
- "@lunora/seed": "1.0.0-alpha.218",
62
+ "@lunora/mcp": "1.0.0-alpha.242",
63
+ "@lunora/runtime": "1.0.0-alpha.208",
64
+ "@lunora/seed": "1.0.0-alpha.228",
65
65
  "@visulima/cerebro": "3.1.2",
66
66
  "@visulima/error": "6.1.0",
67
67
  "@visulima/fs": "6.0.29",
@@ -1 +0,0 @@
1
- import{C as E,R as M,V as a,r as s}from"./cli-DH-MMo4C.mjs";import"./cli-manifest-CRet0egA.mjs";import"./EXIT_CODE-D_XCixv8.mjs";import"./createLogger-Cl18I8AX.mjs";import"./render-lunora-error-C3OJY5wk.mjs";export{E as COMMANDS,M as REGISTERED_COMMAND_NAMES,a as VERSION,s as runCli};