@forinda/kickjs-cli 5.1.0 → 5.2.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.
Files changed (27) hide show
  1. package/dist/{builtins-caRjFvKz.mjs → builtins-B0dptoXq.mjs} +626 -241
  2. package/dist/builtins-B0dptoXq.mjs.map +1 -0
  3. package/dist/{builtins-Cb_d-b1S.mjs → builtins-N3mDa6bM.mjs} +695 -273
  4. package/dist/cli.mjs +9 -9
  5. package/dist/{config-8bAt-mLl.mjs → config-Bc6ERRTE.mjs} +35 -5
  6. package/dist/{config-C_LQNClP.mjs → config-CRi3zCxk.mjs} +36 -6
  7. package/dist/config-CRi3zCxk.mjs.map +1 -0
  8. package/dist/{generator-extension-CYY-RI21.mjs → generator-extension-C-HwKvFf.mjs} +76 -39
  9. package/dist/generator-extension-C-HwKvFf.mjs.map +1 -0
  10. package/dist/index.d.mts +282 -1
  11. package/dist/index.d.mts.map +1 -1
  12. package/dist/index.mjs +4 -4
  13. package/dist/{plugin-D8K5fG-O.mjs → plugin-DfomEcef.mjs} +4 -4
  14. package/dist/{plugin-D8K5fG-O.mjs.map → plugin-DfomEcef.mjs.map} +1 -1
  15. package/dist/{plugin-Bgfg7qMk.mjs → plugin-b7ig7Uxv.mjs} +2 -2
  16. package/dist/{rolldown-runtime-BM29JyaJ.mjs → rolldown-runtime-CV_zlh2d.mjs} +1 -1
  17. package/dist/{run-plugins-BXvMFPhJ.mjs → run-plugins-D9abb5Nx.mjs} +2 -2
  18. package/dist/{typegen-BNz_RQTb.mjs → typegen-B9S81bOx.mjs} +48 -225
  19. package/dist/typegen-B9S81bOx.mjs.map +1 -0
  20. package/dist/{typegen-8ZeA1B-X.mjs → typegen-BKUAdp_3.mjs} +47 -228
  21. package/dist/{types-BBUo1vXh.mjs → types-CU89yUxU.mjs} +2 -2
  22. package/dist/{types-BBUo1vXh.mjs.map → types-CU89yUxU.mjs.map} +1 -1
  23. package/package.json +6 -4
  24. package/dist/builtins-caRjFvKz.mjs.map +0 -1
  25. package/dist/config-C_LQNClP.mjs.map +0 -1
  26. package/dist/generator-extension-CYY-RI21.mjs.map +0 -1
  27. package/dist/typegen-8ZeA1B-X.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,6 +1,206 @@
1
1
 
2
2
  import { Command } from "commander";
3
3
 
