@fluojs/cli 1.0.0-beta.1 → 1.0.0-beta.3

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 (80) hide show
  1. package/README.ko.md +56 -7
  2. package/README.md +56 -7
  3. package/dist/cli.d.ts +12 -2
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +69 -33
  6. package/dist/commands/generate.d.ts +11 -1
  7. package/dist/commands/generate.d.ts.map +1 -1
  8. package/dist/commands/generate.js +71 -2
  9. package/dist/commands/inspect.d.ts +20 -0
  10. package/dist/commands/inspect.d.ts.map +1 -1
  11. package/dist/commands/inspect.js +153 -31
  12. package/dist/commands/migrate.d.ts.map +1 -1
  13. package/dist/commands/migrate.js +42 -0
  14. package/dist/commands/new.d.ts.map +1 -1
  15. package/dist/commands/new.js +25 -1
  16. package/dist/generator-types.d.ts +15 -1
  17. package/dist/generator-types.d.ts.map +1 -1
  18. package/dist/generators/controller.d.ts +7 -0
  19. package/dist/generators/controller.d.ts.map +1 -1
  20. package/dist/generators/controller.js +8 -0
  21. package/dist/generators/guard.d.ts +6 -0
  22. package/dist/generators/guard.d.ts.map +1 -1
  23. package/dist/generators/guard.js +7 -0
  24. package/dist/generators/interceptor.d.ts +6 -0
  25. package/dist/generators/interceptor.d.ts.map +1 -1
  26. package/dist/generators/interceptor.js +7 -0
  27. package/dist/generators/manifest.d.ts +267 -0
  28. package/dist/generators/manifest.d.ts.map +1 -1
  29. package/dist/generators/manifest.js +86 -1
  30. package/dist/generators/middleware.d.ts +6 -0
  31. package/dist/generators/middleware.d.ts.map +1 -1
  32. package/dist/generators/middleware.js +7 -0
  33. package/dist/generators/module.d.ts +22 -0
  34. package/dist/generators/module.d.ts.map +1 -1
  35. package/dist/generators/module.js +25 -0
  36. package/dist/generators/render.d.ts +7 -0
  37. package/dist/generators/render.d.ts.map +1 -1
  38. package/dist/generators/render.js +8 -0
  39. package/dist/generators/repository.d.ts +7 -0
  40. package/dist/generators/repository.d.ts.map +1 -1
  41. package/dist/generators/repository.js +8 -0
  42. package/dist/generators/request-dto.d.ts +6 -0
  43. package/dist/generators/request-dto.d.ts.map +1 -1
  44. package/dist/generators/request-dto.js +7 -0
  45. package/dist/generators/response-dto.d.ts +6 -0
  46. package/dist/generators/response-dto.d.ts.map +1 -1
  47. package/dist/generators/response-dto.js +7 -0
  48. package/dist/generators/service.d.ts +7 -0
  49. package/dist/generators/service.d.ts.map +1 -1
  50. package/dist/generators/service.js +8 -0
  51. package/dist/generators/utils.d.ts +18 -0
  52. package/dist/generators/utils.d.ts.map +1 -1
  53. package/dist/generators/utils.js +20 -0
  54. package/dist/help.d.ts +13 -0
  55. package/dist/help.d.ts.map +1 -1
  56. package/dist/help.js +15 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +2 -1
  60. package/dist/new/package-spec-resolver.d.ts +7 -0
  61. package/dist/new/package-spec-resolver.d.ts.map +1 -1
  62. package/dist/new/package-spec-resolver.js +8 -0
  63. package/dist/new/prompt.d.ts +1 -0
  64. package/dist/new/prompt.d.ts.map +1 -1
  65. package/dist/new/prompt.js +12 -4
  66. package/dist/new/scaffold.d.ts.map +1 -1
  67. package/dist/new/scaffold.js +17 -1
  68. package/dist/prompt-cancel.d.ts +44 -0
  69. package/dist/prompt-cancel.d.ts.map +1 -0
  70. package/dist/prompt-cancel.js +49 -0
  71. package/dist/registry.d.ts +4 -1
  72. package/dist/registry.d.ts.map +1 -1
  73. package/dist/registry.js +13 -5
  74. package/dist/transforms/nestjs-migrate.d.ts +48 -0
  75. package/dist/transforms/nestjs-migrate.d.ts.map +1 -1
  76. package/dist/transforms/nestjs-migrate.js +62 -0
  77. package/dist/update-check.d.ts +82 -0
  78. package/dist/update-check.d.ts.map +1 -0
  79. package/dist/update-check.js +475 -0
  80. package/package.json +10 -2
