@forinda/kickjs-cli 6.2.0-alpha.2 → 6.2.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 (24) hide show
  1. package/dist/{agent-docs-BHxKWIf4.mjs → agent-docs-Di96qILM.mjs} +3 -3
  2. package/dist/{agent-docs-BHxKWIf4.mjs.map → agent-docs-Di96qILM.mjs.map} +1 -1
  3. package/dist/{build-DH7RVYT6.mjs → build-C_RWnIv1.mjs} +3 -3
  4. package/dist/{build-DH7RVYT6.mjs.map → build-C_RWnIv1.mjs.map} +1 -1
  5. package/dist/{builtins-B9jAir23.mjs → builtins-BdJFdAsP.mjs} +2 -2
  6. package/dist/cli.mjs +1 -1
  7. package/dist/{config-DOnwtASE.mjs → config-G8kmxDyZ.mjs} +3 -3
  8. package/dist/{config-DOnwtASE.mjs.map → config-G8kmxDyZ.mjs.map} +1 -1
  9. package/dist/{doctor-CUR55xM0.mjs → doctor-KBy5WFZJ.mjs} +6 -6
  10. package/dist/{doctor-CUR55xM0.mjs.map → doctor-KBy5WFZJ.mjs.map} +1 -1
  11. package/dist/index.mjs +2 -2
  12. package/dist/{plugin-DiLjdUhB.mjs → plugin-BH1mZC2X.mjs} +3 -3
  13. package/dist/{plugin-DiLjdUhB.mjs.map → plugin-BH1mZC2X.mjs.map} +1 -1
  14. package/dist/{project-docs-M1yY0Jfu.mjs → project-docs-DKOLHfqu.mjs} +2 -2
  15. package/dist/{project-docs-M1yY0Jfu.mjs.map → project-docs-DKOLHfqu.mjs.map} +1 -1
  16. package/dist/{project-root-t0bXso9G.mjs → project-root-DsnEUmMN.mjs} +3 -3
  17. package/dist/{project-root-t0bXso9G.mjs.map → project-root-DsnEUmMN.mjs.map} +1 -1
  18. package/dist/{rolldown-runtime-DM9iduxt.mjs → rolldown-runtime-BoqBCbMv.mjs} +1 -1
  19. package/dist/{run-plugins-DujFeVh4.mjs → run-plugins-Bql3IbaE.mjs} +4 -4
  20. package/dist/{run-plugins-DujFeVh4.mjs.map → run-plugins-Bql3IbaE.mjs.map} +1 -1
  21. package/dist/{typegen-6pW2cOTw.mjs → typegen-C7AgyPIB.mjs} +5 -5
  22. package/dist/{typegen-6pW2cOTw.mjs.map → typegen-C7AgyPIB.mjs.map} +1 -1
  23. package/dist/{types-D34YF7B6.mjs → types-xMa5uCri.mjs} +1 -1
  24. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.2.0-alpha.2
