@lunora/cli 1.0.0-alpha.22 → 1.0.0-alpha.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +33 -0
- package/README.md +1 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +2 -10
- package/dist/index.d.mts +786 -341
- package/dist/index.d.ts +786 -341
- package/dist/index.mjs +1 -19
- package/dist/packem_chunks/handler.mjs +1 -150
- package/dist/packem_chunks/handler10.mjs +4 -22
- package/dist/packem_chunks/handler11.mjs +2 -192
- package/dist/packem_chunks/handler12.mjs +1 -131
- package/dist/packem_chunks/handler13.mjs +1 -65
- package/dist/packem_chunks/handler14.mjs +1 -58
- package/dist/packem_chunks/handler15.mjs +1 -79
- package/dist/packem_chunks/handler16.mjs +3 -43
- package/dist/packem_chunks/handler17.mjs +1 -105
- package/dist/packem_chunks/handler18.mjs +1 -170
- package/dist/packem_chunks/handler19.mjs +7 -89
- package/dist/packem_chunks/handler2.mjs +2 -114
- package/dist/packem_chunks/handler20.mjs +1 -94
- package/dist/packem_chunks/handler21.mjs +3 -311
- package/dist/packem_chunks/handler22.mjs +3 -0
- package/dist/packem_chunks/handler23.mjs +1 -0
- package/dist/packem_chunks/handler24.mjs +2 -0
- package/dist/packem_chunks/handler25.mjs +99 -0
- package/dist/packem_chunks/handler26.mjs +10 -0
- package/dist/packem_chunks/handler3.mjs +1 -204
- package/dist/packem_chunks/handler4.mjs +1 -33
- package/dist/packem_chunks/handler5.mjs +1 -49
- package/dist/packem_chunks/handler6.mjs +1 -91
- package/dist/packem_chunks/handler7.mjs +3 -42
- package/dist/packem_chunks/handler8.mjs +1 -174
- package/dist/packem_chunks/handler9.mjs +1 -16
- package/dist/packem_chunks/planDevCommand.mjs +7 -509
- package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
- package/dist/packem_chunks/runDeployCommand.mjs +1 -504
- package/dist/packem_chunks/runInitCommand.mjs +149 -1388
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +9 -395
- package/dist/packem_chunks/runResetCommand.mjs +1 -41
- package/dist/packem_chunks/runRpcCommand.mjs +1 -68
- package/dist/packem_shared/COMMANDS-BbQ3-hLn.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-BPQYMEmV.mjs +1 -0
- package/dist/packem_shared/admin-token-VdUnvnKW.mjs +1 -0
- package/dist/packem_shared/admin-url-BhF5ufg1.mjs +1 -0
- package/dist/packem_shared/advisory-gate-Cl8IEFIj.mjs +1 -0
- package/dist/packem_shared/binding-manifest-file-CQ1eQYy1.mjs +2 -0
- package/dist/packem_shared/buildRegistryIndex-DVmy8fHE.mjs +1 -0
- package/dist/packem_shared/catalog-Cbzph90w.mjs +1 -0
- package/dist/packem_shared/cli-DOBnG22n.mjs +3 -0
- package/dist/packem_shared/codegen-error-AmH54ofi.mjs +3 -0
- package/dist/packem_shared/command-DwC11Cwe.mjs +1 -0
- package/dist/packem_shared/commands-CLLQuHqU.mjs +15 -0
- package/dist/packem_shared/createLogger-hGafwf-3.mjs +2 -0
- package/dist/packem_shared/createRecordingSpawner-DJlNacZ6.mjs +1 -0
- package/dist/packem_shared/deploy-target-B0Xcb2jV.mjs +1 -0
- package/dist/packem_shared/diffSnapshots-DtC5Cs4Z.mjs +5 -0
- package/dist/packem_shared/docker-DpVxvYpL.mjs +1 -0
- package/dist/packem_shared/import-DuHtoh4_.mjs +12 -0
- package/dist/packem_shared/insertSchemaExtension-DY4pA8wE.mjs +8 -0
- package/dist/packem_shared/lint-ignore-report-DKZagpqk.mjs +2 -0
- package/dist/packem_shared/open-url-EnKy--w-.mjs +1 -0
- package/dist/packem_shared/output-format-DfogXx0p.mjs +2 -0
- package/dist/packem_shared/parseManifest-CwPTKdtS.mjs +1 -0
- package/dist/packem_shared/path-containment-CgxYZggb.mjs +1 -0
- package/dist/packem_shared/platform-diagnostics-D0YzAdXm.mjs +4 -0
- package/dist/packem_shared/prompt-cancelled-C8Sj7OqI.mjs +1 -0
- package/dist/packem_shared/resolve-BWFT7RvE.mjs +5 -0
- package/dist/packem_shared/resolve-target-BRvw8Pf7.mjs +1 -0
- package/dist/packem_shared/runAddCommand-BABRWlOb.mjs +1 -0
- package/dist/packem_shared/runExportCommand-Dq-SpjAe.mjs +5 -0
- package/dist/packem_shared/schema-drift-gate-BDCkQ1S6.mjs +1 -0
- package/dist/packem_shared/schemaIrToSnapshot-VpPguG3W.mjs +1 -0
- package/dist/packem_shared/shared-D-zCOmgY.mjs +1 -0
- package/dist/packem_shared/storage-DlUnv7uG.mjs +1 -0
- package/dist/packem_shared/tui-prompts-Dd0pDuNr.mjs +4 -0
- package/dist/packem_shared/vectorize-metadata-dXpl2_Ar.mjs +1 -0
- package/dist/packem_shared/wrangler-name-Dsk5K1f-.mjs +1 -0
- package/dist/packem_shared/wrangler-secrets-CCdt0mUl.mjs +1 -0
- package/package.json +39 -17
- package/skills/README.md +35 -17
- package/skills/lunora/SKILL.md +65 -9
- package/skills/lunora-deploy/SKILL.md +42 -11
- package/skills/lunora-functions/SKILL.md +78 -15
- package/skills/lunora-migration-helper/SKILL.md +74 -21
- package/skills/lunora-performance-audit/SKILL.md +42 -9
- package/skills/lunora-quickstart/SKILL.md +93 -27
- package/skills/lunora-realtime/SKILL.md +58 -30
- package/skills/lunora-setup-auth/SKILL.md +23 -6
- package/skills/lunora-setup-hyperdrive/SKILL.md +33 -13
- package/skills/lunora-setup-mail/SKILL.md +34 -28
- package/skills/lunora-setup-scheduler/SKILL.md +18 -13
- package/skills/lunora-setup-storage/SKILL.md +182 -25
- package/dist/packem_shared/COMMANDS-D3h9Iwvl.mjs +0 -944
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
- package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
- package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
- package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
- package/dist/packem_shared/command-BC30oSBW.mjs +0 -14
- package/dist/packem_shared/commands-hl0mRqqg.mjs +0 -845
- package/dist/packem_shared/createLogger-B40gPzQo.mjs +0 -78
- package/dist/packem_shared/createRecordingSpawner-DxI3mebw.mjs +0 -43
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
- package/dist/packem_shared/diffSnapshots-BeDvvNiF.mjs +0 -161
- package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
- package/dist/packem_shared/insertSchemaExtension-DAqbfr9Z.mjs +0 -64
- package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
- package/dist/packem_shared/output-format-wUvAN6AL.mjs +0 -17
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
- package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
- package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
- package/dist/packem_shared/runAddCommand-vJdgiR5t.mjs +0 -4
- package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
- package/dist/packem_shared/schemaIrToSnapshot-DdsljJT-.mjs +0 -43
- package/dist/packem_shared/storage-B7hHSTZP.mjs +0 -84
- package/dist/packem_shared/tui-prompts-M6OWsuyw.mjs +0 -663
- package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as Ye}from"./commands-CLLQuHqU.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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{jsx as n,jsxs as a}from"react/jsx-runtime";import{isInteractive as m,ACCENT as w,LUNA_ART as ce,LUNA_NAME as le,LUNA_SIGNOFF as se,BADGE_COLUMN_WIDTH as z,badgeWidth as J,badgeLead as ae,padBadge as ue}from"@lunora/config";import{render as H}from"@visulima/tui";import{Box as u}from"@visulima/tui/components/box";import{Text as l}from"@visulima/tui/components/text";import{useApp as I}from"@visulima/tui/hooks/use-app";import{useInput as B}from"@visulima/tui/hooks/use-input";import{useInterval as de}from"@visulima/tui/hooks/use-interval";import{CommandPalette as fe}from"@visulima/tui-kit/command-palette";import{ConfirmInput as he}from"@visulima/tui-kit/confirm-input";import{SelectInput as me}from"@visulima/tui-kit/select-input";import{Spinner as pe}from"@visulima/tui-kit/spinner";import{TextInput as ve}from"@visulima/tui-kit/text-input";import{useState as S,useEffect as A}from"react";import{P as K}from"./prompt-cancelled-C8Sj7OqI.mjs";let j=!1;const V=()=>{j||(j=!0,process.getMaxListeners()<64&&process.setMaxListeners(64))},we=({children:e,onCancel:r})=>{const{exit:t}=I();return B((i,o)=>{o.ctrl&&i==="c"&&(r(),t())}),e},Q=e=>e instanceof Error?e:new Error(typeof e=="string"?e:"task failed"),Z=10,xe=8,ee=({spec:e})=>a(l,{children:[n(l,{children:ae(e.text)}),n(l,{backgroundColor:e.bg,bold:!0,color:e.fg,children:ue(e.text)})]}),$=({badge:e,message:r})=>e===void 0?n(l,{bold:!0,children:r}):a(u,{children:[n(ee,{spec:e}),n(l,{bold:!0,children:` ${r}`})]}),re=2,T=" ".repeat(z-1),te=e=>" ".repeat(J(e)+1),Ce=e=>e===void 0?re:J(e)+1,D=({badge:e,children:r,message:t})=>a(u,{flexDirection:"column",children:[n($,{badge:e,message:t}),n(u,{flexDirection:"column",marginLeft:Ce(e),children:r})]}),g=({answer:e,badge:r,message:t})=>a(u,{flexDirection:"column",children:[n($,{badge:r,message:t}),e===""?null:n(l,{dimColor:!0,children:`${r===void 0?" ".repeat(re):te(r)}${e}`})]}),R=e=>{const{exit:r}=I(),[t,i]=S(void 0);return A(()=>{t!==void 0&&r()},[t,r]),{answer:t,submit:(o,c)=>{e(o),i(c)}}},Se=({children:e})=>{const{exit:r}=I();return A(()=>{r()},[r]),e},N=async e=>{V(),process.stdout.write(`
|
|
2
|
+
`);const r=H(n(Se,{children:e}));try{await r.waitUntilExit()}catch{}finally{r.unmount()}},Ze=async(e,r,t)=>{if(!m())return;const i=t===void 0||t===""?[]:t.split(`
|
|
3
|
+
`);await N(a(u,{flexDirection:"column",children:[n($,{badge:e,message:r}),i.map(o=>n(l,{dimColor:!0,children:`${te(e)}${o}`},o))]}))},G=async e=>{V(),process.stdout.write(`
|
|
4
|
+
`);const r={value:!1},t=H(n(we,{onCancel:()=>{r.value=!0},children:e}),{exitOnCtrlC:!1});try{await t.waitUntilExit()}finally{t.unmount()}if(r.value)throw new K},E=async(e,r)=>{let t=r;return await G(e(i=>{t=i})),t},ne=e=>e.description===void 0?e.label:`${e.label} — ${e.description}`,U=()=>{const{exit:e}=I();B((r,t)=>{t.escape&&e()})},Ie=({badge:e,finish:r,initialIndex:t,message:i,options:o})=>{const{answer:c,submit:d}=R(r);return U(),c!==void 0?n(g,{answer:c,badge:e,message:i}):n(D,{badge:e,message:i,children:n(me,{accentColor:w,initialIndex:t,items:o.map(s=>({key:s.value,label:ne(s),value:s.value})),limit:Z,onSelect:s=>{d(s.value,o.find(f=>f.value===s.value)?.label??s.value)}})})},be=({badge:e,finish:r,message:t,options:i})=>{const{exit:o}=I(),{answer:c,submit:d}=R(r);return c!==void 0?n(g,{answer:c,badge:e,message:t}):n(D,{badge:e,message:t,children:n(fe,{accentColor:w,autoFocus:!0,commands:i.map(s=>({description:s.description,id:s.value,label:s.label})),limit:Z,onCancel:()=>{o()},onSelect:s=>{d(s,i.find(f=>f.value===s)?.label??s)},placeholder:"Type to filter…"})})},er=async(e,r,t)=>{if(!m()||r.length===0)return t?.default;const{badge:i}=t??{};if(r.length>xe)return E(c=>n(be,{badge:i,finish:c,message:e,options:r}),t?.default);const o=t?.default===void 0?-1:r.findIndex(c=>c.value===t.default);return E(c=>n(Ie,{badge:i,finish:c,initialIndex:o>=0?o:void 0,message:e,options:r}),t?.default)},Te=({badge:e,defaultValue:r,finish:t,message:i,placeholder:o})=>{const{answer:c,submit:d}=R(t);return U(),c!==void 0?n(g,{answer:c,badge:e,message:i}):n(D,{badge:e,message:i,children:n(ve,{defaultValue:r,onSubmit:s=>{const f=s.trim()===""?r:s.trim();d(f,f)},placeholder:o})})},rr=async(e,r)=>{const t=r?.default??"";if(!m())return t;const{badge:i}=r??{};return E(o=>n(Te,{badge:i,defaultValue:t,finish:o,message:e,placeholder:r?.placeholder}),t)},Ne=({badge:e,defaults:r,finish:t,message:i,options:o})=>{const{answer:c,submit:d}=R(t),[s,f]=S(0),[p,x]=S(()=>new Set(r));return U(),B((b,v)=>{if(!(c!==void 0||o.length===0)){if(v.upArrow)f(h=>(h-1+o.length)%o.length);else if(v.downArrow)f(h=>(h+1)%o.length);else if(b===" "){const h=o[s];h!==void 0&&x(C=>{const _=new Set(C);return _.has(h.value)?_.delete(h.value):_.add(h.value),_})}else if(v.return){const h=o.filter(C=>p.has(C.value));d(h.map(C=>C.value),h.length>0?h.map(C=>C.label).join(", "):"none")}}}),c!==void 0?n(g,{answer:c,badge:e,message:i}):n(D,{badge:e,message:i,children:a(u,{flexDirection:"column",children:[n(l,{dimColor:!0,children:"space toggles · enter confirms · esc cancels"}),o.map((b,v)=>{const h=v===s;return n(l,{color:h?w:void 0,children:`${h?"▸ ":" "}${p.has(b.value)?"◼":"◻"} ${ne(b)}`},b.value)})]})})},tr=async(e,r,t)=>{const i=t?.defaults??[];if(!m()||r.length===0)return[...i];const{badge:o}=t??{};return E(c=>n(Ne,{badge:o,defaults:i,finish:c,message:e,options:r}),[...i])},ye=({badge:e,defaultYes:r,finish:t,message:i})=>{const{answer:o,submit:c}=R(t);return o!==void 0?n(g,{answer:o,badge:e,message:i}):a(u,{children:[e===void 0?null:n(ee,{spec:e}),n(l,{bold:!0,children:e===void 0?`${i} `:` ${i} `}),n(he,{defaultChoice:r?"confirm":"cancel",onCancel:()=>{c(!1,"No")},onConfirm:()=>{c(!0,"Yes")}})]})},Ee=async(e,r)=>{const t=r?.defaultYes===!0;if(!m())return t;const{badge:i}=r??{};return E(o=>n(ye,{badge:i,defaultYes:t,finish:o,message:e}),!1)},nr=()=>m()?e=>Ee(e,{defaultYes:!0}):()=>Promise.resolve(!1),W="#c8a8ff",L="#d9c8ff",$e="#6b5b9a",P=({moon:e,prefix:r,suffix:t})=>a(u,{children:[n(l,{color:W,dimColor:!0,children:r}),typeof e=="string"?n(l,{color:L,children:e}):e,t===void 0?null:n(l,{color:W,children:t})]}),X=({left:e,right:r})=>a(l,{color:L,children:[e,n(l,{color:$e,children:"●●"}),r]}),ge=()=>a(u,{flexDirection:"column",paddingX:1,children:[n(P,{moon:".-‐-.",prefix:"· ✦ · ",suffix:" ✦"}),n(P,{moon:n(X,{left:"/",right:"\\"}),prefix:" ✦ · ",suffix:" ·"}),n(P,{moon:n(X,{left:"\\",right:"/"}),prefix:" . ✦ · "}),a(u,{children:[n(l,{bold:!0,color:w,children:" lunora init "}),n(l,{dimColor:!0,children:"· moonrise sequence"}),n(l,{color:L})]})]}),or=async e=>{m()&&await N(a(u,{flexDirection:"column",children:[n(ge,{}),n(u,{paddingX:1,children:n(l,{dimColor:!0,children:e})})]}))},Re=({label:e})=>a(u,{children:[n(l,{color:w,children:n(pe,{type:"dots"})}),a(l,{children:[" ",e]})]}),ir=async(e,r)=>{if(!m())return r();V();const t=H(n(Re,{label:e}));try{return await r()}finally{t.unmount()}},cr=async()=>{m()&&await N(a(u,{paddingX:1,children:[n(l,{color:L,children:ce}),a(u,{flexDirection:"column",marginLeft:2,children:[n(l,{bold:!0,color:w,children:le}),n(l,{children:se})]})]}))},_e="#06b6d4",k=" ".repeat(9),lr=async e=>{m()&&await N(n(l,{bold:!0,children:`${k}${e}`}))},sr=async e=>{m()&&await N(a(u,{children:[n(l,{color:_e,children:`${T}◼`}),n(l,{children:` ${e}`})]}))},ar=async(e,r,t,i)=>{m()&&await N(a(u,{flexDirection:"column",children:[n($,{badge:e,message:r}),n(u,{flexDirection:"column",marginTop:1,children:t.map(o=>a(l,{children:[`${k}${o.lead} `,n(l,{color:w,children:o.code}),o.tail??""]},o.lead))}),n(u,{flexDirection:"column",marginTop:1,children:i.map(o=>a(l,{children:[`${k}${o.lead} `,n(l,{color:w,children:o.code}),o.tail??""]},o.lead))})]}))},Y="#a855f7",oe="#06b6d4",y=[Y,"#9b51f6","#8a5cf6","#6f86f6","#4aa6ef","#2bb6dd","#12bcd0",oe],O=y.length-2,F=(e,r)=>Array.from({length:Math.max(0,e)},()=>r),q=[...F(y.length-1,Y),...y,...F(y.length-1,oe),...y.toReversed()],M=q.map((e,r)=>{const t=q.slice(r,r+O);return[...t,...F(O-t.length,Y)]}),Ae=" ".repeat(Math.max(0,z-O)),ie=({label:e})=>{const[r,t]=S(0);de(()=>{t(o=>(o+1)%M.length)},90);const i=M[r%M.length]??[];return a(l,{children:[Ae,i.map((o,c)=>n(l,{color:o,children:"█"},c)),` ${e}`]})},De=({label:e,status:r})=>r==="running"?n(l,{color:w,children:`${T}▶ ${e}`}):r==="failed"?n(l,{color:"red",children:`${T}✖ ${e}`}):r==="done"?n(l,{dimColor:!0,children:`${T}■ ${e}`}):n(l,{dimColor:!0,children:`${T}□ ${e}`}),Le=async(e,r)=>{const t=[];let i;for(const[o,c]of e.entries()){r(o,"running");try{t.push(await c.run()),r(o,"done")}catch(d){r(o,"failed"),i=d;break}}return{failure:i,results:t}},Pe=(e,r,t,i)=>{let o=!0;return Le(e,(d,s)=>{o&&r(f=>f.map((p,x)=>x===d?s:p))}).then(({failure:d,results:s})=>{setTimeout(()=>{o&&(t(s,d),i())},400)}).catch(()=>{}),()=>{o=!1}},Me=({end:e,onSettle:r,start:t,tasks:i})=>{const{exit:o}=I(),[c,d]=S(()=>i.map(()=>"pending"));A(()=>Pe(i,d,r,o),[o,r,i]);const s=c.length>0&&c.every(f=>f==="done");return a(u,{flexDirection:"column",children:[s?a(u,{children:[n(l,{bold:!0,color:"green",children:`${T}✔`}),n(l,{bold:!0,color:"green",children:` ${e}`})]}):n(ie,{label:t}),i.map((f,p)=>n(De,{label:f.label,status:c[p]??"pending"},f.label))]})},ur=async(e,r)=>{if(!m()){const o=[];for(const c of e)o.push(await c.run());return o}let t=[],i;if(await G(n(Me,{end:r.end,onSettle:(o,c)=>{t=o,i=c},start:r.start,tasks:e})),i!==void 0)throw Q(i);return t},ke=async(e,r)=>{const t=[];let i;for(const[o,c]of e.entries()){r(o);try{t.push(await c.task())}catch(d){i=d;break}}return{failure:i,values:t}},Oe=({badge:e,done:r,onSettle:t,steps:i})=>{const{exit:o}=I(),[c,d]=S(0),[s,f]=S(!1);return A(()=>{let p=!0,x;return ke(i,v=>{p&&d(v)}).then(({failure:v,values:h})=>{if(p){if(v!==void 0){t({error:v,ok:!1}),o();return}f(!0),x=setTimeout(()=>{p&&(t({ok:!0,values:h}),o())},400)}}).catch(()=>{}),()=>{p=!1,x!==void 0&&clearTimeout(x)}},[o,t,i]),s?n($,{badge:e,message:r}):n(ie,{label:i[c]?.running??""})},dr=async(e,r,t)=>{if(!m()){const o=[];for(const c of r)o.push(await c.task());return o}let i;if(await G(n(Oe,{badge:e,done:t,onSettle:o=>{i=o},steps:r})),i===void 0)throw new K;if(!i.ok)throw Q(i.error);return i.values};export{rr as a,Ee as b,nr as c,cr as d,Ze as e,or as f,tr as g,lr as h,sr as i,ar as j,ur as k,dr as l,er as t,ir as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=e=>e.endsWith("S")?e.slice(0,-1):e,d=e=>e.replaceAll(/([a-z\d])([A-Z])/gu,"$1_$2").toUpperCase().split(/[_-]+/u).filter(t=>t.length>0),l=new Set(["CREDENTIAL","DSN","PASSPHRASE","PASSWD","PASSWORD","SECRET","TOKEN"]),S=["ACCESS_KEY","API_KEY","ENCRYPTION_KEY","PRIVATE_KEY","SIGNING_KEY"],m=new RegExp(`(?:${[...l,...S.map(e=>e.replaceAll("_",""))].join("|")})S?$`,"iu"),g=e=>d(e).some(t=>t==="PUBLIC"||t==="PUBLISHABLE"),h=e=>{if(g(e))return!1;const t=d(e);if(t.some(s=>l.has(i(s))))return!0;const r=i(t.join("_"));return S.some(s=>r===s||r.endsWith(`_${s}`))||m.test(e)},x=e=>{switch(e){case"boolean":return"boolean";case"date":case"number":case"timestamp":return"number";case"id":case"literal":case"string":return"string";default:return}},A=/already (?:exists|indexed)|duplicate/iu,u=e=>["vectorize","create-metadata-index",e.index,`--property-name=${e.property}`,`--type=${e.type}`],_=async(e,t)=>{try{return await e(t)}catch(r){return{code:1,stderr:r instanceof Error?r.message:String(r)}}},I=async e=>{const{cwd:t,entries:r,exec:s,logger:E,spawner:p}=e,a=[];for(const n of r){const o=await _(p,{args:[...s.args,...u(n)],captureStderr:!0,command:s.command,cwd:t,stdoutToStderr:!0});if(o.code===0){a.push({entry:n,status:"created"});continue}const c=`${o.stderr??""}${o.stdout??""}`;if(A.test(c)){a.push({entry:n,status:"exists"});continue}a.push({entry:n,error:c.trim()||`exit code ${String(o.code)}`,status:"failed"}),E.warn(`could not create the Vectorize metadata index for "${n.property}" on "${n.index}" — filters on that property will match nothing until it exists. Run: wrangler ${u(n).join(" ")}`)}return a};export{u as c,I as e,h as i,x as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findWranglerFile as a,readWranglerJsonc as t}from"@lunora/config/cloudflare";const i=n=>{const e=a(n);if(!e)return;const{parsed:r}=t(e);return typeof r?.name=="string"&&r.name.length>0?r.name:void 0};export{i as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveDeployDriver as c,resolveProjectTarget as d,execArgsFor as l,detectPackageManager as i}from"@lunora/config";import{defaultSpawner as m}from"./createRecordingSpawner-DJlNacZ6.mjs";const u=async(e,t,o)=>{try{const r=await m({args:t,captureStderr:!0,captureStdoutSilently:!0,command:e,cwd:o});return{code:r.code,stderr:r.stderr??"",stdout:r.stdout??""}}catch(r){return{code:1,stderr:r instanceof Error?r.message:String(r),stdout:""}}},f=e=>{let t;try{t=JSON.parse(e)}catch{return}return Array.isArray(t)?[...t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"&&r.length>0)].toSorted((r,n)=>r.localeCompare(n)):void 0},y=async e=>{const t=c(d(e.cwd)).toolchain?.secretList({environment:e.env,temporary:e.temporary});if(t===void 0)return{error:"deploy target has no command-line toolchain",names:[],ok:!1};const{args:o,command:r}=l(i(e.cwd),t.tool,t.args),a=await(e.runner??u)(r,o,e.cwd);if(a.code!==0)return{error:a.stderr.trim()||`wrangler secret list exited ${String(a.code)}`,names:[],ok:!1};const s=f(a.stdout);return s===void 0?{error:"could not parse `wrangler secret list --format json` output",names:[],ok:!1}:{names:s,ok:!0}};export{y as l};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
4
|
-
"description": "The Lunora CLI: init, dev, deploy, codegen,
|
|
3
|
+
"version": "1.0.0-alpha.220",
|
|
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",
|
|
7
7
|
"cli",
|
|
@@ -51,26 +51,48 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@bomb.sh/tab": "0.0.
|
|
55
|
-
"@lunora/
|
|
56
|
-
"@lunora/
|
|
57
|
-
"@lunora/
|
|
58
|
-
"@lunora/
|
|
59
|
-
"@lunora/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@visulima/
|
|
54
|
+
"@bomb.sh/tab": "0.0.22",
|
|
55
|
+
"@lunora/advisor": "1.0.0-alpha.108",
|
|
56
|
+
"@lunora/bindings": "1.0.0-alpha.47",
|
|
57
|
+
"@lunora/codegen": "1.0.0-alpha.153",
|
|
58
|
+
"@lunora/config": "1.0.0-alpha.187",
|
|
59
|
+
"@lunora/container": "1.0.0-alpha.41",
|
|
60
|
+
"@lunora/d1": "1.0.0-alpha.105",
|
|
61
|
+
"@lunora/errors": "1.0.0-alpha.30",
|
|
62
|
+
"@lunora/mcp": "1.0.0-alpha.108",
|
|
63
|
+
"@lunora/runtime": "1.0.0-alpha.90",
|
|
64
|
+
"@lunora/seed": "1.0.0-alpha.104",
|
|
65
|
+
"@visulima/cerebro": "3.0.6",
|
|
66
|
+
"@visulima/error": "6.1.0",
|
|
67
|
+
"@visulima/fs": "6.0.0",
|
|
68
|
+
"@visulima/pail": "4.1.1",
|
|
69
|
+
"@visulima/path": "4.0.0",
|
|
70
|
+
"@visulima/spinner": "1.0.1",
|
|
71
|
+
"@visulima/tui": "4.0.0",
|
|
72
|
+
"@visulima/tui-kit": "1.0.3",
|
|
73
|
+
"adm-zip": "0.6.0",
|
|
66
74
|
"cfonts": "^3.3.1",
|
|
67
|
-
"
|
|
75
|
+
"csv-parse": "7.0.2",
|
|
76
|
+
"giget": "3.3.1",
|
|
68
77
|
"jsonc-parser": "^3.3.1",
|
|
69
|
-
"magic-string": "^
|
|
70
|
-
"react": "^19.2.
|
|
78
|
+
"magic-string": "^1.1.0",
|
|
79
|
+
"react": "^19.2.8",
|
|
71
80
|
"react-reconciler": "^0.33.0",
|
|
81
|
+
"smol-toml": "1.7.1",
|
|
72
82
|
"ts-morph": "^28.0.0"
|
|
73
83
|
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"mysql2": "*",
|
|
86
|
+
"pg": "*"
|
|
87
|
+
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"mysql2": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"pg": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
74
96
|
"engines": {
|
|
75
97
|
"node": "^22.15.0 || >=24.11.0"
|
|
76
98
|
}
|
package/skills/README.md
CHANGED
|
@@ -9,21 +9,39 @@ framework correctly. They ship inside `@lunora/cli` and are discovered by the
|
|
|
9
9
|
Each skill is a `SKILL.md` with YAML frontmatter (`name`, `description`) in its
|
|
10
10
|
own directory:
|
|
11
11
|
|
|
12
|
-
| Skill
|
|
13
|
-
|
|
|
14
|
-
| `lunora`
|
|
15
|
-
| `lunora-quickstart`
|
|
16
|
-
| `lunora-functions`
|
|
17
|
-
| `lunora-realtime`
|
|
18
|
-
| `lunora-setup-auth`
|
|
19
|
-
| `lunora-setup-mail`
|
|
20
|
-
| `lunora-setup-storage`
|
|
21
|
-
| `lunora-setup-scheduler`
|
|
22
|
-
| `lunora-
|
|
23
|
-
| `lunora-
|
|
24
|
-
| `lunora-
|
|
25
|
-
| `lunora-
|
|
12
|
+
| Skill | Use for |
|
|
13
|
+
| -------------------------------- | ---------------------------------------------------------------------------- |
|
|
14
|
+
| `lunora` | Router — start here, then switch to the matching skill below. |
|
|
15
|
+
| `lunora-quickstart` | `lunora init` / adding Lunora to an app + first round-trip. |
|
|
16
|
+
| `lunora-functions` | Core authoring rules — schema, validators, query/mutation/action, `ctx.db`. |
|
|
17
|
+
| `lunora-realtime` | Client reactivity — live hooks, optimistic updates, `@lunora/db`. |
|
|
18
|
+
| `lunora-setup-auth` | Authentication via `lunora registry add auth` (+ providers). |
|
|
19
|
+
| `lunora-setup-mail` | Transactional email via `lunora registry add mail` — `sendEmail` actions. |
|
|
20
|
+
| `lunora-setup-storage` | R2 file storage via `lunora registry add storage` — signed upload/download. |
|
|
21
|
+
| `lunora-setup-scheduler` | Deferred (`ctx.scheduler`) + cron jobs (`lunora registry add crons`). |
|
|
22
|
+
| `lunora-setup-hyperdrive` | Existing Postgres/MySQL from an action — `ctx.sql`, non-reactive. |
|
|
23
|
+
| `lunora-setup-hyperdrive-global` | Postgres/MySQL as a reactive `.global()` backend; D1 → Hyperdrive migration. |
|
|
24
|
+
| `lunora-create-package` | Building a reusable registry item or `@lunora/*` package. |
|
|
25
|
+
| `lunora-migration-helper` | Schema/data migrations, `.global()` DDL flow, the drift gate. |
|
|
26
|
+
| `lunora-deploy` | Deploying to Cloudflare — wrangler bindings, secrets, the gate. |
|
|
27
|
+
| `lunora-performance-audit` | `lunora insights`, scans, indexes, OCC conflicts, sharding/`.global()`. |
|
|
26
28
|
|
|
27
|
-
These are mirrored into `.agents/skills/` and `.claude/skills
|
|
28
|
-
so agents working inside this repo pick them up directly
|
|
29
|
-
|
|
29
|
+
These are mirrored (via symlinks) into `.agents/skills/` and `.claude/skills/`,
|
|
30
|
+
so agents working inside this repo pick them up directly, and into
|
|
31
|
+
`plugins/lunora/skills/`, the payload of the Claude Code / Codex plugin. The
|
|
32
|
+
source of truth lives here so the published `@lunora/cli` tarball carries them —
|
|
33
|
+
`lunora rules install` copies this directory into a consumer project.
|
|
34
|
+
|
|
35
|
+
**Adding a skill?** Create it here, then mirror it through all three hops:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ln -s ../../packages/cli/skills/<name> .agents/skills/<name>
|
|
39
|
+
ln -s ../../.agents/skills/<name> .claude/skills/<name>
|
|
40
|
+
ln -s ../../../packages/cli/skills/<name> plugins/lunora/skills/<name>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`scripts/check-skill-mirrors.js` (run on every `pnpm install`) fails if a mirror
|
|
44
|
+
is missing, dangling, or has become a real directory — a copied directory keeps
|
|
45
|
+
resolving while it silently drifts from the source, so it is treated as an
|
|
46
|
+
error rather than a warning. Forget a hop and it prints the exact `ln -s` for
|
|
47
|
+
the one you missed, so `pnpm install` is the shortest path to the right command.
|
package/skills/lunora/SKILL.md
CHANGED
|
@@ -14,8 +14,9 @@ Lunora exposes a Convex-style functional API (`defineSchema`, `query`,
|
|
|
14
14
|
`mutation`, `action`) on top of Cloudflare Workers and Durable Objects. State
|
|
15
15
|
lives in a per-app `ShardDO` (SQLite, OCC, hibernated WebSocket subscriptions)
|
|
16
16
|
by default; `.shardBy(key)` partitions it across many DOs and `.global()`
|
|
17
|
-
replicates a table to D1
|
|
18
|
-
drives codegen and end-to-end
|
|
17
|
+
replicates a table to D1 — or to Postgres/MySQL over Hyperdrive — for
|
|
18
|
+
low-latency cross-region reads. A Vite plugin drives codegen and end-to-end
|
|
19
|
+
type sync.
|
|
19
20
|
|
|
20
21
|
If a more specific Lunora skill clearly matches the request, use that instead.
|
|
21
22
|
|
|
@@ -47,12 +48,13 @@ After codegen is green, use the most specific Lunora skill for the task:
|
|
|
47
48
|
- Wiring live data into a client (hooks, optimistic updates): `lunora-realtime`
|
|
48
49
|
- Authentication setup (email/password, OAuth, magic link, OTP):
|
|
49
50
|
`lunora-setup-auth`
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
- Transactional email: `lunora-setup-mail`
|
|
52
|
+
- R2 file storage (signed upload/download): `lunora-setup-storage`
|
|
53
|
+
- Deferred work (`ctx.scheduler`) and cron jobs: `lunora-setup-scheduler`
|
|
54
|
+
- Querying an **existing** Postgres/MySQL database from an action (`ctx.sql`,
|
|
55
|
+
non-reactive): `lunora-setup-hyperdrive`
|
|
56
|
+
- Using Postgres/MySQL as a **reactive `.global()` backend**, or migrating a D1
|
|
57
|
+
`.global()` dataset onto it: `lunora-setup-hyperdrive-global`
|
|
56
58
|
- Building a reusable capability — a registry item or an `@lunora/*` package:
|
|
57
59
|
`lunora-create-package`
|
|
58
60
|
- Planning or running a schema/data migration: `lunora-migration-helper`
|
|
@@ -61,9 +63,61 @@ After codegen is green, use the most specific Lunora skill for the task:
|
|
|
61
63
|
- Investigating performance, scan, or write-conflict issues:
|
|
62
64
|
`lunora-performance-audit`
|
|
63
65
|
|
|
66
|
+
**Reviewing or auditing existing `lunora/` code** has no skill of its own,
|
|
67
|
+
because two commands do the work mechanically — run them before reading
|
|
68
|
+
anything:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
lunora verify # wrangler config + codegen dry-run + tsc --noEmit
|
|
72
|
+
lunora advisor # the static + runtime lint set, scored per procedure
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`lunora advisor` is the security/quality review: RLS coverage, ownership and
|
|
76
|
+
identity checks, fail-open guards, input validators, unindexed reads,
|
|
77
|
+
non-deterministic calls in queries, SQL interpolation, and leaked secrets. It
|
|
78
|
+
prints each finding's own lint id and category, so read its output rather than
|
|
79
|
+
grepping for rule names. Use `--entry <file>#<export>` to inspect one procedure
|
|
80
|
+
and `--min-score` / `--baseline` to gate CI. Only after it is clean is a by-hand
|
|
81
|
+
pass over `lunora-functions` worth the tokens.
|
|
82
|
+
|
|
64
83
|
If one of those clearly matches the user's goal, switch to it instead of staying
|
|
65
84
|
in this skill.
|
|
66
85
|
|
|
86
|
+
## Capabilities Without a Dedicated Skill
|
|
87
|
+
|
|
88
|
+
Most other capabilities install as a **registry item** — `lunora registry add
|
|
89
|
+
<item>` scaffolds the `lunora/` glue, wrangler bindings, and env vars, then
|
|
90
|
+
prints post-install steps. Browse with `lunora registry list`; preview with
|
|
91
|
+
`lunora registry view <item>`. Read the installed item's README, and the
|
|
92
|
+
package's `docs/` for the API.
|
|
93
|
+
|
|
94
|
+
| Goal | Install / package |
|
|
95
|
+
| --------------------------------------------- | ------------------------------------------------------------ |
|
|
96
|
+
| Background jobs on Cloudflare Queues | `registry add queue` → `@lunora/queue` (`ctx.queues`) |
|
|
97
|
+
| Durable multi-step workflows | `registry add workflow` → `@lunora/workflow` (`ctx.runStep`) |
|
|
98
|
+
| Durable AI agents (tool loops, HITL, memory) | `@lunora/agent` (`defineAgent`) |
|
|
99
|
+
| Workers AI / RAG | `registry add ai` → `@lunora/ai` (`ctx.ai`, `defineRag`) |
|
|
100
|
+
| Feature flags (OpenFeature) | `registry add flags` → `@lunora/flags` (`ctx.flags`) |
|
|
101
|
+
| Payments (Stripe / Polar) | `registry add payment` → `@lunora/payment` |
|
|
102
|
+
| Rate limiting | `registry add ratelimit` → `@lunora/ratelimit` |
|
|
103
|
+
| Headless browser (action-only) | `registry add browser` → `@lunora/browser` (`ctx.browser`) |
|
|
104
|
+
| Cloudflare Containers | `@lunora/container` (`defineContainer`, `ctx.containers`) |
|
|
105
|
+
| Presence / who's-here | `registry add presence` |
|
|
106
|
+
| Cloudflare Access (Zero Trust) identity | `registry add cloudflare-access` |
|
|
107
|
+
| Backup / restore | `registry add backup` |
|
|
108
|
+
| Testing (in-memory harness, agent doubles) | `@lunora/testing` (`lunoraTest`) |
|
|
109
|
+
| Deterministic seed data | `@lunora/seed` + `lunora seed` |
|
|
110
|
+
| Local-first replica / offline mirror | `@lunora/replica` |
|
|
111
|
+
| Exposing the deployment to AI agents over MCP | `@lunora/mcp` |
|
|
112
|
+
|
|
113
|
+
Scaffolding inside this repo uses `vis generate lunora-<kind>` — `query`,
|
|
114
|
+
`mutation`, `action`, `http-route`, `table`, `cron`, `container`, `workflow`,
|
|
115
|
+
`queue`, `step`, `agent`, `flags`, `collections`, `package` (`vis generate
|
|
116
|
+
--list` for the full set). Most take a name: **always** pass it as
|
|
117
|
+
`--name=value`, since vis parses a space-separated `--name foo` as `--name=true`
|
|
118
|
+
plus a stray positional. `lunora-flags` and `lunora-collections` are singletons
|
|
119
|
+
and take no name.
|
|
120
|
+
|
|
67
121
|
## Core Mental Model
|
|
68
122
|
|
|
69
123
|
- **Functions** live in `lunora/*.ts` and are one of `query` (reactive read),
|
|
@@ -75,7 +129,9 @@ in this skill.
|
|
|
75
129
|
- **Reads go through indexes.** Prefer `ctx.db.query("t").withIndex(...)` over
|
|
76
130
|
`.filter(...)`; declare the index with `.index("by_x", ["x"])`.
|
|
77
131
|
- **Clients** subscribe over WebSocket. `useQuery`/`useMutation` (React, Vue,
|
|
78
|
-
Solid, Svelte) re-render the moment a
|
|
132
|
+
Solid, Svelte, React Native; signals in Angular) re-render the moment a
|
|
133
|
+
mutation changes the queried rows. Subscriptions run under the socket's
|
|
134
|
+
verified identity, so `rls()` / `ctx.auth` apply to live updates too.
|
|
79
135
|
|
|
80
136
|
## When Not to Use
|
|
81
137
|
|
|
@@ -29,9 +29,16 @@ D1 database, R2 buckets, and secrets — so the work is mostly making
|
|
|
29
29
|
|
|
30
30
|
`lunora deploy` runs a fixed pipeline:
|
|
31
31
|
|
|
32
|
-
1. **Codegen** — regenerates `lunora/_generated
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
1. **Codegen** — regenerates `lunora/_generated/`. It does **not** run
|
|
33
|
+
`tsc`: nothing in the deploy pipeline type-checks, and wrangler/esbuild
|
|
34
|
+
strips types, so a project with a TS error deploys. Run `lunora verify`
|
|
35
|
+
(which does run `tsc --noEmit`) as the CI type gate before this.
|
|
36
|
+
2. **Validate `wrangler.jsonc`** — a `compatibility_date` at or past the
|
|
37
|
+
minimum the runtime needs, the `SHARD` Durable Object binding and its
|
|
38
|
+
SQLite migration tag, and the shape of every declared binding. It does
|
|
39
|
+
**not** check `compatibility_flags`: `nodejs_compat` is what every
|
|
40
|
+
template ships and what dependencies reaching for `node:` builtins need,
|
|
41
|
+
but no Lunora package requires it, so nothing fails when it is missing.
|
|
35
42
|
3. **Schema-drift gate** — blocks if the committed baseline
|
|
36
43
|
(`lunora/.lunora-schema.json`) drifted with a breaking change and no
|
|
37
44
|
accompanying migration. The baseline is re-blessed only after the deploy
|
|
@@ -40,9 +47,23 @@ D1 database, R2 buckets, and secrets — so the work is mostly making
|
|
|
40
47
|
images).
|
|
41
48
|
|
|
42
49
|
Useful flags: `--env <name>` (Cloudflare environment), `--migrate` (run pending
|
|
43
|
-
data migrations against the live worker after deploy,
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
data migrations against the live worker after deploy), `--allow-schema-drift`
|
|
51
|
+
(override the gate — use sparingly), and `--update-schema-baseline` (re-bless
|
|
52
|
+
the baseline with the current shape).
|
|
53
|
+
|
|
54
|
+
`--migrate` has three hard requirements, checked **before** `wrangler deploy`,
|
|
55
|
+
so missing one aborts the whole deploy rather than skipping the migration:
|
|
56
|
+
|
|
57
|
+
- `--migrate-yes` — confirms running production data migrations. Always
|
|
58
|
+
required; there is no environment variable for it.
|
|
59
|
+
- `--migrate-url <https://…>` — the deploy target URL is only known after
|
|
60
|
+
wrangler runs, so it cannot be inferred. Omit it only when the checkout is
|
|
61
|
+
linked (`lunora link`) for this same `--env`.
|
|
62
|
+
- an admin token — `--migrate-token` or `LUNORA_ADMIN_TOKEN`.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
lunora deploy --migrate --migrate-yes --migrate-url https://app.example.com
|
|
66
|
+
```
|
|
46
67
|
|
|
47
68
|
## Preflight: `lunora doctor`
|
|
48
69
|
|
|
@@ -119,10 +140,19 @@ before the first request hits production.
|
|
|
119
140
|
- **Production:** `lunora deploy`. Separate D1 database / R2 buckets / secrets
|
|
120
141
|
from dev. Never point a dev worker at prod resources.
|
|
121
142
|
|
|
122
|
-
For `.global()` table DDL,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
For `.global()` table DDL, `lunora migrate generate` emits a reviewable SQL
|
|
144
|
+
file — but **no command applies it**, `lunora deploy` included. What actually
|
|
145
|
+
provisions a global table is the runtime, from the schema rather than from the
|
|
146
|
+
file: on first use it runs `CREATE TABLE IF NOT EXISTS` plus additive
|
|
147
|
+
`ADD COLUMN`, so additive changes land whether or not the file exists.
|
|
148
|
+
Anything the generator cannot express — a backfilling `UPDATE`, a rename
|
|
149
|
+
written as add/copy/drop, an index the schema does not declare — must be
|
|
150
|
+
applied by hand:
|
|
151
|
+
`wrangler d1 execute <DB> --remote --file=lunora/migrations/<file>.sql`. The
|
|
152
|
+
file is multi-statement, so it is not a `@lunora/d1` `Migration` either.
|
|
153
|
+
For data backfills, deploy first, then `lunora deploy --migrate --migrate-yes
|
|
154
|
+
--migrate-url <url>` (or `lunora migrate up --prod`). See
|
|
155
|
+
`lunora-migration-helper`.
|
|
126
156
|
|
|
127
157
|
## Common Pitfalls
|
|
128
158
|
|
|
@@ -147,4 +177,5 @@ secret put` for every prod secret.
|
|
|
147
177
|
- [ ] DO + container `class_name`s exported by the worker entry.
|
|
148
178
|
- [ ] Production secrets set via `wrangler secret put`.
|
|
149
179
|
- [ ] Schema changes migrated; the drift gate is green (no `--allow-schema-drift`).
|
|
150
|
-
- [ ] `lunora deploy` succeeded; `--migrate
|
|
180
|
+
- [ ] `lunora deploy` succeeded; `--migrate --migrate-yes --migrate-url <url>` run
|
|
181
|
+
if data backfills were pending.
|
|
@@ -70,15 +70,22 @@ Each function declares its inputs with `.input(...)` (a `v.*` map) and ends with
|
|
|
70
70
|
terminal `.query` / `.mutation` / `.action` handler. Export them as named
|
|
71
71
|
consts from `lunora/*.ts`; codegen surfaces them as `api.<file>.<name>`.
|
|
72
72
|
|
|
73
|
-
| Kind | Reads `ctx.db`
|
|
74
|
-
| ---------- |
|
|
75
|
-
| `query` | yes
|
|
76
|
-
| `mutation` | yes
|
|
77
|
-
| `action` |
|
|
73
|
+
| Kind | Reads `ctx.db` | Writes `ctx.db` | Side effects / `fetch` | Reactive |
|
|
74
|
+
| ---------- | -------------- | ------------------- | ---------------------- | -------- |
|
|
75
|
+
| `query` | yes | no | no | yes |
|
|
76
|
+
| `mutation` | yes | yes, transactional | no | — |
|
|
77
|
+
| `action` | yes | yes, autocommitting | yes | — |
|
|
78
|
+
|
|
79
|
+
The builders are **generated**, not imported from `@lunora/server`: codegen binds
|
|
80
|
+
them to your schema, so `ctx.db`, `v.id("channels")`, and index names are all
|
|
81
|
+
typed. `@lunora/server` exports the schema/HTTP/validator surface and
|
|
82
|
+
`LunoraError`, never `query` / `mutation` / `action`.
|
|
78
83
|
|
|
79
84
|
```ts
|
|
80
|
-
import
|
|
81
|
-
|
|
85
|
+
import { LunoraError } from "lunorash/server";
|
|
86
|
+
|
|
87
|
+
import type { Id } from "#lunora/_generated/server.js";
|
|
88
|
+
import { action, mutation, query, v } from "#lunora/_generated/server.js";
|
|
82
89
|
|
|
83
90
|
// `api` / `internal` come from codegen:
|
|
84
91
|
// import { api, internal } from "./_generated/api";
|
|
@@ -112,8 +119,12 @@ export const notifySlack = action.input({ messageId: v.id("messages") }).action(
|
|
|
112
119
|
|
|
113
120
|
- **Pick the right kind.** Reactive read → `query`. Transactional write →
|
|
114
121
|
`mutation`. External I/O (`fetch`, third-party SDKs, calling other functions)
|
|
115
|
-
→ `action`. An action has
|
|
116
|
-
|
|
122
|
+
→ `action`. An action has a `ctx.db`, but its own writes are not
|
|
123
|
+
transactional: each autocommits as it runs, so a later throw rolls nothing
|
|
124
|
+
back. Reach data through `ctx.runQuery` / `ctx.runMutation` — a mutation
|
|
125
|
+
called that way runs in the same all-or-nothing transaction a top-level one
|
|
126
|
+
gets, so put every write that has to land together in ONE mutation rather
|
|
127
|
+
than sequencing several from the action.
|
|
117
128
|
- **`internal*` variants** (`internalQuery`, `internalMutation`,
|
|
118
129
|
`internalAction`) are not exposed to clients — use them for server-only logic
|
|
119
130
|
called from actions, crons, or other functions.
|
|
@@ -150,24 +161,76 @@ Declare the index and constrain with `.withIndex`.
|
|
|
150
161
|
|
|
151
162
|
## Other `ctx` capabilities
|
|
152
163
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
Always available:
|
|
165
|
+
|
|
166
|
+
- `ctx.auth` — the resolved session (`ctx.auth.userId`).
|
|
167
|
+
- `ctx.scheduler` — `runAfter` / `runAt` for deferred work.
|
|
168
|
+
- `ctx.secrets` — Cloudflare Secrets Store.
|
|
169
|
+
- `ctx.span` / `ctx.trace` — the current span and a scoped tracing helper for
|
|
170
|
+
wide events.
|
|
171
|
+
|
|
172
|
+
Added by their package when wired. **A dependency in `package.json` is not
|
|
173
|
+
enough** — codegen scans the `lunora/` source set and flips a capability on only
|
|
174
|
+
when a file there imports the `@lunora/*` package or reads its `ctx.*` helper.
|
|
175
|
+
So write the call first, then run `lunora codegen` to surface the typed context:
|
|
176
|
+
|
|
177
|
+
| `ctx.*` | Package |
|
|
178
|
+
| ----------------------------------------------------------------------------------------- | ----------------------------- |
|
|
179
|
+
| `ctx.storage` | `@lunora/storage` (R2) |
|
|
180
|
+
| `ctx.ai` | `@lunora/ai` (Workers AI) |
|
|
181
|
+
| `ctx.flags` | `@lunora/flags` (OpenFeature) |
|
|
182
|
+
| `ctx.queues.<name>` | `@lunora/queue` |
|
|
183
|
+
| `ctx.workflows` / `ctx.runStep` | `@lunora/workflow` |
|
|
184
|
+
| `ctx.containers` | `@lunora/container` |
|
|
185
|
+
| `ctx.browser` (action-only) | `@lunora/browser` |
|
|
186
|
+
| `ctx.sql` (action-only) | `@lunora/hyperdrive` |
|
|
187
|
+
| `ctx.kv` / `ctx.images` / `ctx.analytics` / `ctx.pipelines` / `ctx.vectors` / `ctx.r2sql` | `@lunora/bindings` subpaths |
|
|
188
|
+
|
|
189
|
+
Two exceptions to the usage scan, and one extra requirement:
|
|
190
|
+
|
|
191
|
+
- **`ctx.flags` gates on a declaration file**, not on usage — codegen wires it
|
|
192
|
+
only when `lunora/flags.ts` exists (`vis generate lunora-flags` creates it).
|
|
193
|
+
`ctx.notify` / `ctx.push` work the same way via `lunora/notify.ts`.
|
|
194
|
+
- **`ctx.sql` also needs the real resource.** Codegen types the field, but the
|
|
195
|
+
connection needs a `HYPERDRIVE` binding (`wrangler hyperdrive create`) and an
|
|
196
|
+
explicit `createHyperdrive(ctx.env.HYPERDRIVE)` + driver adapter in the
|
|
197
|
+
action — see `lunora-setup-hyperdrive`. Bindings codegen can provision on its
|
|
198
|
+
own (e.g. `BROWSER` for `ctx.browser`) need no manual wrangler step.
|
|
199
|
+
|
|
200
|
+
`ctx.browser` and `ctx.sql` are **action-only** by design. They are external,
|
|
201
|
+
non-deterministic I/O: a query is re-run on every subscription re-evaluation, so
|
|
202
|
+
a non-deterministic read makes reactivity wrong, and a mutation's writes are
|
|
203
|
+
transactional — a rollback cannot un-send a network call.
|
|
156
204
|
|
|
157
205
|
## HTTP endpoints
|
|
158
206
|
|
|
159
207
|
For webhooks or non-RPC HTTP, use `httpRouter` / `httpRoute` + `httpAction`:
|
|
160
208
|
|
|
209
|
+
`httpRouter()` takes **no arguments** — it returns a [Hono](https://hono.dev)
|
|
210
|
+
app you mount routes on, and you export the app. Passing it a routes object is a
|
|
211
|
+
type error (`Expected 0 arguments`), and from untyped code the routes simply
|
|
212
|
+
never mount.
|
|
213
|
+
|
|
161
214
|
```ts
|
|
215
|
+
// lunora/http.ts
|
|
162
216
|
import { httpAction, httpRouter } from "@lunora/server";
|
|
163
217
|
|
|
164
|
-
|
|
165
|
-
|
|
218
|
+
import { internal } from "./_generated/api";
|
|
219
|
+
|
|
220
|
+
const app = httpRouter();
|
|
221
|
+
|
|
222
|
+
app.post(
|
|
223
|
+
"/webhooks/stripe",
|
|
224
|
+
httpAction(async (ctx, request) => {
|
|
166
225
|
const event = await request.json();
|
|
226
|
+
|
|
167
227
|
await ctx.runMutation(internal.billing.record, { event });
|
|
228
|
+
|
|
168
229
|
return new Response("ok");
|
|
169
230
|
}),
|
|
170
|
-
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
export default app;
|
|
171
234
|
```
|
|
172
235
|
|
|
173
236
|
## Checklist
|