@forinda/kickjs-cli 8.14.6 → 8.14.7

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 (37) hide show
  1. package/dist/{agent-docs-C1fM3mXV.mjs → agent-docs-CUD3elJG.mjs} +3 -3
  2. package/dist/{agent-docs-C1fM3mXV.mjs.map → agent-docs-CUD3elJG.mjs.map} +1 -1
  3. package/dist/{agent-docs-DLkqhKAx.mjs → agent-docs-DzwNvQ0G.mjs} +2 -2
  4. package/dist/{build-B4vPtyvv.mjs → build-0aoBPorQ.mjs} +3 -3
  5. package/dist/{build-B4vPtyvv.mjs.map → build-0aoBPorQ.mjs.map} +1 -1
  6. package/dist/{build-C7756Hsu.mjs → build-B2wThv-0.mjs} +2 -2
  7. package/dist/{builtins-DXacDUD_.mjs → builtins-Ckn98Hr3.mjs} +4 -4
  8. package/dist/{builtins-CtquiRQB.mjs → builtins-Dq9ovs5L.mjs} +2 -2
  9. package/dist/cli.mjs +2 -2
  10. package/dist/{config-CI9pVF5P.mjs → config-BfhrCJ9S.mjs} +3 -3
  11. package/dist/{config-CI9pVF5P.mjs.map → config-BfhrCJ9S.mjs.map} +1 -1
  12. package/dist/{config-D80wnWgv.mjs → config-CHKQG7aQ.mjs} +2 -2
  13. package/dist/{doctor-CfU8GbJz.mjs → doctor-DXJYNedQ.mjs} +4 -4
  14. package/dist/{doctor-CfU8GbJz.mjs.map → doctor-DXJYNedQ.mjs.map} +1 -1
  15. package/dist/{fullstack-CaIzq2C5.mjs → fullstack-DQXClEtz.mjs} +3 -3
  16. package/dist/{fullstack-BNgFfRiv.mjs → fullstack-K1-O3_77.mjs} +4 -4
  17. package/dist/{fullstack-BNgFfRiv.mjs.map → fullstack-K1-O3_77.mjs.map} +1 -1
  18. package/dist/index.mjs +2 -2
  19. package/dist/{package-manager-BSW23HwO.mjs → package-manager-BSCsAZyQ.mjs} +3 -3
  20. package/dist/{package-manager-BSW23HwO.mjs.map → package-manager-BSCsAZyQ.mjs.map} +1 -1
  21. package/dist/{package-manager-ZvCCh0kq.mjs → package-manager-CWHW5A83.mjs} +2 -2
  22. package/dist/{plugin-DKrL6WH5.mjs → plugin-C5F2dwCl.mjs} +2 -2
  23. package/dist/{plugin-CXaj2i5Y.mjs → plugin-XJ8HIdpC.mjs} +2 -2
  24. package/dist/{project-Bwt2uuHp.mjs → project-DOVcja4S.mjs} +5 -5
  25. package/dist/{project-Bwt2uuHp.mjs.map → project-DOVcja4S.mjs.map} +1 -1
  26. package/dist/{project-root-dQZYvCXv.mjs → project-root-CozvpJPt.mjs} +3 -3
  27. package/dist/{project-root-dQZYvCXv.mjs.map → project-root-CozvpJPt.mjs.map} +1 -1
  28. package/dist/{project-root-DGZ8lAPG.mjs → project-root-MkUW8wOU.mjs} +2 -2
  29. package/dist/{project-Q1ml7trN.mjs → project-yL8Nuk0y.mjs} +4 -4
  30. package/dist/{rolldown-runtime-B3K4rer-.mjs → rolldown-runtime-BK_n0_DB.mjs} +1 -1
  31. package/dist/{run-plugins-C9dOrOSt.mjs → run-plugins-CDACNCtf.mjs} +4 -4
  32. package/dist/{run-plugins-C9dOrOSt.mjs.map → run-plugins-CDACNCtf.mjs.map} +1 -1
  33. package/dist/{typegen-VBagOQY4.mjs → typegen-DO4Dc5CU.mjs} +4 -4
  34. package/dist/{typegen-BwnKoL1q.mjs → typegen-M5-UDDP_.mjs} +5 -5
  35. package/dist/{typegen-BwnKoL1q.mjs.map → typegen-M5-UDDP_.mjs.map} +1 -1
  36. package/dist/{types-CHsKxl8b.mjs → types-3PX6Kk1w.mjs} +1 -1
  37. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.6
2
+ * @forinda/kickjs-cli v8.14.7
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-B3K4rer-.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-dQZYvCXv.mjs.map
11
+ import{t as e}from"./rolldown-runtime-BK_n0_DB.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-CozvpJPt.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-root-dQZYvCXv.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-CozvpJPt.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.6
2
+ * @forinda/kickjs-cli v8.14.7
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-B3K4rer-.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-BK_n0_DB.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.6
2
+ * @forinda/kickjs-cli v8.14.7
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-D80wnWgv.mjs";import{_ as r,i,n as a,r as o}from"./package-manager-ZvCCh0kq.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-CHKQG7aQ.mjs";import{_ as r,i,n as a,r as o}from"./package-manager-CWHW5A83.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-DLkqhKAx.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-VBagOQY4.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-DzwNvQ0G.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-DO4Dc5CU.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.6
2
+ * @forinda/kickjs-cli v8.14.7
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.6
2
+ * @forinda/kickjs-cli v8.14.7
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-B3K4rer-.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-BSW23HwO.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-CfU8GbJz.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-CI9pVF5P.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-Bwt2uuHp.mjs";import{t as O}from"./project-root-dQZYvCXv.mjs";import{n as k,t as Ye}from"./types-CHsKxl8b.mjs";import{t as Xe}from"./build-B4vPtyvv.mjs";import{n as Ze}from"./agent-docs-C1fM3mXV.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-BwnKoL1q.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-BNgFfRiv.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-BNgFfRiv.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-dQZYvCXv.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-BK_n0_DB.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-BSCsAZyQ.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-DXJYNedQ.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-BfhrCJ9S.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-DOVcja4S.mjs";import{t as O}from"./project-root-CozvpJPt.mjs";import{n as k,t as Ye}from"./types-3PX6Kk1w.mjs";import{t as Xe}from"./build-0aoBPorQ.mjs";import{n as Ze}from"./agent-docs-CUD3elJG.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-M5-UDDP_.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-K1-O3_77.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-K1-O3_77.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-CozvpJPt.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,
@@ -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-DKrL6WH5.mjs`),{builtinCliPlugins:t}=await import(`./builtins-CtquiRQB.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-C5F2dwCl.mjs`),{builtinCliPlugins:t}=await import(`./builtins-Dq9ovs5L.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:
@@ -876,4 +876,4 @@ declare global {
876
876
  export {}
877
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
878
  `)}}]})];export{Dn as applyDisableFilter,On as n,Ut as r,kn as runAllPluginTypegens,eo as t};
879
- //# sourceMappingURL=run-plugins-C9dOrOSt.mjs.map
879
+ //# sourceMappingURL=run-plugins-CDACNCtf.mjs.map