@holo-js/cli 0.2.6 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/bin/holo.mjs +417 -109
  2. package/dist/{broadcast-JBQWQZSO.mjs → broadcast-PJLFVZH4.mjs} +12 -12
  3. package/dist/cache-KR4ACOYD.mjs +137 -0
  4. package/dist/{cache-migrations-77TLXIVG.mjs → cache-migrations-J34RE4WH.mjs} +13 -13
  5. package/dist/{chunk-LXGQCG56.mjs → chunk-2XXJ76YC.mjs} +1 -1
  6. package/dist/chunk-3ICVWL2M.mjs +491 -0
  7. package/dist/{chunk-YEFJBN56.mjs → chunk-4VYR2ARA.mjs} +11 -8
  8. package/dist/{chunk-VP2E62DF.mjs → chunk-7KZVFDSI.mjs} +49 -349
  9. package/dist/chunk-AZ6NVJAP.mjs +360 -0
  10. package/dist/chunk-CT23GSEC.mjs +156 -0
  11. package/dist/{chunk-7B2RVYLL.mjs → chunk-FFTJKBQF.mjs} +293 -399
  12. package/dist/{chunk-KS5TWO75.mjs → chunk-I3RRWDLV.mjs} +7 -7
  13. package/dist/{chunk-J76GH2DR.mjs → chunk-L3YATEQY.mjs} +129 -86
  14. package/dist/{chunk-4K4CWMMP.mjs → chunk-L6FF22IV.mjs} +76 -61
  15. package/dist/{chunk-ILU426CF.mjs → chunk-PVVGQSUP.mjs} +482 -2
  16. package/dist/chunk-XBOVM6LO.mjs +41 -0
  17. package/dist/{chunk-I7QBCEV7.mjs → chunk-Y355VYRN.mjs} +5 -3
  18. package/dist/{chunk-VRGB6DIS.mjs → chunk-YJWHIQ45.mjs} +2 -0
  19. package/dist/{config-MD27U4FM.mjs → config-XVPV6DJW.mjs} +3 -3
  20. package/dist/{dev-L4Y2GU2E.mjs → dev-NTQTEY5B.mjs} +9 -8
  21. package/dist/{discovery-GWTBF5RZ.mjs → discovery-TMPUQQHI.mjs} +8 -6
  22. package/dist/{generators-VCYISHWO.mjs → generators-3FDCCJDC.mjs} +16 -15
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.mjs +419 -111
  25. package/dist/{media-migrations-BNVAPYEM.mjs → media-migrations-UJ6BMUSZ.mjs} +12 -12
  26. package/dist/plugins-USHY6SPF.mjs +24 -0
  27. package/dist/{queue-5BXSDFCO.mjs → queue-6U7JU4T6.mjs} +53 -17
  28. package/dist/{queue-D4LSWNS2.mjs → queue-VJEFD6SE.mjs} +55 -19
  29. package/dist/{queue-migrations-EF4AMMSY.mjs → queue-migrations-6YUUOKMH.mjs} +17 -14
  30. package/dist/{runtime-RPMZMTD4.mjs → runtime-FVRB4O2M.mjs} +8 -8
  31. package/dist/{runtime-GSXF4NB3.mjs → runtime-P5R7H3B4.mjs} +1 -1
  32. package/dist/runtime-worker.mjs +7 -1
  33. package/dist/{scaffold-NJ5VH73M.mjs → scaffold-F3AZDNPG.mjs} +9 -4
  34. package/dist/{security-K5PZS3E3.mjs → security-X4274RHX.mjs} +8 -7
  35. package/package.json +35 -8
  36. package/dist/broadcast-YGJFCEPP.mjs +0 -204
  37. package/dist/cache-HUGRWOHQ.mjs +0 -66
  38. package/dist/cache-OSJ4PD52.mjs +0 -66
  39. package/dist/cache-migrations-FKAHRP24.mjs +0 -173
  40. package/dist/chunk-AJLRAC5M.mjs +0 -497
  41. package/dist/chunk-C624G3R2.mjs +0 -3306
  42. package/dist/chunk-D7O4SU6N.mjs +0 -2
  43. package/dist/chunk-FGQ2I2YH.mjs +0 -22
  44. package/dist/chunk-LBJAJLKU.mjs +0 -25
  45. package/dist/dev-YPBQBEOE.mjs +0 -44
  46. package/dist/generators-H4NTV4DB.mjs +0 -520
  47. package/dist/media-migrations-NNB3DAQR.mjs +0 -106
  48. package/dist/queue-migrations-LXEWXJYT.mjs +0 -168
  49. package/dist/runtime-UKBJQFXM.mjs +0 -57
  50. package/dist/scaffold-VV3KTYGO.mjs +0 -139
  51. package/dist/security-JR4P7L2C.mjs +0 -71
