@lunora/cli 1.0.0-alpha.126 → 1.0.0-alpha.128
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.
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +42 -6
- package/dist/index.d.ts +42 -6
- package/dist/index.mjs +1 -1
- package/dist/packem_chunks/handler.mjs +1 -1
- package/dist/packem_chunks/handler10.mjs +1 -1
- package/dist/packem_chunks/handler11.mjs +1 -1
- package/dist/packem_chunks/handler14.mjs +1 -1
- package/dist/packem_chunks/handler15.mjs +1 -1
- package/dist/packem_chunks/handler16.mjs +1 -1
- package/dist/packem_chunks/handler17.mjs +1 -1
- package/dist/packem_chunks/handler18.mjs +2 -2
- package/dist/packem_chunks/handler19.mjs +1 -1
- package/dist/packem_chunks/handler21.mjs +7 -2
- package/dist/packem_chunks/handler22.mjs +2 -99
- package/dist/packem_chunks/handler23.mjs +99 -11
- package/dist/packem_chunks/handler24.mjs +11 -0
- package/dist/packem_chunks/handler3.mjs +2 -2
- package/dist/packem_chunks/handler4.mjs +1 -1
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +4 -4
- package/dist/packem_chunks/planDevCommand.mjs +6 -6
- package/dist/packem_chunks/runCodegenCommand.mjs +4 -4
- package/dist/packem_chunks/runDeployCommand.mjs +1 -1
- package/dist/packem_chunks/runInitCommand.mjs +1 -1
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +3 -3
- package/dist/packem_shared/COMMANDS-BHb52jlk.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-CEOt386P.mjs +12 -0
- package/dist/packem_shared/cli-BxL0WCh4.mjs +3 -0
- package/dist/packem_shared/commands-C5pu77HK.mjs +19 -0
- package/dist/packem_shared/deploy-target-Dvr9vxpR.mjs +1 -0
- package/dist/packem_shared/platform-diagnostics-C4TFj5Pu.mjs +4 -0
- package/dist/packem_shared/runAddCommand-CuvJ0l7a.mjs +1 -0
- package/dist/packem_shared/{storage-BHSN9Vgb.mjs → storage-BazhWFmM.mjs} +1 -1
- package/dist/packem_shared/wrangler-name-CHDf3rMP.mjs +1 -0
- package/dist/packem_shared/wrangler-secrets-DDDUuryf.mjs +1 -0
- package/package.json +9 -8
- package/dist/packem_shared/COMMANDS-DmB3_936.mjs +0 -3
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-C5vGgrhK.mjs +0 -8
- package/dist/packem_shared/commands-B1SpMXov.mjs +0 -19
- package/dist/packem_shared/runAddCommand-BF35qSZ2.mjs +0 -1
- package/dist/packem_shared/wrangler-name-HIl0Z6yx.mjs +0 -1
- package/dist/packem_shared/wrangler-secrets-BMRJwKQU.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as m,readFileSync as D}from"node:fs";import{runCodegen as U,discoverMigrations as C}from"@lunora/codegen";import{readLinkedProject as k,writeLinkedProject as L,validateWranglerProject as I,inferLunoraBindings as x,reconcileWranglerBindings as _,reconcileWranglerCompatibilityDate as E,DEV_VARS_FILE as b,parseDevVariableEntries as N,isMintableSecretKey as R,reconcileWranglerCrons as O,findWranglerFile as $,readWranglerJsonc as S,discoverContainerInfo as j,packageNamesFromBindings as P,requiredSecrets as W,generateSecretValue as B,discoverSchemaInfo as K}from"@lunora/config";import{join as p}from"@visulima/path";import{Spinner as M}from"@visulima/spinner";import{Project as q}from"ts-morph";import{r as Y}from"../packem_shared/api-spec-BENwiyUa.mjs";import{d as T}from"../packem_shared/wrangler-name-HIl0Z6yx.mjs";import{i as F}from"../packem_shared/command-Bjv4VmYA.mjs";import{M as h,P as w}from"../packem_shared/detect-package-manager-B2eIuAiP.mjs";import{o as V,r as G}from"../packem_shared/docker-CKvYE9YF.mjs";import{i as z,r as f,d as H,s as J}from"../packem_shared/output-format-D7cKB-O5.mjs";import{containerBuildTag as Q}from"@lunora/container";import{defaultSpawner as v}from"../packem_shared/createRecordingSpawner-ByIqBepG.mjs";import{t as X}from"../packem_shared/resolve-target-vxaXHmvg.mjs";import{k as Z}from"../packem_shared/schema-drift-gate-CpqG-xP4.mjs";import{$ as ee}from"../packem_shared/tui-prompts-CCt3jm1k.mjs";import{m as re,p as te}from"../packem_shared/vectorize-metadata-BvZbbqUD.mjs";import{f as oe}from"../packem_shared/wrangler-secrets-BMRJwKQU.mjs";import{runMigrateDataCommand as ne}from"./runMigrateGenerateCommand.mjs";const ie=/https?:\/\/[^\s"'<>]+\.workers\.dev[^\s"'<>]*/u,ae=/https:\/\/[^\s"'<>]+/u,se=e=>{const r=ie.exec(e);return r?r[0]:ae.exec(e)?.[0]},ce=({cwd:e,env:r,logger:o,now:t,output:n})=>{if(n===void 0||k(e)!==void 0)return;const i=se(n);if(i!==void 0)try{const a=(t??(()=>new Date().toISOString()))();L(e,{env:r,linkedAt:a,workerName:T(e),workerUrl:i}),o.success(`link: recorded ${i} in .lunora/project.json (run \`lunora link\` to change)`)}catch{}},le=e=>{const{cwd:r,env:o,logger:t,migrated:n}=e;try{const i=k(r),a=i?.workerName??T(r);t.success("deploy complete"),t.info(` worker: ${a??"(see wrangler output above)"}`),o!==void 0&&t.info(` env: ${o}`),i?.workerUrl===void 0?t.info(" url: run `lunora link --url <https://your-worker>` to record it"):t.info(` url: ${i.workerUrl}`),n&&t.info(" migrations: applied"),t.info(" studio: lunora view --remote"),t.info(" logs: lunora logs")}catch{}},de=async e=>{if(e.targets.length===0)return{builtTags:[],code:0};if(!(e.railpackAvailable??V)()){const t="deploy blocked: a container uses `image: { build }` (Railpack), but Railpack isn't ready. Install the `railpack` CLI and start a BuildKit instance, e.g. `docker run --rm --privileged -d --name buildkit moby/buildkit` then `export BUILDKIT_HOST=docker-container://buildkit`. Alternatively switch the container's `image` to a Dockerfile path or a pre-built registry reference.";return e.logger.error(t),{builtTags:[],code:1,error:t}}const r=e.spawner??v,o=[];for(const t of e.targets){const n=Q(t.exportName),i={args:["build",t.buildDir,"--name",n],command:"railpack",cwd:e.cwd},a=h(w(e.cwd),"wrangler",["containers","push",n]),s={args:a.args,command:a.command,cwd:e.cwd};e.logger.info(`railpack: building "${t.exportName}" → ${n} from ${t.buildDir}`);const c=await r(i);if(c.code!==0){const d=`railpack build failed for container "${t.exportName}" (${t.buildDir})`;return e.logger.error(d),{builtTags:o,code:c.code,error:d}}e.logger.info(`railpack: pushing ${n} to the Cloudflare Registry`);const l=await r(s);if(l.code!==0){const d=`wrangler containers push failed for "${t.exportName}" (${n})`;return e.logger.error(d),{builtTags:o,code:l.code,error:d}}o.push(n)}return{builtTags:o,code:0}},A="<replace-with-d1-create-id>",ge=["LUNORA_ORIGIN_URL","LUNORA_WORKER_ORIGIN","AUTH_URL"],ue=e=>{try{const{hostname:r}=new URL(e);return r==="localhost"||r==="127.0.0.1"||r==="::1"||r==="[::1]"}catch{return!1}},pe=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"),me=(e,r,o)=>{const t=$(e);if(!t)return;const{parsed:n}=S(t),i=(n?.containers??[]).filter(s=>typeof s?.image=="string"&&pe(s.image));if(i.length===0||o())return;const a=`deploy blocked: wrangler.jsonc declares ${String(i.length)} container(s) built from a local Dockerfile, but no Docker-compatible engine is available. Start Docker (or Colima), or point the container's \`image\` at a pre-built registry reference. Note: container images must target linux/amd64.`;return r.error(a),a},fe=e=>m(p(e,"src","worker.ts"))?"src/worker.ts":void 0,he=(e,r)=>{for(const o of j(e,"lunora").containers){const{image:t}=o;if(t.kind==="dockerfile"&&!m(p(e,t.dockerfilePath))){const n=`deploy blocked: container "${o.exportName}" references a Dockerfile at "${t.dockerfilePath}" that does not exist. Create it or fix the \`image\` path in lunora/containers.ts.`;return r.error(n),n}if(t.kind==="build"&&!m(p(e,t.buildDir))){const n=`deploy blocked: container "${o.exportName}" references a Railpack build directory "${t.buildDir}" that does not exist. Create it or fix the \`image.build\` path in lunora/containers.ts.`;return r.error(n),n}}},we=e=>f(e.format)?!1:e.interactive!==void 0?e.interactive:process.stdout.isTTY&&!process.env.CI,ve=e=>{const r=$(e);if(!r)return;const{parsed:o}=S(r);return o?(o.d1_databases??[]).find(t=>t.database_id===A)?.binding:void 0},ye=async(e,r)=>{const o=j(e,"lunora").containers.filter(n=>n.image.kind==="build").map(n=>({buildDir:n.image.buildDir,exportName:n.exportName}));if(o.length===0)return;const t=await de({cwd:e,logger:r.logger,railpackAvailable:r.railpackAvailable,spawner:r.spawner,targets:o});return t.code===0?void 0:t.error??"railpack build failed"},be=(e,r,o)=>{if(o!==void 0)try{const t=O(e,o);t.changed&&r.success(`synced ${String(o.length)} cron trigger(s) → ${t.wranglerPath??"wrangler.jsonc"}`)}catch(t){const n=t instanceof Error?t.message:String(t);r.warn(`cron trigger sync skipped: ${n}`)}},ke=async(e,r,o)=>{try{const t=await x({projectRoot:e}),n=_(e,t);n.changed&&r.success(`provisioned bindings: ${n.added.join(", ")} → ${n.wranglerPath??"wrangler.jsonc"}`);for(const i of n.warnings)r.warn(i)}catch(t){const n=t instanceof Error?t.message:String(t);r.warn(`binding inference skipped: ${n}`)}try{const t=E(e);t.changed&&r.success(`bumped compatibility_date to ${t.date??"unknown"} (Workers Cache enabled) → ${t.wranglerPath??"wrangler.jsonc"}`)}catch(t){const n=t instanceof Error?t.message:String(t);r.warn(`compatibility date sync skipped: ${n}`)}be(e,r,o)},$e=(e,r)=>{const o=p(e,b);if(!m(o))return;let t;try{t=N(D(o,"utf8")).length}catch{return}t!==0&&r.warn(`Note: \`lunora deploy\` does not push secrets. ${b} has ${String(t)} key(s); if you changed them, run \`lunora env push --yes\` to update the deployed secrets.`)},Se=/(?:KEY|PASSWORD|SECRET|TOKEN)$/u,Re=async e=>{let r=[];try{r=P(await x({projectRoot:e}))}catch{}const o=W(r).map(n=>n.key);let t=[];try{const n=p(e,b);m(n)&&(t=N(D(n,"utf8")).map(i=>i.key).filter(i=>Se.test(i)))}catch{}return[...new Set([...o,...t])]},De=async(e,r,o)=>{const{logger:t}=r,n=r.spawner??v,i=w(e),a=r.env===void 0?"":` --env ${r.env}`;for(const s of o){const c=["secret","put",s];r.env!==void 0&&c.push("--env",r.env),r.temporary===!0&&c.push("--temporary");const l=h(i,"wrangler",c),d=await n({args:l.args,command:l.command,cwd:e,input:B()});if(d.code!==0)return t.error(`failed to push secret ${s} (exit ${String(d.code)}); set it manually with \`wrangler secret put ${s}${a}\`.`),!1;t.success(`generated + pushed ${s}`)}return!0},xe=async(e,r,o)=>{if(r.dryRun===!0||r.preview===!0)return;const{logger:t}=r,n=r.env===void 0?"":` --env ${r.env}`;let i;try{i=await(r.secretLister??oe)({cwd:e,env:r.env,temporary:r.temporary})}catch{return}if(!i.ok)return;const a=new Set(i.names),s=(await Re(e)).filter(l=>!a.has(l));if(s.length===0)return;if(!o)return`missing required secret(s) on the deploy target: ${s.join(", ")}. Set them with \`wrangler secret put <KEY>${n}\` (or \`lunora env generate --set\` then \`lunora env push --yes${r.env===void 0?"":" --prod"}\`), then re-deploy.`;for(const l of s.filter(d=>!R(d)))t.warn(`required secret ${l} is not set on the target — set it with: wrangler secret put ${l}${n}`);const c=s.filter(l=>R(l));if(c.length!==0){if(await(r.secretConfirm??ee())(`${String(c.length)} required secret(s) not set on the target (${c.join(", ")}). Generate strong values and push them now?`)){await De(e,r,c);return}t.warn(`${String(c.length)} required secret(s) not set on the target: ${c.join(", ")}. Generate + push with \`lunora env generate --set\` then \`lunora env push --yes${r.env===void 0?"":" --prod"}\`.`)}},Ne=async(e,r)=>{const o=new q({skipAddingFilesFromTsConfig:!0}),t=p(r,"lunora");let n;try{n=C(o,t)}catch(i){const a=i instanceof Error?i.message:String(i);return e.logger.warn(`--migrate: could not discover migrations (${a}); skipping`),0}if(n.length===0)return e.logger.info("--migrate: no data migrations declared in lunora/"),0;e.logger.info(`--migrate: running ${String(n.length)} migration(s) against deployed worker`);for(const i of n){e.logger.info(`--migrate: up "${i.id}" (table "${i.table}")`);const a={cwd:r,fetchImpl:e.fetchImpl,id:i.id,logger:e.logger,prod:!0,subcommand:"up",token:e.migrateToken,url:e.migrateUrl,yes:e.migrateYes===!0},s=await ne(a);if(s.code!==0)return e.logger.error(`--migrate: migration "${i.id}" failed — see output above`),s.code;e.logger.success(`--migrate: "${i.id}" applied`)}return 0},je=e=>{if(!(!e.migrate||e.dryRun||e.preview)){if(e.migrateUrl===void 0){const r="--migrate requires --migrate-url <https://your-worker> — the deploy target URL is not captured automatically, refusing to default to localhost";return e.logger.error(r),r}if(e.migrateYes!==!0){const r="--migrate runs production data migrations after deploy. Re-run with --migrate-yes to confirm.";return e.logger.error(r),r}if((e.migrateToken??process.env.LUNORA_ADMIN_TOKEN)===void 0||(e.migrateToken??process.env.LUNORA_ADMIN_TOKEN)===""){const r="admin token required for --migrate — pass --migrate-token or set LUNORA_ADMIN_TOKEN";return e.logger.error(r),r}}},Te=(e,r,o,t)=>{let n;r?(n=new M({name:"dots"}),n.start("running codegen")):o.info("running codegen");try{const i=U({apiSpec:t,projectRoot:e});return n?.succeed("codegen complete"),n||o.success("codegen complete"),{result:i}}catch(i){n?.failed("codegen failed");const a=i instanceof Error?i.message:String(i);return o.error(`codegen failed: ${a}`),{error:`codegen failed: ${a}`}}},Ae=(e,r)=>{const o=ve(e);if(o===void 0)return;const t=`deploy blocked: the "${o}" D1 binding has a placeholder database_id ("${A}"). Run \`wrangler d1 create <name>\` to create the database, then replace the placeholder in wrangler.jsonc with the real id before deploying.`;return r.error(t),t},Ue=(e,r)=>{const o=$(e);if(!o)return;const{parsed:t}=S(o),n=t?.vars;if(!n)return;const i=ge.filter(s=>typeof n[s]=="string"&&ue(n[s]));if(i.length===0)return;const a=`deploy blocked: ${i.join(", ")} in wrangler.jsonc point at localhost. A deployed Worker can't reach a loopback address, so this silently breaks scheduled-job dispatch / auth callbacks. Set each to the deployed worker's public URL (or move it to a secret with \`wrangler secret put\`) before deploying.`;return r.error(a),a},Ce=async(e,r)=>{const{info:o}=K(r,"lunora"),t=o?.vectorMetadata??[];if(t.length===0)return;const n=[];for(const a of t){const s=te(a.kind);if(s===void 0){e.logger.warn(`vector index "${a.index}" declares metadata "${a.property}", whose column type cannot be filtered on in Vectorize — it is stored with each vector but no filter will match it.`);continue}n.push({index:a.index,property:a.property,type:s})}if(n.length===0)return;const i=(await re({cwd:r,entries:n,exec:h(w(r),"wrangler",[]),logger:e.logger,spawner:e.spawner??v})).filter(a=>a.status!=="failed").length;i>0&&e.logger.success(`vectorize metadata indexes ready: ${String(i)}/${String(n.length)}`)},Le=async(e,r,o,t,n)=>{if(await Ce(e,r),e.migrate){const i=await Ne(e,r);return i===0&&n?.(),{code:i,descriptor:o,validation:t}}return n?.(),{code:0,descriptor:o,validation:t}},Ie=async(e,r)=>{const o=Ae(e,r.logger);if(o!==void 0)return o;const t=Ue(e,r.logger);if(t!==void 0)return t;const n=he(e,r.logger);if(n!==void 0)return n;const i=me(e,r.logger,r.dockerAvailable??G);return i!==void 0?i:ye(e,r)},_e=(e,r)=>{const o=r.preview?["versions","upload"]:["deploy"],t=fe(e);return t!==void 0&&(o.push(t),r.logger.info(`class-B composition: deploying ${t} (overrides wrangler main)`)),r.env!==void 0&&o.push("--env",r.env),r.temporary&&(o.push("--temporary"),r.logger.info("temporary account: deploying to a short-lived Cloudflare account (~60min); wrangler will print a claim URL")),r.dryRun&&(o.push("--dry-run"),r.logger.info("dry run: validating + bundling without publishing")),r.outDir!==void 0&&(o.push("--outdir",r.outDir,"--metafile"),r.logger.info(`build artifact: emitting bundle to ${r.outDir}`)),o},Ee=(e,r)=>{if(e.problems.length===0)return!1;r.error("wrangler.jsonc validation failed:");for(const o of e.problems)r.error(` - ${o}`);return!0},Oe=async e=>{const r=e.cwd??process.cwd(),o=we(e);let t;if(!e.skipCodegen){const u=Te(r,o,e.logger,e.apiSpec);if(u.error!==void 0)return{code:1,descriptor:void 0,error:u.error,validation:{problems:[],wranglerPath:void 0}};t=u.result}let n;if(t!==void 0){const u=Z({allowDrift:e.allowSchemaDrift===!0,codegen:t,logger:e.logger,updateBaseline:e.updateSchemaBaseline===!0});if(u.blocked)return{code:1,descriptor:void 0,error:"schema drift gate blocked deploy",schemaDrift:{blocked:!0,reason:u.reason},validation:{problems:[],wranglerPath:void 0}};n=u.rebless}await ke(r,e.logger,t?.cronTriggers);const i=je(e);if(i!==void 0)return{code:1,descriptor:void 0,error:i,validation:{problems:[],wranglerPath:void 0}};const a=await Ie(r,e);if(a!==void 0)return{code:1,descriptor:void 0,error:a,validation:{problems:[],wranglerPath:void 0}};const s=I({projectRoot:r});if(Ee(s,e.logger))return{code:1,descriptor:void 0,error:"wrangler validation failed",validation:s};$e(r,e.logger);const c=await xe(r,e,o);if(c!==void 0)return e.logger.error(c),{code:1,descriptor:void 0,error:c,validation:s};const l=!f(e.format)&&e.dryRun!==!0&&e.preview!==!0&&k(r)===void 0,d=h(w(r),"wrangler",_e(r,e)),g={args:d.args,captureStdout:l,command:d.command,cwd:r,stdoutToStderr:f(e.format)};e.logger.info(`deploying via ${g.command} ${g.args.join(" ")}`);const y=await(e.spawner??v)(g);return y.code!==0?{code:y.code,descriptor:g,validation:s}:e.dryRun?{code:0,descriptor:g,validation:s}:e.preview?{code:0,descriptor:g,validation:s}:(ce({cwd:r,env:e.env,logger:e.logger,output:y.stdout}),Le(e,r,g,s,n))},Pe=async e=>{const r=z("deploy",e.format);if(r!==void 0)return e.logger.error(r),{code:1,descriptor:void 0,error:r,validation:{problems:[],wranglerPath:void 0}};const o=await Oe({...e,logger:J(e.format,e.logger)});return f(e.format)?(H(o),o):(o.code===0&&e.dryRun!==!0&&e.preview!==!0?le({cwd:e.cwd??process.cwd(),env:e.env,logger:e.logger,migrated:e.migrate===!0}):o.code===0&&e.preview===!0&&e.logger.success("preview version uploaded — see the preview URL in the wrangler output above"),o)},ir=F(async({cwd:e,logger:r,options:o})=>({code:(await Pe({allowSchemaDrift:o.allowSchemaDrift===!0,apiSpec:Y(o.apiSpec),cwd:e,dryRun:o.dryRun===!0,env:o.env,format:o.format,logger:r,migrate:o.migrate===!0,migrateToken:o.migrateToken,migrateUrl:X({cwd:e,url:o.migrateUrl}),migrateYes:o.migrateYes===!0,preview:o.preview===!0,skipCodegen:o.prebuilt===!0,temporary:o.temporary===!0,updateSchemaBaseline:o.updateSchemaBaseline===!0})).code}));export{ir as execute,Pe as runDeployCommand};
|
|
1
|
+
import{existsSync as h,readFileSync as T}from"node:fs";import{runCodegen as _,discoverMigrations as E}from"@lunora/codegen";import{readLinkedProject as S,writeLinkedProject as P,resolveDeployDriver as R,inferLunoraBindings as U,DEV_VARS_FILE as $,parseDevVariableEntries as A,isMintableSecretKey as j,discoverContainerInfo as C,packageNamesFromBindings as O,requiredSecrets as W,generateSecretValue as B,discoverSchemaInfo as K}from"@lunora/config";import{validateWranglerProject as M,reconcileWranglerBindings as q,reconcileWranglerCompatibilityDate as Y,reconcileWranglerCrons as F,findWranglerFile as D,readWranglerJsonc as x}from"@lunora/config/cloudflare";import{join as m}from"@visulima/path";import{Spinner as V}from"@visulima/spinner";import{Project as G}from"ts-morph";import{r as z}from"../packem_shared/api-spec-BENwiyUa.mjs";import{d as I}from"../packem_shared/wrangler-name-CHDf3rMP.mjs";import{i as H}from"../packem_shared/command-Bjv4VmYA.mjs";import{i as J}from"../packem_shared/deploy-target-Dvr9vxpR.mjs";import{M as v,P as y}from"../packem_shared/detect-package-manager-B2eIuAiP.mjs";import{o as Q,r as X}from"../packem_shared/docker-CKvYE9YF.mjs";import{i as Z,r as w,d as ee,s as re}from"../packem_shared/output-format-D7cKB-O5.mjs";import{containerBuildTag as te}from"@lunora/container";import{defaultSpawner as b}from"../packem_shared/createRecordingSpawner-ByIqBepG.mjs";import{t as oe}from"../packem_shared/resolve-target-vxaXHmvg.mjs";import{k as ne}from"../packem_shared/schema-drift-gate-CpqG-xP4.mjs";import{$ as ie}from"../packem_shared/tui-prompts-CCt3jm1k.mjs";import{m as ae,p as se}from"../packem_shared/vectorize-metadata-BvZbbqUD.mjs";import{R as ce}from"../packem_shared/wrangler-secrets-DDDUuryf.mjs";import{runMigrateDataCommand as le}from"./runMigrateGenerateCommand.mjs";const de=/https?:\/\/[^\s"'<>]+\.workers\.dev[^\s"'<>]*/u,ge=/https:\/\/[^\s"'<>]+/u,ue=e=>{const r=de.exec(e);return r?r[0]:ge.exec(e)?.[0]},pe=({cwd:e,env:r,logger:t,now:n,output:o})=>{if(o===void 0||S(e)!==void 0)return;const i=ue(o);if(i!==void 0)try{const a=(n??(()=>new Date().toISOString()))();P(e,{env:r,linkedAt:a,workerName:I(e),workerUrl:i}),t.success(`link: recorded ${i} in .lunora/project.json (run \`lunora link\` to change)`)}catch{}},me=e=>{const{cwd:r,env:t,logger:n,migrated:o}=e;try{const i=S(r),a=i?.workerName??I(r);n.success("deploy complete"),n.info(` worker: ${a??"(see wrangler output above)"}`),t!==void 0&&n.info(` env: ${t}`),i?.workerUrl===void 0?n.info(" url: run `lunora link --url <https://your-worker>` to record it"):n.info(` url: ${i.workerUrl}`),o&&n.info(" migrations: applied"),n.info(" studio: lunora view --remote"),n.info(" logs: lunora logs")}catch{}},fe=async e=>{if(e.targets.length===0)return{builtTags:[],code:0};if(!(e.railpackAvailable??Q)()){const n="deploy blocked: a container uses `image: { build }` (Railpack), but Railpack isn't ready. Install the `railpack` CLI and start a BuildKit instance, e.g. `docker run --rm --privileged -d --name buildkit moby/buildkit` then `export BUILDKIT_HOST=docker-container://buildkit`. Alternatively switch the container's `image` to a Dockerfile path or a pre-built registry reference.";return e.logger.error(n),{builtTags:[],code:1,error:n}}const r=e.spawner??b,t=[];for(const n of e.targets){const o=te(n.exportName),i={args:["build",n.buildDir,"--name",o],command:"railpack",cwd:e.cwd},a=v(y(e.cwd),"wrangler",["containers","push",o]),s={args:a.args,command:a.command,cwd:e.cwd};e.logger.info(`railpack: building "${n.exportName}" → ${o} from ${n.buildDir}`);const d=await r(i);if(d.code!==0){const l=`railpack build failed for container "${n.exportName}" (${n.buildDir})`;return e.logger.error(l),{builtTags:t,code:d.code,error:l}}e.logger.info(`railpack: pushing ${o} to the Cloudflare Registry`);const c=await r(s);if(c.code!==0){const l=`wrangler containers push failed for "${n.exportName}" (${o})`;return e.logger.error(l),{builtTags:t,code:c.code,error:l}}t.push(o)}return{builtTags:t,code:0}},L="<replace-with-d1-create-id>",he=["LUNORA_ORIGIN_URL","LUNORA_WORKER_ORIGIN","AUTH_URL"],we=e=>{try{const{hostname:r}=new URL(e);return r==="localhost"||r==="127.0.0.1"||r==="::1"||r==="[::1]"}catch{return!1}},ve=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"),ye=(e,r,t)=>{const n=D(e);if(!n)return;const{parsed:o}=x(n),i=(o?.containers??[]).filter(s=>typeof s?.image=="string"&&ve(s.image));if(i.length===0||t())return;const a=`deploy blocked: wrangler.jsonc declares ${String(i.length)} container(s) built from a local Dockerfile, but no Docker-compatible engine is available. Start Docker (or Colima), or point the container's \`image\` at a pre-built registry reference. Note: container images must target linux/amd64.`;return r.error(a),a},be=e=>h(m(e,"src","worker.ts"))?"src/worker.ts":void 0,ke=(e,r)=>{for(const t of C(e,"lunora").containers){const{image:n}=t;if(n.kind==="dockerfile"&&!h(m(e,n.dockerfilePath))){const o=`deploy blocked: container "${t.exportName}" references a Dockerfile at "${n.dockerfilePath}" that does not exist. Create it or fix the \`image\` path in lunora/containers.ts.`;return r.error(o),o}if(n.kind==="build"&&!h(m(e,n.buildDir))){const o=`deploy blocked: container "${t.exportName}" references a Railpack build directory "${n.buildDir}" that does not exist. Create it or fix the \`image.build\` path in lunora/containers.ts.`;return r.error(o),o}}},$e=e=>w(e.format)?!1:e.interactive!==void 0?e.interactive:process.stdout.isTTY&&!process.env.CI,Se=e=>{const r=D(e);if(!r)return;const{parsed:t}=x(r);return t?(t.d1_databases??[]).find(n=>n.database_id===L)?.binding:void 0},Re=async(e,r)=>{const t=C(e,"lunora").containers.filter(o=>o.image.kind==="build").map(o=>({buildDir:o.image.buildDir,exportName:o.exportName}));if(t.length===0)return;const n=await fe({cwd:e,logger:r.logger,railpackAvailable:r.railpackAvailable,spawner:r.spawner,targets:t});return n.code===0?void 0:n.error??"railpack build failed"},De=(e,r,t)=>{if(t!==void 0)try{const n=F(e,t);n.changed&&r.success(`synced ${String(t.length)} cron trigger(s) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const o=n instanceof Error?n.message:String(n);r.warn(`cron trigger sync skipped: ${o}`)}},xe=async(e,r,t,n)=>{try{R(n);const o=await U({projectRoot:e}),i=q(e,o);i.changed&&r.success(`provisioned bindings: ${i.added.join(", ")} → ${i.wranglerPath??"wrangler.jsonc"}`);for(const a of i.warnings)r.warn(a)}catch(o){const i=o instanceof Error?o.message:String(o);r.warn(`binding inference skipped: ${i}`)}try{const o=Y(e);o.changed&&r.success(`bumped compatibility_date to ${o.date??"unknown"} (Workers Cache enabled) → ${o.wranglerPath??"wrangler.jsonc"}`)}catch(o){const i=o instanceof Error?o.message:String(o);r.warn(`compatibility date sync skipped: ${i}`)}De(e,r,t)},Ne=(e,r)=>{const t=m(e,$);if(!h(t))return;let n;try{n=A(T(t,"utf8")).length}catch{return}n!==0&&r.warn(`Note: \`lunora deploy\` does not push secrets. ${$} has ${String(n)} key(s); if you changed them, run \`lunora env push --yes\` to update the deployed secrets.`)},je=/(?:KEY|PASSWORD|SECRET|TOKEN)$/u,Te=async e=>{let r=[];try{r=O(await U({projectRoot:e}))}catch{}const t=W(r).map(o=>o.key);let n=[];try{const o=m(e,$);h(o)&&(n=A(T(o,"utf8")).map(i=>i.key).filter(i=>je.test(i)))}catch{}return[...new Set([...t,...n])]},Ue=async(e,r,t,n)=>{const{logger:o}=r,i=r.spawner??b,a=y(e),s=r.env===void 0?"":` --env ${r.env}`,{toolchain:d}=R(n);if(d===void 0)return o.error("deploy target has no command-line toolchain; cannot push secrets"),!1;for(const c of t){const l=d.secretPut({environment:r.env,key:c,temporary:r.temporary}),p=v(a,l.tool,l.args),f=await i({args:p.args,command:p.command,cwd:e,input:B()});if(f.code!==0)return o.error(`failed to push secret ${c} (exit ${String(f.code)}); set it manually with \`wrangler secret put ${c}${s}\`.`),!1;o.success(`generated + pushed ${c}`)}return!0},Ae=async(e,r,t,n)=>{if(r.dryRun===!0||r.preview===!0)return;const{logger:o}=r,i=r.env===void 0?"":` --env ${r.env}`;let a;try{a=await(r.secretLister??ce)({cwd:e,env:r.env,temporary:r.temporary})}catch{return}if(!a.ok)return;const s=new Set(a.names),d=(await Te(e)).filter(l=>!s.has(l));if(d.length===0)return;if(!t)return`missing required secret(s) on the deploy target: ${d.join(", ")}. Set them with \`wrangler secret put <KEY>${i}\` (or \`lunora env generate --set\` then \`lunora env push --yes${r.env===void 0?"":" --prod"}\`), then re-deploy.`;for(const l of d.filter(p=>!j(p)))o.warn(`required secret ${l} is not set on the target — set it with: wrangler secret put ${l}${i}`);const c=d.filter(l=>j(l));if(c.length!==0){if(await(r.secretConfirm??ie())(`${String(c.length)} required secret(s) not set on the target (${c.join(", ")}). Generate strong values and push them now?`)){await Ue(e,r,c,n);return}o.warn(`${String(c.length)} required secret(s) not set on the target: ${c.join(", ")}. Generate + push with \`lunora env generate --set\` then \`lunora env push --yes${r.env===void 0?"":" --prod"}\`.`)}},Ce=async(e,r)=>{const t=new G({skipAddingFilesFromTsConfig:!0}),n=m(r,"lunora");let o;try{o=E(t,n)}catch(i){const a=i instanceof Error?i.message:String(i);return e.logger.warn(`--migrate: could not discover migrations (${a}); skipping`),0}if(o.length===0)return e.logger.info("--migrate: no data migrations declared in lunora/"),0;e.logger.info(`--migrate: running ${String(o.length)} migration(s) against deployed worker`);for(const i of o){e.logger.info(`--migrate: up "${i.id}" (table "${i.table}")`);const a={cwd:r,fetchImpl:e.fetchImpl,id:i.id,logger:e.logger,prod:!0,subcommand:"up",token:e.migrateToken,url:e.migrateUrl,yes:e.migrateYes===!0},s=await le(a);if(s.code!==0)return e.logger.error(`--migrate: migration "${i.id}" failed — see output above`),s.code;e.logger.success(`--migrate: "${i.id}" applied`)}return 0},Ie=e=>{if(!(!e.migrate||e.dryRun||e.preview)){if(e.migrateUrl===void 0){const r="--migrate requires --migrate-url <https://your-worker> — the deploy target URL is not captured automatically, refusing to default to localhost";return e.logger.error(r),r}if(e.migrateYes!==!0){const r="--migrate runs production data migrations after deploy. Re-run with --migrate-yes to confirm.";return e.logger.error(r),r}if((e.migrateToken??process.env.LUNORA_ADMIN_TOKEN)===void 0||(e.migrateToken??process.env.LUNORA_ADMIN_TOKEN)===""){const r="admin token required for --migrate — pass --migrate-token or set LUNORA_ADMIN_TOKEN";return e.logger.error(r),r}}},Le=(e,r,t,n,o)=>{let i;r?(i=new V({name:"dots"}),i.start("running codegen")):t.info("running codegen");try{const a=_({apiSpec:n,projectRoot:e,target:o});return i?.succeed("codegen complete"),i||t.success("codegen complete"),{result:a}}catch(a){i?.failed("codegen failed");const s=a instanceof Error?a.message:String(a);return t.error(`codegen failed: ${s}`),{error:`codegen failed: ${s}`}}},_e=(e,r)=>{const t=Se(e);if(t===void 0)return;const n=`deploy blocked: the "${t}" D1 binding has a placeholder database_id ("${L}"). Run \`wrangler d1 create <name>\` to create the database, then replace the placeholder in wrangler.jsonc with the real id before deploying.`;return r.error(n),n},Ee=(e,r)=>{const t=D(e);if(!t)return;const{parsed:n}=x(t),o=n?.vars;if(!o)return;const i=he.filter(s=>typeof o[s]=="string"&&we(o[s]));if(i.length===0)return;const a=`deploy blocked: ${i.join(", ")} in wrangler.jsonc point at localhost. A deployed Worker can't reach a loopback address, so this silently breaks scheduled-job dispatch / auth callbacks. Set each to the deployed worker's public URL (or move it to a secret with \`wrangler secret put\`) before deploying.`;return r.error(a),a},Pe=async(e,r)=>{const{info:t}=K(r,"lunora"),n=t?.vectorMetadata??[];if(n.length===0)return;const o=[];for(const a of n){const s=se(a.kind);if(s===void 0){e.logger.warn(`vector index "${a.index}" declares metadata "${a.property}", whose column type cannot be filtered on in Vectorize — it is stored with each vector but no filter will match it.`);continue}o.push({index:a.index,property:a.property,type:s})}if(o.length===0)return;const i=(await ae({cwd:r,entries:o,exec:v(y(r),"wrangler",[]),logger:e.logger,spawner:e.spawner??b})).filter(a=>a.status!=="failed").length;i>0&&e.logger.success(`vectorize metadata indexes ready: ${String(i)}/${String(o.length)}`)},Oe=async(e,r,t,n,o)=>{if(await Pe(e,r),e.migrate){const i=await Ce(e,r);return i===0&&o?.(),{code:i,descriptor:t,validation:n}}return o?.(),{code:0,descriptor:t,validation:n}},We=async(e,r)=>{const t=_e(e,r.logger);if(t!==void 0)return t;const n=Ee(e,r.logger);if(n!==void 0)return n;const o=ke(e,r.logger);if(o!==void 0)return o;const i=ye(e,r.logger,r.dockerAvailable??X);return i!==void 0?i:Re(e,r)},Be=(e,r,t)=>{const n=be(e);n!==void 0&&r.logger.info(`class-B composition: deploying ${n} (overrides wrangler main)`),r.temporary&&r.logger.info("temporary account: deploying to a short-lived Cloudflare account (~60min); wrangler will print a claim URL"),r.dryRun&&r.logger.info("dry run: validating + bundling without publishing"),r.outDir!==void 0&&r.logger.info(`build artifact: emitting bundle to ${r.outDir}`);const o=R(t),i={dryRun:r.dryRun,entry:n,environment:r.env,outDir:r.outDir,preview:r.preview,temporary:r.temporary};if(o.toolchain===void 0)throw new Error(`deploy target "${o.id}" has no command-line toolchain`);return o.toolchain.deploy(i)},Ke=(e,r)=>{if(e.problems.length===0)return!1;r.error("wrangler.jsonc validation failed:");for(const t of e.problems)r.error(` - ${t}`);return!0},Me=async e=>{const r=e.cwd??process.cwd(),t=$e(e),n=J(r,e.target);if(n.target===void 0){const g=n.error??"unknown deploy target";return e.logger.error(g),{code:1,descriptor:void 0,error:g,validation:{problems:[],wranglerPath:void 0}}}const{target:o}=n;let i;if(!e.skipCodegen){const g=Le(r,t,e.logger,e.apiSpec,o);if(g.error!==void 0)return{code:1,descriptor:void 0,error:g.error,validation:{problems:[],wranglerPath:void 0}};i=g.result}let a;if(i!==void 0){const g=ne({allowDrift:e.allowSchemaDrift===!0,codegen:i,logger:e.logger,updateBaseline:e.updateSchemaBaseline===!0});if(g.blocked)return{code:1,descriptor:void 0,error:"schema drift gate blocked deploy",schemaDrift:{blocked:!0,reason:g.reason},validation:{problems:[],wranglerPath:void 0}};a=g.rebless}await xe(r,e.logger,i?.cronTriggers,o);const s=Ie(e);if(s!==void 0)return{code:1,descriptor:void 0,error:s,validation:{problems:[],wranglerPath:void 0}};const d=await We(r,e);if(d!==void 0)return{code:1,descriptor:void 0,error:d,validation:{problems:[],wranglerPath:void 0}};const c=M({projectRoot:r});if(Ke(c,e.logger))return{code:1,descriptor:void 0,error:"wrangler validation failed",validation:c};Ne(r,e.logger);const l=await Ae(r,e,t,o);if(l!==void 0)return e.logger.error(l),{code:1,descriptor:void 0,error:l,validation:c};const p=!w(e.format)&&e.dryRun!==!0&&e.preview!==!0&&S(r)===void 0,f=Be(r,e,o),N=v(y(r),f.tool,f.args),u={args:N.args,captureStdout:p,command:N.command,cwd:r,stdoutToStderr:w(e.format)};e.logger.info(`deploying via ${u.command} ${u.args.join(" ")}`);const k=await(e.spawner??b)(u);return k.code!==0?{code:k.code,descriptor:u,validation:c}:e.dryRun?{code:0,descriptor:u,validation:c}:e.preview?{code:0,descriptor:u,validation:c}:(pe({cwd:r,env:e.env,logger:e.logger,output:k.stdout}),Oe(e,r,u,c,a))},qe=async e=>{const r=Z("deploy",e.format);if(r!==void 0)return e.logger.error(r),{code:1,descriptor:void 0,error:r,validation:{problems:[],wranglerPath:void 0}};const t=await Me({...e,logger:re(e.format,e.logger)});return w(e.format)?(ee(t),t):(t.code===0&&e.dryRun!==!0&&e.preview!==!0?me({cwd:e.cwd??process.cwd(),env:e.env,logger:e.logger,migrated:e.migrate===!0}):t.code===0&&e.preview===!0&&e.logger.success("preview version uploaded — see the preview URL in the wrangler output above"),t)},ur=H(async({cwd:e,logger:r,options:t})=>({code:(await qe({allowSchemaDrift:t.allowSchemaDrift===!0,apiSpec:z(t.apiSpec),cwd:e,dryRun:t.dryRun===!0,env:t.env,format:t.format,logger:r,migrate:t.migrate===!0,migrateToken:t.migrateToken,migrateUrl:oe({cwd:e,url:t.migrateUrl}),migrateYes:t.migrateYes===!0,preview:t.preview===!0,skipCodegen:t.prebuilt===!0,target:t.target,temporary:t.temporary===!0,updateSchemaBaseline:t.updateSchemaBaseline===!0})).code}));export{ur as execute,qe as runDeployCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as h,mkdirSync as L,writeFileSync as m,readFileSync as b,readdirSync as X,rmSync as I,mkdtempSync as Y,lstatSync as Me,cpSync as W,renameSync as Le}from"node:fs";import{tmpdir as Z}from"node:os";import{detectFramework as Se,isInteractive as g,LUNA_ART as Ae,LUNA_NAME as Ne,LUNA_SIGNOFF as Ie,paintAnswer as _e,BADGES as f}from"@lunora/config";import{walkSync as Re}from"@visulima/fs";import{join as p,dirname as $,basename as S,resolve as B,relative as Te}from"@visulima/path";import{downloadTemplate as ee}from"giget";import{modify as Oe,applyEdits as je}from"jsonc-parser";import{join as E,dirname as Be}from"node:path";import{i as Ee}from"../packem_shared/command-Bjv4VmYA.mjs";import{P as te,t as Pe,d as De,k as ze}from"../packem_shared/detect-package-manager-B2eIuAiP.mjs";import Ue from"magic-string";import{Project as ae,SyntaxKind as v}from"ts-morph";import{P}from"../packem_shared/prompt-cancelled-C8Sj7OqI.mjs";import{P as re,g as oe,b as Ve,L as se,
|
|
1
|
+
import{existsSync as h,mkdirSync as L,writeFileSync as m,readFileSync as b,readdirSync as X,rmSync as I,mkdtempSync as Y,lstatSync as Me,cpSync as W,renameSync as Le}from"node:fs";import{tmpdir as Z}from"node:os";import{detectFramework as Se,isInteractive as g,LUNA_ART as Ae,LUNA_NAME as Ne,LUNA_SIGNOFF as Ie,paintAnswer as _e,BADGES as f}from"@lunora/config";import{walkSync as Re}from"@visulima/fs";import{join as p,dirname as $,basename as S,resolve as B,relative as Te}from"@visulima/path";import{downloadTemplate as ee}from"giget";import{modify as Oe,applyEdits as je}from"jsonc-parser";import{join as E,dirname as Be}from"node:path";import{i as Ee}from"../packem_shared/command-Bjv4VmYA.mjs";import{P as te,t as Pe,d as De,k as ze}from"../packem_shared/detect-package-manager-B2eIuAiP.mjs";import Ue from"magic-string";import{Project as ae,SyntaxKind as v}from"ts-morph";import{P}from"../packem_shared/prompt-cancelled-C8Sj7OqI.mjs";import{P as re,g as oe,b as Ve,L as se,k as He}from"../packem_shared/commands-C5pu77HK.mjs";import{defaultSpawner as ie}from"../packem_shared/createRecordingSpawner-ByIqBepG.mjs";import{Y as We,h as qe,M as Fe,C as ne,U as Ke,i as le,X as ce,B as D,H as Je,W as Qe,Q as de,I as Ge,t as Xe}from"../packem_shared/tui-prompts-CCt3jm1k.mjs";import{l as pe,u as Ye,p as Ze,b as et,a as tt,m as at,n as rt,f as ue,q as he,h as ot}from"../packem_shared/storage-BazhWFmM.mjs";import{logStep as q}from"../packem_shared/createLogger--C3x1FNE.mjs";import st from"node:dns/promises";const it=`name: Deploy
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{existsSync as m,mkdirSync as S,writeFileSync as h,mkdtempSync as C,rmSync as I,readFileSync as k}from"node:fs";import{tmpdir as A}from"node:os";import{discoverSchema as T,discoverMigrations as N}from"@lunora/codegen";import{isInteractive as M,promptSelect as z,promptText as E}from"@lunora/config";import{LunoraError as $}from"@lunora/errors";import{join as c}from"@visulima/path";import{Project as w}from"ts-morph";import{u as F}from"../packem_shared/admin-url-Ca-KI3d_.mjs";import{i as O}from"../packem_shared/command-Bjv4VmYA.mjs";import{diffSnapshots as R,renderMigrationFile as q}from"../packem_shared/diffSnapshots-9bDd9nOK.mjs";import{s as D}from"../packem_shared/resolve-target-vxaXHmvg.mjs";import L from"../packem_shared/schemaIrToSnapshot-Clwd2A8e.mjs";import{runExportCommand as j,runImportCommand as B}from"../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
2
|
-
`,"utf8"),r.logger.success(`wrote ${g}`),l.unsupported.length>0&&r.logger.warn(`${String(l.unsupported.length)} unsupported diff(s) — see the comment block in ${y} and write the SQL manually`),{code:0,empty:!1,migrationFile:g}},
|
|
1
|
+
import{existsSync as m,mkdirSync as S,writeFileSync as h,mkdtempSync as C,rmSync as I,readFileSync as k}from"node:fs";import{tmpdir as A}from"node:os";import{discoverSchema as T,discoverMigrations as N}from"@lunora/codegen";import{isInteractive as M,promptSelect as z,promptText as E}from"@lunora/config";import{LunoraError as $}from"@lunora/errors";import{join as c}from"@visulima/path";import{Project as w}from"ts-morph";import{u as F}from"../packem_shared/admin-url-Ca-KI3d_.mjs";import{i as O}from"../packem_shared/command-Bjv4VmYA.mjs";import{diffSnapshots as R,renderMigrationFile as q}from"../packem_shared/diffSnapshots-9bDd9nOK.mjs";import{s as D}from"../packem_shared/resolve-target-vxaXHmvg.mjs";import L from"../packem_shared/schemaIrToSnapshot-Clwd2A8e.mjs";import{runExportCommand as j,runImportCommand as B}from"../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-CEOt386P.mjs";const H=".snapshot.json",x=/[^\da-z]+/gu,U=(r,e)=>{let o=0,t=r.length;for(;o<t&&r[o]===e;)o+=1;for(;t>o&&r[t-1]===e;)t-=1;return r.slice(o,t)},J=r=>{const e=U(r.toLowerCase().replaceAll(x,"_"),"_");return e===""?"auto":e},P=r=>{const e=(o,t=2)=>o.toString().padStart(t,"0");return`${String(r.getUTCFullYear())}${e(r.getUTCMonth()+1)}${e(r.getUTCDate())}${e(r.getUTCHours())}${e(r.getUTCMinutes())}${e(r.getUTCSeconds())}`},Z=r=>{if(m(r))try{const e=k(r,"utf8"),o=JSON.parse(e);if(o.version!==1)throw new $("INTERNAL",`unsupported snapshot version: ${o.version}`);return o}catch(e){const o=e instanceof Error?e.message:String(e);throw new $("INTERNAL",`failed to read ${r}: ${o}`,{cause:e})}},G=r=>{const e=r.cwd??process.cwd(),o=c(e,"lunora","schema.ts");if(!m(o))return r.logger.error(`schema not found: ${o} — run \`vis generate lunora-table --name=<name>\` to create one`),{code:1,empty:!0,migrationFile:""};const t=new w({skipAddingFilesFromTsConfig:!0}),n=T(t,o),a=L(n),i=c(e,"lunora","migrations"),s=c(i,H);let d;try{d=Z(s)}catch(p){return r.logger.error(p instanceof Error?p.message:String(p)),{code:1,empty:!0,migrationFile:""}}const l=R(d,a);if(l.empty)return r.logger.info("no schema changes detected — snapshot is already up to date"),{code:0,empty:!0,migrationFile:""};const u=(r.now??(()=>new Date))(),b=J(r.name??"auto"),y=`${P(u)}_${b}.sql`,g=c(i,y);S(i,{recursive:!0});const _=q(b,l,u.toISOString());return h(g,_,"utf8"),h(s,`${JSON.stringify(a,void 0,4)}
|
|
2
|
+
`,"utf8"),r.logger.success(`wrote ${g}`),l.unsupported.length>0&&r.logger.warn(`${String(l.unsupported.length)} unsupported diff(s) — see the comment block in ${y} and write the SQL manually`),{code:0,empty:!1,migrationFile:g}},K="migrations.ts",v=/^[A-Za-z_]\w*$/u,Q=new Set(["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]),f='import { defineMigration } from "@lunora/server";',V="__lunora_admin__:runMigration",W="__lunora_admin__:migrationStatus",Y="/_lunora/migrate",X=r=>U(r.trim().toLowerCase().replaceAll(x,"-"),"-"),rr=r=>r.split("-").filter(e=>e.length>0).map((e,o)=>o===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(""),er=r=>{const e=c(r,"lunora","schema.ts");if(!m(e))return[];try{const o=new w({skipAddingFilesFromTsConfig:!0});return T(o,e).tables.map(t=>t.name)}catch{return[]}},tr=async r=>r.length>0?z("Which table does this migration iterate?",r.map(e=>({label:e,value:e}))):E("Target table for the migration: "),or=async(r,e)=>{if(e.table!==void 0)return e.table;const o=e.promptTable??(M()?tr:void 0);if(o===void 0){e.logger.error("migrate create requires a target table when not running interactively — re-run with --table <table>");return}const t=(await o(er(r)))?.trim();if(t===void 0||t===""){e.logger.error("no table selected — re-run with --table <table>");return}return t},nr=async r=>{const e=r.cwd??process.cwd(),o=X(r.name);if(o==="")return r.logger.error(`invalid migration name: "${r.name}" — must contain at least one alphanumeric character`),{code:1,file:""};const t=rr(o);if(!v.test(t)||Q.has(t))return r.logger.error(`invalid migration name: "${r.name}" derives the export \`${t}\`, which is not a valid identifier — pick a name that starts with a letter and isn't a reserved word`),{code:1,file:""};const n=await or(e,r);if(n===void 0)return{code:1,file:""};if(!v.test(n))return r.logger.error(`invalid table: "${n}" — must be a valid identifier ([A-Za-z_][A-Za-z0-9_]*)`),{code:1,file:""};const a=c(e,"lunora"),i=c(a,K);let s=m(i)?k(i,"utf8"):"";if(s.includes(`id: "${o}"`)||new RegExp(String.raw`\bexport const ${t}\b`,"u").test(s))return r.logger.error(`a migration with id "${o}" (export \`${t}\`) already exists in ${i}`),{code:1,file:""};s.trim()===""?s=`${f}
|
|
3
3
|
`:s.includes(f)||(s=`${f}
|
|
4
4
|
${s}`);const d=`export const ${t} = defineMigration({
|
|
5
5
|
id: "${o}",
|
|
@@ -8,4 +8,4 @@ ${s}`);const d=`export const ${t} = defineMigration({
|
|
|
8
8
|
});`;return S(a,{recursive:!0}),h(i,`${s.trimEnd()}
|
|
9
9
|
|
|
10
10
|
${d}
|
|
11
|
-
`,"utf8"),r.logger.success(`scaffolded migration "${o}" in ${i}`),{code:0,file:i}},ir=(r,e)=>{const o=new w({skipAddingFilesFromTsConfig:!0});return N(o,c(r,"lunora")).find(t=>t.id===e)?.table},ar=(r,e)=>{let o;try{o=ir(r,e.id)}catch(t){e.logger.error(t instanceof Error?t.message:String(t));return}if(o===void 0){e.logger.error(`migration "${e.id}" not found under lunora/ — declare it with defineMigration({ id: "${e.id}", ... })`);return}if(o===""){e.logger.error(`migration "${e.id}" must declare \`table\` as a static string literal`);return}return o},sr=r=>{const e=r.cwd??process.cwd();if(r.prod&&r.url===void 0){r.logger.error("--prod requires an explicit --url (refusing to migrate the implicit localhost worker)");return}if(r.prod&&(r.subcommand==="up"||r.subcommand==="down")&&!r.yes){r.logger.error(`migrate ${r.subcommand} --prod runs the migration against production. Re-run with --yes to confirm.`);return}const o=r.token??process.env.LUNORA_ADMIN_TOKEN;if(!o){r.logger.error("admin token required — pass --token or set LUNORA_ADMIN_TOKEN");return}const t=ar(e,r);if(t===void 0)return;const n=F(r.url,r.logger,r.cwd);if(n===void 0)return;const a=r.fetchImpl??globalThis.fetch;if(typeof a!="function")throw new TypeError("no fetch implementation available — pass fetchImpl or run on Node >= 18");return{fetchImpl:a,requestUrl:`${n}${
|
|
11
|
+
`,"utf8"),r.logger.success(`scaffolded migration "${o}" in ${i}`),{code:0,file:i}},ir=(r,e)=>{const o=new w({skipAddingFilesFromTsConfig:!0});return N(o,c(r,"lunora")).find(t=>t.id===e)?.table},ar=(r,e)=>{let o;try{o=ir(r,e.id)}catch(t){e.logger.error(t instanceof Error?t.message:String(t));return}if(o===void 0){e.logger.error(`migration "${e.id}" not found under lunora/ — declare it with defineMigration({ id: "${e.id}", ... })`);return}if(o===""){e.logger.error(`migration "${e.id}" must declare \`table\` as a static string literal`);return}return o},sr=r=>{const e=r.cwd??process.cwd();if(r.prod&&r.url===void 0){r.logger.error("--prod requires an explicit --url (refusing to migrate the implicit localhost worker)");return}if(r.prod&&(r.subcommand==="up"||r.subcommand==="down")&&!r.yes){r.logger.error(`migrate ${r.subcommand} --prod runs the migration against production. Re-run with --yes to confirm.`);return}const o=r.token??process.env.LUNORA_ADMIN_TOKEN;if(!o){r.logger.error("admin token required — pass --token or set LUNORA_ADMIN_TOKEN");return}const t=ar(e,r);if(t===void 0)return;const n=F(r.url,r.logger,r.cwd);if(n===void 0)return;const a=r.fetchImpl??globalThis.fetch;if(typeof a!="function")throw new TypeError("no fetch implementation available — pass fetchImpl or run on Node >= 18");return{fetchImpl:a,requestUrl:`${n}${Y}`,table:t,token:o}},cr=r=>{const e={id:r.id};return r.subcommand==="status"||(e.direction=r.subcommand,r.dryRun&&(e.dryRun=!0),r.batchSize!==void 0&&(e.batchSize=r.batchSize),r.maxBatches!==void 0&&(e.maxBatches=r.maxBatches)),e},dr=async r=>{const e=sr(r);if(e===void 0)return{body:void 0,code:1,requestUrl:""};const{fetchImpl:o,requestUrl:t,table:n,token:a}=e,i=r.subcommand==="status"?W:V,s=cr(r);r.logger.info(`POST ${t} -> ${r.subcommand} ${r.id} (table "${n}")`);const d=await o(t,{body:JSON.stringify({args:s,functionPath:i,table:n}),headers:{authorization:`Bearer ${a}`,"content-type":"application/json"},method:"POST"}),l=await d.text();let u;try{u=JSON.parse(l)}catch{u=l}return r.logger.info(JSON.stringify(u,void 0,2)),{body:u,code:d.ok?0:1,requestUrl:t}},lr=async r=>{const{logger:e}=r,o=r.fromUrl??r.toUrl,t=r.toUrl??r.fromUrl;if(o!==void 0&&o===t)return e.error("source and target are the same deployment — pass distinct --from-url and --to-url so the D1 export and Hyperdrive import don't run against one database"),{code:1};const n=r.out===void 0?C(c(A(),"lunora-d1ps-")):void 0,a=r.out??c(n,"dump.ndjson");try{e.info(`Exporting .global() data from the D1 source (${o??"http://localhost:8787"}) …`);const i=await j({fetchImpl:r.fetchImpl,logger:e,out:a,prod:r.prod,tables:r.tables,token:r.fromToken,url:o});if(i.code!==0)return{code:i.code};e.info(`Exported ${String(i.rows)} row(s) (${String(i.bytes)} bytes).`),e.info(`Importing into the Hyperdrive target (${t??"http://localhost:8787"}) …`);const s=await B({batchSize:r.batchSize,fetchImpl:r.fetchImpl,file:a,logger:e,prod:r.prod,token:r.toToken,url:t});return s.code!==0?{code:s.code}:(s.inserted===i.rows?e.info(`✓ Migrated ${String(i.rows)} row(s) — counts match. Verify your app reads from Hyperdrive, then decommission the D1 binding.`):e.warn(`Imported ${String(s.inserted)} of ${String(i.rows)} exported row(s) — the remainder likely already existed in the target (see conflicts above). Re-run after resolving, or inspect the dump with --out.`),{code:0})}finally{n!==void 0&&I(n,{force:!0,recursive:!0})}},Tr=O(({argument:r,cwd:e,logger:o,options:t})=>{const n=r[0];if(n==="generate")return G({cwd:e,logger:o,name:r[1]??t.name});if(n==="d1-to-hyperdrive")return lr({batchSize:t.batchSize,fromToken:t.fromToken??t.token,fromUrl:t.fromUrl??t.url,logger:o,out:t.out,prod:t.prod===!0,tables:t.tables,toToken:t.toToken??t.token,toUrl:t.toUrl??t.url});if(n==="create"){const a=r[1]??t.name;return a?nr({cwd:e,logger:o,name:a,table:t.table}):(o.error("migrate create requires a name. Usage: lunora migrate create <name> [--table <table>]"),{code:1})}if(n==="up"||n==="down"||n==="status"){const a=r[1]??t.name;return a?dr({batchSize:t.batchSize,cwd:e,dryRun:t.dryRun===!0,id:a,logger:o,maxBatches:t.steps,prod:t.prod===!0,subcommand:n,token:t.token,url:D({cwd:e,prod:t.prod===!0,url:t.url}),yes:t.yes===!0}):(o.error(`migrate ${n} requires a migration id. Usage: lunora migrate ${n} <id>`),{code:1})}return o.error(`unknown migrate subcommand: "${n??""}" — expected generate | create | up | down | status`),{code:1}});export{Tr as execute,nr as runMigrateCreateCommand,dr as runMigrateDataCommand,G as runMigrateGenerateCommand,lr as runMigrateToHyperdriveCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:fs";import"node:path";import"node:url";import"@lunora/errors";import"@visulima/cerebro";import"@visulima/cerebro/command/completion";import"@visulima/cerebro/command/version";import{s as M,t as N,e as O}from"./cli-BxL0WCh4.mjs";import"./createLogger--C3x1FNE.mjs";export{M as COMMANDS,N as VERSION,O as runCli};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createWriteStream as J,createReadStream as I}from"node:fs";import{unlink as A,stat as h,readdir as D}from"node:fs/promises";import{join as P}from"node:path";import{LunoraError as T}from"@lunora/errors";import{l as E}from"./admin-token-DV5A9T5b.mjs";import{u as j}from"./admin-url-Ca-KI3d_.mjs";const _="/_lunora/admin/export",R="/_lunora/admin/import",q=500,L=t=>{if(t===void 0)return;const r=t.split(",").map(o=>o.trim()).filter(o=>o.length>0);return r.length>0?r:void 0},N=async(t,r)=>{t.write(r)||await new Promise(o=>{t.once("drain",o)})},U=async(t,r)=>{const o=t.getReader(),e=new TextDecoder;let i=0,s=0,n="",c=!1;try{for(;!c;){const f=await o.read();if(c=f.done,f.value===void 0)continue;i+=f.value.length,n+=e.decode(f.value,{stream:!0});let l=n.indexOf(`
|
|
2
|
+
`);for(;l!==-1;){s+=1;const u=`${n.slice(0,l)}
|
|
3
|
+
`;await N(r,u),n=n.slice(l+1),l=n.indexOf(`
|
|
4
|
+
`)}}return n.length>0&&(s+=1,await N(r,`${n}
|
|
5
|
+
`)),{bytes:i,rows:s}}finally{o.releaseLock()}},C=async(t,r)=>{if(r!==void 0){t.destroy();try{await A(r)}catch{}}},X=async t=>{if(t.prod&&t.url===void 0)return t.logger.error("--prod requires an explicit --url (refusing to export from the implicit localhost worker)"),{bytes:0,code:1,rows:0};const r=j(t.url,t.logger,t.cwd);if(r===void 0)return{bytes:0,code:1,rows:0};const{token:o}=E({cwd:t.cwd??process.cwd(),token:t.token,url:r});if(!o)return t.logger.error("admin token required — pass --token, set LUNORA_ADMIN_TOKEN, or add it to .dev.vars (local targets only)"),{bytes:0,code:1,rows:0};const e=`${r}${_}`,i=L(t.tables),s=t.fetchImpl??globalThis.fetch;if(typeof s!="function")throw new TypeError("no fetch implementation available — pass fetchImpl or run on Node >= 18");t.logger.info(`POST ${e} -> export${i?` (tables: ${i.join(",")})`:""}`);const n=await s(e,{body:JSON.stringify(i?{tables:i}:{}),headers:{authorization:`Bearer ${o}`,"content-type":"application/json"},method:"POST"});if(!n.ok){const p=await n.text();return t.logger.error(`export failed: HTTP ${String(n.status)}: ${p}`),{bytes:0,code:1,rows:0}}if(!n.body)return t.logger.error("export response carried no body"),{bytes:0,code:1,rows:0};const c=t.out===void 0||t.out==="-"?void 0:t.out,f=c===void 0?process.stdout:J(c,{encoding:"utf8"});let l,u;try{({bytes:l,rows:u}=await U(n.body,f))}catch(p){throw await C(f,c),p}return c!==void 0&&(await new Promise((p,g)=>{f.end(y=>{y?g(y):p()})}),t.logger.success(`wrote ${String(u)} rows to ${c} (${String(l)} bytes)`)),{bytes:l,code:0,rows:u}},F=async t=>{if(t.prod&&t.url===void 0){t.logger.error("--prod requires an explicit --url (refusing to import to the implicit localhost worker)");return}if(t.prod&&t.yes!==!0){t.logger.error("import --prod bulk-writes production. Re-run with --yes to confirm.");return}const r=j(t.url,t.logger,t.cwd);if(r===void 0)return;const{token:o}=E({cwd:t.cwd??process.cwd(),token:t.token,url:r});if(!o){t.logger.error("admin token required — pass --token, set LUNORA_ADMIN_TOKEN, or add it to .dev.vars (local targets only)");return}try{const i=await h(t.file);if(!i.isFile()&&!i.isDirectory()){t.logger.error(`not a file or directory: ${t.file}`);return}}catch(i){const s=i instanceof Error?i.message:String(i);t.logger.error(`failed to stat ${t.file}: ${s}`);return}const e=t.fetchImpl??globalThis.fetch;if(typeof e!="function")throw new TypeError("no fetch implementation available — pass fetchImpl or run on Node >= 18");return{fetchImpl:e,requestUrl:`${r}${R}`,token:o}},k="_storage",z=async t=>{if(!(await h(t).catch(()=>{}))?.isDirectory())return;const r=[];for(const o of await D(t,{withFileTypes:!0})){if(!o.isDirectory())continue;const e=P(t,o.name,"documents.jsonl");(await h(e).catch(()=>{}))?.isFile()&&r.push({file:e,table:o.name})}return r.length>0?r.toSorted((o,e)=>o.table.localeCompare(e.table)):void 0};async function*B(t,r){let o="";for await(const i of I(t,{encoding:"utf8"})){o+=typeof i=="string"?i:i.toString("utf8");let s=o.indexOf(`
|
|
6
|
+
`);for(;s!==-1;){const n=o.slice(0,s).trim();o=o.slice(s+1),n.length>0&&(yield`${JSON.stringify({doc:JSON.parse(n),table:r})}
|
|
7
|
+
`),s=o.indexOf(`
|
|
8
|
+
`)}}const e=o.trim();e.length>0&&(yield`${JSON.stringify({doc:JSON.parse(e),table:r})}
|
|
9
|
+
`)}async function*H(t,r){for(const{file:o,table:e}of t){if(e===k){r.warn(`skipping "${k}" — those rows describe stored files. Upload the exported blobs to R2 and re-point the keys.`);continue}yield*B(o,e)}}const M=async t=>{const r=await z(t.file),o=await h(t.file);return r===void 0&&o.isDirectory()?(t.logger.error(`${t.file} is a directory but holds no <table>/documents.jsonl — expected a \`npx convex export --path <dir>\` dump, or pass an NDJSON file.`),{error:!0}):r&&t.table!==void 0?(t.logger.error("--table cannot be combined with a Convex export directory — each row's table comes from its source directory."),{error:!0}):{convexTables:r,error:!1}},Y=async t=>{const r=await F(t);if(r===void 0)return{body:void 0,code:1,inserted:0};const{fetchImpl:o,requestUrl:e,token:i}=r,s=t.batchSize??q,n=await M(t);if(n.error)return{body:void 0,code:1,inserted:0};const{convexTables:c}=n;t.logger.info(c?`POST ${e} -> import Convex export ${t.file} (${String(c.length)} tables)`:`POST ${e} -> import ${t.file}`);const f=c?H(c,t.logger):I(t.file,{encoding:"utf8"}),l={},u=[];let p=0,g="",y=[],v=0;const $=async()=>{if(y.length===0)return;const w=y.join(`
|
|
10
|
+
`);y=[];const d=await o(e,{body:w,headers:{authorization:`Bearer ${i}`,"content-type":"application/x-ndjson"},method:"POST"});if(!d.ok){const m=await d.text().catch(()=>"<no body>");throw new T("INTERNAL",`import batch failed (HTTP ${String(d.status)}): ${m}`)}const a=await d.json();if(a.inserted)for(const[m,b]of Object.entries(a.inserted))l[m]=(l[m]??0)+b;Array.isArray(a.errors)&&u.push(...a.errors),typeof a.conflicts=="number"&&(p+=a.conflicts)},S=w=>{const d=w.trim();if(d.length===0)return;if(v+=1,t.table===void 0){y.push(d);return}let a;try{a=JSON.parse(d)}catch(m){const b=m instanceof Error?m.message:String(m);throw new T("INTERNAL",`invalid JSON on line ${String(v)}: ${b}`,{cause:m})}y.push(JSON.stringify({doc:a,table:t.table}))};for await(const w of f){const d=typeof w=="string"?w:w.toString("utf8");g+=d;let a=g.indexOf(`
|
|
11
|
+
`);for(;a!==-1;)S(g.slice(0,a)),g=g.slice(a+1),a=g.indexOf(`
|
|
12
|
+
`),y.length>=s&&await $()}g.length>0&&S(g),await $();const x=Object.values(l).reduce((w,d)=>w+d,0),O={conflicts:p,errors:u,inserted:l};return t.logger.info(JSON.stringify(O,void 0,2)),t.logger.success(`imported ${String(x)} rows (${String(p)} conflicts, ${String(u.length)} errors)`),{body:O,code:u.length>0?1:0,inserted:x}};export{q as DEFAULT_IMPORT_BATCH_SIZE,X as runExportCommand,Y as runImportCommand};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{mkdirSync as O,readFileSync as b,lstatSync as R,writeFileSync as B}from"node:fs";import{join as c,dirname as h}from"node:path";import{fileURLToPath as A}from"node:url";import{resolveHint as D,isLunoraError as w,flattenHint as L,findSolutionByMessage as E}from"@lunora/errors";import{createCerebro as j}from"@visulima/cerebro";import C from"@visulima/cerebro/command/completion";import I from"@visulima/cerebro/command/version";import{p as l}from"./api-spec-BENwiyUa.mjs";import{g as s}from"./deploy-target-Dvr9vxpR.mjs";import{createLogger as k}from"./createLogger--C3x1FNE.mjs";import{VisulimaError as _,renderError as P}from"@visulima/error";import{homedir as T}from"node:os";const $={argument:{description:"Feature or registry item: ai | auth | email | storage | crons | presence | queue | workflow | flags | backup | …",name:"feature",type:String},description:"Add a feature or registry item (ai, auth, email, storage, crons, …) to the current Lunora project",examples:[["lunora add auth","Add authentication (asks which provider)"],["lunora add auth --provider clerk","Add Clerk auth without prompting"],["lunora add auth-ui","Add copy-in auth screens for your framework (auto-detected)"],["lunora add email","Add transactional email (Cloudflare Email Workers + dev mail catcher)"],["lunora add storage","Add the R2 storage registry item (asks for the bucket name)"],["lunora add storage --bucket my-app-uploads","Add storage with a bucket name, no prompt"],["lunora add crons","Add the scheduled-jobs registry item"],["lunora add storage --ref alpha","Add an item from the alpha branch's registry"]],group:"Project",loader:()=>import("../packem_chunks/handler.mjs").then(e=>({default:e.execute})),name:"add",options:[{description:"auth: provider to use without prompting (auth | clerk | auth0)",name:"provider",type:String},{description:"auth: D1 database name to use without prompting (lowercase alphanumeric + hyphens)",name:"db",type:String},{description:"storage: R2 bucket name to use without prompting (lowercase alphanumeric + hyphens)",name:"bucket",type:String},{description:"email: verified destination address to use without prompting",name:"mail-to",type:String},{description:"Skip prompts (auth provider, DB name, bucket name, mail destination) and use the defaults",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Output format: pretty (default) or json",name:"format",type:String}]},y="lunora.advisor.map.json",U={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/handler21.mjs").then(e=>({default:e.execute})),name:"advisor",options:[{description:"Show every procedure as a check matrix, not just the ones with findings",name:"all",type:Boolean},{description:`Compare against a committed map and fail on regression (default ${y})`,name:"baseline",type:String},{description:"Inspect a single procedure by `file#exportName`",name:"entry",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Exit non-zero when the global score is below this value (0-100)",name:"min-score",type:String},{description:`Where to write the map (default ${y})`,name:"out",type:String},{description:"Write the map artifact to disk (default true; use --no-write to skip)",name:"write",type:Boolean}]},M={description:"Run wrangler dry-run and report bundle size, top modules, and _generated files",examples:[["lunora analyze","Report the worker bundle size + heaviest modules"]],group:"Deploy",loader:()=>import("../packem_chunks/handler2.mjs").then(e=>({default:e.execute})),name:"analyze",options:[{description:"Emit a JSON report instead of human text",name:"json",type:Boolean}]},W={argument:{description:"create | list | restore <id|file> | pitr",name:"subcommand",type:String},description:"Managed snapshot backups (create | list | restore) plus native point-in-time recovery (pitr)",examples:[["lunora backup create","Snapshot every table to a backup file"],["lunora backup list","List recorded snapshots"],["lunora backup restore <id>","Restore a snapshot by id"],["lunora backup pitr --at 2026-06-01T00:00:00Z","Point-in-time recovery (≤30 days)"]],group:"Data",loader:()=>import("../packem_chunks/handler3.mjs").then(e=>({default:e.execute})),name:"backup",options:[{description:"Backup directory (default .lunora-backups)",name:"dir",type:String},{description:"Comma-separated table allowlist (create)",name:"tables",type:String},{description:"pitr: time to read/restore to (ISO or epoch-ms, ≤30 days)",name:"at",type:String},{description:"pitr --restore: explicit bookmark to restore to (wins over --at)",name:"bookmark",type:String},{description:"pitr: perform a restore instead of just reading the bookmark",name:"restore",type:Boolean},{description:"pitr --restore: restart the shard now so recovery applies immediately",name:"restart",type:Boolean},{description:"pitr: target shard key (default: root shard)",name:"shard",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Confirm a production pitr --restore (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}]},J={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"]],group:"Deploy",loader:()=>import("../packem_chunks/handler4.mjs").then(e=>({default:e.execute})),name:"build",options:[{description:`Which API spec(s) to emit: ${l} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Directory to write the bundled Worker to (default .lunora/build)",name:"out-dir",type:String},s]},K={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: ${l} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Don't fail on ERROR-level advisories (the gate defaults to on in CI, off locally)",name:"no-strict-advisories",type:Boolean},s]},q={argument:{description:"<build|push|images|list|info|delete> [args…]",name:"args",type:String},description:"Build/push container images and manage container instances (wraps wrangler containers)",examples:[["lunora containers build ./containers/transcoder --tag transcoder:v1","Build a container image with the local Docker engine"],["lunora containers build ./containers/transcoder --tag transcoder:v1 --push","Build and push to the Cloudflare Registry in one step"],["lunora containers push transcoder:v1","Push a locally-tagged image to the Cloudflare Registry"],["lunora containers images list","List images in your Cloudflare Registry"],["lunora containers images delete transcoder:v1","Delete an image to free registry storage"]],group:"Deploy",loader:()=>import("../packem_chunks/handler5.mjs").then(e=>({default:e.execute})),name:"containers",options:[{description:"build: push the image to the Cloudflare Registry after building",name:"push",type:Boolean},{description:"build: name:tag for the image (forwarded to wrangler --tag)",name:"tag",type:String},{description:"Cloudflare environment name",name:"env",type:String}]},F={description:"Codegen, validate wrangler, then wrangler deploy",examples:[["lunora deploy","Deploy to Cloudflare"],["lunora deploy --env production","Deploy to a named environment"],["lunora deploy --dry-run","Validate + bundle without publishing"],["lunora deploy --migrate","Deploy, then run pending data migrations"]],group:"Deploy",loader:()=>import("../packem_chunks/runDeployCommand.mjs").then(e=>({default:e.execute})),name:"deploy",options:[{description:"Override the schema-drift gate (deploy even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${l} (default openapi)`,name:"api-spec",type:String},{description:"Validate, bundle, and run pre-deploy gates without publishing (wrangler deploy --dry-run)",name:"dry-run",type:Boolean},{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"After 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:"Upload a preview version (wrangler versions upload) instead of going live — prints a preview URL; doesn't shift production traffic",name:"preview",type:Boolean},s,{description:"Deploy to a temporary Cloudflare account when unauthenticated (wrangler deploy --temporary; live ~60min, then claim or it's deleted). Wrangler errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},H={argument:{description:"list | inspect <version-id> | rollback [version-id] | promote <version-id>",name:"subcommand",type:String},description:"List deployments and roll back / promote / inspect Worker versions",examples:[["lunora deployments list","Show the 10 most recent deployments"],["lunora deployments inspect <version-id>","View a specific Worker version"],["lunora deployments rollback --yes","Roll back to the previous version"],["lunora deployments promote <version-id> --yes","Send 100% of traffic to a version"]],group:"Deploy",loader:()=>import("../packem_chunks/handler6.mjs").then(e=>({default:e.execute})),name:"deployments",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Display `list` output as JSON",name:"json",type:Boolean},{description:"Reason/description recorded with a rollback or promote",name:"message",type:String},{description:"Confirm a rollback or promote (required — these change live traffic)",name:"yes",type:Boolean}]},V={argument:{description:"Optional subcommand: stop (shut the running dev server down) | status (report it) | logs (print its captured output)",name:"args",type:String},description:"Run the dev stack: wrangler worker + studio + codegen watch",examples:[["lunora dev","Run the worker + studio + codegen watch"],["lunora dev --background","Run detached: blocks until ready, prints URL + PID, then returns"],["lunora dev stop","Stop the background/tracked dev server (idempotent)"],["lunora dev status","Report the running dev server (URL, PID, uptime)"],["lunora dev logs","Print the captured dev-server log (background runs)"],["lunora dev --json","Machine-readable JSON log lines (also LUNORA_LOG_JSON=1)"],["lunora dev --no-studio","Skip the embedded studio server"],["lunora dev --worker-port 8080","Use a custom wrangler dev port"],["lunora dev --remote","Proxy D1/KV/R2 to the deployed worker (also LUNORA_REMOTE=1)"]],group:"Develop",loader:()=>import("../packem_chunks/planDevCommand.mjs").then(e=>({default:e.execute})),name:"dev",options:[{description:`Which API spec(s) codegen emits: ${l} (default openapi)`,name:"api-spec",type:String},{description:"Studio server port (default 6173)",name:"port",type:Number},s,{description:"wrangler dev port (default 8787)",name:"worker-port",type:Number},{description:"Run the dev server as a managed background process (auto-enabled when an AI agent is detected; LUNORA_AGENT_MODE=0 disables)",name:"background",type:Boolean},{description:"Emit machine-readable JSON log lines (also LUNORA_LOG_JSON=1; auto-enabled for AI agents)",name:"json",type:Boolean},{description:"How many trailing lines `lunora dev logs` prints (default 100, 0 = all)",name:"lines",type:Number},{description:"Don't start the embedded studio server",name:"no-studio",type:Boolean},{description:"Don't spawn wrangler dev — an external task runner owns the worker; codegen watch + studio still run",name:"no-worker",type:Boolean},{description:"Don't watch + regenerate codegen",name:"no-codegen",type:Boolean},{description:"Proxy D1/KV/R2 bindings to the deployed worker (or set LUNORA_REMOTE=1)",name:"remote",type:Boolean}]},z={argument:{description:"Optional path under the docs site (e.g. addons/studio)",name:"section",type:String},description:"Open the Lunora docs in your browser (optional [section] path)",examples:[["lunora docs","Open the Lunora docs"],["lunora docs addons/studio","Open a specific docs section"]],group:"Project",loader:()=>import("../packem_chunks/handler7.mjs").then(e=>({default:e.execute})),name:"docs"},G={description:"Preflight the current Lunora project (wrangler bindings, placeholders, dev secrets)",examples:[["lunora doctor","Run the project preflight checks"]],group:"Project",loader:()=>import("../packem_chunks/handler8.mjs").then(e=>({default:e.execute})),name:"doctor",options:[]},Y={argument:{description:"list | get <KEY> | set <KEY> <VALUE> | unset <KEY> | generate [KEY] | push | diff | doctor",name:"subcommand",type:String},description:"Manage .dev.vars and sync secrets via wrangler (list | get | set | unset | generate | push | diff | doctor)",examples:[["lunora env list","List .dev.vars keys"],["lunora env set API_KEY secret","Set a local variable"],["lunora env generate","Generate strong values for the project's secrets (print KEY=value)"],["lunora env generate AUTH_SECRET --set","Generate one secret and write it to .dev.vars"],["lunora env push --yes","Upload secrets to Cloudflare"],["lunora env diff","Compare local .dev.vars keys against Cloudflare"]],group:"Data",loader:()=>import("../packem_chunks/handler9.mjs").then(e=>({default:e.execute})),name:"env",options:[{description:"Target production for `push` (passes --env production to wrangler)",name:"prod",type:Boolean},{description:"For `generate` — write the generated secrets into .dev.vars instead of printing them",name:"set",type:Boolean},{description:"Push secrets to a temporary-account deployment when unauthenticated (wrangler secret put --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Required for `push` — confirms uploading secrets to Cloudflare",name:"yes",type:Boolean}]},Q={argument:{description:"Optional path (alias for --out)",name:"path",type:String},description:"Stream NDJSON of every shard-local + global table from the worker",examples:[["lunora export --out backup.ndjson","Dump every table to an NDJSON file"],["lunora export --tables messages,users","Export only specific tables"]],group:"Data",loader:()=>import("../packem_chunks/handler10.mjs").then(e=>({default:e.execute})),name:"export",options:[{description:"Output file path (`-` for stdout, default)",name:"out",type:String},{description:"Comma-separated table allowlist",name:"tables",type:String},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String}]},X={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)"]],group:"Data",loader:()=>import("../packem_chunks/handler11.mjs").then(e=>({default:e.execute})),name:"import",options:[{description:"Wrap each bare doc as `{table:<name>,doc:...}`",name:"table",type:String},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"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}]},Z={description:"Print resolved project config: @lunora/* versions, wrangler summary, schema overview",examples:[["lunora info","Print resolved project config"],["lunora info --json","Emit a JSON snapshot"]],group:"Project",loader:()=>import("../packem_chunks/handler12.mjs").then(e=>({default:e.execute})),name:"info",options:[{description:"Emit a JSON snapshot instead of human text",name:"json",type:Boolean}]},ee={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 --ref alpha","Scaffold from the alpha branch's templates"],["lunora init --here","Add Lunora to the current project"],["lunora init my-app --ci github","Scaffold + add a GitHub Actions deploy pipeline"],["lunora init my-app --ci gitlab","Scaffold + add a GitLab CI deploy pipeline"]],group:"Project",loader:()=>import("../packem_chunks/runInitCommand.mjs").then(e=>({default:e.execute})),name:"init",options:[{alias:"t",description:"Bespoke template (standalone | astro | next | nuxt | sveltekit | tanstack-start-react | tanstack-start-solid). For an SPA use --vite react|vue|solid|svelte.",name:"template",type:String},{description:"Scaffold via the create-vite overlay for a framework (react | vue | solid | svelte | vanilla) — official create-vite base + Lunora layer",name:"vite",type:String},{description:"Local templates root to copy from (offline-friendly; expects <type>/ subdirs)",name:"from",type:String},{description:"Override the remote template source (e.g. gh:owner/repo/sub#ref)",name:"source",type:String},{description:"Fetch templates from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https:// (e.g. local file://)",name:"allow-unsafe-source",type:Boolean},{description:"Add Lunora to the current project: detect the framework, patch the config, scaffold lunora/, print per-framework wiring steps",name:"here",type:Boolean},{alias:"i",description:"After scaffolding, offer to add auth + email (defaults on when stdin is a TTY)",name:"interactive",type:Boolean},{alias:"y",description:"Skip the auth/email offer; scaffold only",name:"yes",type:Boolean},{description:"Also scaffold a CI deploy pipeline: github (.github/workflows/deploy.yml) or gitlab (.gitlab-ci.yml)",name:"ci",type:String},{description:"Add features non-interactively after scaffolding (comma-separated): ai | auth | backup | browser | cloudflare-access | crons | email | flags | hyperdrive | payment | presence | queue | storage | workflow",name:"add",type:String},{description:"Walk through every step (prompts + output) without writing files, installing, or running git",name:"dry-run",type:Boolean}]},te={description:"Report write-conflict hot-spots, error rates, and latency outliers from a running Worker",examples:[["lunora insights","Report against the local dev worker"],["lunora insights --shard channel:demo","Scope the report to one shard"],["lunora insights --json","Emit the raw report as JSON"],["lunora insights --prod --url https://app.example.com --token $LUNORA_ADMIN_TOKEN","Report against production"]],group:"Develop",loader:()=>import("../packem_chunks/handler13.mjs").then(e=>({default:e.execute})),name:"insights",options:[{description:"Explicit shard key (defaults to the root shard)",name:"shard",type:String},{description:"Max rows per section (default 10)",name:"limit",type:String},{description:"Emit a JSON report instead of human text",name:"json",type:Boolean},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (or LUNORA_ADMIN_TOKEN)",name:"token",type:String}]},re={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/handler23.mjs").then(e=>({default:e.execute})),name:"introspect",options:[{description:"Database connection string (default: $DATABASE_URL)",name:"url",type:String},{description:"Postgres schema (default `public`) or MySQL database name",name:"schema",type:String},{description:"Comma-separated table allow-list (default: every base table)",name:"tables",type:String},{description:"Also emit list/get procedure modules per table (default true; --no-procedures to skip)",name:"procedures",type:Boolean},{description:"Overwrite files that already exist",name:"force",type:Boolean},{description:"Print what would be written without writing it",name:"dry-run",type:Boolean}]},oe={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/handler14.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}]},ne={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/handler22.mjs").then(e=>({default:e.execute})),name:"logs",options:[{description:"Cloudflare environment name",name:"env",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Substring filter on log messages",name:"search",type:String},{description:"Filter by invocation status: ok, error, or canceled",name:"status",type:String},s,{description:"Tail a temporary-account deployment when unauthenticated (wrangler tail --temporary). Errors if you're already authenticated.",name:"temporary",type:Boolean},{description:"Read the durable log archive (pipelineLogSink → R2) via R2 SQL instead of tailing live",name:"durable",type:Boolean},{description:"durable: Iceberg table the Pipeline writes to (required with --durable)",name:"table",type:String},{description:"durable: Iceberg namespace (R2 Data Catalog database) the table lives in",name:"namespace",type:String},{description:"durable: lower time bound (epoch-millis or ISO 8601), inclusive",name:"since",type:String},{description:"durable: upper time bound (epoch-millis or ISO 8601), inclusive",name:"until",type:String},{description:"durable: exact severity filter (trace|debug|log|info|warn|error|fatal)",name:"level",type:String},{description:"durable: severity floor — this level and every more-severe one",name:"min-level",type:String},{description:"durable: keep function paths starting with this prefix (LIKE 'prefix%')",name:"function-prefix",type:String},{description:"durable: trace-id filter",name:"trace-id",type:String},{description:"durable: shard-key filter",name:"shard-key",type:String},{description:"durable: user-id filter",name:"user-id",type:String},{description:"durable: max rows (clamped to 1–10000; default 500)",name:"limit",type:String},{description:"durable: resume after a prior page — the opaque cursor token printed by the previous page (bare epoch-millis also accepted for back-compat)",name:"cursor",type:String},{description:"durable: emit one JSON object per line instead of a table",name:"ndjson",type:Boolean}]},ae={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"]],group:"Develop",loader:()=>import("../packem_chunks/handler24.mjs").then(e=>({default:e.execute})),name:"mcp",options:[{description:"install: replace entries that already exist",name:"force",type:Boolean},{description:"install: list the supported clients and their config files",name:"list",type:Boolean},{description:"install/uninstall: print what would change instead of writing it",name:"print",type:Boolean},{description:"install/uninstall: only the hosted documentation server",name:"docs-only",type:Boolean},{description:"install/uninstall: only this project's local server",name:"local-only",type:Boolean},{description:"install/uninstall: the machine-wide config (install default: docs server global, local server per-project)",name:"global",type:Boolean},{description:"install/uninstall: this project's config instead of the machine-wide one",name:"project",type:Boolean},{description:"serve: also expose the mutation/action tools (default: read-only)",name:"allow-writes",type:Boolean},{description:"serve: skip the documentation tools",name:"no-docs",type:Boolean},{description:"Docs site origin backing the documentation tools (default https://lunora.sh)",name:"docs-url",type:String},{description:"serve: deployment URL to expose (default: the running dev server)",name:"url",type:String},{description:"serve: bearer token (default: LUNORA_ADMIN_TOKEN from the environment or .dev.vars)",name:"token",type:String}]},ie={argument:{description:"generate | create | up | down | status | d1-to-hyperdrive [name|id]",name:"subcommand",type:String},description:"Schema (generate), online data (create | up | down | status), and backend (d1-to-hyperdrive) migrations",examples:[["lunora migrate generate","Diff lunora/schema.ts and emit a SQL migration"],["lunora migrate create add_users_email","Scaffold a data migration"],["lunora migrate up backfill-names","Run a data migration across shards"],["lunora migrate status backfill-names","Report a migration's per-shard status"],["lunora migrate d1-to-hyperdrive --from-url https://old --to-url https://new","Copy .global() data from D1 to Hyperdrive"]],group:"Data",loader:()=>import("../packem_chunks/runMigrateGenerateCommand.mjs").then(e=>({default:e.execute})),name:"migrate",options:[{description:"Migration name slug (e.g. add_users_email)",name:"name",type:String},{description:"Target table for `create` (prompted for interactively when omitted)",name:"table",type:String},{description:"Preview a data migration without rewriting rows",name:"dry-run",type:Boolean},{description:"Rows per batch for a data migration",name:"batch-size",type:Number},{description:"Cap batches processed this run (maps to the runner's maxBatches)",name:"steps",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Required with --prod for up/down — confirms running against production",name:"yes",type:Boolean},{description:"d1-to-hyperdrive: source (D1) worker URL (defaults to --url)",name:"from-url",type:String},{description:"d1-to-hyperdrive: source admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"from-token",type:String},{description:"d1-to-hyperdrive: target (Hyperdrive) worker URL (defaults to --url)",name:"to-url",type:String},{description:"d1-to-hyperdrive: target admin token (defaults to --token / LUNORA_ADMIN_TOKEN)",name:"to-token",type:String},{description:"d1-to-hyperdrive: comma-separated .global() tables to move (default: all global tables)",name:"tables",type:String},{description:"d1-to-hyperdrive: keep the intermediate NDJSON dump at this path",name:"out",type:String}]},se={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/handler15.mjs").then(e=>({default:e.execute})),name:"prepare",options:[{description:"Override the schema-drift gate (proceed even with breaking schema drift and no migration)",name:"allow-schema-drift",type:Boolean},{description:`Which API spec(s) to emit: ${l} (default openapi)`,name:"api-spec",type:String},s,{description:"Re-bless the committed schema baseline (lunora/.lunora-schema.json) with the current shape",name:"update-schema-baseline",type:Boolean}]},le={argument:{description:"<add|list|view|build> [item names…]",name:"args",type:String},description:"Component registry: add/list/view items, or build the catalog",examples:[["lunora registry list","List available registry items"],["lunora registry add presence","Scaffold a registry item into lunora/"],["lunora registry build --check","Verify the committed catalog is current"]],group:"Project",loader:()=>import("../packem_chunks/handler16.mjs").then(e=>({default:e.execute})),name:"registry",options:[{description:"add: print the plan and stop without writing",name:"dry-run",type:Boolean},{description:"add: preview the file changes (content diff) and write nothing",name:"diff",type:Boolean},{description:"add: force-overwrite existing files (take the incoming copy)",name:"overwrite",type:Boolean},{description:"add: skip the package.json mutation confirmation prompt",name:"yes",type:Boolean},{description:"Local registry root (offline; expects <name>/ subdirs)",name:"from",type:String},{description:"Override the remote registry source base (e.g. gh:owner/repo/registry)",name:"source",type:String},{description:"Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",name:"ref",type:String},{description:"Permit --source values outside gh:/github:/https://",name:"allow-unsafe-source",type:Boolean},{description:"Emit JSON output (add plan / list)",name:"json",type:Boolean},{description:"build: output path for the catalog (default <root>/index.json)",name:"out",type:String},{description:"build: verify the index is current instead of rewriting it",name:"check",type:Boolean}]},pe={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}]},de={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/handler17.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}]},ce={argument:{description:"Function path (e.g. messages:send)",name:"functionPath",type:String},description:"Send a single RPC to a running Lunora Worker",examples:[[`lunora run messages:send --args '{"text":"hi"}'`,"Call a function with JSON args"],["lunora run messages:list --shard channel:demo","Target a specific shard"],["lunora run messages:list --as user_123","Run as an authenticated user (needed when the app gates on identity)"]],group:"Develop",loader:()=>import("../packem_chunks/runRpcCommand.mjs").then(e=>({default:e.execute})),name:"run",options:[{description:"JSON-encoded args object",name:"args",type:String},{description:"Run as this user id — dispatches through the admin-gated `runAs` op so identity-gated apps accept the call",name:"as",type:String},{description:`JSON-encoded extra identity claims to forge alongside --as (e.g. '{"org":"acme"}')`,name:"claims",type:String},{description:"Explicit shard key",name:"shard",type:String},{description:"Worker URL (defaults to the running dev server, else http://localhost:8787)",name:"url",type:String},{description:"Admin bearer for --as (prefer LUNORA_ADMIN_TOKEN or .dev.vars; --token is visible to other local processes via the process table)",name:"token",type:String}]},ue={description:"Generate deterministic fake data from lunora/schema.ts and bulk-insert it via the worker's admin endpoint",examples:[["lunora seed","Seed every table with the default row count"],["lunora seed --table posts --count 50","Seed 50 posts; FK-parent tables are seeded automatically"],["lunora seed --reset","Wipe local .wrangler/state, then seed from scratch"],["lunora seed --seed 7 --dry-run","Print the NDJSON for seed 7 without inserting"],["lunora seed --seed 7 --now 1785000000000","Byte-identical rows across runs (pins the clock too)"]],group:"Data",loader:()=>import("../packem_chunks/handler18.mjs").then(e=>({default:e.execute})),name:"seed",options:[{description:"Rows per table (default 10)",name:"count",type:Number},{description:"Seed only this table; its FK-parent tables are seeded automatically",name:"table",type:String},{description:"Deterministic seed — same value yields identical rows (default 0)",name:"seed",type:Number},{description:"Epoch-ms reference for time columns (createdAt, expiresAt, …). Pin it with --seed for byte-identical rows across runs; defaults to now",name:"now",type:Number},{description:"Print the generated NDJSON instead of inserting",name:"dry-run",type:Boolean},{description:"Wipe local .wrangler/state before seeding (local dev only)",name:"reset",type:Boolean},{description:"Rows per HTTP request (default 500)",name:"batch-size",type:Number},{description:"Target production — requires an explicit --url",name:"prod",type:Boolean},{description:"Worker URL (default http://localhost:8787)",name:"url",type:String},{description:"Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",name:"token",type:String},{description:"Skip the confirmation prompt when seeding a non-local/production target",name:"yes",type:Boolean}]},me={description:"Validate wrangler.jsonc + codegen dry-run + tsc --noEmit (no files written)",examples:[["lunora verify","Validate wrangler + codegen + tsc"],["lunora verify --no-typecheck","Skip the TypeScript type-check"],["lunora verify --health-url https://my-app.workers.dev","Also probe the deployment's /_lunora/health"]],group:"Deploy",loader:()=>import("../packem_chunks/handler19.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: ${l} (default openapi)`,name:"api-spec",type:String},{description:"Output format: pretty (default) or json",name:"format",type:String},{description:"Probe this deployment's /_lunora/health endpoint (off by default; keeps verify offline-safe)",name:"health-url",type:String},{description:"Skip the TypeScript type-check step",name:"no-typecheck",type:Boolean},s]},ge={description:"Open the Lunora studio in your browser (local dev by default, --remote for production)",examples:[["lunora view","Open the studio for local dev"],["lunora view --remote","Open the deployed studio"]],group:"Project",loader:()=>import("../packem_chunks/handler20.mjs").then(e=>({default:e.execute})),name:"view",options:[{description:"Open the deployed worker URL instead of localhost",name:"remote",type:Boolean}]},he={filterStacktrace:()=>!1,hideErrorCodeView:!0},ye=(e,t={})=>{const r=e instanceof Error?e.message:String(e),o=D(w(e)?{code:e.code,hint:e.hint,message:r}:r),n=new _({hint:o===void 0?void 0:L(o).split(`
|
|
2
|
+
`),message:t.reason===void 0?r:`${t.reason}: ${r}`,name:e instanceof Error&&e.name.length>0?e.name:"Error"});return n.stack="",P(n,he)},fe=(e,t)=>{const r=Array.from({length:t.length+1},(o,n)=>n);for(let o=1;o<=e.length;o+=1){let n=r[0]??0;r[0]=o;for(let a=1;a<=t.length;a+=1){const i=r[a]??0,p=e[o-1]===t[a-1]?0:1;r[a]=Math.min((r[a-1]??0)+1,i+1,n+p),n=i}}return r[t.length]??0},ve=(e,t)=>{let r,o=Number.POSITIVE_INFINITY;for(const a of t){const i=fe(e,a);i<o&&(o=i,r=a)}const n=Math.max(2,Math.ceil(e.length/3));return r!==void 0&&o<=n?r:void 0},be=e=>`https://registry.npmjs.org/@lunora/cli/${e}`,we=1440*60*1e3,ke=1500,Se="0.0.0",xe=/^v/u,Ne=new Set(["alpha","beta","next"]),u=e=>{const t=e.trim().replace(xe,""),r=t.indexOf("-");return r===-1?{core:t,prerelease:""}:{core:t.slice(0,r),prerelease:t.slice(r+1)}},f=e=>{const[t,r,o]=u(e).core.split(".").map(n=>{const a=Number.parseInt(n,10);return Number.isFinite(a)?a:0});return[t??0,r??0,o??0]},Oe=(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},Re=(e,t)=>{if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;const r=e.split("."),o=t.split(".");for(let n=0;n<Math.max(r.length,o.length);n+=1){const a=r[n],i=o[n];if(a===void 0||i===void 0)return a===void 0?-1:1;if(a!==i)return Oe(a,i)}return 0},Be=(e,t)=>{const r=f(e),o=f(t);for(let n=0;n<3;n+=1)if((r[n]??0)!==(o[n]??0))return(r[n]??0)>(o[n]??0)?1:-1;return Re(u(e).prerelease,u(t).prerelease)},Ae=e=>{const t=u(e).prerelease.split(".")[0]??"";return Ne.has(t)?t:"latest"},De=(e,t)=>Be(t,e)>0,Le=(e,t,r)=>t-e<r,Ee=(e,t,r="latest")=>`Update available for @lunora/cli: ${e} → ${t} — run \`pnpm add -D @lunora/cli@${r}\``,S=e=>c(e,"lunora-cli-update.json"),je=e=>{const t=e.XDG_CACHE_HOME&&e.XDG_CACHE_HOME.length>0?e.XDG_CACHE_HOME:c(T(),".cache"),r=c(t,"lunora");try{O(r,{mode:448,recursive:!0})}catch{}return r},Ce=e=>{try{const t=JSON.parse(b(S(e),"utf8"));if(t!==null&&typeof t=="object"){const{checkedAt:r,latest:o}=t;if(typeof o=="string"&&typeof r=="number"){const{tag:n}=t;return{checkedAt:r,latest:o,...typeof n=="string"?{tag:n}:{}}}}}catch{}},v=(e,t)=>{try{const r=S(e);try{if(R(r).isSymbolicLink())return}catch{}B(r,`${JSON.stringify(t)}
|
|
3
|
+
`,"utf8")}catch{}},Ie=async(e,t)=>{try{const r=await e(be(t),{signal:AbortSignal.timeout(ke)});if(!r.ok)return;const o=await r.json(),n=o!==null&&typeof o=="object"?o.version:void 0;return typeof n=="string"?n:void 0}catch{return}},_e=(e,t,r)=>e===Se||!r||t.CI!==void 0||t.LUNORA_NO_UPDATE_NOTIFIER!==void 0,Pe=async e=>{const t=e.env??process.env,r=e.isTTY??process.stdout.isTTY;if(_e(e.current,t,r))return;const o=e.cacheDir??je(t),n=(e.now??Date.now)(),a=e.ttlMs??we,i=Ae(e.current),p=Ce(o),N=p?.tag??"latest",m=p!==void 0&&N===i?p:void 0;let d=m?.latest;if(m===void 0||!Le(m.checkedAt,n,a)){const g=await Ie(e.fetchImpl??globalThis.fetch,i);g===void 0?v(o,{checkedAt:n,latest:e.current,tag:i}):(d=g,v(o,{checkedAt:n,latest:g,tag:i}))}d!==void 0&&De(e.current,d)&&e.logger.warn(Ee(e.current,d,i))},Te=["init","add","dev","codegen","build","deploy","containers","prepare","link","deployments","logs","run","insights","reset","migrate","export","import","seed","backup","verify","info","doctor","env","analyze","view","docs","registry","rules","mcp"],$e=8,Ue=()=>{try{let e=h(A(import.meta.url));for(let t=0;t<$e;t+=1){try{const o=JSON.parse(b(c(e,"package.json"),"utf8")),n=o!==null&&typeof o=="object"?o:void 0;if(n?.name==="@lunora/cli"&&typeof n.version=="string"&&n.version.length>0)return n.version}catch{}const r=h(e);if(r===e)break;e=r}}catch{}return"0.0.0"},x=Ue(),Me=[ee,$,V,K,U,J,F,q,se,oe,H,ne,ce,te,pe,ie,Q,X,ue,re,W,me,Z,G,Y,M,ge,z,le,de,ae],We=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:x});for(const o of Me)r.addCommand(o);return r.addCommand(I),r.addCommand(C),{cli:r,exitCode:t}},Je=/Command "(?<name>[^"]+)" not found/u,Ke=e=>{const t=k(),r=e instanceof Error?e.message:String(e),o=Je.exec(r);if(!o?.groups){w(e)||E(r)!==void 0?t.error(ye(e)):t.error(r);return}const n=o.groups.name??"",a=ve(n,Te);t.error(`Unknown command "${n}".${a===void 0?"":` Did you mean "${a}"?`}`),t.info("Run `lunora --help` to list commands, or `lunora docs` to open the documentation.")},rt=async(e={})=>{const{cli:t,exitCode:r}=We(e);try{await t.run({shouldExitProcess:!1})}catch(o){return Ke(o),1}return await Pe({current:x,logger:k()}),r.value};export{rt as e,y as o,Te as s,x as t};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{existsSync as p,readFileSync as g,writeFileSync as $,mkdirSync as j,mkdtempSync as oe,rmSync as O}from"node:fs";import{dirname as w,join as l,relative as L}from"@visulima/path";import{DEV_VARS_FILE as se,parseDevVariableEntries as ie}from"@lunora/config";import{modify as W,applyEdits as U,parse as ae}from"jsonc-parser";import{fileURLToPath as ce}from"node:url";import{LunoraError as y}from"@lunora/errors";import{i as ue}from"./tui-prompts-CCt3jm1k.mjs";import{collectCatalog as de,buildRegistryIndex as fe}from"./buildRegistryIndex-DwySASBu.mjs";import{findWranglerFile as le,readWranglerJsonc as pe}from"@lunora/config/cloudflare";import{insertSchemaExtension as ge}from"./insertSchemaExtension-DZReBZ4_.mjs";import{createHash as me}from"node:crypto";import{tmpdir as $e}from"node:os";import{downloadTemplate as he}from"giget";import ye from"./parseManifest-x3WsxKHz.mjs";const ve="alpha",z="main",we=new Set(["alpha","beta","next"]),be=/^[\w./@-]+$/,ke=e=>!e.includes("..")&&be.test(e),M=()=>{try{let e=w(ce(import.meta.url));for(let t=0;t<6;t+=1){const n=l(e,"package.json");if(p(n)){const o=JSON.parse(g(n,"utf8"));if(o.name==="@lunora/cli"&&typeof o.version=="string")return o.version}const r=w(e);if(r===e)break;e=r}}catch{}return"0.0.0"},V=e=>{if(e==="0.0.0")return ve;const t=e.split("+")[0]??e,n=t.indexOf("-");if(n!==-1){const[r]=t.slice(n+1).split(".");if(r!==void 0&&we.has(r))return r}return z},B=e=>{if(e!==void 0&&e.length>0){if(!ke(e))throw new y("INTERNAL",`invalid --ref "${e}" — a ref may contain letters, digits, ".", "_", "-", "/", "@" and must not contain "..".`);return e}return V(M())},x="anolilab/lunora",F=/^[0-9a-f]{40}$/iu,H=String.raw`\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)+)?(?:\+[0-9A-Za-z.-]+)?`,Se=new RegExp(String.raw`^v?${H}$`,"u"),je=new RegExp(String.raw`^(?:@[\w.-]+\/)?[\w.-]+@${H}$`,"u"),xe=e=>F.test(e)||Se.test(e)||je.test(e),Ne=()=>{const e=process.env.GITHUB_TOKEN??process.env.GH_TOKEN;return e!==void 0&&e.length>0?{authorization:`Bearer ${e}`}:{}},Oe=async e=>{try{const t=await fetch(`https://api.github.com/repos/${x}/commits/${encodeURIComponent(e)}`,{headers:{accept:"application/vnd.github+json","user-agent":"lunora-cli",...Ne()},signal:AbortSignal.timeout(1e4)});if(!t.ok)return;const n=await t.json();return typeof n.sha=="string"&&F.test(n.sha)?n.sha:void 0}catch{return}},Re=async(e,t)=>{const n=B(e);if(xe(n))return n;const r=await Oe(n);return r===void 0?(t.warn(`could not pin ${x}#${n} to a commit — fetching the UNPINNED branch (set GITHUB_TOKEN if rate-limited).`),n):(t.info(`pinned ${x}#${n} → ${r}`),r)},Ae="latest",Ee=(e=M())=>{const t=V(e);return t===z?Ae:t},Te="https://registry.npmjs.org",_e=()=>{const e=process.env.npm_config_registry,t=e!==void 0&&e.length>0?e:Te;return t.endsWith("/")?t.slice(0,-1):t},Je=async(e,t)=>{try{const n=await fetch(`${_e()}/${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}},_t=async(e,t)=>{const n=new Map;return await Promise.all([...new Set(e)].map(async r=>{const o=await Je(r,t);o!==void 0&&n.set(r,o)})),n},C=e=>{if(!e.startsWith("workspace:"))return e;const t=e.slice(10);return t===""||t==="*"||t==="^"||t==="~"?Ee():t},De=new Set(["@lunora/client","@lunora/do","@lunora/ratelimit","@lunora/runtime","@lunora/server","@lunora/values"]),Ie=/(['"])@lunora\/(client|do|ratelimit|runtime|server|values)(\/[^'"]*)?\1/gu,qe=e=>{const t=l(e,"package.json");if(!p(t))return!1;try{const n=JSON.parse(g(t,"utf8"));return n.dependencies?.lunorash!==void 0||n.devDependencies?.lunorash!==void 0}catch{return!1}},Pe=e=>e.replaceAll(Ie,(t,n,r,o)=>`${n}lunorash/${r}${o??""}${n}`),R=(e,t,n,r="dependencies",o=!1)=>{const s=Object.entries(e);if(s.length===0)return[];const a=l(t,"package.json");if(!p(a))return n.warn(`package.json not found at ${a} — skipping dependency updates`),[];let i=g(a,"utf8");const c=JSON.parse(i),u=[];for(const[d,f]of s){if(o&&De.has(d)){n.info(`dep provided by the lunorash umbrella, skipping: ${d}`);continue}if(c.dependencies?.[d]!==void 0||c.devDependencies?.[d]!==void 0){n.info(`dep already present: ${d}`);continue}const m=W(i,[r,d],C(f),{formattingOptions:{insertSpaces:!0,tabSize:4}});i=U(i,m),u.push(d)}return u.length>0&&($(a,i,"utf8"),n.success(`added ${String(u.length)} ${r==="devDependencies"?"devDependency(ies)":"dependency(ies)"} to package.json: ${u.join(", ")}`)),u},Le=(e,t,n)=>{if(e.length===0)return[];const r=l(t,se),o=p(r)?g(r,"utf8"):"",s=new Set(ie(o).map(u=>u.key)),a=[],i=[],c=[];for(const u of e)u.secret&&i.push(u.name),!s.has(u.name)&&(u.description&&c.push(`# ${u.description}`),c.push(`${u.name}=${u.secret?"":u.value??""}`),a.push(u.name));if(a.length>0){const u=o===""||o.endsWith(`
|
|
2
|
+
`)?o:`${o}
|
|
3
|
+
`;$(r,`${u}${c.join(`
|
|
4
|
+
`)}
|
|
5
|
+
`,"utf8"),n.success(`scaffolded ${String(a.length)} env var(s) into .dev.vars: ${a.join(", ")}`)}return i.length>0&&n.info(`set secret value(s) locally in .dev.vars, then for production: ${i.map(u=>`wrangler secret put ${u}`).join("; ")}`),a},A=new Set(["ai","analytics_engine_datasets","browser","d1_databases","durable_objects","hyperdrive","kv_namespaces","mtls_certificates","queues","r2_buckets","send_email","services","vars","vectorize","version_metadata","workflows"]),We=["binding","name","queue","pattern"],E=e=>{if(!(typeof e!="object"||e===null))for(const t of We){const n=e[t];if(typeof n=="string"&&n.length>0)return`${t}:${n}`}},Ue=(e,t,n,r)=>{const o=new Set(e.map(i=>JSON.stringify(i))),s=new Set(e.map(i=>E(i)).filter(i=>i!==void 0)),a=[];for(const i of t){if(o.has(JSON.stringify(i)))continue;const c=E(i);if(c!==void 0&&s.has(c)){r.warn(`${c.replace(":"," ")} already exists in ${n} — keeping the project's entry and skipping the registry item's. Reconcile by hand if the item needs different settings.`);continue}c!==void 0&&s.add(c),a.push(i)}return a},T=e=>Array.isArray(e),ze=(e,t)=>{let n=ae(e);for(const r of t){if(typeof n!="object"||n===null)return;n=n[r]}return n},Me=(e,t)=>{const n=e[0];return n!==void 0&&A.has(n)?!0:(t.warn(`skipping binding "${e.join(".")}" — only resource bindings (${[...A].join(", ")}) may be written, not exec/entrypoint keys`),!1)},G=Symbol("skip-binding"),Ve=(e,t,n)=>{const{value:r}=t;if(!T(r))return r;const o=ze(e,t.path);if(!T(o))return r;const s=Ue(o,r,t.path.join("."),n);return s.length===0?G:[...o,...s]},Be=(e,t,n)=>{if(e.length===0)return[];const r=["wrangler.jsonc","wrangler.json"].map(a=>l(t,a)).find(a=>p(a));if(!r)return n.warn("wrangler.jsonc not found — skipping binding updates"),[];let o=g(r,"utf8");const s=[];for(const a of e){if(!Me(a.path,n))continue;const i=Ve(o,a,n);if(i===G)continue;const c=W(o,[...a.path],i,{formattingOptions:{insertSpaces:!0,tabSize:4}});c.length!==0&&(o=U(o,c),s.push(a.path.join(".")))}return s.length>0&&($(r,o,"utf8"),n.success(`applied ${String(s.length)} binding(s) to ${r}: ${s.join(", ")}`)),s},Fe=(e,t,n,r=!1)=>{const o=[],s=[];return e.deps&&o.push(...R(e.deps,t,n,"dependencies",r)),e.devDependencies&&o.push(...R(e.devDependencies,t,n,"devDependencies",r)),e.bindings&&s.push(...Be(e.bindings,t,n)),e.envVars&&Le(e.envVars,t,n),{bindings:s,deps:o}},He=async(e,t)=>{const n=e.some(({manifest:c})=>Object.keys(c.deps??{}).length>0||Object.keys(c.devDependencies??{}).length>0),r=e.some(({manifest:c})=>(c.bindings??[]).length>0),o=t.source!==void 0&&t.source.length>0;if(!n&&!r&&!o||t.yes)return!0;const s=[];n&&s.push("add dependencies to package.json"),r&&s.push("write wrangler.jsonc bindings"),o&&s.push(`come from a non-default source (${String(t.source)})`);const a=s.join(", ");if(!process.stdin.isTTY&&t.confirm===void 0)return t.logger.error(`add: stdin is not a TTY and the requested items ${a} — re-run with --yes to confirm`),!1;const i=await(t.confirm??ue)(`The requested items ${a}. Continue?`);return i||t.logger.info("add: aborted"),i},S=1,Ce=".lunora-registry.json",Z=e=>l(e,"lunora",Ce),Ge=e=>typeof e!="object"||e===null||!("items"in e)?!1:typeof e.items=="object"&&e.items!==null,b=e=>me("sha256").update(e).digest("hex"),Ze=e=>{const t=Z(e);if(!p(t))return{items:{},version:S};try{const n=JSON.parse(g(t,"utf8"));if(Ge(n))return{items:n.items,version:S}}catch{}return{items:{},version:S}},Ke=(e,t)=>{$(Z(e),`${JSON.stringify(t,void 0,2)}
|
|
6
|
+
`,"utf8")},_=(e,t,n,r)=>{const o=e.items[t],s=o??{files:{}};o===void 0&&(e.items[t]=s),s.files[n]=b(r)},Ye=(e,t,n)=>e.items[t]?.files[n],J=e=>e===""?[]:e.split(`
|
|
7
|
+
`),Qe=(e,t)=>{const n=J(e),r=J(t);let o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o+=1;let s=n.length,a=r.length;for(;s>o&&a>o&&n[s-1]===r[a-1];)s-=1,a-=1;if(o===s&&o===a)return[];const i=[];for(let c=Math.max(0,o-3);c<o;c+=1)i.push(` ${n[c]??""}`);for(let c=o;c<s;c+=1)i.push(`- ${n[c]??""}`);for(let c=o;c<a;c+=1)i.push(`+ ${r[c]??""}`);for(let c=a;c<Math.min(r.length,a+3);c+=1)i.push(` ${r[c]??""}`);return i},Xe=/\.[cm]?[jt]sx?$/u,K=(e,t,n)=>{const r=g(l(e,t.from),"utf8");return n&&Xe.test(t.to)?Pe(r):r},et=(e,t,n,r,o,s,a)=>{const i=l(r,"lunora","schema.ts");if(s)return o.info(`~ would merge .extend(${t}.extension) into lunora/schema.ts (and create ${e.to} if absent)`),{kind:"skipped",path:i};const c=l(r,e.to);p(c)||(j(w(c),{recursive:!0}),$(c,K(n,e,a),"utf8"));const u=a?"lunorash/server":"@lunora/server",d=p(i)?g(i,"utf8"):`import { defineSchema } from "${u}";
|
|
8
|
+
|
|
9
|
+
export const schema = defineSchema({});
|
|
10
|
+
`,f=ge(d,t);if(f.ok)return j(w(i),{recursive:!0}),$(i,f.text,"utf8"),o.success(`merged .extend(${t}.extension) into lunora/schema.ts`),{kind:"written",path:i};if(f.reason==="already-applied")return o.warn(`lunora/schema.ts already extends "${t}" — skipping`),{kind:"skipped",path:i};throw f.reason==="invalid-identifier"?new y("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 y("INTERNAL",`schema-extension merge failed for "${t}": ${f.reason}`)},tt=(e,t,n,r,o)=>{const s=Qe(t,n);if(s.length===0){o.info(`= ${e.to} (unchanged)`);return}o.info(`${r?"~":"+"} ${e.to}`);for(const a of s)o.info(` ${a}`)},nt=(e,t,n,r,o,s,a,i)=>{const c=l(r,e.to),u=K(n,e,i),d=p(c),f=d?g(c,"utf8"):"",m=re=>(j(w(c),{recursive:!0}),$(c,u,"utf8"),_(s,t,e.to,u),o.success(`${re}: ${e.to}`),{kind:"written",path:c});if(a.diff)return tt(e,f,u,d,o),{kind:"skipped",path:c};if(!d)return m("write");const h=b(f);if(h===b(u))return _(s,t,e.to,u),o.warn(`skip (exists): ${e.to}`),{kind:"skipped",path:c};if(a.overwrite)return m("overwrite");const v=Ye(s,t,e.to);return v===void 0?(o.warn(`skip (exists, untracked): ${e.to} — refusing to overwrite a file lunora didn't add (use --overwrite to force)`),{kind:"skipped",path:c}):v===h?m("update"):v===b(u)?(o.warn(`skip (locally edited): ${e.to}`),{kind:"skipped",path:c}):($(`${c}.new`,u,"utf8"),o.warn(`conflict: ${e.to} has local edits and an upstream update — wrote ${e.to}.new (use --overwrite to take theirs)`),{kind:"skipped",path:c})},rt=(e,t,n,r,o,s,a={},i=!1)=>e.merge==="schema-extension"?et(e,t,n,r,o,a.diff===!0,i):nt(e,t,n,r,o,s,a,i),D=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],ot=e=>{const t=le(e);if(t===void 0)return;const{parsed:n}=pe(t);return typeof n?.main=="string"?n.main:void 0},st=e=>{const t=ot(e),n=t===void 0?D:[t,...D];for(const r of n){const o=l(e,r);if(!p(o))continue;const s=g(o,"utf8");if(!s.includes("createShardDO(")){if(r===t)break;continue}return{entryPath:o,main:r,source:s}}},it=(e,t,n)=>{const r=L(w(e),l(t,"lunora",n)).replaceAll("\\","/");return r.startsWith(".")?r:`./${r}`},at=(e,t)=>{for(const n of e){const r=`Add \`export * from "${`./lunora/${n.module}.js`}"\` to your worker entry`,o=n.comment?` (${n.comment})`:"";t.warn(`${r}${o}`)}return 0},ct=(e,t,n,r)=>{const o=[];for(const s of e){const a=it(t,n,s.module),i=a.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);new RegExp(String.raw`export\s+\*\s+from\s+["']${i}\.js["']`,"u").test(r)||(s.comment&&o.push(`
|
|
11
|
+
// ${s.comment}`),o.push(`export * from "${a}.js";`))}return o},ut=(e,t,n,r)=>{if(e.length===0)return 0;const o=st(t);if(o===void 0)return at(e,n);const s=ct(e,o.entryPath,t,o.source);if(s.length===0)return 0;if(r){for(const i of s)i!==""&&n.info(`~ entrypoint: ${i}`);return s.length}const a=o.source.endsWith(`
|
|
12
|
+
`)?"":`
|
|
13
|
+
`;return $(o.entryPath,`${o.source}${a}${s.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`,"utf8"),n.success(`wrote ${String(s.length)} entrypoint re-export(s) to ${L(t,o.entryPath)}`),s.length},I=(e,t,n,r={})=>{const o=[],s=[],a=[],i=[],c=Ze(t),u=qe(t);for(const{directory:d,manifest:f}of e){for(const h of f.files){const v=rt(h,f.name,d,t,n,c,r,u);(v.kind==="written"?o:s).push(v.path)}if(f.entrypointReexports!==void 0&&ut(f.entrypointReexports,t,n,r.diff===!0),r.diff)continue;const m=Fe(f,t,n,u);a.push(...m.deps),i.push(...m.bindings)}return!r.diff&&Object.keys(c.items).length>0&&Ke(t,c),{bindings:i,deps:a,skipped:s,written:o}},Y="gh:anolilab/lunora/registry",q=/^[A-Za-z0-9][\w-]*$/u,dt=e=>{if(!q.test(e))throw new y("INTERNAL",`invalid registry item name "${e}" — names must match ${q.source} (letters, digits, "-", "_"; no path separators or "..")`)},ft=e=>e.includes("..")?!1:e.startsWith("gh:")||e.startsWith("github:")||e.startsWith("https://"),lt=e=>e.from===void 0&&e.source!==void 0&&e.source.length>0&&!e.allowUnsafeSource&&!ft(e.source),N=(e,t)=>lt(t)?`${e}: refusing --source ${String(t.source)} — only gh:, github:, or https:// sources are allowed (and may not contain ".."). Re-run with --allow-unsafe-source if you really want this.`:void 0,Q=async(e,t,n)=>{const r=oe(l($e(),`lunora-${t}-fetch-`)),o=l(r,t);n.info(`fetching ${e}`);try{const s=await he(e,{cwd:r,dir:o,force:!0,install:!1,silent:!0});return n.info(s.commit?`resolved ${s.source} @ ${s.commit}`:`resolved ${s.source}`),{cleanup:()=>{O(r,{force:!0,recursive:!0})},directory:o}}catch(s){throw O(r,{force:!0,recursive:!0}),s}},P=new WeakMap,X=async e=>{const t=P.get(e);if(t!==void 0)return t;const n=e.source!==void 0&&e.source.length>0?Promise.resolve(B(e.ref)):Re(e.ref,e.logger);return P.set(e,n),n},ee=async(e,t)=>{if(dt(e),t.from!==void 0){const r=l(t.from,e);if(!p(r))throw new y("INTERNAL",`registry item not found in local source: ${r}`);return{cleanup:()=>{},directory:r}}const n=t.source??Y;return Q(`${n}/${e}#${await X(t)}`,"item",t.logger)},pt=async e=>{if(e.from!==void 0){if(!p(e.from))throw new y("INTERNAL",`registry root not found: ${e.from}`);return{cleanup:()=>{},root:e.from}}const t=e.source??Y,{cleanup:n,directory:r}=await Q(`${t}#${await X(e)}`,"registry",e.logger);return{cleanup:n,root:r}},te=(e,t)=>{const n=JSON.parse(g(l(e,"registry.json"),"utf8"));return ye(n,t)},gt=async(e,t)=>{const n=[],r=[],o=new Set,s=new Set,a=async i=>{if(o.has(i))return;if(s.has(i))throw new y("INTERNAL",`cyclic registry dependency detected at "${i}"`);s.add(i);const{cleanup:c,directory:u}=await ee(i,t);r.push(c);const d=te(u,i);for(const f of d.requires??[])await a(f);s.delete(i),o.add(i),n.push({directory:u,manifest:d})};try{for(const i of e)await a(i)}catch(i){for(const c of r)c();throw i}return{cleanups:r,items:n}},k=()=>({bindings:[],code:0,deps:[],skipped:[],written:[]}),Jt=(e,t,n,r,o)=>e.bindings?{...e,bindings:e.bindings.map(s=>{if(s.path[0]!==t||!Array.isArray(s.value))return s;const a=s.value;return{...s,value:a.map(i=>typeof i=="object"&&i!==null&&i[n.key]===n.value?{...i,[r]:o}:i)}})}:e,ne=(e,t)=>{const n=t.title??t.description;e.info(`plan: ${t.name}${n?` — ${n}`:""}`);for(const s of t.files)e.info(` file ${s.to} (${s.merge})`);const r=new Map,o=s=>{const a=r.get(s);if(a!==void 0)return a;const i=C(s);return r.set(s,i),i};for(const[s,a]of Object.entries(t.deps??{}))e.info(` dep ${s}@${o(a)}`);for(const[s,a]of Object.entries(t.devDependencies??{}))e.info(` dev ${s}@${o(a)}`);for(const s of t.bindings??[])e.info(` bind ${s.path.join(".")} = ${JSON.stringify(s.value)}`);for(const s of t.envVars??[]){const a=s.secret?" (secret)":` = ${JSON.stringify(s.value??"")}`;e.info(` env ${s.name}${a}`)}for(const s of t.entrypointReexports??[]){const a=`./lunora/${s.module}`,i=s.comment?` // ${s.comment}`:"";e.info(` entry ${a}${i}`)}},mt=e=>{const t=e.map(({manifest:n})=>({bindings:(n.bindings??[]).map(r=>({path:r.path.join("."),value:r.value})),deps:Object.keys(n.deps??{}),devDependencies:Object.keys(n.devDependencies??{}),entrypointReexports:(n.entrypointReexports??[]).map(r=>({module:r.module,...r.comment?{comment:r.comment}:{}})),envVars:(n.envVars??[]).map(r=>({name:r.name,...r.secret?{secret:!0}:{value:r.value??""}})),files:n.files.map(r=>({merge:r.merge,to:r.to})),name:n.name,requires:n.requires??[],title:n.title}));process.stdout.write(`${JSON.stringify({items:t},void 0,2)}
|
|
16
|
+
`)},$t=(e,t,n,r,o)=>{o.success(`add complete: ${String(n)} written, ${String(r)} skipped`),o.info("next steps:"),o.info(" lunora codegen # regenerate _generated/ so the new tables/functions appear"),t.length>0&&o.info(" pnpm install # install newly-added dependencies");for(const{manifest:s}of e)s.docs&&o.info(`${s.name}: ${s.docs}`)},ht=async e=>{const t=k(),n=N("list",e);if(n)return e.logger.error(n),{...t,code:1};let r=()=>{};try{const o=await pt(e);r=o.cleanup;const s=de(o.root);if(e.json)return process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
17
|
+
`),t;e.logger.info(`available registry items (${String(s.length)}):`);for(const a of s)e.logger.info(` ${a.name}${a.description?` — ${a.description}`:""}`);return t}catch(o){return e.logger.error(`list failed: ${o instanceof Error?o.message:String(o)}`),{...t,code:1}}finally{r()}},Dt=async e=>{const t=e.cwd??process.cwd(),n=k();if(e.list)return ht(e);if(e.names.length===0)return e.logger.error("add requires at least one item name. Usage: lunora registry add <name> [...names]"),{...n,code:1};const r=N("add",e);if(r)return e.logger.error(r),{...n,code:1};let o=[];try{const{cleanups:s,items:a}=await gt(e.names,e);o=s;const{transformManifest:i}=e,c=i?a.map(h=>({...h,manifest:i(h.manifest)})):a;for(const{manifest:h}of c)ne(e.logger,h);if(e.json&&mt(c),e.dryRun)return e.logger.info("dry-run: stopping before any files are written"),n;if(e.diff)return I(c,t,e.logger,{diff:!0}),e.logger.info("diff: preview only — re-run without --diff to apply"),n;if(!await He(c,e))return{...n,code:1};const{bindings:u,deps:d,skipped:f,written:m}=I(c,t,e.logger,{overwrite:e.overwrite});return $t(c,d,m.length,f.length,e.logger),{bindings:u,code:0,deps:d,skipped:f,written:m}}catch(s){return e.logger.error(`add failed: ${s instanceof Error?s.message:String(s)}`),{...n,code:1}}finally{for(const s of o)s()}},It=async e=>{const t=k();if(e.names.length===0)return e.logger.error("view requires an item name. Usage: lunora registry view <name>"),{...t,code:1};const n=N("view",e);if(n)return e.logger.error(n),{...t,code:1};const r=[];try{for(const o of e.names){const{cleanup:s,directory:a}=await ee(o,e);r.push(s);const i=te(a,o);ne(e.logger,i);for(const c of i.files){e.logger.info(`--- ${c.to} (${c.merge}) ---`);const u=g(l(a,c.from),"utf8");for(const d of u.split(`
|
|
18
|
+
`))e.logger.info(d)}}return t}catch(o){return e.logger.error(`view failed: ${o instanceof Error?o.message:String(o)}`),{...t,code:1}}finally{for(const o of r)o()}},qt=async e=>{const t=k(),n=e.from;if(n===void 0)return e.logger.error("registry build requires --from <registry root>"),{...t,code:1};if(!p(n))return e.logger.error(`registry root not found: ${n}`),{...t,code:1};const r=fe(n),o=e.out??l(n,"index.json");if(e.check){const s=p(o)?JSON.parse(g(o,"utf8")):{items:[]};return JSON.stringify(s.items??[])!==JSON.stringify(r.items)?(e.logger.error(`registry: ${o} is stale — run \`lunora registry build\` to regenerate it`),{...t,code:1}):(e.logger.success(`registry: ${o} is up to date (${String(r.items.length)} items)`),t)}return $(o,`${JSON.stringify({$schema:"./schema/registry.schema.json",...r},void 0,4)}
|
|
19
|
+
`,"utf8"),e.logger.success(`registry: wrote ${o} (${String(r.items.length)} items)`),t};export{It as D,Ee as L,_t as P,ht as R,Re as b,Jt as d,B as g,Dt as k,qt as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{deployTargetIds as o,DEFAULT_DEPLOY_TARGET as n,resolveTargetOrThrow as a}from"@lunora/config";const s=(()=>{const r=o();return r.length>1?`${r.join(" | ")} (default ${n})`:r.join(" | ")})(),i={description:`Deploy target: ${s}. Also settable as "target" in lunora.json`,name:"target",type:String},l=(r,e)=>{try{return{target:a(r,e)}}catch(t){return{error:t instanceof Error?t.message:String(t)}}};export{i as g,l as i};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const i=(r,t)=>{if(r.length===0)return;const a=r.map(e=>` [${e.level.toUpperCase()}] ${e.name} — ${e.message}
|
|
2
|
+
↳ ${e.remediation}`),n=r.filter(e=>e.level==="error"),o=`${String(r.length)} platform ${r.length===1?"diagnostic":"diagnostics"}:
|
|
3
|
+
${a.join(`
|
|
4
|
+
`)}`;if(n.length===0){t.warn(o);return}return t.error(o),n[0]?.message??"platform diagnostics reported an error"};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:fs";import"@visulima/path";import{k as d,q as i,R as s,D as t}from"./commands-C5pu77HK.mjs";import"./buildRegistryIndex-DwySASBu.mjs";export{d as runAddCommand,i as runBuildIndexCommand,s as runListCommand,t as runRegistryViewCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as r}from"./commands-
|
|
1
|
+
import{d as r}from"./commands-C5pu77HK.mjs";const o=[{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"}],n="auth",O=async a=>await a("Which auth provider?",o,{default:n})??n,S="mail",y=[{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 + Vite",label:"Solid",value:"auth-ui-solid"},{description:"Analog",label:"Angular",value:"auth-ui-angular"}],x="auth-ui-react",d=a=>Object.hasOwn(a,"react-native")||Object.hasOwn(a,"@lunora/react-native")||Object.hasOwn(a,"expo"),_=a=>{const e=t=>Object.hasOwn(a,t);if(!d(a)){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"}},A=a=>{const e=a.trim();if(e==="")return;const t=e.toLowerCase();return t==="auth-ui"||t==="auth-ui-"?{kind:"auth-ui"}:t==="auth"?{kind:"auth"}:t==="email"||t==="mail"?{kind:"email"}:{item:t,kind:"item"}},c=/[^a-z0-9]+/u,u=(a,e,t)=>{let i=a.toLowerCase().split(c).filter(Boolean).join("-").slice(0,t);return i.endsWith("-")&&(i=i.slice(0,-1)),i.length>=e?i:void 0},h="DB",v="Name your D1 database (run `wrangler d1 create` to get its id, then put it in wrangler.jsonc)",l=a=>u(a,1,64),f="lunora-db",b=a=>l(`${a}-db`)??f,V=async(a,e)=>{const t=b(e);return l(await a(v,{default:t,placeholder:t}))??t},C=(a,e)=>r(a,"d1_databases",{key:"binding",value:h},"database_name",e),m="SEND_EMAIL",D="Verified destination email for production delivery (blank = set it later in wrangler.jsonc)",p=a=>{const e=a.trim();if(e.length===0||e.includes(" "))return!1;const t=e.indexOf("@");if(t<=0||t!==e.lastIndexOf("@"))return!1;const i=e.slice(t+1);return i.length>=3&&i.includes(".")&&!i.startsWith(".")&&!i.endsWith(".")},N=(a,e)=>{const t=a.trim();if(t!==""){if(!p(t)){e(`"${t}" doesn't look like an email — leaving the placeholder; set destination_address in wrangler.jsonc.`);return}return t}},E=(a,e)=>r(a,"send_email",{key:"name",value:m},"destination_address",e),$="UPLOADS",g="Name your R2 bucket (you can rename it in wrangler.jsonc later)",s=a=>u(a,3,63),k="lunora-uploads",w=a=>s(`${a}-uploads`)??k,L=async(a,e)=>{const t=w(e);return s(await a(g,{default:t,placeholder:t}))??t},W=(a,e)=>r(a,"r2_buckets",{key:"binding",value:$},"bucket_name",e);export{N as a,D as b,l as c,A as d,b as e,V as f,n as g,_ as h,s as i,y as j,o as k,S as l,E as m,O as n,w as o,W as p,C as q,d as r,x as s,L as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findWranglerFile as t,readWranglerJsonc as o}from"@lunora/config/cloudflare";const i=r=>{const e=t(r);if(!e)return;const{parsed:n}=o(e);return typeof n?.name=="string"&&n.name.length>0?n.name:void 0};export{i as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{execFile as c}from"node:child_process";import{resolveDeployDriver as i,resolveProjectTarget as l}from"@lunora/config";import{M as m,P as d}from"./detect-package-manager-B2eIuAiP.mjs";const p=r=>r?typeof r.code=="number"?r.code:1:0,f=(r,o,e)=>new Promise(n=>{c(r,[...o],{cwd:e},(t,a,s)=>{n({code:p(t),stderr:s,stdout:a})})}),u=r=>{let o;try{o=JSON.parse(r)}catch{return}return Array.isArray(o)?[...o.map(e=>e!==null&&typeof e=="object"?e.name:void 0).filter(e=>typeof e=="string"&&e.length>0)].toSorted((e,n)=>e.localeCompare(n)):void 0},w=async r=>{const o=i(l(r.cwd)).toolchain?.secretList({environment:r.env,temporary:r.temporary});if(o===void 0)return{error:"deploy target has no command-line toolchain",names:[],ok:!1};const{args:e,command:n}=m(d(r.cwd),o.tool,o.args),t=await(r.runner??f)(n,e,r.cwd);if(t.code!==0)return{error:t.stderr.trim()||`wrangler secret list exited ${String(t.code)}`,names:[],ok:!1};const a=u(t.stdout);return a===void 0?{error:"could not parse `wrangler secret list --format json` output",names:[],ok:!1}:{names:a,ok:!0}};export{w as R};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.128",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -52,15 +52,16 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@bomb.sh/tab": "0.0.21",
|
|
55
|
-
"@lunora/
|
|
56
|
-
"@lunora/
|
|
57
|
-
"@lunora/
|
|
55
|
+
"@lunora/advisor": "1.0.0-alpha.58",
|
|
56
|
+
"@lunora/bindings": "1.0.0-alpha.14",
|
|
57
|
+
"@lunora/codegen": "1.0.0-alpha.80",
|
|
58
|
+
"@lunora/config": "1.0.0-alpha.105",
|
|
58
59
|
"@lunora/container": "1.0.0-alpha.17",
|
|
59
|
-
"@lunora/d1": "1.0.0-alpha.
|
|
60
|
+
"@lunora/d1": "1.0.0-alpha.54",
|
|
60
61
|
"@lunora/errors": "1.0.0-alpha.9",
|
|
61
|
-
"@lunora/mcp": "1.0.0-alpha.
|
|
62
|
-
"@lunora/runtime": "1.0.0-alpha.
|
|
63
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
62
|
+
"@lunora/mcp": "1.0.0-alpha.50",
|
|
63
|
+
"@lunora/runtime": "1.0.0-alpha.47",
|
|
64
|
+
"@lunora/seed": "1.0.0-alpha.54",
|
|
64
65
|
"@visulima/cerebro": "3.0.0",
|
|
65
66
|
"@visulima/error": "6.0.0",
|
|
66
67
|
"@visulima/fs": "5.0.5",
|