@lunora/cli 1.0.0-alpha.215 → 1.0.0-alpha.217

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