@forinda/kickjs-cli 8.14.8 → 8.15.0

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 (38) hide show
  1. package/dist/{agent-docs-BLpdFCWy.mjs → agent-docs-CrVQtJgn.mjs} +2 -2
  2. package/dist/{agent-docs-c9x_je96.mjs → agent-docs-D7K6R5C3.mjs} +3 -3
  3. package/dist/{agent-docs-c9x_je96.mjs.map → agent-docs-D7K6R5C3.mjs.map} +1 -1
  4. package/dist/{build-cXg5ZlrG.mjs → build-Czsf4CBN.mjs} +2 -2
  5. package/dist/{build-Ch7Mu-zN.mjs → build-gqxIH3D8.mjs} +3 -3
  6. package/dist/{build-Ch7Mu-zN.mjs.map → build-gqxIH3D8.mjs.map} +1 -1
  7. package/dist/{builtins-Cj-H0MpD.mjs → builtins-6euI1-lN.mjs} +2 -2
  8. package/dist/{builtins-1iFKUPC8.mjs → builtins-xahWxQLw.mjs} +25 -25
  9. package/dist/cli.mjs +2 -2
  10. package/dist/{config-LzGMuzP3.mjs → config-8jdSKLKJ.mjs} +3 -3
  11. package/dist/{config-LzGMuzP3.mjs.map → config-8jdSKLKJ.mjs.map} +1 -1
  12. package/dist/{config-DJ3Yuos3.mjs → config-DCM2vXUJ.mjs} +2 -2
  13. package/dist/{doctor-hrYL914U.mjs → doctor-CwGU9orm.mjs} +4 -4
  14. package/dist/{doctor-hrYL914U.mjs.map → doctor-CwGU9orm.mjs.map} +1 -1
  15. package/dist/{fullstack-BDk2Min0.mjs → fullstack-9HywHQL-.mjs} +4 -4
  16. package/dist/{fullstack-BDk2Min0.mjs.map → fullstack-9HywHQL-.mjs.map} +1 -1
  17. package/dist/{fullstack-DOx3kvFi.mjs → fullstack-BmIFnryN.mjs} +3 -3
  18. package/dist/index.mjs +2 -2
  19. package/dist/{package-manager-W-gJGan_.mjs → package-manager-9XxrErw1.mjs} +2 -2
  20. package/dist/{package-manager-DMNCUv5Z.mjs → package-manager-Dwaolesm.mjs} +3 -3
  21. package/dist/{package-manager-DMNCUv5Z.mjs.map → package-manager-Dwaolesm.mjs.map} +1 -1
  22. package/dist/{plugin-DmerIwIH.mjs → plugin-BjmLRF7t.mjs} +2 -2
  23. package/dist/{plugin-h1RvCxk1.mjs → plugin-DLZP4hZ0.mjs} +2 -2
  24. package/dist/{project-CXcAR-tR.mjs → project-CFi3NvO9.mjs} +5 -5
  25. package/dist/{project-CXcAR-tR.mjs.map → project-CFi3NvO9.mjs.map} +1 -1
  26. package/dist/{project-BhLkKHOD.mjs → project-CO0D8B0V.mjs} +4 -4
  27. package/dist/{project-root-DQwgpeEX.mjs → project-root-8DH00M-b.mjs} +2 -2
  28. package/dist/{project-root-DBTLa3ee.mjs → project-root-Dk8r8FMi.mjs} +3 -3
  29. package/dist/{project-root-DBTLa3ee.mjs.map → project-root-Dk8r8FMi.mjs.map} +1 -1
  30. package/dist/{rolldown-runtime-UeWuLvbj.mjs → rolldown-runtime-CRasMkPY.mjs} +1 -1
  31. package/dist/{run-plugins-CajtgfCU.mjs → run-plugins-R0bVf_nK.mjs} +26 -26
  32. package/dist/run-plugins-R0bVf_nK.mjs.map +1 -0
  33. package/dist/{typegen-BsYWuduu.mjs → typegen-BZ8cQ1YM.mjs} +5 -5
  34. package/dist/{typegen-BsYWuduu.mjs.map → typegen-BZ8cQ1YM.mjs.map} +1 -1
  35. package/dist/{typegen-DmSQleE5.mjs → typegen-DNufBmjE.mjs} +4 -4
  36. package/dist/{types-CX1RqHCf.mjs → types-DOcxTXlP.mjs} +1 -1
  37. package/package.json +3 -3
  38. package/dist/run-plugins-CajtgfCU.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.8
