@forinda/kickjs-cli 6.12.2 → 6.14.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 (46) hide show
  1. package/dist/{agent-docs-CStVJrj8.mjs → agent-docs-BJWnAmX_.mjs} +2 -2
  2. package/dist/{agent-docs-CLu4CsQ7.mjs → agent-docs-DIYN_jL_.mjs} +3 -3
  3. package/dist/{agent-docs-CLu4CsQ7.mjs.map → agent-docs-DIYN_jL_.mjs.map} +1 -1
  4. package/dist/{build-Db4cha4R.mjs → build-CBfQ3H3v.mjs} +2 -2
  5. package/dist/{build-DzBNYKLj.mjs → build-iwtR0Oi9.mjs} +3 -3
  6. package/dist/{build-DzBNYKLj.mjs.map → build-iwtR0Oi9.mjs.map} +1 -1
  7. package/dist/{builtins-DVQRavE0.mjs → builtins-D0WWY6Mn.mjs} +35 -24
  8. package/dist/{builtins-Ho5elH40.mjs → builtins-eOHQv50e.mjs} +2 -2
  9. package/dist/cli.mjs +2 -2
  10. package/dist/{config-CpfbwTOH.mjs → config-DtCmKjkD.mjs} +3 -3
  11. package/dist/{config-CpfbwTOH.mjs.map → config-DtCmKjkD.mjs.map} +1 -1
  12. package/dist/{config-CZQN6aLU.mjs → config-HJUsJTa_.mjs} +2 -2
  13. package/dist/{doctor-BRKjTXg-.mjs → doctor-Cbn2k8Hl.mjs} +19 -20
  14. package/dist/doctor-Cbn2k8Hl.mjs.map +1 -0
  15. package/dist/{fullstack-CWtFWYLl.mjs → fullstack-BSMvdL5S.mjs} +3 -3
  16. package/dist/{fullstack-DrptYERV.mjs → fullstack-DUgRUss6.mjs} +4 -4
  17. package/dist/{fullstack-DrptYERV.mjs.map → fullstack-DUgRUss6.mjs.map} +1 -1
  18. package/dist/index.d.mts +8 -0
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +2 -2
  21. package/dist/{plugin-Bl42_aUN.mjs → plugin-BYw2PRe-.mjs} +3 -3
  22. package/dist/{plugin-Bl42_aUN.mjs.map → plugin-BYw2PRe-.mjs.map} +1 -1
  23. package/dist/{plugin-BM0vR4Wp.mjs → plugin-CM0U_qoY.mjs} +2 -2
  24. package/dist/{project-K-Pg2DPp.mjs → project-CdPZ9hA0.mjs} +26 -19
  25. package/dist/project-CdPZ9hA0.mjs.map +1 -0
  26. package/dist/{project-docs-CC4IryAZ.mjs → project-docs-7cMfbyoI.mjs} +90 -233
  27. package/dist/project-docs-7cMfbyoI.mjs.map +1 -0
  28. package/dist/{project-docs-NfXHhcln.mjs → project-docs-Baxu_pX9.mjs} +89 -232
  29. package/dist/{project-Cr_EJhoL.mjs → project-l7L-GLDC.mjs} +24 -17
  30. package/dist/{project-root-pbgtKIoC.mjs → project-root-BQ0U5ZvB.mjs} +2 -2
  31. package/dist/{project-root-DJr3x5pY.mjs → project-root-kVPNVO-C.mjs} +3 -3
  32. package/dist/{project-root-DJr3x5pY.mjs.map → project-root-kVPNVO-C.mjs.map} +1 -1
  33. package/dist/{prompts-XiiR969b.mjs → prompts-DFl7xNfp.mjs} +2 -2
  34. package/dist/{prompts-XiiR969b.mjs.map → prompts-DFl7xNfp.mjs.map} +1 -1
  35. package/dist/{rolldown-runtime-BTs2uP94.mjs → rolldown-runtime-BcHyXykH.mjs} +1 -1
  36. package/dist/{run-plugins-CY13ekyP.mjs → run-plugins-CsbJxJic.mjs} +20 -8
  37. package/dist/run-plugins-CsbJxJic.mjs.map +1 -0
  38. package/dist/{typegen-e3DwxkVv.mjs → typegen-Djd23Y-q.mjs} +4 -4
  39. package/dist/{typegen-BBSL503s.mjs → typegen-Junx6g4g.mjs} +5 -5
  40. package/dist/{typegen-BBSL503s.mjs.map → typegen-Junx6g4g.mjs.map} +1 -1
  41. package/dist/{types-xWud6jrx.mjs → types-POvw-713.mjs} +1 -1
  42. package/package.json +9 -9
  43. package/dist/doctor-BRKjTXg-.mjs.map +0 -1
  44. package/dist/project-K-Pg2DPp.mjs.map +0 -1
  45. package/dist/project-docs-CC4IryAZ.mjs.map +0 -1
  46. package/dist/run-plugins-CY13ekyP.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.12.2
