@forinda/kickjs-cli 5.7.0 → 5.8.1

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.
package/dist/index.d.mts CHANGED
@@ -378,8 +378,23 @@ interface GeneratorContext {
378
378
  pluralCamel?: string;
379
379
  /** Modules directory from `kick.config.ts` (default `'src/modules'`). */
380
380
  modulesDir: string;
381
- /** Working directory for the generator — usually `process.cwd()`. */
381
+ /**
382
+ * Working directory the CLI was invoked from. May be a nested subdirectory
383
+ * if the adopter ran `kick g ...` from `src/modules/foo/` — for "write
384
+ * files relative to the project" use {@link projectRoot} instead.
385
+ */
382
386
  cwd: string;
387
+ /**
388
+ * Resolved project root — the nearest ancestor directory of {@link cwd}
389
+ * containing `kick.config.{ts,js,mjs,json}` (or `package.json` as a
390
+ * fallback). Always set; falls back to `cwd` when no marker is found.
391
+ *
392
+ * Use this when writing files that must land at a known location
393
+ * regardless of where the adopter typed the command. `kick g ...` from
394
+ * inside `src/modules/foo/` will still see `projectRoot` pointing at
395
+ * the directory that owns `kick.config.ts`.
396
+ */
397
+ projectRoot: string;
383
398
  /** Positional arguments passed AFTER the name (e.g. `kick g command Order extra1 extra2` → `['extra1', 'extra2']`). */
384
399
  args: string[];
385
400
  /** Flag values from the command line — booleans for switches, strings for `--key value`. */
@@ -488,7 +503,25 @@ interface DiscoveryResult {
488
503
  * land here without changing the callback signature.
489
504
  */
490
505
  interface KickCliPluginContext {
506
+ /**
507
+ * Working directory the CLI was invoked from. Plugin authors that need
508
+ * a stable "project base" location (e.g. to write artifacts, resolve
509
+ * config-relative paths) should prefer {@link projectRoot} over `cwd`
510
+ * — `cwd` is whatever the adopter typed the command from, including
511
+ * arbitrary subdirectories.
512
+ */
491
513
  cwd: string;
514
+ /**
515
+ * Resolved project root — the directory `loadKickConfig` walked up to
516
+ * via `findProjectRoot()`. Always set to a usable absolute path: when
517
+ * a `kick.config.{ts,js,mjs,json}` is found, that directory; otherwise
518
+ * the nearest ancestor with a `package.json`; otherwise `cwd` itself.
519
+ *
520
+ * Populated by `mergeCliPlugins.register()` from the same resolution
521
+ * that `cli.ts` performs at startup, so plugin authors get a coherent
522
+ * view of the project root without re-walking the filesystem.
523
+ */
524
+ projectRoot: string;
492
525
  /** Resolved kick.config.ts (null if the project has none). */
493
526
  config: KickConfig | null;
494
527
  log: (msg: string) => void;
@@ -1129,6 +1162,13 @@ declare function buildGeneratorContext(input: {
1129
1162
  flags?: Record<string, string | boolean>;
1130
1163
  modulesDir?: string;
1131
1164
  cwd?: string;
1165
+ /**
1166
+ * Resolved project root. When omitted, derived from {@link cwd} via
1167
+ * `findProjectRoot()` so adopter-facing call sites stay zero-config.
1168
+ * Callers that already know the root (e.g. `cli.ts` after one upfront
1169
+ * resolution) should pass it through to avoid redundant fs walks.
1170
+ */
1171
+ projectRoot?: string;
1132
1172
  pluralize?: boolean;
1133
1173
  }): GeneratorContext;
1134
1174
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/generator-extension/discover.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/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;;;;AAgCA;;;;AAOU;AAEV;;;;AAAmD;AAGnD;;;;;;;;;;;AAUW;AAIX;;cA1Ba,eAAA;AAAA,KASD,aAAA,WAAwB,eAAe;;UAGlC,eAAA;EA2CQ;EAzCvB,SAAA;EAcA;EAZA,SAAA,EAAW,aAAa;EAgBxB;EAdA,QAAA;EAkBA;EAhBA,YAAA;EAyBA;EAvBA,SAAA;AAAA;;UAIe,eAAA;EA4BF;EA1Bb,UAAA;EA2Bc;EAzBd,MAAA;EA6BA;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1B,WAAA;EACA,QAAA;AAAA;;iBAIoB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAO;;;;;;AdzEvE;;;;AAOU;AAEV;;;;AAAmD;AAGnD;;iBexBgB,eAAA,CAAgB,QAAgC;;;;;AfYhE;;;;iBgBhBgB,qBAAA,CAAsB,KAAA;EACpC,IAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;EACR,UAAA;EACA,GAAA;EACA,SAAA;AAAA,IACE,gBAAgB;;;;iBCpBJ,YAAA,CAAa,IAAY;;iBAOzB,WAAA,CAAY,IAAY;;iBAMxB,WAAA,CAAY,IAAY;;AjBuB9B;AAEV;;;iBiBbgB,SAAA,CAAU,IAAY"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/generator-extension/discover.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/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;;;;AAgCA;;;;AAOU;AAEV;;;;AAAmD;AAGnD;;;;;;;;;;;AAUW;AAIX;;cA1Ba,eAAA;AAAA,KASD,aAAA,WAAwB,eAAe;;UAGlC,eAAA;EA2CQ;EAzCvB,SAAA;EAcA;EAZA,SAAA,EAAW,aAAa;EAgBxB;EAdA,QAAA;EAkBA;EAhBA,YAAA;EAyBA;EAvBA,SAAA;AAAA;;UAIe,eAAA;EA4BF;EA1Bb,UAAA;EA2Bc;EAzBd,MAAA;EA6BA;EA3BA,UAAA;EA2BY;EAzBZ,IAAA;EA6BwB;EA3BxB,UAAA;EA6BA;AAMM;AAIR;;;;;EA/BE,eAAA;EACA,aAAA;EACA,eAAA;EAqCY;AAAA;AAId;;;;EAlCE,UAAA,EAAY,SA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EAAS,kBAAA,GAAqB,OAAO;;;;;;AdzEvE;;;;AAOU;AAEV;;;;AAAmD;AAGnD;;iBexBgB,eAAA,CAAgB,QAAgC;;;;;AfYhE;;;;iBgBfgB,qBAAA,CAAsB,KAAA;EACpC,IAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;EACR,UAAA;EACA,GAAA;EhBsBe;;;;;;EgBff,WAAA;EACA,SAAA;AAAA,IACE,gBAAgB;;;;iBC5BJ,YAAA,CAAa,IAAY;;iBAOzB,WAAA,CAAY,IAAY;;iBAMxB,WAAA,CAAY,IAAY;;AjBuB9B;AAEV;;;iBiBbgB,SAAA,CAAU,IAAY"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.7.0
2
+ * @forinda/kickjs-cli v5.8.1
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{E as e,S as t,T as n,a as r,d as i,f as a,g as o,h as s,i as c,m as l,p as u,r as d,w as f,y as p}from"./generator-extension-Cd2DU_XX.mjs";import{i as m,r as h}from"./config-BQUzGk6m.mjs";import{t as g}from"./project-root-Dsxhm7OL.mjs";import{n as _,t as v}from"./types-Du3p7CZ5.mjs";function y(e){return e}export{v as KickPluginConflictError,d as buildGeneratorContext,_ as defineCliPlugin,h as defineConfig,c as defineGenerator,y as defineTypegen,g as findProjectRoot,o as generateAdapter,a as generateController,i as generateDto,l as generateGuard,s as generateMiddleware,p as generateModule,u as generateService,r as initProject,m as loadKickConfig,t as pluralize,f as toCamelCase,n as toKebabCase,e as toPascalCase};
11
+ import{E as e,S as t,T as n,a as r,d as i,f as a,g as o,h as s,i as c,m as l,p as u,r as d,w as f,y as p}from"./generator-extension-ChoCJW23.mjs";import{i as m,r as h}from"./config-v6vsVMtc.mjs";import{t as g}from"./project-root-BaUzB3D7.mjs";import{n as _,t as v}from"./types-BG2NeDgK.mjs";function y(e){return e}export{v as KickPluginConflictError,d as buildGeneratorContext,_ as defineCliPlugin,h as defineConfig,c as defineGenerator,y as defineTypegen,g as findProjectRoot,o as generateAdapter,a as generateController,i as generateDto,l as generateGuard,s as generateMiddleware,p as generateModule,u as generateService,r as initProject,m as loadKickConfig,t as pluralize,f as toCamelCase,n as toKebabCase,e as toPascalCase};
12
12
  //# sourceMappingURL=index.mjs.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.7.0
2
+ * @forinda/kickjs-cli v5.8.1
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-jjtMmVBF.mjs";import{t}from"./types-Du3p7CZ5.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=n?{generators:d,...n}:{cwd:process.cwd(),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-B6ANfh7O.mjs.map
11
+ import{t as e}from"./rolldown-runtime-vNCSDkuE.mjs";import{t}from"./types-BG2NeDgK.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-BaUzB3D7.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-1Oiz9_TD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-B6ANfh7O.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 const register = async (program: Command, ctx?: KickCliPluginContext): Promise<void> => {\n // Default ctx if caller didn't provide one (tests, scripts). Thread\n // `generators` through so the `kick/generate` built-in can register\n // each plugin generator as a real Commander subcommand. Caller-\n // supplied ctx wins for every field including `generators`, in\n // case a test fixture wants to inject a different set.\n const resolved: KickCliPluginContext = ctx\n ? { generators, ...ctx }\n : { cwd: process.cwd(), config: null, log: () => {}, generators }\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,CAEx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nC,CAAE,aAAY,GAAG,CAAI,EACrB,CAAE,IAAK,QAAQ,IAAI,EAAG,OAAQ,KAAM,QAAW,CAAC,EAAG,YAAW,EAClE,IAAK,IAAM,KAAK,EACV,EAAE,UAAU,MAAM,EAAE,SAAS,EAAS,CAAQ,CAEtD,CAEkD,CACpD"}
1
+ {"version":3,"file":"plugin-1Oiz9_TD.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,IACpB,EAA0C,CAAC,EACjD,IAAK,IAAM,KAAK,EACd,IAAK,IAAM,KAAO,EAAE,UAAY,CAAC,EAAG,CAClC,IAAM,EAAQ,EAAc,IAAI,EAAI,IAAI,EACxC,GAAI,EACF,MAAM,IAAI,EAAwB,UAAW,EAAI,KAAM,CAAC,EAAO,EAAE,IAAI,CAAC,EAExE,EAAc,IAAI,EAAI,KAAM,EAAE,IAAI,EAClC,EAAe,KAAK,CAAG,CACzB,CAGF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1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.7.0
2
+ * @forinda/kickjs-cli v5.8.1
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-jjtMmVBF.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
12
- //# sourceMappingURL=project-root-Dsxhm7OL.mjs.map
11
+ import{t as e}from"./rolldown-runtime-vNCSDkuE.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
12
+ //# sourceMappingURL=project-root-BaUzB3D7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-root-Dsxhm7OL.mjs","names":[],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sLAGA,MAAM,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgB,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAM,EAAQ,EAAQ,CAAQ,EACxB,CAAE,KAAM,GAAW,EAAM,CAAK,EAEhC,EAAkC,KAClC,EAAS,EACb,OAAa,CACX,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,EAAQ,EAAQ,CAAI,CAAC,EAAG,OAAO,EAKhD,GAHI,IAAqB,MAAQ,EAAW,EAAQ,EAAQ,cAAc,CAAC,IACzE,EAAmB,GAEjB,IAAW,EAAQ,MACvB,IAAM,EAAS,EAAQ,CAAM,EAC7B,GAAI,IAAW,EAAQ,MACvB,EAAS,CACX,CAEA,OAAO,GAAoB,CAC7B"}
1
+ {"version":3,"file":"project-root-BaUzB3D7.mjs","names":[],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sLAGA,MAAM,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgB,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAM,EAAQ,EAAQ,CAAQ,EACxB,CAAE,KAAM,GAAW,EAAM,CAAK,EAEhC,EAAkC,KAClC,EAAS,EACb,OAAa,CACX,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,EAAQ,EAAQ,CAAI,CAAC,EAAG,OAAO,EAKhD,GAHI,IAAqB,MAAQ,EAAW,EAAQ,EAAQ,cAAc,CAAC,IACzE,EAAmB,GAEjB,IAAW,EAAQ,MACvB,IAAM,EAAS,EAAQ,CAAM,EAC7B,GAAI,IAAW,EAAQ,MACvB,EAAS,CACX,CAEA,OAAO,GAAoB,CAC7B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.7.0
2
+ * @forinda/kickjs-cli v5.8.1
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.7.0
2
+ * @forinda/kickjs-cli v5.8.1
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,B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,c as v,d as y,f as ee,g as te,h as b,j as x,k as S,l as ne,m as re,n as ie,o as ae,p as oe,s as se,t as ce,u as le,v as ue,w as de,x as C,y as fe,z as w}from"./generator-extension-Cd2DU_XX.mjs";import{a as T,i as E,o as pe,t as me}from"./config-BQUzGk6m.mjs";import{t as he}from"./project-root-Dsxhm7OL.mjs";import{n as D}from"./types-Du3p7CZ5.mjs";import{n as ge}from"./plugin-B6ANfh7O.mjs";import{a as _e,c as ve,i as ye,n as be,o as xe,s as Se,t as O}from"./typegen-D-1Q9yBD.mjs";import k,{basename as Ce,dirname as A,isAbsolute as we,join as j,relative as M,resolve as N,sep as Te}from"node:path";import{cpSync as Ee,existsSync as P,mkdirSync as De,readFileSync as F,readdirSync as Oe,rmSync as ke,statSync as Ae,writeFileSync as je}from"node:fs";import{copyFile as Me,mkdir as Ne,readFile as I,readdir as Pe,rm as Fe,stat as Ie,writeFile as L}from"node:fs/promises";import{execSync as Le,fork as Re,spawn as ze,spawnSync as Be}from"node:child_process";import{pathToFileURL as R}from"node:url";import{glob as Ve}from"glob";import{groupAssetKeys as He}from"@forinda/kickjs";import{arch as Ue,platform as We,release as Ge}from"node:os";import{detectCompositeReferences as Ke,generate as qe,migrateDown as Je,migrateLatest as Ye,migrateRollback as Xe,migrateStatus as Ze,migrateUp as Qe,renderSchemaSource as $e,resolveDbConfig as et}from"@forinda/kickjs-db";const tt={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},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`},"db-pg":{pkg:`@forinda/kickjs-db-pg`,peers:[`pg`],description:`kick/db PostgreSQL dialect + adapter (pgDialect, pgAdapter)`},drizzle:{pkg:`@forinda/kickjs-drizzle`,peers:[`drizzle-orm`],description:`Drizzle ORM adapter + query builder`},prisma:{pkg:`@forinda/kickjs-prisma`,peers:[`@prisma/client`],description:`Prisma adapter + query builder`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`socket.io`],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`},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}};function z(e,t=process.cwd()){let n=t;for(;;){if(P(N(n,e)))return n;let t=A(n);if(t===n)return null;n=t}}function nt(){return z(`pnpm-lock.yaml`)?`pnpm`:z(`yarn.lock`)?`yarn`:z(`bun.lockb`)||z(`bun.lock`)?`bun`:z(`package-lock.json`)?`npm`:null}function rt(){let e=process.cwd();for(;e;){let t=N(e,`package.json`);if(P(t))try{let e=JSON.parse(F(t,`utf-8`)).packageManager;if(typeof e==`string`){let t=e.split(`@`)[0];if(me.includes(t))return t}}catch{}let n=A(e);if(n===e)return null;e=n}return null}async function it(e){if(e&&me.includes(e))return{pm:e,source:`flag`};let t=await E(process.cwd());if(t?.packageManager&&me.includes(t.packageManager))return{pm:t.packageManager,source:`config`};let n=rt();if(n)return{pm:n,source:`package.json`};let r=nt();return r?{pm:r,source:`lockfile`}:{pm:`npm`,source:`default`}}async function at(e){let{pm:t}=await it(e);return t}function ot(e=!1){let t=Object.entries(tt),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(`, `)})`:``;return` ${r} ${t.description}${i}`};console.log(`
11
+ import{A as e,B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,c as v,d as y,f as ee,g as te,h as b,j as x,k as S,l as ne,m as re,n as ie,o as ae,p as oe,s as se,t as ce,u as le,v as ue,w as de,x as C,y as fe,z as w}from"./generator-extension-ChoCJW23.mjs";import{a as T,i as E,o as pe,t as me}from"./config-v6vsVMtc.mjs";import{t as he}from"./project-root-BaUzB3D7.mjs";import{n as D}from"./types-BG2NeDgK.mjs";import{n as ge}from"./plugin-1Oiz9_TD.mjs";import{a as _e,c as ve,i as ye,n as be,o as xe,s as Se,t as O}from"./typegen-B8lAhWXz.mjs";import k,{basename as Ce,dirname as A,isAbsolute as we,join as j,relative as M,resolve as N,sep as Te}from"node:path";import{cpSync as Ee,existsSync as P,mkdirSync as De,readFileSync as F,readdirSync as Oe,rmSync as ke,statSync as Ae,writeFileSync as je}from"node:fs";import{copyFile as Me,mkdir as Ne,readFile as I,readdir as Pe,rm as Fe,stat as Ie,writeFile as L}from"node:fs/promises";import{execSync as Le,fork as Re,spawn as ze,spawnSync as Be}from"node:child_process";import{pathToFileURL as R}from"node:url";import{glob as Ve}from"glob";import{groupAssetKeys as He}from"@forinda/kickjs";import{arch as Ue,platform as We,release as Ge}from"node:os";import{detectCompositeReferences as Ke,generate as qe,migrateDown as Je,migrateLatest as Ye,migrateRollback as Xe,migrateStatus as Ze,migrateUp as Qe,renderSchemaSource as $e,resolveDbConfig as et}from"@forinda/kickjs-db";const tt={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},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`},"db-pg":{pkg:`@forinda/kickjs-db-pg`,peers:[`pg`],description:`kick/db PostgreSQL dialect + adapter (pgDialect, pgAdapter)`},drizzle:{pkg:`@forinda/kickjs-drizzle`,peers:[`drizzle-orm`],description:`Drizzle ORM adapter + query builder`},prisma:{pkg:`@forinda/kickjs-prisma`,peers:[`@prisma/client`],description:`Prisma adapter + query builder`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`socket.io`],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}};function z(e,t=process.cwd()){let n=t;for(;;){if(P(N(n,e)))return n;let t=A(n);if(t===n)return null;n=t}}function nt(){return z(`pnpm-lock.yaml`)?`pnpm`:z(`yarn.lock`)?`yarn`:z(`bun.lockb`)||z(`bun.lock`)?`bun`:z(`package-lock.json`)?`npm`:null}function rt(){let e=process.cwd();for(;e;){let t=N(e,`package.json`);if(P(t))try{let e=JSON.parse(F(t,`utf-8`)).packageManager;if(typeof e==`string`){let t=e.split(`@`)[0];if(me.includes(t))return t}}catch{}let n=A(e);if(n===e)return null;e=n}return null}async function it(e){if(e&&me.includes(e))return{pm:e,source:`flag`};let t=await E(process.cwd());if(t?.packageManager&&me.includes(t.packageManager))return{pm:t.packageManager,source:`config`};let n=rt();if(n)return{pm:n,source:`package.json`};let r=nt();return r?{pm:r,source:`lockfile`}:{pm:`npm`,source:`default`}}async function at(e){let{pm:t}=await it(e);return t}function ot(e=!1){let t=Object.entries(tt),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(`, `)})`:``;return` ${r} ${t.description}${i}`};console.log(`
12
12
  Core packages (always installed by \`kick new\`):
13
13
  `);for(let e of r)console.log(a(e));if(e){console.log(`
14
14
  Optional packages (add as needed):
@@ -633,7 +633,7 @@ describe('${c}', () => {
633
633
  Plugin generators:
634
634
  `);let e=Math.max(...r.generators.map(e=>`${e.spec.name} <name>`.length));for(let{source:t,spec:n}of r.generators){let r=`${n.name} <name>`;console.log(` kick g ${r.padEnd(e+2)} ${n.description} [${t}]`)}}if(r.failed.length>0){console.log(`
635
635
  Failed to load:
636
- `);for(let{source:e,reason:t}of r.failed)console.log(` ${e} — ${t}`)}console.log()}async function Xt(e,t,n){let r=await E(process.cwd()),i=T(r),a=t.modulesDir??i.dir??`src/modules`,s=t.repo??_(i.repo),c=t.pattern??r?.pattern??`ddd`,l=t.pluralize===!1?!1:i.pluralize??!0,u=pe(r,process.cwd()),d=i.style??`define`;if(!n&&d===`define`){let e=await Ot(N(a),`define`);if(e.length>0){console.error(`\n ${o.red(`Error:`)} ${e.length} module file(s) still use the legacy \`class … implements AppModule\` shape.\n ${o.dim(`Project setting:`)} modules.style: 'define' (default)\n\n ${o.bold(`Files needing migration:`)}`);for(let t of e.slice(0,5))console.error(` - ${t}`);e.length>5&&console.error(` … and ${e.length-5} more`),console.error(`\n ${o.bold(`Pick one:`)}\n 1. Migrate everything to defineModule:\n ${o.dim(`$`)} kick codemod modules --experimental --apply\n 2. Keep the class form — pin it in kick.config.ts:\n ${o.dim(`// kick.config.ts`)}\n ${o.dim(`export default defineConfig({ modules: { style: 'class' } })`)}\n`),process.exit(1)}}let f=[];for(let r of e){let e=await fe({name:r,modulesDir:N(a),noEntity:t.entity===!1,noTests:t.tests===!1,repo:s,minimal:t.minimal,force:t.force,pattern:c,dryRun:n,pluralize:l,prismaClientPath:i.prismaClientPath,tokenScope:u,style:i.style});f.push(...e)}G(f,n),await qt(n)}function Zt(e,t){let n=e.command(`generate [names...]`).alias(`g`).description("Generate code scaffolds — bare form `kick g <name>` is shorthand for `kick g module <name>`").option(`--list`,`List all available generators`).option(`--dry-run`,`Preview files that would be generated without writing them`).option(`--no-entity`,`Skip entity and value object generation (module shortcut)`).option(`--no-tests`,`Skip test file generation (module shortcut)`).option(`--repo <type>`,`Repository implementation: inmemory | drizzle | prisma`).option(`--pattern <pattern>`,`Override project pattern: rest | ddd | cqrs | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t,r)=>{if(t.list){await Yt();return}if(!e||e.length===0){n.help();return}let i=W(r);w(i);let[a,o,...s]=e;if(a){let e=await E(process.cwd()),n=ge(e?.plugins??[],e?.commands??[]),r=await ie({generatorName:a,itemName:o??``,args:s,flags:t,cwd:process.cwd()},n.generators);if(r){G(r.files,i);return}}await Xt(e,t,i)});n.command(`module <names...>`).description(`Generate one or more modules (e.g. kick g module user task project)`).option(`--no-entity`,`Skip entity and value object generation`).option(`--no-tests`,`Skip test file generation`).option(`--repo <type>`,`Repository implementation: inmemory | drizzle | prisma`).option(`--pattern <pattern>`,`Override project pattern: rest | ddd | cqrs | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t,n)=>{let r=W(n);w(r),await Xt(e,{...n.optsWithGlobals(),...t},r)}),n.command(`adapter <name>`).description(`Generate an AppAdapter with lifecycle hooks and middleware support`).option(`-o, --out <dir>`,`Output directory`,`src/adapters`).action(async(e,t,n)=>{let r=W(n);w(r),G(await te({name:e,outDir:N(t.out)}),r)}),n.command(`plugin <name>`).description(`Generate a KickPlugin with DI, modules, adapters, middleware, and lifecycle hooks`).option(`-o, --out <dir>`,`Output directory`,`src/plugins`).action(async(e,t,n)=>{let r=W(n);w(r),G(await dt({name:e,outDir:N(t.out)}),r)}),n.command(`middleware <name>`).description(`Generate an Express middleware function
636
+ `);for(let{source:e,reason:t}of r.failed)console.log(` ${e} — ${t}`)}console.log()}async function Xt(e,t,n){let r=await E(process.cwd()),i=T(r),a=t.modulesDir??i.dir??`src/modules`,s=t.repo??_(i.repo),c=t.pattern??r?.pattern??`ddd`,l=t.pluralize===!1?!1:i.pluralize??!0,u=pe(r,process.cwd()),d=i.style??`define`;if(!n&&d===`define`){let e=await Ot(N(a),`define`);if(e.length>0){console.error(`\n ${o.red(`Error:`)} ${e.length} module file(s) still use the legacy \`class … implements AppModule\` shape.\n ${o.dim(`Project setting:`)} modules.style: 'define' (default)\n\n ${o.bold(`Files needing migration:`)}`);for(let t of e.slice(0,5))console.error(` - ${t}`);e.length>5&&console.error(` … and ${e.length-5} more`),console.error(`\n ${o.bold(`Pick one:`)}\n 1. Migrate everything to defineModule:\n ${o.dim(`$`)} kick codemod modules --experimental --apply\n 2. Keep the class form — pin it in kick.config.ts:\n ${o.dim(`// kick.config.ts`)}\n ${o.dim(`export default defineConfig({ modules: { style: 'class' } })`)}\n`),process.exit(1)}}let f=[];for(let r of e){let e=await fe({name:r,modulesDir:N(a),noEntity:t.entity===!1,noTests:t.tests===!1,repo:s,minimal:t.minimal,force:t.force,pattern:c,dryRun:n,pluralize:l,prismaClientPath:i.prismaClientPath,tokenScope:u,style:i.style});f.push(...e)}G(f,n),await qt(n)}function Zt(e,t){let n=e.command(`generate [names...]`).alias(`g`).description("Generate code scaffolds — bare form `kick g <name>` is shorthand for `kick g module <name>`").option(`--list`,`List all available generators`).option(`--dry-run`,`Preview files that would be generated without writing them`).option(`--no-entity`,`Skip entity and value object generation (module shortcut)`).option(`--no-tests`,`Skip test file generation (module shortcut)`).option(`--repo <type>`,`Repository implementation: inmemory | drizzle | prisma`).option(`--pattern <pattern>`,`Override project pattern: rest | ddd | cqrs | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,r,i)=>{if(r.list){await Yt();return}if(!e||e.length===0){n.help();return}let a=W(i);w(a);let[o,s,...c]=e;if(o){let e=await E(process.cwd()),n=ge(e?.plugins??[],e?.commands??[]),i=await ie({generatorName:o,itemName:s??``,args:c,flags:r,cwd:process.cwd(),projectRoot:t?.projectRoot},n.generators);if(i){G(i.files,a);return}}await Xt(e,r,a)});n.command(`module <names...>`).description(`Generate one or more modules (e.g. kick g module user task project)`).option(`--no-entity`,`Skip entity and value object generation`).option(`--no-tests`,`Skip test file generation`).option(`--repo <type>`,`Repository implementation: inmemory | drizzle | prisma`).option(`--pattern <pattern>`,`Override project pattern: rest | ddd | cqrs | minimal`).option(`--minimal`,`Shorthand for --pattern minimal`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular names (skip auto-pluralization)`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t,n)=>{let r=W(n);w(r),await Xt(e,{...n.optsWithGlobals(),...t},r)}),n.command(`adapter <name>`).description(`Generate an AppAdapter with lifecycle hooks and middleware support`).option(`-o, --out <dir>`,`Output directory`,`src/adapters`).action(async(e,t,n)=>{let r=W(n);w(r),G(await te({name:e,outDir:N(t.out)}),r)}),n.command(`plugin <name>`).description(`Generate a KickPlugin with DI, modules, adapters, middleware, and lifecycle hooks`).option(`-o, --out <dir>`,`Output directory`,`src/plugins`).action(async(e,t,n)=>{let r=W(n);w(r),G(await dt({name:e,outDir:N(t.out)}),r)}),n.command(`middleware <name>`).description(`Generate an Express middleware function
637
637
  Use -m to scope it to a module: kick g middleware auth -m users`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(e,t,n)=>{let r=W(n);w(r);let i=await E(process.cwd()),a=T(i),o=a.dir??`src/modules`;G(await b({name:e,outDir:t.out,moduleName:t.module,modulesDir:o,pattern:i?.pattern,pluralize:a.pluralize??!0}),r)}),n.command(`guard <name>`).description(`Generate a route guard (auth, roles, etc.)
638
638
  Use -m to scope it to a module: kick g guard admin -m users`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(e,t,n)=>{let r=W(n);w(r);let i=await E(process.cwd()),a=T(i),o=a.dir??`src/modules`;G(await re({name:e,outDir:t.out,moduleName:t.module,modulesDir:o,pattern:i?.pattern,pluralize:a.pluralize??!0}),r)}),n.command(`service <name>`).description(`Generate a @Service() class
639
639
  Use -m to scope it to a module: kick g service payment -m orders`).option(`-o, --out <dir>`,`Output directory (overrides --module)`).option(`-m, --module <module>`,`Place inside a module folder`).action(async(e,t,n)=>{let r=W(n);w(r);let i=await E(process.cwd()),a=T(i),o=a.dir??`src/modules`;G(await oe({name:e,outDir:t.out,moduleName:t.module,modulesDir:o,pattern:i?.pattern,pluralize:a.pluralize??!0}),r)}),n.command(`controller <name>`).description(`Generate a @Controller() class with basic routes
@@ -648,7 +648,7 @@ describe('${c}', () => {
648
648
  Usage: kick g scaffold <name> <field:type> [field:type...]
649
649
  Example: kick g scaffold Post title:string body:text:optional published:boolean:optional
650
650
  Optional: append :optional (shell-safe, no quoting needed)
651
- `),process.exit(1));let a=await E(process.cwd()),o=T(a),s=n.modulesDir??o.dir??`src/modules`,c=jt(t),l=pe(a,process.cwd()),u=a?.pattern??`ddd`;u!==`ddd`&&(console.error(`\n Error: 'kick g scaffold' currently only supports the DDD pattern.\n Detected project pattern: '${u}'.\n Workarounds:\n - Run 'kick g module ${e}' for the ${u} layout (no fields), then add fields manually.\n - Override the pattern for this scaffold by setting kick.config.ts pattern: 'ddd'.\n`),process.exit(1));let d=await Mt({name:e,fields:c,modulesDir:N(s),noEntity:n.entity===!1,noTests:n.tests===!1,pluralize:n.pluralize===!1?!1:o.pluralize??!0,tokenScope:l,style:o.style});console.log(`\n Scaffolded ${e} with ${c.length} field(s):`);for(let e of c)console.log(` ${e.name}: ${e.type}${e.optional?` (optional)`:``}`);G(d,i),await qt(i)}),n.command(`config`).description(`Generate a kick.config.ts at the project root`).option(`--modules-dir <dir>`,`Modules directory path`,`src/modules`).option(`--repo <type>`,`Default repository type: inmemory | drizzle | prisma`,`inmemory`).option(`-f, --force`,`Overwrite existing kick.config.ts without prompting`).action(async(e,t)=>{let n=W(t);w(n),G(await ft({outDir:N(`.`),modulesDir:e.modulesDir,defaultRepo:e.repo,force:e.force}),n)}),n.command(`agents`).alias(`agent-docs`).alias(`ai-docs`).description(`Regenerate AGENTS.md + CLAUDE.md + kickjs-skills.md (sync after framework upgrades)`).option(`--only <which>`,`Limit scope: agents | claude | skills | both (agents+claude) | all (default: all)`,`all`).option(`--name <name>`,`Project name (defaults to package.json name)`).option(`--pm <pm>`,`Package manager (defaults to package.json packageManager)`).option(`--template <template>`,`Template: rest | ddd | cqrs | minimal`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t)=>{let n=W(t);w(n);let r=e.only??`all`;if(!Kt.includes(r)){console.error(` Invalid --only value: ${r}. Expected: ${Kt.join(` | `)}`),process.exitCode=1;return}G(await _t({outDir:N(`.`),only:r,name:e.name,pm:e.pm,template:e.template,force:e.force}),n)});for(let e of t?.generators??[])Qt(n,e)}function Qt(e,t){let{source:n,spec:r}=t,i=r.args?.[0],a=i?.name??`itemName`,o=i?.required?`<${a}>`:`[${a}]`,s=`${r.name} ${o} [extraArgs...]`,c=e.command(s).description(`${r.description} [${n}]`);for(let e of r.flags??[]){let t=e.takesValue?`--${e.name} <value>`:`--${e.name}`,n=e.alias?`-${e.alias}, ${t}`:t;c.option(n,e.description??``)}c.action(async(e,n,i,a)=>{let o=W(a);w(o);let s=await ie({generatorName:r.name,itemName:e??``,args:n??[],flags:i,cwd:process.cwd()},[t]);s&&G(s.files,o)})}function $t(e,t,n){let r=Be(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function en(e){let t=k.resolve(e.cwd,`.kickjs/types`);await Ne(t,{recursive:!0});let n=new Map,r=e.scan??ve,i={cwd:e.cwd,config:e.config,async importTs(e){return await import(R(e).href)},async writeFile(t,n){let r=k.resolve(e.cwd,t);await Ne(k.dirname(r),{recursive:!0}),await L(r,n,`utf8`)},getScanResult:e=>{let t=tn(e),i=n.get(t);return i||(i=r(e),n.set(t,i)),i},log:console},a=[];for(let n of e.plugins){let r=await n.generate(i);if(r===null){a.push({id:n.id,status:`skipped`});continue}let o=n.outExtension??`.d.ts`,s=k.join(t,`${n.id.replace(/\//g,`__`)}${o}`),c=`/* AUTO-GENERATED by kick typegen — do not edit. Plugin: ${n.id} */\n\n`+r+`
651
+ `),process.exit(1));let a=await E(process.cwd()),o=T(a),s=n.modulesDir??o.dir??`src/modules`,c=jt(t),l=pe(a,process.cwd()),u=a?.pattern??`ddd`;u!==`ddd`&&(console.error(`\n Error: 'kick g scaffold' currently only supports the DDD pattern.\n Detected project pattern: '${u}'.\n Workarounds:\n - Run 'kick g module ${e}' for the ${u} layout (no fields), then add fields manually.\n - Override the pattern for this scaffold by setting kick.config.ts pattern: 'ddd'.\n`),process.exit(1));let d=await Mt({name:e,fields:c,modulesDir:N(s),noEntity:n.entity===!1,noTests:n.tests===!1,pluralize:n.pluralize===!1?!1:o.pluralize??!0,tokenScope:l,style:o.style});console.log(`\n Scaffolded ${e} with ${c.length} field(s):`);for(let e of c)console.log(` ${e.name}: ${e.type}${e.optional?` (optional)`:``}`);G(d,i),await qt(i)}),n.command(`config`).description(`Generate a kick.config.ts at the project root`).option(`--modules-dir <dir>`,`Modules directory path`,`src/modules`).option(`--repo <type>`,`Default repository type: inmemory | drizzle | prisma`,`inmemory`).option(`-f, --force`,`Overwrite existing kick.config.ts without prompting`).action(async(e,t)=>{let n=W(t);w(n),G(await ft({outDir:N(`.`),modulesDir:e.modulesDir,defaultRepo:e.repo,force:e.force}),n)}),n.command(`agents`).alias(`agent-docs`).alias(`ai-docs`).description(`Regenerate AGENTS.md + CLAUDE.md + kickjs-skills.md (sync after framework upgrades)`).option(`--only <which>`,`Limit scope: agents | claude | skills | both (agents+claude) | all (default: all)`,`all`).option(`--name <name>`,`Project name (defaults to package.json name)`).option(`--pm <pm>`,`Package manager (defaults to package.json packageManager)`).option(`--template <template>`,`Template: rest | ddd | cqrs | minimal`).option(`-f, --force`,`Overwrite existing files without prompting`).action(async(e,t)=>{let n=W(t);w(n);let r=e.only??`all`;if(!Kt.includes(r)){console.error(` Invalid --only value: ${r}. Expected: ${Kt.join(` | `)}`),process.exitCode=1;return}G(await _t({outDir:N(`.`),only:r,name:e.name,pm:e.pm,template:e.template,force:e.force}),n)});for(let e of t?.generators??[])Qt(n,e,t?.projectRoot)}function Qt(e,t,n){let{source:r,spec:i}=t,a=i.args?.[0],o=a?.name??`itemName`,s=a?.required?`<${o}>`:`[${o}]`,c=`${i.name} ${s} [extraArgs...]`,l=e.command(c).description(`${i.description} [${r}]`);for(let e of i.flags??[]){let t=e.takesValue?`--${e.name} <value>`:`--${e.name}`,n=e.alias?`-${e.alias}, ${t}`:t;l.option(n,e.description??``)}l.action(async(e,r,a,o)=>{let s=W(o);w(s);let c=await ie({generatorName:i.name,itemName:e??``,args:r??[],flags:a,cwd:process.cwd(),projectRoot:n},[t]);c&&G(c.files,s)})}function $t(e,t,n){let r=Be(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function en(e){let t=k.resolve(e.cwd,`.kickjs/types`);await Ne(t,{recursive:!0});let n=new Map,r=e.scan??ve,i={cwd:e.cwd,config:e.config,async importTs(e){return await import(R(e).href)},async writeFile(t,n){let r=k.resolve(e.cwd,t);await Ne(k.dirname(r),{recursive:!0}),await L(r,n,`utf8`)},getScanResult:e=>{let t=tn(e),i=n.get(t);return i||(i=r(e),n.set(t,i)),i},log:console},a=[];for(let n of e.plugins){let r=await n.generate(i);if(r===null){a.push({id:n.id,status:`skipped`});continue}let o=n.outExtension??`.d.ts`,s=k.join(t,`${n.id.replace(/\//g,`__`)}${o}`),c=`/* AUTO-GENERATED by kick typegen — do not edit. Plugin: ${n.id} */\n\n`+r+`
652
652
  `,l=``;if(P(s)&&(l=await I(s,`utf8`)),l===c){a.push({id:n.id,status:`unchanged`,outFile:s});continue}if(e.check)throw Error(`kick typegen --check: drift detected for ${n.id} (${s})`);await L(s,c,`utf8`),a.push({id:n.id,status:`written`,outFile:s})}return a}function tn(e){let t=(e.extensions??[]).slice().toSorted().join(`,`),n=(e.exclude??[]).slice().toSorted().join(`,`);return[`root=${e.root}`,`cwd=${e.cwd}`,`extensions=${t}`,`exclude=${n}`,`envFile=${e.envFile??``}`].join(`|`)}function nn(e,t){let n=new Set(t),r=[],i=[],a=new Set;for(let t of e)n.has(t.id)?(i.push(t),a.add(t.id)):r.push(t);return{enabled:r,skipped:i,unknown:[...n].filter(e=>!a.has(e))}}async function rn(e){let{enabled:t,skipped:n,unknown:r}=nn(ge([...Lr,...e.config?.plugins??[]],e.config?.commands??[]).typegens,e.config?.typegen?.disable??[]);if(!e.silent&&n.length>0)for(let e of n)console.log(` ${e.id}: disabled (typegen.disable)`);if(!e.silent&&r.length>0&&console.warn(` kick typegen: disable list references unknown id(s): ${r.map(e=>`'${e}'`).join(`, `)}. Run \`kick typegen --list\` to see registered ids.`),t.length===0)return[];try{let n=await en({cwd:e.cwd,config:e.config??{},plugins:t,check:e.check});if(!e.silent)for(let e of n)console.log(` ${e.id}: ${e.status}`);return n}catch(t){if(!e.silent){let e=t instanceof Error?t.message:String(t);console.warn(` kick typegen plugins: skipped (${e})`)}return[]}}async function an(e,t){let{cwd:n,silent:r=!1}=t,i=t.distDir??e?.build?.outDir??`dist`,a=e?.assetMap;if(!a||Object.keys(a).length===0)return null;let o=r?()=>{}:console.log,s=N(n,i);De(s,{recursive:!0});let c=[],l={};for(let[e,t]of Object.entries(a)){let r=await on(e,t,n,s);c.push(r.entrySummary),Object.assign(l,r.manifestSlice),o(` ✓ ${e}: ${r.entrySummary.filesCopied} file(s) → ${r.entrySummary.dest}`)}let u={version:1,entries:l},d=j(s,`.kickjs-assets.json`);return je(d,JSON.stringify(u,null,2)+`
653
653
  `,`utf-8`),o(` ✓ wrote manifest → ${M(n,d)} (${Object.keys(l).length} entries)`),{manifestPath:d,entries:c,manifest:u}}async function on(e,t,n,r){let i=N(n,t.src),a=t.dest?N(n,t.dest):j(r,e);if(cn(a,n))return console.warn(` ⚠ assetMap.${e}.dest ('${t.dest}') resolves outside the project root — skipping copy`),{entrySummary:{namespace:e,src:t.src,dest:M(n,a),filesCopied:0},manifestSlice:{}};if(!P(i)||!ln(i))return{entrySummary:{namespace:e,src:t.src,dest:M(n,a),filesCopied:0},manifestSlice:{}};let o=await Ve(t.glob??`**/*`,{cwd:i,nodir:!0,dot:!1,posix:!0});De(a,{recursive:!0});let s={},{pairs:c,collisionGroupsResolved:l}=He(e,[...o].toSorted(),{strategy:t.keys??`auto`});for(let{rel:e,key:t}of c){let n=j(i,e),o=j(a,e);De(A(o),{recursive:!0}),Ee(n,o),s[t]=sn(r,o)}return l>0&&console.log(` ℹ assetMap.${e}: auto-resolved ${l} basename collision(s) by keeping extensions (set 'keys: "strip"' to opt back into legacy last-write-wins behaviour, or 'keys: "with-extension"' to keep all keys verbose).`),{entrySummary:{namespace:e,src:t.src,dest:M(n,a),filesCopied:o.length},manifestSlice:s}}function sn(e,t){return M(e,t).split(/[\\/]/).filter(Boolean).join(`/`)}function cn(e,t){let n=M(t,e);return n===``?!1:n.startsWith(`..`)||we(n)}function ln(e){try{return Ae(e).isDirectory()}catch{return!1}}function un(e){if(typeof e==`boolean`)return e;let t=process.env.KICKJS_WATCH_POLLING;return t===`1`||t===`true`}async function dn(e,t,n={}){t&&(process.env.PORT=t);let r=un(n.polling),i=process.cwd(),a=await E(i),o=a?.typegen?.schemaValidator??`zod`,s=a?.typegen?.envFile;try{await O({cwd:i,allowDuplicates:!0,schemaValidator:o,envFile:s,srcDir:a?.typegen?.srcDir,outDir:a?.typegen?.outDir,assetMap:a?.assetMap,runPlugins:!1})}catch(e){console.warn(` kick typegen: skipped (${e?.message??e})`)}await rn({cwd:i,config:a});let{createRequire:c}=await import(`node:module`),{createServer:l}=await import(R(c(N(`package.json`)).resolve(`vite`)).href),u=await l({configFile:N(`vite.config.ts`),server:{port:t?parseInt(t,10):void 0,...r?{watch:{usePolling:!0,interval:100}}:{}}}),d=a?.assetMap?Object.values(a.assetMap).map(e=>e?.src).filter(e=>typeof e==`string`&&e.length>0).map(e=>N(i,e)):[],f=e=>d.some(t=>e===t||e.startsWith(`${t}/`)),p=null,m=e=>{if(e.includes(`.kickjs`)||e.endsWith(`.d.ts`))return;let t=/\.(ts|tsx|mts|cts)$/.test(e),n=f(e);!t&&!n||(p&&clearTimeout(p),p=setTimeout(()=>{O({cwd:i,silent:!0,allowDuplicates:!0,schemaValidator:o,envFile:s,srcDir:a?.typegen?.srcDir,outDir:a?.typegen?.outDir,assetMap:a?.assetMap,runPlugins:!1}).catch(()=>{}),rn({cwd:i,config:a,silent:!0}).catch(()=>{})},100))};u.watcher.on(`add`,m),u.watcher.on(`unlink`,m),u.watcher.on(`change`,m),d.length>0&&u.watcher.add(d),await u.listen(),u.printUrls(),console.log(`
654
654
  KickJS dev server running (Vite + @forinda/kickjs-vite)
@@ -850,7 +850,7 @@ server.on('exit', () => {
850
850
  Cancelled.
851
851
  `);return}await Fe(d,{recursive:!0,force:!0}),console.log(` Deleted: ${d}`);let h=j(n,`index.ts`);if(await f(h)){let e=await I(h,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${C(l)}Module\\s*\\}\\s*from\\s*['"][^'"]*${C(u)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Yn(e,l),e=e.replace(/\n{3,}/g,`
852
852
 
853
- `),e!==t&&(await L(h,e,`utf-8`),console.log(` Unregistered: ${l}Module from ${h}`))}console.log(`\n Module '${u}' removed.\n`)}function Zn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Xn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Qn(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;console.warn(` kick typegen: unknown --schema-validator '${e}' (only 'zod' and 'false' are supported). Falling back to project config.`)}}function $n(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function er(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: fail on plugin-typegen drift instead of writing`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").action(async e=>{let t=he(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-B6ANfh7O.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-BIpoT6cb.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
853
+ `),e!==t&&(await L(h,e,`utf-8`),console.log(` Unregistered: ${l}Module from ${h}`))}console.log(`\n Module '${u}' removed.\n`)}function Zn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Xn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Qn(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;console.warn(` kick typegen: unknown --schema-validator '${e}' (only 'zod' and 'false' are supported). Falling back to project config.`)}}function $n(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function er(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: fail on plugin-typegen drift instead of writing`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").action(async e=>{let t=he(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-1Oiz9_TD.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-CF4q3JIg.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
854
854
  Registered typegen plugins:
855
855
  `);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``;console.log(` ${e.id.padEnd(a+2)}inputs: ${e.inputs.join(`, `)||`(none)`}${t}`)}console.log();return}let r=Qn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=$n(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,allowDuplicates:e.allowDuplicates,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await ye(a);e.silent||console.log(` kick typegen: watching for changes (Ctrl-C to exit)`);let n=()=>{t(),process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n),await new Promise(()=>{})}else{let{result:r}=await O(a),i=await rn({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&i.some(e=>e.status===`written`)&&process.exit(1),e.check||await be(N(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r.written,i,e.silent??!1)}}catch(e){e instanceof Se?console.error(`
856
856
  `+e.message+`
@@ -928,4 +928,4 @@ declare global {
928
928
 
929
929
  export {}
930
930
  `}const Pr=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Ir(e);if(t===!1)return null;let n=await e.getScanResult({root:Fr(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=k.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return Nr(n.env,r)}});function Fr(e){return k.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Ir(e){return e.config?.typegen?.envFile}const Lr=[D({name:`kick/init`,register:ut}),D({name:`kick/generate`,register:Zt}),D({name:`kick/run`,register:fn}),D({name:`kick/info`,register:pn}),D({name:`kick/inspect`,register:Sn}),D({name:`kick/add`,register:ct}),D({name:`kick/list`,register:st}),D({name:`kick/explain`,register:Mn}),D({name:`kick/mcp`,register:Vn}),D({name:`kick/tinker`,register:Gn}),D({name:`kick/remove`,register:Zn}),D({name:`kick/typegen`,register:er}),D({name:`kick/check`,register:fr}),D({name:`kick/db`,register:hr,typegens:[yr()]}),D({name:`kick/codemod`,register:_r}),D({name:`kick/assets`,typegens:[Sr()]}),D({name:`kick/routes`,typegens:[Ar()]}),D({name:`kick/env`,typegens:[Pr()]})];export{nn as applyDisableFilter,rn as runAllPluginTypegens,Lr as t};
931
- //# sourceMappingURL=run-plugins-DaO1FtZb.mjs.map
931
+ //# sourceMappingURL=run-plugins-Bg8kTYfa.mjs.map