2
+ * @forinda/kickjs-cli v8.15.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{f as e,o as t,r as n}from"./config-DJ3Yuos3.mjs";import{_ as r,i,n as a,r as o}from"./package-manager-W-gJGan_.mjs";import{existsSync as s,readFileSync as c,readdirSync as l,statSync as u,writeFileSync as d}from"node:fs";import{dirname as f,join as p,posix as m,relative as h,resolve as g,sep as _}from"node:path";import{fileURLToPath as v}from"node:url";import{execFile as y,execFileSync as b,execSync as x,spawnSync as S}from"node:child_process";import{promisify as C}from"node:util";import{randomBytes as ee}from"node:crypto";import{parseSync as w}from"oxc-parser";const T=C(y),E=/[&|<>^"'`(){}[\];!%\r\n\\]/;function D(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(E.test(e)||t.some(e=>E.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function O(e,t,n={}){let r=D(e,t);if(!r)return null;try{return b(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function k(e,t,n={}){let r=D(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);b(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function te(e,t,n){x(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function ne(e,t,n){let r=S(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function re(e,t,n={}){let r=D(e,t);if(!r)return null;try{let{stdout:e}=await T(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const ie=f(v(import.meta.url)),A=[p(ie,`..`,`templates`),p(ie,`..`,`..`,`templates`)].find(e=>s(p(e,`base`)));function ae(e){return e.split(`/`).map(e=>e.startsWith(`_dot_`)?`.${e.slice(5)}`:e).join(`/`)}function j(e,t={}){let n=t.templatesDir??A,r=/* @__PURE__ */ new Map,i=[],a=[],o={},d=[],f={};for(let t of e){let e=p(n,t);if(!s(e))throw Error(`Unknown scaffold layer "${t}" (${e})`);let m=p(e,`feature.json`);if(s(m)){let e=JSON.parse(c(m,`utf-8`));i.push(...e.dependencies??[]),a.push(...e.devDependencies??[]),Object.assign(o,e.builds),d.push(...e.integrations??[]),Object.assign(f,e.scripts)}let h=p(e,`files`);if(s(h))for(let e of l(h,{recursive:!0,encoding:`utf-8`}).toSorted()){let t=p(h,e);if(!u(t).isFile())continue;let n=c(t,`utf-8`),i=ae(e.split(_).join(`/`));if(i.endsWith(`.append`)){let e=i.slice(0,-7);r.set(e,(r.get(e)??``)+n)}else r.set(i,n)}}d.push(...t.extra??[]);let m=t.vars??{},h=e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>m[t]??e);for(let[e,t]of r)t.includes(`// @kick:`)&&r.set(e,oe(t,d,h));return{files:r,dependencies:[...new Set(i)],devDependencies:[...new Set(a)].filter(e=>!i.includes(e)),builds:o,integrations:d,scripts:f}}function M(e,t){let n=e=>e.replace(/\{\{(\w+)\}\}/g,(e,n)=>n in t?t[n]:e);return new Map([...e].map(([e,t])=>[e,n(t)]))}const N=/^([ \t]*)\/\/ @kick:([\w-]+)[ \t]*$/;function oe(e,t,n=e=>e){let r=e.split(`
11
+ import{f as e,o as t,r as n}from"./config-DCM2vXUJ.mjs";import{_ as r,i,n as a,r as o}from"./package-manager-9XxrErw1.mjs";import{existsSync as s,readFileSync as c,readdirSync as l,statSync as u,writeFileSync as d}from"node:fs";import{dirname as f,join as p,posix as m,relative as h,resolve as g,sep as _}from"node:path";import{fileURLToPath as v}from"node:url";import{execFile as y,execFileSync as b,execSync as x,spawnSync as S}from"node:child_process";import{promisify as C}from"node:util";import{randomBytes as ee}from"node:crypto";import{parseSync as w}from"oxc-parser";const T=C(y),E=/[&|<>^"'`(){}[\];!%\r\n\\]/;function D(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(E.test(e)||t.some(e=>E.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function O(e,t,n={}){let r=D(e,t);if(!r)return null;try{return b(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function k(e,t,n={}){let r=D(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);b(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function te(e,t,n){x(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function ne(e,t,n){let r=S(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function re(e,t,n={}){let r=D(e,t);if(!r)return null;try{let{stdout:e}=await T(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const ie=f(v(import.meta.url)),A=[p(ie,`..`,`templates`),p(ie,`..`,`..`,`templates`)].find(e=>s(p(e,`base`)));function ae(e){return e.split(`/`).map(e=>e.startsWith(`_dot_`)?`.${e.slice(5)}`:e).join(`/`)}function j(e,t={}){let n=t.templatesDir??A,r=/* @__PURE__ */ new Map,i=[],a=[],o={},d=[],f={};for(let t of e){let e=p(n,t);if(!s(e))throw Error(`Unknown scaffold layer "${t}" (${e})`);let m=p(e,`feature.json`);if(s(m)){let e=JSON.parse(c(m,`utf-8`));i.push(...e.dependencies??[]),a.push(...e.devDependencies??[]),Object.assign(o,e.builds),d.push(...e.integrations??[]),Object.assign(f,e.scripts)}let h=p(e,`files`);if(s(h))for(let e of l(h,{recursive:!0,encoding:`utf-8`}).toSorted()){let t=p(h,e);if(!u(t).isFile())continue;let n=c(t,`utf-8`),i=ae(e.split(_).join(`/`));if(i.endsWith(`.append`)){let e=i.slice(0,-7);r.set(e,(r.get(e)??``)+n)}else r.set(i,n)}}d.push(...t.extra??[]);let m=t.vars??{},h=e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>m[t]??e);for(let[e,t]of r)t.includes(`// @kick:`)&&r.set(e,oe(t,d,h));return{files:r,dependencies:[...new Set(i)],devDependencies:[...new Set(a)].filter(e=>!i.includes(e)),builds:o,integrations:d,scripts:f}}function M(e,t){let n=e=>e.replace(/\{\{(\w+)\}\}/g,(e,n)=>n in t?t[n]:e);return new Map([...e].map(([e,t])=>[e,n(t)]))}const N=/^([ \t]*)\/\/ @kick:([\w-]+)[ \t]*$/;function oe(e,t,n=e=>e){let r=e.split(`
12
12
  `),i=new Set(r.map(e=>N.exec(e)?.[2]).filter(Boolean)),a=t.filter(e=>!e.slot||i.has(e.slot)),o=[],s=-1;for(let e=0;e<r.length;e++){let t=N.exec(r[e]);if(!t){o.push(r[e]);continue}let[,i,c]=t;if(c===`imports`){s=o.length;continue}let l=a.filter(e=>e.slot===c&&e.code).map(e=>se(`${n(e.code)},`,i));l.length>0?o.push(...l):o.at(-1)?.trimEnd().endsWith(`[`)&&r[e+1]?.trim().startsWith(`]`)&&(o.pop(),e++)}if(s>=0){let e=e=>RegExp(`(?<![\\w$])${e.replace(/\$/g,`\\$`)}(?![\\w$])`),t=o.join(`
13
13
  `),n=/^import\b[^;]*?\bfrom\s*['"][^'"]+['"]/gm,r=(t.match(n)??[]).join(`
14
14
  `),i=t.replace(n,``),c=t=>e(t).test(i)&&!e(t).test(r),l=a.flatMap(e=>{if(!e.import)return[];let{names:t,default:n,from:r}=e.import,i={from:r,names:t?.filter(c),default:n&&c(n)?n:void 0};return i.names?.length||i.default?[i]:[]});o.splice(s,0,...ce(l))}return o.join(`
@@ -127,8 +127,8 @@ CMD ["node", "dist/index.js"]
127
127
  `),console.log(Ye(l).replace(/^/gm,` `)),console.log())}}C?console.log(` Done!
128
128
  `):(console.log(` Finished with errors — the install above did not complete.
129
129
  `),process.exitCode=1)})}const ct=f(v(import.meta.url));function lt(t){return{kick:n(t,`kick`),runDev:e(t,`dev`),runBuild:e(t,`build`),runStart:e(t,`start`),runTest:e(t,`test`)}}const Q=JSON.parse(c([p(ct,`..`,`package.json`),p(ct,`..`,`..`,`package.json`)].find(s),`utf-8`)),ut=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`],dt={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`,cap:`^17`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function ft(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function pt(e){return e===`@forinda/kickjs-cli`?`^${Q.version}`:`latest`}async function mt(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function $(){let e=[...ut.map(e=>({name:e,fallback:pt(e),cap:void 0})),...Object.entries(dt).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await mt(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=ft(await re(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function ht(e,t){let n=O(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function gt(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function _t(e,t){let n=e=>gt(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}const vt=Q.version;async function yt(){let e=ft(await re(`npm`,[`view`,`@forinda/kickjs-cli`,`version`],{timeout:5e3}));return e&&bt(vt,e)?e:null}function bt(e,t){return e.split(`-`)[0]===t.split(`-`)[0]?e.includes(`-`)&&!t.includes(`-`):!_t(e,t)}function xt(e,t,n){let r=O(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function St(t){let{name:i,directory:a,packageManager:o=`pnpm`,template:c=`rest`,defaultRepo:l=`inmemory`,packages:u=[],schemaLib:d=`zod`,runtime:f=`express`}=t,m=a,h=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${i}\n`),t.versions||h(`Resolving package versions...`);let g=t.versions??await $(),_=Object.keys(g).filter(e=>g[e]===`latest`);if(_.length>0&&h(`WARNING: could not reach npm for ${_.join(`, `)} — pinned to 'latest'`),f!==`express`){if(xt(`@forinda/kickjs`,`latest`,`./${f}`))h(`Using @forinda/kickjs@latest (stable ships the ${f} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=ht(r,`alpha`);e&&_t(e,gt(g[r]))&&(g[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}h(n?`Using the alpha channel for the ${f} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${f} runtime subpath may be missing. After install, run: ${o} add @forinda/kickjs@alpha`)}}let v=u.filter(e=>!s(p(A,`feature-${e}`)));v.length>0&&h(`WARNING: skipping unknown package(s): ${v.join(`, `)} — add them later with kick add`);let y=j([...Tt({template:c,runtime:f,schemaLib:d,packages:u}),...t.extraLayers??[]],{vars:{name:i,version:Q.version},extra:[{slot:`repo`,code:l===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${l.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...t.spaClientDir?[wt(t.spaClientDir)]:[]]}),b=t.platformConfig===!1?void 0:F(o);await r(p(m,`package.json`),fe(i,g,y,b));let S=de(o,b);S&&await r(p(m,`.yarnrc.yml`),S);let C=M(y.files,{name:i,template:c,runtime:f,packageManager:o,...lt(o),templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (React)`}[c],sessionSecret:ee(32).toString(`hex`),packages:[...y.dependencies,...y.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
130
- `)});for(let[e,t]of C)await r(p(m,e),t);t.deploy?.length&&t.platformConfig!==!1&&await Te({dir:m,targets:t.deploy,pm:o,force:!0});let{generateAgentDocs:w}=await import(`./agent-docs-BLpdFCWy.mjs`).then(e=>e.t);await w({outDir:m,name:i,pm:o,template:c,only:`both`,force:!0});let T={...nt,...it(u),...y.builds};if(t.approveInstallScripts!==!1&&Z(o,m,T),t.installDeps){console.log(`\n Installing dependencies with ${o}...\n`);try{x(`${o} install`,{cwd:m,stdio:`inherit`}),console.log(`
131
- Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-DmSQleE5.mjs`).then(e=>e.n);await e({cwd:m,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{x(`git init`,{cwd:m,stdio:`pipe`}),x(`git branch -M main`,{cwd:m,stdio:`pipe`}),x(`git add -A`,{cwd:m,stdio:`pipe`}),x(`git commit -m "chore: initial commit from kick new"`,{cwd:m,stdio:`pipe`}),h(`Git repository initialized`)}catch{h(`Warning: git init failed (git may not be installed)`)}console.log(`
130
+ `)});for(let[e,t]of C)await r(p(m,e),t);t.deploy?.length&&t.platformConfig!==!1&&await Te({dir:m,targets:t.deploy,pm:o,force:!0});let{generateAgentDocs:w}=await import(`./agent-docs-CrVQtJgn.mjs`).then(e=>e.t);await w({outDir:m,name:i,pm:o,template:c,only:`both`,force:!0});let T={...nt,...it(u),...y.builds};if(t.approveInstallScripts!==!1&&Z(o,m,T),t.installDeps){console.log(`\n Installing dependencies with ${o}...\n`);try{x(`${o} install`,{cwd:m,stdio:`inherit`}),console.log(`
131
+ Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-DNufBmjE.mjs`).then(e=>e.n);await e({cwd:m,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{x(`git init`,{cwd:m,stdio:`pipe`}),x(`git branch -M main`,{cwd:m,stdio:`pipe`}),x(`git add -A`,{cwd:m,stdio:`pipe`}),x(`git commit -m "chore: initial commit from kick new"`,{cwd:m,stdio:`pipe`}),h(`Git repository initialized`)}catch{h(`Warning: git init failed (git may not be installed)`)}console.log(`
132
132
  Project scaffolded successfully!`),console.log();let E=m!==process.cwd();h(`Next steps:`),E&&h(` cd ${i}`),t.installDeps||h(` ${o} install`);let D=n(o,`kick`),O={rest:`${D} g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};h(` ${O[c]??O.rest}`),h(` ${e(o,`dev`)}`);let k=e=>{let t=Math.max(...e.map(([e])=>e.length))+2;for(let[n,r]of e)h(` ${n.padEnd(t)}${r}`)};return h(``),h(`Commands:`),k([[e(o,`dev`),`Start dev server with Vite HMR`],[e(o,`build`),`Production build via Vite`],[e(o,`start`),`Run production build`]]),h(``),h(`Generators:`),k([[`${D} g module <name>`,`REST module (controller, service, DTOs, repository)`],[`${D} g scaffold <n> <f..>`,`CRUD module from field definitions`],[`${D} g controller <name>`,`Standalone controller`],[`${D} g service <name>`,`@Service() class`],[`${D} g middleware <name>`,`Global connect-style middleware`],[`${D} g guard <name>`,`Route guard (auth, roles, etc.)`],[`${D} g adapter <name>`,`AppAdapter with lifecycle hooks`],[`${D} g dto <name>`,`DTO schema (Zod / Valibot / Yup)`],[`${D} g config`,`Generate kick.config.ts`]]),h(``),h(`Add packages:`),k([[`${D} add <pkg>`,`Install a KickJS package + peers`],[`${D} add --list`,`Show all available packages`]]),h(``),h(`Available: ${Xe}`),h(``),{builds:T}}const Ct=e=>`'${JSON.stringify(e).slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`'`,`\\'`)}'`;function wt(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
133
133
  // Inert until the client build exists, so \`kick dev\` (where Vite
134
134
  // serves the client and proxies /api here) is unaffected.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.8
2
+ * @forinda/kickjs-cli v8.15.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,4 +8,4 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{t as e}from"./rolldown-runtime-UeWuLvbj.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=i(e),{root:s}=r(a),c=null,l=a;for(;;){for(let e of o)if(t(i(l,e)))return l;if(c===null&&t(i(l,`package.json`))&&(c=l),l===s)break;let e=n(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
11
+ import{t as e}from"./rolldown-runtime-CRasMkPY.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=i(e),{root:s}=r(a),c=null,l=a;for(;;){for(let e of o)if(t(i(l,e)))return l;if(c===null&&t(i(l,`package.json`))&&(c=l),l===s)break;let e=n(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.8
2
+ * @forinda/kickjs-cli v8.15.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{t as e}from"./rolldown-runtime-UeWuLvbj.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
12
- //# sourceMappingURL=project-root-DBTLa3ee.mjs.map
11
+ import{t as e}from"./rolldown-runtime-CRasMkPY.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
12
+ //# sourceMappingURL=project-root-Dk8r8FMi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-root-DBTLa3ee.mjs","names":["__exportAll","project_root_exports","findProjectRoot","CONFIG_FILENAMES","start","resolve","startDir","fsRoot","parse","firstPackageJson","cursor","name","existsSync","parent","dirname"],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sMAGA,MAAMG,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgBD,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAME,EAAQC,EAAQC,CAAQ,EACxB,CAAE,KAAMC,GAAWC,EAAMJ,CAAK,EAEhCK,EAAkC,KAClCC,EAASN,EACb,OAAa,CACX,IAAK,IAAMO,KAAQR,EACjB,GAAIS,EAAWP,EAAQK,EAAQC,CAAI,CAAC,EAAG,OAAOD,EAKhD,GAHID,IAAqB,MAAQG,EAAWP,EAAQK,EAAQ,cAAc,CAAC,IACzE,EAAmBA,GAEjBA,IAAWH,EAAQ,MACvB,IAAMM,EAASC,EAAQJ,CAAM,EAC7B,GAAIG,IAAWH,EAAQ,MACvB,EAASG,CACX,CAEA,OAAOJ,GAAoBL,CAC7B"}
1
+ {"version":3,"file":"project-root-Dk8r8FMi.mjs","names":["__exportAll","project_root_exports","findProjectRoot","CONFIG_FILENAMES","start","resolve","startDir","fsRoot","parse","firstPackageJson","cursor","name","existsSync","parent","dirname"],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sMAGA,MAAMG,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgBD,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAME,EAAQC,EAAQC,CAAQ,EACxB,CAAE,KAAMC,GAAWC,EAAMJ,CAAK,EAEhCK,EAAkC,KAClCC,EAASN,EACb,OAAa,CACX,IAAK,IAAMO,KAAQR,EACjB,GAAIS,EAAWP,EAAQK,EAAQC,CAAI,CAAC,EAAG,OAAOD,EAKhD,GAHID,IAAqB,MAAQG,EAAWP,EAAQK,EAAQ,cAAc,CAAC,IACzE,EAAmBA,GAEjBA,IAAWH,EAAQ,MACvB,IAAMM,EAASC,EAAQJ,CAAM,EAC7B,GAAIG,IAAWH,EAAQ,MACvB,EAASG,CACX,CAEA,OAAOJ,GAAoBL,CAC7B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.8
2
+ * @forinda/kickjs-cli v8.15.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.8
2
+ * @forinda/kickjs-cli v8.15.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{t as e}from"./rolldown-runtime-UeWuLvbj.mjs";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./package-manager-DMNCUv5Z.mjs";import{A as v,C as y,D as b,E as x,F as S,M as ee,N as te,O as ne,P as C,S as re,T as ie,_ as ae,a as oe,b as se,c as ce,f as le,g as ue,h as de,i as fe,j as pe,k as me,l as he,m as ge,p as _e,r as ve,u as ye,v as be,w as xe,x as Se,y as Ce}from"./doctor-hrYL914U.mjs";import{a as we,c as w,d as Te,f as Ee,h as De,l as T,m as Oe,o as ke,p as Ae,s as E,u as je}from"./config-LzGMuzP3.mjs";import{_ as Me,a as Ne,b as Pe,d as Fe,g as Ie,h as Le,l as Re,m as ze,n as Be,o as Ve,p as He,r as Ue,s as D,t as We,u as Ge,v as Ke,x as qe,y as Je}from"./project-CXcAR-tR.mjs";import{t as O}from"./project-root-DBTLa3ee.mjs";import{n as k,t as Ye}from"./types-CX1RqHCf.mjs";import{t as Xe}from"./build-Ch7Mu-zN.mjs";import{n as Ze}from"./agent-docs-c9x_je96.mjs";import{C as Qe,S as $e,_ as et,a as tt,b as nt,c as rt,d as it,f as at,g as ot,h as st,i as ct,l as lt,m as ut,o as dt,p as ft,r as pt,s as mt,t as ht,u as gt,v as _t,w as vt,x as A,y as yt}from"./typegen-BsYWuduu.mjs";import{createRequire as bt}from"node:module";import j,{basename as xt,dirname as M,join as N,relative as P,resolve as F,sep as I}from"node:path";import{cpSync as St,existsSync as L,mkdirSync as Ct,readFileSync as R,readdirSync as z,rmSync as wt,statSync as Tt,writeFileSync as B}from"node:fs";import{copyFile as Et,mkdir as Dt,readFile as V,readdir as Ot,rm as kt,stat as At,writeFile as jt}from"node:fs/promises";import{fork as Mt,spawn as Nt,spawnSync as Pt}from"node:child_process";import{createHash as Ft}from"node:crypto";import{fileURLToPath as It,pathToFileURL as H}from"node:url";import{parseSync as Lt}from"oxc-parser";import{arch as Rt,platform as zt,release as Bt}from"node:os";const Vt=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`},{value:`storage`,label:`Storage`,hint:`disk, S3 / R2 / MinIO`}];function Ht(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | minimal | fullstack | inertia`).option(`--runtime <engine>`,`HTTP runtime: express | fastify | h3`).option(`-r, --repo <type>`,`Repository name (inmemory, or any DB name e.g. postgres)`).option(`-s, --schema <lib>`,`Schema library for env / DTOs: zod | valibot | yup (default: zod)`).option(`--frontend <kind>`,`Fullstack web/ scaffold: 'kick' (wired React app) or 'vite' (create-vite, unwired)`).option(`--vite-template <name>`,`create-vite TypeScript template for --frontend vite (default 'react-ts')`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. swagger,ws,queue,devtools)`).option(`--deploy <targets>`,`Comma-separated deploy targets to write files for: netlify, vercel, docker (later: kick g deploy)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{n(`KickJS — Create a new project`);let a=Ue(),o=e=>{e&&f.warn(`kick ${We} is behind the latest release, ${e} — templates and options added since are missing. Upgrade: npm i -g @forinda/kickjs-cli@latest`)},s=[];try{s=t.deploy?qe(t.deploy):[]}catch(e){f.error(e.message),r(`Aborted.`),process.exitCode=1;return}let u=!!(t.yes||t.nonInteractive);e||=u?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let m;if(e===`.`?(m=F(`.`),e=xt(m)):m=F(t.directory||e),L(m)){let n=z(m);if(n.length>0){if(t.force)f.warn(`Clearing existing files in ${m}`);else if(u){f.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{f.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)f.message(` - ${e}`);if(n.length>5&&f.message(` ... and ${n.length-5} more`),!await c({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)wt(F(m,e),{recursive:!0,force:!0})}}u||o(await Promise.race([a,new Promise(e=>setTimeout(e,3e3,null).unref())]));let g=t.template;g||=u?`minimal`:await l({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`},{value:`fullstack`,label:`Fullstack`,hint:`server + Vite React web, typed client`},{value:`inertia`,label:`Inertia`,hint:`server-driven React pages, one app, SSR`}]});let _=t.runtime;_||=u?`express`:await l({message:`HTTP runtime`,options:[{value:`express`,label:`Express`,hint:`default, zero-config`},{value:`fastify`,label:`Fastify`,hint:`fastify + @fastify/middie`},{value:`h3`,label:`h3`,hint:`Nitro / Nuxt engine`}]});let v=t.pm;v||=u?await d(void 0):await l({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let y=t.repo;y||=u?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),De(y);let b=t.schema;g===`inertia`&&(b&&b!==`zod`&&f.warn(`The inertia template uses zod — ignoring --schema ${b}.`),b=`zod`),b||=u?`zod`:await l({message:`Schema library (env + DTO validation)`,options:[{value:`zod`,label:`Zod`,hint:`default — broad ecosystem`},{value:`valibot`,label:`Valibot`,hint:`smaller bundle`},{value:`yup`,label:`Yup`,hint:`classic API`}]}),[`zod`,`valibot`,`yup`].includes(b)||(f.warn(`Unknown --schema "${b}", falling back to zod.`),b=`zod`);let x;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();x=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else x=u?[]:await h({message:`Select packages to include`,options:[...Vt],required:!1});let S;S=t.git===void 0?u?!0:await c({message:`Initialize git repository?`,initialValue:!0}):t.git;let ee;if(ee=t.install===void 0?u?!0:await c({message:`Install dependencies?`,initialValue:!0}):t.install,t.frontend!==void 0&&t.frontend!==`kick`&&t.frontend!==`vite`){f.error(`Unknown --frontend '${String(t.frontend)}'. Use 'kick' (wired React app) or 'vite' (create-vite).`),r(`Aborted.`);return}let{VITE_TEMPLATES:te,DEFAULT_VITE_TEMPLATE:ne}=await import(`./fullstack-BDk2Min0.mjs`);if(t.viteTemplate!==void 0&&!te.some(e=>e.value===t.viteTemplate)){f.error(`Unknown --vite-template '${String(t.viteTemplate)}'. TypeScript templates only: ${te.map(e=>e.value).join(`, `)}.`),r(`Aborted.`);return}let C=t.frontend===`vite`?`vite`:`kick`,re=t.viteTemplate??ne;if(g===`fullstack`&&!t.frontend&&!u&&(C=await l({message:`Frontend for web/`,options:[{value:`kick`,label:`KickJS React app`,hint:`typed client, /api proxy, route types — wired`},{value:`vite`,label:`Delegate to create-vite`,hint:`pick any framework; wiring is manual (guide printed after)`}]})),C===`vite`&&!t.viteTemplate&&!u&&(re=await l({message:`create-vite template`,options:te.map(e=>({value:e.value,label:e.label})),initialValue:ne})),g===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-BDk2Min0.mjs`);await t({name:e,directory:m,packageManager:v,initGit:S,installDeps:ee,schemaLib:b,runtime:_,packages:x,frontend:C,viteTemplate:re,deploy:s}),u&&o(await a),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${v}${v===`pnpm`?` dev`:` run dev:server`}`)}`)}else await Be({name:e,directory:m,packageManager:v,initGit:S,installDeps:ee,template:g,defaultRepo:y,packages:x,schemaLib:b,runtime:_,deploy:s}),u&&o(await a),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${Ae(v,`dev`)}`)}`)})}function Ut(e,t=[]){let n=/* @__PURE__ */ new Map;for(let t of e){let e=(n.get(t.name)??0)+1;if(n.set(t.name,e),e===2)throw new Ye(`plugin`,t.name,[t.name,t.name])}let r=/* @__PURE__ */ new Map,i=[];for(let t of e)for(let e of t.commands??[]){let n=r.get(e.name);if(n)throw new Ye(`command`,e.name,[n,t.name]);r.set(e.name,t.name),i.push(e)}let a=new Set(t.map(e=>e.name)),o=[...i.filter(e=>!a.has(e.name)),...t],s=/* @__PURE__ */ new Map,c=[];for(let t of e)for(let e of t.typegens??[]){let n=s.get(e.id);if(n)throw new Ye(`typegen`,e.id,[n,t.name]);s.set(e.id,t.name),c.push(e)}let l=/* @__PURE__ */ new Map,u=[];for(let t of e)for(let e of t.generators??[]){let n=l.get(e.name);if(n)throw new Ye(`generator`,e.name,[n,t.name]);l.set(e.name,t.name),u.push({source:t.name,spec:e})}return{commands:o,typegens:c,generators:u,register:async(t,n)=>{let r;if(n)r={generators:u,...n};else{let{findProjectRoot:e}=await import(`./project-root-DBTLa3ee.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:u}}for(let n of e)n.register&&await n.register(t,r)}}}async function Wt(e){let{name:n,outDir:r}=e,i=C(n),a=S(n),o=[],s=N(r,`${i}.plugin.ts`);return await t(s,`import {
11
+ import{t as e}from"./rolldown-runtime-CRasMkPY.mjs";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./package-manager-Dwaolesm.mjs";import{A as v,C as y,D as b,E as x,F as S,M as ee,N as te,O as ne,P as C,S as re,T as ie,_ as ae,a as oe,b as se,c as ce,f as le,g as ue,h as de,i as fe,j as pe,k as me,l as he,m as ge,p as _e,r as ve,u as ye,v as be,w as xe,x as Se,y as Ce}from"./doctor-CwGU9orm.mjs";import{a as we,c as w,d as Te,f as Ee,h as De,l as T,m as Oe,o as ke,p as Ae,s as E,u as je}from"./config-8jdSKLKJ.mjs";import{_ as Me,a as Ne,b as Pe,d as Fe,g as Ie,h as Le,l as Re,m as ze,n as Be,o as Ve,p as He,r as Ue,s as D,t as We,u as Ge,v as Ke,x as qe,y as Je}from"./project-CFi3NvO9.mjs";import{t as O}from"./project-root-Dk8r8FMi.mjs";import{n as k,t as Ye}from"./types-DOcxTXlP.mjs";import{t as Xe}from"./build-gqxIH3D8.mjs";import{n as Ze}from"./agent-docs-D7K6R5C3.mjs";import{C as Qe,S as $e,_ as et,a as tt,b as nt,c as rt,d as it,f as at,g as ot,h as st,i as ct,l as lt,m as ut,o as dt,p as ft,r as pt,s as mt,t as ht,u as gt,v as _t,w as vt,x as A,y as yt}from"./typegen-BZ8cQ1YM.mjs";import{createRequire as bt}from"node:module";import j,{basename as xt,dirname as M,join as N,relative as P,resolve as F,sep as I}from"node:path";import{cpSync as St,existsSync as L,mkdirSync as Ct,readFileSync as R,readdirSync as z,rmSync as wt,statSync as Tt,writeFileSync as B}from"node:fs";import{copyFile as Et,mkdir as Dt,readFile as V,readdir as Ot,rm as kt,stat as At,writeFile as jt}from"node:fs/promises";import{fork as Mt,spawn as Nt,spawnSync as Pt}from"node:child_process";import{createHash as Ft}from"node:crypto";import{fileURLToPath as It,pathToFileURL as H}from"node:url";import{parseSync as Lt}from"oxc-parser";import{arch as Rt,platform as zt,release as Bt}from"node:os";const Vt=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`},{value:`storage`,label:`Storage`,hint:`disk, S3 / R2 / MinIO`}];function Ht(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | minimal | fullstack | inertia`).option(`--runtime <engine>`,`HTTP runtime: express | fastify | h3`).option(`-r, --repo <type>`,`Repository name (inmemory, or any DB name e.g. postgres)`).option(`-s, --schema <lib>`,`Schema library for env / DTOs: zod | valibot | yup (default: zod)`).option(`--frontend <kind>`,`Fullstack web/ scaffold: 'kick' (wired React app) or 'vite' (create-vite, unwired)`).option(`--vite-template <name>`,`create-vite TypeScript template for --frontend vite (default 'react-ts')`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. swagger,ws,queue,devtools)`).option(`--deploy <targets>`,`Comma-separated deploy targets to write files for: netlify, vercel, docker (later: kick g deploy)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{n(`KickJS — Create a new project`);let a=Ue(),o=e=>{e&&f.warn(`kick ${We} is behind the latest release, ${e} — templates and options added since are missing. Upgrade: npm i -g @forinda/kickjs-cli@latest`)},s=[];try{s=t.deploy?qe(t.deploy):[]}catch(e){f.error(e.message),r(`Aborted.`),process.exitCode=1;return}let u=!!(t.yes||t.nonInteractive);e||=u?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let m;if(e===`.`?(m=F(`.`),e=xt(m)):m=F(t.directory||e),L(m)){let n=z(m);if(n.length>0){if(t.force)f.warn(`Clearing existing files in ${m}`);else if(u){f.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{f.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)f.message(` - ${e}`);if(n.length>5&&f.message(` ... and ${n.length-5} more`),!await c({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)wt(F(m,e),{recursive:!0,force:!0})}}u||o(await Promise.race([a,new Promise(e=>setTimeout(e,3e3,null).unref())]));let g=t.template;g||=u?`minimal`:await l({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`},{value:`fullstack`,label:`Fullstack`,hint:`server + Vite React web, typed client`},{value:`inertia`,label:`Inertia`,hint:`server-driven React pages, one app, SSR`}]});let _=t.runtime;_||=u?`express`:await l({message:`HTTP runtime`,options:[{value:`express`,label:`Express`,hint:`default, zero-config`},{value:`fastify`,label:`Fastify`,hint:`fastify + @fastify/middie`},{value:`h3`,label:`h3`,hint:`Nitro / Nuxt engine`}]});let v=t.pm;v||=u?await d(void 0):await l({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let y=t.repo;y||=u?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),De(y);let b=t.schema;g===`inertia`&&(b&&b!==`zod`&&f.warn(`The inertia template uses zod — ignoring --schema ${b}.`),b=`zod`),b||=u?`zod`:await l({message:`Schema library (env + DTO validation)`,options:[{value:`zod`,label:`Zod`,hint:`default — broad ecosystem`},{value:`valibot`,label:`Valibot`,hint:`smaller bundle`},{value:`yup`,label:`Yup`,hint:`classic API`}]}),[`zod`,`valibot`,`yup`].includes(b)||(f.warn(`Unknown --schema "${b}", falling back to zod.`),b=`zod`);let x;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();x=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else x=u?[]:await h({message:`Select packages to include`,options:[...Vt],required:!1});let S;S=t.git===void 0?u?!0:await c({message:`Initialize git repository?`,initialValue:!0}):t.git;let ee;if(ee=t.install===void 0?u?!0:await c({message:`Install dependencies?`,initialValue:!0}):t.install,t.frontend!==void 0&&t.frontend!==`kick`&&t.frontend!==`vite`){f.error(`Unknown --frontend '${String(t.frontend)}'. Use 'kick' (wired React app) or 'vite' (create-vite).`),r(`Aborted.`);return}let{VITE_TEMPLATES:te,DEFAULT_VITE_TEMPLATE:ne}=await import(`./fullstack-9HywHQL-.mjs`);if(t.viteTemplate!==void 0&&!te.some(e=>e.value===t.viteTemplate)){f.error(`Unknown --vite-template '${String(t.viteTemplate)}'. TypeScript templates only: ${te.map(e=>e.value).join(`, `)}.`),r(`Aborted.`);return}let C=t.frontend===`vite`?`vite`:`kick`,re=t.viteTemplate??ne;if(g===`fullstack`&&!t.frontend&&!u&&(C=await l({message:`Frontend for web/`,options:[{value:`kick`,label:`KickJS React app`,hint:`typed client, /api proxy, route types — wired`},{value:`vite`,label:`Delegate to create-vite`,hint:`pick any framework; wiring is manual (guide printed after)`}]})),C===`vite`&&!t.viteTemplate&&!u&&(re=await l({message:`create-vite template`,options:te.map(e=>({value:e.value,label:e.label})),initialValue:ne})),g===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-9HywHQL-.mjs`);await t({name:e,directory:m,packageManager:v,initGit:S,installDeps:ee,schemaLib:b,runtime:_,packages:x,frontend:C,viteTemplate:re,deploy:s}),u&&o(await a),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${v}${v===`pnpm`?` dev`:` run dev:server`}`)}`)}else await Be({name:e,directory:m,packageManager:v,initGit:S,installDeps:ee,template:g,defaultRepo:y,packages:x,schemaLib:b,runtime:_,deploy:s}),u&&o(await a),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${Ae(v,`dev`)}`)}`)})}function Ut(e,t=[]){let n=/* @__PURE__ */ new Map;for(let t of e){let e=(n.get(t.name)??0)+1;if(n.set(t.name,e),e===2)throw new Ye(`plugin`,t.name,[t.name,t.name])}let r=/* @__PURE__ */ new Map,i=[];for(let t of e)for(let e of t.commands??[]){let n=r.get(e.name);if(n)throw new Ye(`command`,e.name,[n,t.name]);r.set(e.name,t.name),i.push(e)}let a=new Set(t.map(e=>e.name)),o=[...i.filter(e=>!a.has(e.name)),...t],s=/* @__PURE__ */ new Map,c=[];for(let t of e)for(let e of t.typegens??[]){let n=s.get(e.id);if(n)throw new Ye(`typegen`,e.id,[n,t.name]);s.set(e.id,t.name),c.push(e)}let l=/* @__PURE__ */ new Map,u=[];for(let t of e)for(let e of t.generators??[]){let n=l.get(e.name);if(n)throw new Ye(`generator`,e.name,[n,t.name]);l.set(e.name,t.name),u.push({source:t.name,spec:e})}return{commands:o,typegens:c,generators:u,register:async(t,n)=>{let r;if(n)r={generators:u,...n};else{let{findProjectRoot:e}=await import(`./project-root-Dk8r8FMi.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:u}}for(let n of e)n.register&&await n.register(t,r)}}}async function Wt(e){let{name:n,outDir:r}=e,i=C(n),a=S(n),o=[],s=N(r,`${i}.plugin.ts`);return await t(s,`import {
12
12
  definePlugin,
13
13
  type AppAdapter,
14
14
  type AppModuleEntry,
@@ -347,7 +347,7 @@ describe('${c}', () => {
347
347
  Example: kick g scaffold Post title:string body:text:optional published:boolean:optional
348
348
  Optional: append :optional (shell-safe, no quoting needed)
349
349
  `),process.exit(1));let s=await E(process.cwd()),c=w(s),l=i.modulesDir??c.dir??`src/modules`,u=cn(t),d=Ee(s,process.cwd()),f=ke(O()),p=await ln({name:e,fields:u,modulesDir:F(l),noEntity:i.entity===!1,noTests:i.tests===!1,pluralize:T(i.pluralize,c),pluralizeRoutes:je(i.pluralizeRoutes,c),tokenScope:d,swagger:f,style:c.style});console.log(`\n Scaffolded ${e} with ${u.length} field(s):`);for(let e of u)console.log(` ${e.name}: ${e.type}${e.optional?` (optional)`:``}`);K(p,a),await hn(a)}),n.command(`config`).description(`Generate a kick.config.ts at the project root`).option(`--modules-dir <dir>`,`Modules directory path`,`src/modules`).option(`--repo <type>`,`Repository name: inmemory (default) or any DB name`,`inmemory`).option(`-f, --force`,`Overwrite existing kick.config.ts without prompting`).action(async(e,t)=>{let n=G(t);o(n),K(await qt({outDir:F(`.`),modulesDir:e.modulesDir,defaultRepo:e.repo,force:e.force}),n)}),n.command(`agents`).alias(`agent-docs`).alias(`ai-docs`).description(`Regenerate .agents/* + root CLAUDE.md (sync after framework upgrades)`).option(`--only <which>`,`Limit scope: agents | claude | skills | gemini | copilot | both (agents+claude) | all (default: all)`,`all`).option(`--name <name>`,`Project name (defaults to package.json name)`).option(`--pm <pm>`,`Package manager (default: detected from kick.config, packageManager, or the lockfile)`).option(`--template <template>`,`Template: rest | minimal | fullstack | inertia`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t)=>{let n=G(t);o(n);let r=e.only??`all`;mn.includes(r)?K(await Ze({outDir:F(`.`),only:r,name:e.name,pm:e.pm,template:e.template,force:e.force}),n):(console.error(` Invalid --only value: ${r}. Expected: ${mn.join(` | `)}`),process.exitCode=1)}),n.command(`deploy <targets...>`).description(`Add deploy files: netlify | vercel | docker (config, serverless entry, build script)`).option(`--pm <pm>`,`Package manager (default: detected)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t,n)=>{let r=G(n);o(r);let i;try{i=qe(e.flatMap(e=>e.split(`,`))),K(await Pe({dir:F(`.`),targets:i,pm:t.pm,force:t.force}),r)}catch(e){console.error(` ${e.message}`),process.exitCode=1}});for(let e of t?.generators??[])Cn(n,e,t?.projectRoot)}function Cn(e,t,n){let{source:r,spec:i}=t,a=i.args?.[0],s=a?.name??`itemName`,c=a?.required?`<${s}>`:`[${s}]`,l=`${i.name} ${c} [extraArgs...]`,u=e.command(l).description(`${i.description} [${r}]`);for(let e of i.flags??[]){let t=e.takesValue?`--${e.name} <value>`:`--${e.name}`,n=e.alias?`-${e.alias}, ${t}`:t;u.option(n,e.description??``)}u.action(async(e,r,a,s)=>{let c=G(s);o(c);let l=await oe({generatorName:i.name,itemName:e??``,args:r??[],flags:a,cwd:process.cwd(),projectRoot:n},[t]);l&&K(l.files,c)})}const wn=`/* AUTO-GENERATED by kick typegen — do not edit. Plugin: `;async function Tn(e){let t=j.resolve(e.cwd,`.kickjs/types`);e.check||await Dt(t,{recursive:!0});let n=/* @__PURE__ */ new Map,r=e.scan??st,i=j.resolve(e.cwd,`.kickjs`,`cache`),a=e.scan?void 0:e.changedFiles,o={cwd:e.cwd,config:e.config,async importTs(e){return await import(H(e).href)},async writeFile(t,n){let r=j.resolve(e.cwd,t);await Dt(j.dirname(r),{recursive:!0}),await jt(r,n,`utf8`)},getScanResult:e=>{let t=En(e),o=n.get(t);if(!o){let s={cacheDir:i,...e};o=a?ot(s,a):r(s),n.set(t,o)}return o},log:console,watch:e.watch,check:e.check},s=[],c=[];for(let n of e.plugins){let r=n.outExtension??`.d.ts`,i=j.join(t,`${n.id.replace(/\//g,`__`)}${r}`),a;try{a=await n.generate(o)}catch(t){let r=t instanceof Error?t.message:String(t);if(e.check)throw Error(`kick typegen --check: ${n.id} failed to generate (${r})`,{cause:t});o.log.error(` ${n.id}: typegen failed (${r}) — keeping previous output`),s.push({id:n.id,status:`error`,outFile:i});continue}if(a===null){s.push({id:n.id,status:`skipped`});continue}let l=`${wn}${n.id} */\n\n`+a+`
350
- `,u=``;L(i)&&(u=await V(i,`utf8`)),u===l?s.push({id:n.id,status:`unchanged`,outFile:i}):e.check?(c.push({id:n.id,outFile:i}),s.push({id:n.id,status:`drifted`,outFile:i})):(await jt(i,l,`utf8`),s.push({id:n.id,status:`written`,outFile:i}))}if(c.length>0)throw new ye(c);return s}function En(e){let t=(e.extensions??[]).slice().toSorted().join(`,`),n=(e.exclude??[]).slice().toSorted().join(`,`);return[`root=${e.root}`,`cwd=${e.cwd}`,`extensions=${t}`,`exclude=${n}`,`envFile=${e.envFile??``}`].join(`|`)}function Dn(e,t){let n=new Set(t),r=[],i=[],a=/* @__PURE__ */ new Set;for(let t of e)n.has(t.id)?(i.push(t),a.add(t.id)):r.push(t);return{enabled:r,skipped:i,unknown:[...n].filter(e=>!a.has(e))}}var On=/* @__PURE__ */ e({applyDisableFilter:()=>Dn,runAllPluginTypegens:()=>kn});async function kn(e){let{enabled:t,skipped:n,unknown:r}=Dn(Ut([...eo,...e.config?.plugins??[]],e.config?.commands??[]).typegens,e.config?.typegen?.disable??[]);if(!e.silent&&n.length>0)for(let e of n)console.log(` ${e.id}: disabled (typegen.disable)`);if(!e.silent&&r.length>0&&console.warn(` kick typegen: disable list references unknown id(s): ${r.map(e=>`'${e}'`).join(`, `)}. Run \`kick typegen --list\` to see registered ids.`),t.length===0)return[];try{let n=await Tn({cwd:e.cwd,config:e.config??{},plugins:t,watch:e.watch,check:e.check,changedFiles:e.changedFiles});if(!e.silent&&le())for(let e of n)console.log(` ${e.id}: ${e.status}`);return n}catch(t){if(t instanceof ye||e.check)throw t;if(!e.silent){let e=t instanceof Error?t.message:String(t);console.warn(` kick typegen plugins: skipped (${e})`)}return[]}}function An(e){let t=process.platform===`win32`;for(let n of jn(e))for(let e of[`vue-tsc`,`tsgo`,`tsc`]){let r=t?[`${e}.CMD`,`${e}.cmd`,`${e}.exe`]:[e];for(let i of r){let r=N(n,i);if(L(r))return{cmd:r,args:[`--noEmit`],shell:t,kind:e}}}return null}function jn(e){let t=F(e),n=Mn(t);return(n?[t,n]:[t]).map(e=>N(e,`node_modules`,`.bin`))}function Mn(e){for(let t=M(e);t!==M(t);t=M(t)){let n=N(t,`pnpm-workspace.yaml`),r=N(t,`package.json`);if(L(n)||L(r))return Nn(n,r).some(n=>Pn(n,P(t,e)))?t:void 0}}function Nn(e,t){try{if(L(e)){let t=R(e,`utf-8`).split(/^packages:\s*$/m)[1]??``,n=[];for(let e of t.split(`
350
+ `,u=``;L(i)&&(u=await V(i,`utf8`)),u===l?s.push({id:n.id,status:`unchanged`,outFile:i}):e.check?(c.push({id:n.id,outFile:i}),s.push({id:n.id,status:`drifted`,outFile:i})):(await jt(i,l,`utf8`),s.push({id:n.id,status:`written`,outFile:i}))}if(c.length>0)throw new ye(c);return s}function En(e){let t=(e.extensions??[]).slice().toSorted().join(`,`),n=(e.exclude??[]).slice().toSorted().join(`,`);return[`root=${e.root}`,`cwd=${e.cwd}`,`extensions=${t}`,`exclude=${n}`,`envFile=${e.envFile??``}`].join(`|`)}function Dn(e,t){let n=new Set(t),r=[],i=[],a=/* @__PURE__ */ new Set;for(let t of e)n.has(t.id)?(i.push(t),a.add(t.id)):r.push(t);return{enabled:r,skipped:i,unknown:[...n].filter(e=>!a.has(e))}}var On=/* @__PURE__ */ e({applyDisableFilter:()=>Dn,runAllPluginTypegens:()=>kn});async function kn(e){let{enabled:t,skipped:n,unknown:r}=Dn(Ut([...to,...e.config?.plugins??[]],e.config?.commands??[]).typegens,e.config?.typegen?.disable??[]);if(!e.silent&&n.length>0)for(let e of n)console.log(` ${e.id}: disabled (typegen.disable)`);if(!e.silent&&r.length>0&&console.warn(` kick typegen: disable list references unknown id(s): ${r.map(e=>`'${e}'`).join(`, `)}. Run \`kick typegen --list\` to see registered ids.`),t.length===0)return[];try{let n=await Tn({cwd:e.cwd,config:e.config??{},plugins:t,watch:e.watch,check:e.check,changedFiles:e.changedFiles});if(!e.silent&&le())for(let e of n)console.log(` ${e.id}: ${e.status}`);return n}catch(t){if(t instanceof ye||e.check)throw t;if(!e.silent){let e=t instanceof Error?t.message:String(t);console.warn(` kick typegen plugins: skipped (${e})`)}return[]}}function An(e){let t=process.platform===`win32`;for(let n of jn(e))for(let e of[`vue-tsc`,`tsgo`,`tsc`]){let r=t?[`${e}.CMD`,`${e}.cmd`,`${e}.exe`]:[e];for(let i of r){let r=N(n,i);if(L(r))return{cmd:r,args:[`--noEmit`],shell:t,kind:e}}}return null}function jn(e){let t=F(e),n=Mn(t);return(n?[t,n]:[t]).map(e=>N(e,`node_modules`,`.bin`))}function Mn(e){for(let t=M(e);t!==M(t);t=M(t)){let n=N(t,`pnpm-workspace.yaml`),r=N(t,`package.json`);if(L(n)||L(r))return Nn(n,r).some(n=>Pn(n,P(t,e)))?t:void 0}}function Nn(e,t){try{if(L(e)){let t=R(e,`utf-8`).split(/^packages:\s*$/m)[1]??``,n=[];for(let e of t.split(`
351
351
  `)){if(!e.trim()||e.trim().startsWith(`#`))continue;let t=/^\s+-\s*['"]?([^'"#]+?)['"]?\s*$/.exec(e);if(!t)break;n.push(t[1])}return n}let{workspaces:n}=JSON.parse(R(t,`utf-8`)),r=Array.isArray(n)?n:n?.packages;return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]}catch{return[]}}function Pn(e,t){let n=e.replace(/^\.\//,``).replace(/\/+$/,``).split(`/`).map(e=>e===`**`?`.*`:e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/]*`)).join(`/`);return RegExp(`^${n}$`).test(t.split(I).join(`/`))}function Fn(e){let t=e.spawnFn??Nt,n=null,r=0,i=!1;return{schedule(){if(i)return;let a=++r;n&&=(n.kill(),null);let o=Date.now(),s=t(e.bin.cmd,e.bin.args,{cwd:e.cwd,shell:e.bin.shell,stdio:[`ignore`,`pipe`,`pipe`]});n=s;let c=``;s.stdout?.on(`data`,e=>{c+=e.toString()}),s.stderr?.on(`data`,e=>{c+=e.toString()}),s.on(`error`,()=>{a===r&&(n=null)}),s.on(`close`,t=>{i||a!==r||(n=null,e.onResult({ok:t===0,output:c,durationMs:Date.now()-o,kind:e.bin.kind}))})},dispose(){i=!0,n&&=(n.kill(),null)}}}function In(e,t=12){let n=e.trim().split(/\r?\n/);return n.length<=t?n.join(`
352
352
  `):`${n.slice(0,t).join(`
353
353
  `)}\n… ${n.length-t} more line(s)`}function Ln(e){if(typeof e==`boolean`)return e;let t=process.env.KICKJS_WATCH_POLLING;return t===`1`||t===`true`}async function Rn(e,t=`127.0.0.1`){let n=await import(`node:inspector`);n.open(e,t,!1);let r=n.url();if(!r)throw Error(`inspector.open() reported no URL`);return r}async function zn(e,t,n={}){t&&(process.env.PORT=t);let r=Ln(n.polling),i=process.cwd(),a=await E(i),o=a?.typegen?.schemaValidator??`zod`,s=a?.typegen?.envFile;try{await ht({cwd:i,allowDuplicates:!0,schemaValidator:o,envFile:s,srcDir:a?.typegen?.srcDir,outDir:a?.typegen?.outDir,assetMap:a?.assetMap,runPlugins:!1})}catch(e){console.warn(` kick typegen: skipped (${e?.message??e})`)}let c=F(i,a?.typegen?.outDir??`.kickjs/types`);try{let e=await kn({cwd:i,config:a});await ct(c,e,!1)}catch(e){console.warn(` kick typegen: plugin pass skipped (${e?.message??e})`)}let{createRequire:l}=await import(`node:module`),u=l(F(`package.json`)).resolve(`vite`),{createServer:d}=await import(H(u).href);globalThis[ce]=`kick-dev`;let f=await d({configFile:F(`vite.config.ts`),server:{port:t?parseInt(t,10):void 0,...r?{watch:{usePolling:!0,interval:100}}:{}}}),p=n.typecheck??a?.dev?.typecheck??!1,m=null,h=!0;if(p){let e=An(i);e?m=Fn({cwd:i,bin:e,onResult:e=>{f.hot.send({type:`custom`,event:`kickjs:typecheck`,data:{ok:e.ok,output:e.output,durationMs:e.durationMs}}),e.ok?h||(h=!0,console.log(` kick typecheck: clean again (${e.kind}, ${e.durationMs}ms)`)):(h=!1,console.warn(`\n kick typecheck (${e.kind}, ${e.durationMs}ms):`),console.warn(In(e.output).replace(/^/gm,` `)))}}):console.warn(` kick dev: --typecheck requested but neither tsgo (@typescript/native-preview) nor typescript is installed in this project — skipping type checks.`)}let g=he({cwd:i,config:a,emitWarning:e=>{console.warn(e),f.hot.send({type:`custom`,event:`kickjs:typegen-error`,data:{message:e,timestamp:Date.now()}})},onPassComplete:()=>m?.schedule()});f.watcher.on(`add`,e=>g.handleWatchEvent(`add`,e)),f.watcher.on(`unlink`,e=>g.handleWatchEvent(`unlink`,e)),f.watcher.on(`change`,e=>g.handleWatchEvent(`change`,e)),f.watcher.on(`unlinkDir`,e=>g.handleWatchEvent(`unlinkDir`,e)),g.assetSrcRoots.length>0&&f.watcher.add([...g.assetSrcRoots]),await f.listen(),f.printUrls(),console.log(`
@@ -682,7 +682,7 @@ server.on('exit', () => {
682
682
  Cancelled.
683
683
  `);return}await kt(d,{recursive:!0,force:!0}),console.log(` Deleted: ${d}`);let f=N(r,`index.ts`);if(await s(f)){let e=await V(f,`utf-8`),n=e,r=RegExp(`^import\\s*\\{\\s*${v(l)}Module\\s*\\}\\s*from\\s*['"][^'"]*${v(u)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(r,``),e=Xr(e,l),e=e.replace(/\n{3,}/g,`
684
684
 
685
- `),e!==n&&(await t(f,e),console.log(` Unregistered: ${l}Module from ${f}`))}console.log(`\n Module '${u}' removed.\n`)}function Qr(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--pluralize`,`The module folder is pluralized (users/ for user)`).option(`--no-pluralize`,`The module folder is the name as typed (the default)`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=await E(process.cwd()),r=w(n),i=t.modulesDir??r.dir??`src/modules`,a=T(t.pluralize,r);for(let n of e)await Zr({name:n,modulesDir:F(i),force:t.force,pluralize:a})})}function $r(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function ei(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function ti(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=O(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-h1RvCxk1.mjs`),{builtinCliPlugins:t}=await import(`./builtins-Cj-H0MpD.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
685
+ `),e!==n&&(await t(f,e),console.log(` Unregistered: ${l}Module from ${f}`))}console.log(`\n Module '${u}' removed.\n`)}function Qr(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--pluralize`,`The module folder is pluralized (users/ for user)`).option(`--no-pluralize`,`The module folder is the name as typed (the default)`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=await E(process.cwd()),r=w(n),i=t.modulesDir??r.dir??`src/modules`,a=T(t.pluralize,r);for(let n of e)await Zr({name:n,modulesDir:F(i),force:t.force,pluralize:a})})}function $r(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function ei(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function ti(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=O(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-DLZP4hZ0.mjs`),{builtinCliPlugins:t}=await import(`./builtins-6euI1-lN.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
686
686
  Registered typegen plugins:
687
687
  `);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``,n=`${e.id.replace(/\//g,`__`)}${e.outExtension??`.d.ts`}`;console.log(` ${e.id.padEnd(a+2)}→ .kickjs/types/${n}${t}`),console.log(` ${` `.repeat(a+2)} watches: ${e.inputs.join(`, `)||`(none)`}`)}console.log(`
688
688
  Disable one in kick.config.ts:
@@ -715,7 +715,7 @@ server.on('exit', () => {
715
715
  The regex-based rewrite handles the shapes our templates produce.
716
716
  Hand-rolled modules with non-standard structures may be skipped.
717
717
  Always commit before running with --apply.
718
- `),process.exit(1));let r=await E(process.cwd()),i=w(r),a=F(e.modulesDir??i.dir??`src/modules`),s;e.target===`define`||e.target===`class`?s=e.target:e.target===void 0?s=i.style??`define`:(console.error(`\n ${p.red(`Error:`)} --target must be 'define' or 'class' (got '${e.target}').\n`),process.exit(1));let c=p.dim(`→ ${s}`),l=n?p.dim(`(dry-run)`):p.bold(`(applying)`);console.log(`\n ${p.bold(`kick codemod modules`)} ${c} ${l}`),console.log(` modulesDir: ${p.dim(a)}\n`);let u=e.backup!==!1&&!n,d=await an(a,{dryRun:n,target:s,backup:u});if(d.backupDir){let e=d.backupDir;console.log(` ${p.green(`✓`)} backup: ${p.dim(e)}\n ${p.dim(`(restore: rm -rf <modulesDir> && mv "<backup>" <modulesDir>)`)}\n`)}else!n&&e.backup===!1&&console.log(` ${p.dim(`(--no-backup — skipping snapshot)`)}\n`);let f=0,m=0;for(let e of d.files)if(e.status===`migrated`)f++,console.log(` ${p.green(`✓`)} ${e.path}`);else{m++;let t=p.dim(`(${e.reason??`skipped`})`);console.log(` ${p.dim(`-`)} ${e.path} ${t}`)}if(console.log(),d.indexStatus===`migrated`)console.log(` ${p.green(`✓`)} ${d.indexPath}`);else if(d.indexStatus===`skipped`){let e=p.dim(`(${d.indexReason??`skipped`})`);console.log(` ${p.dim(`-`)} ${d.indexPath} ${e}`)}else console.log(` ${p.dim(`-`)} ${d.indexPath} ${p.dim(`(not found)`)}`);let h=n?p.dim(` (dry-run — pass --apply to write)`):``;console.log(`\n ${p.bold(String(f))} migrated, ${p.bold(String(m))} skipped${h}\n`)})}function Ai(e){try{let t=JSON.parse(R(F(e,`package.json`),`utf-8`));return{...t.dependencies,...t.devDependencies}}catch{return{}}}function ji(e,t=L,n=Ai(e)){if(n[`@forinda/kickjs-inertia`])return{staticDir:`dist/client`,siteRoot:`.`,apiPath:``,include:[`dist/client/.vite/manifest.json`,`dist/ssr`]};let r=M(e);return(t(F(r,`pnpm-workspace.yaml`))||t(F(r,`package.json`)))&&t(F(r,`web`,`package.json`))?{staticDir:`../web/dist`,siteRoot:`..`,apiPath:`/api`}:{siteRoot:`.`,apiPath:``}}function Mi(e,t,n,r){let i=ji(t,n,r),a=e?.staticDir===!1?void 0:e?.staticDir??i.staticDir;return{entry:e?.entry??`src/serverless.ts`,outDir:e?.outDir??`dist/serverless`,staticDir:a,siteRoot:e?.siteRoot??i.siteRoot,publishDir:e?.publishDir??`dist/public`,apiPath:e?.apiPath??i.apiPath,external:e?.external??[`valibot`,`yup`],vercelRuntime:e?.vercelRuntime??`nodejs22.x`,include:e?.include??i.include??[]}}function Ni(e,t,n={projectDir:`.`}){let r=[` path: '${t}/*',`,...n.preferStatic?[` preferStatic: true,`]:[],...n.includedFiles?.length?[` includedFiles: ${JSON.stringify(n.includedFiles)},`]:[]];return`import { fileURLToPath } from 'node:url'
718
+ `),process.exit(1));let r=await E(process.cwd()),i=w(r),a=F(e.modulesDir??i.dir??`src/modules`),s;e.target===`define`||e.target===`class`?s=e.target:e.target===void 0?s=i.style??`define`:(console.error(`\n ${p.red(`Error:`)} --target must be 'define' or 'class' (got '${e.target}').\n`),process.exit(1));let c=p.dim(`→ ${s}`),l=n?p.dim(`(dry-run)`):p.bold(`(applying)`);console.log(`\n ${p.bold(`kick codemod modules`)} ${c} ${l}`),console.log(` modulesDir: ${p.dim(a)}\n`);let u=e.backup!==!1&&!n,d=await an(a,{dryRun:n,target:s,backup:u});if(d.backupDir){let e=d.backupDir;console.log(` ${p.green(`✓`)} backup: ${p.dim(e)}\n ${p.dim(`(restore: rm -rf <modulesDir> && mv "<backup>" <modulesDir>)`)}\n`)}else!n&&e.backup===!1&&console.log(` ${p.dim(`(--no-backup — skipping snapshot)`)}\n`);let f=0,m=0;for(let e of d.files)if(e.status===`migrated`)f++,console.log(` ${p.green(`✓`)} ${e.path}`);else{m++;let t=p.dim(`(${e.reason??`skipped`})`);console.log(` ${p.dim(`-`)} ${e.path} ${t}`)}if(console.log(),d.indexStatus===`migrated`)console.log(` ${p.green(`✓`)} ${d.indexPath}`);else if(d.indexStatus===`skipped`){let e=p.dim(`(${d.indexReason??`skipped`})`);console.log(` ${p.dim(`-`)} ${d.indexPath} ${e}`)}else console.log(` ${p.dim(`-`)} ${d.indexPath} ${p.dim(`(not found)`)}`);let h=n?p.dim(` (dry-run — pass --apply to write)`):``;console.log(`\n ${p.bold(String(f))} migrated, ${p.bold(String(m))} skipped${h}\n`)})}function Ai(e){try{let t=JSON.parse(R(F(e,`package.json`),`utf-8`));return{...t.dependencies,...t.devDependencies}}catch{return{}}}function ji(e,t=L,n=Ai(e)){if(n[`@forinda/kickjs-inertia`])return{staticDir:`dist/client`,siteRoot:`.`,apiPath:``,include:[`dist/client/.vite/manifest.json`,`dist/ssr`]};let r=M(e);return(t(F(r,`pnpm-workspace.yaml`))||t(F(r,`package.json`)))&&t(F(r,`web`,`package.json`))?{staticDir:`../web/dist`,siteRoot:`..`,apiPath:`/api`}:n[`@forinda/kickjs-view`]?{staticDir:`dist/public`,siteRoot:`.`,apiPath:``}:{siteRoot:`.`,apiPath:``}}function Mi(e,t,n,r){let i=ji(t,n,r),a=e?.staticDir===!1?void 0:e?.staticDir??i.staticDir;return{entry:e?.entry??`src/serverless.ts`,outDir:e?.outDir??`dist/serverless`,staticDir:a,siteRoot:e?.siteRoot??i.siteRoot,publishDir:e?.publishDir??`dist/public`,apiPath:e?.apiPath??i.apiPath,external:e?.external??[`valibot`,`yup`],vercelRuntime:e?.vercelRuntime??`nodejs22.x`,include:e?.include??i.include??[]}}function Ni(e,t,n={projectDir:`.`}){let r=[` path: '${t}/*',`,...n.preferStatic?[` preferStatic: true,`]:[],...n.includedFiles?.length?[` includedFiles: ${JSON.stringify(n.includedFiles)},`]:[]];return`import { fileURLToPath } from 'node:url'
719
719
  import { handler } from '${e}'
720
720
 
721
721
  // Where the app's build files were packaged; the platform starts this
@@ -740,10 +740,10 @@ const requestContext = () => globalThis[Symbol.for('@vercel/request-context')]?.
740
740
 
741
741
  export default (req, res) => handler.node(req, res, requestContext())
742
742
  `}function Fi(e){return/^\s*publish\s*=\s*["']([^"']+)["']/m.exec(e)?.[1]?.replace(/^\.\//,``).replace(/\/+$/,``)}function Ii(e,t,n=!1){let r=[{handle:`filesystem`},{src:`^${e}/(.*)$`,dest:`/api`}];return n&&e!==``&&r.push({src:`^/_kick/(.*)$`,dest:`/api`}),t&&e!==``&&r.push({src:`^/(.*)$`,dest:`/index.html`}),r}function Li(e,t){let n;try{n=Lt(t,e).program}catch{return[]}let r=[],i=t=>e.slice(0,t).split(`
743
- `).length,a=e=>{if(!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(a);let n=e,o=n.expression;if(n.type===`Decorator`&&o?.type===`CallExpression`&&o.callee?.type===`Identifier`&&o.callee.name===`Cron`){let[e,a]=o.arguments??[],s=e?.type===`Literal`&&typeof e.value==`string`?e.value:e?.type===`TemplateLiteral`&&e.expressions.length===0?e.quasis[0]?.value?.cooked:void 0;r.push({file:t,line:i(n.start??0),expression:s,timezone:a?.type===`ObjectExpression`&&a.properties.some(e=>(e.key?.name??e.key?.value)===`timezone`)})}for(let e in n)e!==`parent`&&a(n[e])};return a(n),r}function Ri(e){let t=F(e,`src`);return L(t)?z(t,{recursive:!0,encoding:`utf-8`}).filter(e=>/\.m?ts$/.test(e)&&!/\.(test|spec|d)\.m?ts$/.test(e)).flatMap(e=>{let n=R(F(t,e),`utf-8`);return n.includes(`@Cron`)?Li(n,`src/${e}`):[]}):[]}function zi(e){let t=2166136261;for(let n of e.trim().replace(/\s+/g,` `))t^=n.codePointAt(0),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Bi(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=`${r.file}:${r.line}`;if(r.expression===void 0){t.push(`${e}: @Cron expression is not a string literal, so it has no Vercel cron entry`);continue}r.timezone&&t.push(`${e}: Vercel crons run in UTC — the timezone option is ignored there`);let i=r.expression.trim().replace(/\s+/g,` `);i.split(` `).length===5?n.set(zi(i),i):t.push(`${e}: Vercel crons need a five-field expression, so it has no Vercel cron entry`)}return{crons:[...n].map(([e,t])=>({path:`/_kick/cron/${e}`,schedule:t})),warnings:t}}function Vi(e){let t=e=>{if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return;let n=e;for(let e of[`import`,`module`,`node`,`default`]){let r=t(n[e]);if(r)return r}},n=e.exports;return t(typeof n==`string`||Array.isArray(n)?n:n?.[`.`]??n)??e.module??e.main}async function Hi(e,t){let{createRequire:n}=await import(`node:module`),r=n(F(e,`package.json`)),i;try{i=r.resolve(`${t}/package.json`)}catch{i=F(e,`node_modules`,t,`package.json`)}if(!L(i))throw Error(`${t} is not installed in this project. Run: ${g(e)} add -D vite unplugin-swc @forinda/kickjs-vite`);let a=Vi(JSON.parse(R(i,`utf-8`)));if(!a)throw Error(`${t} has no importable entry point`);return import(H(F(M(i),a)).href)}async function Ui(e,t,n){let r=F(e,t.entry);if(!L(r))throw Error(`${t.entry} not found. The serverless entry exports \`handler = createHandler({ modules })\` — see the Serverless guide.`);let{build:i}=await Hi(e,`vite`),{default:a}=await Hi(e,`unplugin-swc`),{devtoolsFlagPlugin:o,devtoolsStripPlugin:s}=await Hi(e,`@forinda/kickjs-vite`);await i({configFile:!1,root:e,logLevel:`warn`,oxc:!1,plugins:[a.vite(),o(),s()],resolve:{alias:{"@":F(e,`src`)}},ssr:{noExternal:!0,target:`node`},build:{ssr:!0,target:`node20`,outDir:F(e,t.outDir),emptyOutDir:!0,minify:!1,rollupOptions:{input:r,external:(n,r)=>Gi(n,r?M(r):e)||t.external.includes(n)&&Gi(n,e),output:{format:`esm`,entryFileNames:`server.mjs`,codeSplitting:!1}}}});let c=F(e,t.outDir,`server.mjs`);return n(`bundled ${P(process.cwd(),c)}`),c}function Wi(e){return/^((?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*)(?:\/|$)/i.exec(e)?.[1]}function Gi(e,t,n=L){let r=Wi(e);if(!r)return!1;for(let e=t;;e=M(e)){if(n(F(e,`node_modules`,r,`package.json`)))return!1;if(M(e)===e)return!0}}function Ki(e,t){let n=P(e,t).split(I)[0];return n!==void 0&&n.startsWith(`.`)}function qi(e){return e.flatMap(e=>[`/${e} /404 404!`,`/${e}/* /404 404!`])}function Ji(e){try{return Tt(e)}catch{return}}function Yi(e,t){let n=t.filter(t=>!L(F(e,t)));if(n.length>0)throw Error(`${n.join(`, `)} not found — the function reads ${n.length===1?`it`:`them`} at runtime. Run the full build first (\`${Ae(g(e),`build`)}\`), or fix \`deploy.include\`.`)}function Xi(e,t){let n=t.projectRoot,r=()=>Mi(t.config?.deploy,n);e.command(`build:netlify`).description(`Bundle the serverless entry and write the Netlify function`).action(async()=>{let e=r();Yi(n,e.include);let i=await Ui(n,e,t.log),a=F(n,e.siteRoot),o=Ri(n);o.length>0&&t.log(`warning: ${o.length} @Cron job(s) found — Netlify has no cron trigger for them, so they will not run. Use Netlify scheduled functions, or deploy to Vercel or Workers.`);let s=F(a,`.netlify/v1/functions`);Ct(s,{recursive:!0});let c=P(s,i).split(I).join(`/`),l=e=>e.split(I).join(`/`);B(F(s,`api.mjs`),Ni(c,e.apiPath,{projectDir:l(P(s,n)),preferStatic:e.apiPath===``&&!!e.staticDir,includedFiles:e.include.flatMap(e=>{let t=l(P(s,F(n,e)));return Ji(F(n,e))?.isDirectory()?[`${t}/**`]:[t]})})),t.log(`wrote ${P(process.cwd(),F(s,`api.mjs`))}`);let u=e.staticDir??e.publishDir;if(!e.staticDir)Ct(F(n,u),{recursive:!0}),t.log(`publish directory ready at ${P(process.cwd(),F(n,u))}`);else if(L(F(n,u))){let e=z(F(n,u)).filter(e=>e.startsWith(`.`));if(e.length>0){let t=F(n,u,`_redirects`),r=L(t)?R(t,`utf-8`):``,i=qi(e).filter(e=>!r.includes(e));i.length>0&&B(t,`${r}${r&&!r.endsWith(`
743
+ `).length,a=e=>{if(!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(a);let n=e,o=n.expression;if(n.type===`Decorator`&&o?.type===`CallExpression`&&o.callee?.type===`Identifier`&&o.callee.name===`Cron`){let[e,a]=o.arguments??[],s=e?.type===`Literal`&&typeof e.value==`string`?e.value:e?.type===`TemplateLiteral`&&e.expressions.length===0?e.quasis[0]?.value?.cooked:void 0;r.push({file:t,line:i(n.start??0),expression:s,timezone:a?.type===`ObjectExpression`&&a.properties.some(e=>(e.key?.name??e.key?.value)===`timezone`)})}for(let e in n)e!==`parent`&&a(n[e])};return a(n),r}function Ri(e){let t=F(e,`src`);return L(t)?z(t,{recursive:!0,encoding:`utf-8`}).filter(e=>/\.m?ts$/.test(e)&&!/\.(test|spec|d)\.m?ts$/.test(e)).flatMap(e=>{let n=R(F(t,e),`utf-8`);return n.includes(`@Cron`)?Li(n,`src/${e}`):[]}):[]}function zi(e){let t=2166136261;for(let n of e.trim().replace(/\s+/g,` `))t^=n.codePointAt(0),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Bi(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=`${r.file}:${r.line}`;if(r.expression===void 0){t.push(`${e}: @Cron expression is not a string literal, so it has no Vercel cron entry`);continue}r.timezone&&t.push(`${e}: Vercel crons run in UTC — the timezone option is ignored there`);let i=r.expression.trim().replace(/\s+/g,` `);i.split(` `).length===5?n.set(zi(i),i):t.push(`${e}: Vercel crons need a five-field expression, so it has no Vercel cron entry`)}return{crons:[...n].map(([e,t])=>({path:`/_kick/cron/${e}`,schedule:t})),warnings:t}}function Vi(e){let t=e=>{if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return;let n=e;for(let e of[`import`,`module`,`node`,`default`]){let r=t(n[e]);if(r)return r}},n=e.exports;return t(typeof n==`string`||Array.isArray(n)?n:n?.[`.`]??n)??e.module??e.main}async function Hi(e,t){let{createRequire:n}=await import(`node:module`),r=n(F(e,`package.json`)),i;try{i=r.resolve(`${t}/package.json`)}catch{i=F(e,`node_modules`,t,`package.json`)}if(!L(i))throw Error(`${t} is not installed in this project. Run: ${g(e)} add -D vite unplugin-swc @forinda/kickjs-vite`);let a=Vi(JSON.parse(R(i,`utf-8`)));if(!a)throw Error(`${t} has no importable entry point`);return import(H(F(M(i),a)).href)}function Ui(e,t){if(!t.staticDir)return{clientFiles:`bundle`};let n=F(e,t.outDir);return{publicDir:P(n,F(e,t.staticDir)).split(I).join(`/`)}}async function Wi(e,t,n){let r=F(e,t.entry);if(!L(r))throw Error(`${t.entry} not found. The serverless entry exports \`handler = createHandler({ modules })\` — see the Serverless guide.`);let{build:i}=await Hi(e,`vite`),{default:a}=await Hi(e,`unplugin-swc`),{devtoolsFlagPlugin:o,devtoolsStripPlugin:s,kickViewsPlugin:c}=await Hi(e,`@forinda/kickjs-vite`),l=Ai(e)[`@forinda/kickjs-view`]?[c(Ui(e,t))]:[];await i({configFile:!1,root:e,logLevel:`warn`,oxc:!1,plugins:[a.vite(),o(),s(),...l],resolve:{alias:{"@":F(e,`src`)}},ssr:{noExternal:!0,target:`node`},build:{ssr:!0,target:`node20`,outDir:F(e,t.outDir),emptyOutDir:!0,minify:!1,rollupOptions:{input:r,external:(n,r)=>Ki(n,r?M(r):e)||t.external.includes(n)&&Ki(n,e),output:{format:`esm`,entryFileNames:`server.mjs`,codeSplitting:!1}}}}),l.length&&t.staticDir&&Ct(F(e,t.staticDir),{recursive:!0});let u=F(e,t.outDir,`server.mjs`);return n(`bundled ${P(process.cwd(),u)}`),u}function Gi(e){return/^((?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*)(?:\/|$)/i.exec(e)?.[1]}function Ki(e,t,n=L){let r=Gi(e);if(!r)return!1;for(let e=t;;e=M(e)){if(n(F(e,`node_modules`,r,`package.json`)))return!1;if(M(e)===e)return!0}}function qi(e,t){let n=P(e,t).split(I)[0];return n!==void 0&&n.startsWith(`.`)}function Ji(e){return e.flatMap(e=>[`/${e} /404 404!`,`/${e}/* /404 404!`])}function Yi(e){try{return Tt(e)}catch{return}}function Xi(e,t){let n=t.filter(t=>!L(F(e,t)));if(n.length>0)throw Error(`${n.join(`, `)} not found — the function reads ${n.length===1?`it`:`them`} at runtime. Run the full build first (\`${Ae(g(e),`build`)}\`), or fix \`deploy.include\`.`)}function Zi(e,t){let n=t.projectRoot,r=()=>Mi(t.config?.deploy,n);e.command(`build:netlify`).description(`Bundle the serverless entry and write the Netlify function`).action(async()=>{let e=r();Xi(n,e.include);let i=await Wi(n,e,t.log),a=F(n,e.siteRoot),o=Ri(n);o.length>0&&t.log(`warning: ${o.length} @Cron job(s) found — Netlify has no cron trigger for them, so they will not run. Use Netlify scheduled functions, or deploy to Vercel or Workers.`);let s=F(a,`.netlify/v1/functions`);Ct(s,{recursive:!0});let c=P(s,i).split(I).join(`/`),l=e=>e.split(I).join(`/`);B(F(s,`api.mjs`),Ni(c,e.apiPath,{projectDir:l(P(s,n)),preferStatic:e.apiPath===``&&!!e.staticDir,includedFiles:e.include.flatMap(e=>{let t=l(P(s,F(n,e)));return Yi(F(n,e))?.isDirectory()?[`${t}/**`]:[t]})})),t.log(`wrote ${P(process.cwd(),F(s,`api.mjs`))}`);let u=e.staticDir??e.publishDir;if(!e.staticDir)Ct(F(n,u),{recursive:!0}),t.log(`publish directory ready at ${P(process.cwd(),F(n,u))}`);else if(L(F(n,u))){let e=z(F(n,u)).filter(e=>e.startsWith(`.`));if(e.length>0){let t=F(n,u,`_redirects`),r=L(t)?R(t,`utf-8`):``,i=Ji(e).filter(e=>!r.includes(e));i.length>0&&B(t,`${r}${r&&!r.endsWith(`
744
744
  `)?`
745
745
  `:``}${i.join(`
746
- `)}\n`)}}let d=F(a,`netlify.toml`);if(L(d)){let e=Fi(R(d,`utf-8`)),r=P(a,F(n,u)).split(I).join(`/`);e!==void 0&&e!==r&&t.log(`warning: netlify.toml publishes "${e}", but this build fills "${r}". Update netlify.toml, or set \`deploy.publishDir\` / \`deploy.staticDir\` to match.`)}}),e.command(`build:vercel`).description(`Bundle the serverless entry and write .vercel/output (Build Output API v3)`).action(async()=>{let e=r();Yi(n,e.include);let i=await Ui(n,e,t.log),a=F(n,e.siteRoot),o=e.staticDir?F(n,e.staticDir):void 0,s=F(a,`.vercel/output`),c=F(s,`functions/api.func`);wt(s,{recursive:!0,force:!0}),Ct(c,{recursive:!0}),St(i,F(c,`server.mjs`)),B(F(c,`index.mjs`),Pi());for(let t of e.include)St(F(n,t),F(c,t),{recursive:!0});if(B(F(c,`.vc-config.json`),`${JSON.stringify({runtime:e.vercelRuntime,handler:`index.mjs`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2)}\n`),o){if(!L(o))throw Error(`build:vercel: ${e.staticDir} does not exist — build the frontend first`);St(o,F(s,`static`),{recursive:!0,filter:e=>!Ki(o,e)})}let{crons:l,warnings:u}=Bi(Ri(n));for(let e of u)t.log(`warning: ${e}`);let d={version:3,routes:Ii(e.apiPath,!!o,l.length>0),...l.length>0?{crons:l}:{}};B(F(s,`config.json`),`${JSON.stringify(d,null,2)}\n`),t.log(`wrote ${P(process.cwd(),s)}`),l.length>0&&t.log(`${l.length} cron schedule(s) written. Set CRON_SECRET in the Vercel project — the trigger is not mounted without it.`)})}const Zi=()=>({id:`kick/assets`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`],async generate(e){let t=j.resolve(e.cwd,`kick.config.ts`);if(!L(t))return null;let n=await E(e.cwd);if(!n?.assetMap)return null;let r=tt(n.assetMap,e.cwd);return r.count===0?null:dt(r)}}),Qi="/* eslint-disable */\n// AUTO-GENERATED by `kick typegen`. DO NOT EDIT.\n// Re-run with `kick typegen` or rely on `kick dev` to refresh.\n";function $i(e,t,n,r={}){if(e.length===0)return`${Qi}
746
+ `)}\n`)}}let d=F(a,`netlify.toml`);if(L(d)){let e=Fi(R(d,`utf-8`)),r=P(a,F(n,u)).split(I).join(`/`);e!==void 0&&e!==r&&t.log(`warning: netlify.toml publishes "${e}", but this build fills "${r}". Update netlify.toml, or set \`deploy.publishDir\` / \`deploy.staticDir\` to match.`)}}),e.command(`build:vercel`).description(`Bundle the serverless entry and write .vercel/output (Build Output API v3)`).action(async()=>{let e=r();Xi(n,e.include);let i=await Wi(n,e,t.log),a=F(n,e.siteRoot),o=e.staticDir?F(n,e.staticDir):void 0,s=F(a,`.vercel/output`),c=F(s,`functions/api.func`);wt(s,{recursive:!0,force:!0}),Ct(c,{recursive:!0}),St(i,F(c,`server.mjs`)),B(F(c,`index.mjs`),Pi());for(let t of e.include)St(F(n,t),F(c,t),{recursive:!0});if(B(F(c,`.vc-config.json`),`${JSON.stringify({runtime:e.vercelRuntime,handler:`index.mjs`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2)}\n`),o){if(!L(o))throw Error(`build:vercel: ${e.staticDir} does not exist — build the frontend first`);St(o,F(s,`static`),{recursive:!0,filter:e=>!qi(o,e)})}let{crons:l,warnings:u}=Bi(Ri(n));for(let e of u)t.log(`warning: ${e}`);let d={version:3,routes:Ii(e.apiPath,!!o,l.length>0),...l.length>0?{crons:l}:{}};B(F(s,`config.json`),`${JSON.stringify(d,null,2)}\n`),t.log(`wrote ${P(process.cwd(),s)}`),l.length>0&&t.log(`${l.length} cron schedule(s) written. Set CRON_SECRET in the Vercel project — the trigger is not mounted without it.`)})}const Qi=()=>({id:`kick/assets`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`],async generate(e){let t=j.resolve(e.cwd,`kick.config.ts`);if(!L(t))return null;let n=await E(e.cwd);if(!n?.assetMap)return null;let r=tt(n.assetMap,e.cwd);return r.count===0?null:dt(r)}}),$i="/* eslint-disable */\n// AUTO-GENERATED by `kick typegen`. DO NOT EDIT.\n// Re-run with `kick typegen` or rely on `kick dev` to refresh.\n";function ea(e,t,n,r={}){if(e.length===0)return`${$i}
747
747
  // (no routes discovered yet — annotate a controller method with
748
748
  // @Get/@Post/@Put/@Delete/@Patch and re-run \`kick typegen\`)
749
749
  declare global {
@@ -760,15 +760,15 @@ declare global {
760
760
 
761
761
  /** Empty until the first route exists — see kick typegen. */
762
762
  export const kickRpc = {} as const
763
- `;let i=/* @__PURE__ */ new Map;for(let t of e){let e=i.get(t.controller)??[];e.push(t),i.set(t.controller,e)}let a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Map,s=e=>{let t=`${e.filePath}::${e.controller}`,n=o.get(t);return n||(n=`_C${o.size}`,o.set(t,n)),n},c=(e,i,o)=>{let s=ra(e,i.filePath,t,n,a);if(!s){if(e&&n!==!1){let t=o===`params`?`URL-pattern params`:o===`query`&&i.queryFilterable!==null?`the @ApiQueryParams-derived query shape`:`'unknown'`,n=`route ${i.controller}.${i.method} (${i.httpMethod} ${i.path})`;r.onWarn?.(e.unexported?`${n}: ${o} schema '${e.identifier}' is declared in ${P(process.cwd(),i.filePath)} but not exported, so the generated types can't import it — ${o} is typed as ${t}. Export it (\`export const ${e.identifier} = ...\`) to type ctx.${o}.`:`${n}: ${o} schema '${e.identifier}' could not be statically resolved — falling back to ${t}. Export the schema from the controller file or import it with a static specifier.`)}return null}return n===`kickjs-schema`?`import('@forinda/kickjs-schema').InferSchemaOutput<typeof ${s}>`:`import('zod').infer<typeof ${s}>`},l=[];for(let[e,t]of i){let n=[` interface ${e} {`];for(let e of t){let t=e.pathParams.length>0?`{ ${e.pathParams.map(e=>`${e}: string`).join(`; `)} }`:`{}`,r=c(e.bodySchema,e,`body`),i=c(e.querySchema,e,`query`),a=c(e.paramsSchema,e,`params`)??t,o=r??`unknown`,l=i??ta(e),u=c(e.responseSchema??null,e,`response`),d=s(e),f=u??`import('@forinda/kickjs').InferHandlerResponse<${d}['${e.method}']>`,p=na(e);n.push(` /**`,` * ${e.httpMethod} ${e.path}`,...p.map(e=>` * ${e}`),` */`,` ${e.method}: {`,` params: ${a}`,` body: ${o}`,` query: ${l}`,` response: ${f}`,` contextKeys: ${ea(e)}`,` }`)}n.push(` }`),l.push(n.join(`
763
+ `;let i=/* @__PURE__ */ new Map;for(let t of e){let e=i.get(t.controller)??[];e.push(t),i.set(t.controller,e)}let a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Map,s=e=>{let t=`${e.filePath}::${e.controller}`,n=o.get(t);return n||(n=`_C${o.size}`,o.set(t,n)),n},c=(e,i,o)=>{let s=ia(e,i.filePath,t,n,a);if(!s){if(e&&n!==!1){let t=o===`params`?`URL-pattern params`:o===`query`&&i.queryFilterable!==null?`the @ApiQueryParams-derived query shape`:`'unknown'`,n=`route ${i.controller}.${i.method} (${i.httpMethod} ${i.path})`;r.onWarn?.(e.unexported?`${n}: ${o} schema '${e.identifier}' is declared in ${P(process.cwd(),i.filePath)} but not exported, so the generated types can't import it — ${o} is typed as ${t}. Export it (\`export const ${e.identifier} = ...\`) to type ctx.${o}.`:`${n}: ${o} schema '${e.identifier}' could not be statically resolved — falling back to ${t}. Export the schema from the controller file or import it with a static specifier.`)}return null}return n===`kickjs-schema`?`import('@forinda/kickjs-schema').InferSchemaOutput<typeof ${s}>`:`import('zod').infer<typeof ${s}>`},l=[];for(let[e,t]of i){let n=[` interface ${e} {`];for(let e of t){let t=e.pathParams.length>0?`{ ${e.pathParams.map(e=>`${e}: string`).join(`; `)} }`:`{}`,r=c(e.bodySchema,e,`body`),i=c(e.querySchema,e,`query`),a=c(e.paramsSchema,e,`params`)??t,o=r??`unknown`,l=i??na(e),u=c(e.responseSchema??null,e,`response`),d=s(e),f=u??`import('@forinda/kickjs').InferHandlerResponse<${d}['${e.method}']>`,p=ra(e);n.push(` /**`,` * ${e.httpMethod} ${e.path}`,...p.map(e=>` * ${e}`),` */`,` ${e.method}: {`,` params: ${a}`,` body: ${o}`,` query: ${l}`,` response: ${f}`,` contextKeys: ${ta(e)}`,` }`)}n.push(` }`),l.push(n.join(`
764
764
  `))}let u=[],d=/* @__PURE__ */ new Set,f=/* @__PURE__ */ new Set;i.has(`Named`)&&r.onWarn?.(`controller class 'Named' collides with the reserved KickRoutes.Named route-name map — its interface declaration-merges into it. Rename the controller.`),i.has(`Api`)&&r.onWarn?.(`controller class 'Api' collides with the reserved KickRoutes.Api client map — its interface declaration-merges into the flat route map. Rename the controller.`);for(let[e,t]of i)for(let n of t){let t=`${n.httpMethod} ${n.mountedPath??n.path}`;d.has(t)?r.onWarn?.(`duplicate route '${t}' (${e}.${n.method}) — two handlers claim the same verb+path at runtime. KickRoutes.Api keeps the first (scan order, which may not match runtime dispatch); resolve the conflict in the modules.`):(d.add(t),f.add(`${e}.${n.method}`),u.push(` '${t}': ${e}['${n.method}']`))}let p=[` interface Api {`,...u,` }`].join(`
765
765
  `);l.push(p);let m=[];for(let[e,t]of i)for(let n of t)f.has(`${e}.${n.method}`)&&m.push(` '${e}.${n.method}': ${e}['${n.method}']`);l.push([` interface Named {`,...m,` }`].join(`
766
- `));let h=[],g=/* @__PURE__ */ new Set;for(let[e,t]of i){let n=oa(e);if(g.has(n)){r.onWarn?.(`RPC manifest: controller key '${n}' (from ${e}) collides with another controller — keeping the first; rename one class for distinct RPC namespaces.`);continue}g.add(n);let i=[];for(let n of t){if(!f.has(`${e}.${n.method}`))continue;let t=`${n.httpMethod} ${n.mountedPath??n.path}`;i.push(` ${n.method}: '${t}',`)}i.length>0&&h.push(` ${n}: {\n${i.join(`
766
+ `));let h=[],g=/* @__PURE__ */ new Set;for(let[e,t]of i){let n=sa(e);if(g.has(n)){r.onWarn?.(`RPC manifest: controller key '${n}' (from ${e}) collides with another controller — keeping the first; rename one class for distinct RPC namespaces.`);continue}g.add(n);let i=[];for(let n of t){if(!f.has(`${e}.${n.method}`))continue;let t=`${n.httpMethod} ${n.mountedPath??n.path}`;i.push(` ${n.method}: '${t}',`)}i.length>0&&h.push(` ${n}: {\n${i.join(`
767
767
  `)}\n },`)}let _=[`/**`,` * Runtime route manifest for the tRPC-style sugar:`," * `createRpc(api, kickRpc)` from @forinda/kickjs-client.",` */`,`export const kickRpc = {`,...h,`} as const`].join(`
768
- `),v=[],y=/* @__PURE__ */ new Map;for(let t of e)y.set(`${t.filePath}::${t.controller}`,t);for(let[e,n]of o){let r=y.get(e),i=aa(``,r.filePath,t),a=r.controllerIsDefaultExport?`default as ${n}`:`${r.controller} as ${n}`;v.push(`import type { ${a} } from '${i}'`)}let b=v.length>0?v.join(`
768
+ `),v=[],y=/* @__PURE__ */ new Map;for(let t of e)y.set(`${t.filePath}::${t.controller}`,t);for(let[e,n]of o){let r=y.get(e),i=oa(``,r.filePath,t),a=r.controllerIsDefaultExport?`default as ${n}`:`${r.controller} as ${n}`;v.push(`import type { ${a} } from '${i}'`)}let b=v.length>0?v.join(`
769
769
  `)+`
770
- `:``,x=ia(a)+b,S=l.join(`
771
- `);return`${Qi}${x}
770
+ `:``,x=aa(a)+b,S=l.join(`
771
+ `);return`${$i}${x}
772
772
  declare global {
773
773
  // eslint-disable-next-line @typescript-eslint/no-namespace
774
774
  namespace KickRoutes {
@@ -780,18 +780,18 @@ ${S}
780
780
  }
781
781
 
782
782
  ${_}
783
- `}function ea(e){let t=e.contextKeys;return t==null?`string`:t.length===0?`never`:t.map(e=>JSON.stringify(e)).join(` | `)}function ta(e){if(e.queryFilterable===null)return`unknown`;let t=e.querySortable??[];return`{ filter?: string | string[]; sort?: ${t.length>0?t.flatMap(e=>[`'${e}'`,`'-${e}'`]).join(` | `):`string`}; q?: string; page?: string; limit?: string; cursor?: string }`}function na(e){let t=[];return e.queryFilterable&&e.queryFilterable.length>0&&t.push(`Filterable: ${e.queryFilterable.join(`, `)}`),e.querySortable&&e.querySortable.length>0&&t.push(`Sortable: ${e.querySortable.join(`, `)}`),e.querySearchable&&e.querySearchable.length>0&&t.push(`Searchable: ${e.querySearchable.join(`, `)}`),t}function ra(e,t,n,r,i){if(!e||r===!1||e.source===null)return null;let a=aa(e.source,t,n);if(a===`unknown`)return null;let o=`${a}::${e.identifier}`,s=i.get(o)?.specifier;return s?s=i.get(o).specifier:(s=`_S${i.size}`,i.set(o,{identifier:e.identifier,specifier:s})),s}function ia(e){if(e.size===0)return``;let t=[];for(let[n,r]of e){let[e]=n.split(`::`);t.push(`import type { ${r.identifier} as ${r.specifier} } from '${e}'`)}return t.join(`
783
+ `}function ta(e){let t=e.contextKeys;return t==null?`string`:t.length===0?`never`:t.map(e=>JSON.stringify(e)).join(` | `)}function na(e){if(e.queryFilterable===null)return`unknown`;let t=e.querySortable??[];return`{ filter?: string | string[]; sort?: ${t.length>0?t.flatMap(e=>[`'${e}'`,`'-${e}'`]).join(` | `):`string`}; q?: string; page?: string; limit?: string; cursor?: string }`}function ra(e){let t=[];return e.queryFilterable&&e.queryFilterable.length>0&&t.push(`Filterable: ${e.queryFilterable.join(`, `)}`),e.querySortable&&e.querySortable.length>0&&t.push(`Sortable: ${e.querySortable.join(`, `)}`),e.querySearchable&&e.querySearchable.length>0&&t.push(`Searchable: ${e.querySearchable.join(`, `)}`),t}function ia(e,t,n,r,i){if(!e||r===!1||e.source===null)return null;let a=oa(e.source,t,n);if(a===`unknown`)return null;let o=`${a}::${e.identifier}`,s=i.get(o)?.specifier;return s?s=i.get(o).specifier:(s=`_S${i.size}`,i.set(o,{identifier:e.identifier,specifier:s})),s}function aa(e){if(e.size===0)return``;let t=[];for(let[n,r]of e){let[e]=n.split(`::`);t.push(`import type { ${r.identifier} as ${r.specifier} } from '${e}'`)}return t.join(`
784
784
  `)+`
785
- `}function aa(e,t,n){if(e===null)return`unknown`;let r=M(n);if(e===``){let e=P(r,t).split(I).join(`/`);return e=e.replace(/\.(ts|tsx|mts|cts)$/i,``),e.startsWith(`.`)||(e=`./`+e),e}if(!e.startsWith(`.`)&&!e.startsWith(`/`))return e;let i=M(t),a=F(i,e),o=P(r,a).split(I).join(`/`);return o=o.replace(/\.(ts|tsx|mts|cts)$/i,``),o.startsWith(`.`)||(o=`./`+o),o}function oa(e){let t=e.endsWith(`Controller`)?e.slice(0,-10):e,n=t.length>0?t:e;return n.charAt(0).toLowerCase()+n.slice(1)}const sa=()=>({id:`kick/routes`,outExtension:`.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){let t=await e.getScanResult({root:ca(e),cwd:e.cwd,envFile:la(e)}),n=e.config?.typegen?.schemaValidator??`zod`,r=j.resolve(e.cwd,`.kickjs/types/kick__routes.ts`);return $i(t.routes,r,n,{onWarn:t=>e.log.warn(t)})}});function ca(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function la(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}const ua=`@typescript/typescript6`;function da(e){return typeof e?.createProgram==`function`}function fa(e){if(da(e.typescript))return{api:e.typescript,source:`typescript`};if(da(e.ts6))return{api:e.ts6,source:ua};let t=`Install it in the project:\n ${g()} add -D ${ua}`;throw e.typescript?Error(`kick typegen: the client route map needs a TypeScript compiler API.
786
- TypeScript 7 does not ship a compiler API, so the compatibility package is required.\n ${t}`):Error(`kick typegen: the client route map needs a TypeScript compiler API, and neither 'typescript' nor '${ua}' resolved from this project.\n ${t}`)}async function pa(e){let t=bt(N(e,`package.json`)),n=async e=>{try{return await import(H(t.resolve(e)).href)}catch{return null}},[r,i]=await Promise.all([n(`typescript`),n(ua)]);return fa({typescript:ma(r),ts6:ma(i)}).api}function ma(e){let t=e;return t?.default&&typeof t.default==`object`?t.default:e}const ha=Symbol(`kick/client: expansion budget exhausted`);var ga=class{ts;checker;program;opts;get printFlags(){return this.ts.TypeFormatFlags.NoTruncation}hoistedByType=/* @__PURE__ */ new Map;inProgress=/* @__PURE__ */ new Map;jsonInProgress=/* @__PURE__ */ new Set;nextName=0;blocks=[];maxDepth;truncations=0;budget;constructor(e,t,n,r={}){this.ts=e,this.checker=t,this.program=n,this.opts=r,this.maxDepth=r.maxDepth??12,this.budget=r.truncationBudget??1e3}hoisted(){return this.blocks}expand(e){this.truncations=0;let t=this.blocks.length,n=this.nextName,r=new Set(this.hoistedByType.keys());try{return this.render(e,0)}catch(e){if(e!==ha)throw e;this.blocks.length=t,this.nextName=n;for(let e of this.hoistedByType.keys())r.has(e)||this.hoistedByType.delete(e);return this.opts.onWarn?.(`expansion abandoned after ${this.budget} depth hoists — emitting 'unknown'. Either the response type never repeats (a generic that grows at every level) or it nests more distinct types than the budget allows; raising maxDepth hoists fewer of them. Declare a response schema on the route for an exact type.`),`unknown`}}render(e,t,n=!0){let r=this.ts.TypeFlags;if(n){let t=this.hoistedByType.get(e);if(t)return t}if(t>this.maxDepth&&!this.isLeaf(e))return this.hoistDeep(e);if(e.flags&(r.String|r.Number|r.Boolean|r.BigInt|r.ESSymbol)||e.flags&(r.Any|r.Unknown|r.Never|r.Void|r.Undefined|r.Null)||e.isLiteral()||e.flags&r.BooleanLiteral)return this.checker.typeToString(e,void 0,this.printFlags);if(e.isUnion()){let n=e.types.filter(e=>!this.isCallable(e));return(n.length>0?n:e.types).map(e=>this.render(e,t+1)).join(` | `)}if(e.isIntersection())return e.types.map(e=>this.render(e,t+1)).join(` & `);if(this.isTuple(e))return this.renderTuple(e,t);let i=this.arrayElement(e);if(i){let e=this.render(i.element,t+1),n=/[|&]/.test(e)?`(${e})[]`:`${e}[]`;return i.readonly?`readonly ${n}`:n}let a=this.toJsonType(e);if(a){if(this.jsonInProgress.has(e))return this.opts.onWarn?.(`'${this.checker.typeToString(e,void 0,this.printFlags)}' has a cyclic toJSON() — emitting 'unknown', since it has no serializable form.`),`unknown`;this.jsonInProgress.add(e);try{return this.render(a,t)}finally{this.jsonInProgress.delete(e)}}return this.isLibType(e)?this.renderLibType(e,t):e.flags&r.Object?this.renderObject(e,t):(this.opts.onWarn?.(`could not expand type '${this.checker.typeToString(e)}' — emitting 'unknown'`),`unknown`)}isLeaf(e){let t=this.ts.TypeFlags;return(e.flags&(t.String|t.Number|t.Boolean|t.BigInt|t.ESSymbol|t.Any|t.Unknown|t.Never|t.Void|t.Undefined|t.Null|t.BooleanLiteral))!==0||e.isLiteral()}hoistDeep(e){if(++this.truncations>this.budget)throw ha;let t=this.allocName();this.hoistedByType.set(e,t);let n=this.blocks.length;return this.blocks.push(``),this.blocks[n]=this.isPlainObject(e)?`interface ${t} {\n${this.members(e,0,` `)}\n}`:`type ${t} = ${this.render(e,0,!1)}`,t}isPlainObject(e){return(e.flags&this.ts.TypeFlags.Object)!==0&&!e.isUnionOrIntersection()&&!this.isTuple(e)&&!this.arrayElement(e)&&!this.toJsonType(e)&&!this.isLibType(e)}renderObject(e,t){let n=this.hoistedByType.get(e);if(n)return n;if(this.isNamed(e)){let t=this.allocName();this.hoistedByType.set(e,t);let n=this.blocks.length;return this.blocks.push(``),this.blocks[n]=`interface ${t} {\n${this.members(e,0,` `)}\n}`,t}let r=this.inProgress.get(e);if(r)return r.name??=this.allocName();let i={name:null};this.inProgress.set(e,i);let a;try{a=this.members(e,t,``,`; `)}finally{this.inProgress.delete(e)}if(i.name){this.hoistedByType.set(e,i.name);let t=this.blocks.length;return this.blocks.push(``),this.blocks[t]=`interface ${i.name} {\n${this.members(e,0,` `)}\n}`,i.name}return a.length>0?`{ ${a} }`:`{}`}allocName(){return`__T${this.nextName++}`}members(e,t,n,r=`
785
+ `}function oa(e,t,n){if(e===null)return`unknown`;let r=M(n);if(e===``){let e=P(r,t).split(I).join(`/`);return e=e.replace(/\.(ts|tsx|mts|cts)$/i,``),e.startsWith(`.`)||(e=`./`+e),e}if(!e.startsWith(`.`)&&!e.startsWith(`/`))return e;let i=M(t),a=F(i,e),o=P(r,a).split(I).join(`/`);return o=o.replace(/\.(ts|tsx|mts|cts)$/i,``),o.startsWith(`.`)||(o=`./`+o),o}function sa(e){let t=e.endsWith(`Controller`)?e.slice(0,-10):e,n=t.length>0?t:e;return n.charAt(0).toLowerCase()+n.slice(1)}const ca=()=>({id:`kick/routes`,outExtension:`.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){let t=await e.getScanResult({root:la(e),cwd:e.cwd,envFile:ua(e)}),n=e.config?.typegen?.schemaValidator??`zod`,r=j.resolve(e.cwd,`.kickjs/types/kick__routes.ts`);return ea(t.routes,r,n,{onWarn:t=>e.log.warn(t)})}});function la(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function ua(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}const da=`@typescript/typescript6`;function fa(e){return typeof e?.createProgram==`function`}function pa(e){if(fa(e.typescript))return{api:e.typescript,source:`typescript`};if(fa(e.ts6))return{api:e.ts6,source:da};let t=`Install it in the project:\n ${g()} add -D ${da}`;throw e.typescript?Error(`kick typegen: the client route map needs a TypeScript compiler API.
786
+ TypeScript 7 does not ship a compiler API, so the compatibility package is required.\n ${t}`):Error(`kick typegen: the client route map needs a TypeScript compiler API, and neither 'typescript' nor '${da}' resolved from this project.\n ${t}`)}async function ma(e){let t=bt(N(e,`package.json`)),n=async e=>{try{return await import(H(t.resolve(e)).href)}catch{return null}},[r,i]=await Promise.all([n(`typescript`),n(da)]);return pa({typescript:ha(r),ts6:ha(i)}).api}function ha(e){let t=e;return t?.default&&typeof t.default==`object`?t.default:e}const ga=Symbol(`kick/client: expansion budget exhausted`);var _a=class{ts;checker;program;opts;get printFlags(){return this.ts.TypeFormatFlags.NoTruncation}hoistedByType=/* @__PURE__ */ new Map;inProgress=/* @__PURE__ */ new Map;jsonInProgress=/* @__PURE__ */ new Set;nextName=0;blocks=[];maxDepth;truncations=0;budget;constructor(e,t,n,r={}){this.ts=e,this.checker=t,this.program=n,this.opts=r,this.maxDepth=r.maxDepth??12,this.budget=r.truncationBudget??1e3}hoisted(){return this.blocks}expand(e){this.truncations=0;let t=this.blocks.length,n=this.nextName,r=new Set(this.hoistedByType.keys());try{return this.render(e,0)}catch(e){if(e!==ga)throw e;this.blocks.length=t,this.nextName=n;for(let e of this.hoistedByType.keys())r.has(e)||this.hoistedByType.delete(e);return this.opts.onWarn?.(`expansion abandoned after ${this.budget} depth hoists — emitting 'unknown'. Either the response type never repeats (a generic that grows at every level) or it nests more distinct types than the budget allows; raising maxDepth hoists fewer of them. Declare a response schema on the route for an exact type.`),`unknown`}}render(e,t,n=!0){let r=this.ts.TypeFlags;if(n){let t=this.hoistedByType.get(e);if(t)return t}if(t>this.maxDepth&&!this.isLeaf(e))return this.hoistDeep(e);if(e.flags&(r.String|r.Number|r.Boolean|r.BigInt|r.ESSymbol)||e.flags&(r.Any|r.Unknown|r.Never|r.Void|r.Undefined|r.Null)||e.isLiteral()||e.flags&r.BooleanLiteral)return this.checker.typeToString(e,void 0,this.printFlags);if(e.isUnion()){let n=e.types.filter(e=>!this.isCallable(e));return(n.length>0?n:e.types).map(e=>this.render(e,t+1)).join(` | `)}if(e.isIntersection())return e.types.map(e=>this.render(e,t+1)).join(` & `);if(this.isTuple(e))return this.renderTuple(e,t);let i=this.arrayElement(e);if(i){let e=this.render(i.element,t+1),n=/[|&]/.test(e)?`(${e})[]`:`${e}[]`;return i.readonly?`readonly ${n}`:n}let a=this.toJsonType(e);if(a){if(this.jsonInProgress.has(e))return this.opts.onWarn?.(`'${this.checker.typeToString(e,void 0,this.printFlags)}' has a cyclic toJSON() — emitting 'unknown', since it has no serializable form.`),`unknown`;this.jsonInProgress.add(e);try{return this.render(a,t)}finally{this.jsonInProgress.delete(e)}}return this.isLibType(e)?this.renderLibType(e,t):e.flags&r.Object?this.renderObject(e,t):(this.opts.onWarn?.(`could not expand type '${this.checker.typeToString(e)}' — emitting 'unknown'`),`unknown`)}isLeaf(e){let t=this.ts.TypeFlags;return(e.flags&(t.String|t.Number|t.Boolean|t.BigInt|t.ESSymbol|t.Any|t.Unknown|t.Never|t.Void|t.Undefined|t.Null|t.BooleanLiteral))!==0||e.isLiteral()}hoistDeep(e){if(++this.truncations>this.budget)throw ga;let t=this.allocName();this.hoistedByType.set(e,t);let n=this.blocks.length;return this.blocks.push(``),this.blocks[n]=this.isPlainObject(e)?`interface ${t} {\n${this.members(e,0,` `)}\n}`:`type ${t} = ${this.render(e,0,!1)}`,t}isPlainObject(e){return(e.flags&this.ts.TypeFlags.Object)!==0&&!e.isUnionOrIntersection()&&!this.isTuple(e)&&!this.arrayElement(e)&&!this.toJsonType(e)&&!this.isLibType(e)}renderObject(e,t){let n=this.hoistedByType.get(e);if(n)return n;if(this.isNamed(e)){let t=this.allocName();this.hoistedByType.set(e,t);let n=this.blocks.length;return this.blocks.push(``),this.blocks[n]=`interface ${t} {\n${this.members(e,0,` `)}\n}`,t}let r=this.inProgress.get(e);if(r)return r.name??=this.allocName();let i={name:null};this.inProgress.set(e,i);let a;try{a=this.members(e,t,``,`; `)}finally{this.inProgress.delete(e)}if(i.name){this.hoistedByType.set(e,i.name);let t=this.blocks.length;return this.blocks.push(``),this.blocks[t]=`interface ${i.name} {\n${this.members(e,0,` `)}\n}`,i.name}return a.length>0?`{ ${a} }`:`{}`}allocName(){return`__T${this.nextName++}`}members(e,t,n,r=`
787
787
  `){let i=[];for(let r of this.checker.getIndexInfosOfType(e)){let e=this.checker.typeToString(r.keyType,void 0,this.printFlags);i.push(`${n}[key: ${e}]: ${this.render(r.type,t+1)}`)}for(let r of this.checker.getPropertiesOfType(e)){let e=this.typeOfProperty(r);if(this.isCallable(e)||r.getName().startsWith(`__@`))continue;let a=(r.flags&this.ts.SymbolFlags.Optional)!==0,o=this.renderPropertyType(e,a,r,t+1),s=this.isReadonlyProp(r)?`readonly `:``;i.push(`${n}${s}${this.propName(r.getName())}${a?`?`:``}: ${o}`)}return i.join(r===`
788
788
  `?`
789
- `:r)}typeOfProperty(e){let t=this.checker;if(typeof t.getTypeOfSymbol==`function`)return t.getTypeOfSymbol(e);let n=e.valueDeclaration??e.declarations?.[0];return n?this.checker.getTypeOfSymbolAtLocation(e,n):this.checker.getDeclaredTypeOfSymbol(e)}renderPropertyType(e,t,n,r){if(!t||!e.isUnion()||this.declaresUndefined(n))return this.render(e,r);let i=e.types.filter(e=>!(e.flags&this.ts.TypeFlags.Undefined));return i.length===0?`undefined`:i.map(e=>this.render(e,r)).join(` | `)}isReadonlyProp(e){let t=e.valueDeclaration??e.declarations?.[0];return t?(this.ts.getCombinedModifierFlags(t)&this.ts.ModifierFlags.Readonly)!==0:!1}declaresUndefined(e){let t=e.valueDeclaration??e.declarations?.[0];if(!t||!(this.ts.isPropertySignature(t)||this.ts.isPropertyDeclaration(t))||!t.type)return!1;let n=this.checker.getTypeFromTypeNode(t.type);return(n.isUnion()?n.types:[n]).some(e=>(e.flags&this.ts.TypeFlags.Undefined)!==0)}renderTuple(e,t){let n=this.ts.ElementFlags,r=this.checker.getTypeArguments(e),i=e.target,a=i.elementFlags??[],o=r.map((e,r)=>{let i=a[r]??n.Required;return i&n.Optional?`${(e.isUnion()?e.types.filter(e=>!(e.flags&this.ts.TypeFlags.Undefined)):[e]).map(e=>this.render(e,t+1)).join(` | `)}?`:i&n.Rest?`...${this.render(e,t+1)}[]`:i&n.Variadic?`...${this.render(e,t+1)}`:this.render(e,t+1)});return`${i.readonly?`readonly `:``}[${o.join(`, `)}]`}propName(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}isLibType(e){let t=e.aliasSymbol?.declarations??e.getSymbol()?.declarations;return!t||t.length===0?!1:t.every(e=>this.program.isSourceFileDefaultLibrary(e.getSourceFile()))}renderLibType(e,t){let n=(e.aliasSymbol??e.getSymbol())?.getName(),r=e.aliasTypeArguments??this.typeArguments(e);return!n||r.length===0?this.checker.typeToString(e,void 0,this.printFlags):`${n}<${r.map(e=>this.render(e,t+1)).join(`, `)}>`}typeArguments(e){return!(e.flags&this.ts.TypeFlags.Object)||!(e.objectFlags&this.ts.ObjectFlags.Reference)?[]:this.checker.getTypeArguments(e)}toJsonType(e){if(!(e.flags&this.ts.TypeFlags.Object))return null;let t=this.checker.getPropertyOfType(e,`toJSON`);if(!t)return null;let[n]=this.checker.getSignaturesOfType(this.typeOfProperty(t),this.ts.SignatureKind.Call);if(!n)return null;let r=this.checker.getReturnTypeOfSignature(n);return r===e?null:r}isCallable(e){if(e.isUnion()){let t=e.types.filter(e=>!(e.flags&(this.ts.TypeFlags.Undefined|this.ts.TypeFlags.Null)));return t.length>0&&t.every(e=>this.isCallable(e))}return this.checker.getSignaturesOfType(e,this.ts.SignatureKind.Call).length>0||this.checker.getSignaturesOfType(e,this.ts.SignatureKind.Construct).length>0}isNamed(e){let t=e.getSymbol();if(!t)return!1;let n=t.getName();return n!==`__type`&&n!==`__object`&&n.length>0}isTuple(e){let t=this.ts.ObjectFlags;if(!(e.flags&this.ts.TypeFlags.Object)||!(e.objectFlags&t.Reference))return!1;let n=e.target;return!!(n&&n.objectFlags&t.Tuple)}arrayElement(e){let t=e.getSymbol()?.getName();if(t!==`Array`&&t!==`ReadonlyArray`)return null;let n=this.checker.getTypeArguments(e);return n.length===1?{element:n[0],readonly:t===`ReadonlyArray`}:null}};const _a=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`],va=/(?:^|[\\/])(?:node_modules|\.kickjs)(?:[\\/]|$)/;function ya(e){return Ft(`sha1`).update(e).digest(`hex`)}function ba(e){let t=Ft(`sha1`);t.update(e.cliVersion),t.update(JSON.stringify(e.options??{})),t.update(e.keys.join(`
790
- `));for(let n of _a){let r=N(e.projectDir,n);if(L(r))try{t.update(R(r))}catch(e){throw Error(`kick/client: cannot read lockfile ${r}`,{cause:e})}}for(let n of e.fileNames.toSorted())if(!va.test(n)){t.update(n);try{t.update(R(n))}catch(e){throw Error(`kick/client: cannot read project file ${n}`,{cause:e})}}return t.digest(`hex`)}async function xa(e){try{let t=await pa(e.compilerFrom??e.projectDir),n={...t.sys,onUnRecoverableConfigFileDiagnostic:()=>{}},r=t.getParsedCommandLineOfConfigFile(N(e.projectDir,`tsconfig.json`),{},n);return r?ba({projectDir:e.projectDir,fileNames:r.fileNames,keys:e.keys,options:{...r.options,__kickMaxDepth:e.maxDepth??null},cliVersion:e.cliVersion}):null}catch{return null}}async function Sa(e){let t=await pa(e.compilerFrom??e.projectDir),n=N(M(e.routesFile),`__kick_client_probe__.ts`),r=Ta(e.routesFile,e.keys),i=Oa(t,e.projectDir,n,r),a=i.getTypeChecker(),o=i.getSourceFile(n);if(!o)throw Error(`kick/client: could not add the resolution probe to the program. Check that ${e.routesFile} exists — run \`kick typegen\` first.`);Ca(t,i,e.routesFile);let s=Ea(t,i,o,e.keys),c=null,l=new ga(t,a,i,{maxDepth:e.maxDepth,onWarn:t=>e.onWarn?.(c?`route '${c}': ${t}`:t)}),u=/* @__PURE__ */ new Map;for(let[n,r]of e.keys.entries()){if(s.has(r)){e.onWarn?.(`route '${r}' is not present in KickRoutes.Api — skipped. Re-run \`kick typegen\` so the two maps agree.`);continue}let i=o.statements.find(e=>t.isTypeAliasDeclaration(e)&&e.name.text===wa(n));if(!i){e.onWarn?.(`route '${r}' could not be resolved — skipped.`);continue}let d=a.getTypeAtLocation(i.type);d.flags&t.TypeFlags.Any?e.onWarn?.(`route '${r}' resolved to 'any' — skipped rather than emitted, since an 'any' entry silently accepts every call. Check that the server type-checks.`):(c=r,u.set(r,l.expand(d)),c=null)}return{entries:u,hoisted:l.hoisted()}}function Ca(e,t,n){let r=t.getSourceFile(n);if(!r)throw Error(`kick/client: ${n} is not in the TypeScript program. Run \`kick typegen\` first, and check that tsconfig.json includes .kickjs.`);let i=t.getSemanticDiagnostics(r);if(i.length===0)return;let a=i.slice(0,3).map(t=>` ${e.flattenDiagnosticMessageText(t.messageText,` `)}`).join(`
791
- `);throw Error(`${n} has ${i.length} type error(s), so its route types cannot be resolved — every entry would come out as 'any'.\n${a}\n Usually this means dependencies are not installed or the server does not type-check.`)}function wa(e){return`_K${e}`}function Ta(e,t){let n=`./`+xt(e).replace(/\.tsx?$/,``),r=t.map((e,t)=>`type ${wa(t)} = KickRoutes.Api[${JSON.stringify(e)}]`);return[`import ${JSON.stringify(n)}`,...r].join(`
789
+ `:r)}typeOfProperty(e){let t=this.checker;if(typeof t.getTypeOfSymbol==`function`)return t.getTypeOfSymbol(e);let n=e.valueDeclaration??e.declarations?.[0];return n?this.checker.getTypeOfSymbolAtLocation(e,n):this.checker.getDeclaredTypeOfSymbol(e)}renderPropertyType(e,t,n,r){if(!t||!e.isUnion()||this.declaresUndefined(n))return this.render(e,r);let i=e.types.filter(e=>!(e.flags&this.ts.TypeFlags.Undefined));return i.length===0?`undefined`:i.map(e=>this.render(e,r)).join(` | `)}isReadonlyProp(e){let t=e.valueDeclaration??e.declarations?.[0];return t?(this.ts.getCombinedModifierFlags(t)&this.ts.ModifierFlags.Readonly)!==0:!1}declaresUndefined(e){let t=e.valueDeclaration??e.declarations?.[0];if(!t||!(this.ts.isPropertySignature(t)||this.ts.isPropertyDeclaration(t))||!t.type)return!1;let n=this.checker.getTypeFromTypeNode(t.type);return(n.isUnion()?n.types:[n]).some(e=>(e.flags&this.ts.TypeFlags.Undefined)!==0)}renderTuple(e,t){let n=this.ts.ElementFlags,r=this.checker.getTypeArguments(e),i=e.target,a=i.elementFlags??[],o=r.map((e,r)=>{let i=a[r]??n.Required;return i&n.Optional?`${(e.isUnion()?e.types.filter(e=>!(e.flags&this.ts.TypeFlags.Undefined)):[e]).map(e=>this.render(e,t+1)).join(` | `)}?`:i&n.Rest?`...${this.render(e,t+1)}[]`:i&n.Variadic?`...${this.render(e,t+1)}`:this.render(e,t+1)});return`${i.readonly?`readonly `:``}[${o.join(`, `)}]`}propName(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}isLibType(e){let t=e.aliasSymbol?.declarations??e.getSymbol()?.declarations;return!t||t.length===0?!1:t.every(e=>this.program.isSourceFileDefaultLibrary(e.getSourceFile()))}renderLibType(e,t){let n=(e.aliasSymbol??e.getSymbol())?.getName(),r=e.aliasTypeArguments??this.typeArguments(e);return!n||r.length===0?this.checker.typeToString(e,void 0,this.printFlags):`${n}<${r.map(e=>this.render(e,t+1)).join(`, `)}>`}typeArguments(e){return!(e.flags&this.ts.TypeFlags.Object)||!(e.objectFlags&this.ts.ObjectFlags.Reference)?[]:this.checker.getTypeArguments(e)}toJsonType(e){if(!(e.flags&this.ts.TypeFlags.Object))return null;let t=this.checker.getPropertyOfType(e,`toJSON`);if(!t)return null;let[n]=this.checker.getSignaturesOfType(this.typeOfProperty(t),this.ts.SignatureKind.Call);if(!n)return null;let r=this.checker.getReturnTypeOfSignature(n);return r===e?null:r}isCallable(e){if(e.isUnion()){let t=e.types.filter(e=>!(e.flags&(this.ts.TypeFlags.Undefined|this.ts.TypeFlags.Null)));return t.length>0&&t.every(e=>this.isCallable(e))}return this.checker.getSignaturesOfType(e,this.ts.SignatureKind.Call).length>0||this.checker.getSignaturesOfType(e,this.ts.SignatureKind.Construct).length>0}isNamed(e){let t=e.getSymbol();if(!t)return!1;let n=t.getName();return n!==`__type`&&n!==`__object`&&n.length>0}isTuple(e){let t=this.ts.ObjectFlags;if(!(e.flags&this.ts.TypeFlags.Object)||!(e.objectFlags&t.Reference))return!1;let n=e.target;return!!(n&&n.objectFlags&t.Tuple)}arrayElement(e){let t=e.getSymbol()?.getName();if(t!==`Array`&&t!==`ReadonlyArray`)return null;let n=this.checker.getTypeArguments(e);return n.length===1?{element:n[0],readonly:t===`ReadonlyArray`}:null}};const va=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`],ya=/(?:^|[\\/])(?:node_modules|\.kickjs)(?:[\\/]|$)/;function ba(e){return Ft(`sha1`).update(e).digest(`hex`)}function xa(e){let t=Ft(`sha1`);t.update(e.cliVersion),t.update(JSON.stringify(e.options??{})),t.update(e.keys.join(`
790
+ `));for(let n of va){let r=N(e.projectDir,n);if(L(r))try{t.update(R(r))}catch(e){throw Error(`kick/client: cannot read lockfile ${r}`,{cause:e})}}for(let n of e.fileNames.toSorted())if(!ya.test(n)){t.update(n);try{t.update(R(n))}catch(e){throw Error(`kick/client: cannot read project file ${n}`,{cause:e})}}return t.digest(`hex`)}async function Sa(e){try{let t=await ma(e.compilerFrom??e.projectDir),n={...t.sys,onUnRecoverableConfigFileDiagnostic:()=>{}},r=t.getParsedCommandLineOfConfigFile(N(e.projectDir,`tsconfig.json`),{},n);return r?xa({projectDir:e.projectDir,fileNames:r.fileNames,keys:e.keys,options:{...r.options,__kickMaxDepth:e.maxDepth??null},cliVersion:e.cliVersion}):null}catch{return null}}async function Ca(e){let t=await ma(e.compilerFrom??e.projectDir),n=N(M(e.routesFile),`__kick_client_probe__.ts`),r=Ea(e.routesFile,e.keys),i=ka(t,e.projectDir,n,r),a=i.getTypeChecker(),o=i.getSourceFile(n);if(!o)throw Error(`kick/client: could not add the resolution probe to the program. Check that ${e.routesFile} exists — run \`kick typegen\` first.`);wa(t,i,e.routesFile);let s=Da(t,i,o,e.keys),c=null,l=new _a(t,a,i,{maxDepth:e.maxDepth,onWarn:t=>e.onWarn?.(c?`route '${c}': ${t}`:t)}),u=/* @__PURE__ */ new Map;for(let[n,r]of e.keys.entries()){if(s.has(r)){e.onWarn?.(`route '${r}' is not present in KickRoutes.Api — skipped. Re-run \`kick typegen\` so the two maps agree.`);continue}let i=o.statements.find(e=>t.isTypeAliasDeclaration(e)&&e.name.text===Ta(n));if(!i){e.onWarn?.(`route '${r}' could not be resolved — skipped.`);continue}let d=a.getTypeAtLocation(i.type);d.flags&t.TypeFlags.Any?e.onWarn?.(`route '${r}' resolved to 'any' — skipped rather than emitted, since an 'any' entry silently accepts every call. Check that the server type-checks.`):(c=r,u.set(r,l.expand(d)),c=null)}return{entries:u,hoisted:l.hoisted()}}function wa(e,t,n){let r=t.getSourceFile(n);if(!r)throw Error(`kick/client: ${n} is not in the TypeScript program. Run \`kick typegen\` first, and check that tsconfig.json includes .kickjs.`);let i=t.getSemanticDiagnostics(r);if(i.length===0)return;let a=i.slice(0,3).map(t=>` ${e.flattenDiagnosticMessageText(t.messageText,` `)}`).join(`
791
+ `);throw Error(`${n} has ${i.length} type error(s), so its route types cannot be resolved — every entry would come out as 'any'.\n${a}\n Usually this means dependencies are not installed or the server does not type-check.`)}function Ta(e){return`_K${e}`}function Ea(e,t){let n=`./`+xt(e).replace(/\.tsx?$/,``),r=t.map((e,t)=>`type ${Ta(t)} = KickRoutes.Api[${JSON.stringify(e)}]`);return[`import ${JSON.stringify(n)}`,...r].join(`
792
792
  `)+`
793
- `}function Ea(e,t,n,r){let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map;for(let t of n.statements)e.isTypeAliasDeclaration(t)&&a.set(t.name.text,t);for(let e of t.getSemanticDiagnostics(n))if(e.start!==void 0)for(let[t,o]of r.entries()){let r=a.get(wa(t));r&&e.start>=r.getStart(n)&&e.start<r.getEnd()&&i.add(o)}return i}function Da(e,t){let n=e.filter(e=>/\.d\.(ts|mts|cts)$/.test(e)),r=[];try{r=z(t).filter(e=>e.endsWith(`.ts`)).map(e=>N(t,e))}catch{}return[.../* @__PURE__ */ new Set([...n,...r])]}function Oa(e,t,n,r){let i=N(t,`tsconfig.json`),a={...e.sys,onUnRecoverableConfigFileDiagnostic:t=>{throw Error(e.flattenDiagnosticMessageText(t.messageText,`
794
- `))}},o=e.getParsedCommandLineOfConfigFile(i,{},a);if(!o)throw Error(`kick/client: could not read ${i}`);let s=e.createCompilerHost(o.options,!0),c=s.readFile.bind(s),l=s.getSourceFile.bind(s),u=s.fileExists.bind(s);return s.readFile=e=>e===n?r:c(e),s.fileExists=e=>e===n||u(e),s.getSourceFile=(t,i,a,o)=>t===n?e.createSourceFile(t,r,i,!0):l(t,i,a,o),e.createProgram({rootNames:[...Da(o.fileNames,M(n)),n],options:o.options,host:s})}const ka=`/* eslint-disable */
793
+ `}function Da(e,t,n,r){let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map;for(let t of n.statements)e.isTypeAliasDeclaration(t)&&a.set(t.name.text,t);for(let e of t.getSemanticDiagnostics(n))if(e.start!==void 0)for(let[t,o]of r.entries()){let r=a.get(Ta(t));r&&e.start>=r.getStart(n)&&e.start<r.getEnd()&&i.add(o)}return i}function Oa(e,t){let n=e.filter(e=>/\.d\.(ts|mts|cts)$/.test(e)),r=[];try{r=z(t).filter(e=>e.endsWith(`.ts`)).map(e=>N(t,e))}catch{}return[.../* @__PURE__ */ new Set([...n,...r])]}function ka(e,t,n,r){let i=N(t,`tsconfig.json`),a={...e.sys,onUnRecoverableConfigFileDiagnostic:t=>{throw Error(e.flattenDiagnosticMessageText(t.messageText,`
794
+ `))}},o=e.getParsedCommandLineOfConfigFile(i,{},a);if(!o)throw Error(`kick/client: could not read ${i}`);let s=e.createCompilerHost(o.options,!0),c=s.readFile.bind(s),l=s.getSourceFile.bind(s),u=s.fileExists.bind(s);return s.readFile=e=>e===n?r:c(e),s.fileExists=e=>e===n||u(e),s.getSourceFile=(t,i,a,o)=>t===n?e.createSourceFile(t,r,i,!0):l(t,i,a,o),e.createProgram({rootNames:[...Oa(o.fileNames,M(n)),n],options:o.options,host:s})}const Aa=`/* eslint-disable */
795
795
  // AUTO-GENERATED by \`kick typegen\`. DO NOT EDIT.
796
796
  //
797
797
  // Self-contained: this file has no imports, so a frontend consumes it without
@@ -805,7 +805,7 @@ ${_}
805
805
  //
806
806
  // Written when \`kick dev\` starts, not on save — resolving these types builds a
807
807
  // full TypeScript program over the server. Re-run \`kick typegen\`.
808
- `;function Aa(e,t){let n=t.filter(t=>e.entries.has(t));if(n.length===0)return`${ka}
808
+ `;function ja(e,t){let n=t.filter(t=>e.entries.has(t));if(n.length===0)return`${Aa}
809
809
  // (no routes discovered yet — annotate a controller method with
810
810
  // @Get/@Post/@Put/@Delete/@Patch and re-run \`kick typegen\`)
811
811
  interface Api {}
@@ -822,7 +822,7 @@ export type { Api }
822
822
 
823
823
  `)+`
824
824
 
825
- `:``,i=n.map(t=>` ${JSON.stringify(t)}: ${e.entries.get(t)}`);return`${ka}
825
+ `:``,i=n.map(t=>` ${JSON.stringify(t)}: ${e.entries.get(t)}`);return`${Aa}
826
826
  ${r}interface Api {
827
827
  ${i.join(`
828
828
  `)}
@@ -836,7 +836,7 @@ declare global {
836
836
  }
837
837
 
838
838
  export type { Api }
839
- `}const ja=`kick/client`,Q=`.kickjs/types/kick__client.d.ts`,Ma=`.kickjs/cache/client-map.sha1`,Na=(()=>{try{return bt(import.meta.url)(`../../../package.json`).version??`0.0.0`}catch{return`0.0.0`}})();function Pa(e){try{if(!L(e))return null;let[t,n]=R(e,`utf-8`).trim().split(/\s+/);return t&&n?{inputs:t,output:n}:null}catch{return null}}function Fa(e){return`${wn}${ja} */\n\n${e}\n`}function Ia(e){try{return L(e)?R(e,`utf-8`):null}catch{return null}}async function La(e){let t=j.resolve(e.cwd,Q);if(!L(t))return!1;try{await kt(t,{force:!0})}catch(t){return e.log.warn(` kick/client: could not remove the stale ${Q} — treat it as out of date (${t instanceof Error?t.message:String(t)})`),!0}return e.log.warn(` kick/client: removed the previously generated ${Q} rather than leave a stale one — re-run \`kick typegen\` once the cause above is fixed.`),!0}function Ra(e){let t=e?.typegen?.client;return typeof t==`object`?t.maxDepth:void 0}function za(e){let t=e.config?.typegen?.client;return typeof t==`boolean`?t:t&&typeof t==`object`?t.enabled!==!1:(L(j.resolve(e.cwd,Q))&&e.log.warn(` kick/client: ${Q} exists but typegen.client is not set, so it is NOT being refreshed.\n Add \`typegen: { client: true }\` to kick.config.ts to keep it current, or delete the file if nothing reads it.`),!1)}const Ba=()=>({id:ja,outExtension:`.d.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){if(!za(e))return null;if(e.watch)return e.log.info?.(" kick/client: skipped under watch (builds a full TypeScript program). Run `kick typegen` to refresh the client route map."),null;let t=await e.getScanResult({root:j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`),cwd:e.cwd}),n=[],r=/* @__PURE__ */ new Set;for(let e of t.routes){let t=`${e.httpMethod} ${e.mountedPath??e.path}`;r.has(t)||(r.add(t),n.push(t))}let i=Ra(e.config),a=await xa({projectDir:e.cwd,keys:n,maxDepth:i,cliVersion:Na}),o=Pa(j.resolve(e.cwd,Ma)),s=Ia(j.resolve(e.cwd,Q));if(a&&o&&s!==null&&o.inputs===a&&o.output===ya(s))return le()&&e.log.info?.(` kick/client: unchanged, keeping ${Q}`),null;try{let t=Aa(await Sa({projectDir:e.cwd,routesFile:j.resolve(e.cwd,`.kickjs/types/kick__routes.ts`),keys:n,maxDepth:i,onWarn:t=>e.log.warn(t)}),n);return a&&!e.check&&await e.writeFile(Ma,`${a} ${ya(Fa(t))}`),t}catch(t){let n=L(j.resolve(e.cwd,Q)),r=` kick/client: skipped — ${t instanceof Error?t.message:String(t)}`;return n?e.log.warn(r):le()&&e.log.info?.(r),n&&await La(e),null}}});function Va(e,t,n=`zod`){if(!e)return null;let r=M(t),i=P(r,e.filePath).split(I).join(`/`);return i=i.replace(/\.(ts|tsx|mts|cts)$/i,``),i.startsWith(`.`)||(i=`./`+i),`/* eslint-disable */
839
+ `}const Ma=`kick/client`,Q=`.kickjs/types/kick__client.d.ts`,Na=`.kickjs/cache/client-map.sha1`,Pa=(()=>{try{return bt(import.meta.url)(`../../../package.json`).version??`0.0.0`}catch{return`0.0.0`}})();function Fa(e){try{if(!L(e))return null;let[t,n]=R(e,`utf-8`).trim().split(/\s+/);return t&&n?{inputs:t,output:n}:null}catch{return null}}function Ia(e){return`${wn}${Ma} */\n\n${e}\n`}function La(e){try{return L(e)?R(e,`utf-8`):null}catch{return null}}async function Ra(e){let t=j.resolve(e.cwd,Q);if(!L(t))return!1;try{await kt(t,{force:!0})}catch(t){return e.log.warn(` kick/client: could not remove the stale ${Q} — treat it as out of date (${t instanceof Error?t.message:String(t)})`),!0}return e.log.warn(` kick/client: removed the previously generated ${Q} rather than leave a stale one — re-run \`kick typegen\` once the cause above is fixed.`),!0}function za(e){let t=e?.typegen?.client;return typeof t==`object`?t.maxDepth:void 0}function Ba(e){let t=e.config?.typegen?.client;return typeof t==`boolean`?t:t&&typeof t==`object`?t.enabled!==!1:(L(j.resolve(e.cwd,Q))&&e.log.warn(` kick/client: ${Q} exists but typegen.client is not set, so it is NOT being refreshed.\n Add \`typegen: { client: true }\` to kick.config.ts to keep it current, or delete the file if nothing reads it.`),!1)}const Va=()=>({id:Ma,outExtension:`.d.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){if(!Ba(e))return null;if(e.watch)return e.log.info?.(" kick/client: skipped under watch (builds a full TypeScript program). Run `kick typegen` to refresh the client route map."),null;let t=await e.getScanResult({root:j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`),cwd:e.cwd}),n=[],r=/* @__PURE__ */ new Set;for(let e of t.routes){let t=`${e.httpMethod} ${e.mountedPath??e.path}`;r.has(t)||(r.add(t),n.push(t))}let i=za(e.config),a=await Sa({projectDir:e.cwd,keys:n,maxDepth:i,cliVersion:Pa}),o=Fa(j.resolve(e.cwd,Na)),s=La(j.resolve(e.cwd,Q));if(a&&o&&s!==null&&o.inputs===a&&o.output===ba(s))return le()&&e.log.info?.(` kick/client: unchanged, keeping ${Q}`),null;try{let t=ja(await Ca({projectDir:e.cwd,routesFile:j.resolve(e.cwd,`.kickjs/types/kick__routes.ts`),keys:n,maxDepth:i,onWarn:t=>e.log.warn(t)}),n);return a&&!e.check&&await e.writeFile(Na,`${a} ${ba(Ia(t))}`),t}catch(t){let n=L(j.resolve(e.cwd,Q)),r=` kick/client: skipped — ${t instanceof Error?t.message:String(t)}`;return n?e.log.warn(r):le()&&e.log.info?.(r),n&&await Ra(e),null}}});function Ha(e,t,n=`zod`){if(!e)return null;let r=M(t),i=P(r,e.filePath).split(I).join(`/`);return i=i.replace(/\.(ts|tsx|mts|cts)$/i,``),i.startsWith(`.`)||(i=`./`+i),`/* eslint-disable */
840
840
  // AUTO-GENERATED by \`kick typegen\`. DO NOT EDIT.
841
841
  // Re-run with \`kick typegen\` or rely on \`kick dev\` to refresh.
842
842
 
@@ -874,6 +874,6 @@ declare global {
874
874
  }
875
875
 
876
876
  export {}
877
- `}const Ha=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Wa(e);if(t===!1)return null;let n=await e.getScanResult({root:Ua(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=j.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return Va(n.env,i,r)}});function Ua(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Wa(e){return e.config?.typegen?.envFile}function Ga(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Ka(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:Ga(e),cwd:e.cwd,envFile:Ka(e)}}const qa=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=j.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return at(t.classes,n,r)}}),Ja=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className)),r=lt(t.classes,t.tokens,t.injects,n);return ut(`ServiceToken`,r,"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),Ya=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ut(`ModuleToken`,rt(t.classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),Xa=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return it(t.pluginsAndAdapters)}}),Za=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:gt(t.contextKeys)}}),Qa=()=>({id:`kick/route-flags`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ft(t.routeFlags)}}),$a={express:{subpath:`@forinda/kickjs/express`,typeName:`ExpressRuntimeTypes`},fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},eo=[k({name:`kick/init`,register:Ht}),k({name:`kick/generate`,register:Sn}),k({name:`kick/run`,register:Vn}),k({name:`kick/info`,register:Kn}),k({name:`kick/inspect`,register:nr}),k({name:`kick/add`,register:Ge}),k({name:`kick/runtime-swap`,register:vr}),k({name:`kick/list`,register:Fe}),k({name:`kick/explain`,register:jr}),k({name:`kick/mcp`,register:Hr}),k({name:`kick/tinker`,register:Kr}),k({name:`kick/remove`,register:Qr}),k({name:`kick/typegen`,register:ti}),k({name:`kick/check`,register:bi}),k({name:`kick/doctor`,register:ve}),k({name:`kick/env-command`,register:Di}),k({name:`kick/codemod`,register:ki}),k({name:`kick/deploy`,register:Xi}),k({name:`kick/registry`,typegens:[qa()]}),k({name:`kick/services`,typegens:[Ja()]}),k({name:`kick/modules`,typegens:[Ya()]}),k({name:`kick/plugins`,typegens:[Xa()]}),k({name:`kick/context`,typegens:[Za()]}),k({name:`kick/route-flags`,typegens:[Qa()]}),k({name:`kick/assets`,typegens:[Zi()]}),k({name:`kick/routes`,typegens:[sa()]}),k({name:`kick/client`,typegens:[Ba()]}),k({name:`kick/env`,typegens:[Ha()]}),k({name:`kick/runtime`,typegens:[{id:`kick/runtime`,outExtension:`.ts`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],async generate(e){let t=e.config?.runtime??`express`;if(t!==`express`&&t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=$a[t];return[`// Runtime escape-hatch types for the '${t}' engine (kick.config runtime).`,`declare module '@forinda/kickjs' {`,` interface KickRuntimeRegister {`,` runtime: import('${n}').${r}`,` }`,`}`,``,`export {}`,``].join(`
878
- `)}}]})];export{Dn as applyDisableFilter,On as n,Ut as r,kn as runAllPluginTypegens,eo as t};
879
- //# sourceMappingURL=run-plugins-CajtgfCU.mjs.map
877
+ `}const Ua=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Ga(e);if(t===!1)return null;let n=await e.getScanResult({root:Wa(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=j.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return Ha(n.env,i,r)}});function Wa(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Ga(e){return e.config?.typegen?.envFile}function Ka(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function qa(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:Ka(e),cwd:e.cwd,envFile:qa(e)}}const Ja=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=j.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return at(t.classes,n,r)}}),Ya=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className)),r=lt(t.classes,t.tokens,t.injects,n);return ut(`ServiceToken`,r,"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),Xa=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ut(`ModuleToken`,rt(t.classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),Za=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return it(t.pluginsAndAdapters)}}),Qa=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:gt(t.contextKeys)}}),$a=()=>({id:`kick/route-flags`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ft(t.routeFlags)}}),eo={express:{subpath:`@forinda/kickjs/express`,typeName:`ExpressRuntimeTypes`},fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},to=[k({name:`kick/init`,register:Ht}),k({name:`kick/generate`,register:Sn}),k({name:`kick/run`,register:Vn}),k({name:`kick/info`,register:Kn}),k({name:`kick/inspect`,register:nr}),k({name:`kick/add`,register:Ge}),k({name:`kick/runtime-swap`,register:vr}),k({name:`kick/list`,register:Fe}),k({name:`kick/explain`,register:jr}),k({name:`kick/mcp`,register:Hr}),k({name:`kick/tinker`,register:Kr}),k({name:`kick/remove`,register:Qr}),k({name:`kick/typegen`,register:ti}),k({name:`kick/check`,register:bi}),k({name:`kick/doctor`,register:ve}),k({name:`kick/env-command`,register:Di}),k({name:`kick/codemod`,register:ki}),k({name:`kick/deploy`,register:Zi}),k({name:`kick/registry`,typegens:[Ja()]}),k({name:`kick/services`,typegens:[Ya()]}),k({name:`kick/modules`,typegens:[Xa()]}),k({name:`kick/plugins`,typegens:[Za()]}),k({name:`kick/context`,typegens:[Qa()]}),k({name:`kick/route-flags`,typegens:[$a()]}),k({name:`kick/assets`,typegens:[Qi()]}),k({name:`kick/routes`,typegens:[ca()]}),k({name:`kick/client`,typegens:[Va()]}),k({name:`kick/env`,typegens:[Ua()]}),k({name:`kick/runtime`,typegens:[{id:`kick/runtime`,outExtension:`.ts`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],async generate(e){let t=e.config?.runtime??`express`;if(t!==`express`&&t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=eo[t];return[`// Runtime escape-hatch types for the '${t}' engine (kick.config runtime).`,`declare module '@forinda/kickjs' {`,` interface KickRuntimeRegister {`,` runtime: import('${n}').${r}`,` }`,`}`,``,`export {}`,``].join(`
878
+ `)}}]})];export{Dn as applyDisableFilter,On as n,Ut as r,kn as runAllPluginTypegens,to as t};
879
+ //# sourceMappingURL=run-plugins-R0bVf_nK.mjs.map