package/dist/index.mjs CHANGED
@@ -15,26 +15,30 @@ import {
15
15
  resolveNewProjectInput,
16
16
  resolveStringFlag,
17
17
  splitCsv
18
- } from "./chunk-VRGB6DIS.mjs";
18
+ } from "./chunk-YJWHIQ45.mjs";
19
19
  import {
20
- hasProjectDependency
21
- } from "./chunk-FGQ2I2YH.mjs";
22
- import {
23
- fileExists
24
- } from "./chunk-LBJAJLKU.mjs";
20
+ hasProjectDependency,
21
+ pinProjectDependencyVersions,
22
+ removeProjectDependency,
23
+ upsertProjectDependency
24
+ } from "./chunk-CT23GSEC.mjs";
25
25
  import {
26
26
  runWithSpinner,
27
- supportsSpinner,
28
27
  writeLine
29
- } from "./chunk-I7QBCEV7.mjs";
30
- import "./chunk-D7O4SU6N.mjs";
31
- import "./chunk-VP2E62DF.mjs";
32
- import "./chunk-C624G3R2.mjs";
33
- import "./chunk-YEFJBN56.mjs";
34
- import "./chunk-J76GH2DR.mjs";
28
+ } from "./chunk-Y355VYRN.mjs";
35
29
  import {
30
+ ensureEmptyDirectory,
31
+ fileExists
32
+ } from "./chunk-FFTJKBQF.mjs";
33
+ import "./chunk-4VYR2ARA.mjs";
34
+ import "./chunk-7KZVFDSI.mjs";
35
+ import "./chunk-L3YATEQY.mjs";
36
+ import "./chunk-3ICVWL2M.mjs";
37
+ import "./chunk-AZ6NVJAP.mjs";
38
+ import {
39
+ APP_CONFIG_FILE_NAMES,
36
40
  SUPPORTED_AUTH_SOCIAL_PROVIDERS
37
- } from "./chunk-ILU426CF.mjs";
41
+ } from "./chunk-PVVGQSUP.mjs";
38
42
 
39
43
  // src/types.ts
