@warlock.js/core 4.2.1 → 4.2.2

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 (107) hide show
  1. package/esm/_virtual/_rolldown/runtime.mjs +7 -0
  2. package/esm/cli/cli-commands.manager.mjs +290 -0
  3. package/esm/cli/cli-commands.manager.mjs.map +1 -0
  4. package/esm/cli/cli-commands.utils.mjs +217 -0
  5. package/esm/cli/cli-commands.utils.mjs.map +1 -0
  6. package/esm/cli/commands/add.command.mjs +27 -0
  7. package/esm/cli/commands/add.command.mjs.map +1 -0
  8. package/esm/cli/commands/build.command.mjs +14 -0
  9. package/esm/cli/commands/build.command.mjs.map +1 -0
  10. package/esm/cli/commands/create-database.command.mjs +24 -0
  11. package/esm/cli/commands/create-database.command.mjs.map +1 -0
  12. package/esm/cli/commands/dev-server.command.mjs +48 -0
  13. package/esm/cli/commands/dev-server.command.mjs.map +1 -0
  14. package/esm/cli/commands/drop-tables.command.mjs +23 -0
  15. package/esm/cli/commands/drop-tables.command.mjs.map +1 -0
  16. package/esm/cli/commands/generate/generate.command.mjs +201 -0
  17. package/esm/cli/commands/generate/generate.command.mjs.map +1 -0
  18. package/esm/cli/commands/generate/generators/column-dsl-parser.mjs +49 -0
  19. package/esm/cli/commands/generate/generators/column-dsl-parser.mjs.map +1 -0
  20. package/esm/cli/commands/generate/generators/controller.generator.mjs +48 -0
  21. package/esm/cli/commands/generate/generators/controller.generator.mjs.map +1 -0
  22. package/esm/cli/commands/generate/generators/migration.generator.mjs +81 -0
  23. package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -0
  24. package/esm/cli/commands/generate/generators/model.generator.mjs +60 -0
  25. package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -0
  26. package/esm/cli/commands/generate/generators/module.generator.mjs +113 -0
  27. package/esm/cli/commands/generate/generators/module.generator.mjs.map +1 -0
  28. package/esm/cli/commands/generate/generators/repository.generator.mjs +42 -0
  29. package/esm/cli/commands/generate/generators/repository.generator.mjs.map +1 -0
  30. package/esm/cli/commands/generate/generators/resource.generator.mjs +42 -0
  31. package/esm/cli/commands/generate/generators/resource.generator.mjs.map +1 -0
  32. package/esm/cli/commands/generate/generators/service.generator.mjs +42 -0
  33. package/esm/cli/commands/generate/generators/service.generator.mjs.map +1 -0
  34. package/esm/cli/commands/generate/templates/stubs.mjs +514 -0
  35. package/esm/cli/commands/generate/templates/stubs.mjs.map +1 -0
  36. package/esm/cli/commands/generate/utils/name-parser.mjs +69 -0
  37. package/esm/cli/commands/generate/utils/name-parser.mjs.map +1 -0
  38. package/esm/cli/commands/generate/utils/path-resolver.mjs +56 -0
  39. package/esm/cli/commands/generate/utils/path-resolver.mjs.map +1 -0
  40. package/esm/cli/commands/generate/utils/prompt.mjs +28 -0
  41. package/esm/cli/commands/generate/utils/prompt.mjs.map +1 -0
  42. package/esm/cli/commands/generate/utils/writer.mjs +60 -0
  43. package/esm/cli/commands/generate/utils/writer.mjs.map +1 -0
  44. package/esm/cli/commands/migrate.command.mjs +60 -0
  45. package/esm/cli/commands/migrate.command.mjs.map +1 -0
  46. package/esm/cli/commands/seed.command.mjs +41 -0
  47. package/esm/cli/commands/seed.command.mjs.map +1 -0
  48. package/esm/cli/commands/start-production.command.mjs +50 -0
  49. package/esm/cli/commands/start-production.command.mjs.map +1 -0
  50. package/esm/cli/commands/storage-put.action.mjs +75 -0
  51. package/esm/cli/commands/storage-put.action.mjs.map +1 -0
  52. package/esm/cli/commands/storage-put.command.mjs +46 -0
  53. package/esm/cli/commands/storage-put.command.mjs.map +1 -0
  54. package/esm/cli/commands/typings-generator.command.mjs +38 -0
  55. package/esm/cli/commands/typings-generator.command.mjs.map +1 -0
  56. package/esm/cli/commands-loader.mjs +50 -0
  57. package/esm/cli/commands-loader.mjs.map +1 -0
  58. package/esm/cli/framework-cli-commands.mjs +37 -0
  59. package/esm/cli/framework-cli-commands.mjs.map +1 -0
  60. package/esm/cli/parse-cli-args.mjs +62 -0
  61. package/esm/cli/parse-cli-args.mjs.map +1 -0
  62. package/esm/cli/start.d.mts +1 -0
  63. package/esm/cli/start.mjs +8 -0
  64. package/esm/cli/start.mjs.map +1 -0
  65. package/esm/cli/string-similarity.mjs +56 -0
  66. package/esm/cli/string-similarity.mjs.map +1 -0
  67. package/esm/database/create-database-action.mjs +32 -0
  68. package/esm/database/create-database-action.mjs.map +1 -0
  69. package/esm/database/drop-tables-action.mjs +35 -0
  70. package/esm/database/drop-tables-action.mjs.map +1 -0
  71. package/esm/database/migrate-action.mjs +99 -0
  72. package/esm/database/migrate-action.mjs.map +1 -0
  73. package/esm/database/seed-command-action.mjs +74 -0
  74. package/esm/database/seed-command-action.mjs.map +1 -0
  75. package/esm/database/seeds/seeders.manager.mjs +129 -0
  76. package/esm/database/seeds/seeders.manager.mjs.map +1 -0
  77. package/esm/database/seeds/seeds-table-migration.mjs +31 -0
  78. package/esm/database/seeds/seeds-table-migration.mjs.map +1 -0
  79. package/esm/database/seeds/utils.mjs +6 -0
  80. package/esm/database/seeds/utils.mjs.map +1 -0
  81. package/esm/dev-server/dev-logger.mjs +12 -1
  82. package/esm/dev-server/dev-logger.mjs.map +1 -1
  83. package/esm/dev-server/development-server.mjs +115 -0
  84. package/esm/dev-server/development-server.mjs.map +1 -0
  85. package/esm/dev-server/layer-executor.mjs +114 -0
  86. package/esm/dev-server/layer-executor.mjs.map +1 -0
  87. package/esm/dev-server/start-development-server.mjs +63 -0
  88. package/esm/dev-server/start-development-server.mjs.map +1 -0
  89. package/esm/dev-server/type-generator.mjs +453 -0
  90. package/esm/dev-server/type-generator.mjs.map +1 -0
  91. package/esm/generations/add-command.action.mjs +480 -0
  92. package/esm/generations/add-command.action.mjs.map +1 -0
  93. package/esm/generations/stubs.mjs +436 -0
  94. package/esm/generations/stubs.mjs.map +1 -0
  95. package/esm/manifest/manifest-manager.mjs +79 -0
  96. package/esm/manifest/manifest-manager.mjs.map +1 -0
  97. package/esm/production/build-app-production.mjs +14 -0
  98. package/esm/production/build-app-production.mjs.map +1 -0
  99. package/esm/production/esbuild-plugins.mjs +37 -0
  100. package/esm/production/esbuild-plugins.mjs.map +1 -0
  101. package/esm/production/production-builder.mjs +264 -0
  102. package/esm/production/production-builder.mjs.map +1 -0
  103. package/esm/production/resolve-build-config.mjs +28 -0
  104. package/esm/production/resolve-build-config.mjs.map +1 -0
  105. package/esm/utils/framework-vesion.mjs +10 -1
  106. package/esm/utils/framework-vesion.mjs.map +1 -1
  107. package/package.json +15 -9