2
+ * @forinda/kickjs-cli v6.2.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-DM9iduxt.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-t0bXso9G.mjs.map
11
+ import{t as e}from"./rolldown-runtime-BoqBCbMv.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-DsnEUmMN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-root-t0bXso9G.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-DsnEUmMN.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.2.0-alpha.2
2
+ * @forinda/kickjs-cli v6.2.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v6.2.0-alpha.2
2
+ * @forinda/kickjs-cli v6.2.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{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,p as l,s as u,u as d,v as f,y as p}from"./project-docs-M1yY0Jfu.mjs";import{A as m,C as h,D as g,E as _,F as v,I as y,L as b,M as ee,N as x,O as S,P as C,R as w,S as te,T as ne,_ as re,a as ie,b as ae,c as oe,f as se,g as ce,h as le,i as ue,j as de,k as fe,l as pe,m as me,o as he,p as ge,r as _e,s as ve,v as ye,w as be,x as xe,y as Se}from"./doctor-CUR55xM0.mjs";import{a as T,i as E,o as Ce,s as we}from"./config-DOnwtASE.mjs";import{t as Te}from"./project-root-t0bXso9G.mjs";import{n as D}from"./types-D34YF7B6.mjs";import{t as Ee}from"./build-DH7RVYT6.mjs";import{n as De}from"./agent-docs-BHxKWIf4.mjs";import{n as Oe}from"./plugin-DiLjdUhB.mjs";import{a as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,i as Fe,l as Ie,m as Le,o as Re,p as ze,r as Be,s as Ve,t as He,u as Ue}from"./typegen-6pW2cOTw.mjs";import O,{basename as We,dirname as k,join as A,relative as j,resolve as M,sep as N}from"node:path";import{cpSync as Ge,existsSync as P,mkdirSync as Ke,readFileSync as F,readdirSync as qe,rmSync as Je,writeFileSync as Ye}from"node:fs";import{copyFile as Xe,mkdir as I,readFile as L,readdir as Ze,rm as Qe,stat as $e,writeFile as R}from"node:fs/promises";import{fork as et,spawn as tt,spawnSync as nt}from"node:child_process";import{fileURLToPath as rt,pathToFileURL as z}from"node:url";import{arch as it,platform as at,release as ot}from"node:os";const st=[{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 ct(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`).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)=>{n(`KickJS — Create a new project`);let o=!!(t.yes||t.nonInteractive);e||=o?`my-api`:await c({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let l;if(e===`.`?(l=M(`.`),e=We(l)):l=M(t.directory||e),P(l)){let n=qe(l);if(n.length>0){if(t.force)s.warn(`Clearing existing files in ${l}`);else if(o){s.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{s.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)s.message(` - ${e}`);if(n.length>5&&s.message(` ... and ${n.length-5} more`),!await u({message:a.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)Je(M(l,e),{recursive:!0,force:!0})}}let f=t.template;f||=o?`minimal`:await i({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`}]});let p=t.runtime;p||=o?`express`:await i({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||=o?await ve(void 0):await i({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||=o?`inmemory`:await c({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),we(h);let g=t.schema;g||=o?`zod`:await i({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)||(s.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 _=o?[]:await d({message:`Select packages to include`,options:[...st],required:!1});let v;v=t.git===void 0?o?!0:await u({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;y=t.install===void 0?o?!0:await u({message:`Install dependencies?`,initialValue:!0}):t.install,await me({name:e,directory:l,packageManager:m,initGit:v,installDeps:y,template:f,defaultRepo:h,packages:_,schemaLib:g,runtime:p}),r(`Done! Next steps: ${a.cyan(`cd ${e} && ${m} dev`)}`)})}async function lt(e){let{name:n,outDir:r}=e,i=b(n),a=w(n),o=[],s=A(r,`${i}.plugin.ts`);return await t(s,`import {
11
+ import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,p as l,s as u,u as d,v as f,y as p}from"./project-docs-DKOLHfqu.mjs";import{A as m,C as h,D as g,E as _,F as v,I as y,L as b,M as ee,N as x,O as S,P as C,R as w,S as te,T as ne,_ as re,a as ie,b as ae,c as oe,f as se,g as ce,h as le,i as ue,j as de,k as fe,l as pe,m as me,o as he,p as ge,r as _e,s as ve,v as ye,w as be,x as xe,y as Se}from"./doctor-KBy5WFZJ.mjs";import{a as T,i as E,o as Ce,s as we}from"./config-G8kmxDyZ.mjs";import{t as Te}from"./project-root-DsnEUmMN.mjs";import{n as D}from"./types-xMa5uCri.mjs";import{t as Ee}from"./build-C_RWnIv1.mjs";import{n as De}from"./agent-docs-Di96qILM.mjs";import{n as Oe}from"./plugin-BH1mZC2X.mjs";import{a as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,i as Fe,l as Ie,m as Le,o as Re,p as ze,r as Be,s as Ve,t as He,u as Ue}from"./typegen-C7AgyPIB.mjs";import O,{basename as We,dirname as k,join as A,relative as j,resolve as M,sep as N}from"node:path";import{cpSync as Ge,existsSync as P,mkdirSync as Ke,readFileSync as F,readdirSync as qe,rmSync as Je,writeFileSync as Ye}from"node:fs";import{copyFile as Xe,mkdir as I,readFile as L,readdir as Ze,rm as Qe,stat as $e,writeFile as R}from"node:fs/promises";import{fork as et,spawn as tt,spawnSync as nt}from"node:child_process";import{fileURLToPath as rt,pathToFileURL as z}from"node:url";import{arch as it,platform as at,release as ot}from"node:os";const st=[{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 ct(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`).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)=>{n(`KickJS — Create a new project`);let o=!!(t.yes||t.nonInteractive);e||=o?`my-api`:await c({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let l;if(e===`.`?(l=M(`.`),e=We(l)):l=M(t.directory||e),P(l)){let n=qe(l);if(n.length>0){if(t.force)s.warn(`Clearing existing files in ${l}`);else if(o){s.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{s.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)s.message(` - ${e}`);if(n.length>5&&s.message(` ... and ${n.length-5} more`),!await u({message:a.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)Je(M(l,e),{recursive:!0,force:!0})}}let f=t.template;f||=o?`minimal`:await i({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`}]});let p=t.runtime;p||=o?`express`:await i({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||=o?await ve(void 0):await i({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||=o?`inmemory`:await c({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),we(h);let g=t.schema;g||=o?`zod`:await i({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)||(s.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 _=o?[]:await d({message:`Select packages to include`,options:[...st],required:!1});let v;v=t.git===void 0?o?!0:await u({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;y=t.install===void 0?o?!0:await u({message:`Install dependencies?`,initialValue:!0}):t.install,await me({name:e,directory:l,packageManager:m,initGit:v,installDeps:y,template:f,defaultRepo:h,packages:_,schemaLib:g,runtime:p}),r(`Done! Next steps: ${a.cyan(`cd ${e} && ${m} dev`)}`)})}async function lt(e){let{name:n,outDir:r}=e,i=b(n),a=w(n),o=[],s=A(r,`${i}.plugin.ts`);return await t(s,`import {
12
12
  definePlugin,
13
13
  type AppAdapter,
14
14
  type AppModuleEntry,
@@ -538,7 +538,7 @@ server.on('exit', () => {
538
538
  Cancelled.
539
539
  `);return}await Qe(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let d=A(n,`index.ts`);if(await f(d)){let e=await L(d,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${x(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${x(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Rn(e,s),e=e.replace(/\n{3,}/g,`
540
540
 
541
- `),e!==t&&(await R(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Bn(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 zn({name:n,modulesDir:M(r),force:t.force,pluralize:i})})}function Vn(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 Hn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Un(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: fail on plugin-typegen drift instead of writing`).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=Te(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-DiLjdUhB.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-B9jAir23.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(`
541
+ `),e!==t&&(await R(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Bn(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 zn({name:n,modulesDir:M(r),force:t.force,pluralize:i})})}function Vn(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 Hn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Un(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: fail on plugin-typegen drift instead of writing`).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=Te(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-BH1mZC2X.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-BdJFdAsP.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(`
542
542
  Registered typegen plugins:
543
543
  `);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=Vn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Hn(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,allowDuplicates:e.allowDuplicates,noCache:e.cache===!1,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await Be(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 He(a);let r=await Gt({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 Fe(M(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r,e.silent??!1)}}catch(e){e instanceof Ve?console.error(`
544
544
  `+e.message+`
@@ -618,4 +618,4 @@ declare global {
618
618
  export {}
619
619
  `}const gr=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=vr(e);if(t===!1)return null;let n=await e.getScanResult({root:_r(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=O.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return hr(n.env,i,r)}});function _r(e){return O.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function vr(e){return e.config?.typegen?.envFile}function yr(e){return O.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function br(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:yr(e),cwd:e.cwd,envFile:br(e)}}const xr=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=O.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return ze(t.classes,n,r)}}),Sr=()=>({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 Le(`ServiceToken`,Ie(t.classes,t.tokens,t.injects,n),"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),Cr=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){return Le(`ModuleToken`,Ae((await e.getScanResult($(e))).classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),wr=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){return Me((await e.getScanResult($(e))).pluginsAndAdapters)}}),Tr=()=>({id:`kick/augmentations`,inputs:[`src/**/*.ts`],async generate(e){return Ue((await e.getScanResult($(e))).augmentations)}}),Er=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:je(t.contextKeys)}}),Dr={fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},Or=[D({name:`kick/init`,register:ct}),D({name:`kick/generate`,register:Rt}),D({name:`kick/run`,register:Zt}),D({name:`kick/info`,register:nn}),D({name:`kick/inspect`,register:dn}),D({name:`kick/add`,register:ie}),D({name:`kick/list`,register:he}),D({name:`kick/explain`,register:xn}),D({name:`kick/mcp`,register:An}),D({name:`kick/tinker`,register:Pn}),D({name:`kick/remove`,register:Bn}),D({name:`kick/typegen`,register:Un}),D({name:`kick/check`,register:tr}),D({name:`kick/doctor`,register:_e}),D({name:`kick/codemod`,register:rr}),D({name:`kick/registry`,typegens:[xr()]}),D({name:`kick/services`,typegens:[Sr()]}),D({name:`kick/modules`,typegens:[Cr()]}),D({name:`kick/plugins`,typegens:[wr()]}),D({name:`kick/augmentations`,typegens:[Tr()]}),D({name:`kick/context`,typegens:[Er()]}),D({name:`kick/assets`,typegens:[ir()]}),D({name:`kick/routes`,typegens:[fr()]}),D({name:`kick/env`,typegens:[gr()]}),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}=Dr[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(`
620
620
  `)}}]})];export{Ut as applyDisableFilter,Gt as runAllPluginTypegens,Or as t};
621
- //# sourceMappingURL=run-plugins-DujFeVh4.mjs.map
621
+ //# sourceMappingURL=run-plugins-Bql3IbaE.mjs.map