40
44
  function defineCommand(command) {
@@ -42,6 +46,8 @@ function defineCommand(command) {
42
46
  }
43
47
 
44
48
  // src/cli.ts
49
+ import { cp, mkdtemp, readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
50
+ import { tmpdir } from "os";
45
51
  import { resolve as resolve2 } from "path";
46
52
  import { clearConfigCache, resolveConfigCachePath } from "@holo-js/config";
47
53
 
@@ -111,12 +117,7 @@ async function generateProjectAppKey(projectRoot) {
111
117
  };
112
118
  }
113
119
 
114
- // src/cli.ts
115
- var AUTH_INSTALL_FEATURES = ["social", "workos", "clerk"];
116
- var AUTH_SOCIAL_PROVIDER_MODES = ["default", "specific"];
117
- var EVENTS_QUEUE_ACTIONS = ["skip", "enable"];
118
- var MODEL_GENERATOR_OPTIONS = ["migration", "observer", "seeder", "factory"];
119
- var COMMAND_LIST_DESCRIPTION_COLUMN = 32;
120
+ // src/command-executors.ts
120
121
  var runtimeModulePromise;
121
122
  var queueModulePromise;
122
123
  var cacheModulePromise;
@@ -129,63 +130,36 @@ var securityModulePromise;
129
130
  var devModulePromise;
130
131
  var projectConfigModulePromise;
131
132
  var projectDiscoveryModulePromise;
133
+ var projectPluginsModulePromise;
132
134
  var projectRuntimeModulePromise;
133
135
  var projectScaffoldModulePromise;
134
136
  var agentSkillsModulePromise;
135
137
  function loadRuntimeModule() {
136
- runtimeModulePromise ??= import("./runtime-UKBJQFXM.mjs");
138
+ runtimeModulePromise ??= import("./runtime-FVRB4O2M.mjs");
137
139
  return runtimeModulePromise;
138
140
  }
139
- function loadQueueModule() {
140
- queueModulePromise ??= import("./queue-5BXSDFCO.mjs");
141
- return queueModulePromise;
142
- }
143
- function loadCacheModule() {
144
- cacheModulePromise ??= import("./cache-HUGRWOHQ.mjs");
145
- return cacheModulePromise;
146
- }
147
- function loadQueueMigrationsModule() {
148
- queueMigrationsModulePromise ??= import("./queue-migrations-EF4AMMSY.mjs");
149
- return queueMigrationsModulePromise;
150
- }
151
- function loadCacheMigrationsModule() {
152
- cacheMigrationsModulePromise ??= import("./cache-migrations-77TLXIVG.mjs");
153
- return cacheMigrationsModulePromise;
154
- }
155
- function loadMediaMigrationsModule() {
156
- mediaMigrationsModulePromise ??= import("./media-migrations-NNB3DAQR.mjs");
157
- return mediaMigrationsModulePromise;
158
- }
159
- function loadGeneratorsModule() {
160
- generatorsModulePromise ??= import("./generators-H4NTV4DB.mjs");
161
- return generatorsModulePromise;
162
- }
163
- function loadBroadcastModule() {
164
- broadcastModulePromise ??= import("./broadcast-YGJFCEPP.mjs");
165
- return broadcastModulePromise;
166
- }
167
141
  function loadSecurityModule() {
168
- securityModulePromise ??= import("./security-JR4P7L2C.mjs");
142
+ securityModulePromise ??= import("./security-X4274RHX.mjs");
169
143
  return securityModulePromise;
170
144
  }
171
- function loadDevModule() {
172
- devModulePromise ??= import("./dev-L4Y2GU2E.mjs");
173
- return devModulePromise;
174
- }
175
145
  function loadProjectConfigModule() {
176
- projectConfigModulePromise ??= import("./config-MD27U4FM.mjs");
146
+ projectConfigModulePromise ??= import("./config-XVPV6DJW.mjs");
177
147
  return projectConfigModulePromise;
178
148
  }
179
149
  function loadProjectDiscoveryModule() {
180
- projectDiscoveryModulePromise ??= import("./discovery-GWTBF5RZ.mjs");
150
+ projectDiscoveryModulePromise ??= import("./discovery-TMPUQQHI.mjs");
181
151
  return projectDiscoveryModulePromise;
182
152
  }
153
+ function loadProjectPluginsModule() {
154
+ projectPluginsModulePromise ??= import("./plugins-USHY6SPF.mjs");
155
+ return projectPluginsModulePromise;
156
+ }
183
157
  function loadProjectRuntimeModule() {
184
- projectRuntimeModulePromise ??= import("./runtime-GSXF4NB3.mjs");
158
+ projectRuntimeModulePromise ??= import("./runtime-P5R7H3B4.mjs");
185
159
  return projectRuntimeModulePromise;
186
160
  }
187
161
  function loadProjectScaffoldModule() {
188
- projectScaffoldModulePromise ??= import("./scaffold-VV3KTYGO.mjs");
162
+ projectScaffoldModulePromise ??= import("./scaffold-F3AZDNPG.mjs");
189
163
  return projectScaffoldModulePromise;
190
164
  }
191
165
  function loadAgentSkillsModule() {
@@ -193,63 +167,73 @@ function loadAgentSkillsModule() {
193
167
  return agentSkillsModulePromise;
194
168
  }
195
169
  async function resolveRuntimeExecutor(runtimeExecutor) {
196
- return runtimeExecutor ?? (await loadRuntimeModule()).withRuntimeEnvironment;
170
+ runtimeModulePromise ??= import("./runtime-FVRB4O2M.mjs");
171
+ return runtimeExecutor ?? (await runtimeModulePromise).withRuntimeEnvironment;
197
172
  }
198
- var projectExecutorLoaders = {
199
- runProjectPrepare: async () => (await loadDevModule()).runProjectPrepare,
200
- runProjectDevServer: async () => (await loadDevModule()).runProjectDevServer,
201
- runProjectBuild: async () => (await loadDevModule()).runProjectBuild,
202
- runProjectStartServer: async () => (await loadDevModule()).runProjectStartServer,
203
- runProjectDependencyInstall: async () => (await loadDevModule()).runProjectDependencyInstall
204
- };
205
- async function resolveExecutor(executors, loaders, key) {
173
+ async function resolveExecutor(executors, loader, key) {
206
174
  const existing = executors[key];
207
- if (existing) {
208
- return existing;
209
- }
210
- return await loaders[key]();
175
+ return existing ? existing : await loader();
211
176
  }
212
- async function resolveProjectExecutor(projectExecutors, key) {
213
- return await resolveExecutor(projectExecutors, projectExecutorLoaders, key);
177
+ async function resolveProjectExecutor(executors, key) {
178
+ devModulePromise ??= import("./dev-NTQTEY5B.mjs");
179
+ return resolveExecutor(executors, async () => (await devModulePromise)[key], key);
214
180
  }
215
- var queueExecutorLoaders = {
216
- runQueueFailedTableCommand: async () => (await loadQueueMigrationsModule()).runQueueFailedTableCommand,
217
- runQueueTableCommand: async () => (await loadQueueMigrationsModule()).runQueueTableCommand,
218
- runQueueFailedCommand: async () => (await loadQueueModule()).runQueueFailedCommand,
219
- runQueueFlushCommand: async () => (await loadQueueModule()).runQueueFlushCommand,
220
- runQueueWorkCommand: async () => (await loadQueueModule()).runQueueWorkCommand,
221
- runQueueForgetCommand: async () => (await loadQueueModule()).runQueueForgetCommand,
222
- runQueueListen: async () => (await loadQueueModule()).runQueueListen,
223
- runQueueRestartCommand: async () => (await loadQueueModule()).runQueueRestartCommand,
224
- runQueueRetryCommand: async () => (await loadQueueModule()).runQueueRetryCommand,
225
- runQueueClearCommand: async () => (await loadQueueModule()).runQueueClearCommand
226
- };
227
- var cacheExecutorLoaders = {
228
- runCacheTableCommand: async () => (await loadCacheMigrationsModule()).runCacheTableCommand,
229
- runCacheClearCommand: async () => (await loadCacheModule()).runCacheClearCommand,
230
- runCacheForgetCommand: async () => (await loadCacheModule()).runCacheForgetCommand
231
- };
232
- var mediaExecutorLoaders = {
233
- runMediaTableCommand: async () => (await loadMediaMigrationsModule()).runMediaTableCommand
234
- };
235
- var broadcastExecutorLoaders = {
236
- runBroadcastWorkCommand: async () => (await loadBroadcastModule()).runBroadcastWorkCommand
237
- };
238
- async function resolveQueueExecutor(queueExecutors, key) {
239
- return await resolveExecutor(queueExecutors, queueExecutorLoaders, key);
181
+ async function resolveQueueExecutor(executors, key) {
182
+ return resolveExecutor(executors, async () => {
183
+ if (key === "runQueueFailedTableCommand" || key === "runQueueTableCommand") {
184
+ queueMigrationsModulePromise ??= import("./queue-migrations-6YUUOKMH.mjs");
185
+ const migrations = await queueMigrationsModulePromise;
186
+ return key === "runQueueFailedTableCommand" ? migrations.runQueueFailedTableCommand : migrations.runQueueTableCommand;
187
+ }
188
+ queueModulePromise ??= import("./queue-6U7JU4T6.mjs");
189
+ const queue = await queueModulePromise;
190
+ const resolved = {
191
+ runQueueFailedCommand: queue.runQueueFailedCommand,
192
+ runQueueFlushCommand: queue.runQueueFlushCommand,
193
+ runQueueWorkCommand: queue.runQueueWorkCommand,
194
+ runQueueForgetCommand: queue.runQueueForgetCommand,
195
+ runQueueListen: queue.runQueueListen,
196
+ runQueueRestartCommand: queue.runQueueRestartCommand,
197
+ runQueueRetryCommand: queue.runQueueRetryCommand,
198
+ runQueueClearCommand: queue.runQueueClearCommand
199
+ };
200
+ return resolved[key];
201
+ }, key);
240
202
  }
241
- async function resolveCacheExecutor(cacheExecutors, key) {
242
- return await resolveExecutor(cacheExecutors, cacheExecutorLoaders, key);
203
+ async function resolveCacheExecutor(executors, key) {
204
+ return resolveExecutor(executors, async () => {
205
+ if (key === "runCacheTableCommand") {
206
+ cacheMigrationsModulePromise ??= import("./cache-migrations-J34RE4WH.mjs");
207
+ return (await cacheMigrationsModulePromise).runCacheTableCommand;
208
+ }
209
+ cacheModulePromise ??= import("./cache-KR4ACOYD.mjs");
210
+ const cache = await cacheModulePromise;
211
+ const resolved = {
212
+ runCacheClearCommand: cache.runCacheClearCommand,
213
+ runCacheForgetCommand: cache.runCacheForgetCommand
214
+ };
215
+ return resolved[key];
216
+ }, key);
243
217
  }
244
- async function resolveMediaExecutor(mediaExecutors, key) {
245
- return await resolveExecutor(mediaExecutors, mediaExecutorLoaders, key);
218
+ async function resolveMediaExecutor(executors, key) {
219
+ mediaMigrationsModulePromise ??= import("./media-migrations-UJ6BMUSZ.mjs");
220
+ return resolveExecutor(executors, async () => (await mediaMigrationsModulePromise)[key], key);
246
221
  }
247
- async function resolveBroadcastExecutor(broadcastExecutors, key) {
248
- return await resolveExecutor(broadcastExecutors, broadcastExecutorLoaders, key);
222
+ async function resolveBroadcastExecutor(executors, key) {
223
+ broadcastModulePromise ??= import("./broadcast-PJLFVZH4.mjs");
224
+ return resolveExecutor(executors, async () => (await broadcastModulePromise)[key], key);
249
225
  }
250
226
  async function resolveGeneratorCommand(key) {
251
- return (await loadGeneratorsModule())[key];
227
+ generatorsModulePromise ??= import("./generators-3FDCCJDC.mjs");
228
+ return (await generatorsModulePromise)[key];
252
229
  }
230
+
231
+ // src/cli.ts
232
+ var AUTH_INSTALL_FEATURES = ["social", "workos", "clerk"];
233
+ var AUTH_SOCIAL_PROVIDER_MODES = ["default", "specific"];
234
+ var EVENTS_QUEUE_ACTIONS = ["skip", "enable"];
235
+ var MODEL_GENERATOR_OPTIONS = ["migration", "observer", "seeder", "factory"];
236
+ var COMMAND_LIST_DESCRIPTION_COLUMN = 32;
253
237
  function createCommandContext(io, projectRoot, loadProject, input) {
254
238
  return {
255
239
  cwd: io.cwd,
@@ -331,6 +315,130 @@ async function runProjectDependencyInstallForProject(context, projectExecutors,
331
315
  writeLine(context.stdout, " - installed dependencies");
332
316
  }
333
317
  }
318
+ function formatPluginLabel(plugin) {
319
+ return plugin.name ? `${plugin.name} (${plugin.id})` : plugin.id;
320
+ }
321
+ function formatPluginContributionLines(plugin) {
322
+ const contributes = plugin.contributes;
323
+ if (!contributes) {
324
+ return [];
325
+ }
326
+ const lines = [];
327
+ if (contributes.framework) {
328
+ lines.push(`framework: ${contributes.framework.displayName}`);
329
+ }
330
+ if (contributes.dependencies?.holo?.length) {
331
+ lines.push(`holo packages: ${contributes.dependencies.holo.join(", ")}`);
332
+ }
333
+ if (contributes.dependencies?.runtime?.length) {
334
+ lines.push(`runtime packages: ${contributes.dependencies.runtime.join(", ")}`);
335
+ }
336
+ if (contributes.config?.files?.length) {
337
+ lines.push(`config files: ${contributes.config.files.join(", ")}`);
338
+ }
339
+ if (contributes.config?.env?.length) {
340
+ lines.push(`env keys: ${contributes.config.env.join(", ")}`);
341
+ }
342
+ if (contributes.broadcast?.drivers) {
343
+ const driverNames = Object.keys(contributes.broadcast.drivers);
344
+ if (driverNames.length > 0) {
345
+ lines.push(`broadcast drivers: ${driverNames.join(", ")}`);
346
+ }
347
+ }
348
+ if (contributes.cache?.drivers) {
349
+ const driverNames = Object.keys(contributes.cache.drivers);
350
+ if (driverNames.length > 0) {
351
+ lines.push(`cache drivers: ${driverNames.join(", ")}`);
352
+ }
353
+ }
354
+ if (contributes.queue?.drivers) {
355
+ const driverNames = Object.keys(contributes.queue.drivers);
356
+ if (driverNames.length > 0) {
357
+ lines.push(`queue drivers: ${driverNames.join(", ")}`);
358
+ }
359
+ }
360
+ if (contributes.mail?.drivers) {
361
+ const driverNames = Object.keys(contributes.mail.drivers);
362
+ if (driverNames.length > 0) {
363
+ lines.push(`mail drivers: ${driverNames.join(", ")}`);
364
+ }
365
+ }
366
+ if (contributes.notifications?.channels) {
367
+ const channelNames = Object.keys(contributes.notifications.channels);
368
+ if (channelNames.length > 0) {
369
+ lines.push(`notification channels: ${channelNames.join(", ")}`);
370
+ }
371
+ }
372
+ if (contributes.runtime?.boot) {
373
+ lines.push(`runtime boot: ${contributes.runtime.boot}`);
374
+ }
375
+ if (contributes.cli?.commands) {
376
+ lines.push(`cli commands: ${contributes.cli.commands}`);
377
+ }
378
+ if (contributes.migrations?.publish) {
379
+ lines.push(`migration publisher: ${contributes.migrations.publish}`);
380
+ }
381
+ return lines;
382
+ }
383
+ function writePluginDetails(context, loadedPlugin) {
384
+ writeLine(context.stdout, `Plugin: ${formatPluginLabel(loadedPlugin.definition)}`);
385
+ writeLine(context.stdout, ` - package: ${loadedPlugin.packageName}`);
386
+ if (loadedPlugin.definition.description) {
387
+ writeLine(context.stdout, ` - description: ${loadedPlugin.definition.description}`);
388
+ }
389
+ const contributionLines = formatPluginContributionLines(loadedPlugin.definition);
390
+ if (contributionLines.length === 0) {
391
+ writeLine(context.stdout, " - contributions: none");
392
+ return;
393
+ }
394
+ for (const line of contributionLines) {
395
+ writeLine(context.stdout, ` - ${line}`);
396
+ }
397
+ }
398
+ async function readPackageJsonSnapshot(projectRoot) {
399
+ return await readFile2(resolve2(projectRoot, "package.json"), "utf8");
400
+ }
401
+ async function restorePackageJsonSnapshot(projectRoot, snapshot) {
402
+ await writeFile2(resolve2(projectRoot, "package.json"), snapshot);
403
+ }
404
+ async function readAppConfigSnapshot(projectRoot) {
405
+ for (const fileName of APP_CONFIG_FILE_NAMES) {
406
+ const path = resolve2(projectRoot, fileName);
407
+ if (await fileExists(path)) {
408
+ return {
409
+ path,
410
+ contents: await readFile2(path, "utf8")
411
+ };
412
+ }
413
+ }
414
+ return void 0;
415
+ }
416
+ async function restoreAppConfigSnapshot(snapshot) {
417
+ if (!snapshot) {
418
+ return;
419
+ }
420
+ await writeFile2(snapshot.path, snapshot.contents);
421
+ }
422
+ async function readDirectorySnapshot(projectRoot, relativePath) {
423
+ const path = resolve2(projectRoot, relativePath);
424
+ if (!await fileExists(path)) {
425
+ return { path };
426
+ }
427
+ const snapshotPath = await mkdtemp(resolve2(tmpdir(), "holo-cli-plugin-add-"));
428
+ await cp(path, snapshotPath, { recursive: true, force: true });
429
+ return { path, snapshotPath };
430
+ }
431
+ async function restoreDirectorySnapshot(snapshot) {
432
+ await rm(snapshot.path, { recursive: true, force: true });
433
+ if (snapshot.snapshotPath) {
434
+ await cp(snapshot.snapshotPath, snapshot.path, { recursive: true, force: true });
435
+ }
436
+ }
437
+ async function cleanupDirectorySnapshot(snapshot) {
438
+ if (snapshot.snapshotPath) {
439
+ await rm(snapshot.snapshotPath, { recursive: true, force: true });
440
+ }
441
+ }
334
442
  function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, projectExecutors = {}, broadcastExecutors = {}, securityExecutors = {}, cacheExecutors = {}, mediaExecutors = {}) {
335
443
  return [
336
444
  {
@@ -351,7 +459,12 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
351
459
  usage: "holo new <name> [--framework <nuxt|next|sveltekit>] [--database <sqlite|mysql|postgres>] [--package-manager <bun|npm|pnpm|yarn>] [--package <storage|events|queue|validation|forms|auth|authorization|notifications|mail|broadcast|realtime|security|cache>] [--storage-default-disk <local|public>]",
352
460
  source: "internal",
353
461
  async prepare(input) {
354
- const resolved = await resolveNewProjectInput(context, input);
462
+ const resolved = await resolveNewProjectInput(
463
+ context,
464
+ input,
465
+ void 0,
466
+ (projectName) => ensureEmptyDirectory(resolve2(context.cwd, projectName), projectName)
467
+ );
355
468
  return {
356
469
  args: [resolved.projectName],
357
470
  flags: {
@@ -390,11 +503,11 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
390
503
  writeLine(context.stdout, `Created Holo project: ${targetDir}`);
391
504
  await runWithSpinner(
392
505
  context,
393
- "Installing dependencies...",
506
+ `Installing dependencies with ${packageManager}...`,
394
507
  () => runProjectDependencyInstallForProject(context, projectExecutors, targetDir, {
395
- writeStatus: !supportsSpinner(context)
508
+ writeStatus: false
396
509
  }),
397
- "Dependencies installed."
510
+ `Dependencies installed with ${packageManager}.`
398
511
  );
399
512
  writeLine(context.stdout);
400
513
  writeLine(context.stdout, "Next steps");
@@ -755,6 +868,196 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
755
868
  await runProjectDependencyInstallAfterPackageJsonUpdate(context, projectExecutors, result.updatedPackageJson);
756
869
  }
757
870
  },
871
+ {
872
+ name: "plugin:add",
873
+ aliases: ["plugins:add"],
874
+ description: "Install and activate a Holo plugin package.",
875
+ usage: "holo plugin:add <package>",
876
+ source: "internal",
877
+ async prepare(input) {
878
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
879
+ return { args: [packageName], flags: {} };
880
+ },
881
+ async run(commandContext) {
882
+ const packageName = String(commandContext.args[0] ?? "");
883
+ const plugins = await loadProjectPluginsModule();
884
+ const packageJsonSnapshot = await readPackageJsonSnapshot(context.projectRoot);
885
+ const appConfigSnapshot = await readAppConfigSnapshot(context.projectRoot);
886
+ const holoDirectorySnapshot = await readDirectorySnapshot(context.projectRoot, ".holo-js");
887
+ let dependencyInstallSucceeded = false;
888
+ let updatedDependencies = false;
889
+ let updatedPackageJson = false;
890
+ let loadedPlugin;
891
+ let contributedDependencies = [];
892
+ let updatedContributedDependencies = false;
893
+ let activated = false;
894
+ try {
895
+ updatedPackageJson = await upsertProjectDependency(context.projectRoot, packageName);
896
+ updatedDependencies = updatedPackageJson || updatedDependencies;
897
+ if (updatedPackageJson) {
898
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
899
+ dependencyInstallSucceeded = true;
900
+ await pinProjectDependencyVersions(context.projectRoot, [packageName]);
901
+ }
902
+ loadedPlugin = await plugins.loadHoloPluginFromPackage(context.projectRoot, packageName);
903
+ contributedDependencies = [
904
+ ...loadedPlugin.definition.contributes?.dependencies?.holo ?? [],
905
+ ...loadedPlugin.definition.contributes?.dependencies?.runtime ?? []
906
+ ];
907
+ for (const dependencyName of contributedDependencies) {
908
+ const updatedContributedDependency = await upsertProjectDependency(context.projectRoot, dependencyName);
909
+ updatedContributedDependencies = updatedContributedDependency || updatedContributedDependencies;
910
+ }
911
+ updatedDependencies = updatedContributedDependencies || updatedDependencies;
912
+ if (updatedContributedDependencies) {
913
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
914
+ dependencyInstallSucceeded = true;
915
+ await pinProjectDependencyVersions(context.projectRoot, contributedDependencies);
916
+ }
917
+ activated = await plugins.activateProjectPlugin(context.projectRoot, packageName);
918
+ if (activated) {
919
+ const runProjectPrepare = await resolveProjectExecutor(projectExecutors, "runProjectPrepare");
920
+ await runProjectPrepare(context.projectRoot, context);
921
+ }
922
+ } catch (error) {
923
+ await restoreAppConfigSnapshot(appConfigSnapshot);
924
+ await restorePackageJsonSnapshot(context.projectRoot, packageJsonSnapshot);
925
+ await restoreDirectorySnapshot(holoDirectorySnapshot);
926
+ if (updatedDependencies && dependencyInstallSucceeded) {
927
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot).catch(() => void 0);
928
+ }
929
+ await cleanupDirectorySnapshot(holoDirectorySnapshot);
930
+ throw error;
931
+ }
932
+ writeLine(context.stdout, `Installed Holo plugin: ${formatPluginLabel(loadedPlugin.definition)}`);
933
+ writeLine(context.stdout, ` - package: ${updatedPackageJson ? "added" : "already present"} ${packageName}`);
934
+ if (contributedDependencies.length > 0) {
935
+ writeLine(
936
+ context.stdout,
937
+ ` - dependencies: ${updatedContributedDependencies ? "updated" : "already present"} ${contributedDependencies.join(", ")}`
938
+ );
939
+ }
940
+ writeLine(context.stdout, ` - activation: ${activated ? "updated config/app.ts" : "already active"}`);
941
+ if (activated) {
942
+ writeLine(context.stdout, " - refreshed generated artifacts");
943
+ }
944
+ for (const line of formatPluginContributionLines(loadedPlugin.definition)) {
945
+ writeLine(context.stdout, ` - ${line}`);
946
+ }
947
+ await cleanupDirectorySnapshot(holoDirectorySnapshot);
948
+ }
949
+ },
950
+ {
951
+ name: "plugin:list",
952
+ aliases: ["plugins:list"],
953
+ description: "List active Holo plugins.",
954
+ usage: "holo plugin:list",
955
+ source: "internal",
956
+ async prepare() {
957
+ return { args: [], flags: {} };
958
+ },
959
+ async run() {
960
+ const plugins = await loadProjectPluginsModule();
961
+ const resolvedPlugins = await plugins.resolveProjectPlugins(context.projectRoot);
962
+ writeLine(context.stdout, "Active Holo plugins:");
963
+ if (resolvedPlugins.length === 0) {
964
+ writeLine(context.stdout, " (none)");
965
+ return;
966
+ }
967
+ for (const resolvedPlugin of resolvedPlugins) {
968
+ if (resolvedPlugin.loaded) {
969
+ writeLine(context.stdout, ` - ${resolvedPlugin.packageName}: ${formatPluginLabel(resolvedPlugin.loaded.definition)}`);
970
+ continue;
971
+ }
972
+ writeLine(context.stdout, ` - ${resolvedPlugin.packageName}: failed`);
973
+ if (resolvedPlugin.error) {
974
+ writeLine(context.stdout, ` ${resolvedPlugin.error}`);
975
+ }
976
+ }
977
+ }
978
+ },
979
+ {
980
+ name: "plugin:remove",
981
+ aliases: ["plugins:remove"],
982
+ description: "Deactivate a Holo plugin package.",
983
+ usage: "holo plugin:remove <package> [--uninstall]",
984
+ source: "internal",
985
+ async prepare(input) {
986
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
987
+ return {
988
+ args: [packageName],
989
+ flags: {
990
+ ...resolveBooleanFlag(input.flags, "uninstall") === true ? { uninstall: true } : {}
991
+ }
992
+ };
993
+ },
994
+ async run(commandContext) {
995
+ const packageName = String(commandContext.args[0] ?? "");
996
+ const plugins = await loadProjectPluginsModule();
997
+ const deactivated = await plugins.deactivateProjectPlugin(context.projectRoot, packageName);
998
+ const uninstalled = commandContext.flags.uninstall === true ? await removeProjectDependency(context.projectRoot, packageName) : false;
999
+ if (uninstalled) {
1000
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
1001
+ }
1002
+ if (deactivated || uninstalled) {
1003
+ const runProjectPrepare = await resolveProjectExecutor(projectExecutors, "runProjectPrepare");
1004
+ await runProjectPrepare(context.projectRoot, context);
1005
+ }
1006
+ writeLine(context.stdout, deactivated ? "Removed Holo plugin activation." : "Holo plugin was not active.");
1007
+ writeLine(context.stdout, ` - package: ${packageName}`);
1008
+ if (commandContext.flags.uninstall === true) {
1009
+ writeLine(context.stdout, ` - dependency: ${uninstalled ? "removed from package.json" : "not present in package.json"}`);
1010
+ } else {
1011
+ writeLine(context.stdout, " - dependency: left installed");
1012
+ }
1013
+ }
1014
+ },
1015
+ {
1016
+ name: "plugin:info",
1017
+ aliases: ["plugins:info"],
1018
+ description: "Show metadata for a Holo plugin package.",
1019
+ usage: "holo plugin:info <package>",
1020
+ source: "internal",
1021
+ async prepare(input) {
1022
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
1023
+ return { args: [packageName], flags: {} };
1024
+ },
1025
+ async run(commandContext) {
1026
+ const packageName = String(commandContext.args[0] ?? "");
1027
+ const plugins = await loadProjectPluginsModule();
1028
+ const loadedPlugin = await plugins.loadHoloPluginFromPackage(context.projectRoot, packageName);
1029
+ writePluginDetails(context, loadedPlugin);
1030
+ }
1031
+ },
1032
+ {
1033
+ name: "plugin:doctor",
1034
+ aliases: ["plugins:doctor"],
1035
+ description: "Validate active Holo plugin packages.",
1036
+ usage: "holo plugin:doctor",
1037
+ source: "internal",
1038
+ async prepare() {
1039
+ return { args: [], flags: {} };
1040
+ },
1041
+ async run() {
1042
+ const plugins = await loadProjectPluginsModule();
1043
+ const resolvedPlugins = await plugins.resolveProjectPlugins(context.projectRoot);
1044
+ const failedPlugins = resolvedPlugins.filter((resolvedPlugin) => !resolvedPlugin.loaded);
1045
+ if (resolvedPlugins.length === 0) {
1046
+ writeLine(context.stdout, "No active Holo plugins.");
1047
+ return;
1048
+ }
1049
+ for (const resolvedPlugin of resolvedPlugins) {
1050
+ if (resolvedPlugin.loaded) {
1051
+ writeLine(context.stdout, `Loaded ${resolvedPlugin.packageName}: ${formatPluginLabel(resolvedPlugin.loaded.definition)}`);
1052
+ continue;
1053
+ }
1054
+ writeLine(context.stdout, `Failed ${resolvedPlugin.packageName}: ${resolvedPlugin.error ?? "Unknown plugin loading error."}`);
1055
+ }
1056
+ if (failedPlugins.length > 0) {
1057
+ throw new Error(`${failedPlugins.length} Holo ${failedPlugins.length === 1 ? "plugin" : "plugins"} failed validation.`);
1058
+ }
1059
+ }
1060
+ },
758
1061
  {
759
1062
  name: "auth:notifications:publish",
760
1063
  description: "Publish editable auth notification definitions into the application.",
@@ -1676,10 +1979,15 @@ async function runCli(argv, io) {
1676
1979
  };
1677
1980
  const internalCommands = createInternalCommands(internalContext);
1678
1981
  const registry = [...internalCommands];
1679
- const canSkipAppDiscovery = requestedCommandName === "config:cache" || requestedCommandName === "config:clear" || requestedCommandName === "key:generate" || requestedCommandName === "new" || requestedCommandName === "install" || requestedCommandName === "agents:install" || requestedCommandName === "agent:install" || requestedCommandName === "ai:install" || requestedCommandName === "auth:notifications:publish" || requestedCommandName === "prepare" || requestedCommandName === "dev" || requestedCommandName === "build" || requestedCommandName === "cache:table" || requestedCommandName === "cache:clear" || requestedCommandName === "cache:forget" || requestedCommandName === "media:table" || requestedCommandName === "broadcast:work" || requestedCommandName === "queue:table" || requestedCommandName === "queue:failed-table" || requestedCommandName === "queue:work" || requestedCommandName === "queue:listen" || requestedCommandName === "queue:failed" || requestedCommandName === "queue:retry" || requestedCommandName === "queue:forget" || requestedCommandName === "queue:flush" || requestedCommandName === "queue:restart" || requestedCommandName === "queue:clear" || requestedCommandName === "rate-limit:clear";
1982
+ const requestedInternalCommand = requestedCommandName ? findCommand(registry, requestedCommandName) : void 0;
1983
+ const canSkipAppDiscovery = requestedCommandName === "config:cache" || requestedCommandName === "config:clear" || requestedCommandName === "key:generate" || requestedCommandName === "new" || requestedCommandName === "install" || requestedCommandName === "agents:install" || requestedCommandName === "agent:install" || requestedCommandName === "ai:install" || requestedCommandName === "auth:notifications:publish" || requestedCommandName === "prepare" || requestedCommandName === "dev" || requestedCommandName === "build" || requestedCommandName === "cache:table" || requestedCommandName === "cache:clear" || requestedCommandName === "cache:forget" || requestedCommandName === "media:table" || requestedCommandName === "broadcast:work" || requestedCommandName === "queue:table" || requestedCommandName === "queue:failed-table" || requestedCommandName === "queue:work" || requestedCommandName === "queue:listen" || requestedCommandName === "queue:failed" || requestedCommandName === "queue:retry" || requestedCommandName === "queue:forget" || requestedCommandName === "queue:flush" || requestedCommandName === "queue:restart" || requestedCommandName === "queue:clear" || requestedCommandName === "rate-limit:clear" || requestedCommandName === "plugin:add" || requestedCommandName === "plugins:add" || requestedCommandName === "plugin:list" || requestedCommandName === "plugins:list" || requestedCommandName === "plugin:remove" || requestedCommandName === "plugins:remove" || requestedCommandName === "plugin:info" || requestedCommandName === "plugins:info" || requestedCommandName === "plugin:doctor" || requestedCommandName === "plugins:doctor" || typeof requestedInternalCommand !== "undefined" && requestedInternalCommand.name !== "list";
1680
1984
  if (!canSkipAppDiscovery) {
1681
1985
  const initialProject = await loadProject();
1682
- const appCommands = (await (await loadProjectDiscoveryModule()).discoverAppCommands(projectRoot, initialProject.config)).map((entry) => createAppCommandDefinition(entry));
1986
+ const pluginCommands = await (await loadProjectPluginsModule()).loadProjectPluginCommands(projectRoot);
1987
+ const appCommands = [
1988
+ ...pluginCommands,
1989
+ ...await (await loadProjectDiscoveryModule()).discoverAppCommands(projectRoot, initialProject.config)
1990
+ ].map((entry) => createAppCommandDefinition(entry));
1683
1991
  for (const appCommand of appCommands) {
1684
1992
  const duplicate = findCommandConflict(registry, appCommand);
1685
1993
  if (duplicate) {