@@ -0,0 +1,7 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region \0rolldown/runtime.js
4
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
+
6
+ //#endregion
7
+ export { __require };
@@ -0,0 +1,290 @@
1
+ import { appPath } from "../utils/paths.mjs";
2
+ import "../utils/index.mjs";
3
+ import { Application } from "../application/application.mjs";
4
+ import "../application/index.mjs";
5
+ import { bootstrap } from "../bootstrap.mjs";
6
+ import { ConnectorLifecyclePhase } from "../connectors/types.mjs";
7
+ import { connectorsManager } from "../connectors/connectors-manager.mjs";
8
+ import { warlockConfigManager } from "../warlock-config/warlock-config.manager.mjs";
9
+ import { filesOrchestrator } from "../dev-server/files-orchestrator.mjs";
10
+ import { loadConfigFiles } from "../config/load-config-files.mjs";
11
+ import { manifestManager } from "../manifest/manifest-manager.mjs";
12
+ import { displayBootError, displayCommandError, displayCommandHelp, displayCommandNotFound, displayCommandSuccess, displayExecutingCommand, displayHelp, displayMissingCommand, displayMissingOptions, displayWarlockVersionInTerminal, isMatchingCommandName } from "./cli-commands.utils.mjs";
13
+ import { cliCommandsLoader } from "./commands-loader.mjs";
14
+ import { frameworkCommands } from "./framework-cli-commands.mjs";
15
+ import { parseCliArgs } from "./parse-cli-args.mjs";
16
+ import { findSimilar } from "./string-similarity.mjs";
17
+ import { loadEnv } from "@mongez/dotenv";
18
+ import { colors } from "@mongez/copper";
19
+ import { fileExistsAsync } from "@warlock.js/fs";
20
+
21
+ //#region ../@warlock.js/core/src/cli/cli-commands.manager.ts
22
+ var CLICommandsManager = class {
23
+ constructor() {
24
+ this.commands = [];
25
+ this.commandsMap = /* @__PURE__ */ new Map();
26
+ this.aliasMap = /* @__PURE__ */ new Map();
27
+ }
28
+ /**
29
+ * Register the given commands
30
+ */
31
+ register(...commands) {
32
+ this.commands.push(...commands);
33
+ commands.forEach((command) => {
34
+ const commandKey = command.name.split(" ")[0];
35
+ manifestManager.addCommandToList(command.name, {
36
+ relativePath: command.commandRelativePath,
37
+ source: command.commandSource || "project",
38
+ description: command.commandDescription,
39
+ alias: command.commandAlias,
40
+ options: command.commandOptions.length > 0 ? command.commandOptions : void 0
41
+ });
42
+ this.commandsMap.set(commandKey, command);
43
+ if (command.commandAlias) this.aliasMap.set(command.commandAlias, commandKey);
44
+ });
45
+ return this;
46
+ }
47
+ /**
48
+ * Get command by name or alias
49
+ */
50
+ getCommand(name) {
51
+ let command = this.commandsMap.get(name);
52
+ if (command) return command;
53
+ const realName = this.aliasMap.get(name);
54
+ if (realName) return this.commandsMap.get(realName);
55
+ }
56
+ /**
57
+ * Get all command names and aliases
58
+ * Used for fuzzy matching suggestions
59
+ */
60
+ getAllCommandNames() {
61
+ const names = [];
62
+ for (const name of this.commandsMap.keys()) names.push(name);
63
+ for (const alias of this.aliasMap.keys()) names.push(alias);
64
+ const manifestCommands = manifestManager.commandsJson?.commands || {};
65
+ for (const name of Object.keys(manifestCommands)) {
66
+ const baseName = name.split(" ")[0];
67
+ if (!names.includes(baseName)) names.push(baseName);
68
+ const alias = manifestCommands[name].alias;
69
+ if (alias && !names.includes(alias)) names.push(alias);
70
+ }
71
+ return names;
72
+ }
73
+ /**
74
+ * Start the cli manager
75
+ */
76
+ async start() {
77
+ const { name, options, args } = parseCliArgs(process.argv);
78
+ if (options.noCache) {
79
+ manifestManager.clearCommandsCache();
80
+ await manifestManager.removeCommandsFile();
81
+ }
82
+ if (options.version || options.v) {
83
+ await displayWarlockVersionInTerminal();
84
+ process.exit(0);
85
+ }
86
+ await manifestManager.loadCommands();
87
+ this.register(...frameworkCommands.map((command) => {
88
+ if (!command.commandSource) command.commandSource = "framework";
89
+ return command;
90
+ }));
91
+ const isHelpCommand = options.help || options.h;
92
+ if (!name && isHelpCommand) {
93
+ await this.showGlobalHelp();
94
+ process.exit(0);
95
+ }
96
+ if (options.warmCache) {
97
+ await this.warmCache();
98
+ process.exit(0);
99
+ }
100
+ if (!name) {
101
+ displayMissingCommand();
102
+ process.exit(1);
103
+ }
104
+ const command = await this.lazyGetCommand(name);
105
+ if (manifestManager.hasChanges) await manifestManager.saveCommands();
106
+ if (!command) {
107
+ displayCommandNotFound(name, findSimilar(name, this.getAllCommandNames()).map((s) => s.value));
108
+ process.exit(1);
109
+ }
110
+ if (isHelpCommand) {
111
+ displayCommandHelp({
112
+ name: command.name,
113
+ alias: command.commandAlias,
114
+ description: command.commandDescription,
115
+ options: command.commandOptions
116
+ });
117
+ process.exit(0);
118
+ }
119
+ await this.execute(command, {
120
+ options,
121
+ args
122
+ });
123
+ }
124
+ /**
125
+ * Show global help with all commands
126
+ * Uses manifest if available for fast display
127
+ */
128
+ async showGlobalHelp() {
129
+ if (manifestManager.isCommandLoaded && Object.keys(manifestManager.commandsJson?.commands || {}).length > 0) {
130
+ await displayHelp(Object.entries(manifestManager.commandsJson?.commands || {}).map(([name, cmd]) => ({
131
+ name,
132
+ alias: cmd.alias,
133
+ description: cmd.description,
134
+ source: cmd.source
135
+ })));
136
+ return;
137
+ }
138
+ await this.loadPluginsCommands();
139
+ const projectCommands = await cliCommandsLoader.scanAll();
140
+ this.register(...projectCommands);
141
+ await manifestManager.saveCommands();
142
+ await displayHelp(this.commands.map((cmd) => ({
143
+ name: cmd.name,
144
+ alias: cmd.commandAlias,
145
+ description: cmd.commandDescription,
146
+ source: cmd.commandSource || "project"
147
+ })));
148
+ }
149
+ /**
150
+ * Warm cache - scan all project commands and save to manifest
151
+ */
152
+ async warmCache() {
153
+ console.log();
154
+ console.log(` ${colors.cyan("›")} Scanning project commands...`);
155
+ const projectCommands = await cliCommandsLoader.scanAll();
156
+ this.register(...projectCommands);
157
+ await manifestManager.saveCommands();
158
+ console.log(` ${colors.green("✔")} Cached ${colors.bold(String(projectCommands.length))} project commands`);
159
+ console.log();
160
+ }
161
+ /**
162
+ * Load plugins commands
163
+ */
164
+ async loadPluginsCommands() {
165
+ await warlockConfigManager.load();
166
+ if (warlockConfigManager.isLoaded) this.register(...(warlockConfigManager.get("cli")?.commands || []).map((command) => {
167
+ if (!command.commandSource) command.commandSource = "plugin";
168
+ return command;
169
+ }));
170
+ }
171
+ /**
172
+ * Try to find the command based on the given command name or alias
173
+ */
174
+ async lazyGetCommand(name) {
175
+ let command = this.getCommand(name);
176
+ if (command) return command;
177
+ await this.loadPluginsCommands();
178
+ command = this.getCommand(name);
179
+ if (command) return command;
180
+ await this.loadProjectCommands(name);
181
+ command = this.getCommand(name);
182
+ if (command) return command;
183
+ return null;
184
+ }
185
+ /**
186
+ * Load project commands
187
+ */
188
+ async loadProjectCommands(name) {
189
+ const jsonCommandsFile = await manifestManager.loadCommands();
190
+ if (jsonCommandsFile) for (const fullCommandName in jsonCommandsFile.commands) {
191
+ const cmdMeta = jsonCommandsFile.commands[fullCommandName];
192
+ if (isMatchingCommandName(fullCommandName, name) || cmdMeta.alias === name) {
193
+ const commandPath = cmdMeta.relativePath;
194
+ if (commandPath) {
195
+ const executedCommand = await cliCommandsLoader.load(commandPath);
196
+ if (executedCommand) {
197
+ executedCommand.$relativePath(commandPath);
198
+ this.register(executedCommand);
199
+ return;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ const command = await cliCommandsLoader.locate(name);
205
+ if (command) {
206
+ this.register(command);
207
+ return;
208
+ }
209
+ }
210
+ /**
211
+ * Validate required options
212
+ */
213
+ validateOptions(command, options) {
214
+ const missing = [];
215
+ command.commandOptions.forEach((opt) => {
216
+ if (opt.required) {
217
+ if (!(options[opt.name] !== void 0 || opt.alias && options[opt.alias] !== void 0)) missing.push(opt);
218
+ }
219
+ });
220
+ return missing;
221
+ }
222
+ /**
223
+ * Apply default values to options
224
+ */
225
+ applyDefaultOptions(command, options) {
226
+ const result = { ...options };
227
+ command.commandOptions.forEach((opt) => {
228
+ if (opt.defaultValue !== void 0) {
229
+ if (!(result[opt.name] !== void 0 || opt.alias && result[opt.alias] !== void 0)) result[opt.name] = opt.defaultValue;
230
+ }
231
+ if (opt.alias !== void 0 && result[opt.alias] && result[opt.name] === void 0) result[opt.name] = result[opt.alias];
232
+ });
233
+ return result;
234
+ }
235
+ /**
236
+ * Execute the given command
237
+ */
238
+ async execute(command, data) {
239
+ const startTime = Date.now();
240
+ const missingOptions = this.validateOptions(command, data.options);
241
+ if (missingOptions.length > 0) {
242
+ displayMissingOptions(missingOptions);
243
+ process.exit(1);
244
+ }
245
+ data.options = this.applyDefaultOptions(command, data.options);
246
+ displayExecutingCommand(command.name);
247
+ if (command.commandPreAction) await command.commandPreAction(data);
248
+ if (command.commandPreload) try {
249
+ await this.loadPreloaders(command);
250
+ } catch (error) {
251
+ displayBootError(command.name, error);
252
+ process.exit(1);
253
+ }
254
+ try {
255
+ await command.execute(data);
256
+ if (!command.isPersistent) {
257
+ displayCommandSuccess(command.name, Date.now() - startTime);
258
+ process.exit(0);
259
+ }
260
+ } catch (error) {
261
+ displayCommandError(command.name, error);
262
+ if (!command.isPersistent) process.exit(1);
263
+ }
264
+ }
265
+ /**
266
+ * Load preloaders
267
+ */
268
+ async loadPreloaders(command) {
269
+ const preloaders = command.commandPreload || {};
270
+ if (preloaders.runtimeStrategy) Application.setRuntimeStrategy(preloaders.runtimeStrategy);
271
+ if (preloaders.environemnt) Application.setEnvironment(preloaders.environemnt);
272
+ await warlockConfigManager.load();
273
+ if (preloaders.config || preloaders.bootstrap || preloaders.prestart) await filesOrchestrator.init();
274
+ if (preloaders.env && !preloaders.bootstrap) await loadEnv();
275
+ else if (preloaders.bootstrap) {
276
+ await bootstrap();
277
+ if (await fileExistsAsync(appPath("bootstrap.ts"))) await filesOrchestrator.load("src/app/bootstrap.ts");
278
+ }
279
+ if (preloaders.config) await loadConfigFiles(preloaders.config);
280
+ if (preloaders.prestart) {
281
+ if (await fileExistsAsync(appPath("prestart.ts"))) await filesOrchestrator.load("src/app/prestart.ts");
282
+ }
283
+ if (preloaders.connectors) if (preloaders.connectors === true) await connectorsManager.startPhase("early");
284
+ else await connectorsManager.start(preloaders.connectors);
285
+ }
286
+ };
287
+
288
+ //#endregion
289
+ export { CLICommandsManager };
290
+ //# sourceMappingURL=cli-commands.manager.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-commands.manager.mjs","names":[],"sources":["../../../../../../../@warlock.js/core/src/cli/cli-commands.manager.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport { loadEnv } from \"@mongez/dotenv\";\r\nimport { fileExistsAsync } from \"@warlock.js/fs\";\r\nimport { Application } from \"../application\";\r\nimport { bootstrap } from \"../bootstrap\";\r\nimport { loadConfigFiles } from \"../config/load-config-files\";\r\nimport { connectorsManager } from \"../connectors/connectors-manager\";\r\nimport { ConnectorLifecyclePhase } from \"../connectors/types\";\r\nimport { filesOrchestrator } from \"../dev-server/files-orchestrator\";\r\nimport { manifestManager } from \"../manifest/manifest-manager\";\r\nimport { appPath } from \"../utils\";\r\nimport { warlockConfigManager } from \"../warlock-config/warlock-config.manager\";\r\nimport { CLICommand } from \"./cli-command\";\r\nimport {\r\n displayBootError,\r\n displayCommandError,\r\n displayCommandHelp,\r\n displayCommandNotFound,\r\n displayCommandSuccess,\r\n displayExecutingCommand,\r\n displayHelp,\r\n displayMissingCommand,\r\n displayMissingOptions,\r\n displayWarlockVersionInTerminal,\r\n type HelpCommandInfo,\r\n isMatchingCommandName,\r\n} from \"./cli-commands.utils\";\r\nimport { cliCommandsLoader } from \"./commands-loader\";\r\nimport { frameworkCommands } from \"./framework-cli-commands\";\r\nimport { parseCliArgs } from \"./parse-cli-args\";\r\nimport { findSimilar } from \"./string-similarity\";\r\nimport { CommandActionData, ResolvedCLICommandOption } from \"./types\";\r\n\r\nexport class CLICommandsManager {\r\n /**\r\n * List of commands\r\n */\r\n public commands: CLICommand[] = [];\r\n\r\n /**\r\n * Commands map (name -> command)\r\n */\r\n public commandsMap: Map<string, CLICommand> = new Map();\r\n\r\n /**\r\n * Alias map (alias -> command name)\r\n */\r\n public aliasMap: Map<string, string> = new Map();\r\n\r\n /**\r\n * Register the given commands\r\n */\r\n public register(...commands: CLICommand[]): this {\r\n this.commands.push(...commands);\r\n\r\n commands.forEach((command) => {\r\n const commandKey = command.name.split(\" \")[0];\r\n\r\n manifestManager.addCommandToList(command.name, {\r\n relativePath: command.commandRelativePath,\r\n source: command.commandSource || \"project\",\r\n description: command.commandDescription,\r\n alias: command.commandAlias,\r\n options: command.commandOptions.length > 0 ? command.commandOptions : undefined,\r\n });\r\n\r\n this.commandsMap.set(commandKey, command);\r\n\r\n // Register alias if exists\r\n if (command.commandAlias) {\r\n this.aliasMap.set(command.commandAlias, commandKey);\r\n }\r\n });\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Get command by name or alias\r\n */\r\n public getCommand(name: string): CLICommand | undefined {\r\n // First try direct lookup\r\n let command = this.commandsMap.get(name);\r\n if (command) return command;\r\n\r\n // Try alias lookup\r\n const realName = this.aliasMap.get(name);\r\n if (realName) {\r\n return this.commandsMap.get(realName);\r\n }\r\n\r\n return;\r\n }\r\n\r\n /**\r\n * Get all command names and aliases\r\n * Used for fuzzy matching suggestions\r\n */\r\n public getAllCommandNames(): string[] {\r\n const names: string[] = [];\r\n\r\n // Add all command names\r\n for (const name of this.commandsMap.keys()) {\r\n names.push(name);\r\n }\r\n\r\n // Add all aliases\r\n for (const alias of this.aliasMap.keys()) {\r\n names.push(alias);\r\n }\r\n\r\n // Also include cached commands from manifest\r\n const manifestCommands = manifestManager.commandsJson?.commands || {};\r\n for (const name of Object.keys(manifestCommands)) {\r\n const baseName = name.split(\" \")[0];\r\n if (!names.includes(baseName)) {\r\n names.push(baseName);\r\n }\r\n const alias = manifestCommands[name].alias;\r\n if (alias && !names.includes(alias)) {\r\n names.push(alias);\r\n }\r\n }\r\n\r\n return names;\r\n }\r\n\r\n /**\r\n * Start the cli manager\r\n */\r\n public async start() {\r\n const { name, options, args } = parseCliArgs(process.argv);\r\n\r\n if (options.noCache) {\r\n manifestManager.clearCommandsCache();\r\n // remove the commands.json file as wel\r\n await manifestManager.removeCommandsFile();\r\n }\r\n\r\n if (options.version || options.v) {\r\n await displayWarlockVersionInTerminal();\r\n process.exit(0);\r\n }\r\n\r\n // Try to load from manifest first (fastest path)\r\n await manifestManager.loadCommands();\r\n\r\n // Register framework commands first (needed for help)\r\n this.register(\r\n ...frameworkCommands.map((command) => {\r\n if (!command.commandSource) {\r\n command.commandSource = \"framework\";\r\n }\r\n return command;\r\n }),\r\n );\r\n\r\n const isHelpCommand = options.help || options.h;\r\n\r\n // Handle global help (no command)\r\n if (!name && isHelpCommand) {\r\n await this.showGlobalHelp();\r\n process.exit(0);\r\n }\r\n\r\n // Handle warm cache\r\n if (options.warmCache) {\r\n await this.warmCache();\r\n process.exit(0);\r\n }\r\n\r\n if (!name) {\r\n displayMissingCommand();\r\n process.exit(1);\r\n }\r\n\r\n const command = await this.lazyGetCommand(name);\r\n\r\n if (manifestManager.hasChanges) {\r\n await manifestManager.saveCommands();\r\n }\r\n\r\n if (!command) {\r\n // Find similar commands for suggestions\r\n const allCommandNames = this.getAllCommandNames();\r\n const suggestions = findSimilar(name, allCommandNames).map((s) => s.value);\r\n\r\n displayCommandNotFound(name, suggestions);\r\n process.exit(1);\r\n }\r\n\r\n // Handle command-specific help\r\n if (isHelpCommand) {\r\n displayCommandHelp({\r\n name: command.name,\r\n alias: command.commandAlias,\r\n description: command.commandDescription,\r\n options: command.commandOptions,\r\n });\r\n process.exit(0);\r\n }\r\n\r\n await this.execute(command, {\r\n options,\r\n args,\r\n });\r\n }\r\n\r\n /**\r\n * Show global help with all commands\r\n * Uses manifest if available for fast display\r\n */\r\n protected async showGlobalHelp() {\r\n if (\r\n manifestManager.isCommandLoaded &&\r\n Object.keys(manifestManager.commandsJson?.commands || {}).length > 0\r\n ) {\r\n // Use manifest directly - no need to load command files\r\n const helpCommands: HelpCommandInfo[] = Object.entries(\r\n manifestManager.commandsJson?.commands || {},\r\n ).map(([name, cmd]) => ({\r\n name,\r\n alias: cmd.alias,\r\n description: cmd.description,\r\n source: cmd.source,\r\n }));\r\n\r\n await displayHelp(helpCommands);\r\n return;\r\n }\r\n\r\n // Fallback: No manifest, build from registered commands\r\n // This happens on first run before warm-cache\r\n await this.loadPluginsCommands();\r\n\r\n const projectCommands = await cliCommandsLoader.scanAll();\r\n\r\n this.register(...projectCommands);\r\n\r\n await manifestManager.saveCommands();\r\n\r\n // Build help info from registered commands\r\n const helpCommands: HelpCommandInfo[] = this.commands.map((cmd) => ({\r\n name: cmd.name,\r\n alias: cmd.commandAlias,\r\n description: cmd.commandDescription,\r\n source: cmd.commandSource || \"project\",\r\n }));\r\n\r\n await displayHelp(helpCommands);\r\n }\r\n\r\n /**\r\n * Warm cache - scan all project commands and save to manifest\r\n */\r\n protected async warmCache() {\r\n console.log();\r\n console.log(` ${colors.cyan(\"›\")} Scanning project commands...`);\r\n\r\n const projectCommands = await cliCommandsLoader.scanAll();\r\n\r\n this.register(...projectCommands);\r\n\r\n await manifestManager.saveCommands();\r\n\r\n console.log(\r\n ` ${colors.green(\"✔\")} Cached ${colors.bold(String(projectCommands.length))} project commands`,\r\n );\r\n console.log();\r\n }\r\n\r\n /**\r\n * Load plugins commands\r\n */\r\n protected async loadPluginsCommands() {\r\n await warlockConfigManager.load();\r\n\r\n if (warlockConfigManager.isLoaded) {\r\n this.register(\r\n ...(warlockConfigManager.get(\"cli\")?.commands || []).map((command) => {\r\n if (!command.commandSource) {\r\n command.commandSource = \"plugin\";\r\n }\r\n return command;\r\n }),\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Try to find the command based on the given command name or alias\r\n */\r\n protected async lazyGetCommand(name: string) {\r\n // first step, try to find it directly through current commands\r\n let command = this.getCommand(name);\r\n if (command) {\r\n return command;\r\n }\r\n\r\n // second step, try to find it through warlock config commands\r\n await this.loadPluginsCommands();\r\n\r\n command = this.getCommand(name);\r\n\r\n if (command) {\r\n return command;\r\n }\r\n\r\n // third step, try to find it through project commands\r\n await this.loadProjectCommands(name);\r\n\r\n command = this.getCommand(name);\r\n if (command) {\r\n return command;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Load project commands\r\n */\r\n protected async loadProjectCommands(name: string) {\r\n // first get the commands.json contents as an object\r\n const jsonCommandsFile = await manifestManager.loadCommands();\r\n\r\n if (jsonCommandsFile) {\r\n // Check by name or alias\r\n for (const fullCommandName in jsonCommandsFile.commands) {\r\n const cmdMeta = jsonCommandsFile.commands[fullCommandName];\r\n\r\n // Match by name or alias\r\n if (isMatchingCommandName(fullCommandName, name) || cmdMeta.alias === name) {\r\n const commandPath = cmdMeta.relativePath;\r\n if (commandPath) {\r\n const executedCommand = await cliCommandsLoader.load(commandPath);\r\n\r\n if (executedCommand) {\r\n executedCommand.$relativePath(commandPath);\r\n this.register(executedCommand);\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n const command = await cliCommandsLoader.locate(name);\r\n\r\n if (command) {\r\n this.register(command);\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Validate required options\r\n */\r\n protected validateOptions(\r\n command: CLICommand,\r\n options: Record<string, string | boolean | number>,\r\n ): ResolvedCLICommandOption[] {\r\n const missing: ResolvedCLICommandOption[] = [];\r\n\r\n command.commandOptions.forEach((opt) => {\r\n if (opt.required) {\r\n // Check if option is provided by name or alias\r\n const hasOption =\r\n options[opt.name] !== undefined || (opt.alias && options[opt.alias] !== undefined);\r\n if (!hasOption) {\r\n missing.push(opt);\r\n }\r\n }\r\n });\r\n\r\n return missing;\r\n }\r\n\r\n /**\r\n * Apply default values to options\r\n */\r\n protected applyDefaultOptions(\r\n command: CLICommand,\r\n options: Record<string, string | boolean | number>,\r\n ): Record<string, string | boolean | number> {\r\n const result = { ...options };\r\n\r\n command.commandOptions.forEach((opt) => {\r\n if (opt.defaultValue !== undefined) {\r\n const hasOption =\r\n result[opt.name] !== undefined || (opt.alias && result[opt.alias] !== undefined);\r\n if (!hasOption) {\r\n result[opt.name] = opt.defaultValue;\r\n }\r\n }\r\n\r\n if (opt.alias !== undefined && result[opt.alias] && result[opt.name] === undefined) {\r\n result[opt.name] = result[opt.alias];\r\n }\r\n });\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Execute the given command\r\n */\r\n public async execute(command: CLICommand, data: CommandActionData) {\r\n const startTime = Date.now();\r\n\r\n // Validate required options\r\n const missingOptions = this.validateOptions(command, data.options);\r\n if (missingOptions.length > 0) {\r\n displayMissingOptions(missingOptions);\r\n process.exit(1);\r\n }\r\n\r\n // Apply default values\r\n data.options = this.applyDefaultOptions(command, data.options);\r\n\r\n displayExecutingCommand(command.name);\r\n\r\n if (command.commandPreAction) {\r\n await command.commandPreAction(data);\r\n }\r\n\r\n // load preloaders\r\n if (command.commandPreload) {\r\n try {\r\n await this.loadPreloaders(command);\r\n } catch (error) {\r\n // A preload failure (a bad import in a config file, a connector that\r\n // throws on boot, a missing module export) happens BEFORE the command's\r\n // action runs — there is no run loop to recover into, so it is ALWAYS\r\n // fatal, persistent command (dev/start) or not. Surface the real cause\r\n // and the offending file, then exit. This MUST stay outside the\r\n // command-execute try/catch below: letting a preload rejection escape\r\n // turned `warlock dev` into a silent hang — the unhandled rejection slid\r\n // past while the already-started loader worker thread kept the process\r\n // alive, freezing just after the banner with no error printed.\r\n displayBootError(command.name, error as Error);\r\n process.exit(1);\r\n }\r\n }\r\n\r\n try {\r\n await command.execute(data);\r\n\r\n if (!command.isPersistent) {\r\n displayCommandSuccess(command.name, Date.now() - startTime);\r\n\r\n process.exit(0);\r\n }\r\n } catch (error) {\r\n displayCommandError(command.name, error as Error);\r\n // Persistent commands (dev/start) own their startup-failure exits;\r\n // by the time an error reaches here they've already entered their\r\n // run loop, so it's a runtime error we log but don't crash on —\r\n // HMR or process supervisors can recover. Non-persistent\r\n // one-shot commands always exit on failure.\r\n if (!command.isPersistent) {\r\n process.exit(1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Load preloaders\r\n */\r\n protected async loadPreloaders(command: CLICommand) {\r\n const preloaders = command.commandPreload || {};\r\n\r\n if (preloaders.runtimeStrategy) {\r\n Application.setRuntimeStrategy(preloaders.runtimeStrategy);\r\n }\r\n\r\n if (preloaders.environemnt) {\r\n Application.setEnvironment(preloaders.environemnt);\r\n }\r\n\r\n await warlockConfigManager.load();\r\n\r\n if (preloaders.config || preloaders.bootstrap || preloaders.prestart) {\r\n await filesOrchestrator.init();\r\n }\r\n\r\n if (preloaders.env && !preloaders.bootstrap) {\r\n await loadEnv();\r\n } else if (preloaders.bootstrap) {\r\n await bootstrap();\r\n\r\n if (await fileExistsAsync(appPath(\"bootstrap.ts\"))) {\r\n await filesOrchestrator.load(\"src/app/bootstrap.ts\");\r\n }\r\n }\r\n\r\n // Load configuration files\r\n if (preloaders.config) {\r\n await loadConfigFiles(preloaders.config);\r\n }\r\n\r\n if (preloaders.prestart) {\r\n if (await fileExistsAsync(appPath(\"prestart.ts\"))) {\r\n await filesOrchestrator.load(\"src/app/prestart.ts\");\r\n }\r\n }\r\n\r\n // Initialize connectors.\r\n // `connectors: true` only starts the early phase here — late-phase\r\n // connectors (http, socket) start after the command's action loads\r\n // app code. Explicit lists bypass phase splitting (caller knows\r\n // exactly which connectors they want).\r\n if (preloaders.connectors) {\r\n if (preloaders.connectors === true) {\r\n await connectorsManager.startPhase(ConnectorLifecyclePhase.Early);\r\n } else {\r\n await connectorsManager.start(preloaders.connectors);\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,qBAAb,MAAgC;;kBAIE,CAAC;qCAKa,IAAI,IAAI;kCAKf,IAAI,IAAI;;;;;CAK/C,AAAO,SAAS,GAAG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b;OAAI,MAAM,gBAAgB,QAAQ,aAAa,CAAC,GAC9C,MAAM,kBAAkB,KAAK,qBAAqB;EACpD;EAQF,IAAI,WAAW,YACb,IAAI,WAAW,eAAe,MAC5B,MAAM,kBAAkB,kBAAwC;OAEhE,MAAM,kBAAkB,MAAM,WAAW,UAAU;CAGzD;AACF"}
@@ -0,0 +1,217 @@
1
+ import { getWarlockVersion } from "../utils/framework-vesion.mjs";
2
+ import { colors } from "@mongez/copper";
3
+
4
+ //#region ../@warlock.js/core/src/cli/cli-commands.utils.ts
5
+ function isMatchingCommandName(commandName, targetingCommandName) {
6
+ return commandName.split(" ")[0] === targetingCommandName;
7
+ }
8
+ /**
9
+ * Display the Warlock.js version banner
10
+ */
11
+ async function displayWarlockVersionInTerminal() {
12
+ const version = await getWarlockVersion();
13
+ console.log(`⚡ ${colors.bold("Warlock.js")} ${colors.greenBright(`v${version}`)}`);
14
+ }
15
+ function getTextColorMethod(environment) {
16
+ switch (environment) {
17
+ case "development": return colors.yellowBright;
18
+ case "production": return colors.greenBright;
19
+ case "test": return colors.blueBright;
20
+ default: return colors.whiteBright;
21
+ }
22
+ }
23
+ /**
24
+ * Display CLI startup banner
25
+ */
26
+ async function displayStartupBanner({ environment }) {
27
+ const version = await getWarlockVersion();
28
+ const textColorMethod = getTextColorMethod(environment);
29
+ console.log(` ⚡ ${colors.bold(textColorMethod("Warlock.js"))} ${colors.dim(`v${version}`)}`);
30
+ console.log();
31
+ }
32
+ /**
33
+ * Display command execution header
34
+ */
35
+ function displayExecutingCommand(commandName) {
36
+ console.log(` ${colors.cyan("›")} Running ${colors.bold(colors.white(commandName))}...`);
37
+ console.log();
38
+ }
39
+ /**
40
+ * Display command not found error with optional suggestions
41
+ */
42
+ function displayCommandNotFound(commandName, suggestions) {
43
+ console.log();
44
+ console.log(` ${colors.red("✖")} Command ${colors.magenta(commandName)} not found`);
45
+ if (suggestions && suggestions.length > 0) {
46
+ console.log();
47
+ console.log(` ${colors.yellow("Did you mean?")}`);
48
+ suggestions.forEach((suggestion) => {
49
+ console.log(` ${colors.cyan("→")} ${colors.white(suggestion)}`);
50
+ });
51
+ }
52
+ console.log();
53
+ console.log(` ${colors.dim("Run")} ${colors.cyan("warlock --help")} ${colors.dim("to see available commands")}`);
54
+ console.log();
55
+ }
56
+ /**
57
+ * Display missing command error
58
+ */
59
+ function displayMissingCommand() {
60
+ console.log();
61
+ console.log(` ${colors.red("✖")} No command specified`);
62
+ console.log(` ${colors.dim("Run")} ${colors.cyan("warlock --help")} ${colors.dim("to see available commands")}`);
63
+ console.log();
64
+ }
65
+ /**
66
+ * Display command success message
67
+ */
68
+ function displayCommandSuccess(commandName, durationMs) {
69
+ const duration = durationMs ? colors.dim(` (${durationMs}ms)`) : "";
70
+ console.log();
71
+ console.log(` ${colors.green("✔")} ${colors.bold(commandName)} completed successfully${duration}`);
72
+ console.log();
73
+ }
74
+ /**
75
+ * Display command error message
76
+ */
77
+ function displayCommandError(commandName, error) {
78
+ console.log();
79
+ console.log(` ${colors.red("✖")} ${colors.bold(commandName)} failed`);
80
+ console.log(` ${colors.dim(error.message)}`);
81
+ console.log();
82
+ }
83
+ /**
84
+ * Display a FATAL boot/preload failure and exit information.
85
+ *
86
+ * Preload failures — a bad import in a config file, a connector that throws
87
+ * on startup, a missing module export — happen BEFORE the command's run loop
88
+ * exists, so there is nothing to recover into: they are always fatal. Unlike
89
+ * `displayCommandError`, this prints the full stack (not just `error.message`)
90
+ * because the stack names the exact file + line of the offending import, which
91
+ * is the single most useful clue when a config file pulls in a broken module.
92
+ *
93
+ * Surfacing this loudly is the difference between a clear error and a silent
94
+ * hang: an unhandled preload rejection used to escape while the already-started
95
+ * loader worker thread kept the process alive, leaving `warlock dev` frozen
96
+ * just after the banner with no message at all.
97
+ *
98
+ * @example
99
+ * // SyntaxError: The requested module '@warlock.js/cascade' does not
100
+ * // provide an export named 'belongsTo'
101
+ * // at src/app/.../permission.model.ts:2
102
+ */
103
+ function displayBootError(commandName, error) {
104
+ console.log();
105
+ console.log(` ${colors.red("✖")} ${colors.bold(commandName)} failed to start`);
106
+ console.log(` ${colors.red(error.message)}`);
107
+ if (error.stack) {
108
+ console.log();
109
+ console.log(colors.dim(error.stack));
110
+ }
111
+ console.log();
112
+ }
113
+ /**
114
+ * Display missing required options error
115
+ */
116
+ function displayMissingOptions(options) {
117
+ console.log();
118
+ console.log(` ${colors.red("✖")} Missing required options:`);
119
+ options.forEach((opt) => {
120
+ console.log(` ${colors.yellow(opt.text)} ${colors.dim(`(--${opt.name})`)}`);
121
+ });
122
+ console.log();
123
+ }
124
+ /**
125
+ * Display global help with all commands grouped by source
126
+ */
127
+ async function displayHelp(commands) {
128
+ const version = await getWarlockVersion();
129
+ console.log();
130
+ console.log(` ⚡ ${colors.bold(colors.yellowBright("Warlock.js"))} CLI ${colors.dim(`v${version}`)}`);
131
+ console.log();
132
+ console.log(` ${colors.bold("Usage:")} ${colors.cyan("warlock")} ${colors.dim("<command>")} ${colors.dim("[options]")}`);
133
+ console.log();
134
+ const grouped = {
135
+ framework: [],
136
+ plugin: [],
137
+ project: []
138
+ };
139
+ commands.forEach((cmd) => {
140
+ grouped[cmd.source]?.push(cmd);
141
+ });
142
+ const groupLabels = {
143
+ framework: "Framework Commands",
144
+ plugin: "Plugin Commands",
145
+ project: "Project Commands"
146
+ };
147
+ for (const [source, cmds] of Object.entries(grouped)) {
148
+ if (cmds.length === 0) continue;
149
+ console.log(` ${colors.bold(colors.white(groupLabels[source]))}`);
150
+ console.log();
151
+ const maxLen = Math.max(...cmds.map((c) => c.name.length + (c.alias ? c.alias.length + 4 : 0)));
152
+ cmds.forEach((cmd) => {
153
+ const aliasStr = cmd.alias ? colors.dim(` (${cmd.alias})`) : "";
154
+ const nameWithAlias = cmd.name + (cmd.alias ? ` (${cmd.alias})` : "");
155
+ const padding = " ".repeat(maxLen - nameWithAlias.length + 2);
156
+ const desc = cmd.description || "";
157
+ console.log(` ${colors.cyan(cmd.name)}${aliasStr}${padding}${desc}`);
158
+ });
159
+ console.log();
160
+ }
161
+ console.log(` ${colors.bold(colors.white("Global Flags"))}`);
162
+ console.log();
163
+ const globalFlags = [
164
+ {
165
+ flag: "--help, -h",
166
+ description: "Show help for a command"
167
+ },
168
+ {
169
+ flag: "--version, -v",
170
+ description: "Show Warlock version"
171
+ },
172
+ {
173
+ flag: "--no-cache",
174
+ description: "Force reload without cache"
175
+ },
176
+ {
177
+ flag: "--warm-cache",
178
+ description: "Pre-cache all project commands"
179
+ }
180
+ ];
181
+ const maxFlagLen = Math.max(...globalFlags.map((f) => f.flag.length));
182
+ globalFlags.forEach(({ flag, description }) => {
183
+ const padding = " ".repeat(maxFlagLen - flag.length + 2);
184
+ console.log(` ${colors.yellow(flag)}${padding}${description}`);
185
+ });
186
+ console.log();
187
+ console.log(` ${colors.dim("Run")} ${colors.cyan("warlock <command> --help")} ${colors.dim("for command-specific help")}`);
188
+ console.log();
189
+ }
190
+ /**
191
+ * Display help for a specific command
192
+ */
193
+ function displayCommandHelp(command) {
194
+ console.log();
195
+ console.log(` ${colors.bold(colors.cyan(command.name))}${command.alias ? colors.dim(` (${command.alias})`) : ""}`);
196
+ if (command.description) console.log(` ${command.description}`);
197
+ console.log();
198
+ if (command.options && command.options.length > 0) {
199
+ console.log(` ${colors.bold("Options:")}`);
200
+ console.log();
201
+ const maxLen = Math.max(...command.options.map((o) => o.text.length));
202
+ command.options.forEach((opt) => {
203
+ const padding = " ".repeat(maxLen - opt.text.length + 2);
204
+ const required = opt.required ? colors.red(" (required)") : "";
205
+ const desc = opt.description || "";
206
+ console.log(` ${colors.green(opt.text)}${padding}${desc}${required}`);
207
+ });
208
+ console.log();
209
+ } else {
210
+ console.log(` ${colors.dim("No options available")}`);
211
+ console.log();
212
+ }
213
+ }
214
+
215
+ //#endregion
216
+ export { displayBootError, displayCommandError, displayCommandHelp, displayCommandNotFound, displayCommandSuccess, displayExecutingCommand, displayHelp, displayMissingCommand, displayMissingOptions, displayStartupBanner, displayWarlockVersionInTerminal, isMatchingCommandName };
217
+ //# sourceMappingURL=cli-commands.utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-commands.utils.mjs","names":[],"sources":["../../../../../../../@warlock.js/core/src/cli/cli-commands.utils.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { Environment } from \"../utils\";\nimport { getWarlockVersion } from \"../utils/framework-vesion\";\n\nexport function isMatchingCommandName(commandName: string, targetingCommandName: string) {\n return commandName.split(\" \")[0] === targetingCommandName;\n}\n\n/**\n * Display the Warlock.js version banner\n */\nexport async function displayWarlockVersionInTerminal() {\n const version = await getWarlockVersion();\n console.log(`⚡ ${colors.bold(\"Warlock.js\")} ${colors.greenBright(`v${version}`)}`);\n}\n\ntype StartBannerOptions = {\n environment: Environment;\n};\n\nfunction getTextColorMethod(environment: Environment) {\n switch (environment) {\n case \"development\":\n return colors.yellowBright;\n case \"production\":\n return colors.greenBright;\n case \"test\":\n return colors.blueBright;\n default:\n return colors.whiteBright;\n }\n}\n\n/**\n * Display CLI startup banner\n */\nexport async function displayStartupBanner({ environment }: StartBannerOptions) {\n const version = await getWarlockVersion();\n const textColorMethod = getTextColorMethod(environment);\n console.log(` ⚡ ${colors.bold(textColorMethod(\"Warlock.js\"))} ${colors.dim(`v${version}`)}`);\n console.log();\n}\n\n/**\n * Display command execution header\n */\nexport function displayExecutingCommand(commandName: string) {\n console.log(` ${colors.cyan(\"›\")} Running ${colors.bold(colors.white(commandName))}...`);\n console.log();\n}\n\n/**\n * Display command not found error with optional suggestions\n */\nexport function displayCommandNotFound(commandName: string, suggestions?: string[]) {\n console.log();\n console.log(` ${colors.red(\"✖\")} Command ${colors.magenta(commandName)} not found`);\n\n if (suggestions && suggestions.length > 0) {\n console.log();\n console.log(` ${colors.yellow(\"Did you mean?\")}`);\n suggestions.forEach((suggestion) => {\n console.log(` ${colors.cyan(\"→\")} ${colors.white(suggestion)}`);\n });\n }\n\n console.log();\n console.log(\n ` ${colors.dim(\"Run\")} ${colors.cyan(\"warlock --help\")} ${colors.dim(\"to see available commands\")}`,\n );\n console.log();\n}\n\n/**\n * Display missing command error\n */\nexport function displayMissingCommand() {\n console.log();\n console.log(` ${colors.red(\"✖\")} No command specified`);\n console.log(\n ` ${colors.dim(\"Run\")} ${colors.cyan(\"warlock --help\")} ${colors.dim(\"to see available commands\")}`,\n );\n console.log();\n}\n\n/**\n * Display command success message\n */\nexport function displayCommandSuccess(commandName: string, durationMs?: number) {\n const duration = durationMs ? colors.dim(` (${durationMs}ms)`) : \"\";\n console.log();\n console.log(\n ` ${colors.green(\"✔\")} ${colors.bold(commandName)} completed successfully${duration}`,\n );\n console.log();\n}\n\n/**\n * Display command error message\n */\nexport function displayCommandError(commandName: string, error: Error) {\n console.log();\n console.log(` ${colors.red(\"✖\")} ${colors.bold(commandName)} failed`);\n console.log(` ${colors.dim(error.message)}`);\n console.log();\n}\n\n/**\n * Display a FATAL boot/preload failure and exit information.\n *\n * Preload failures — a bad import in a config file, a connector that throws\n * on startup, a missing module export — happen BEFORE the command's run loop\n * exists, so there is nothing to recover into: they are always fatal. Unlike\n * `displayCommandError`, this prints the full stack (not just `error.message`)\n * because the stack names the exact file + line of the offending import, which\n * is the single most useful clue when a config file pulls in a broken module.\n *\n * Surfacing this loudly is the difference between a clear error and a silent\n * hang: an unhandled preload rejection used to escape while the already-started\n * loader worker thread kept the process alive, leaving `warlock dev` frozen\n * just after the banner with no message at all.\n *\n * @example\n * // SyntaxError: The requested module '@warlock.js/cascade' does not\n * // provide an export named 'belongsTo'\n * // at src/app/.../permission.model.ts:2\n */\nexport function displayBootError(commandName: string, error: Error) {\n console.log();\n console.log(` ${colors.red(\"✖\")} ${colors.bold(commandName)} failed to start`);\n console.log(` ${colors.red(error.message)}`);\n if (error.stack) {\n console.log();\n console.log(colors.dim(error.stack));\n }\n console.log();\n}\n\n/**\n * Display missing required options error\n */\nexport function displayMissingOptions(options: { name: string; text: string }[]) {\n console.log();\n console.log(` ${colors.red(\"✖\")} Missing required options:`);\n options.forEach((opt) => {\n console.log(` ${colors.yellow(opt.text)} ${colors.dim(`(--${opt.name})`)}`);\n });\n console.log();\n}\n\n/**\n * Command info for help display\n */\nexport type HelpCommandInfo = {\n name: string;\n alias?: string;\n description?: string;\n source: \"framework\" | \"plugin\" | \"project\";\n};\n\n/**\n * Display global help with all commands grouped by source\n */\nexport async function displayHelp(commands: HelpCommandInfo[]) {\n const version = await getWarlockVersion();\n\n console.log();\n console.log(\n ` ⚡ ${colors.bold(colors.yellowBright(\"Warlock.js\"))} CLI ${colors.dim(`v${version}`)}`,\n );\n console.log();\n console.log(\n ` ${colors.bold(\"Usage:\")} ${colors.cyan(\"warlock\")} ${colors.dim(\"<command>\")} ${colors.dim(\"[options]\")}`,\n );\n console.log();\n\n // Group by source\n const grouped: Record<string, HelpCommandInfo[]> = {\n framework: [],\n plugin: [],\n project: [],\n };\n\n commands.forEach((cmd) => {\n grouped[cmd.source]?.push(cmd);\n });\n\n // Display each group\n const groupLabels: Record<string, string> = {\n framework: \"Framework Commands\",\n plugin: \"Plugin Commands\",\n project: \"Project Commands\",\n };\n\n for (const [source, cmds] of Object.entries(grouped)) {\n if (cmds.length === 0) continue;\n\n console.log(` ${colors.bold(colors.white(groupLabels[source]))}`);\n console.log();\n\n // Find max name length for alignment\n const maxLen = Math.max(...cmds.map((c) => c.name.length + (c.alias ? c.alias.length + 4 : 0)));\n\n cmds.forEach((cmd) => {\n const aliasStr = cmd.alias ? colors.dim(` (${cmd.alias})`) : \"\";\n const nameWithAlias = cmd.name + (cmd.alias ? ` (${cmd.alias})` : \"\");\n const padding = \" \".repeat(maxLen - nameWithAlias.length + 2);\n // const desc = cmd.description || colors.dim(\"No description\");\n const desc = cmd.description || \"\";\n console.log(` ${colors.cyan(cmd.name)}${aliasStr}${padding}${desc}`);\n });\n console.log();\n }\n\n // Display global flags\n console.log(` ${colors.bold(colors.white(\"Global Flags\"))}`);\n console.log();\n\n const globalFlags = [\n { flag: \"--help, -h\", description: \"Show help for a command\" },\n { flag: \"--version, -v\", description: \"Show Warlock version\" },\n { flag: \"--no-cache\", description: \"Force reload without cache\" },\n { flag: \"--warm-cache\", description: \"Pre-cache all project commands\" },\n ];\n\n const maxFlagLen = Math.max(...globalFlags.map((f) => f.flag.length));\n\n globalFlags.forEach(({ flag, description }) => {\n const padding = \" \".repeat(maxFlagLen - flag.length + 2);\n console.log(` ${colors.yellow(flag)}${padding}${description}`);\n });\n console.log();\n\n console.log(\n ` ${colors.dim(\"Run\")} ${colors.cyan(\"warlock <command> --help\")} ${colors.dim(\"for command-specific help\")}`,\n );\n console.log();\n}\n\n/**\n * Display help for a specific command\n */\nexport function displayCommandHelp(command: {\n name: string;\n alias?: string;\n description?: string;\n options?: { name: string; text: string; description?: string; required?: boolean }[];\n}) {\n console.log();\n console.log(\n ` ${colors.bold(colors.cyan(command.name))}${command.alias ? colors.dim(` (${command.alias})`) : \"\"}`,\n );\n\n if (command.description) {\n console.log(` ${command.description}`);\n }\n console.log();\n\n if (command.options && command.options.length > 0) {\n console.log(` ${colors.bold(\"Options:\")}`);\n console.log();\n\n const maxLen = Math.max(...command.options.map((o) => o.text.length));\n\n command.options.forEach((opt) => {\n const padding = \" \".repeat(maxLen - opt.text.length + 2);\n const required = opt.required ? colors.red(\" (required)\") : \"\";\n const desc = opt.description || \"\";\n console.log(` ${colors.green(opt.text)}${padding}${desc}${required}`);\n });\n console.log();\n } else {\n console.log(` ${colors.dim(\"No options available\")}`);\n console.log();\n }\n}\n"],"mappings":";;;;AAIA,SAAgB,sBAAsB,aAAqB,sBAA8B;CACvF,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,OAAO;AACvC;;;;AAKA,eAAsB,kCAAkC;CACtD,MAAM,UAAU,MAAM,kBAAkB;CACxC,QAAQ,IAAI,KAAK,OAAO,KAAK,YAAY,EAAE,GAAG,OAAO,YAAY,IAAI,SAAS,GAAG;AACnF;AAMA,SAAS,mBAAmB,aAA0B;CACpD,QAAQ,aAAR;EACE,KAAK,eACH,OAAO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GAChC,QAAQ,IAAI,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,UAAU,OAAO,UAAU;EACzE,CAAC;EACD,QAAQ,IAAI;CACd,OAAO;EACL,QAAQ,IAAI,KAAK,OAAO,IAAI,sBAAsB,GAAG;EACrD,QAAQ,IAAI;CACd;AACF"}
@@ -0,0 +1,27 @@
1
+ import { command } from "../cli-command.mjs";
2
+ import { addCommandAction } from "../../generations/add-command.action.mjs";
3
+
4
+ //#region ../@warlock.js/core/src/cli/commands/add.command.ts
5
+ const addCommand = command({
6
+ name: "add <features...>",
7
+ description: "Add new feature(s) to the project",
8
+ action: addCommandAction,
9
+ options: [
10
+ {
11
+ text: "--package-manager -pm",
12
+ description: "Package manager to use, if not passed, it will be detected automatically"
13
+ },
14
+ {
15
+ text: "--list, -l",
16
+ description: "List available features"
17
+ },
18
+ {
19
+ text: "--no-install",
20
+ description: "Record dependencies in package.json without installing them — still ejects configs, adds scripts, and runs setup hooks. Pass it last, after the feature list. Used by scaffolders that run a single install afterwards."
21
+ }
22
+ ]
23
+ });
24
+
25
+ //#endregion
26
+ export { addCommand };
27
+ //# sourceMappingURL=add.command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.command.mjs","names":[],"sources":["../../../../../../../../@warlock.js/core/src/cli/commands/add.command.ts"],"sourcesContent":["import { addCommandAction } from \"../../generations/add-command.action\";\r\nimport { command } from \"../cli-command\";\r\n\r\nexport const addCommand = command({\r\n name: \"add <features...>\",\r\n description: \"Add new feature(s) to the project\",\r\n action: addCommandAction,\r\n options: [\r\n {\r\n text: \"--package-manager -pm\",\r\n description: \"Package manager to use, if not passed, it will be detected automatically\",\r\n },\r\n {\r\n text: \"--list, -l\",\r\n description: \"List available features\",\r\n },\r\n {\r\n text: \"--no-install\",\r\n description:\r\n \"Record dependencies in package.json without installing them — still ejects configs, adds scripts, and runs setup hooks. Pass it last, after the feature list. Used by scaffolders that run a single install afterwards.\",\r\n },\r\n ],\r\n});\r\n"],"mappings":";;;;AAGA,MAAa,aAAa,QAAQ;CAChC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,SAAS;EACP;GACE,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,aACE;EACJ;CACF;AACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { command } from "../cli-command.mjs";
2
+ import { buildAppProduction } from "../../production/build-app-production.mjs";
3
+
4
+ //#region ../@warlock.js/core/src/cli/commands/build.command.ts
5
+ const buildCommand = command({
6
+ name: "build",
7
+ description: "Build the project for production",
8
+ action: buildAppProduction,
9
+ preload: { warlockConfig: true }
10
+ });
11
+
12
+ //#endregion
13
+ export { buildCommand };
14
+ //# sourceMappingURL=build.command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.command.mjs","names":[],"sources":["../../../../../../../../@warlock.js/core/src/cli/commands/build.command.ts"],"sourcesContent":["import { buildAppProduction } from \"../../production/build-app-production\";\nimport { command } from \"../cli-command\";\n\nexport const buildCommand = command({\n name: \"build\",\n description: \"Build the project for production\",\n action: buildAppProduction,\n preload: {\n warlockConfig: true,\n },\n});\n"],"mappings":";;;;AAGA,MAAa,eAAe,QAAQ;CAClC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,SAAS,EACP,eAAe,KACjB;AACF,CAAC"}