4
+ //#region src/typegen/scanner.d.ts
5
+ /**
6
+ * Static scanner for KickJS decorated classes and DI tokens.
7
+ *
8
+ * Walks `src/**\/*.ts` (excluding tests and node_modules) and extracts:
9
+ *
10
+ * - Decorated classes (`@Service`, `@Controller`, `@Repository`, etc.)
11
+ * - `createToken<T>('name')` definitions
12
+ * - `@Inject('literal')` calls
13
+ *
14
+ * The output feeds the type generator, which emits `.kickjs/types/*.d.ts`
15
+ * files used by the user's tsc to make `container.resolve()` and module
16
+ * discovery type-safe.
17
+ *
18
+ * This is intentionally regex-based (not AST-based) to avoid the
19
+ * ts-morph / typescript compiler dependency. Pattern from
20
+ * `packages/vite/src/module-discovery.ts` which already uses regex
21
+ * to detect `*.module.ts` exports.
22
+ *
23
+ * ## Collision detection
24
+ *
25
+ * Two classes with the same name across different files is a collision.
26
+ * The scanner records all collisions in `ScanResult.collisions` so the
27
+ * caller (generator) can decide whether to hard-error or auto-namespace.
28
+ *
29
+ * @module @forinda/kickjs-cli/typegen/scanner
30
+ */
31
+ /** Decorators that mark a class as DI-managed */
32
+ declare const DECORATOR_NAMES: readonly ["Service", "Controller", "Repository", "Injectable", "Component", "Module"];
33
+ type DecoratorName = (typeof DECORATOR_NAMES)[number];
34
+ /** A single discovered decorated class */
35
+ interface DiscoveredClass {
36
+ /** Class name (e.g., 'UserService') */
37
+ className: string;
38
+ /** Decorator that marked it (e.g., 'Service') */
39
+ decorator: DecoratorName;
40
+ /** Absolute file path */
41
+ filePath: string;
42
+ /** Path relative to scan root, with forward slashes */
43
+ relativePath: string;
44
+ /** True if exported as `default` */
45
+ isDefault: boolean;
46
+ }
47
+ /** A single route handler discovered on a controller class */
48
+ interface DiscoveredRoute {
49
+ /** Owning controller class name (e.g. 'UserController') */
50
+ controller: string;
51
+ /** Handler method name on the controller (e.g. 'getUser') */
52
+ method: string;
53
+ /** HTTP verb (uppercase) */
54
+ httpMethod: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
55
+ /** Route path including parameter placeholders (e.g. '/:id/posts/:postId') */
56
+ path: string;
57
+ /** URL path parameter names extracted from `:placeholder` segments */
58
+ pathParams: string[];
59
+ /**
60
+ * Whitelisted query field names extracted from `@ApiQueryParams({...})`.
61
+ * `null` means no `@ApiQueryParams` was found on this method (so the
62
+ * generator emits an unconstrained `query` shape). An empty array means
63
+ * the decorator existed but no fields could be statically extracted
64
+ * (e.g. an opaque imported config).
65
+ */
66
+ queryFilterable: string[] | null;
67
+ querySortable: string[] | null;
68
+ querySearchable: string[] | null;
69
+ /**
70
+ * Schema identifiers referenced from the route decorator's second arg
71
+ * (e.g. `@Post('/', { body: createTaskSchema })`). `null` means no
72
+ * such reference; the value carries the identifier and the resolved
73
+ * import source (relative module path) if known.
74
+ */
75
+ bodySchema: SchemaRef | null;
76
+ querySchema: SchemaRef | null;
77
+ paramsSchema: SchemaRef | null;
78
+ /** Absolute file path of the controller */
79
+ filePath: string;
80
+ /** Path relative to scan root, with forward slashes */
81
+ relativePath: string;
82
+ }
83
+ /** A statically-resolved schema identifier reference */
84
+ interface SchemaRef {
85
+ /** The identifier as written (e.g. `createTaskSchema`) */
86
+ identifier: string;
87
+ /**
88
+ * Resolved module specifier (relative path or bare module name) where
89
+ * the identifier is defined. `null` means the source could not be
90
+ * statically determined (the generator falls back to `unknown`).
91
+ */
92
+ source: string | null;
93
+ }
94
+ /** A `createToken<T>('name')` call discovered in source */
95
+ interface DiscoveredToken {
96
+ /** The literal string passed to `createToken()` */
97
+ name: string;
98
+ /** The const variable name on the LHS, if any */
99
+ variable: string | null;
100
+ /** Absolute file path */
101
+ filePath: string;
102
+ /** Path relative to scan root, with forward slashes */
103
+ relativePath: string;
104
+ }
105
+ /** An `@Inject('literal')` call discovered in source */
106
+ interface DiscoveredInject {
107
+ /** The literal string passed to `@Inject()` */
108
+ name: string;
109
+ /** Absolute file path */
110
+ filePath: string;
111
+ /** Path relative to scan root, with forward slashes */
112
+ relativePath: string;
113
+ }
114
+ /** A name collision — same class name in two or more files */
115
+ interface ClassCollision {
116
+ /** The colliding class name */
117
+ className: string;
118
+ /** All files declaring the class */
119
+ classes: DiscoveredClass[];
120
+ }
121
+ /**
122
+ * Information about a discovered env schema file. The typegen
123
+ * generator uses this to emit a `KickEnv` + `NodeJS.ProcessEnv`
124
+ * augmentation that flows through to `@Value` and `process.env`.
125
+ *
126
+ * `null` means no env file was found at the configured location.
127
+ */
128
+ interface DiscoveredEnv {
129
+ /** Absolute path to the env schema file */
130
+ filePath: string;
131
+ /** Path relative to scan root, with forward slashes */
132
+ relativePath: string;
133
+ }
134
+ /**
135
+ * A plugin or adapter discovered in source — either via `defineAdapter({ name })`
136
+ * / `definePlugin({ name })` calls, or via a class that `implements AppAdapter`
137
+ * and declares a string-literal `name` field.
138
+ *
139
+ * The `name` here is the literal string passed to the framework (the value
140
+ * `dependsOn` references), NOT the symbol on the LHS. `defineAdapter` lets
141
+ * authors choose any name they want; the symbol is irrelevant at runtime.
142
+ */
143
+ interface DiscoveredPluginOrAdapter {
144
+ /** Whether this is a plugin (`definePlugin`) or adapter (`defineAdapter` / class) */
145
+ kind: 'plugin' | 'adapter';
146
+ /** The string literal passed as `name` (the value `dependsOn` references) */
147
+ name: string;
148
+ /** Absolute file path */
149
+ filePath: string;
150
+ /** Path relative to scan root, with forward slashes */
151
+ relativePath: string;
152
+ }
153
+ /**
154
+ * A `defineAugmentation('Name', meta)` call discovered in source. Plugins
155
+ * call this to advertise an augmentable interface so the typegen can list
156
+ * every augmentation surface in one generated file.
157
+ */
158
+ interface DiscoveredAugmentation {
159
+ /** The literal string passed as the first arg to `defineAugmentation` */
160
+ name: string;
161
+ /** Optional `description` extracted from the second-arg object literal */
162
+ description: string | null;
163
+ /** Optional `example` extracted from the second-arg object literal */
164
+ example: string | null;
165
+ /** Absolute file path */
166
+ filePath: string;
167
+ /** Path relative to scan root, with forward slashes */
168
+ relativePath: string;
169
+ }
170
+ /** Aggregated scanner output */
171
+ interface ScanResult {
172
+ classes: DiscoveredClass[];
173
+ routes: DiscoveredRoute[];
174
+ tokens: DiscoveredToken[];
175
+ injects: DiscoveredInject[];
176
+ collisions: ClassCollision[];
177
+ /** Discovered env schema file (or null if none found at the configured path) */
178
+ env: DiscoveredEnv | null;
179
+ /** Plugins/adapters discovered via `defineAdapter`/`definePlugin`/`implements AppAdapter` */
180
+ pluginsAndAdapters: DiscoveredPluginOrAdapter[];
181
+ /** Augmentation interfaces declared via `defineAugmentation('Name', meta)` */
182
+ augmentations: DiscoveredAugmentation[];
183
+ }
184
+ /** Options for the scanner */
185
+ interface ScanOptions {
186
+ /** Root directory to scan (e.g., absolute path to `src`) */
187
+ root: string;
188
+ /** Project root used to compute relative paths (e.g., process.cwd()) */
189
+ cwd: string;
190
+ /** Glob-like extensions to scan */
191
+ extensions?: string[];
192
+ /** Substrings that exclude a path (matched against relative path) */
193
+ exclude?: string[];
194
+ /**
195
+ * Path to the env schema file, relative to `cwd`. Defaults to
196
+ * `'src/env.ts'`. The file must contain a `defineEnv(...)` call
197
+ * with a default export for the typegen to emit a typed `KickEnv`
198
+ * augmentation. If the file does not exist or doesn't match the
199
+ * expected shape, env typing is skipped silently.
200
+ */
201
+ envFile?: string;
202
+ }
203
+ //#endregion
4
204
  //#region src/typegen/plugin.d.ts