@@ -1,5 +1,13 @@
1
1
  import { renderTemplate } from './render.js';
2
2
  import { toKebabCase, toPascalCase } from './utils.js';
3
+
4
+ /**
5
+ * Generate controller files.
6
+ *
7
+ * @param name The name.
8
+ * @param options The options.
9
+ * @returns The generate controller files result.
10
+ */
3
11
  export function generateControllerFiles(name, options = {}) {
4
12
  const kebab = toKebabCase(name);
5
13
  const resource = toPascalCase(name);
@@ -1,3 +1,9 @@
1
1
  import type { GeneratedFile } from '../types.js';
2
+ /**
3
+ * Generate guard files.
4
+ *
5
+ * @param name The name.
6
+ * @returns The generate guard files result.
7
+ */
2
8
  export declare function generateGuardFiles(name: string): GeneratedFile[];
3
9
  //# sourceMappingURL=guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/generators/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAShE"}
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/generators/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAShE"}
@@ -1,5 +1,12 @@
1
1
  import { renderTemplate } from './render.js';
2
2
  import { toKebabCase, toPascalCase } from './utils.js';
3
+
4
+ /**
5
+ * Generate guard files.
6
+ *
7
+ * @param name The name.
8
+ * @returns The generate guard files result.
9
+ */
3
10
  export function generateGuardFiles(name) {
4
11
  const kebab = toKebabCase(name);
5
12
  const resource = toPascalCase(name);
@@ -1,3 +1,9 @@
1
1
  import type { GeneratedFile } from '../types.js';
2
+ /**
3
+ * Generate interceptor files.
4
+ *
5
+ * @param name The name.
6
+ * @returns The generate interceptor files result.
7
+ */
2
8
  export declare function generateInterceptorFiles(name: string): GeneratedFile[];
3
9
  //# sourceMappingURL=interceptor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/generators/interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAStE"}
1
+ {"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/generators/interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAStE"}
@@ -1,5 +1,12 @@
1
1
  import { renderTemplate } from './render.js';
2
2
  import { toKebabCase, toPascalCase } from './utils.js';
3
+
4
+ /**
5
+ * Generate interceptor files.
6
+ *
7
+ * @param name The name.
8
+ * @returns The generate interceptor files result.
9
+ */
3
10
  export function generateInterceptorFiles(name) {
4
11
  const kebab = toKebabCase(name);
5
12
  const resource = toPascalCase(name);
@@ -1,9 +1,11 @@
1
1
  import type { GeneratorFactory } from '../generator-types.js';
2
+ /** Module metadata array names that auto-registered generators are allowed to update. */
2
3
  export type ModuleArrayKey = 'controllers' | 'providers' | 'middleware';
3
4
  type ModuleRegistrationDescriptor = {
4
5
  arrayKey: ModuleArrayKey;
5
6
  classSuffix: string;
6
7
  };
8
+ /** Describes one built-in generator schematic and its CLI-facing metadata. */
7
9
  export type GeneratorManifestEntry = {
8
10
  aliases: readonly string[];
9
11
  description: string;
@@ -15,6 +17,244 @@ export type GeneratorManifestEntry = {
15
17
  schematic: string;
16
18
  wiringBehavior: 'auto-registered' | 'files-only';
17
19
  };
20
+ /** Describes a deterministic collection of generator schematics discoverable by the CLI. */
21
+ export type GeneratorCollection = {
22
+ description: string;
23
+ generators: readonly GeneratorManifestEntry[];
24
+ id: string;
25
+ source: 'built-in';
26
+ };
27
+ /** Option metadata shared by generate-command parsing, help output, docs, and tests. */
28
+ export declare const generatorOptionSchemas: readonly [{
29
+ readonly aliases: readonly ["-o"];
30
+ readonly description: "Write generated files under a specific source directory.";
31
+ readonly name: "--target-directory <path>";
32
+ readonly value: "path";
33
+ }, {
34
+ readonly aliases: readonly ["-f"];
35
+ readonly description: "Overwrite files that already exist.";
36
+ readonly name: "--force";
37
+ readonly value: "boolean";
38
+ }, {
39
+ readonly aliases: readonly [];
40
+ readonly description: "Preview planned writes, skips, and module wiring without touching files.";
41
+ readonly name: "--dry-run";
42
+ readonly value: "boolean";
43
+ }, {
44
+ readonly aliases: readonly ["-h"];
45
+ readonly description: "Show help for the generate command.";
46
+ readonly name: "--help";
47
+ readonly value: "boolean";
48
+ }];
49
+ /** The single generator collection shipped directly inside `@fluojs/cli`. */
50
+ export declare const builtInGeneratorCollection: {
51
+ readonly description: "The deterministic collection of generator schematics shipped by @fluojs/cli.";
52
+ readonly generators: readonly [{
53
+ readonly aliases: readonly ["co"];
54
+ readonly description: "Generate a controller (auto-registered in the module controllers array).";
55
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
56
+ readonly kind: "controller";
57
+ readonly moduleRegistration: {
58
+ readonly arrayKey: "controllers";
59
+ readonly classSuffix: "Controller";
60
+ };
61
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then add route handlers.";
62
+ readonly schematic: "controller";
63
+ readonly wiringBehavior: "auto-registered";
64
+ }, {
65
+ readonly aliases: readonly ["gu"];
66
+ readonly description: "Generate a guard (auto-registered as a provider in the module).";
67
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
68
+ readonly kind: "guard";
69
+ readonly moduleRegistration: {
70
+ readonly arrayKey: "providers";
71
+ readonly classSuffix: "Guard";
72
+ };
73
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then apply the guard to routes.";
74
+ readonly schematic: "guard";
75
+ readonly wiringBehavior: "auto-registered";
76
+ }, {
77
+ readonly aliases: readonly ["in"];
78
+ readonly description: "Generate an interceptor (auto-registered as a provider in the module).";
79
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
80
+ readonly kind: "interceptor";
81
+ readonly moduleRegistration: {
82
+ readonly arrayKey: "providers";
83
+ readonly classSuffix: "Interceptor";
84
+ };
85
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then bind the interceptor to routes.";
86
+ readonly schematic: "interceptor";
87
+ readonly wiringBehavior: "auto-registered";
88
+ }, {
89
+ readonly aliases: readonly ["mi"];
90
+ readonly description: "Generate a middleware (auto-registered in the module middleware array).";
91
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
92
+ readonly kind: "middleware";
93
+ readonly moduleRegistration: {
94
+ readonly arrayKey: "middleware";
95
+ readonly classSuffix: "Middleware";
96
+ };
97
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then configure route matching in forRoutes.";
98
+ readonly schematic: "middleware";
99
+ readonly wiringBehavior: "auto-registered";
100
+ }, {
101
+ readonly aliases: readonly ["mo"];
102
+ readonly description: "Generate a standalone module (import it in a parent module to activate).";
103
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
104
+ readonly kind: "module";
105
+ readonly nextStepHint: "Import the new module in a parent module's imports array, then run 'pnpm typecheck'.";
106
+ readonly schematic: "module";
107
+ readonly wiringBehavior: "files-only";
108
+ }, {
109
+ readonly aliases: readonly ["repo"];
110
+ readonly description: "Generate a persistence-agnostic repository (auto-registered as a provider).";
111
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
112
+ readonly kind: "repo";
113
+ readonly moduleRegistration: {
114
+ readonly arrayKey: "providers";
115
+ readonly classSuffix: "Repo";
116
+ };
117
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then add data-access methods to the repo stub.";
118
+ readonly registryAliases: readonly ["repository"];
119
+ readonly schematic: "repository";
120
+ readonly wiringBehavior: "auto-registered";
121
+ }, {
122
+ readonly aliases: readonly ["req"];
123
+ readonly description: "Generate a request DTO for route-level data binding and validation (files only — wire it into a controller manually).";
124
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
125
+ readonly kind: "request-dto";
126
+ readonly nextStepHint: "Import the DTO in a controller and add it as a parameter with @FromBody or @FromQuery.";
127
+ readonly schematic: "request-dto";
128
+ readonly wiringBehavior: "files-only";
129
+ }, {
130
+ readonly aliases: readonly ["res"];
131
+ readonly description: "Generate a response DTO for typed response payloads (files only — use it as a controller return type).";
132
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
133
+ readonly kind: "response-dto";
134
+ readonly nextStepHint: "Import the DTO in a controller and use it as the return type for route handlers.";
135
+ readonly schematic: "response-dto";
136
+ readonly wiringBehavior: "files-only";
137
+ }, {
138
+ readonly aliases: readonly ["s"];
139
+ readonly description: "Generate a service (auto-registered as a provider in the module).";
140
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
141
+ readonly kind: "service";
142
+ readonly moduleRegistration: {
143
+ readonly arrayKey: "providers";
144
+ readonly classSuffix: "Service";
145
+ };
146
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then implement business logic.";
147
+ readonly schematic: "service";
148
+ readonly wiringBehavior: "auto-registered";
149
+ }];
150
+ readonly id: "@fluojs/cli/builtin";
151
+ readonly source: "built-in";
152
+ };
153
+ /** Deterministic list of generator collections currently discovered by `fluo generate`. */
154
+ export declare const generatorCollections: readonly [{
155
+ readonly description: "The deterministic collection of generator schematics shipped by @fluojs/cli.";
156
+ readonly generators: readonly [{
157
+ readonly aliases: readonly ["co"];
158
+ readonly description: "Generate a controller (auto-registered in the module controllers array).";
159
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
160
+ readonly kind: "controller";
161
+ readonly moduleRegistration: {
162
+ readonly arrayKey: "controllers";
163
+ readonly classSuffix: "Controller";
164
+ };
165
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then add route handlers.";
166
+ readonly schematic: "controller";
167
+ readonly wiringBehavior: "auto-registered";
168
+ }, {
169
+ readonly aliases: readonly ["gu"];
170
+ readonly description: "Generate a guard (auto-registered as a provider in the module).";
171
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
172
+ readonly kind: "guard";
173
+ readonly moduleRegistration: {
174
+ readonly arrayKey: "providers";
175
+ readonly classSuffix: "Guard";
176
+ };
177
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then apply the guard to routes.";
178
+ readonly schematic: "guard";
179
+ readonly wiringBehavior: "auto-registered";
180
+ }, {
181
+ readonly aliases: readonly ["in"];
182
+ readonly description: "Generate an interceptor (auto-registered as a provider in the module).";
183
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
184
+ readonly kind: "interceptor";
185
+ readonly moduleRegistration: {
186
+ readonly arrayKey: "providers";
187
+ readonly classSuffix: "Interceptor";
188
+ };
189
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then bind the interceptor to routes.";
190
+ readonly schematic: "interceptor";
191
+ readonly wiringBehavior: "auto-registered";
192
+ }, {
193
+ readonly aliases: readonly ["mi"];
194
+ readonly description: "Generate a middleware (auto-registered in the module middleware array).";
195
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
196
+ readonly kind: "middleware";
197
+ readonly moduleRegistration: {
198
+ readonly arrayKey: "middleware";
199
+ readonly classSuffix: "Middleware";
200
+ };
201
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then configure route matching in forRoutes.";
202
+ readonly schematic: "middleware";
203
+ readonly wiringBehavior: "auto-registered";
204
+ }, {
205
+ readonly aliases: readonly ["mo"];
206
+ readonly description: "Generate a standalone module (import it in a parent module to activate).";
207
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
208
+ readonly kind: "module";
209
+ readonly nextStepHint: "Import the new module in a parent module's imports array, then run 'pnpm typecheck'.";
210
+ readonly schematic: "module";
211
+ readonly wiringBehavior: "files-only";
212
+ }, {
213
+ readonly aliases: readonly ["repo"];
214
+ readonly description: "Generate a persistence-agnostic repository (auto-registered as a provider).";
215
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
216
+ readonly kind: "repo";
217
+ readonly moduleRegistration: {
218
+ readonly arrayKey: "providers";
219
+ readonly classSuffix: "Repo";
220
+ };
221
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then add data-access methods to the repo stub.";
222
+ readonly registryAliases: readonly ["repository"];
223
+ readonly schematic: "repository";
224
+ readonly wiringBehavior: "auto-registered";
225
+ }, {
226
+ readonly aliases: readonly ["req"];
227
+ readonly description: "Generate a request DTO for route-level data binding and validation (files only — wire it into a controller manually).";
228
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
229
+ readonly kind: "request-dto";
230
+ readonly nextStepHint: "Import the DTO in a controller and add it as a parameter with @FromBody or @FromQuery.";
231
+ readonly schematic: "request-dto";
232
+ readonly wiringBehavior: "files-only";
233
+ }, {
234
+ readonly aliases: readonly ["res"];
235
+ readonly description: "Generate a response DTO for typed response payloads (files only — use it as a controller return type).";
236
+ readonly factory: (name: string) => import("../generator-types.js").GeneratedFile[];
237
+ readonly kind: "response-dto";
238
+ readonly nextStepHint: "Import the DTO in a controller and use it as the return type for route handlers.";
239
+ readonly schematic: "response-dto";
240
+ readonly wiringBehavior: "files-only";
241
+ }, {
242
+ readonly aliases: readonly ["s"];
243
+ readonly description: "Generate a service (auto-registered as a provider in the module).";
244
+ readonly factory: (name: string, options: import("../generator-types.js").GenerateOptions | undefined) => import("../generator-types.js").GeneratedFile[];
245
+ readonly kind: "service";
246
+ readonly moduleRegistration: {
247
+ readonly arrayKey: "providers";
248
+ readonly classSuffix: "Service";
249
+ };
250
+ readonly nextStepHint: "Run 'pnpm typecheck' to verify module wiring, then implement business logic.";
251
+ readonly schematic: "service";
252
+ readonly wiringBehavior: "auto-registered";
253
+ }];
254
+ readonly id: "@fluojs/cli/builtin";
255
+ readonly source: "built-in";
256
+ }];
257
+ /** Built-in generator manifest used by CLI parsing, help output, and command execution. */
18
258
  export declare const generatorManifest: readonly [{
19
259
  readonly aliases: readonly ["co"];
20
260
  readonly description: "Generate a controller (auto-registered in the module controllers array).";
@@ -113,9 +353,36 @@ export declare const generatorManifest: readonly [{
113
353
  readonly schematic: "service";
114
354
  readonly wiringBehavior: "auto-registered";
115
355
  }];
356
+ /** Union of generator kind tokens accepted by the built-in generator manifest. */
116
357
  export type GeneratorKind = (typeof generatorManifest)[number]['kind'];
358
+ /** Exact manifest entry type for one built-in generator definition. */
117
359
  export type GeneratorDefinition = (typeof generatorManifest)[number];
360
+ /**
361
+ * Looks up one built-in generator definition by canonical kind.
362
+ *
363
+ * @param kind Canonical generator kind to resolve.
364
+ * @returns The matching built-in generator definition.
365
+ */
118
366
  export declare function findGeneratorDefinition(kind: GeneratorKind): GeneratorDefinition;
367
+ /**
368
+ * Lists generator collections that `fluo generate` discovers without loading external code.
369
+ *
370
+ * @returns The deterministic generator collection list.
371
+ */
372
+ export declare function listGeneratorCollections(): readonly GeneratorCollection[];
373
+ /**
374
+ * Lists generator definitions for a known collection.
375
+ *
376
+ * @param collectionId Collection identifier to read, defaulting to the built-in collection.
377
+ * @returns Generator definitions owned by the requested collection.
378
+ */
379
+ export declare function listGeneratorDefinitions(collectionId?: string): readonly GeneratorDefinition[];
380
+ /**
381
+ * Resolves a CLI token or alias to a canonical generator kind.
382
+ *
383
+ * @param value Raw CLI generator token or alias.
384
+ * @returns The canonical generator kind when the token is known, otherwise `undefined`.
385
+ */
119
386
  export declare function resolveGeneratorKind(value: string | undefined): GeneratorKind | undefined;
120
387
  export {};
121
388
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/generators/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAY9D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAExE,KAAK,4BAA4B,GAAG;IAClC,QAAQ,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,4BAA4B,CAAC;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,iBAAiB,GAAG,YAAY,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFwB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAcrE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,GAAG,mBAAmB,CAOhF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAMzF"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/generators/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,uBAAuB,CAAC;AAYrF,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAExE,KAAK,4BAA4B,GAAG;IAClC,QAAQ,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,4BAA4B,CAAC;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,iBAAiB,GAAG,YAAY,CAAC;CAClD,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;EAKkB,CAAC;AA6FtD,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKC,CAAC;AAEzC,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiF,CAAC;AAEnH,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwC,CAAC;AAEvE,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAcrE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,GAAG,mBAAmB,CAOhF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,SAAS,mBAAmB,EAAE,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,GAAE,MAAsC,GAAG,SAAS,mBAAmB,EAAE,CAO7H;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAMzF"}
@@ -7,7 +7,36 @@ import { generateRepoFiles } from './repository.js';
7
7
  import { generateRequestDtoFiles } from './request-dto.js';
8
8
  import { generateResponseDtoFiles } from './response-dto.js';
9
9
  import { generateServiceFiles } from './service.js';
10
- export const generatorManifest = [{
10
+
11
+ /** Module metadata array names that auto-registered generators are allowed to update. */
12
+
13
+ /** Describes one built-in generator schematic and its CLI-facing metadata. */
14
+
15
+ /** Describes a deterministic collection of generator schematics discoverable by the CLI. */
16
+
17
+ /** Option metadata shared by generate-command parsing, help output, docs, and tests. */
18
+ export const generatorOptionSchemas = [{
19
+ aliases: ['-o'],
20
+ description: 'Write generated files under a specific source directory.',
21
+ name: '--target-directory <path>',
22
+ value: 'path'
23
+ }, {
24
+ aliases: ['-f'],
25
+ description: 'Overwrite files that already exist.',
26
+ name: '--force',
27
+ value: 'boolean'
28
+ }, {
29
+ aliases: [],
30
+ description: 'Preview planned writes, skips, and module wiring without touching files.',
31
+ name: '--dry-run',
32
+ value: 'boolean'
33
+ }, {
34
+ aliases: ['-h'],
35
+ description: 'Show help for the generate command.',
36
+ name: '--help',
37
+ value: 'boolean'
38
+ }];
39
+ const builtInGeneratorDefinitions = [{
11
40
  aliases: ['co'],
12
41
  description: 'Generate a controller (auto-registered in the module controllers array).',
13
42
  factory: (name, options) => generateControllerFiles(name, options),
@@ -105,6 +134,25 @@ export const generatorManifest = [{
105
134
  schematic: 'service',
106
135
  wiringBehavior: 'auto-registered'
107
136
  }];
137
+
138
+ /** The single generator collection shipped directly inside `@fluojs/cli`. */
139
+ export const builtInGeneratorCollection = {
140
+ description: 'The deterministic collection of generator schematics shipped by @fluojs/cli.',
141
+ generators: builtInGeneratorDefinitions,
142
+ id: '@fluojs/cli/builtin',
143
+ source: 'built-in'
144
+ };
145
+
146
+ /** Deterministic list of generator collections currently discovered by `fluo generate`. */
147
+ export const generatorCollections = [builtInGeneratorCollection];
148
+
149
+ /** Built-in generator manifest used by CLI parsing, help output, and command execution. */
150
+ export const generatorManifest = builtInGeneratorCollection.generators;
151
+
152
+ /** Union of generator kind tokens accepted by the built-in generator manifest. */
153
+
154
+ /** Exact manifest entry type for one built-in generator definition. */
155
+
108
156
  const generatorByKind = new Map();
109
157
  const tokenToKind = new Map();
110
158
  for (const entry of generatorManifest) {
@@ -115,6 +163,13 @@ for (const entry of generatorManifest) {
115
163
  tokenToKind.set(alias, entry.kind);
116
164
  }
117
165
  }
166
+
167
+ /**
168
+ * Looks up one built-in generator definition by canonical kind.
169
+ *
170
+ * @param kind Canonical generator kind to resolve.
171
+ * @returns The matching built-in generator definition.
172
+ */
118
173
  export function findGeneratorDefinition(kind) {
119
174
  const entry = generatorByKind.get(kind);
120
175
  if (!entry) {
@@ -122,6 +177,36 @@ export function findGeneratorDefinition(kind) {
122
177
  }
123
178
  return entry;
124
179
  }
180
+
181
+ /**
182
+ * Lists generator collections that `fluo generate` discovers without loading external code.
183
+ *
184
+ * @returns The deterministic generator collection list.
185
+ */
186
+ export function listGeneratorCollections() {
187
+ return generatorCollections;
188
+ }
189
+
190
+ /**
191
+ * Lists generator definitions for a known collection.
192
+ *
193
+ * @param collectionId Collection identifier to read, defaulting to the built-in collection.
194
+ * @returns Generator definitions owned by the requested collection.
195
+ */
196
+ export function listGeneratorDefinitions(collectionId = builtInGeneratorCollection.id) {
197
+ const collection = generatorCollections.find(entry => entry.id === collectionId);
198
+ if (!collection) {
199
+ throw new Error(`Unknown generator collection: ${collectionId}`);
200
+ }
201
+ return collection.generators;
202
+ }
203
+
204
+ /**
205
+ * Resolves a CLI token or alias to a canonical generator kind.
206
+ *
207
+ * @param value Raw CLI generator token or alias.
208
+ * @returns The canonical generator kind when the token is known, otherwise `undefined`.
209
+ */
125
210
  export function resolveGeneratorKind(value) {
126
211
  if (!value) {
127
212
  return undefined;
@@ -1,3 +1,9 @@
1
1
  import type { GeneratedFile } from '../types.js';
2
+ /**
3
+ * Generate middleware files.
4
+ *
5
+ * @param name The name.
6
+ * @returns The generate middleware files result.
7
+ */
2
8
  export declare function generateMiddlewareFiles(name: string): GeneratedFile[];
3
9
  //# sourceMappingURL=middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/generators/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CASrE"}
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/generators/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CASrE"}
@@ -1,5 +1,12 @@
1
1
  import { renderTemplate } from './render.js';
2
2
  import { toKebabCase, toPascalCase } from './utils.js';
3
+
4
+ /**
5
+ * Generate middleware files.
6
+ *
7
+ * @param name The name.
8
+ * @returns The generate middleware files result.
9
+ */
3
10
  export function generateMiddlewareFiles(name) {
4
11
  const kebab = toKebabCase(name);
5
12
  const resource = toPascalCase(name);
@@ -1,6 +1,28 @@
1
1
  import type { GeneratedFile } from '../types.js';
2
2
  import type { ModuleArrayKey } from './manifest.js';
3
+ /**
4
+ * Ensure module import.
5
+ *
6
+ * @param source The source.
7
+ * @param className The class name.
8
+ * @param importPath The import path.
9
+ * @returns The ensure module import result.
10
+ */
3
11
  export declare function ensureModuleImport(source: string, className: string, importPath: string): string;
12
+ /**
13
+ * Generate module files.
14
+ *
15
+ * @param name The name.
16
+ * @returns The generate module files result.
17
+ */
4
18
  export declare function generateModuleFiles(name: string): GeneratedFile[];
19
+ /**
20
+ * Register in module.
21
+ *
22
+ * @param source The source.
23
+ * @param arrayKey The array key.
24
+ * @param className The class name.
25
+ * @returns The register in module result.
26
+ */
5
27
  export declare function registerInModule(source: string, arrayKey: ModuleArrayKey, className: string): string;
6
28
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/generators/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA6FpD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAyDhG;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAUjE;AAwDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/generators/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA6FpD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAyDhG;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAUjE;AAwDD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpG"}
@@ -64,6 +64,15 @@ function findNamedImportSource(sourceFile, className) {
64
64
  function buildImportDeclaration(className, importPath) {
65
65
  return ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(className))])), ts.factory.createStringLiteral(`./${importPath}`));
66
66
  }
67
+
68
+ /**
69
+ * Ensure module import.
70
+ *
71
+ * @param source The source.
72
+ * @param className The class name.
73
+ * @param importPath The import path.
74
+ * @returns The ensure module import result.
75
+ */
67
76
  export function ensureModuleImport(source, className, importPath) {
68
77
  const sourceFile = parseSource(source);
69
78
  const moduleSpecifier = `./${importPath}`;
@@ -96,6 +105,13 @@ export function ensureModuleImport(source, className, importPath) {
96
105
  }
97
106
  return `${newImportLine}\n${source}`;
98
107
  }
108
+
109
+ /**
110
+ * Generate module files.
111
+ *
112
+ * @param name The name.
113
+ * @returns The generate module files result.
114
+ */
99
115
  export function generateModuleFiles(name) {
100
116
  const kebab = toKebabCase(name);
101
117
  const pascal = `${toPascalCase(name)}Module`;
@@ -138,6 +154,15 @@ function insertIntoModuleArray(source, arrayKey, className) {
138
154
  const updatedModuleMetadata = ts.factory.updateObjectLiteralExpression(moduleMetadata, updatedProperties);
139
155
  return replaceNodeText(source, sourceFile, moduleMetadata, printer.printNode(ts.EmitHint.Unspecified, updatedModuleMetadata, sourceFile));
140
156
  }
157
+
158
+ /**
159
+ * Register in module.
160
+ *
161
+ * @param source The source.
162
+ * @param arrayKey The array key.
163
+ * @param className The class name.
164
+ * @returns The register in module result.
165
+ */
141
166
  export function registerInModule(source, arrayKey, className) {
142
167
  return insertIntoModuleArray(source, arrayKey, className);
143
168
  }
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Render template.
3
+ *
4
+ * @param templateName The template name.
5
+ * @param vars The vars.
6
+ * @returns The render template result.
7
+ */
1
8
  export declare function renderTemplate(templateName: string, vars: Record<string, unknown>): string;
2
9
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/generators/render.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU1F"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/generators/render.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU1F"}
@@ -4,6 +4,14 @@ import { fileURLToPath } from 'node:url';
4
4
  import ejs from 'ejs';
5
5
  const templatesDir = join(dirname(fileURLToPath(import.meta.url)), 'templates');
6
6
  const templateCache = new Map();
7
+
8
+ /**
9
+ * Render template.
10
+ *
11
+ * @param templateName The template name.
12
+ * @param vars The vars.
13
+ * @returns The render template result.
14
+ */
7
15
  export function renderTemplate(templateName, vars) {
8
16
  const templatePath = join(templatesDir, templateName);
9
17
  let template = templateCache.get(templatePath);
@@ -1,3 +1,10 @@
1
1
  import type { GenerateOptions, GeneratedFile } from '../types.js';
2
+ /**
3
+ * Generate repo files.
4
+ *
5
+ * @param name The name.
6
+ * @param _options The options.
7
+ * @returns The generate repo files result.
8
+ */
2
9
  export declare function generateRepoFiles(name: string, _options?: GenerateOptions): GeneratedFile[];
3
10
  //# sourceMappingURL=repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/generators/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAmB/F"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/generators/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKlE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,aAAa,EAAE,CAmB/F"}