2
+ * @forinda/kickjs-cli v6.14.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,8 +8,8 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{r as e,t}from"./config-CZQN6aLU.mjs";import{l as n,o as r}from"./project-docs-NfXHhcln.mjs";import{existsSync as i,readFileSync as a}from"node:fs";import{dirname as o,join as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{execFileSync as u,execSync as d,spawnSync as f}from"node:child_process";const p=/[&|<>^"'`(){}[\];!%\r\n\\]/;function m(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(p.test(e)||t.some(e=>p.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 h(e,t,n={}){let r=m(e,t);if(!r)return null;try{return u(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 g(e,t,n={}){let r=m(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);u(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function _(e,t,n){d(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function v(e,t,n){let r=f(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}const y={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},b={zod:{name:`zod`,range:`^4.3.6`},valibot:{name:`valibot`,range:`^1.4.1`},yup:{name:`yup`,range:`^1.7.1`}};function x(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES in generators/project.ts.`);return n}function S(e,t,n,r=[],i=`zod`,a=`express`){let o=b[i],s={"@forinda/kickjs":x(n,`@forinda/kickjs`),"@forinda/kickjs-schema":x(n,`@forinda/kickjs-schema`),dotenv:`^17.3.1`,"reflect-metadata":`^0.2.2`,[o.name]:o.range};a===`express`?s.express=`^5.1.0`:a===`fastify`?(s.fastify=`^5.0.0`,s[`@fastify/middie`]=`^9.0.0`,s[`serve-static`]=`^2.2.0`):a===`h3`&&(s.h3=`^1.0.0`,s[`serve-static`]=`^2.2.0`);for(let e of r){let t=y[e];t&&!s[t]&&(s[t]=x(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,"dev:debug":`kick dev:debug`,build:`kick build`,start:`kick start`,test:`vitest run`,"test:watch":`vitest`,typecheck:`tsc --noEmit`,typegen:`kick typegen`,lint:`eslint src/`,format:`prettier --write src/`},dependencies:s,devDependencies:{"@forinda/kickjs-cli":x(n,`@forinda/kickjs-cli`),"@forinda/kickjs-vite":x(n,`@forinda/kickjs-vite`),"@swc/core":`^1.15.21`,...a===`express`?{"@types/express":`^5.0.6`}:{},"@types/node":`^25.0.0`,"unplugin-swc":`^1.5.9`,vite:`^8.0.3`,vitest:`^4.1.2`,typescript:`^7.0.2`,prettier:`^3.8.1`}},null,2)}function ee(){return`import { defineConfig } from 'vite'
12
- import { resolve } from 'node:path'
11
+ import{r as e,t}from"./config-HJUsJTa_.mjs";import{l as n,o as r}from"./project-docs-Baxu_pX9.mjs";import{existsSync as i,readFileSync as a}from"node:fs";import{dirname as o,join as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{execFileSync as u,execSync as d,spawnSync as f}from"node:child_process";const p=/[&|<>^"'`(){}[\];!%\r\n\\]/;function m(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(p.test(e)||t.some(e=>p.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 h(e,t,n={}){let r=m(e,t);if(!r)return null;try{return u(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 g(e,t,n={}){let r=m(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);u(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function _(e,t,n){d(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function v(e,t,n){let r=f(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}const y={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},b={zod:{name:`zod`,range:`^4.3.6`},valibot:{name:`valibot`,range:`^1.4.1`},yup:{name:`yup`,range:`^1.7.1`}};function x(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES in generators/project.ts.`);return n}function S(e,t,n,r=[],i=`zod`,a=`express`){let o=b[i],s={"@forinda/kickjs":x(n,`@forinda/kickjs`),"@forinda/kickjs-schema":x(n,`@forinda/kickjs-schema`),dotenv:`^17.3.1`,"reflect-metadata":`^0.2.2`,[o.name]:o.range};a===`express`?s.express=`^5.1.0`:a===`fastify`?(s.fastify=`^5.0.0`,s[`@fastify/middie`]=`^9.0.0`,s[`serve-static`]=`^2.2.0`):a===`h3`&&(s.h3=`^1.0.0`,s[`serve-static`]=`^2.2.0`);for(let e of r){let t=y[e];t&&!s[t]&&(s[t]=x(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,"dev:debug":`kick dev:debug`,build:`kick build`,start:`kick start`,test:`vitest run`,"test:watch":`vitest`,typecheck:`tsc --noEmit`,typegen:`kick typegen`,lint:`eslint src/`,format:`prettier --write src/`},dependencies:s,devDependencies:{"@forinda/kickjs-cli":x(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":x(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":x(n,`@forinda/kickjs-vite`),"@types/supertest":`^7.2.1`,"@swc/core":`^1.15.21`,...a===`express`?{"@types/express":`^5.0.6`}:{},"@types/node":`^25.0.0`,"unplugin-swc":`^1.5.9`,vite:`^8.0.3`,supertest:`^7.2.2`,vitest:`^4.1.2`,typescript:`^7.0.2`,prettier:`^3.8.1`}},null,2)}function ee(){return`import { defineConfig } from 'vite'
12
+ import { fileURLToPath } from 'node:url'
13
13
  import swc from 'unplugin-swc'
14
14
  import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
15
15
 
@@ -24,7 +24,7 @@ export default defineConfig({
24
24
  ],
25
25
  resolve: {
26
26
  alias: {
27
- '@': resolve(__dirname, 'src'),
27
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
28
28
  },
29
29
  },
30
30
  build: {
@@ -33,7 +33,7 @@ export default defineConfig({
33
33
  outDir: 'dist',
34
34
  sourcemap: true,
35
35
  rollupOptions: {
36
- input: resolve(__dirname, 'src/index.ts'),
36
+ input: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
37
37
  output: { format: 'esm' },
38
38
  },
39
39
  },
@@ -93,17 +93,24 @@ NODE_ENV=development
93
93
  NODE_ENV=test
94
94
  PORT=0
95
95
  LOG_LEVEL=silent
96
- `}function D(){return`import { defineConfig } from 'vitest/config'
97
- import swc from 'unplugin-swc'
96
+ `}function D(){return`import { defineConfig, mergeConfig } from 'vitest/config'
97
+ import viteConfig from './vite.config.ts'
98
98
 
99
- export default defineConfig({
100
- plugins: [swc.vite()],
101
- test: {
102
- globals: true,
103
- environment: 'node',
104
- include: ['src/**/*.test.ts'],
105
- },
106
- })
99
+ // A \`vitest.config.ts\` OVERRIDES \`vite.config.ts\` outright — vitest does not
100
+ // merge the two, and it never reads tsconfig \`paths\`. Restating settings here
101
+ // would mean the \`@\` alias lives in three files and drifts in two of them, so
102
+ // merge the real config instead: the alias, plugins, and ssr externals all come
103
+ // from one place.
104
+ export default mergeConfig(
105
+ viteConfig,
106
+ defineConfig({
107
+ test: {
108
+ globals: true,
109
+ environment: 'node',
110
+ include: ['src/**/*.test.ts'],
111
+ },
112
+ }),
113
+ )
107
114
  `}const O={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function k(e,t,n,r=[],i=`express`,a){let o=O[i],s=i===`express`;switch(t){case`minimal`:{let t=[],i=[],c=s?`import { bootstrap, ${o.name} } from '@forinda/kickjs'`:`import { bootstrap } from '@forinda/kickjs'\nimport { ${o.name} } from '${o.from}'`;r.includes(`swagger`)&&(t.push(`import { SwaggerAdapter } from '@forinda/kickjs-swagger'`),i.push(` SwaggerAdapter({ info: { title: '${e}', version: '${n}' } }),`)),r.includes(`devtools`)&&(t.push(`import { DevToolsAdapter } from '@forinda/kickjs-devtools'`),i.push(` DevToolsAdapter(),`)),a&&(t.push(`import { SpaAdapter } from '@forinda/kickjs/spa'`),i.push(` // Serves the built frontend from this origin in production.
108
115
  // Inert until the client build exists, so \`kick dev\` (where Vite
109
116
  // serves the client and proxies /api here) is unaffected.
@@ -400,6 +407,6 @@ export default defineConfig({
400
407
  `);for(let e of i)console.log(a(e))}else console.log(`\n Plus ${i.length} optional packages (auth, swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
401
408
  Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}function q(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=R[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=I[c];if(!e){a.push(c);continue}e.deprecated&&o.push(`'${c}' (${e.pkg}) is deprecated — ${e.deprecated}`);let l=t||e.dev?i:r;l.add(e.pkg);for(let t of e.peers)l.add(t)}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function J(e){e.command(`list`).alias(`ls`).description(`List KickJS packages (core only; pair with --all for the full catalog)`).option(`--all`,`Include the full optional catalog`).action(e=>{K(!!e.all)})}function Y(e){e.command(`add [packages...]`).description(`Add KickJS packages with their required dependencies`).option(`--pm <manager>`,`Package manager override`).option(`-D, --dev`,`Install as dev dependency`).option(`--list`,`List packages (core only by default; pair with --all)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){K(!!t.all);return}let{pm:n,source:r}=await W(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=await z(process.cwd()),{prodDeps:a,devDeps:o,unknown:s,warnings:c,notices:l}=q(e,!!t.dev,i);for(let e of c)console.warn(`\n WARNING: ${e}`);for(let e of l)console.log(`\n ${e}`);if(!(s.length>0&&(console.log(`\n Unknown packages: ${s.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
402
409
  `),a.length===0&&o.length===0))){if(a.length>0){let e=a,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{d(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(o.length>0){let e=o,t=`${n} add -D ${e.join(` `)}`;console.log(`\n Installing ${e.length} dev dependency(ies):`);for(let t of e)console.log(` + ${t} (dev)`);console.log();try{d(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
403
- `)}})}const ae=o(l(import.meta.url)),X=JSON.parse(a(s(ae,`..`,`package.json`),`utf-8`)),oe=`^${X.version}`,se=[`@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`];async function Z(){let e=await Promise.all(se.map(async e=>{let t=h(`npm`,[`view`,e,`version`]);return t&&/^\d+\.\d+\.\d+/.test(t)?[e,`^${t}`]:[e,oe]}));return Object.fromEntries(e)}function ce(e,t){let n=h(`npm`,[`view`,`${e}@${t}`,`version`]);return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function Q(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function le(e,t){let n=e=>Q(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}function $(e,t,n){let r=h(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`]);if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function ue(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:f=`express`}=e,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),m(`Resolving package versions...`);let h=await Z();if(f!==`express`)if($(`@forinda/kickjs`,`latest`,`./${f}`))m(`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=ce(r,`alpha`);e&&le(e,Q(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(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: ${a} add @forinda/kickjs@alpha`)}await n(s(p,`package.json`),S(t,o,h,l,u,f)),await n(s(p,`vite.config.ts`),ee()),await n(s(p,`tsconfig.json`),C()),await n(s(p,`.prettierrc`),w()),await n(s(p,`.editorconfig`),te()),await n(s(p,`.gitignore`),ne()),await n(s(p,`.gitattributes`),re()),await n(s(p,`.env`),ie()),await n(s(p,`.env.example`),T()),await n(s(p,`.env.test`),E()),await n(s(p,`src/config/index.ts`),j(u)),await n(s(p,`src/index.ts`),k(t,o,X.version,l,f,e.spaClientDir)),await n(s(p,`src/modules/index.ts`),A()),await n(s(p,`src/modules/hello/hello.service.ts`),M()),await n(s(p,`src/modules/hello/hello.controller.ts`),N()),await n(s(p,`src/modules/hello/hello.module.ts`),P()),await n(s(p,`kick.config.ts`),F(o,c,a,f)),await n(s(p,`vitest.config.ts`),D()),await n(s(p,`README.md`),r(t,o,a));let{generateAgentDocs:g}=await import(`./agent-docs-CStVJrj8.mjs`).then(e=>e.t);if(await g({outDir:p,name:t,pm:a,template:o,only:`all`,force:!0}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{d(`${a} install`,{cwd:p,stdio:`inherit`}),console.log(`
404
- Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-e3DwxkVv.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{d(`git init`,{cwd:p,stdio:`pipe`}),d(`git branch -M main`,{cwd:p,stdio:`pipe`}),d(`git add -A`,{cwd:p,stdio:`pipe`}),d(`git commit -m "chore: initial commit from kick new"`,{cwd:p,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
410
+ `)}})}const ae=o(l(import.meta.url)),X=JSON.parse(a(s(ae,`..`,`package.json`),`utf-8`)),oe=`^${X.version}`,se=[`@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`];async function Z(){let e=await Promise.all(se.map(async e=>{let t=h(`npm`,[`view`,e,`version`]);return t&&/^\d+\.\d+\.\d+/.test(t)?[e,`^${t}`]:[e,oe]}));return Object.fromEntries(e)}function ce(e,t){let n=h(`npm`,[`view`,`${e}@${t}`,`version`]);return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function Q(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function le(e,t){let n=e=>Q(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}function $(e,t,n){let r=h(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`]);if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function ue(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:f=`express`}=e,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),m(`Resolving package versions...`);let h=await Z();if(f!==`express`)if($(`@forinda/kickjs`,`latest`,`./${f}`))m(`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=ce(r,`alpha`);e&&le(e,Q(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(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: ${a} add @forinda/kickjs@alpha`)}await n(s(p,`package.json`),S(t,o,h,l,u,f)),await n(s(p,`vite.config.ts`),ee()),await n(s(p,`tsconfig.json`),C()),await n(s(p,`.prettierrc`),w()),await n(s(p,`.editorconfig`),te()),await n(s(p,`.gitignore`),ne()),await n(s(p,`.gitattributes`),re()),await n(s(p,`.env`),ie()),await n(s(p,`.env.example`),T()),await n(s(p,`.env.test`),E()),await n(s(p,`src/config/index.ts`),j(u)),await n(s(p,`src/index.ts`),k(t,o,X.version,l,f,e.spaClientDir)),await n(s(p,`src/modules/index.ts`),A()),await n(s(p,`src/modules/hello/hello.service.ts`),M()),await n(s(p,`src/modules/hello/hello.controller.ts`),N()),await n(s(p,`src/modules/hello/hello.module.ts`),P()),await n(s(p,`kick.config.ts`),F(o,c,a,f)),await n(s(p,`vitest.config.ts`),D()),await n(s(p,`README.md`),r(t,o,a));let{generateAgentDocs:g}=await import(`./agent-docs-BJWnAmX_.mjs`).then(e=>e.t);if(await g({outDir:p,name:t,pm:a,template:o,only:`all`,force:!0}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{d(`${a} install`,{cwd:p,stdio:`inherit`}),console.log(`
411
+ Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-Djd23Y-q.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{d(`git init`,{cwd:p,stdio:`pipe`}),d(`git branch -M main`,{cwd:p,stdio:`pipe`}),d(`git add -A`,{cwd:p,stdio:`pipe`}),d(`git commit -m "chore: initial commit from kick new"`,{cwd:p,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
405
412
  Project scaffolded successfully!`),console.log();let _=p!==process.cwd();m(`Next steps:`),_&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let v={rest:`kick g module user`,ddd:`kick g module user --repo drizzle`,cqrs:`kick g module user --pattern cqrs`,minimal:`# add your routes to src/index.ts`};m(` ${v[o]??v.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> Full DDD module (controller, DTOs, use-cases, repo)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Express middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> Zod DTO schema`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${L}`),m(``)}export{Y as a,G as c,_ as d,R as i,g as l,Z as n,J as o,I as r,z as s,ue as t,v as u};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.12.2
2
+ * @forinda/kickjs-cli v6.14.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-BTs2uP94.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=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-BcHyXykH.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=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 v6.12.2
2
+ * @forinda/kickjs-cli v6.14.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-BTs2uP94.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=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-DJr3x5pY.mjs.map
11
+ import{t as e}from"./rolldown-runtime-BcHyXykH.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=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-kVPNVO-C.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-root-DJr3x5pY.mjs","names":[],"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":";;;;;;;;;;sLAGA,MAAM,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgB,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAM,EAAQ,EAAQ,CAAQ,EACxB,CAAE,KAAM,GAAW,EAAM,CAAK,EAEhC,EAAkC,KAClC,EAAS,EACb,OAAa,CACX,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,EAAQ,EAAQ,CAAI,CAAC,EAAG,OAAO,EAKhD,GAHI,IAAqB,MAAQ,EAAW,EAAQ,EAAQ,cAAc,CAAC,IACzE,EAAmB,GAEjB,IAAW,EAAQ,MACvB,IAAM,EAAS,EAAQ,CAAM,EAC7B,GAAI,IAAW,EAAQ,MACvB,EAAS,CACX,CAEA,OAAO,GAAoB,CAC7B"}
1
+ {"version":3,"file":"project-root-kVPNVO-C.mjs","names":[],"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":";;;;;;;;;;sLAGA,MAAM,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgB,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAM,EAAQ,EAAQ,CAAQ,EACxB,CAAE,KAAM,GAAW,EAAM,CAAK,EAEhC,EAAkC,KAClC,EAAS,EACb,OAAa,CACX,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,EAAQ,EAAQ,CAAI,CAAC,EAAG,OAAO,EAKhD,GAHI,IAAqB,MAAQ,EAAW,EAAQ,EAAQ,cAAc,CAAC,IACzE,EAAmB,GAEjB,IAAW,EAAQ,MACvB,IAAM,EAAS,EAAQ,CAAM,EAC7B,GAAI,IAAW,EAAQ,MACvB,EAAS,CACX,CAEA,OAAO,GAAoB,CAC7B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.12.2
2
+ * @forinda/kickjs-cli v6.14.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,4 +9,4 @@
9
9
  * @license MIT
10
10
  */
11
11
  import*as e from"@clack/prompts";import t from"picocolors";const n={GET:t.green,POST:t.cyan,PUT:t.yellow,PATCH:t.magenta,DELETE:t.red};function r(e){return(n[e]??t.dim)(e.padEnd(7))}function i(e){let n=`[${e}]`.padEnd(10);switch(e){case`CRITICAL`:return t.red(n);case`WARNING`:return t.yellow(n);case`INFO`:return t.blue(t.dim(n));default:return n}}t.green(`✓`),t.red(`✖`),t.yellow(`⚠`),t.blue(`ℹ`);function a(n){e.intro(t.bgCyan(t.black(` ${n} `)))}function o(t){e.outro(t)}function s(t){e.isCancel(t)&&(e.cancel(`Operation cancelled.`),process.exit(0))}async function c(t){let n=await e.text(t);return s(n),n}async function l(t){let n=await e.select(t);return s(n),n}async function u(t){let n=await e.multiselect(t);return s(n),n}async function d(t){let n=await e.confirm(t);return s(n),n}function f(){return e.spinner()}const p=e.log;export{o as a,c,i as d,u as i,r as l,a as n,l as o,p as r,f as s,d as t,t as u};
12
- //# sourceMappingURL=prompts-XiiR969b.mjs.map
12
+ //# sourceMappingURL=prompts-DFl7xNfp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts-XiiR969b.mjs","names":["colors"],"sources":["../src/utils/colors.ts","../src/utils/prompts.ts"],"sourcesContent":["import pc from 'picocolors'\n\nexport { pc as colors }\n\nconst METHOD_COLOR_MAP: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.cyan,\n PUT: pc.yellow,\n PATCH: pc.magenta,\n DELETE: pc.red,\n}\n\n/** Color an HTTP method string for terminal display */\nexport function httpMethodColor(method: string): string {\n const fn = METHOD_COLOR_MAP[method] ?? pc.dim\n return fn(method.padEnd(7))\n}\n\n/** Color a severity tag for terminal display (padded to 10 chars) */\nexport function severityColor(severity: string): string {\n const tag = `[${severity}]`.padEnd(10)\n switch (severity) {\n case 'CRITICAL':\n return pc.red(tag)\n case 'WARNING':\n return pc.yellow(tag)\n case 'INFO':\n return pc.blue(pc.dim(tag))\n default:\n return tag\n }\n}\n","import * as clack from '@clack/prompts'\nimport { colors } from './colors'\n\nexport const symbols = {\n success: colors.green('✓'),\n error: colors.red('✖'),\n warning: colors.yellow('⚠'),\n info: colors.blue('ℹ'),\n}\n\n/** Show branded intro banner */\nexport function intro(title: string): void {\n clack.intro(colors.bgCyan(colors.black(` ${title} `)))\n}\n\n/** Show closing message */\nexport function outro(message: string): void {\n clack.outro(message)\n}\n\n/** Handle cancellation — print message and exit */\nfunction handleCancel(value: unknown): void {\n if (clack.isCancel(value)) {\n clack.cancel('Operation cancelled.')\n process.exit(0)\n }\n}\n\n/** Text input prompt */\nexport async function text(opts: {\n message: string\n placeholder?: string\n defaultValue?: string\n validate?: (value: string) => string | void\n}): Promise<string> {\n const value = await clack.text(opts as any)\n handleCancel(value)\n return value as string\n}\n\n/** Single select prompt */\nexport async function select<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n initialValue?: T\n}): Promise<T> {\n const value = await clack.select(opts as any)\n handleCancel(value)\n return value as T\n}\n\n/** Multi-select prompt with checkboxes */\nexport async function multiSelect<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n required?: boolean\n initialValues?: T[]\n}): Promise<T[]> {\n const value = await clack.multiselect(opts as any)\n handleCancel(value)\n return value as T[]\n}\n\n/** Yes/no confirmation prompt */\nexport async function confirm(opts: {\n message: string\n active?: string\n inactive?: string\n initialValue?: boolean\n}): Promise<boolean> {\n const value = await clack.confirm(opts)\n handleCancel(value)\n return value as boolean\n}\n\n/** Create a spinner for progress indication */\nexport function spinner() {\n return clack.spinner()\n}\n\n/** Log utilities for styled messages inside clack flow */\nexport const log = clack.log\n"],"mappings":";;;;;;;;;;2DAIA,MAAM,EAA0D,CAC9D,IAAK,EAAG,MACR,KAAM,EAAG,KACT,IAAK,EAAG,OACR,MAAO,EAAG,QACV,OAAQ,EAAG,GACb,EAGA,SAAgB,EAAgB,EAAwB,CAEtD,OADW,EAAiB,IAAW,EAAG,IAAA,CAChC,EAAO,OAAO,CAAC,CAAC,CAC5B,CAGA,SAAgB,EAAc,EAA0B,CACtD,IAAM,EAAM,IAAI,EAAS,GAAG,OAAO,EAAE,EACrC,OAAQ,EAAR,CACE,IAAK,WACH,OAAO,EAAG,IAAI,CAAG,EACnB,IAAK,UACH,OAAO,EAAG,OAAO,CAAG,EACtB,IAAK,OACH,OAAO,EAAG,KAAK,EAAG,IAAI,CAAG,CAAC,EAC5B,QACE,OAAO,CACX,CACF,CC3BWA,EAAO,MAAM,GAAG,EAClBA,EAAO,IAAI,GAAG,EACZA,EAAO,OAAO,GAAG,EACpBA,EAAO,KAAK,GAAG,EAIvB,SAAgB,EAAM,EAAqB,CACzC,EAAM,MAAMA,EAAO,OAAOA,EAAO,MAAM,IAAI,EAAM,EAAE,CAAC,CAAC,CACvD,CAGA,SAAgB,EAAM,EAAuB,CAC3C,EAAM,MAAM,CAAO,CACrB,CAGA,SAAS,EAAa,EAAsB,CACtC,EAAM,SAAS,CAAK,IACtB,EAAM,OAAO,sBAAsB,EACnC,QAAQ,KAAK,CAAC,EAElB,CAGA,eAAsB,EAAK,EAKP,CAClB,IAAM,EAAQ,MAAM,EAAM,KAAK,CAAW,EAE1C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAU,EAIjB,CACb,IAAM,EAAQ,MAAM,EAAM,OAAO,CAAW,EAE5C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAe,EAKpB,CACf,IAAM,EAAQ,MAAM,EAAM,YAAY,CAAW,EAEjD,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAQ,EAKT,CACnB,IAAM,EAAQ,MAAM,EAAM,QAAQ,CAAI,EAEtC,OADA,EAAa,CAAK,EACX,CACT,CAGA,SAAgB,GAAU,CACxB,OAAO,EAAM,QAAQ,CACvB,CAGA,MAAa,EAAM,EAAM"}
1
+ {"version":3,"file":"prompts-DFl7xNfp.mjs","names":["colors"],"sources":["../src/utils/colors.ts","../src/utils/prompts.ts"],"sourcesContent":["import pc from 'picocolors'\n\nexport { pc as colors }\n\nconst METHOD_COLOR_MAP: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.cyan,\n PUT: pc.yellow,\n PATCH: pc.magenta,\n DELETE: pc.red,\n}\n\n/** Color an HTTP method string for terminal display */\nexport function httpMethodColor(method: string): string {\n const fn = METHOD_COLOR_MAP[method] ?? pc.dim\n return fn(method.padEnd(7))\n}\n\n/** Color a severity tag for terminal display (padded to 10 chars) */\nexport function severityColor(severity: string): string {\n const tag = `[${severity}]`.padEnd(10)\n switch (severity) {\n case 'CRITICAL':\n return pc.red(tag)\n case 'WARNING':\n return pc.yellow(tag)\n case 'INFO':\n return pc.blue(pc.dim(tag))\n default:\n return tag\n }\n}\n","import * as clack from '@clack/prompts'\nimport { colors } from './colors'\n\nexport const symbols = {\n success: colors.green('✓'),\n error: colors.red('✖'),\n warning: colors.yellow('⚠'),\n info: colors.blue('ℹ'),\n}\n\n/** Show branded intro banner */\nexport function intro(title: string): void {\n clack.intro(colors.bgCyan(colors.black(` ${title} `)))\n}\n\n/** Show closing message */\nexport function outro(message: string): void {\n clack.outro(message)\n}\n\n/** Handle cancellation — print message and exit */\nfunction handleCancel(value: unknown): void {\n if (clack.isCancel(value)) {\n clack.cancel('Operation cancelled.')\n process.exit(0)\n }\n}\n\n/** Text input prompt */\nexport async function text(opts: {\n message: string\n placeholder?: string\n defaultValue?: string\n validate?: (value: string) => string | void\n}): Promise<string> {\n const value = await clack.text(opts as any)\n handleCancel(value)\n return value as string\n}\n\n/** Single select prompt */\nexport async function select<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n initialValue?: T\n}): Promise<T> {\n const value = await clack.select(opts as any)\n handleCancel(value)\n return value as T\n}\n\n/** Multi-select prompt with checkboxes */\nexport async function multiSelect<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n required?: boolean\n initialValues?: T[]\n}): Promise<T[]> {\n const value = await clack.multiselect(opts as any)\n handleCancel(value)\n return value as T[]\n}\n\n/** Yes/no confirmation prompt */\nexport async function confirm(opts: {\n message: string\n active?: string\n inactive?: string\n initialValue?: boolean\n}): Promise<boolean> {\n const value = await clack.confirm(opts)\n handleCancel(value)\n return value as boolean\n}\n\n/** Create a spinner for progress indication */\nexport function spinner() {\n return clack.spinner()\n}\n\n/** Log utilities for styled messages inside clack flow */\nexport const log = clack.log\n"],"mappings":";;;;;;;;;;2DAIA,MAAM,EAA0D,CAC9D,IAAK,EAAG,MACR,KAAM,EAAG,KACT,IAAK,EAAG,OACR,MAAO,EAAG,QACV,OAAQ,EAAG,GACb,EAGA,SAAgB,EAAgB,EAAwB,CAEtD,OADW,EAAiB,IAAW,EAAG,IAAA,CAChC,EAAO,OAAO,CAAC,CAAC,CAC5B,CAGA,SAAgB,EAAc,EAA0B,CACtD,IAAM,EAAM,IAAI,EAAS,GAAG,OAAO,EAAE,EACrC,OAAQ,EAAR,CACE,IAAK,WACH,OAAO,EAAG,IAAI,CAAG,EACnB,IAAK,UACH,OAAO,EAAG,OAAO,CAAG,EACtB,IAAK,OACH,OAAO,EAAG,KAAK,EAAG,IAAI,CAAG,CAAC,EAC5B,QACE,OAAO,CACX,CACF,CC3BWA,EAAO,MAAM,GAAG,EAClBA,EAAO,IAAI,GAAG,EACZA,EAAO,OAAO,GAAG,EACpBA,EAAO,KAAK,GAAG,EAIvB,SAAgB,EAAM,EAAqB,CACzC,EAAM,MAAMA,EAAO,OAAOA,EAAO,MAAM,IAAI,EAAM,EAAE,CAAC,CAAC,CACvD,CAGA,SAAgB,EAAM,EAAuB,CAC3C,EAAM,MAAM,CAAO,CACrB,CAGA,SAAS,EAAa,EAAsB,CACtC,EAAM,SAAS,CAAK,IACtB,EAAM,OAAO,sBAAsB,EACnC,QAAQ,KAAK,CAAC,EAElB,CAGA,eAAsB,EAAK,EAKP,CAClB,IAAM,EAAQ,MAAM,EAAM,KAAK,CAAW,EAE1C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAU,EAIjB,CACb,IAAM,EAAQ,MAAM,EAAM,OAAO,CAAW,EAE5C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAe,EAKpB,CACf,IAAM,EAAQ,MAAM,EAAM,YAAY,CAAW,EAEjD,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAQ,EAKT,CACnB,IAAM,EAAQ,MAAM,EAAM,QAAQ,CAAI,EAEtC,OADA,EAAa,CAAK,EACX,CACT,CAGA,SAAgB,GAAU,CACxB,OAAO,EAAM,QAAQ,CACvB,CAGA,MAAa,EAAM,EAAM"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.12.2
2
+ * @forinda/kickjs-cli v6.14.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.12.2
2
+ * @forinda/kickjs-cli v6.14.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{c as e,l as t,s as n}from"./project-docs-CC4IryAZ.mjs";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./prompts-XiiR969b.mjs";import{A as m,C as h,D as g,E as _,F as v,M as y,N as b,O as x,P as S,S as C,T as ee,_ as te,a as ne,b as re,c as ie,f as ae,g as oe,h as se,i as ce,j as le,k as ue,l as de,m as fe,p as pe,r as me,u as w,v as he,w as ge,x as _e,y as ve}from"./doctor-BRKjTXg-.mjs";import{a as ye,c as be,o as xe,r as Se,t as Ce,u as we}from"./project-K-Pg2DPp.mjs";import{a as T,i as E,o as Te,s as Ee}from"./config-CpfbwTOH.mjs";import{t as De}from"./project-root-DJr3x5pY.mjs";import{n as D}from"./types-xWud6jrx.mjs";import{t as Oe}from"./build-DzBNYKLj.mjs";import{n as ke}from"./agent-docs-CLu4CsQ7.mjs";import{n as O}from"./plugin-Bl42_aUN.mjs";import{a as Ae,c as je,d as Me,f as Ne,g as Pe,h as Fe,i as Ie,l as Le,m as Re,o as ze,p as Be,r as Ve,s as He,t as k,u as Ue}from"./typegen-BBSL503s.mjs";import A,{basename as We,dirname as j,join as M,relative as Ge,resolve as N,sep as Ke}from"node:path";import{cpSync as qe,existsSync as P,mkdirSync as Je,readFileSync as F,readdirSync as Ye,rmSync as Xe,writeFileSync as Ze}from"node:fs";import{copyFile as Qe,mkdir as I,readFile as L,readdir as $e,rm as et,stat as tt,writeFile as R}from"node:fs/promises";import{fork as nt,spawn as rt}from"node:child_process";import{fileURLToPath as it,pathToFileURL as z}from"node:url";import{arch as at,platform as ot,release as st}from"node:os";const ct=[{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`}];function lt(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`).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(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).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)=>{c(`KickJS — Create a new project`);let n=!!(t.yes||t.nonInteractive);e||=n?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let a;if(e===`.`?(a=N(`.`),e=We(a)):a=N(t.directory||e),P(a)){let i=Ye(a);if(i.length>0){if(t.force)u.warn(`Clearing existing files in ${a}`);else if(n){u.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{u.warn(`Directory "${e}" is not empty:`);let t=i.slice(0,5);for(let e of t)u.message(` - ${e}`);if(i.length>5&&u.message(` ... and ${i.length-5} more`),!await f({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of i)Xe(N(a,e),{recursive:!0,force:!0})}}let s=t.template;s||=n?`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`}]});let d=t.runtime;d||=n?`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 m=t.pm;m||=n?await be(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 h=t.repo;h||=n?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),Ee(h);let g=t.schema;g||=n?`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(g)||(u.warn(`Unknown --schema "${g}", falling back to zod.`),g=`zod`);let _;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();_=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else _=n?[]:await o({message:`Select packages to include`,options:[...ct],required:!1});let v;v=t.git===void 0?n?!0:await f({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;if(y=t.install===void 0?n?!0:await f({message:`Install dependencies?`,initialValue:!0}):t.install,s===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-DrptYERV.mjs`);await t({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m}${m===`pnpm`?` dev`:` run dev:server`}`)}`);return}await Ce({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,template:s,defaultRepo:h,packages:_,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m} dev`)}`)})}async function ut(e){let{name:n,outDir:r}=e,i=S(n),a=v(n),o=[],s=M(r,`${i}.plugin.ts`);return await t(s,`import {
11
+ import{c as e,l as t,s as n}from"./project-docs-7cMfbyoI.mjs";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./prompts-DFl7xNfp.mjs";import{A as m,C as h,D as g,E as _,F as v,M as y,N as b,O as x,P as S,S as C,T as ee,_ as te,a as ne,b as re,c as ie,f as ae,g as oe,h as se,i as ce,j as le,k as ue,l as de,m as fe,p as pe,r as me,u as w,v as he,w as ge,x as _e,y as ve}from"./doctor-Cbn2k8Hl.mjs";import{a as ye,c as be,o as xe,r as Se,t as Ce,u as we}from"./project-CdPZ9hA0.mjs";import{a as T,i as E,o as Te,s as Ee}from"./config-DtCmKjkD.mjs";import{t as De}from"./project-root-kVPNVO-C.mjs";import{n as D}from"./types-POvw-713.mjs";import{t as Oe}from"./build-iwtR0Oi9.mjs";import{n as ke}from"./agent-docs-DIYN_jL_.mjs";import{n as O}from"./plugin-BYw2PRe-.mjs";import{a as Ae,c as je,d as Me,f as Ne,g as Pe,h as Fe,i as Ie,l as Le,m as Re,o as ze,p as Be,r as Ve,s as He,t as k,u as Ue}from"./typegen-Junx6g4g.mjs";import A,{basename as We,dirname as j,join as M,relative as Ge,resolve as N,sep as Ke}from"node:path";import{cpSync as qe,existsSync as P,mkdirSync as Je,readFileSync as F,readdirSync as Ye,rmSync as Xe,writeFileSync as Ze}from"node:fs";import{copyFile as Qe,mkdir as I,readFile as L,readdir as $e,rm as et,stat as tt,writeFile as R}from"node:fs/promises";import{fork as nt,spawn as rt}from"node:child_process";import{fileURLToPath as it,pathToFileURL as z}from"node:url";import{arch as at,platform as ot,release as st}from"node:os";const ct=[{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`}];function lt(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`).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(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).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)=>{c(`KickJS — Create a new project`);let n=!!(t.yes||t.nonInteractive);e||=n?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let a;if(e===`.`?(a=N(`.`),e=We(a)):a=N(t.directory||e),P(a)){let i=Ye(a);if(i.length>0){if(t.force)u.warn(`Clearing existing files in ${a}`);else if(n){u.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{u.warn(`Directory "${e}" is not empty:`);let t=i.slice(0,5);for(let e of t)u.message(` - ${e}`);if(i.length>5&&u.message(` ... and ${i.length-5} more`),!await f({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of i)Xe(N(a,e),{recursive:!0,force:!0})}}let s=t.template;s||=n?`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`}]});let d=t.runtime;d||=n?`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 m=t.pm;m||=n?await be(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 h=t.repo;h||=n?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),Ee(h);let g=t.schema;g||=n?`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(g)||(u.warn(`Unknown --schema "${g}", falling back to zod.`),g=`zod`);let _;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();_=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else _=n?[]:await o({message:`Select packages to include`,options:[...ct],required:!1});let v;v=t.git===void 0?n?!0:await f({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;if(y=t.install===void 0?n?!0:await f({message:`Install dependencies?`,initialValue:!0}):t.install,s===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-DUgRUss6.mjs`);await t({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m}${m===`pnpm`?` dev`:` run dev:server`}`)}`);return}await Ce({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,template:s,defaultRepo:h,packages:_,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m} dev`)}`)})}async function ut(e){let{name:n,outDir:r}=e,i=S(n),a=v(n),o=[],s=M(r,`${i}.plugin.ts`);return await t(s,`import {
12
12
  definePlugin,
13
13
  type AppAdapter,
14
14
  type AppModuleEntry,
@@ -340,8 +340,8 @@ describe('${s}', () => {
340
340
  Plugin generators:
341
341
  `);let e=Math.max(...r.generators.map(e=>`${e.spec.name} <name>`.length));for(let{source:t,spec:n}of r.generators){let r=`${n.name} <name>`;console.log(` kick g ${r.padEnd(e+2)} ${n.description} [${t}]`)}}if(r.failed.length>0){console.log(`
342
342
  Failed to load:
343
- `);for(let{source:e,reason:t}of r.failed)console.log(` ${e} — ${t}`)}console.log()}async function Lt(e,t,n){let r=await E(process.cwd()),i=T(r),a=t.modulesDir??i.dir??`src/modules`,o=t.repo??C(i.repo);t.repo&&Ee(t.repo);let s=t.pattern??r?.pattern??`rest`,c=t.pluralize===!1?!1:i.pluralize??!0,l=Te(r,process.cwd()),u=i.style??`define`;if(!n&&u===`define`){let e=await wt(N(a),`define`);if(e.length>0){console.error(`\n ${p.red(`Error:`)} ${e.length} module file(s) still use the legacy \`class … implements AppModule\` shape.\n ${p.dim(`Project setting:`)} modules.style: 'define' (default)\n\n ${p.bold(`Files needing migration:`)}`);for(let t of e.slice(0,5))console.error(` - ${t}`);e.length>5&&console.error(` … and ${e.length-5} more`),console.error(`\n ${p.bold(`Pick one:`)}\n 1. Migrate everything to defineModule:\n ${p.dim(`$`)} kick codemod modules --experimental --apply\n 2. Keep the class form — pin it in kick.config.ts:\n ${p.dim(`// kick.config.ts`)}\n ${p.dim(`export default defineConfig({ modules: { style: 'class' } })`)}\n`),process.exit(1)}}let d=[];for(let r of e){let e=await _e({name:r,modulesDir:N(a),noEntity:t.entity===!1,noTests:t.tests===!1,repo:o,minimal:t.minimal,force:t.force,pattern:s,dryRun:n,pluralize:c,prismaClientPath:i.prismaClientPath,tokenScope:l,style:i.style});d.push(...e)}W(d,n),await G(n)}function Rt(t,n){let r=t.command(`generate [names...]`).alias(`g`).description("Generate code scaffolds — bare form `kick g <name>` is shorthand for `kick g module <name>`").option(`--list`,`List all available generators`).option(`--dry-run`,`Preview files that would be generated without writing them`).option(`--no-entity`,`Skip entity and value object generation (module shortcut)`).option(`--no-tests`,`Skip test file generation (module shortcut)`).option(`--repo <type>`,`Repository name: inmemory (default) or any DB name (e.g. postgres)`).option(`--pattern <pattern>`,`Override project pattern: rest | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(t,i,a)=>{if(i.list){await It();return}if(!t||t.length===0){r.help();return}let o=U(a);e(o);let[s,c,...l]=t;if(s){let e=await E(process.cwd()),t=O(e?.plugins??[],e?.commands??[]),r=await ne({generatorName:s,itemName:c??``,args:l,flags:i,cwd:process.cwd(),projectRoot:n?.projectRoot},t.generators);if(r){W(r.files,o);return}if(s!==`module`&&Ft.has(s)){console.error(`\n '${s}' is a generator, not a module name.`),console.error(` Did you mean: kick g ${s} ${c??`<name>`}`),console.error(` If that errors, your @forinda/kickjs-cli is older than the '${s}' generator — upgrade it.\n`),process.exitCode=1;return}}await Lt(t,i,o)});r.command(`module <names...>`).description(`Generate one or more modules (e.g. kick g module user task project)`).option(`--no-entity`,`Skip entity and value object generation`).option(`--no-tests`,`Skip test file generation`).option(`--repo <type>`,`Repository name: inmemory (default) or any DB name (e.g. postgres)`).option(`--pattern <pattern>`,`Override project pattern: rest | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(t,n,r)=>{let i=U(r);e(i),await Lt(t,{...r.optsWithGlobals(),...n},i)}),r.command(`adapter <name>`).description(`Generate an AppAdapter with lifecycle hooks and middleware support`).option(`-o, --out <dir>`,`Output directory`,`src/adapters`).action(async(t,n,r)=>{let i=U(r);e(i),W(await he({name:t,outDir:N(n.out)}),i)}),r.command(`plugin <name>`).description(`Generate a KickPlugin with DI, modules, adapters, middleware, and lifecycle hooks`).option(`-o, --out <dir>`,`Output directory`,`src/plugins`).action(async(t,n,r)=>{let i=U(r);e(i),W(await ut({name:t,outDir:N(n.out)}),i)}),r.command(`middleware <name>`).description(`Generate an Express middleware function
344
- Use -m to scope it to a module: kick g middleware auth -m users`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(t,n,r)=>{let i=U(r);e(i);let a=await E(process.cwd()),o=T(a),s=o.dir??`src/modules`;W(await oe({name:t,outDir:n.out,moduleName:n.module,modulesDir:s,pattern:a?.pattern,pluralize:o.pluralize??!0}),i)}),r.command(`guard <name>`).description(`Generate a route guard (auth, roles, etc.)
343
+ `);for(let{source:e,reason:t}of r.failed)console.log(` ${e} — ${t}`)}console.log()}async function Lt(e,t,n){let r=await E(process.cwd()),i=T(r),a=t.modulesDir??i.dir??`src/modules`,o=t.repo??C(i.repo);t.repo&&Ee(t.repo);let s=t.pattern??r?.pattern??`rest`,c=t.pluralize===!1?!1:i.pluralize??!0,l=Te(r,process.cwd()),u=i.style??`define`;if(!n&&u===`define`){let e=await wt(N(a),`define`);if(e.length>0){console.error(`\n ${p.red(`Error:`)} ${e.length} module file(s) still use the legacy \`class … implements AppModule\` shape.\n ${p.dim(`Project setting:`)} modules.style: 'define' (default)\n\n ${p.bold(`Files needing migration:`)}`);for(let t of e.slice(0,5))console.error(` - ${t}`);e.length>5&&console.error(` … and ${e.length-5} more`),console.error(`\n ${p.bold(`Pick one:`)}\n 1. Migrate everything to defineModule:\n ${p.dim(`$`)} kick codemod modules --experimental --apply\n 2. Keep the class form — pin it in kick.config.ts:\n ${p.dim(`// kick.config.ts`)}\n ${p.dim(`export default defineConfig({ modules: { style: 'class' } })`)}\n`),process.exit(1)}}let d=[];for(let r of e){let e=await _e({name:r,modulesDir:N(a),noEntity:t.entity===!1,noTests:t.tests===!1,repo:o,minimal:t.minimal,force:t.force,pattern:s,dryRun:n,pluralize:c,prismaClientPath:i.prismaClientPath,tokenScope:l,style:i.style});d.push(...e)}W(d,n),await G(n)}function Rt(t,n){let r=t.command(`generate [names...]`).alias(`g`).description("Generate code scaffolds — bare form `kick g <name>` is shorthand for `kick g module <name>`").option(`--list`,`List all available generators`).option(`--dry-run`,`Preview files that would be generated without writing them`).option(`--no-entity`,`Skip entity and value object generation (module shortcut)`).option(`--no-tests`,`Skip test file generation (module shortcut)`).option(`--repo <type>`,`Repository name: inmemory (default) or any DB name (e.g. postgres)`).option(`--pattern <pattern>`,`Override project pattern: rest | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(t,i,a)=>{if(i.list){await It();return}if(!t||t.length===0){r.help();return}let o=U(a);e(o);let[s,c,...l]=t;if(s){let e=await E(process.cwd()),t=O(e?.plugins??[],e?.commands??[]),r=await ne({generatorName:s,itemName:c??``,args:l,flags:i,cwd:process.cwd(),projectRoot:n?.projectRoot},t.generators);if(r){W(r.files,o);return}if(s!==`module`&&Ft.has(s)){console.error(`\n '${s}' is a generator, not a module name.`),console.error(` Did you mean: kick g ${s} ${c??`<name>`}`),console.error(` If that errors, your @forinda/kickjs-cli is older than the '${s}' generator — upgrade it.\n`),process.exitCode=1;return}}await Lt(t,i,o)});r.command(`module <names...>`).description(`Generate one or more modules (e.g. kick g module user task project)`).option(`--no-entity`,`Skip entity and value object generation`).option(`--no-tests`,`Skip test file generation`).option(`--repo <type>`,`Repository name: inmemory (default) or any DB name (e.g. postgres)`).option(`--pattern <pattern>`,`Override project pattern: rest | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(t,n,r)=>{let i=U(r);e(i),await Lt(t,{...r.optsWithGlobals(),...n},i)}),r.command(`adapter <name>`).description(`Generate an AppAdapter with lifecycle hooks and middleware support`).option(`-o, --out <dir>`,`Output directory`,`src/adapters`).action(async(t,n,r)=>{let i=U(r);e(i),W(await he({name:t,outDir:N(n.out)}),i)}),r.command(`plugin <name>`).description(`Generate a KickPlugin with DI, modules, adapters, middleware, and lifecycle hooks`).option(`-o, --out <dir>`,`Output directory`,`src/plugins`).action(async(t,n,r)=>{let i=U(r);e(i),W(await ut({name:t,outDir:N(n.out)}),i)}),r.command(`middleware <name>`).description(`Generate a global middleware function, typed for the configured runtime
344
+ Use -m to scope it to a module: kick g middleware auth -m users`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(t,n,r)=>{let i=U(r);e(i);let a=await E(process.cwd()),o=T(a),s=o.dir??`src/modules`;W(await oe({name:t,outDir:n.out,moduleName:n.module,modulesDir:s,pattern:a?.pattern,pluralize:o.pluralize??!0,runtime:a?.runtime}),i)}),r.command(`guard <name>`).description(`Generate a route guard (auth, roles, etc.)
345
345
  Use -m to scope it to a module: kick g guard admin -m users`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(t,n,r)=>{let i=U(r);e(i);let a=await E(process.cwd()),o=T(a),s=o.dir??`src/modules`;W(await se({name:t,outDir:n.out,moduleName:n.module,modulesDir:s,pattern:a?.pattern,pluralize:o.pluralize??!0}),i)}),r.command(`contributor <name>`).description(`Generate a Context Contributor (typed alternative to @Middleware for ctx.set)
346
346
  --type http (default, RequestContext) | bare (ExecutionContext)
347
347
  --params "source:string,region:number" → emits the withParams<T>() form
@@ -378,7 +378,19 @@ describe('${s}', () => {
378
378
  Asset build complete.
379
379
  `)}catch(e){console.error(` ✗ ${e instanceof Error?e.message:String(e)}`),process.exit(1)}}),e.command(`start`).description(`Start production server`).option(`-e, --entry <file>`,`Entry file`,`dist/index.js`).option(`-p, --port <port>`,`Port number`).action(e=>{let t={NODE_ENV:`production`};e.port&&(t.PORT=String(e.port)),we(e.entry,t)}),e.command(`dev:debug`).description(`Start dev server with Node.js inspector attached`).option(`-e, --entry <file>`,`Entry file`,`src/index.ts`).option(`-p, --port <port>`,`Port number`).option(`--inspect-port <port>`,`Inspector port`,`9229`).action(async e=>{let t=e.inspectPort??`9229`;process.env.NODE_OPTIONS=`--inspect=0.0.0.0:${t}`,console.log(` Debugger: ws://0.0.0.0:${t}`);try{await Yt(e.entry,e.port)}catch(e){console.error(`
380
380
  Dev server (debug) failed:`,e.message??e),process.exit(1)}})}function Zt(){try{let e=j(it(import.meta.url));return JSON.parse(F(M(e,`..`,`package.json`),`utf-8`)).version??`unknown`}catch{return`unknown`}}const Qt=new Set(Object.values(Se).filter(e=>e.deprecated).map(e=>e.pkg));function $t(e){let t=M(e,`package.json`);if(!P(t))return[];let n;try{n=JSON.parse(F(t,`utf-8`))}catch{return[]}let r={...n.dependencies,...n.devDependencies};return Object.keys(r).filter(e=>e===`@forinda/kickjs`||e.startsWith(`@forinda/kickjs-`)).toSorted().map(t=>{let n=null,i=M(e,`node_modules`,...t.split(`/`),`package.json`);if(P(i))try{n=JSON.parse(F(i,`utf-8`)).version??null}catch{}return{name:t,installed:n,declared:r[t]??null,deprecated:Qt.has(t)}})}function en(e){let t=e;for(;;){if(P(M(t,`package.json`)))return t;let e=j(t);if(e===t)return null;t=e}}function tn(e){e.command(`info`).description(`Print system and framework info`).action(()=>{let e=[``,` KickJS CLI v${Zt()}`,``,` System:`,` OS: ${ot()} ${st()} (${at()})`,` Node: ${process.version}`],t=en(process.cwd()),n=t?$t(t):[];if(!t)e.push(``,` Packages: (not inside a project — no package.json found)`);else if(n.length===0)e.push(``,` Packages: (no @forinda/kickjs* dependencies in ${t})`);else{e.push(``,` Packages:`);let t=Math.max(...n.map(e=>e.name.length));for(let r of n){let n=r.installed??`${r.declared??`?`} (declared — not installed)`,i=r.deprecated?" [DEPRECATED — see `kick add --list --all`]":``;e.push(` ${r.name.padEnd(t+2)} ${n}${i}`)}}e.push(``),console.log(e.join(`
381
- `))})}const{bold:K,dim:q,green:nn,red:J,yellow:rn,blue:an}=p;function on(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=e%60,a=[];return t&&a.push(`${t}d`),n&&a.push(`${n}h`),r&&a.push(`${r}m`),a.push(`${i}s`),a.join(` `)}async function sn(e){let t=await fetch(e,{signal:AbortSignal.timeout(5e3)});if(!t.ok)throw Error(`${t.status} ${t.statusText}`);return t.json()}async function Y(e,t){try{return await sn(`${e}${t}`)}catch{return null}}async function cn(e){let[t,n,r,i,a]=await Promise.all([Y(e,`/health`),Y(e,`/metrics`),Y(e,`/routes`),Y(e,`/container`),Y(e,`/ws`)]);return{health:t,metrics:n,routes:r,container:i,ws:a}}function ln(e,t){let{health:n,metrics:r,routes:i,container:a,ws:o}=t,c=q(`─`.repeat(60));if(console.log(),console.log(K(` KickJS Inspector`)+q(` → ${e}`)),console.log(c),n){let e=n.status===`healthy`?nn(`● healthy`):J(`● `+n.status);console.log(` ${K(`Health:`)} ${e}`)}else console.log(` ${K(`Health:`)} ${J(`● unreachable`)}`);if(r){let e=((r.errorRate??0)*100).toFixed(1),t=r.errorRate>.1?J:r.errorRate>0?rn:nn;console.log(` ${K(`Uptime:`)} ${on(r.uptimeSeconds)}`),console.log(` ${K(`Requests:`)} ${r.requests}`),console.log(` ${K(`Errors:`)} ${r.serverErrors} server, ${r.clientErrors??0} client ${q(`(`)}${t(e+`%`)}${q(`)`)}`)}if(a&&console.log(` ${K(`DI:`)} ${a.count} bindings`),o&&o.enabled&&console.log(` ${K(`WS:`)} ${o.connections??0} connections, ${o.namespaces??0} namespaces`),i?.routes?.length){console.log(),console.log(K(` Routes`)),console.log(c),console.log(` ${q(`METHOD`)} ${q(`PATH`.padEnd(36))} ${q(`CONTROLLER`)}`);for(let e of i.routes){let t=e.path.length>36?e.path.slice(0,33)+`...`:e.path.padEnd(36);console.log(` ${s(e.method)} ${t} ${an(e.controller)}.${q(e.handler)}`)}}console.log(c),console.log()}function un(e){e.command(`inspect [url]`).description(`Connect to a running KickJS app and display debug info`).option(`-p, --port <port>`,`Override port`).option(`-w, --watch`,`Poll every 5 seconds`).option(`-j, --json`,`Output raw JSON`).action(async(e,t)=>{let n=e??`http://localhost:3000`;if(t.port)try{let e=new URL(n);e.port=t.port,n=e.origin}catch{n=`http://localhost:${t.port}`}let r=`${n.replace(/\/$/,``)}/_debug`,i=async()=>{try{let e=await cn(r);t.json?console.log(JSON.stringify(e,null,2)):ln(n,e)}catch(e){t.json?console.log(JSON.stringify({error:String(e)})):(console.error(J(` ✖ Could not connect to ${n}`)),console.error(q(` ${e instanceof Error?e.message:String(e)}`))),t.watch||(process.exitCode=1)}};if(t.watch){let e=async()=>{process.stdout.write(`\x1B[2J\x1B[H`),await i()};await e(),setInterval(e,5e3)}else await i()})}function dn(e,t){let n=e.toLowerCase();return t.every(e=>n.includes(e.toLowerCase()))}function X(e,t){let n=e.toLowerCase();return t.some(e=>n.includes(e.toLowerCase()))}const fn=[{match(e,t){let n=dn(e,[`config`,`get`])&&X(e,[`undefined`,`null`]),r=e.includes(`@Value`)&&X(e,[`undefined`,`is not defined`]);return!n&&!r?null:{confidence:n&&r?90:75,diagnosis:{id:`env-schema-not-registered`,title:`ConfigService.get() returns undefined for user-defined keys`,explanation:`Your src/index.ts is missing \`import "./config"\`. That side-effect import
381
+ `))})}const{bold:K,dim:q,green:nn,red:J,yellow:rn,blue:an}=p;function on(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=e%60,a=[];return t&&a.push(`${t}d`),n&&a.push(`${n}h`),r&&a.push(`${r}m`),a.push(`${i}s`),a.join(` `)}async function sn(e){let t=await fetch(e,{signal:AbortSignal.timeout(5e3)});if(!t.ok)throw Error(`${t.status} ${t.statusText}`);return t.json()}async function Y(e,t){try{return await sn(`${e}${t}`)}catch{return null}}async function cn(e){let[t,n,r,i,a]=await Promise.all([Y(e,`/health`),Y(e,`/metrics`),Y(e,`/routes`),Y(e,`/container`),Y(e,`/ws`)]);return{health:t,metrics:n,routes:r,container:i,ws:a}}function ln(e,t){let{health:n,metrics:r,routes:i,container:a,ws:o}=t,c=q(`─`.repeat(60));if(console.log(),console.log(K(` KickJS Inspector`)+q(` → ${e}`)),console.log(c),n){let e=n.status===`healthy`?nn(`● healthy`):J(`● `+n.status);console.log(` ${K(`Health:`)} ${e}`)}else console.log(` ${K(`Health:`)} ${J(`● unreachable`)}`);if(r){let e=((r.errorRate??0)*100).toFixed(1),t=r.errorRate>.1?J:r.errorRate>0?rn:nn;console.log(` ${K(`Uptime:`)} ${on(r.uptimeSeconds)}`),console.log(` ${K(`Requests:`)} ${r.requests}`),console.log(` ${K(`Errors:`)} ${r.serverErrors} server, ${r.clientErrors??0} client ${q(`(`)}${t(e+`%`)}${q(`)`)}`)}if(a&&console.log(` ${K(`DI:`)} ${a.count} bindings`),o&&o.enabled&&console.log(` ${K(`WS:`)} ${o.connections??0} connections, ${o.namespaces??0} namespaces`),i?.routes?.length){console.log(),console.log(K(` Routes`)),console.log(c),console.log(` ${q(`METHOD`)} ${q(`PATH`.padEnd(36))} ${q(`CONTROLLER`)}`);for(let e of i.routes){let t=e.path.length>36?e.path.slice(0,33)+`...`:e.path.padEnd(36);console.log(` ${s(e.method)} ${t} ${an(e.controller)}.${q(e.handler)}`)}}console.log(c),console.log()}function un(e){e.command(`inspect [url]`).description(`Connect to a running KickJS app and display debug info`).option(`-p, --port <port>`,`Override port`).option(`-w, --watch`,`Poll every 5 seconds`).option(`-j, --json`,`Output raw JSON`).action(async(e,t)=>{let n=e??`http://localhost:3000`;if(t.port)try{let e=new URL(n);e.port=t.port,n=e.origin}catch{n=`http://localhost:${t.port}`}let r=`${n.replace(/\/$/,``)}/_debug`,i=async()=>{try{let e=await cn(r);t.json?console.log(JSON.stringify(e,null,2)):ln(n,e)}catch(e){t.json?console.log(JSON.stringify({error:String(e)})):(console.error(J(` ✖ Could not connect to ${n}`)),console.error(q(` ${e instanceof Error?e.message:String(e)}`))),t.watch||(process.exitCode=1)}};if(t.watch){let e=async()=>{process.stdout.write(`\x1B[2J\x1B[H`),await i()};await e(),setInterval(e,5e3)}else await i()})}function dn(e,t){let n=e.toLowerCase();return t.every(e=>n.includes(e.toLowerCase()))}function X(e,t){let n=e.toLowerCase();return t.some(e=>n.includes(e.toLowerCase()))}const fn=[{match(e,t){let n=dn(e,[`config`,`get`])&&X(e,[`undefined`,`null`]),r=e.includes(`@Value`)&&X(e,[`undefined`,`is not defined`]);return!n&&!r?null:X(e,[`vitest`,`createTestApp`,`__tests__`,`.test.`,`.spec.`])?{confidence:85,diagnosis:{id:`env-schema-not-registered-in-test`,title:`ConfigService.get() returns undefined inside a test`,explanation:`The env schema is registered by a module-load side effect in
382
+ src/config/index.ts, and src/index.ts imports it before bootstrap().
383
+ Tests never load src/index.ts — \`createTestApp\` builds the app
384
+ directly — so that import does not run and ConfigService falls back to
385
+ the base schema. @Value() still reads through to process.env, so the
386
+ app and its tests disagree and only the tests are wrong.`,fix:`Import the side-effect module in the test file itself:`,codeBefore:`import { createTestApp } from '@forinda/kickjs-testing'
387
+
388
+ const { expressApp } = await createTestApp({ modules: [UserModule] })
389
+ `,codeAfter:`import { createTestApp } from '@forinda/kickjs-testing'
390
+ import '@/config' // ← registers the env schema, as src/index.ts does
391
+
392
+ const { expressApp } = await createTestApp({ modules: [UserModule] })
393
+ `,docs:`https://kickjs.app/guide/configuration.html#wiring-the-schema-at-startup`}}:{confidence:n&&r?90:75,diagnosis:{id:`env-schema-not-registered`,title:`ConfigService.get() returns undefined for user-defined keys`,explanation:`Your src/index.ts is missing \`import "./config"\`. That side-effect import
382
394
  registers the env schema with kickjs at module-load time. Without it,
383
395
  ConfigService falls back to the base schema (PORT/NODE_ENV/LOG_LEVEL only)
384
396
  and every user-defined key reads as undefined. @Value() may *appear* to
@@ -390,7 +402,7 @@ import { modules } from './modules'
390
402
  import './config' // ← add this — registers env schema
391
403
  import { bootstrap } from '@forinda/kickjs'
392
404
  import { modules } from './modules'
393
- `,docs:`https://kickjs.app/guide/configuration.html#wiring-the-schema-at-startup`}}}},{match(e,t){let n=X(e,[`vitest`,`test`,`spec`,`__tests__`,`.test.`]);return X(e,[`already registered`,`already exists`,`duplicate`,`has been registered`])?{confidence:n?85:60,diagnosis:{id:`container-not-reset-in-tests`,title:`DI container leaks between test cases`,explanation:`KickJS decorators register classes on the global Container at import time.
405
+ `,docs:`https://kickjs.app/guide/configuration.html#wiring-the-schema-at-startup`}}}},{match(e,t){let n=X(e,[`vitest`,`createTestApp`,`__tests__`,`.test.`,`.spec.`]);return X(e,[`already registered`,`already exists`,`duplicate`,`has been registered`])?{confidence:n?85:60,diagnosis:{id:`container-not-reset-in-tests`,title:`DI container leaks between test cases`,explanation:`KickJS decorators register classes on the global Container at import time.
394
406
  When vitest re-imports your modules across tests, the same class can be
395
407
  registered twice and the container throws. The fix is to wipe the
396
408
  container between tests so each case starts fresh.`,fix:`Add Container.reset() to a beforeEach hook in the failing test file:`,codeAfter:`import { describe, it, beforeEach } from 'vitest'
@@ -585,7 +597,7 @@ server.on('exit', () => {
585
597
  Cancelled.
586
598
  `);return}await et(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let u=M(r,`index.ts`);if(await n(u)){let e=await L(u,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${m(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${m(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Ln(e,s),e=e.replace(/\n{3,}/g,`
587
599
 
588
- `),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(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(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(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 Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(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=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-Bl42_aUN.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-Ho5elH40.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(`
600
+ `),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(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(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(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 Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(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=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-BYw2PRe-.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-eOHQv50e.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(`
589
601
  Registered typegen plugins:
590
602
  `);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``;console.log(` ${e.id.padEnd(a+2)}inputs: ${e.inputs.join(`, `)||`(none)`}${t}`)}console.log();return}let r=Bn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Vn(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,fix:e.fix,allowDuplicates:e.allowDuplicates,noCache:e.cache===!1,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await Ve(a);e.silent||console.log(` kick typegen: watching for changes (Ctrl-C to exit)`);let n=()=>{t(),process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n),await new Promise(()=>{})}else{await k(a);let r=await Wt({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&r.some(e=>e.status===`written`)&&process.exit(1),e.check||await Ie(N(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r,e.silent??!1)}}catch(e){e instanceof He?console.error(`
591
603
  `+e.message+`
@@ -683,4 +695,4 @@ declare global {
683
695
  export {}
684
696
  `}const _r=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=yr(e);if(t===!1)return null;let n=await e.getScanResult({root:vr(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=A.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return gr(n.env,i,r)}});function vr(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function yr(e){return e.config?.typegen?.envFile}function br(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function xr(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:br(e),cwd:e.cwd,envFile:xr(e)}}const Sr=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=A.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return Be(t.classes,n,r)}}),Cr=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className));return Re(`ServiceToken`,Le(t.classes,t.tokens,t.injects,n),"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),wr=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){return Re(`ModuleToken`,je((await e.getScanResult($(e))).classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),Tr=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){return Ne((await e.getScanResult($(e))).pluginsAndAdapters)}}),Er=()=>({id:`kick/augmentations`,inputs:[`src/**/*.ts`],async generate(e){return Ue((await e.getScanResult($(e))).augmentations)}}),Dr=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:Me(t.contextKeys)}}),Or={fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},kr=[D({name:`kick/init`,register:lt}),D({name:`kick/generate`,register:Rt}),D({name:`kick/run`,register:Xt}),D({name:`kick/info`,register:tn}),D({name:`kick/inspect`,register:un}),D({name:`kick/add`,register:ye}),D({name:`kick/list`,register:xe}),D({name:`kick/explain`,register:bn}),D({name:`kick/mcp`,register:kn}),D({name:`kick/tinker`,register:Nn}),D({name:`kick/remove`,register:zn}),D({name:`kick/typegen`,register:Hn}),D({name:`kick/check`,register:er}),D({name:`kick/doctor`,register:me}),D({name:`kick/codemod`,register:nr}),D({name:`kick/registry`,typegens:[Sr()]}),D({name:`kick/services`,typegens:[Cr()]}),D({name:`kick/modules`,typegens:[wr()]}),D({name:`kick/plugins`,typegens:[Tr()]}),D({name:`kick/augmentations`,typegens:[Er()]}),D({name:`kick/context`,typegens:[Dr()]}),D({name:`kick/assets`,typegens:[rr()]}),D({name:`kick/routes`,typegens:[pr()]}),D({name:`kick/env`,typegens:[_r()]}),D({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;if(t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=Or[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(`
685
697
  `)}}]})];export{Ht as applyDisableFilter,Wt as runAllPluginTypegens,kr as t};
686
- //# sourceMappingURL=run-plugins-CY13ekyP.mjs.map
698
+ //# sourceMappingURL=run-plugins-CsbJxJic.mjs.map