5
205
  interface TypegenLogger {
6
206
  info(msg: string): void;
@@ -15,13 +215,45 @@ interface TypegenContext {
15
215
  importTs<T = unknown>(absPath: string): Promise<T>;
16
216
  /** Write under `cwd`. Caller passes a relPath (e.g. `.kickjs/types/foo.d.ts`). */
17
217
  writeFile(relPath: string, contents: string): Promise<void>;
218
+ /**
219
+ * Run `scanProject` once per typegen pass, memoizing the result so
220
+ * multiple plugins (`kick/routes`, `kick/env`, future adopter plugins)
221
+ * share a single fs walk + AST extraction.
222
+ *
223
+ * The runner uses an order-independent cache key derived from the
224
+ * resolved options (`root`, `cwd`, `extensions`, `exclude`, `envFile`)
225
+ * — semantically equal options hit the cache regardless of how the
226
+ * caller built the literal. (We deliberately don't `JSON.stringify`
227
+ * the options for caching since that would be sensitive to property
228
+ * insertion order.) Plugins that don't need scanner data can ignore
229
+ * this method entirely.
230
+ *
231
+ * Implementation lives in the runner so test harnesses can inject
232
+ * a stub scanner; plugins only see the function.
233
+ */
234
+ getScanResult(opts: ScanOptions): Promise<ScanResult>;
18
235
  log: TypegenLogger;
19
236
  }
20
237
  interface TypegenPlugin {
21
- /** Stable id — used as filename: `.kickjs/types/${id}.d.ts` (slashes → `__`). */
238
+ /** Stable id — used as filename: `.kickjs/types/${id}<outExtension>` (slashes → `__`). */
22
239
  id: string;
23
240
  /** Glob patterns the Vite watcher subscribes to; change → re-run this plugin. */
24
241
  inputs: string[];
242
+ /**
243
+ * Output filename extension. Default `.d.ts` — the right choice for
244
+ * pure module-augmentation plugins (kick/db, kick/assets) since
245
+ * declaration files don't need the runtime-import dance.
246
+ *
247
+ * `kick/routes` overrides to `.ts` because it emits hoisted
248
+ * `import type {...} from '...'` lines at the top of the file. Inline
249
+ * `import('...').X` references inside `.d.ts` silently degrade to
250
+ * `unknown` under `moduleResolution: 'bundler'`; emitting `.ts`
251
+ * sidesteps that quirk and gets full type resolution.
252
+ *
253
+ * Adopter-supplied plugins should leave this unset unless they hit
254
+ * the same hoisted-import constraint.
255
+ */
256
+ outExtension?: string;
25
257
  /**
26
258
  * Return the augmentation source (without banner — runner prepends).
27
259
  * Return null to skip emission (e.g. no schema file present).
@@ -263,6 +495,28 @@ interface AssetMapEntry {
263
495
  * selective by design (unlike `copyDirs` which copies everything).
264
496
  */
265
497
  glob?: string;
498
+ /**
499
+ * How file extensions feed into manifest keys. Default `'auto'`.
500
+ *
501
+ * - `'strip'` — drop the extension. `pages/index.pug` →
502
+ * `'pages/index'`. Two siblings with the same basename collide;
503
+ * last-walk-order wins, others are silently dropped. Opt-in
504
+ * only — kept for backward compatibility with projects that
505
+ * relied on this contract.
506
+ * - `'with-extension'` — keep every extension on every key. Best
507
+ * when the namespace holds extension siblings (`index.pug` +
508
+ * `index.html` + `index.css` in `src/pages/`); every file
509
+ * reaches the manifest under its full path.
510
+ * - `'auto'` — strip when basenames are unique, keep extensions
511
+ * on collision groups. Singleton files keep their short key;
512
+ * `pages/index.{pug,html,css}` becomes
513
+ * `pages/index.pug` / `pages/index.html` / `pages/index.css`.
514
+ * No data loss; non-colliding namespaces stay on the short
515
+ * keys they had before.
516
+ *
517
+ * @default 'auto'
518
+ */
519
+ keys?: 'auto' | 'strip' | 'with-extension';
266
520
  }
267
521
  /** Typegen settings — controls .kickjs/types/* generation */
268
522
  interface TypegenConfig {
@@ -393,6 +647,25 @@ interface KickConfig {
393
647
  * packageManager: 'pnpm'
394
648
  */
395
649
  packageManager?: PackageManager;
650
+ /**
651
+ * DI token scope prefix used by code generators. Every scaffolded
652
+ * `createToken<T>('<scope>/<area>/<key>')` substitutes this string
653
+ * for `<scope>`. Generators emit org-scoped tokens out of the box
654
+ * so adopter projects pass `kick-lint`'s `token-reserved-prefix`
655
+ * rule (which forbids the reserved `kick/` prefix on third-party
656
+ * code) without manual rename.
657
+ *
658
+ * Resolution order (highest first):
659
+ * 1. This field, when set
660
+ * 2. `package.json` `name` field — `@scope/pkg` → `'scope'`,
661
+ * bare `pkg` → `'pkg'`
662
+ * 3. Fallback `'app'`
663
+ *
664
+ * @example
665
+ * tokenScope: 'mycorp'
666
+ * // → createToken<...>('mycorp/users/repository')
667
+ */
668
+ tokenScope?: string;
396
669
  /**
397
670
  * Directories to copy to dist/ after build.
398
671
  * Useful for EJS templates, email templates, static assets, etc.
@@ -510,6 +783,14 @@ interface GenerateModuleOptions {
510
783
  pluralize?: boolean;
511
784
  /** Prisma client import path (default: '@prisma/client', Prisma 7+: '@/generated/prisma/client') */
512
785
  prismaClientPath?: string;
786
+ /**
787
+ * DI-token scope prefix substituted into emitted `createToken<T>()`
788
+ * literals. Resolved by the orchestrating command from
789
+ * `kick.config.ts > tokenScope` or the project's package.json.
790
+ * Falls back to `'app'` when not set so the generator can be called
791
+ * without a config in tests/fixtures.
792
+ */
793
+ tokenScope?: string;
513
794
  }
514
795
  /**
515
796
  * Generate a module — structure depends on the project pattern.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/plugin/types.ts","../src/config.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/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;UAWiB,aAAA;EACf,IAAA,CAAK,GAAA;EACL,IAAA,CAAK,GAAA;EACL,KAAA,CAAM,GAAA;AAAA;AAAA,UAGS,cAAA;EACf,GAAA;EACA,MAAA,EAAQ,UAAA;EANR;;EASA,QAAA,cAAsB,OAAA,WAAkB,OAAA,CAAQ,CAAA;EAR1C;EAUN,SAAA,CAAU,OAAA,UAAiB,QAAA,WAAmB,OAAA;EAC9C,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,aAAA;EAXc;EAa7B,EAAA;EARgD;EAUhD,MAAA;EAR8C;;;;EAa9C,QAAA,CAAS,GAAA,EAAK,cAAA,GAAiB,OAAA;AAAA;AAAA,UAGhB,mBAAA;EACf,EAAA;EACA,MAAA;EACA,OAAA;AAAA;;;;;;AAhCF;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;UCgBiB,gBAAA;EDPuB;ECStC,IAAA;EDdA;ECgBA,MAAA;EDXc;ECad,KAAA;EDb+B;ECe/B,KAAA;EDfsC;ECiBtC,KAAA;EDdkC;ECgBlC,YAAA;EDhBk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AAS,kBAAA,GAAqB,OAAA;;;KCsB3D,eAAA;AAAA,UAEK,kBAAA;EACR,IAAA;EACA,SAAA;EACA,cAAA;EACA,OAAA;EACA,WAAA;EACA,QAAA,GAAW,eAAA;EACX,WAAA;EACA,QAAA;AAAA;;iBAIoB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA;;;;;AXxChE;;;UYCiB,mBAAA;EACf,MAAA;EACA,IAAA,EAAM,aAAA;AAAA;;;;;;UAQS,eAAA;EACf,UAAA,EAAY,mBAAA;EZNiB;EYQ7B,MAAA;EZHgD;;;;EYQhD,MAAA,EAAQ,KAAA;IAAQ,MAAA;IAAgB,MAAA;EAAA;AAAA;;;;;AZnBlC;;;;iBaKgB,qBAAA,CAAsB,KAAA;EACpC,IAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;EACR,UAAA;EACA,GAAA;EACA,SAAA;AAAA,IACE,gBAAA;;;;iBCpBY,YAAA,CAAa,IAAA;;iBAOb,WAAA,CAAY,IAAA;;iBAMZ,WAAA,CAAY,IAAA;;;;;;iBAYZ,SAAA,CAAU,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/plugin/types.ts","../src/config.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/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;;;;AAgCA;;;;;AASA;;;;;AAGA;;;;;;;;;;;;AAcA;;cA1Ba,eAAA;AAAA,KASD,aAAA,WAAwB,eAAA;;UAGnB,eAAA;EA2CQ;EAzCvB,SAAA;EAcA;EAZA,SAAA,EAAW,aAAA;EAgBX;EAdA,QAAA;EAkBA;EAhBA,YAAA;EAyBA;EAvBA,SAAA;AAAA;;UAIe,eAAA;EA4BF;EA1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AAA,EAAS,kBAAA,GAAqB,OAAA;;;;;AZnBhE;;;UapBiB,mBAAA;EACf,MAAA;EACA,IAAA,EAAM,aAAA;AAAA;;;;Ab8BR;;UatBiB,eAAA;EACf,UAAA,EAAY,mBAAA;EbuBZ;EarBA,MAAA;EbuBW;;;;EalBX,MAAA,EAAQ,KAAA;IAAQ,MAAA;IAAgB,MAAA;EAAA;AAAA;;;;;AbElC;;;;iBchBgB,qBAAA,CAAsB,KAAA;EACpC,IAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;EACR,UAAA;EACA,GAAA;EACA,SAAA;AAAA,IACE,gBAAA;;;;iBCpBY,YAAA,CAAa,IAAA;;iBAOb,WAAA,CAAY,IAAA;;iBAMZ,WAAA,CAAY,IAAA;;;AfyB5B;;;iBebgB,SAAA,CAAU,IAAA"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.1.0
2
+ * @forinda/kickjs-cli v5.2.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 { _ as pluralize, a as initProject, b as toKebabCase, d as generateService, f as generateGuard, h as generateModule, i as defineGenerator, l as generateDto, m as generateAdapter, p as generateMiddleware, r as buildGeneratorContext, u as generateController, x as toPascalCase, y as toCamelCase } from "./generator-extension-CYY-RI21.mjs";
12
- import { i as loadKickConfig, r as defineConfig } from "./config-C_LQNClP.mjs";
13
- import { n as defineCliPlugin, t as KickPluginConflictError } from "./types-BBUo1vXh.mjs";
11
+ import { _ as pluralize, a as initProject, b as toKebabCase, d as generateService, f as generateGuard, h as generateModule, i as defineGenerator, l as generateDto, m as generateAdapter, p as generateMiddleware, r as buildGeneratorContext, u as generateController, x as toPascalCase, y as toCamelCase } from "./generator-extension-C-HwKvFf.mjs";
12
+ import { i as loadKickConfig, r as defineConfig } from "./config-CRi3zCxk.mjs";
13
+ import { n as defineCliPlugin, t as KickPluginConflictError } from "./types-CU89yUxU.mjs";
14
14
  export { KickPluginConflictError, buildGeneratorContext, defineCliPlugin, defineConfig, defineGenerator, generateAdapter, generateController, generateDto, generateGuard, generateMiddleware, generateModule, generateService, initProject, loadKickConfig, pluralize, toCamelCase, toKebabCase, toPascalCase };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.1.0
2
+ * @forinda/kickjs-cli v5.2.1
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,8 +8,8 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as __exportAll } from "./rolldown-runtime-BM29JyaJ.mjs";
12
- import { t as KickPluginConflictError } from "./types-BBUo1vXh.mjs";
11
+ import { t as __exportAll } from "./rolldown-runtime-CV_zlh2d.mjs";
12
+ import { t as KickPluginConflictError } from "./types-CU89yUxU.mjs";
13
13
  //#region src/plugin/merge.ts
14
14
  function mergeCliPlugins(plugins, adopterCommands = []) {
15
15
  const seenPluginNames = /* @__PURE__ */ new Map();
@@ -68,4 +68,4 @@ var plugin_exports = /* @__PURE__ */ __exportAll({ mergeCliPlugins: () => mergeC
68
68
  //#endregion
69
69
  export { mergeCliPlugins as n, plugin_exports as t };
70
70
 
71
- //# sourceMappingURL=plugin-D8K5fG-O.mjs.map
71
+ //# sourceMappingURL=plugin-DfomEcef.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-D8K5fG-O.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 const resolved: KickCliPluginContext = ctx ?? {\n cwd: process.cwd(),\n config: null,\n log: () => {},\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":";;;;;;;;;;;;;AA4CA,SAAgB,gBACd,SACA,kBAAoD,EAAE,EACvC;CAEf,MAAM,kCAAkB,IAAI,KAAqB;AACjD,MAAK,MAAM,KAAK,SAAS;EACvB,MAAM,SAAS,gBAAgB,IAAI,EAAE,KAAK,IAAI,KAAK;AACnD,kBAAgB,IAAI,EAAE,MAAM,MAAM;AAClC,MAAI,UAAU,EACZ,OAAM,IAAI,wBAAwB,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC;;CAIzE,MAAM,gCAAgB,IAAI,KAAqB;C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AAO;GAC5C,KAAK,QAAQ,KAAK;GAClB,QAAQ;GACR,WAAW;GACZ;AACD,OAAK,MAAM,KAAK,QACd,KAAI,EAAE,SAAU,OAAM,EAAE,SAAS,SAAS,SAAS;;AAIvD,QAAO;EAAE;EAAU;EAAU;EAAY;EAAU"}
1
+ {"version":3,"file":"plugin-DfomEcef.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 const resolved: KickCliPluginContext = ctx ?? {\n cwd: process.cwd(),\n config: null,\n log: () => {},\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":";;;;;;;;;;;;;AA4CA,SAAgB,gBACd,SACA,kBAAoD,EAAE,EACvC;CAEf,MAAM,kCAAkB,IAAI,KAAqB;AACjD,MAAK,MAAM,KAAK,SAAS;EACvB,MAAM,SAAS,gBAAgB,IAAI,EAAE,KAAK,IAAI,KAAK;AACnD,kBAAgB,IAAI,EAAE,MAAM,MAAM;AAClC,MAAI,UAAU,EACZ,OAAM,IAAI,wBAAwB,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC;;CAIzE,MAAM,gCAAgB,IAAI,KAAqB;CAC/C,MAAM,iBAA0C,EAAE;AAClD,MAAK,MAAM,KAAK,QACd,MAAK,MAAM,OAAO,EAAE,YAAY,EAAE,EAAE;EAClC,MAAM,QAAQ,cAAc,IAAI,IAAI,KAAK;AACzC,MAAI,MACF,OAAM,IAAI,wBAAwB,WAAW,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;AAEzE,gBAAc,IAAI,IAAI,MAAM,EAAE,KAAK;AACnC,iBAAe,KAAK,IAAI;;CAI5B,MAAM,eAAe,IAAI,IAAI,gBAAgB,KAAK,MAAM,EAAE,KAAK,CAAC;CAEhE,MAAM,WAAW,CAAC,GADK,eAAe,QAAQ,MAAM,CAAC,aAAa,IAAI,EAAE,KAAK,CAAC,EACzC,GAAG,gBAAgB;CAExD,MAAM,gCAAgB,IAAI,KAAqB;CAC/C,MAAM,WAA4B,EAAE;AACpC,MAAK,MAAM,KAAK,QACd,MAAK,MAAM,MAAM,EAAE,YAAY,EAAE,EAAE;EACjC,MAAM,QAAQ,cAAc,IAAI,GAAG,GAAG;AACtC,MAAI,MACF,OAAM,IAAI,wBAAwB,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;AAEtE,gBAAc,IAAI,GAAG,IAAI,EAAE,KAAK;AAChC,WAAS,KAAK,GAAG;;CAIrB,MAAM,kCAAkB,IAAI,KAAqB;CACjD,MAAM,aAAoC,EAAE;AAC5C,MAAK,MAAM,KAAK,QACd,MAAK,MAAM,QAAQ,EAAE,cAAc,EAAE,EAAE;EACrC,MAAM,QAAQ,gBAAgB,IAAI,KAAK,KAAK;AAC5C,MAAI,MACF,OAAM,IAAI,wBAAwB,aAAa,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;AAE5E,kBAAgB,IAAI,KAAK,MAAM,EAAE,KAAK;AACtC,aAAW,KAAK;GAAE,QAAQ,EAAE;GAAY;GAA8B,CAAC;;CAI3E,MAAM,WAAW,OAAO,SAAkB,QAA8C;EACtF,MAAM,WAAiC,OAAO;GAC5C,KAAK,QAAQ,KAAK;GAClB,QAAQ;GACR,WAAW;GACZ;AACD,OAAK,MAAM,KAAK,QACd,KAAI,EAAE,SAAU,OAAM,EAAE,SAAS,SAAS,SAAS;;AAIvD,QAAO;EAAE;EAAU;EAAU;EAAY;EAAU"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.1.0
2
+ * @forinda/kickjs-cli v5.2.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 { t as __exportAll } from "./rolldown-runtime-BM29JyaJ.mjs";
11
+ import { t as __exportAll } from "./rolldown-runtime-CV_zlh2d.mjs";
12
12
  //#region src/plugin/types.ts
13
13
  /** Identity helper — exists for type inference + parity with definePlugin. */
14
14
  function defineCliPlugin(p) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.1.0
2
+ * @forinda/kickjs-cli v5.2.1
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v5.1.0
2
+ * @forinda/kickjs-cli v5.2.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 { n as applyDisableFilter, t as runAllPluginTypegens } from "./builtins-caRjFvKz.mjs";
11
+ import { n as applyDisableFilter, t as runAllPluginTypegens } from "./builtins-B0dptoXq.mjs";
12
12
  export { applyDisableFilter, runAllPluginTypegens };