@forinda/kickjs-cli 8.0.1 → 8.1.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 (48) hide show
  1. package/dist/{agent-docs-BsDrREYZ.mjs → agent-docs-eQAOlX05.mjs} +3 -3
  2. package/dist/agent-docs-eQAOlX05.mjs.map +1 -0
  3. package/dist/{agent-docs-B7yE3lQx.mjs → agent-docs-jERb6N2l.mjs} +2 -2
  4. package/dist/{build-Dzh4toKg.mjs → build-D2ZZU7I6.mjs} +3 -3
  5. package/dist/{build-Dzh4toKg.mjs.map → build-D2ZZU7I6.mjs.map} +1 -1
  6. package/dist/{build-D6d8OEIP.mjs → build-DEaT15J_.mjs} +2 -2
  7. package/dist/{builtins-DAE1P8v_.mjs → builtins--qT_kVnj.mjs} +104 -101
  8. package/dist/{builtins-BZ-nFDRJ.mjs → builtins-DMGXEkYh.mjs} +2 -2
  9. package/dist/cli.mjs +2 -2
  10. package/dist/{config-DVJ-0xov.mjs → config-BsD3F7Qm.mjs} +2 -2
  11. package/dist/{config-1AktuESd.mjs → config-D9cTQyqK.mjs} +3 -3
  12. package/dist/{config-1AktuESd.mjs.map → config-D9cTQyqK.mjs.map} +1 -1
  13. package/dist/{doctor-DKu4x3uO.mjs → doctor-CXyjM165.mjs} +4 -4
  14. package/dist/{doctor-DKu4x3uO.mjs.map → doctor-CXyjM165.mjs.map} +1 -1
  15. package/dist/{fullstack-7cYgMEf1.mjs → fullstack-BmLfytg8.mjs} +3 -3
  16. package/dist/{fullstack-DEgxqh6m.mjs → fullstack-DoSyxXS4.mjs} +4 -4
  17. package/dist/{fullstack-DEgxqh6m.mjs.map → fullstack-DoSyxXS4.mjs.map} +1 -1
  18. package/dist/index.d.mts +22 -0
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +2 -2
  21. package/dist/{plugin-DhUZGZ1v.mjs → plugin-48zRrjAt.mjs} +2 -2
  22. package/dist/{plugin-C5HNkLuq.mjs → plugin-BpYt41Nj.mjs} +3 -3
  23. package/dist/{plugin-C5HNkLuq.mjs.map → plugin-BpYt41Nj.mjs.map} +1 -1
  24. package/dist/{project-Bb1LRDKF.mjs → project-CWQxUTOw.mjs} +24 -24
  25. package/dist/{project-docs-pIpQ-4Os.mjs → project-docs-B3f2t5-o.mjs} +2 -2
  26. package/dist/{project-docs-pIpQ-4Os.mjs.map → project-docs-B3f2t5-o.mjs.map} +1 -1
  27. package/dist/{project-docs-DWPzkZ5p.mjs → project-docs-ue-hY0J7.mjs} +1 -1
  28. package/dist/{project-D8Bjdxtm.mjs → project-llLxBp1a.mjs} +22 -22
  29. package/dist/project-llLxBp1a.mjs.map +1 -0
  30. package/dist/{project-root-CTbG-IYo.mjs → project-root-DX8zIouv.mjs} +2 -2
  31. package/dist/{project-root-CJm3KGjG.mjs → project-root-yp0AaVDs.mjs} +3 -3
  32. package/dist/{project-root-CJm3KGjG.mjs.map → project-root-yp0AaVDs.mjs.map} +1 -1
  33. package/dist/{prompts-xizRYRHy.mjs → prompts-BRkH7pwQ.mjs} +2 -2
  34. package/dist/{prompts-xizRYRHy.mjs.map → prompts-BRkH7pwQ.mjs.map} +1 -1
  35. package/dist/{rolldown-runtime-CSIJ2o5J.mjs → rolldown-runtime-4o6m7Xdi.mjs} +1 -1
  36. package/dist/{run-plugins-BKGgSL6L.mjs → run-plugins-l7m3dInr.mjs} +71 -68
  37. package/dist/run-plugins-l7m3dInr.mjs.map +1 -0
  38. package/dist/typegen-BK72BD_F.mjs +131 -0
  39. package/dist/typegen-CO21qe_k.mjs +132 -0
  40. package/dist/typegen-CO21qe_k.mjs.map +1 -0
  41. package/dist/{types-DlARm-HF.mjs → types-B1zn_O0F.mjs} +1 -1
  42. package/package.json +2 -2
  43. package/dist/agent-docs-BsDrREYZ.mjs.map +0 -1
  44. package/dist/project-D8Bjdxtm.mjs.map +0 -1
  45. package/dist/run-plugins-BKGgSL6L.mjs.map +0 -1
  46. package/dist/typegen-BA-9aIp0.mjs +0 -113
  47. package/dist/typegen-D85l90Te.mjs +0 -114
  48. package/dist/typegen-D85l90Te.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,14 +8,14 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{l as e,n as t,t as n}from"./project-Bb1LRDKF.mjs";import{l as r}from"./project-docs-DWPzkZ5p.mjs";import{join as i}from"node:path";import{execFileSync as a}from"node:child_process";async function o(o){let{name:_,directory:v,schemaLib:y=`zod`,runtime:b=`express`}=o,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(o.packageManager),S=x?o.packageManager:`pnpm`,C=v,w=e=>console.log(` ${e}`);o.packageManager!==void 0&&!x&&w(`Warning: unknown package manager '${String(o.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${_}\n`),await n({name:`${_}-server`,directory:i(C,`server`),packageManager:S,template:`minimal`,schemaLib:y,runtime:b,withClientMap:!0,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`});let T=await t(),E=T[`@forinda/kickjs-client`]??`^0.1.0`;await r(i(C,`web/package.json`),s(_,E)),await r(i(C,`web/vite.config.ts`),c()),await r(i(C,`web/tsconfig.json`),l()),await r(i(C,`web/index.html`),u(_)),await r(i(C,`web/src/main.tsx`),d()),await r(i(C,`web/src/App.tsx`),f()),await r(i(C,`web/src/api.ts`),p()),await r(i(C,`package.json`),m(_,S,T[`@forinda/kickjs-cli`])),S===`pnpm`&&await r(i(C,`pnpm-workspace.yaml`),`packages:
11
+ import{l as e,n as t,t as n}from"./project-CWQxUTOw.mjs";import{l as r}from"./project-docs-ue-hY0J7.mjs";import{join as i}from"node:path";import{execFileSync as a}from"node:child_process";async function o(o){let{name:_,directory:v,schemaLib:y=`zod`,runtime:b=`express`}=o,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(o.packageManager),S=x?o.packageManager:`pnpm`,C=v,w=e=>console.log(` ${e}`);o.packageManager!==void 0&&!x&&w(`Warning: unknown package manager '${String(o.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${_}\n`),await n({name:`${_}-server`,directory:i(C,`server`),packageManager:S,template:`minimal`,schemaLib:y,runtime:b,withClientMap:!0,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`});let T=await t(),E=T[`@forinda/kickjs-client`]??`^0.1.0`;await r(i(C,`web/package.json`),s(_,E)),await r(i(C,`web/vite.config.ts`),c()),await r(i(C,`web/tsconfig.json`),l()),await r(i(C,`web/index.html`),u(_)),await r(i(C,`web/src/main.tsx`),d()),await r(i(C,`web/src/App.tsx`),f()),await r(i(C,`web/src/api.ts`),p()),await r(i(C,`package.json`),m(_,S,T[`@forinda/kickjs-cli`])),S===`pnpm`&&await r(i(C,`pnpm-workspace.yaml`),`packages:
12
12
  - server
13
13
  - web
14
14
 
15
15
  allowBuilds:
16
16
  '@swc/core': true
17
17
  esbuild: true
18
- `),await r(i(C,`.gitignore`),h()),await r(i(C,`README.md`),g(_,S));let{generateAgentDocs:D}=await import(`./agent-docs-B7yE3lQx.mjs`).then(e=>e.t);if(await D({outDir:C,name:_,pm:S,template:`fullstack`,only:`all`,force:!0}),o.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{e(S,[`install`],{cwd:C})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-BA-9aIp0.mjs`).then(e=>e.n);await e({cwd:i(C,`server`),allowDuplicates:!0,silent:!0})}catch{}if(o.initGit)try{a(`git`,[`init`],{cwd:C,stdio:`pipe`}),a(`git`,[`branch`,`-M`,`main`],{cwd:C,stdio:`pipe`}),a(`git`,[`add`,`-A`],{cwd:C,stdio:`pipe`}),a(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:C,stdio:`pipe`}),w(`Git repository initialized`)}catch{w(`Warning: git init failed (git may not be installed)`)}console.log(`
18
+ `),await r(i(C,`.gitignore`),h()),await r(i(C,`README.md`),g(_,S));let{generateAgentDocs:D}=await import(`./agent-docs-jERb6N2l.mjs`).then(e=>e.t);if(await D({outDir:C,name:_,pm:S,template:`fullstack`,only:`all`,force:!0}),o.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{e(S,[`install`],{cwd:C})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-BK72BD_F.mjs`).then(e=>e.n);await e({cwd:i(C,`server`),allowDuplicates:!0,silent:!0})}catch{}if(o.initGit)try{a(`git`,[`init`],{cwd:C,stdio:`pipe`}),a(`git`,[`branch`,`-M`,`main`],{cwd:C,stdio:`pipe`}),a(`git`,[`add`,`-A`],{cwd:C,stdio:`pipe`}),a(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:C,stdio:`pipe`}),w(`Git repository initialized`)}catch{w(`Warning: git init failed (git may not be installed)`)}console.log(`
19
19
  Fullstack workspace scaffolded!`),console.log(),w(`Next steps:`),w(` cd ${_}`),o.installDeps||w(` ${S} install`),S===`pnpm`?w(` pnpm dev # runs server (kick dev) + web (vite) together`):(w(` ${S} run dev:server # terminal 1`),w(` ${S} run dev:web # terminal 2`)),w(``),w(`The web app calls the API through @forinda/kickjs-client —`),w(`edit server/src/modules/hello and watch web/src/App.tsx's types follow.`),w(``)}function s(e,t){return`${JSON.stringify({name:`${e}-web`,private:!0,version:`0.0.0`,type:`module`,scripts:{dev:`vite`,build:`tsc --noEmit && vite build`,preview:`vite preview`,typecheck:`tsc --noEmit`},dependencies:{"@forinda/kickjs-client":t,react:`^19.0.0`,"react-dom":`^19.0.0`},devDependencies:{"@types/react":`^19.0.0`,"@types/react-dom":`^19.0.0`,"@vitejs/plugin-react":`^5.0.0`,typescript:`^5.9.0`,vite:`^7.0.0`}},null,2)}\n`}function c(){return`import { defineConfig } from 'vite'
20
20
  import react from '@vitejs/plugin-react'
21
21
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,14 +8,14 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{l as e}from"./project-docs-pIpQ-4Os.mjs";import{l as t,n,t as r}from"./project-D8Bjdxtm.mjs";import{join as i}from"node:path";import{execFileSync as a}from"node:child_process";async function o(o){let{name:_,directory:v,schemaLib:y=`zod`,runtime:b=`express`}=o,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(o.packageManager),S=x?o.packageManager:`pnpm`,C=v,w=e=>console.log(` ${e}`);o.packageManager!==void 0&&!x&&w(`Warning: unknown package manager '${String(o.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${_}\n`),await r({name:`${_}-server`,directory:i(C,`server`),packageManager:S,template:`minimal`,schemaLib:y,runtime:b,withClientMap:!0,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`});let T=await n(),E=T[`@forinda/kickjs-client`]??`^0.1.0`;await e(i(C,`web/package.json`),s(_,E)),await e(i(C,`web/vite.config.ts`),c()),await e(i(C,`web/tsconfig.json`),l()),await e(i(C,`web/index.html`),u(_)),await e(i(C,`web/src/main.tsx`),d()),await e(i(C,`web/src/App.tsx`),f()),await e(i(C,`web/src/api.ts`),p()),await e(i(C,`package.json`),m(_,S,T[`@forinda/kickjs-cli`])),S===`pnpm`&&await e(i(C,`pnpm-workspace.yaml`),`packages:
11
+ import{l as e}from"./project-docs-B3f2t5-o.mjs";import{l as t,n,t as r}from"./project-llLxBp1a.mjs";import{join as i}from"node:path";import{execFileSync as a}from"node:child_process";async function o(o){let{name:_,directory:v,schemaLib:y=`zod`,runtime:b=`express`}=o,x=[`pnpm`,`npm`,`yarn`,`bun`].includes(o.packageManager),S=x?o.packageManager:`pnpm`,C=v,w=e=>console.log(` ${e}`);o.packageManager!==void 0&&!x&&w(`Warning: unknown package manager '${String(o.packageManager)}' — falling back to pnpm.`),console.log(`\n Creating fullstack KickJS workspace: ${_}\n`),await r({name:`${_}-server`,directory:i(C,`server`),packageManager:S,template:`minimal`,schemaLib:y,runtime:b,withClientMap:!0,initGit:!1,installDeps:!1,spaClientDir:`../web/dist`});let T=await n(),E=T[`@forinda/kickjs-client`]??`^0.1.0`;await e(i(C,`web/package.json`),s(_,E)),await e(i(C,`web/vite.config.ts`),c()),await e(i(C,`web/tsconfig.json`),l()),await e(i(C,`web/index.html`),u(_)),await e(i(C,`web/src/main.tsx`),d()),await e(i(C,`web/src/App.tsx`),f()),await e(i(C,`web/src/api.ts`),p()),await e(i(C,`package.json`),m(_,S,T[`@forinda/kickjs-cli`])),S===`pnpm`&&await e(i(C,`pnpm-workspace.yaml`),`packages:
12
12
  - server
13
13
  - web
14
14
 
15
15
  allowBuilds:
16
16
  '@swc/core': true
17
17
  esbuild: true
18
- `),await e(i(C,`.gitignore`),h()),await e(i(C,`README.md`),g(_,S));let{generateAgentDocs:D}=await import(`./agent-docs-BsDrREYZ.mjs`).then(e=>e.t);if(await D({outDir:C,name:_,pm:S,template:`fullstack`,only:`all`,force:!0}),o.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{t(S,[`install`],{cwd:C})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-D85l90Te.mjs`).then(e=>e.n);await e({cwd:i(C,`server`),allowDuplicates:!0,silent:!0})}catch{}if(o.initGit)try{a(`git`,[`init`],{cwd:C,stdio:`pipe`}),a(`git`,[`branch`,`-M`,`main`],{cwd:C,stdio:`pipe`}),a(`git`,[`add`,`-A`],{cwd:C,stdio:`pipe`}),a(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:C,stdio:`pipe`}),w(`Git repository initialized`)}catch{w(`Warning: git init failed (git may not be installed)`)}console.log(`
18
+ `),await e(i(C,`.gitignore`),h()),await e(i(C,`README.md`),g(_,S));let{generateAgentDocs:D}=await import(`./agent-docs-eQAOlX05.mjs`).then(e=>e.t);if(await D({outDir:C,name:_,pm:S,template:`fullstack`,only:`all`,force:!0}),o.installDeps){console.log(`\n Installing workspace dependencies with ${S}...\n`);try{t(S,[`install`],{cwd:C})}catch{console.log(`\n Warning: ${S} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-CO21qe_k.mjs`).then(e=>e.n);await e({cwd:i(C,`server`),allowDuplicates:!0,silent:!0})}catch{}if(o.initGit)try{a(`git`,[`init`],{cwd:C,stdio:`pipe`}),a(`git`,[`branch`,`-M`,`main`],{cwd:C,stdio:`pipe`}),a(`git`,[`add`,`-A`],{cwd:C,stdio:`pipe`}),a(`git`,[`commit`,`-m`,`chore: initial commit from kick new (fullstack)`],{cwd:C,stdio:`pipe`}),w(`Git repository initialized`)}catch{w(`Warning: git init failed (git may not be installed)`)}console.log(`
19
19
  Fullstack workspace scaffolded!`),console.log(),w(`Next steps:`),w(` cd ${_}`),o.installDeps||w(` ${S} install`),S===`pnpm`?w(` pnpm dev # runs server (kick dev) + web (vite) together`):(w(` ${S} run dev:server # terminal 1`),w(` ${S} run dev:web # terminal 2`)),w(``),w(`The web app calls the API through @forinda/kickjs-client —`),w(`edit server/src/modules/hello and watch web/src/App.tsx's types follow.`),w(``)}function s(e,t){return`${JSON.stringify({name:`${e}-web`,private:!0,version:`0.0.0`,type:`module`,scripts:{dev:`vite`,build:`tsc --noEmit && vite build`,preview:`vite preview`,typecheck:`tsc --noEmit`},dependencies:{"@forinda/kickjs-client":t,react:`^19.0.0`,"react-dom":`^19.0.0`},devDependencies:{"@types/react":`^19.0.0`,"@types/react-dom":`^19.0.0`,"@vitejs/plugin-react":`^5.0.0`,typescript:`^5.9.0`,vite:`^7.0.0`}},null,2)}\n`}function c(){return`import { defineConfig } from 'vite'
20
20
  import react from '@vitejs/plugin-react'
21
21
 
@@ -187,4 +187,4 @@ export const api = createClient<Api>({ baseUrl: '/api/v1' })
187
187
 
188
188
  Docs: https://kickjs.app/guide/typed-client.html
189
189
  `}export{o as initFullstackProject};
190
- //# sourceMappingURL=fullstack-DEgxqh6m.mjs.map
190
+ //# sourceMappingURL=fullstack-DoSyxXS4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fullstack-DEgxqh6m.mjs","names":[],"sources":["../src/generators/fullstack.ts"],"sourcesContent":["// `kick new --template fullstack` — a pnpm-workspace monorepo:\n//\n// my-app/\n// server/ KickJS API (the standard scaffold, minus its own git/install)\n// web/ Vite + React frontend typed end-to-end via\n// @forinda/kickjs-client + the server's generated KickRoutes.Api\n//\n// The type loop: server controllers use return-value handlers → `kick\n// typegen` (run here once, re-run by `kick dev`) emits\n// server/.kickjs/types/kick__client.d.ts → web tsconfig `types` (ambient)\n// side-effect-imports that file (type-only, erased at runtime) → the web\n// client calls `api.get('/hello')` with the handler's actual response type.\n\nimport { join } from 'node:path'\nimport { execFileSync } from 'node:child_process'\n\nimport { writeFileSafe } from '../utils/fs'\nimport { runCommand } from '../utils/shell'\nimport { initProject, resolveSiblingVersions } from './project'\n\nexport interface InitFullstackOptions {\n name: string\n directory: string\n packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun'\n initGit?: boolean\n installDeps?: boolean\n schemaLib?: 'zod' | 'valibot' | 'yup'\n runtime?: 'express' | 'fastify' | 'h3'\n}\n\nexport async function initFullstackProject(options: InitFullstackOptions): Promise<void> {\n const { name, directory, schemaLib = 'zod', runtime = 'express' } = options\n // `--pm` arrives as a free CLI string — allowlist before it reaches a\n // process invocation (execFileSync takes an argv array, no shell, but a\n // bogus binary name is still a confusing failure).\n const pmValid = (['pnpm', 'npm', 'yarn', 'bun'] as const).includes(\n options.packageManager as never,\n )\n const packageManager = pmValid\n ? (options.packageManager as 'pnpm' | 'npm' | 'yarn' | 'bun')\n : 'pnpm'\n const dir = directory\n const log = (msg: string) => console.log(` ${msg}`)\n if (options.packageManager !== undefined && !pmValid) {\n log(\n `Warning: unknown package manager '${String(options.packageManager)}' — falling back to pnpm.`,\n )\n }\n\n console.log(`\\n Creating fullstack KickJS workspace: ${name}\\n`)\n\n // ── server/ — the standard scaffold, deferred install/git ──────────\n await initProject({\n name: `${name}-server`,\n directory: join(dir, 'server'),\n packageManager,\n template: 'minimal',\n schemaLib,\n runtime,\n // web/ reads the resolved route map from the ambient KickClientApi\n // namespace, which needs the TS 7 compiler API to produce.\n withClientMap: true,\n // Root owns install + git so the lockfile/commit cover the workspace.\n initGit: false,\n installDeps: false,\n // Production single-origin serving. `web/` builds to `web/dist`, and\n // nothing served it before — `pnpm build` produced a frontend the API had\n // no way to hand out, so every deploy needed a hand-wired static host or\n // a second process. The adapter is inert until `../web/dist` exists, so\n // `dev` (Vite serves the client and proxies /api here) is untouched.\n spaClientDir: '../web/dist',\n })\n\n // ── web/ — Vite + React, typed client ──────────────────────────────\n const versions = await resolveSiblingVersions()\n const clientVersion = versions['@forinda/kickjs-client'] ?? '^0.1.0'\n\n await writeFileSafe(join(dir, 'web/package.json'), webPackageJson(name, clientVersion))\n await writeFileSafe(join(dir, 'web/vite.config.ts'), webViteConfig())\n await writeFileSafe(join(dir, 'web/tsconfig.json'), webTsConfig())\n await writeFileSafe(join(dir, 'web/index.html'), webIndexHtml(name))\n await writeFileSafe(join(dir, 'web/src/main.tsx'), webMain())\n await writeFileSafe(join(dir, 'web/src/App.tsx'), webApp())\n await writeFileSafe(join(dir, 'web/src/api.ts'), webApi())\n\n // ── workspace root ──────────────────────────────────────────────────\n await writeFileSafe(\n join(dir, 'package.json'),\n rootPackageJson(name, packageManager, versions['@forinda/kickjs-cli']),\n )\n // Only pnpm reads this file. npm / yarn / bun declare workspaces via the\n // `workspaces` field in the root package.json instead — see rootPackageJson.\n if (packageManager === 'pnpm') {\n // `allowBuilds` is answered here, not left to pnpm. This scaffold installs\n // non-interactively, so pnpm cannot prompt — it writes\n // `'@swc/core': set this to true or false` and then refuses to run ANY\n // script with ERR_PNPM_IGNORED_BUILDS, leaving a fresh project unable to\n // run `pnpm typecheck` or `pnpm dev` until someone edits this file.\n //\n // Both are build tools this template chose: swc compiles the decorators,\n // esbuild is Vite's. Approving their install scripts is the same decision\n // as depending on them.\n await writeFileSafe(\n join(dir, 'pnpm-workspace.yaml'),\n `packages:\\n - server\\n - web\\n\\nallowBuilds:\\n '@swc/core': true\\n esbuild: true\\n`,\n )\n }\n await writeFileSafe(join(dir, '.gitignore'), rootGitignore())\n await writeFileSafe(join(dir, 'README.md'), rootReadme(name, packageManager))\n\n // Workspace-root agent docs (CLAUDE.md + .agents/) flavored for the\n // fullstack layout — the server/ subdir keeps its own generated set.\n const { generateAgentDocs } = await import('./agent-docs')\n await generateAgentDocs({\n outDir: dir,\n name,\n pm: packageManager,\n template: 'fullstack',\n only: 'all',\n force: true,\n })\n\n // ── install (root — covers both workspace packages) ────────────────\n if (options.installDeps) {\n console.log(`\\n Installing workspace dependencies with ${packageManager}...\\n`)\n try {\n // `runCommand`, not bare execFileSync — on Windows every package\n // manager is a `.cmd` shim that execFileSync cannot spawn.\n runCommand(packageManager, ['install'], { cwd: dir })\n } catch {\n console.log(`\\n Warning: ${packageManager} install failed. Run it manually.`)\n }\n }\n\n // ── typegen (server) so web's KickRoutes.Api resolves immediately ──\n try {\n const { runTypegen } = await import('../typegen')\n await runTypegen({ cwd: join(dir, 'server'), allowDuplicates: true, silent: true })\n } catch {\n // Non-fatal — `kick dev` in server/ retries on boot.\n }\n\n // ── git (root) ──────────────────────────────────────────────────────\n if (options.initGit) {\n try {\n execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['branch', '-M', 'main'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['add', '-A'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['commit', '-m', 'chore: initial commit from kick new (fullstack)'], {\n cwd: dir,\n stdio: 'pipe',\n })\n log('Git repository initialized')\n } catch {\n log('Warning: git init failed (git may not be installed)')\n }\n }\n\n console.log('\\n Fullstack workspace scaffolded!')\n console.log()\n log('Next steps:')\n log(` cd ${name}`)\n if (!options.installDeps) log(` ${packageManager} install`)\n if (packageManager === 'pnpm') {\n log(' pnpm dev # runs server (kick dev) + web (vite) together')\n } else {\n log(` ${packageManager} run dev:server # terminal 1`)\n log(` ${packageManager} run dev:web # terminal 2`)\n }\n log('')\n log('The web app calls the API through @forinda/kickjs-client —')\n log(\"edit server/src/modules/hello and watch web/src/App.tsx's types follow.\")\n log('')\n}\n\n// ── web templates ─────────────────────────────────────────────────────\n\nfunction webPackageJson(name: string, clientVersion: string): string {\n return `${JSON.stringify(\n {\n name: `${name}-web`,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts: {\n dev: 'vite',\n build: 'tsc --noEmit && vite build',\n preview: 'vite preview',\n typecheck: 'tsc --noEmit',\n },\n dependencies: {\n '@forinda/kickjs-client': clientVersion,\n react: '^19.0.0',\n 'react-dom': '^19.0.0',\n },\n devDependencies: {\n '@types/react': '^19.0.0',\n '@types/react-dom': '^19.0.0',\n '@vitejs/plugin-react': '^5.0.0',\n typescript: '^5.9.0',\n vite: '^7.0.0',\n },\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction webViteConfig(): string {\n return `import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n // The KickJS server (kick dev) listens on 3000; the client's baseUrl is\n // the relative '/api/v1', so the browser hits Vite and Vite forwards.\n proxy: {\n '/api': 'http://localhost:3000',\n },\n },\n})\n`\n}\n\nexport function webTsConfig(): string {\n return `${JSON.stringify(\n {\n compilerOptions: {\n target: 'ES2022',\n lib: ['ES2022', 'DOM', 'DOM.Iterable'],\n module: 'ESNext',\n moduleResolution: 'bundler',\n jsx: 'react-jsx',\n strict: true,\n skipLibCheck: true,\n noEmit: true,\n isolatedModules: true,\n // The resolved client route map, as an ambient global type package —\n // the same mechanism as \"node\" or \"vitest/globals\". It makes\n // `KickClientApi.Api` available with no import and no bridge file.\n //\n // Note this is a `types` ENTRY, not an `include`: the map is a global\n // type package, not source of this app. It also means the file must\n // exist — `kick new` runs typegen for you, and `kick typegen` in\n // server/ refreshes it. (An `include` entry tolerates the file being\n // absent; a `types` entry reports TS2688, which is the louder and\n // more useful failure for something the app depends on.)\n //\n // No `experimentalDecorators` here: unlike the ambient\n // `KickRoutes.Api` bridge, this map carries no reference to the\n // server's decorated controller sources.\n types: ['../server/.kickjs/types/kick__client'],\n },\n include: ['src'],\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction webIndexHtml(name: string): string {\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`\n}\n\nfunction webMain(): string {\n return `import { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport { App } from './App'\n\ncreateRoot(document.getElementById('root')!).render(\n <StrictMode>\n <App />\n </StrictMode>,\n)\n`\n}\n\nfunction webApp(): string {\n return `import { useEffect, useState } from 'react'\nimport { api } from './api'\n\n// The response types below are INFERRED from the server's handlers —\n// change server/src/modules/hello/hello.service.ts and these types follow on\n// the next \\`kick typegen\\`. Not under \\`kick dev\\`: resolving the client map\n// builds a whole TypeScript program, so it is a build step, not a per-save one.\ntype Greeting = Awaited<ReturnType<typeof fetchGreeting>>\n\nfunction fetchGreeting() {\n return api.get('/hello')\n}\n\nexport function App() {\n const [greeting, setGreeting] = useState<Greeting | null>(null)\n const [health, setHealth] = useState<string>('checking…')\n\n useEffect(() => {\n fetchGreeting().then(setGreeting).catch(console.error)\n api\n .get('/hello/health')\n .then((h) => setHealth(h.status))\n .catch(() => setHealth('down'))\n }, [])\n\n return (\n <main style={{ fontFamily: 'system-ui', maxWidth: 640, margin: '4rem auto', padding: '0 1rem' }}>\n <h1>KickJS fullstack</h1>\n <p>\n <strong>{greeting?.message ?? 'loading…'}</strong>\n </p>\n <p>\n Server said hello at <code>{greeting?.timestamp ?? '…'}</code> — health:{' '}\n <code>{health}</code>\n </p>\n <p style={{ color: '#666' }}>\n This call is typed end to end: <code>api.get('/hello')</code> returns the exact shape\n <code> HelloService.greet()</code> produces. Rename a field on the server and this file\n stops compiling.\n </p>\n </main>\n )\n}\n`\n}\n\nexport function webApi(): string {\n return `import { createClient } from '@forinda/kickjs-client'\n\n// KickClientApi is ambient — the resolved route map from\n// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's \\`types\\`. Every\n// response type is a literal shape, so nothing from the server's source graph\n// enters this program.\n//\n// Keys are module-mount-relative paths; the bootstrap-level '/api/v1' prefix\n// lives here in baseUrl, and the Vite dev proxy forwards it to the KickJS\n// server.\n//\n// Prefer an explicit import? The same file exports the type:\n// import type { Api } from '../../server/.kickjs/types/kick__client'\nexport const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })\n`\n}\n\n// ── root templates ────────────────────────────────────────────────────\n\nfunction rootPackageJson(name: string, pm: string, cliVersion: string): string {\n const scripts: Record<string, string> =\n pm === 'pnpm'\n ? {\n dev: 'pnpm --parallel -r run dev',\n // One origin: the server serves `web/dist` through SpaAdapter.\n start: 'pnpm --filter ./server run start',\n 'dev:server': 'pnpm --filter ./server dev',\n 'dev:web': 'pnpm --filter ./web dev',\n build: 'pnpm -r run build',\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web',\n }\n : {\n // cd-based scripts — the one form npm, yarn (classic AND berry),\n // and bun all run identically; workspace-filter flags differ per\n // manager (--workspace vs `yarn workspace <name>` vs --filter).\n start: `cd server && ${pm} run start`,\n 'dev:server': `cd server && ${pm} run dev`,\n 'dev:web': `cd web && ${pm} run dev`,\n build: `${pm} run build:server && ${pm} run build:web`,\n 'build:server': `cd server && ${pm} run build`,\n 'build:web': `cd web && ${pm} run build`,\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web',\n }\n return `${JSON.stringify(\n {\n name,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts,\n // The CLI is a ROOT dependency so the bare `kick` in the scripts above\n // resolves: package managers put `node_modules/.bin` on PATH for\n // scripts, and the CLI otherwise lives only in `server/node_modules`.\n devDependencies: { '@forinda/kickjs-cli': cliVersion },\n workspaces: ['server', 'web'],\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction rootGitignore(): string {\n return `node_modules/\ndist/\n.env\n*.log\n.DS_Store\n`\n}\n\nfunction rootReadme(name: string, pm: string): string {\n return `# ${name}\n\nFullstack KickJS workspace — typed end to end.\n\n| Package | What |\n| --------- | ----------------------------------------------------------------- |\n| \\`server/\\` | KickJS API (decorators, DI, \\`kick dev\\` with typegen watch) |\n| \\`web/\\` | Vite + React, typed against the API via \\`@forinda/kickjs-client\\` |\n\n## Develop\n\n\\`\\`\\`bash\n${pm} install\n${pm === 'pnpm' ? 'pnpm dev # server (kick dev) + web (vite), in parallel' : `${pm} run dev:server # terminal 1\\n${pm} run dev:web # terminal 2`}\n\\`\\`\\`\n\nServer: http://localhost:3000 · Web: http://localhost:5173 (Vite proxies \\`/api\\`).\n\n## The type loop\n\n1. Server handlers **return** their payloads (\\`return this.service.greet(...)\\`).\n2. \\`kick typegen\\` emits \\`server/.kickjs/types/kick__client.d.ts\\` — the flat\n route map with every response type resolved to a literal shape.\n3. \\`web/tsconfig.json\\` lists that file in \\`types\\`, so \\`KickClientApi\\` is\n ambient — no import, no bridge file.\n4. \\`web/src/api.ts\\`'s \\`createClient<KickClientApi.Api>\\` types every call site.\n\nBecause the map holds resolved types rather than references to controllers,\n\\`web\\` never compiles server source: no \\`experimentalDecorators\\`, no path\naliases into \\`server/src\\`.\n\nRename a field in \\`server/src/modules/hello/hello.service.ts\\` → \\`web/src/App.tsx\\`\nstops compiling. That's the point.\n\n### Keeping the map fresh\n\n\\`server/.kickjs/types/kick__client.d.ts\\` is generated, and \\`web\\` reads it as\nan ambient type package. Two things follow.\n\n**It is not refreshed by \\`kick dev\\`.** Resolving it builds a whole TypeScript\nprogram over the server, which is a build-step cost rather than a per-save one,\nso a renamed response field surfaces on the next \\`kick typegen\\` rather than on\nsave. Everything else in \\`.kickjs/types\\` still updates on save. Add\n\\`kick typegen --check\\` to CI and a stale map fails the build.\n\n**It needs a compiler API.** TypeScript 7 ships none, so \\`server\\` depends on\n\\`@typescript/typescript6\\`. Remove it and typegen skips this one file, saying\nso; \\`web\\` then reports \\`TS2688\\` because the file it lists in \\`types\\` is gone.\n\n### The other way to wire it\n\nA \\`types\\` entry says \"this is a global type package\", which is what the map is,\nand it fails loudly when the file is missing. If you would rather it be quiet\nwhen absent — say, a repo where the map is not always generated — use\n\\`include\\` instead:\n\n\\`\\`\\`json\n{ \"include\": [\"src\", \"../server/.kickjs/types/kick__client.d.ts\"] }\n\\`\\`\\`\n\nThat tolerates the file not existing, at the cost of \\`KickClientApi\\` silently\nnot resolving. Note \\`types\\` replaces TypeScript's automatic \\`@types\\`\ninclusion, so if you add entries there, list the ones you rely on too\n(\\`\"types\": [\"node\", \"../server/.kickjs/types/kick__client\"]\\`).\n\nOr skip the global entirely — the same file exports the type:\n\n\\`\\`\\`ts\nimport type { Api } from '../../server/.kickjs/types/kick__client'\n\nexport const api =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H,CACE,IAAK,6BAEL,MAAO,mCACP,aAAc,6BACd,UAAW,0BACX,MAAO,oBAUP,UAAW,yDACb,EACA,CAIE,MAAO,gBAAgB,EAAG,YAC1B,aAAc,gBAAgB,EAAG,UACjC,UAAW,aAAa,EAAG,UAC3B,MAAO,GAAG,EAAG,uBAAuB,EAAG,gBACvC,eAAgB,gBAAgB,EAAG,YACnC,YAAa,aAAa,EAAG,YAU7B,UAAW,yDACb,EACN,MAAO,GAAG,KAAK,UACb,CACE,OACA,QAAS,GACT,QAAS,QACT,KAAM,SACN,UAIA,gBAAiB,CAAE,sBAAuB,CAAW,EACrD,WAAY,CAAC,SAAU,KAAK,CAC9B,EACA,KACA,CACF,EAAE,GACJ,CAEA,SAAS,GAAwB,CAC/B,MAAO;;;;;CAMT,CAEA,SAAS,EAAW,EAAc,EAAoB,CACpD,MAAO,KAAK,EAAK;;;;;;;;;;;;EAYjB,EAAG;EACH,IAAO,OAAS,oEAAsE,GAAG,EAAG,kCAAkC,EAAG,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DnK"}
1
+ {"version":3,"file":"fullstack-DoSyxXS4.mjs","names":[],"sources":["../src/generators/fullstack.ts"],"sourcesContent":["// `kick new --template fullstack` — a pnpm-workspace monorepo:\n//\n// my-app/\n// server/ KickJS API (the standard scaffold, minus its own git/install)\n// web/ Vite + React frontend typed end-to-end via\n// @forinda/kickjs-client + the server's generated KickRoutes.Api\n//\n// The type loop: server controllers use return-value handlers → `kick\n// typegen` (run here once, re-run by `kick dev`) emits\n// server/.kickjs/types/kick__client.d.ts → web tsconfig `types` (ambient)\n// side-effect-imports that file (type-only, erased at runtime) → the web\n// client calls `api.get('/hello')` with the handler's actual response type.\n\nimport { join } from 'node:path'\nimport { execFileSync } from 'node:child_process'\n\nimport { writeFileSafe } from '../utils/fs'\nimport { runCommand } from '../utils/shell'\nimport { initProject, resolveSiblingVersions } from './project'\n\nexport interface InitFullstackOptions {\n name: string\n directory: string\n packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun'\n initGit?: boolean\n installDeps?: boolean\n schemaLib?: 'zod' | 'valibot' | 'yup'\n runtime?: 'express' | 'fastify' | 'h3'\n}\n\nexport async function initFullstackProject(options: InitFullstackOptions): Promise<void> {\n const { name, directory, schemaLib = 'zod', runtime = 'express' } = options\n // `--pm` arrives as a free CLI string — allowlist before it reaches a\n // process invocation (execFileSync takes an argv array, no shell, but a\n // bogus binary name is still a confusing failure).\n const pmValid = (['pnpm', 'npm', 'yarn', 'bun'] as const).includes(\n options.packageManager as never,\n )\n const packageManager = pmValid\n ? (options.packageManager as 'pnpm' | 'npm' | 'yarn' | 'bun')\n : 'pnpm'\n const dir = directory\n const log = (msg: string) => console.log(` ${msg}`)\n if (options.packageManager !== undefined && !pmValid) {\n log(\n `Warning: unknown package manager '${String(options.packageManager)}' — falling back to pnpm.`,\n )\n }\n\n console.log(`\\n Creating fullstack KickJS workspace: ${name}\\n`)\n\n // ── server/ — the standard scaffold, deferred install/git ──────────\n await initProject({\n name: `${name}-server`,\n directory: join(dir, 'server'),\n packageManager,\n template: 'minimal',\n schemaLib,\n runtime,\n // web/ reads the resolved route map from the ambient KickClientApi\n // namespace, which needs the TS 7 compiler API to produce.\n withClientMap: true,\n // Root owns install + git so the lockfile/commit cover the workspace.\n initGit: false,\n installDeps: false,\n // Production single-origin serving. `web/` builds to `web/dist`, and\n // nothing served it before — `pnpm build` produced a frontend the API had\n // no way to hand out, so every deploy needed a hand-wired static host or\n // a second process. The adapter is inert until `../web/dist` exists, so\n // `dev` (Vite serves the client and proxies /api here) is untouched.\n spaClientDir: '../web/dist',\n })\n\n // ── web/ — Vite + React, typed client ──────────────────────────────\n const versions = await resolveSiblingVersions()\n const clientVersion = versions['@forinda/kickjs-client'] ?? '^0.1.0'\n\n await writeFileSafe(join(dir, 'web/package.json'), webPackageJson(name, clientVersion))\n await writeFileSafe(join(dir, 'web/vite.config.ts'), webViteConfig())\n await writeFileSafe(join(dir, 'web/tsconfig.json'), webTsConfig())\n await writeFileSafe(join(dir, 'web/index.html'), webIndexHtml(name))\n await writeFileSafe(join(dir, 'web/src/main.tsx'), webMain())\n await writeFileSafe(join(dir, 'web/src/App.tsx'), webApp())\n await writeFileSafe(join(dir, 'web/src/api.ts'), webApi())\n\n // ── workspace root ──────────────────────────────────────────────────\n await writeFileSafe(\n join(dir, 'package.json'),\n rootPackageJson(name, packageManager, versions['@forinda/kickjs-cli']),\n )\n // Only pnpm reads this file. npm / yarn / bun declare workspaces via the\n // `workspaces` field in the root package.json instead — see rootPackageJson.\n if (packageManager === 'pnpm') {\n // `allowBuilds` is answered here, not left to pnpm. This scaffold installs\n // non-interactively, so pnpm cannot prompt — it writes\n // `'@swc/core': set this to true or false` and then refuses to run ANY\n // script with ERR_PNPM_IGNORED_BUILDS, leaving a fresh project unable to\n // run `pnpm typecheck` or `pnpm dev` until someone edits this file.\n //\n // Both are build tools this template chose: swc compiles the decorators,\n // esbuild is Vite's. Approving their install scripts is the same decision\n // as depending on them.\n await writeFileSafe(\n join(dir, 'pnpm-workspace.yaml'),\n `packages:\\n - server\\n - web\\n\\nallowBuilds:\\n '@swc/core': true\\n esbuild: true\\n`,\n )\n }\n await writeFileSafe(join(dir, '.gitignore'), rootGitignore())\n await writeFileSafe(join(dir, 'README.md'), rootReadme(name, packageManager))\n\n // Workspace-root agent docs (CLAUDE.md + .agents/) flavored for the\n // fullstack layout — the server/ subdir keeps its own generated set.\n const { generateAgentDocs } = await import('./agent-docs')\n await generateAgentDocs({\n outDir: dir,\n name,\n pm: packageManager,\n template: 'fullstack',\n only: 'all',\n force: true,\n })\n\n // ── install (root — covers both workspace packages) ────────────────\n if (options.installDeps) {\n console.log(`\\n Installing workspace dependencies with ${packageManager}...\\n`)\n try {\n // `runCommand`, not bare execFileSync — on Windows every package\n // manager is a `.cmd` shim that execFileSync cannot spawn.\n runCommand(packageManager, ['install'], { cwd: dir })\n } catch {\n console.log(`\\n Warning: ${packageManager} install failed. Run it manually.`)\n }\n }\n\n // ── typegen (server) so web's KickRoutes.Api resolves immediately ──\n try {\n const { runTypegen } = await import('../typegen')\n await runTypegen({ cwd: join(dir, 'server'), allowDuplicates: true, silent: true })\n } catch {\n // Non-fatal — `kick dev` in server/ retries on boot.\n }\n\n // ── git (root) ──────────────────────────────────────────────────────\n if (options.initGit) {\n try {\n execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['branch', '-M', 'main'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['add', '-A'], { cwd: dir, stdio: 'pipe' })\n execFileSync('git', ['commit', '-m', 'chore: initial commit from kick new (fullstack)'], {\n cwd: dir,\n stdio: 'pipe',\n })\n log('Git repository initialized')\n } catch {\n log('Warning: git init failed (git may not be installed)')\n }\n }\n\n console.log('\\n Fullstack workspace scaffolded!')\n console.log()\n log('Next steps:')\n log(` cd ${name}`)\n if (!options.installDeps) log(` ${packageManager} install`)\n if (packageManager === 'pnpm') {\n log(' pnpm dev # runs server (kick dev) + web (vite) together')\n } else {\n log(` ${packageManager} run dev:server # terminal 1`)\n log(` ${packageManager} run dev:web # terminal 2`)\n }\n log('')\n log('The web app calls the API through @forinda/kickjs-client —')\n log(\"edit server/src/modules/hello and watch web/src/App.tsx's types follow.\")\n log('')\n}\n\n// ── web templates ─────────────────────────────────────────────────────\n\nfunction webPackageJson(name: string, clientVersion: string): string {\n return `${JSON.stringify(\n {\n name: `${name}-web`,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts: {\n dev: 'vite',\n build: 'tsc --noEmit && vite build',\n preview: 'vite preview',\n typecheck: 'tsc --noEmit',\n },\n dependencies: {\n '@forinda/kickjs-client': clientVersion,\n react: '^19.0.0',\n 'react-dom': '^19.0.0',\n },\n devDependencies: {\n '@types/react': '^19.0.0',\n '@types/react-dom': '^19.0.0',\n '@vitejs/plugin-react': '^5.0.0',\n typescript: '^5.9.0',\n vite: '^7.0.0',\n },\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction webViteConfig(): string {\n return `import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n // The KickJS server (kick dev) listens on 3000; the client's baseUrl is\n // the relative '/api/v1', so the browser hits Vite and Vite forwards.\n proxy: {\n '/api': 'http://localhost:3000',\n },\n },\n})\n`\n}\n\nexport function webTsConfig(): string {\n return `${JSON.stringify(\n {\n compilerOptions: {\n target: 'ES2022',\n lib: ['ES2022', 'DOM', 'DOM.Iterable'],\n module: 'ESNext',\n moduleResolution: 'bundler',\n jsx: 'react-jsx',\n strict: true,\n skipLibCheck: true,\n noEmit: true,\n isolatedModules: true,\n // The resolved client route map, as an ambient global type package —\n // the same mechanism as \"node\" or \"vitest/globals\". It makes\n // `KickClientApi.Api` available with no import and no bridge file.\n //\n // Note this is a `types` ENTRY, not an `include`: the map is a global\n // type package, not source of this app. It also means the file must\n // exist — `kick new` runs typegen for you, and `kick typegen` in\n // server/ refreshes it. (An `include` entry tolerates the file being\n // absent; a `types` entry reports TS2688, which is the louder and\n // more useful failure for something the app depends on.)\n //\n // No `experimentalDecorators` here: unlike the ambient\n // `KickRoutes.Api` bridge, this map carries no reference to the\n // server's decorated controller sources.\n types: ['../server/.kickjs/types/kick__client'],\n },\n include: ['src'],\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction webIndexHtml(name: string): string {\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`\n}\n\nfunction webMain(): string {\n return `import { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport { App } from './App'\n\ncreateRoot(document.getElementById('root')!).render(\n <StrictMode>\n <App />\n </StrictMode>,\n)\n`\n}\n\nfunction webApp(): string {\n return `import { useEffect, useState } from 'react'\nimport { api } from './api'\n\n// The response types below are INFERRED from the server's handlers —\n// change server/src/modules/hello/hello.service.ts and these types follow on\n// the next \\`kick typegen\\`. Not under \\`kick dev\\`: resolving the client map\n// builds a whole TypeScript program, so it is a build step, not a per-save one.\ntype Greeting = Awaited<ReturnType<typeof fetchGreeting>>\n\nfunction fetchGreeting() {\n return api.get('/hello')\n}\n\nexport function App() {\n const [greeting, setGreeting] = useState<Greeting | null>(null)\n const [health, setHealth] = useState<string>('checking…')\n\n useEffect(() => {\n fetchGreeting().then(setGreeting).catch(console.error)\n api\n .get('/hello/health')\n .then((h) => setHealth(h.status))\n .catch(() => setHealth('down'))\n }, [])\n\n return (\n <main style={{ fontFamily: 'system-ui', maxWidth: 640, margin: '4rem auto', padding: '0 1rem' }}>\n <h1>KickJS fullstack</h1>\n <p>\n <strong>{greeting?.message ?? 'loading…'}</strong>\n </p>\n <p>\n Server said hello at <code>{greeting?.timestamp ?? '…'}</code> — health:{' '}\n <code>{health}</code>\n </p>\n <p style={{ color: '#666' }}>\n This call is typed end to end: <code>api.get('/hello')</code> returns the exact shape\n <code> HelloService.greet()</code> produces. Rename a field on the server and this file\n stops compiling.\n </p>\n </main>\n )\n}\n`\n}\n\nexport function webApi(): string {\n return `import { createClient } from '@forinda/kickjs-client'\n\n// KickClientApi is ambient — the resolved route map from\n// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's \\`types\\`. Every\n// response type is a literal shape, so nothing from the server's source graph\n// enters this program.\n//\n// Keys are module-mount-relative paths; the bootstrap-level '/api/v1' prefix\n// lives here in baseUrl, and the Vite dev proxy forwards it to the KickJS\n// server.\n//\n// Prefer an explicit import? The same file exports the type:\n// import type { Api } from '../../server/.kickjs/types/kick__client'\nexport const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })\n`\n}\n\n// ── root templates ────────────────────────────────────────────────────\n\nfunction rootPackageJson(name: string, pm: string, cliVersion: string): string {\n const scripts: Record<string, string> =\n pm === 'pnpm'\n ? {\n dev: 'pnpm --parallel -r run dev',\n // One origin: the server serves `web/dist` through SpaAdapter.\n start: 'pnpm --filter ./server run start',\n 'dev:server': 'pnpm --filter ./server dev',\n 'dev:web': 'pnpm --filter ./web dev',\n build: 'pnpm -r run build',\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web',\n }\n : {\n // cd-based scripts — the one form npm, yarn (classic AND berry),\n // and bun all run identically; workspace-filter flags differ per\n // manager (--workspace vs `yarn workspace <name>` vs --filter).\n start: `cd server && ${pm} run start`,\n 'dev:server': `cd server && ${pm} run dev`,\n 'dev:web': `cd web && ${pm} run dev`,\n build: `${pm} run build:server && ${pm} run build:web`,\n 'build:server': `cd server && ${pm} run build`,\n 'build:web': `cd web && ${pm} run build`,\n // No `npx`: the binary is `kick` but the package is\n // `@forinda/kickjs-cli`, so npx cannot map one to the other and\n // falls back to the REGISTRY — where `kick` is an unrelated\n // AngularJS scaffolder. It runs, prints its own help, and exits 0,\n // so this script would pass without type-checking anything.\n //\n // Every package manager puts `node_modules/.bin` on PATH for\n // scripts, so the bare name resolves locally, and a missing install\n // fails loudly instead of fetching a stranger.\n typecheck: 'kick typecheck --cwd server && kick typecheck --cwd web',\n }\n return `${JSON.stringify(\n {\n name,\n private: true,\n version: '0.0.0',\n type: 'module',\n scripts,\n // The CLI is a ROOT dependency so the bare `kick` in the scripts above\n // resolves: package managers put `node_modules/.bin` on PATH for\n // scripts, and the CLI otherwise lives only in `server/node_modules`.\n devDependencies: { '@forinda/kickjs-cli': cliVersion },\n workspaces: ['server', 'web'],\n },\n null,\n 2,\n )}\\n`\n}\n\nfunction rootGitignore(): string {\n return `node_modules/\ndist/\n.env\n*.log\n.DS_Store\n`\n}\n\nfunction rootReadme(name: string, pm: string): string {\n return `# ${name}\n\nFullstack KickJS workspace — typed end to end.\n\n| Package | What |\n| --------- | ----------------------------------------------------------------- |\n| \\`server/\\` | KickJS API (decorators, DI, \\`kick dev\\` with typegen watch) |\n| \\`web/\\` | Vite + React, typed against the API via \\`@forinda/kickjs-client\\` |\n\n## Develop\n\n\\`\\`\\`bash\n${pm} install\n${pm === 'pnpm' ? 'pnpm dev # server (kick dev) + web (vite), in parallel' : `${pm} run dev:server # terminal 1\\n${pm} run dev:web # terminal 2`}\n\\`\\`\\`\n\nServer: http://localhost:3000 · Web: http://localhost:5173 (Vite proxies \\`/api\\`).\n\n## The type loop\n\n1. Server handlers **return** their payloads (\\`return this.service.greet(...)\\`).\n2. \\`kick typegen\\` emits \\`server/.kickjs/types/kick__client.d.ts\\` — the flat\n route map with every response type resolved to a literal shape.\n3. \\`web/tsconfig.json\\` lists that file in \\`types\\`, so \\`KickClientApi\\` is\n ambient — no import, no bridge file.\n4. \\`web/src/api.ts\\`'s \\`createClient<KickClientApi.Api>\\` types every call site.\n\nBecause the map holds resolved types rather than references to controllers,\n\\`web\\` never compiles server source: no \\`experimentalDecorators\\`, no path\naliases into \\`server/src\\`.\n\nRename a field in \\`server/src/modules/hello/hello.service.ts\\` → \\`web/src/App.tsx\\`\nstops compiling. That's the point.\n\n### Keeping the map fresh\n\n\\`server/.kickjs/types/kick__client.d.ts\\` is generated, and \\`web\\` reads it as\nan ambient type package. Two things follow.\n\n**It is not refreshed by \\`kick dev\\`.** Resolving it builds a whole TypeScript\nprogram over the server, which is a build-step cost rather than a per-save one,\nso a renamed response field surfaces on the next \\`kick typegen\\` rather than on\nsave. Everything else in \\`.kickjs/types\\` still updates on save. Add\n\\`kick typegen --check\\` to CI and a stale map fails the build.\n\n**It needs a compiler API.** TypeScript 7 ships none, so \\`server\\` depends on\n\\`@typescript/typescript6\\`. Remove it and typegen skips this one file, saying\nso; \\`web\\` then reports \\`TS2688\\` because the file it lists in \\`types\\` is gone.\n\n### The other way to wire it\n\nA \\`types\\` entry says \"this is a global type package\", which is what the map is,\nand it fails loudly when the file is missing. If you would rather it be quiet\nwhen absent — say, a repo where the map is not always generated — use\n\\`include\\` instead:\n\n\\`\\`\\`json\n{ \"include\": [\"src\", \"../server/.kickjs/types/kick__client.d.ts\"] }\n\\`\\`\\`\n\nThat tolerates the file not existing, at the cost of \\`KickClientApi\\` silently\nnot resolving. Note \\`types\\` replaces TypeScript's automatic \\`@types\\`\ninclusion, so if you add entries there, list the ones you rely on too\n(\\`\"types\": [\"node\", \"../server/.kickjs/types/kick__client\"]\\`).\n\nOr skip the global entirely — the same file exports the type:\n\n\\`\\`\\`ts\nimport type { Api } from '../../server/.kickjs/types/kick__client'\n\nexport const api = createClient<Api>({ baseUrl: '/api/v1' })\n\\`\\`\\`\n\nDocs: https://kickjs.app/guide/typed-client.html\n`\n}\n"],"mappings":";;;;;;;;;;uLA8BA,eAAsB,EAAqB,EAA8C,CACvF,GAAM,CAAE,OAAM,YAAW,YAAY,MAAO,UAAU,WAAc,EAI9D,EAAW,CAAC,OAAQ,MAAO,OAAQ,KAAK,CAAC,CAAW,SACxD,EAAQ,cACV,EACM,EAAiB,EAClB,EAAQ,eACT,OACE,EAAM,EACN,EAAO,GAAgB,QAAQ,IAAI,KAAK,GAAK,EAC/C,EAAQ,iBAAmB,IAAA,IAAa,CAAC,GAC3C,EACE,qCAAqC,OAAO,EAAQ,cAAc,EAAE,0BACtE,EAGF,QAAQ,IAAI,4CAA4C,EAAK,GAAG,EAGhE,MAAM,EAAY,CAChB,KAAM,GAAG,EAAK,SACd,UAAW,EAAK,EAAK,QAAQ,EAC7B,iBACA,SAAU,UACV,YACA,UAGA,cAAe,GAEf,QAAS,GACT,YAAa,GAMb,aAAc,aAChB,CAAC,EAGD,IAAM,EAAW,MAAM,EAAuB,EACxC,EAAgB,EAAS,2BAA6B,SAE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A8DnK"}
package/dist/index.d.mts CHANGED
@@ -1070,6 +1070,26 @@ interface DiscoveredPluginOrAdapter {
1070
1070
  * plugin, which emits the `ContextKeys` augmentation so `dependsOn`
1071
1071
  * typo-checking is automatic and complete.
1072
1072
  */
1073
+ /**
1074
+ * A `defineRouteFlag('name')` call site.
1075
+ *
1076
+ * Cheaper to discover than a context key: the name is a positional string
1077
+ * literal, there is no `dependsOn` graph to resolve and no per-route narrowing
1078
+ * to compute — a flag is just a name, so scanning is one AST branch and the
1079
+ * emitted registry is a flat map.
1080
+ */
1081
+ interface DiscoveredRouteFlag {
1082
+ /** The literal name — `'auth.public'`. */
1083
+ name: string;
1084
+ /**
1085
+ * Source text of an explicit value type, when the call site writes one:
1086
+ * `defineRouteFlag<{ rpm: number }>('rate.limit')` → `'{ rpm: number }'`.
1087
+ * `null` for a bare flag, which is emitted as `true`.
1088
+ */
1089
+ valueType: string | null;
1090
+ filePath: string;
1091
+ relativePath: string;
1092
+ }
1073
1093
  interface DiscoveredContextKey {
1074
1094
  /** The literal `key:` value the contributor writes. */
1075
1095
  key: string;
@@ -1141,6 +1161,8 @@ interface ScanResult {
1141
1161
  augmentations: DiscoveredAugmentation[];
1142
1162
  /** Context keys from `define(Http)ContextDecorator({ key })` calls */
1143
1163
  contextKeys: DiscoveredContextKey[];
1164
+ /** Route flags from `defineRouteFlag('name')` calls. */
1165
+ routeFlags: DiscoveredRouteFlag[];
1144
1166
  /**
1145
1167
  * Decorated classes that sit inside a module directory but aren't
1146
1168
  * picked up by any of the module's `import.meta.glob(...)` patterns.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/commands/add.ts","../src/commands/doctor.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/templates/types.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/project.ts","../src/utils/project-root.ts","../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/typegen/token-conventions.ts","../src/typegen/index.ts","../src/typegen/run-plugins.ts","../src/asset-manager/build.ts","../src/typegen/dev-watcher.ts","../src/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;KAoNY;;;;;;;;;;;;;;;;;;;UCzLK;EACf;EACA;;;;;;;EAOA;;;;;;EAMA,SAAS;;UAGM;;EAEf;EACA;;EAEA;;EAEA;;KAGU,eACV,KAAK,kBACF,eAAe,wBAAwB,QAAQ,eAAe;;;;;;UAOlD;;EAEf,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCK,sBAAsB,KAAK,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;iBA0B7C,kBAAkB,OAAO,cAAc;;;;KChG3C,uBAAuB,uBAAoB;;KAG3C,gBAAgB,gBAAa;;;;UC7BxB;;EAEf;;EAEA;;;;;;;;;EASA;;EAEA;;;KAIU;;KAGA;;;;;;;;;;;;;KAgBA;;UA0BK;EACf;;;KAIU,iBAAiB,oBAAkB;;;;;;;;;;;KAYnC;;;;;;UAOK;;;;;;;EAOf;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;;;;;;;;;;EAsBA;;;;;;;;;;;;;;;;;;;;;;;;UAyBe;;;;;EAKf;;;;;EAKA;;EAEA;;;;;;;EAOA;;;;;;;EAOA,0BAA0B;;;UAIX;;;;;EAKf;;;;;EAKA;;;;;;;;;;;;;EAaA,kBAAkB;;;;;;;;;;EAUlB;;;;;;;;;;;;;;;;;;EAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,mBAAmB;;;UAIJ;;EAEf;;;;;;;;EAQA;;;UAIe;;EAEf;;;;;;;;;;;;;;;;;;;;;;EAsBA,OAAO;;EAEP;;;;;;EAMA;;;;;;;;;;;;;;;;;;;;EAoBA;;;UAIe;;;;;;;;EAQf,UAAU;;;;;;;;;;;;EAYV,UAAU;;;;;;;;;;;;;;;;EA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AAM;;;;;;;UAQS;EACf,YAAY;;EAEZ;;;;;EAKA,QAAQ;IAAQ;IAAgB;;;;;;;;;;;iBCblB,sBAAsB;EACpC;EACA;EACA,QAAQ;EACR;EACA;;;;;;;EAOA;EACA;IACE;;;;iBC5BY,aAAa;;iBAOb,YAAY;;iBAMZ,YAAY;;;;;;iBAYZ,UAAU"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/commands/add.ts","../src/commands/doctor.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/templates/types.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/project.ts","../src/utils/project-root.ts","../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/typegen/token-conventions.ts","../src/typegen/index.ts","../src/typegen/run-plugins.ts","../src/asset-manager/build.ts","../src/typegen/dev-watcher.ts","../src/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;KA2OY;;;;;;;;;;;;;;;;;;;UChNK;EACf;EACA;;;;;;;EAOA;;;;;;EAMA,SAAS;;UAGM;;EAEf;EACA;;EAEA;;EAEA;;KAGU,eACV,KAAK,kBACF,eAAe,wBAAwB,QAAQ,eAAe;;;;;;UAOlD;;EAEf,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCK,sBAAsB,KAAK,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;iBA0B7C,kBAAkB,OAAO,cAAc;;;;KChG3C,uBAAuB,uBAAoB;;KAG3C,gBAAgB,gBAAa;;;;UC7BxB;;EAEf;;EAEA;;;;;;;;;EASA;;EAEA;;;KAIU;;KAGA;;;;;;;;;;;;;KAgBA;;UA0BK;EACf;;;KAIU,iBAAiB,oBAAkB;;;;;;;;;;;KAYnC;;;;;;UAOK;;;;;;;EAOf;;;;;;;EAOA;;;;;;EAMA;;;;;;;;;;;;;;;;;;;;;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B,MAAM,8BACL,QAAQ;;;;cCpBE;;UAGI;EACf,gBAAgB;;;;;;;;;;EAUhB,SAAS;;UAGM;;EAEf;;;;;;;EAOA;;EAEA;;;UAIe;EACf;EACA;EACA;;;;;;EAMA;;;UAIe;EACf;EACA,SAAS;;EAET,UAAU;;;;;;;;;;;;;iBAcU,YACpB,QAAQ,mBACR,MAAM,qBACL,QAAQ;;;;;;;;cCrDE;KAED;;UAGK;EACf,mBAAmB;EACnB,6BAA6B;EAC7B,8BAA8B;EAC9B,oBAAoB;;UAGL;EACf;;EAEA,QAAQ;;;;;EAKR,cAAc;;;;;;EAMd;;EAEA;;EAEA,WAAW;;UAGI;;EAEf,iBAAiB,OAAO,mBAAmB;;;;;EAK3C;;;;;;EAMA;;EAEA;;iBAGc,wBAAwB,MAAM,2BAA2B;;;;;;;;UC3ExD;EACf;EACA,MAAM;;;;;;;UAQS;EACf,YAAY;;EAEZ;;;;;EAKA,QAAQ;IAAQ;IAAgB;;;;;;;;;;;iBCblB,sBAAsB;EACpC;EACA;EACA,QAAQ;EACR;EACA;;;;;;;EAOA;EACA;IACE;;;;iBC5BY,aAAa;;iBAOb,YAAY;;iBAMZ,YAAY;;;;;;iBAYZ,UAAU"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.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{A as e,M as t,N as n,P as r,S as i,_ as a,c as o,d as s,g as c,h as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g,y as _}from"./doctor-DKu4x3uO.mjs";import{t as v}from"./project-D8Bjdxtm.mjs";import{o as y,r as b}from"./config-1AktuESd.mjs";import{t as x}from"./project-root-CJm3KGjG.mjs";import{n as S,t as C}from"./types-DlARm-HF.mjs";export{C as KickPluginConflictError,o as TYPEGEN_OWNER_KEY,p as buildGeneratorContext,u as createTypegenDevWatcher,S as defineCliPlugin,b as defineConfig,g as defineDoctorCheck,f as defineDoctorExtension,h as defineGenerator,s as defineTypegen,x as findProjectRoot,_ as generateAdapter,d as generateController,m as generateDto,c as generateGuard,a as generateMiddleware,i as generateModule,l as generateService,v as initProject,y as loadKickConfig,e as pluralize,t as toCamelCase,n as toKebabCase,r as toPascalCase};
11
+ import{A as e,M as t,N as n,P as r,S as i,_ as a,c as o,d as s,g as c,h as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g,y as _}from"./doctor-CXyjM165.mjs";import{t as v}from"./project-llLxBp1a.mjs";import{o as y,r as b}from"./config-D9cTQyqK.mjs";import{t as x}from"./project-root-yp0AaVDs.mjs";import{n as S,t as C}from"./types-B1zn_O0F.mjs";export{C as KickPluginConflictError,o as TYPEGEN_OWNER_KEY,p as buildGeneratorContext,u as createTypegenDevWatcher,S as defineCliPlugin,b as defineConfig,g as defineDoctorCheck,f as defineDoctorExtension,h as defineGenerator,s as defineTypegen,x as findProjectRoot,_ as generateAdapter,d as generateController,m as generateDto,c as generateGuard,a as generateMiddleware,i as generateModule,l as generateService,v as initProject,y as loadKickConfig,e as pluralize,t as toCamelCase,n as toKebabCase,r as toPascalCase};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.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-CSIJ2o5J.mjs";import{KickPluginConflictError as t,defineCliPlugin as n}from"@forinda/kickjs-cli-kit";function r(e,n=[]){let r=new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r;if(n)r={generators:d,...n};else{let{findProjectRoot:e}=await import(`./project-root-CTbG-IYo.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:d}}for(let n of e)n.register&&await n.register(t,r)}}}var i=e({mergeCliPlugins:()=>r});export{r as n,n as r,i as t};
11
+ import{t as e}from"./rolldown-runtime-4o6m7Xdi.mjs";import{KickPluginConflictError as t,defineCliPlugin as n}from"@forinda/kickjs-cli-kit";function r(e,n=[]){let r=new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r;if(n)r={generators:d,...n};else{let{findProjectRoot:e}=await import(`./project-root-DX8zIouv.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:d}}for(let n of e)n.register&&await n.register(t,r)}}}var i=e({mergeCliPlugins:()=>r});export{r as n,n as r,i as t};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.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-CSIJ2o5J.mjs";import{t}from"./types-DlARm-HF.mjs";function n(e,n=[]){let r=new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r;if(n)r={generators:d,...n};else{let{findProjectRoot:e}=await import(`./project-root-CJm3KGjG.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:d}}for(let n of e)n.register&&await n.register(t,r)}}}var r=e({mergeCliPlugins:()=>n});export{n,r as t};
12
- //# sourceMappingURL=plugin-C5HNkLuq.mjs.map
11
+ import{t as e}from"./rolldown-runtime-4o6m7Xdi.mjs";import{t}from"./types-B1zn_O0F.mjs";function n(e,n=[]){let r=new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r;if(n)r={generators:d,...n};else{let{findProjectRoot:e}=await import(`./project-root-yp0AaVDs.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:d}}for(let n of e)n.register&&await n.register(t,r)}}}var r=e({mergeCliPlugins:()=>n});export{n,r as t};
12
+ //# sourceMappingURL=plugin-BpYt41Nj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-C5HNkLuq.mjs","names":[],"sources":["../src/plugin/merge.ts","../src/plugin/index.ts"],"sourcesContent":["// Plugin → unified registry merge.\n//\n// Resolution rules (per the v1 spec + dogfood pivot):\n// - duplicate plugin `name` across the input array → conflict error.\n// Catches the double-install case (built-in shipped twice, or\n// adopter requiring the same plugin twice).\n// - plugin commands appear first in the merged list, then adopter\n// commands; adopter `commands` of the same name override the\n// plugin entry (filter pass).\n// - duplicate command name across two plugins → conflict error\n// listing both plugin names. Adopter overriding a plugin is\n// allowed and not an error.\n// - duplicate typegen id across two plugins → same error. Typegens\n// have no adopter override path; only plugins contribute them.\n// - register() functions are collected in input order; the caller\n// invokes each one against the same Command program. They have no\n// id-level conflict surface — owners are responsible for picking\n// non-colliding command names inside their own register().\n// - plugin order = array order. No implicit precedence rules.\n\nimport type { Command } from 'commander'\n\nimport type { KickCommandDefinition } from '../config'\nimport type { TypegenPlugin } from '../typegen/plugin'\nimport type { GeneratorSpec } from '../generator-extension/define'\nimport type { DiscoveredGenerator } from '../generator-extension/discover'\nimport { KickPluginConflictError, type KickCliPlugin, type KickCliPluginContext } from './types'\n\nexport interface MergedPlugins {\n commands: KickCommandDefinition[]\n typegens: TypegenPlugin[]\n /** DiscoveredGenerator shape so this list slots into the existing\n * dispatch path next to package.json-discovered entries. `source`\n * carries the plugin name for error attribution. */\n generators: DiscoveredGenerator[]\n /**\n * Apply every plugin's register() in input order. ctx is optional so\n * tests + lightweight callers can invoke `register(program)` without\n * constructing a full context; it falls back to cwd=process.cwd(),\n * config=null, log=no-op.\n */\n register: (program: Command, ctx?: KickCliPluginContext) => Promise<void>\n}\n\nexport function mergeCliPlugins(\n plugins: readonly KickCliPlugin[],\n adopterCommands: readonly KickCommandDefinition[] = [],\n): MergedPlugins {\n // Plugin-name dedup — catches double-install.\n const seenPluginNames = new Map<string, number>()\n for (const p of plugins) {\n const count = (seenPluginNames.get(p.name) ?? 0) + 1\n seenPluginNames.set(p.name, count)\n if (count === 2) {\n throw new KickPluginConflictError('plugin', p.name, [p.name, p.name])\n }\n }\n\n const commandOwners = new Map<string, string>()\n const pluginCommands: KickCommandDefinition[] = []\n for (const p of plugins) {\n for (const cmd of p.commands ?? []) {\n const prior = commandOwners.get(cmd.name)\n if (prior) {\n throw new KickPluginConflictError('command', cmd.name, [prior, p.name])\n }\n commandOwners.set(cmd.name, p.name)\n pluginCommands.push(cmd)\n }\n }\n\n const adopterNames = new Set(adopterCommands.map((c) => c.name))\n const filteredPlugin = pluginCommands.filter((c) => !adopterNames.has(c.name))\n const commands = [...filteredPlugin, ...adopterCommands]\n\n const typegenOwners = new Map<string, string>()\n const typegens: TypegenPlugin[] = []\n for (const p of plugins) {\n for (const tg of p.typegens ?? []) {\n const prior = typegenOwners.get(tg.id)\n if (prior) {\n throw new KickPluginConflictError('typegen', tg.id, [prior, p.name])\n }\n typegenOwners.set(tg.id, p.name)\n typegens.push(tg)\n }\n }\n\n const generatorOwners = new Map<string, string>()\n const generators: DiscoveredGenerator[] = []\n for (const p of plugins) {\n for (const spec of p.generators ?? []) {\n const prior = generatorOwners.get(spec.name)\n if (prior) {\n throw new KickPluginConflictError('generator', spec.name, [prior, p.name])\n }\n generatorOwners.set(spec.name, p.name)\n generators.push({ source: p.name, spec: spec satisfies GeneratorSpec })\n }\n }\n\n /**\n * Apply every plugin's `register()` callback in input order against the\n * given Commander program. Each callback receives a {@link KickCliPluginContext}:\n * caller-supplied ctx wins (test fixtures can inject a different\n * workspace boundary); otherwise a default ctx is built with\n * `findProjectRoot(process.cwd())` as the project root, `cwd` matching\n * `process.cwd()`, null config, no-op log, and the merged generator set\n * threaded through so the `kick/generate` built-in can surface each as\n * a Commander subcommand. The dynamic import of `findProjectRoot` keeps\n * the caller-supplied fast path zero-cost.\n */\n const register = async (program: Command, ctx?: KickCliPluginContext): Promise<void> => {\n let resolved: KickCliPluginContext\n if (ctx) {\n resolved = { generators, ...ctx }\n } else {\n const { findProjectRoot } = await import('../utils/project-root')\n const cwd = process.cwd()\n resolved = {\n cwd,\n projectRoot: findProjectRoot(cwd),\n config: null,\n log: () => {},\n generators,\n }\n }\n for (const p of plugins) {\n if (p.register) await p.register(program, resolved)\n }\n }\n\n return { commands, typegens, generators, register }\n}\n","// Barrel intentionally omits `./builtins` — that module top-level-imports\n// every register*Command, which pulls heavy modules (project scaffolders,\n// fs reads at import time) into the graph. Importers that need the\n// builtin list go through `./plugin/builtins` directly; tests + adopter\n// plugins consuming only the contract types import from here.\n\nexport type { KickCliPlugin } from './types'\nexport { defineCliPlugin, KickPluginConflictError } from './types'\nexport { mergeCliPlugins, type MergedPlugins } from './merge'\n"],"mappings":";;;;;;;;;;wFA4CA,SAAgB,EACd,EACA,EAAoD,CAAC,EACtC,CAEf,IAAM,EAAkB,IAAI,IAC5B,IAAK,IAAM,KAAK,EAAS,CACvB,IAAM,GAAS,EAAgB,IAA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AK,KAAM,EAAE,IAAI,EACrC,EAAW,KAAK,CAAE,OAAQ,EAAE,KAAY,MAA6B,CAAC,CACxE,CAkCF,MAAO,CAAE,WAAU,WAAU,aAAY,eApBjB,EAAkB,IAA8C,CACtF,IAAI,EACJ,GAAI,EACF,EAAW,CAAE,aAAY,GAAG,CAAI,MAC3B,CACL,GAAM,CAAE,mBAAoB,MAAM,OAAO,8BAAwB,CAAA,KAAA,GAAA,EAAA,CAAA,EAC3D,EAAM,QAAQ,IAAI,EACxB,EAAW,CACT,MACA,YAAa,EAAgB,CAAG,EAChC,OAAQ,KACR,QAAW,CAAC,EACZ,YACF,CACF,CACA,IAAK,IAAM,KAAK,EACV,EAAE,UAAU,MAAM,EAAE,SAAS,EAAS,CAAQ,CAEtD,CAEkD,CACpD"}
1
+ {"version":3,"file":"plugin-BpYt41Nj.mjs","names":[],"sources":["../src/plugin/merge.ts","../src/plugin/index.ts"],"sourcesContent":["// Plugin → unified registry merge.\n//\n// Resolution rules (per the v1 spec + dogfood pivot):\n// - duplicate plugin `name` across the input array → conflict error.\n// Catches the double-install case (built-in shipped twice, or\n// adopter requiring the same plugin twice).\n// - plugin commands appear first in the merged list, then adopter\n// commands; adopter `commands` of the same name override the\n// plugin entry (filter pass).\n// - duplicate command name across two plugins → conflict error\n// listing both plugin names. Adopter overriding a plugin is\n// allowed and not an error.\n// - duplicate typegen id across two plugins → same error. Typegens\n// have no adopter override path; only plugins contribute them.\n// - register() functions are collected in input order; the caller\n// invokes each one against the same Command program. They have no\n// id-level conflict surface — owners are responsible for picking\n// non-colliding command names inside their own register().\n// - plugin order = array order. No implicit precedence rules.\n\nimport type { Command } from 'commander'\n\nimport type { KickCommandDefinition } from '../config'\nimport type { TypegenPlugin } from '../typegen/plugin'\nimport type { GeneratorSpec } from '../generator-extension/define'\nimport type { DiscoveredGenerator } from '../generator-extension/discover'\nimport { KickPluginConflictError, type KickCliPlugin, type KickCliPluginContext } from './types'\n\nexport interface MergedPlugins {\n commands: KickCommandDefinition[]\n typegens: TypegenPlugin[]\n /** DiscoveredGenerator shape so this list slots into the existing\n * dispatch path next to package.json-discovered entries. `source`\n * carries the plugin name for error attribution. */\n generators: DiscoveredGenerator[]\n /**\n * Apply every plugin's register() in input order. ctx is optional so\n * tests + lightweight callers can invoke `register(program)` without\n * constructing a full context; it falls back to cwd=process.cwd(),\n * config=null, log=no-op.\n */\n register: (program: Command, ctx?: KickCliPluginContext) => Promise<void>\n}\n\nexport function mergeCliPlugins(\n plugins: readonly KickCliPlugin[],\n adopterCommands: readonly KickCommandDefinition[] = [],\n): MergedPlugins {\n // Plugin-name dedup — catches double-install.\n const seenPluginNames = new Map<string, number>()\n for (const p of plugins) {\n const count = (seenPluginNames.get(p.name) ?? 0) + 1\n seenPluginNames.set(p.name, count)\n if (count === 2) {\n throw new KickPluginConflictError('plugin', p.name, [p.name, p.name])\n }\n }\n\n const commandOwners = new Map<string, string>()\n const pluginCommands: KickCommandDefinition[] = []\n for (const p of plugins) {\n for (const cmd of p.commands ?? []) {\n const prior = commandOwners.get(cmd.name)\n if (prior) {\n throw new KickPluginConflictError('command', cmd.name, [prior, p.name])\n }\n commandOwners.set(cmd.name, p.name)\n pluginCommands.push(cmd)\n }\n }\n\n const adopterNames = new Set(adopterCommands.map((c) => c.name))\n const filteredPlugin = pluginCommands.filter((c) => !adopterNames.has(c.name))\n const commands = [...filteredPlugin, ...adopterCommands]\n\n const typegenOwners = new Map<string, string>()\n const typegens: TypegenPlugin[] = []\n for (const p of plugins) {\n for (const tg of p.typegens ?? []) {\n const prior = typegenOwners.get(tg.id)\n if (prior) {\n throw new KickPluginConflictError('typegen', tg.id, [prior, p.name])\n }\n typegenOwners.set(tg.id, p.name)\n typegens.push(tg)\n }\n }\n\n const generatorOwners = new Map<string, string>()\n const generators: DiscoveredGenerator[] = []\n for (const p of plugins) {\n for (const spec of p.generators ?? []) {\n const prior = generatorOwners.get(spec.name)\n if (prior) {\n throw new KickPluginConflictError('generator', spec.name, [prior, p.name])\n }\n generatorOwners.set(spec.name, p.name)\n generators.push({ source: p.name, spec: spec satisfies GeneratorSpec })\n }\n }\n\n /**\n * Apply every plugin's `register()` callback in input order against the\n * given Commander program. Each callback receives a {@link KickCliPluginContext}:\n * caller-supplied ctx wins (test fixtures can inject a different\n * workspace boundary); otherwise a default ctx is built with\n * `findProjectRoot(process.cwd())` as the project root, `cwd` matching\n * `process.cwd()`, null config, no-op log, and the merged generator set\n * threaded through so the `kick/generate` built-in can surface each as\n * a Commander subcommand. The dynamic import of `findProjectRoot` keeps\n * the caller-supplied fast path zero-cost.\n */\n const register = async (program: Command, ctx?: KickCliPluginContext): Promise<void> => {\n let resolved: KickCliPluginContext\n if (ctx) {\n resolved = { generators, ...ctx }\n } else {\n const { findProjectRoot } = await import('../utils/project-root')\n const cwd = process.cwd()\n resolved = {\n cwd,\n projectRoot: findProjectRoot(cwd),\n config: null,\n log: () => {},\n generators,\n }\n }\n for (const p of plugins) {\n if (p.register) await p.register(program, resolved)\n }\n }\n\n return { commands, typegens, generators, register }\n}\n","// Barrel intentionally omits `./builtins` — that module top-level-imports\n// every register*Command, which pulls heavy modules (project scaffolders,\n// fs reads at import time) into the graph. Importers that need the\n// builtin list go through `./plugin/builtins` directly; tests + adopter\n// plugins consuming only the contract types import from here.\n\nexport type { KickCliPlugin } from './types'\nexport { defineCliPlugin, KickPluginConflictError } from './types'\nexport { mergeCliPlugins, type MergedPlugins } from './merge'\n"],"mappings":";;;;;;;;;;wFA4CA,SAAgB,EACd,EACA,EAAoD,CAAC,EACtC,CAEf,IAAM,EAAkB,IAAI,IAC5B,IAAK,IAAM,KAAK,EAAS,CACvB,IAAM,GAAS,EAAgB,IAAI,EAAE,IAAI,GAAK,GAAK,EAEnD,GADA,EAAgB,IAAI,EAAE,KAAM,CAAK,EAC7B,IAAU,EACZ,MAAM,IAAI,EAAwB,SAAU,EAAE,KAAM,CAAC,EAAE,KAAM,EAAE,IAAI,CAAC,CAExE,CAEA,IAAM,EAAgB,IAAI,I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,CAAI,MAC3B,CACL,GAAM,CAAE,mBAAoB,MAAM,OAAO,8BAAwB,CAAA,KAAA,GAAA,EAAA,CAAA,EAC3D,EAAM,QAAQ,IAAI,EACxB,EAAW,CACT,MACA,YAAa,EAAgB,CAAG,EAChC,OAAQ,KACR,QAAW,CAAC,EACZ,YACF,CACF,CACA,IAAK,IAAM,KAAK,EACV,EAAE,UAAU,MAAM,EAAE,SAAS,EAAS,CAAQ,CAEtD,CAEkD,CACpD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.0.1
2
+ * @forinda/kickjs-cli v8.1.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{a as e,t}from"./config-DVJ-0xov.mjs";import{l as n,o as r}from"./project-docs-DWPzkZ5p.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{execFile as u,execFileSync as d,execSync as f,spawnSync as p}from"node:child_process";import{promisify as m}from"node:util";const h=m(u),g=/[&|<>^"'`(){}[\];!%\r\n\\]/;function _(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(g.test(e)||t.some(e=>g.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 v(e,t,n={}){let r=_(e,t);if(!r)return null;try{return d(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 y(e,t,n={}){let r=_(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);d(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function b(e,t,n){f(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function x(e,t,n){let r=p(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function S(e,t,n={}){let r=_(e,t);if(!r)return null;try{let{stdout:e}=await h(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const ee={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},C={zod:{name:`zod`,range:`^4.3.6`},valibot:{name:`valibot`,range:`^1.4.1`},yup:{name:`yup`,range:`^1.7.1`}};function w(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 T(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=C[i],c={"@forinda/kickjs":w(n,`@forinda/kickjs`),"@forinda/kickjs-schema":w(n,`@forinda/kickjs-schema`),dotenv:`^17.3.1`,"reflect-metadata":`^0.2.2`,[s.name]:s.range};a===`express`?c.express=`^5.1.0`:a===`fastify`?(c.fastify=`^5.0.0`,c[`@fastify/middie`]=`^9.0.0`,c[`serve-static`]=`^2.2.0`):a===`h3`&&(c.h3=`^1.0.0`,c[`serve-static`]=`^2.2.0`);for(let e of r){let t=ee[e];t&&!c[t]&&(c[t]=w(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":w(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":w(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":w(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`,...o?{"@typescript/typescript6":`^6.0.2`}:{},oxfmt:`^0.65.0`,oxlint:`^1.80.0`}},null,2)}function te(){return`import { defineConfig } from 'vite'
11
+ import{a as e,t}from"./config-BsD3F7Qm.mjs";import{l as n,o as r}from"./project-docs-ue-hY0J7.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{execFile as u,execFileSync as d,execSync as f,spawnSync as p}from"node:child_process";import{promisify as m}from"node:util";const h=m(u),g=/[&|<>^"'`(){}[\];!%\r\n\\]/;function _(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(g.test(e)||t.some(e=>g.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 v(e,t,n={}){let r=_(e,t);if(!r)return null;try{return d(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 y(e,t,n={}){let r=_(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);d(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function ee(e,t,n){f(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function b(e,t,n){let r=p(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function x(e,t,n={}){let r=_(e,t);if(!r)return null;try{let{stdout:e}=await h(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const S={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},C={zod:{name:`zod`,range:`^4.3.6`},valibot:{name:`valibot`,range:`^1.4.1`},yup:{name:`yup`,range:`^1.7.1`}};function w(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 T(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=C[i],c={"@forinda/kickjs":w(n,`@forinda/kickjs`),"@forinda/kickjs-schema":w(n,`@forinda/kickjs-schema`),dotenv:`^17.3.1`,"reflect-metadata":`^0.2.2`,[s.name]:s.range};a===`express`?c.express=`^5.1.0`:a===`fastify`?(c.fastify=`^5.0.0`,c[`@fastify/middie`]=`^9.0.0`,c[`serve-static`]=`^2.2.0`):a===`h3`&&(c.h3=`^1.0.0`,c[`serve-static`]=`^2.2.0`);for(let e of r){let t=S[e];t&&!c[t]&&(c[t]=w(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":w(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":w(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":w(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`,...o?{"@typescript/typescript6":`^6.0.2`}:{},oxfmt:`^0.65.0`,oxlint:`^1.80.0`}},null,2)}function E(){return`import { defineConfig } from 'vite'
12
12
  import { fileURLToPath } from 'node:url'
13
13
  import swc from 'unplugin-swc'
14
14
  import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
@@ -38,7 +38,7 @@ export default defineConfig({
38
38
  },
39
39
  },
40
40
  })
41
- `}function E(){return JSON.stringify({compilerOptions:{target:`ES2022`,module:`ESNext`,moduleResolution:`bundler`,lib:[`ES2022`],types:[`node`,`vite/client`],strict:!0,esModuleInterop:!0,skipLibCheck:!0,sourceMap:!0,declaration:!0,experimentalDecorators:!0,emitDecoratorMetadata:!0,outDir:`dist`,paths:{"@/*":[`./src/*`]}},include:[`src`,`.kickjs/types/**/*.d.ts`,`.kickjs/types/**/*.ts`]},null,2)}function ne(){return JSON.stringify({$schema:`./node_modules/oxfmt/configuration_schema.json`,semi:!1,singleQuote:!0,trailingComma:`all`,printWidth:100,tabWidth:2,ignorePatterns:[`**/dist/`,`**/.kickjs/`,`**/node_modules/`]},null,2)}function re(){return`# https://editorconfig.org
41
+ `}function D(){return JSON.stringify({compilerOptions:{target:`ES2022`,module:`ESNext`,moduleResolution:`bundler`,lib:[`ES2022`],types:[`node`,`vite/client`],strict:!0,esModuleInterop:!0,skipLibCheck:!0,sourceMap:!0,declaration:!0,experimentalDecorators:!0,emitDecoratorMetadata:!0,outDir:`dist`,paths:{"@/*":[`./src/*`]}},include:[`src`,`.kickjs/types/**/*.d.ts`,`.kickjs/types/**/*.ts`]},null,2)}function O(){return JSON.stringify({$schema:`./node_modules/oxfmt/configuration_schema.json`,semi:!1,singleQuote:!0,trailingComma:`all`,printWidth:100,tabWidth:2,ignorePatterns:[`**/dist/`,`**/.kickjs/`,`**/node_modules/`]},null,2)}function k(){return`# https://editorconfig.org
42
42
  root = true
43
43
 
44
44
  [*]
@@ -51,7 +51,7 @@ insert_final_newline = true
51
51
 
52
52
  [*.md]
53
53
  trim_trailing_whitespace = false
54
- `}function ie(){return`node_modules/
54
+ `}function te(){return`node_modules/
55
55
  dist/
56
56
  .env
57
57
  # Personal machine overrides. \`.env.test\` itself is COMMITTED — it is the
@@ -61,7 +61,7 @@ coverage/
61
61
  .DS_Store
62
62
  *.tsbuildinfo
63
63
  .kickjs/
64
- `}function ae(){return`# Auto-detect text files and normalise line endings to LF
64
+ `}function ne(){return`# Auto-detect text files and normalise line endings to LF
65
65
  * text=auto eol=lf
66
66
 
67
67
  # Explicitly mark generated / binary files
@@ -79,11 +79,11 @@ coverage/
79
79
  pnpm-lock.yaml -diff linguist-generated
80
80
  yarn.lock -diff linguist-generated
81
81
  package-lock.json -diff linguist-generated
82
- `}function D(){return`PORT=3000
82
+ `}function re(){return`PORT=3000
83
83
  NODE_ENV=development
84
- `}function O(){return`PORT=3000
84
+ `}function ie(){return`PORT=3000
85
85
  NODE_ENV=development
86
- `}function k(){return`# Read INSTEAD of .env when NODE_ENV=test (or under vitest).
86
+ `}function ae(){return`# Read INSTEAD of .env when NODE_ENV=test (or under vitest).
87
87
  # No fallback to .env — declare here everything the suite needs, so a
88
88
  # missing var fails the run instead of silently resolving to your dev value.
89
89
  #
@@ -93,7 +93,7 @@ NODE_ENV=development
93
93
  NODE_ENV=test
94
94
  PORT=0
95
95
  LOG_LEVEL=silent
96
- `}function A(){return`import { defineConfig, mergeConfig } from 'vitest/config'
96
+ `}function oe(){return`import { defineConfig, mergeConfig } from 'vitest/config'
97
97
  import viteConfig from './vite.config.ts'
98
98
 
99
99
  // A \`vitest.config.ts\` OVERRIDES \`vite.config.ts\` outright — vitest does not
@@ -111,7 +111,7 @@ export default mergeConfig(
111
111
  },
112
112
  }),
113
113
  )
114
- `}const j={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function M(e,t,n,r=[],i=`express`,a){let o=j[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.
114
+ `}const A={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function j(e,t,n,r=[],i=`express`,a){let o=A[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.
115
115
  // Inert until the client build exists, so \`kick dev\` (where Vite
116
116
  // serves the client and proxies /api here) is unaffected.
117
117
  SpaAdapter({ clientDir: ${JSON.stringify(a)} }),`));let l=t.length?t.join(`
@@ -158,14 +158,14 @@ export const app = await bootstrap({
158
158
  requestLogger(),${d}
159
159
  ],
160
160
  })
161
- `}}}function N(){return`import { defineModules } from '@forinda/kickjs'
161
+ `}}}function M(){return`import { defineModules } from '@forinda/kickjs'
162
162
  import { HelloModule } from './hello/hello.module'
163
163
 
164
164
  // Remove HelloModule and run: kick g module <name>
165
165
  // \`defineModules()\` returns a chainable list — \`kick g module\` appends
166
166
  // \`.mount(NewModule())\` to the chain on every generation.
167
167
  export const modules = defineModules().mount(HelloModule())
168
- `}function P(e=`zod`){return e===`valibot`?`import { loadEnvFromSchema } from '@forinda/kickjs/config'
168
+ `}function N(e=`zod`){return e===`valibot`?`import { loadEnvFromSchema } from '@forinda/kickjs/config'
169
169
  import { fromValibot } from '@forinda/kickjs-schema/valibot'
170
170
  import * as v from 'valibot'
171
171
 
@@ -293,7 +293,7 @@ const envSchema = fromZod(
293
293
  export const env = loadEnvFromSchema(envSchema)
294
294
 
295
295
  export default envSchema
296
- `}function F(){return`import { Service } from '@forinda/kickjs'
296
+ `}function P(){return`import { Service } from '@forinda/kickjs'
297
297
 
298
298
  @Service()
299
299
  export class HelloService {
@@ -305,7 +305,7 @@ export class HelloService {
305
305
  return { status: 'ok', uptime: process.uptime() }
306
306
  }
307
307
  }
308
- `}function I(){return`import { Controller, Get, Autowired, type Ctx } from '@forinda/kickjs'
308
+ `}function F(){return`import { Controller, Get, Autowired, type Ctx } from '@forinda/kickjs'
309
309
  import { HelloService } from './hello.service'
310
310
 
311
311
  // \`Ctx<KickRoutes.HelloController['<method>']>\` is generated by
@@ -331,7 +331,7 @@ export class HelloController {
331
331
  return this.helloService.healthCheck()
332
332
  }
333
333
  }
334
- `}function L(){return`import { defineModule } from '@forinda/kickjs'
334
+ `}function I(){return`import { defineModule } from '@forinda/kickjs'
335
335
  import { HelloController } from './hello.controller'
336
336
 
337
337
  export const HelloModule = defineModule({
@@ -352,7 +352,7 @@ export const HelloModule = defineModule({
352
352
  },
353
353
  }),
354
354
  })
355
- `}function R(e,t=`inmemory`,n=`pnpm`,r=`express`,i=!1){return`import { defineConfig } from '@forinda/kickjs-cli'
355
+ `}function L(e,t=`inmemory`,n=`pnpm`,r=`express`,i=!1){return`import { defineConfig } from '@forinda/kickjs-cli'
356
356
 
357
357
  export default defineConfig({
358
358
  pattern: '${e}',
@@ -413,13 +413,13 @@ export default defineConfig({
413
413
  },
414
414
  ],
415
415
  })
416
- `}const z={kickjs:{pkg:`@forinda/kickjs`,peers:[`express`],description:`Unified framework: DI, decorators, routing, middleware`,core:!0},vite:{pkg:`@forinda/kickjs-vite`,peers:[`vite`],description:`Vite plugin: dev server, HMR, module discovery`,dev:!0,core:!0},cli:{pkg:`@forinda/kickjs-cli`,peers:[],description:`CLI tool and code generators`,dev:!0,core:!0},zod:{pkg:`zod`,peers:[],description:`Zod schema validation (env, DTOs, OpenAPI) — wrap with fromZod()`},valibot:{pkg:`valibot`,peers:[],description:`Valibot schema validation — wrap with fromValibot()`},yup:{pkg:`yup`,peers:[],description:`Yup schema validation — wrap with fromYup()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`},db:{pkg:`@forinda/kickjs-db`,peers:[],description:`kick/db core — schema DSL, migrations, KickDbClient, customType`},pg:{pkg:`@forinda/kickjs-db`,peers:[`pg`],description:`kick/db + PostgreSQL driver (use @forinda/kickjs-db/pg)`},sqlite:{pkg:`@forinda/kickjs-db`,peers:[`better-sqlite3`],description:`kick/db + SQLite driver (use @forinda/kickjs-db/sqlite)`},mysql:{pkg:`@forinda/kickjs-db`,peers:[`mysql2`],description:`kick/db + MySQL driver (use @forinda/kickjs-db/mysql)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],description:`WebSocket with @WsController decorators`},devtools:{pkg:`@forinda/kickjs-devtools`,peers:[],description:`Development dashboard — routes, DI, metrics, health`,dev:!0},queue:{pkg:`@forinda/kickjs-queue`,peers:[],description:`Queue adapter (BullMQ/RabbitMQ/Kafka)`},"queue:bullmq":{pkg:`@forinda/kickjs-queue`,peers:[`bullmq`,`ioredis`],description:`Queue with BullMQ + Redis`},"queue:rabbitmq":{pkg:`@forinda/kickjs-queue`,peers:[`amqplib`],description:`Queue with RabbitMQ`},"queue:kafka":{pkg:`@forinda/kickjs-queue`,peers:[`kafkajs`],description:`Queue with Kafka`},"queue:redis-pubsub":{pkg:`@forinda/kickjs-queue`,peers:[`ioredis`],description:`Lightweight pub/sub via Redis (no persistence)`},mcp:{pkg:`@forinda/kickjs-mcp`,peers:[`@modelcontextprotocol/sdk`],description:`Model Context Protocol server — expose @Controller endpoints as AI tools`},testing:{pkg:`@forinda/kickjs-testing`,peers:[],description:`Test utilities and TestModule builder`,dev:!0}},B=Object.entries(z).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),V={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};async function H(t=process.cwd()){let n=(await e(t))?.runtime;return n===`express`||n===`fastify`||n===`h3`?n:U(t)}function U(e=process.cwd()){let t=W(`package.json`,e);if(t)try{let e=JSON.parse(a(c(t,`package.json`),`utf-8`)),n={...e.dependencies,...e.devDependencies};if(`fastify`in n)return`fastify`;if(`h3`in n)return`h3`}catch{}return`express`}function W(e,t=process.cwd()){let n=t;for(;;){if(i(c(n,e)))return n;let t=o(n);if(t===n)return null;n=t}}function G(){return W(`pnpm-lock.yaml`)?`pnpm`:W(`yarn.lock`)?`yarn`:W(`bun.lockb`)||W(`bun.lock`)?`bun`:W(`package-lock.json`)?`npm`:null}function K(){let e=process.cwd();for(;e;){let n=c(e,`package.json`);if(i(n))try{let e=JSON.parse(a(n,`utf-8`)).packageManager;if(typeof e==`string`){let n=e.split(`@`)[0];if(t.includes(n))return n}}catch{}let r=o(e);if(r===e)return null;e=r}return null}async function q(n){if(n&&t.includes(n))return{pm:n,source:`flag`};let r=await e(process.cwd());if(r?.packageManager&&t.includes(r.packageManager))return{pm:r.packageManager,source:`config`};let i=K();if(i)return{pm:i,source:`package.json`};let a=G();return a?{pm:a,source:`lockfile`}:{pm:`npm`,source:`default`}}async function J(e){let{pm:t}=await q(e);return t}function Y(e=!1){let t=Object.entries(z),n=Math.max(...t.map(([e])=>e.length)),r=t.filter(([,e])=>e.core),i=t.filter(([,e])=>!e.core),a=([e,t])=>{let r=e.padEnd(n+2),i=t.peers.length?` (+ ${t.peers.join(`, `)})`:``,a=t.deprecated?` [DEPRECATED — ${t.deprecated}]`:``;return` ${r} ${t.description}${i}${a}`};console.log(`
416
+ `}const R={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,description:`Unified framework: DI, decorators, routing, middleware`,core:!0},vite:{pkg:`@forinda/kickjs-vite`,peers:[`vite`],description:`Vite plugin: dev server, HMR, module discovery`,dev:!0,core:!0},cli:{pkg:`@forinda/kickjs-cli`,peers:[],description:`CLI tool and code generators`,dev:!0,core:!0},zod:{pkg:`zod`,peers:[],description:`Zod schema validation (env, DTOs, OpenAPI) — wrap with fromZod()`},valibot:{pkg:`valibot`,peers:[],description:`Valibot schema validation — wrap with fromValibot()`},yup:{pkg:`yup`,peers:[],description:`Yup schema validation — wrap with fromYup()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`},db:{pkg:`@forinda/kickjs-db`,peers:[],description:`kick/db core — schema DSL, migrations, KickDbClient, customType`},pg:{pkg:`@forinda/kickjs-db`,peers:[`pg`],description:`kick/db + PostgreSQL driver (use @forinda/kickjs-db/pg)`},sqlite:{pkg:`@forinda/kickjs-db`,peers:[`better-sqlite3`],description:`kick/db + SQLite driver (use @forinda/kickjs-db/sqlite)`},mysql:{pkg:`@forinda/kickjs-db`,peers:[`mysql2`],description:`kick/db + MySQL driver (use @forinda/kickjs-db/mysql)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],description:`WebSocket with @WsController decorators`},devtools:{pkg:`@forinda/kickjs-devtools`,peers:[],description:`Development dashboard — routes, DI, metrics, health`,dev:!0},queue:{pkg:`@forinda/kickjs-queue`,peers:[],description:`Queue adapter (BullMQ/RabbitMQ/Kafka)`},"queue:bullmq":{pkg:`@forinda/kickjs-queue`,peers:[`bullmq`,`ioredis`],description:`Queue with BullMQ + Redis`},"queue:rabbitmq":{pkg:`@forinda/kickjs-queue`,peers:[`amqplib`],description:`Queue with RabbitMQ`},"queue:kafka":{pkg:`@forinda/kickjs-queue`,peers:[`kafkajs`],description:`Queue with Kafka`},"queue:redis-pubsub":{pkg:`@forinda/kickjs-queue`,peers:[`ioredis`],description:`Lightweight pub/sub via Redis (no persistence)`},mcp:{pkg:`@forinda/kickjs-mcp`,peers:[`@modelcontextprotocol/sdk`],description:`Model Context Protocol server — expose @Controller endpoints as AI tools`},testing:{pkg:`@forinda/kickjs-testing`,peers:[],description:`Test utilities and TestModule builder`,dev:!0}},z=Object.entries(R).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),B={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3`,`serve-static`]},V={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function H(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function U(e=process.cwd()){return(await W(e)).runtime}async function W(t=process.cwd()){let n=(await e(t))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...K(t),fromConfig:!1}}const G=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function K(e=process.cwd()){let t=q(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(a(c(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let i=G.filter(([e])=>e in n).map(([,e])=>e),o=G.filter(([e])=>e in r&&!(e in n)).map(([,e])=>e),s=[...i,...o];return i.length===1?{runtime:i[0],candidates:s,ambiguous:!1}:i.length===0&&o.length===1?{runtime:o[0],candidates:s,ambiguous:!1}:s.length===0?{runtime:`express`,candidates:s,ambiguous:!1}:{runtime:`express`,candidates:s,ambiguous:!0}}function q(e,t=process.cwd()){let n=t;for(;;){if(i(c(n,e)))return n;let t=o(n);if(t===n)return null;n=t}}function se(){return q(`pnpm-lock.yaml`)?`pnpm`:q(`yarn.lock`)?`yarn`:q(`bun.lockb`)||q(`bun.lock`)?`bun`:q(`package-lock.json`)?`npm`:null}function ce(){let e=process.cwd();for(;e;){let n=c(e,`package.json`);if(i(n))try{let e=JSON.parse(a(n,`utf-8`)).packageManager;if(typeof e==`string`){let n=e.split(`@`)[0];if(t.includes(n))return n}}catch{}let r=o(e);if(r===e)return null;e=r}return null}async function J(n){if(n&&t.includes(n))return{pm:n,source:`flag`};let r=await e(process.cwd());if(r?.packageManager&&t.includes(r.packageManager))return{pm:r.packageManager,source:`config`};let i=ce();if(i)return{pm:i,source:`package.json`};let a=se();return a?{pm:a,source:`lockfile`}:{pm:`npm`,source:`default`}}async function le(e){let{pm:t}=await J(e);return t}function Y(e=!1,t){let n=Object.entries(R),r=Math.max(...n.map(([e])=>e.length)),i=n.filter(([,e])=>e.core),a=n.filter(([,e])=>!e.core),o=([e,n])=>{let i=e.padEnd(r+2),a=n.enginePeers?[...n.peers,...B[t??`express`]]:n.peers,o=n.enginePeers?` [${t??`express`} engine]`:``,s=a.length?` (+ ${a.join(`, `)})${o}`:``,c=n.deprecated?` [DEPRECATED — ${n.deprecated}]`:``;return` ${i} ${n.description}${s}${c}`};console.log(`
417
417
  Core packages (always installed by \`kick new\`):
418
- `);for(let e of r)console.log(a(e));if(e){console.log(`
418
+ `);for(let e of i)console.log(o(e));if(e){console.log(`
419
419
  Optional packages (add as needed):
420
- `);for(let e of i)console.log(a(e))}else console.log(`\n Plus ${i.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
421
- 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 oe(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=V[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=z[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 se(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=>{Y(!!e.all)})}function ce(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){Y(!!t.all);return}let{pm:n,source:r}=await q(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=await H(process.cwd()),{prodDeps:a,devDeps:o,unknown:s,warnings:c,notices:l}=oe(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.
422
- `),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{f(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{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
423
- `)}})}const X=o(l(import.meta.url)),Z=JSON.parse(a([s(X,`..`,`package.json`),s(X,`..`,`..`,`package.json`)].find(i),`utf-8`)),le=[`@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`];function ue(e){return e===`@forinda/kickjs-cli`?`^${Z.version}`:`latest`}async function Q(){let e=await Promise.all(le.map(async e=>{let t=await S(`npm`,[`view`,e,`version`],{timeout:2e4});return t&&/^\d+\.\d+\.\d+/.test(t)?[e,`^${t}`]:[e,ue(e)]}));return Object.fromEntries(e)}function de(e,t){let n=v(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function fe(e,t){let n=e=>$(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 pe(e,t,n){let r=v(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function me(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=e,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),m(`Resolving package versions...`);let h=await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`)if(pe(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=de(r,`alpha`);e&&fe(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${a} add @forinda/kickjs@alpha`)}await n(s(p,`package.json`),T(t,o,h,l,u,d,e.withClientMap)),await n(s(p,`vite.config.ts`),te()),await n(s(p,`tsconfig.json`),E()),await n(s(p,`.oxfmtrc.json`),ne()),await n(s(p,`.editorconfig`),re()),await n(s(p,`.gitignore`),ie()),await n(s(p,`.gitattributes`),ae()),await n(s(p,`.env`),D()),await n(s(p,`.env.example`),O()),await n(s(p,`.env.test`),k()),await n(s(p,`src/config/index.ts`),P(u)),await n(s(p,`src/index.ts`),M(t,o,Z.version,l,d,e.spaClientDir)),await n(s(p,`src/modules/index.ts`),N()),await n(s(p,`src/modules/hello/hello.service.ts`),F()),await n(s(p,`src/modules/hello/hello.controller.ts`),I()),await n(s(p,`src/modules/hello/hello.module.ts`),L()),await n(s(p,`kick.config.ts`),R(o,c,a,d,e.withClientMap)),await n(s(p,`vitest.config.ts`),A()),await n(s(p,`README.md`),r(t,o,a));let{generateAgentDocs:_}=await import(`./agent-docs-B7yE3lQx.mjs`).then(e=>e.t);if(await _({outDir:p,name:t,pm:a,template:o,only:`all`,force:!0}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{f(`${a} install`,{cwd:p,stdio:`inherit`}),console.log(`
424
- Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-BA-9aIp0.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{f(`git init`,{cwd:p,stdio:`pipe`}),f(`git branch -M main`,{cwd:p,stdio:`pipe`}),f(`git add -A`,{cwd:p,stdio:`pipe`}),f(`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(`
425
- Project scaffolded successfully!`),console.log();let v=p!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={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(` ${y[o]??y.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: ${B}`),m(``)}export{ce as a,J as c,b as d,V as i,y as l,Q as n,se as o,z as r,H as s,me as t,x as u};
420
+ `);for(let e of a)console.log(o(e))}else console.log(`\n Plus ${a.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
421
+ 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 ue(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=V[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=R[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);if(e.enginePeers){let e=B[n];for(let t of e)l.add(t);s.push(`${c} (${n}): engine peers ${e.join(`, `)}`)}}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function de(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`).option(`--runtime <engine>`,`HTTP engine to show peers for: express | fastify | h3`).action(async e=>{Y(!!e.all,H(e.runtime)??await U())})}function fe(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(`--runtime <engine>`,`HTTP engine for peer resolution: express | fastify | h3 (overrides kick.config.ts)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){Y(!!t.all,H(t.runtime)??await U());return}let{pm:n,source:r}=await J(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=H(t.runtime),a=await W(process.cwd()),o=i??a.runtime;if(!i&&a.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${a.candidates.join(`, `)} in package.json.\n\n Installing engine peers for the wrong one is worse than not installing them, so:\n • set \`runtime: '<engine>'\` in kick.config.ts (permanent, also fixes kick doctor), or\n • pass --runtime <${a.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let{prodDeps:s,devDeps:c,unknown:l,warnings:u,notices:d}=ue(e,!!t.dev,o);for(let e of u)console.warn(`\n WARNING: ${e}`);for(let e of d)console.log(`\n ${e}`);if(!(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
422
+ `),s.length===0&&c.length===0))){if(s.length>0){let e=s,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(c.length>0){let e=c,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{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
423
+ `)}})}const X=o(l(import.meta.url)),Z=JSON.parse(a([s(X,`..`,`package.json`),s(X,`..`,`..`,`package.json`)].find(i),`utf-8`)),pe=[`@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`];function me(e){return e===`@forinda/kickjs-cli`?`^${Z.version}`:`latest`}async function Q(){let e=await Promise.all(pe.map(async e=>{let t=await x(`npm`,[`view`,e,`version`],{timeout:2e4});return t&&/^\d+\.\d+\.\d+/.test(t)?[e,`^${t}`]:[e,me(e)]}));return Object.fromEntries(e)}function he(e,t){let n=v(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function ge(e,t){let n=e=>$(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(e,t,n){let r=v(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function ve(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=e,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),m(`Resolving package versions...`);let h=await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`)if(_e(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=he(r,`alpha`);e&&ge(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${a} add @forinda/kickjs@alpha`)}await n(s(p,`package.json`),T(t,o,h,l,u,d,e.withClientMap)),await n(s(p,`vite.config.ts`),E()),await n(s(p,`tsconfig.json`),D()),await n(s(p,`.oxfmtrc.json`),O()),await n(s(p,`.editorconfig`),k()),await n(s(p,`.gitignore`),te()),await n(s(p,`.gitattributes`),ne()),await n(s(p,`.env`),re()),await n(s(p,`.env.example`),ie()),await n(s(p,`.env.test`),ae()),await n(s(p,`src/config/index.ts`),N(u)),await n(s(p,`src/index.ts`),j(t,o,Z.version,l,d,e.spaClientDir)),await n(s(p,`src/modules/index.ts`),M()),await n(s(p,`src/modules/hello/hello.service.ts`),P()),await n(s(p,`src/modules/hello/hello.controller.ts`),F()),await n(s(p,`src/modules/hello/hello.module.ts`),I()),await n(s(p,`kick.config.ts`),L(o,c,a,d,e.withClientMap)),await n(s(p,`vitest.config.ts`),oe()),await n(s(p,`README.md`),r(t,o,a));let{generateAgentDocs:_}=await import(`./agent-docs-jERb6N2l.mjs`).then(e=>e.t);if(await _({outDir:p,name:t,pm:a,template:o,only:`all`,force:!0}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{f(`${a} install`,{cwd:p,stdio:`inherit`}),console.log(`
424
+ Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-BK72BD_F.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{f(`git init`,{cwd:p,stdio:`pipe`}),f(`git branch -M main`,{cwd:p,stdio:`pipe`}),f(`git add -A`,{cwd:p,stdio:`pipe`}),f(`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(`
425
+ Project scaffolded successfully!`),console.log();let v=p!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={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(` ${y[o]??y.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: ${z}`),m(``)}export{fe as a,le as c,ee as d,V as i,y as l,Q as n,de as o,R as r,U as s,ve as t,b as u};