@holo-js/cli 0.2.5 → 0.3.0

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 (53) hide show
  1. package/dist/{agent-skills-MSEMQUXT.mjs → agent-skills-CHAXS2YN.mjs} +13 -6
  2. package/dist/bin/holo.mjs +436 -109
  3. package/dist/{broadcast-5MJ3GJK7.mjs → broadcast-5VZM5SGQ.mjs} +13 -10
  4. package/dist/{broadcast-MRJGFCFH.mjs → broadcast-AABT52BK.mjs} +13 -10
  5. package/dist/cache-A42JSVYA.mjs +138 -0
  6. package/dist/cache-DUVBBOZU.mjs +138 -0
  7. package/dist/{cache-migrations-CPYQC7T6.mjs → cache-migrations-4WKSEN2Q.mjs} +12 -10
  8. package/dist/{cache-migrations-APDFSFEX.mjs → cache-migrations-PD2T5AV4.mjs} +14 -12
  9. package/dist/chunk-3RFRE7XG.mjs +491 -0
  10. package/dist/{chunk-PT72AMV7.mjs → chunk-6BHJLCAO.mjs} +256 -392
  11. package/dist/{chunk-KS5TWO75.mjs → chunk-EQUFFLRG.mjs} +7 -7
  12. package/dist/chunk-HX6MOYBO.mjs +2 -0
  13. package/dist/{chunk-YEFJBN56.mjs → chunk-JVLZ3SOW.mjs} +11 -8
  14. package/dist/{chunk-UPXQONEH.mjs → chunk-KRADH7PK.mjs} +55 -51
  15. package/dist/chunk-LALDNNPH.mjs +428 -0
  16. package/dist/chunk-LHK5YUR4.mjs +156 -0
  17. package/dist/{chunk-LBJAJLKU.mjs → chunk-M3IPUCTM.mjs} +1 -1
  18. package/dist/{chunk-TWITVSFZ.mjs → chunk-OI54DOHK.mjs} +256 -392
  19. package/dist/{chunk-LXGQCG56.mjs → chunk-OLZEMIDQ.mjs} +1 -1
  20. package/dist/{chunk-VP2E62DF.mjs → chunk-QSVMXMTQ.mjs} +49 -349
  21. package/dist/{chunk-J76GH2DR.mjs → chunk-R4ZYMEDU.mjs} +129 -86
  22. package/dist/{chunk-XDRCZ3Z5.mjs → chunk-TH5YCOZB.mjs} +57 -53
  23. package/dist/chunk-TRYHX5S4.mjs +360 -0
  24. package/dist/chunk-XBOVM6LO.mjs +41 -0
  25. package/dist/{chunk-ILU426CF.mjs → chunk-YACY2572.mjs} +482 -2
  26. package/dist/{config-MD27U4FM.mjs → config-BZHQK532.mjs} +3 -3
  27. package/dist/{dev-CT4DRTLN.mjs → dev-7KGRV56X.mjs} +10 -8
  28. package/dist/{dev-QDLR6C7K.mjs → dev-GQT37XJU.mjs} +10 -8
  29. package/dist/{discovery-GWTBF5RZ.mjs → discovery-HNH3BLDL.mjs} +8 -6
  30. package/dist/{generators-PUN5TFP5.mjs → generators-3FVW4AEJ.mjs} +18 -15
  31. package/dist/{generators-WQHI7DBW.mjs → generators-JWVNGUUE.mjs} +14 -11
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.mjs +434 -107
  34. package/dist/{media-migrations-D3CDNMPT.mjs → media-migrations-EG34NYAG.mjs} +13 -11
  35. package/dist/{media-migrations-IWCSCKSA.mjs → media-migrations-LGI7R7AR.mjs} +11 -9
  36. package/dist/plugins-ZGLB6JO6.mjs +24 -0
  37. package/dist/{queue-O3OSLGOV.mjs → queue-BEZDCZCY.mjs} +54 -16
  38. package/dist/{queue-GRB2IH5M.mjs → queue-R54DUUYA.mjs} +54 -16
  39. package/dist/{queue-migrations-7T42S4FX.mjs → queue-migrations-AM3AKT76.mjs} +16 -11
  40. package/dist/{queue-migrations-HFZB64OG.mjs → queue-migrations-U477YSFD.mjs} +18 -13
  41. package/dist/{runtime-TTRP2DGL.mjs → runtime-4TJYZLQV.mjs} +10 -8
  42. package/dist/{runtime-M3G5OKQV.mjs → runtime-MSRQD5W5.mjs} +10 -8
  43. package/dist/{runtime-GSXF4NB3.mjs → runtime-VR5BDPYQ.mjs} +1 -1
  44. package/dist/runtime-worker.mjs +7 -1
  45. package/dist/{scaffold-5BOVJYF3.mjs → scaffold-ASEX5LEX.mjs} +8 -4
  46. package/dist/{scaffold-NY3MWUZF.mjs → scaffold-ZAD3XUSD.mjs} +8 -4
  47. package/dist/{security-ST6ED7EK.mjs → security-4QLV7QCH.mjs} +8 -6
  48. package/dist/{security-H7AGDFBX.mjs → security-KYTLP4DF.mjs} +8 -6
  49. package/package.json +35 -8
  50. package/dist/cache-KVRYC7FB.mjs +0 -66
  51. package/dist/cache-WWE4Q4YE.mjs +0 -66
  52. package/dist/chunk-D7O4SU6N.mjs +0 -2
  53. package/dist/chunk-FGQ2I2YH.mjs +0 -22
package/dist/bin/holo.mjs CHANGED
@@ -18,26 +18,34 @@ import {
18
18
  splitCsv
19
19
  } from "../chunk-VRGB6DIS.mjs";
20
20
  import {
21
- hasProjectDependency
22
- } from "../chunk-FGQ2I2YH.mjs";
21
+ hasProjectDependency,
22
+ pinProjectDependencyVersions,
23
+ removeProjectDependency,
24
+ upsertProjectDependency
25
+ } from "../chunk-LHK5YUR4.mjs";
26
+ import {
27
+ fileExists
28
+ } from "../chunk-M3IPUCTM.mjs";
23
29
  import {
24
30
  runWithSpinner,
25
31
  supportsSpinner,
26
32
  writeLine
27
33
  } from "../chunk-I7QBCEV7.mjs";
34
+ import "../chunk-HX6MOYBO.mjs";
35
+ import "../chunk-QSVMXMTQ.mjs";
36
+ import "../chunk-OI54DOHK.mjs";
37
+ import "../chunk-JVLZ3SOW.mjs";
38
+ import "../chunk-R4ZYMEDU.mjs";
39
+ import "../chunk-3RFRE7XG.mjs";
40
+ import "../chunk-TRYHX5S4.mjs";
28
41
  import {
29
- fileExists
30
- } from "../chunk-LBJAJLKU.mjs";
31
- import "../chunk-D7O4SU6N.mjs";
32
- import "../chunk-VP2E62DF.mjs";
33
- import "../chunk-PT72AMV7.mjs";
34
- import "../chunk-YEFJBN56.mjs";
35
- import "../chunk-J76GH2DR.mjs";
36
- import {
42
+ APP_CONFIG_FILE_NAMES,
37
43
  SUPPORTED_AUTH_SOCIAL_PROVIDERS
38
- } from "../chunk-ILU426CF.mjs";
44
+ } from "../chunk-YACY2572.mjs";
39
45
 
40
46
  // src/cli.ts
47
+ import { cp, mkdtemp, readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
48
+ import { tmpdir } from "os";
41
49
  import { resolve as resolve2 } from "path";
42
50
  import { clearConfigCache, resolveConfigCachePath } from "@holo-js/config";
43
51
 
@@ -107,12 +115,7 @@ async function generateProjectAppKey(projectRoot) {
107
115
  };
108
116
  }
109
117
 
110
- // src/cli.ts
111
- var AUTH_INSTALL_FEATURES = ["social", "workos", "clerk"];
112
- var AUTH_SOCIAL_PROVIDER_MODES = ["default", "specific"];
113
- var EVENTS_QUEUE_ACTIONS = ["skip", "enable"];
114
- var MODEL_GENERATOR_OPTIONS = ["migration", "observer", "seeder", "factory"];
115
- var COMMAND_LIST_DESCRIPTION_COLUMN = 32;
118
+ // src/command-executors.ts
116
119
  var runtimeModulePromise;
117
120
  var queueModulePromise;
118
121
  var cacheModulePromise;
@@ -125,127 +128,110 @@ var securityModulePromise;
125
128
  var devModulePromise;
126
129
  var projectConfigModulePromise;
127
130
  var projectDiscoveryModulePromise;
131
+ var projectPluginsModulePromise;
128
132
  var projectRuntimeModulePromise;
129
133
  var projectScaffoldModulePromise;
130
134
  var agentSkillsModulePromise;
131
135
  function loadRuntimeModule() {
132
- runtimeModulePromise ??= import("../runtime-TTRP2DGL.mjs");
136
+ runtimeModulePromise ??= import("../runtime-MSRQD5W5.mjs");
133
137
  return runtimeModulePromise;
134
138
  }
135
- function loadQueueModule() {
136
- queueModulePromise ??= import("../queue-GRB2IH5M.mjs");
137
- return queueModulePromise;
138
- }
139
- function loadCacheModule() {
140
- cacheModulePromise ??= import("../cache-WWE4Q4YE.mjs");
141
- return cacheModulePromise;
142
- }
143
- function loadQueueMigrationsModule() {
144
- queueMigrationsModulePromise ??= import("../queue-migrations-HFZB64OG.mjs");
145
- return queueMigrationsModulePromise;
146
- }
147
- function loadCacheMigrationsModule() {
148
- cacheMigrationsModulePromise ??= import("../cache-migrations-CPYQC7T6.mjs");
149
- return cacheMigrationsModulePromise;
150
- }
151
- function loadMediaMigrationsModule() {
152
- mediaMigrationsModulePromise ??= import("../media-migrations-D3CDNMPT.mjs");
153
- return mediaMigrationsModulePromise;
154
- }
155
- function loadGeneratorsModule() {
156
- generatorsModulePromise ??= import("../generators-PUN5TFP5.mjs");
157
- return generatorsModulePromise;
158
- }
159
- function loadBroadcastModule() {
160
- broadcastModulePromise ??= import("../broadcast-MRJGFCFH.mjs");
161
- return broadcastModulePromise;
162
- }
163
139
  function loadSecurityModule() {
164
- securityModulePromise ??= import("../security-H7AGDFBX.mjs");
140
+ securityModulePromise ??= import("../security-4QLV7QCH.mjs");
165
141
  return securityModulePromise;
166
142
  }
167
- function loadDevModule() {
168
- devModulePromise ??= import("../dev-QDLR6C7K.mjs");
169
- return devModulePromise;
170
- }
171
143
  function loadProjectConfigModule() {
172
- projectConfigModulePromise ??= import("../config-MD27U4FM.mjs");
144
+ projectConfigModulePromise ??= import("../config-BZHQK532.mjs");
173
145
  return projectConfigModulePromise;
174
146
  }
175
147
  function loadProjectDiscoveryModule() {
176
- projectDiscoveryModulePromise ??= import("../discovery-GWTBF5RZ.mjs");
148
+ projectDiscoveryModulePromise ??= import("../discovery-HNH3BLDL.mjs");
177
149
  return projectDiscoveryModulePromise;
178
150
  }
151
+ function loadProjectPluginsModule() {
152
+ projectPluginsModulePromise ??= import("../plugins-ZGLB6JO6.mjs");
153
+ return projectPluginsModulePromise;
154
+ }
179
155
  function loadProjectRuntimeModule() {
180
- projectRuntimeModulePromise ??= import("../runtime-GSXF4NB3.mjs");
156
+ projectRuntimeModulePromise ??= import("../runtime-VR5BDPYQ.mjs");
181
157
  return projectRuntimeModulePromise;
182
158
  }
183
159
  function loadProjectScaffoldModule() {
184
- projectScaffoldModulePromise ??= import("../scaffold-NY3MWUZF.mjs");
160
+ projectScaffoldModulePromise ??= import("../scaffold-ZAD3XUSD.mjs");
185
161
  return projectScaffoldModulePromise;
186
162
  }
187
163
  function loadAgentSkillsModule() {
188
- agentSkillsModulePromise ??= import("../agent-skills-MSEMQUXT.mjs");
164
+ agentSkillsModulePromise ??= import("../agent-skills-CHAXS2YN.mjs");
189
165
  return agentSkillsModulePromise;
190
166
  }
191
167
  async function resolveRuntimeExecutor(runtimeExecutor) {
192
- return runtimeExecutor ?? (await loadRuntimeModule()).withRuntimeEnvironment;
168
+ runtimeModulePromise ??= import("../runtime-MSRQD5W5.mjs");
169
+ return runtimeExecutor ?? (await runtimeModulePromise).withRuntimeEnvironment;
193
170
  }
194
- var projectExecutorLoaders = {
195
- runProjectPrepare: async () => (await loadDevModule()).runProjectPrepare,
196
- runProjectDevServer: async () => (await loadDevModule()).runProjectDevServer,
197
- runProjectBuild: async () => (await loadDevModule()).runProjectBuild,
198
- runProjectStartServer: async () => (await loadDevModule()).runProjectStartServer,
199
- runProjectDependencyInstall: async () => (await loadDevModule()).runProjectDependencyInstall
200
- };
201
- async function resolveExecutor(executors, loaders, key) {
171
+ async function resolveExecutor(executors, loader, key) {
202
172
  const existing = executors[key];
203
- if (existing) {
204
- return existing;
205
- }
206
- return await loaders[key]();
173
+ return existing ? existing : await loader();
207
174
  }
208
- async function resolveProjectExecutor(projectExecutors, key) {
209
- return await resolveExecutor(projectExecutors, projectExecutorLoaders, key);
175
+ async function resolveProjectExecutor(executors, key) {
176
+ devModulePromise ??= import("../dev-7KGRV56X.mjs");
177
+ return resolveExecutor(executors, async () => (await devModulePromise)[key], key);
210
178
  }
211
- var queueExecutorLoaders = {
212
- runQueueFailedTableCommand: async () => (await loadQueueMigrationsModule()).runQueueFailedTableCommand,
213
- runQueueTableCommand: async () => (await loadQueueMigrationsModule()).runQueueTableCommand,
214
- runQueueFailedCommand: async () => (await loadQueueModule()).runQueueFailedCommand,
215
- runQueueFlushCommand: async () => (await loadQueueModule()).runQueueFlushCommand,
216
- runQueueWorkCommand: async () => (await loadQueueModule()).runQueueWorkCommand,
217
- runQueueForgetCommand: async () => (await loadQueueModule()).runQueueForgetCommand,
218
- runQueueListen: async () => (await loadQueueModule()).runQueueListen,
219
- runQueueRestartCommand: async () => (await loadQueueModule()).runQueueRestartCommand,
220
- runQueueRetryCommand: async () => (await loadQueueModule()).runQueueRetryCommand,
221
- runQueueClearCommand: async () => (await loadQueueModule()).runQueueClearCommand
222
- };
223
- var cacheExecutorLoaders = {
224
- runCacheTableCommand: async () => (await loadCacheMigrationsModule()).runCacheTableCommand,
225
- runCacheClearCommand: async () => (await loadCacheModule()).runCacheClearCommand,
226
- runCacheForgetCommand: async () => (await loadCacheModule()).runCacheForgetCommand
227
- };
228
- var mediaExecutorLoaders = {
229
- runMediaTableCommand: async () => (await loadMediaMigrationsModule()).runMediaTableCommand
230
- };
231
- var broadcastExecutorLoaders = {
232
- runBroadcastWorkCommand: async () => (await loadBroadcastModule()).runBroadcastWorkCommand
233
- };
234
- async function resolveQueueExecutor(queueExecutors, key) {
235
- return await resolveExecutor(queueExecutors, queueExecutorLoaders, key);
179
+ async function resolveQueueExecutor(executors, key) {
180
+ return resolveExecutor(executors, async () => {
181
+ if (key === "runQueueFailedTableCommand" || key === "runQueueTableCommand") {
182
+ queueMigrationsModulePromise ??= import("../queue-migrations-AM3AKT76.mjs");
183
+ const migrations = await queueMigrationsModulePromise;
184
+ return key === "runQueueFailedTableCommand" ? migrations.runQueueFailedTableCommand : migrations.runQueueTableCommand;
185
+ }
186
+ queueModulePromise ??= import("../queue-R54DUUYA.mjs");
187
+ const queue = await queueModulePromise;
188
+ const resolved = {
189
+ runQueueFailedCommand: queue.runQueueFailedCommand,
190
+ runQueueFlushCommand: queue.runQueueFlushCommand,
191
+ runQueueWorkCommand: queue.runQueueWorkCommand,
192
+ runQueueForgetCommand: queue.runQueueForgetCommand,
193
+ runQueueListen: queue.runQueueListen,
194
+ runQueueRestartCommand: queue.runQueueRestartCommand,
195
+ runQueueRetryCommand: queue.runQueueRetryCommand,
196
+ runQueueClearCommand: queue.runQueueClearCommand
197
+ };
198
+ return resolved[key];
199
+ }, key);
236
200
  }
237
- async function resolveCacheExecutor(cacheExecutors, key) {
238
- return await resolveExecutor(cacheExecutors, cacheExecutorLoaders, key);
201
+ async function resolveCacheExecutor(executors, key) {
202
+ return resolveExecutor(executors, async () => {
203
+ if (key === "runCacheTableCommand") {
204
+ cacheMigrationsModulePromise ??= import("../cache-migrations-4WKSEN2Q.mjs");
205
+ return (await cacheMigrationsModulePromise).runCacheTableCommand;
206
+ }
207
+ cacheModulePromise ??= import("../cache-A42JSVYA.mjs");
208
+ const cache = await cacheModulePromise;
209
+ const resolved = {
210
+ runCacheClearCommand: cache.runCacheClearCommand,
211
+ runCacheForgetCommand: cache.runCacheForgetCommand
212
+ };
213
+ return resolved[key];
214
+ }, key);
239
215
  }
240
- async function resolveMediaExecutor(mediaExecutors, key) {
241
- return await resolveExecutor(mediaExecutors, mediaExecutorLoaders, key);
216
+ async function resolveMediaExecutor(executors, key) {
217
+ mediaMigrationsModulePromise ??= import("../media-migrations-LGI7R7AR.mjs");
218
+ return resolveExecutor(executors, async () => (await mediaMigrationsModulePromise)[key], key);
242
219
  }
243
- async function resolveBroadcastExecutor(broadcastExecutors, key) {
244
- return await resolveExecutor(broadcastExecutors, broadcastExecutorLoaders, key);
220
+ async function resolveBroadcastExecutor(executors, key) {
221
+ broadcastModulePromise ??= import("../broadcast-AABT52BK.mjs");
222
+ return resolveExecutor(executors, async () => (await broadcastModulePromise)[key], key);
245
223
  }
246
224
  async function resolveGeneratorCommand(key) {
247
- return (await loadGeneratorsModule())[key];
225
+ generatorsModulePromise ??= import("../generators-JWVNGUUE.mjs");
226
+ return (await generatorsModulePromise)[key];
248
227
  }
228
+
229
+ // src/cli.ts
230
+ var AUTH_INSTALL_FEATURES = ["social", "workos", "clerk"];
231
+ var AUTH_SOCIAL_PROVIDER_MODES = ["default", "specific"];
232
+ var EVENTS_QUEUE_ACTIONS = ["skip", "enable"];
233
+ var MODEL_GENERATOR_OPTIONS = ["migration", "observer", "seeder", "factory"];
234
+ var COMMAND_LIST_DESCRIPTION_COLUMN = 32;
249
235
  function createCommandContext(io, projectRoot, loadProject, input) {
250
236
  return {
251
237
  cwd: io.cwd,
@@ -255,6 +241,23 @@ function createCommandContext(io, projectRoot, loadProject, input) {
255
241
  loadProject
256
242
  };
257
243
  }
244
+ function serializePassthroughInput(input) {
245
+ const tokens = [...input.args];
246
+ for (const [name, value] of Object.entries(input.flags)) {
247
+ if (value === false) {
248
+ continue;
249
+ }
250
+ const flag = name.length === 1 ? `-${name}` : `--${name}`;
251
+ const values = Array.isArray(value) ? value : [value];
252
+ for (const currentValue of values) {
253
+ tokens.push(flag);
254
+ if (currentValue !== true) {
255
+ tokens.push(String(currentValue));
256
+ }
257
+ }
258
+ }
259
+ return tokens;
260
+ }
258
261
  function printCommandList(io, registry) {
259
262
  const internal = registry.filter((command) => command.source === "internal");
260
263
  const app = registry.filter((command) => command.source === "app");
@@ -310,6 +313,130 @@ async function runProjectDependencyInstallForProject(context, projectExecutors,
310
313
  writeLine(context.stdout, " - installed dependencies");
311
314
  }
312
315
  }
316
+ function formatPluginLabel(plugin) {
317
+ return plugin.name ? `${plugin.name} (${plugin.id})` : plugin.id;
318
+ }
319
+ function formatPluginContributionLines(plugin) {
320
+ const contributes = plugin.contributes;
321
+ if (!contributes) {
322
+ return [];
323
+ }
324
+ const lines = [];
325
+ if (contributes.framework) {
326
+ lines.push(`framework: ${contributes.framework.displayName}`);
327
+ }
328
+ if (contributes.dependencies?.holo?.length) {
329
+ lines.push(`holo packages: ${contributes.dependencies.holo.join(", ")}`);
330
+ }
331
+ if (contributes.dependencies?.runtime?.length) {
332
+ lines.push(`runtime packages: ${contributes.dependencies.runtime.join(", ")}`);
333
+ }
334
+ if (contributes.config?.files?.length) {
335
+ lines.push(`config files: ${contributes.config.files.join(", ")}`);
336
+ }
337
+ if (contributes.config?.env?.length) {
338
+ lines.push(`env keys: ${contributes.config.env.join(", ")}`);
339
+ }
340
+ if (contributes.broadcast?.drivers) {
341
+ const driverNames = Object.keys(contributes.broadcast.drivers);
342
+ if (driverNames.length > 0) {
343
+ lines.push(`broadcast drivers: ${driverNames.join(", ")}`);
344
+ }
345
+ }
346
+ if (contributes.cache?.drivers) {
347
+ const driverNames = Object.keys(contributes.cache.drivers);
348
+ if (driverNames.length > 0) {
349
+ lines.push(`cache drivers: ${driverNames.join(", ")}`);
350
+ }
351
+ }
352
+ if (contributes.queue?.drivers) {
353
+ const driverNames = Object.keys(contributes.queue.drivers);
354
+ if (driverNames.length > 0) {
355
+ lines.push(`queue drivers: ${driverNames.join(", ")}`);
356
+ }
357
+ }
358
+ if (contributes.mail?.drivers) {
359
+ const driverNames = Object.keys(contributes.mail.drivers);
360
+ if (driverNames.length > 0) {
361
+ lines.push(`mail drivers: ${driverNames.join(", ")}`);
362
+ }
363
+ }
364
+ if (contributes.notifications?.channels) {
365
+ const channelNames = Object.keys(contributes.notifications.channels);
366
+ if (channelNames.length > 0) {
367
+ lines.push(`notification channels: ${channelNames.join(", ")}`);
368
+ }
369
+ }
370
+ if (contributes.runtime?.boot) {
371
+ lines.push(`runtime boot: ${contributes.runtime.boot}`);
372
+ }
373
+ if (contributes.cli?.commands) {
374
+ lines.push(`cli commands: ${contributes.cli.commands}`);
375
+ }
376
+ if (contributes.migrations?.publish) {
377
+ lines.push(`migration publisher: ${contributes.migrations.publish}`);
378
+ }
379
+ return lines;
380
+ }
381
+ function writePluginDetails(context, loadedPlugin) {
382
+ writeLine(context.stdout, `Plugin: ${formatPluginLabel(loadedPlugin.definition)}`);
383
+ writeLine(context.stdout, ` - package: ${loadedPlugin.packageName}`);
384
+ if (loadedPlugin.definition.description) {
385
+ writeLine(context.stdout, ` - description: ${loadedPlugin.definition.description}`);
386
+ }
387
+ const contributionLines = formatPluginContributionLines(loadedPlugin.definition);
388
+ if (contributionLines.length === 0) {
389
+ writeLine(context.stdout, " - contributions: none");
390
+ return;
391
+ }
392
+ for (const line of contributionLines) {
393
+ writeLine(context.stdout, ` - ${line}`);
394
+ }
395
+ }
396
+ async function readPackageJsonSnapshot(projectRoot) {
397
+ return await readFile2(resolve2(projectRoot, "package.json"), "utf8");
398
+ }
399
+ async function restorePackageJsonSnapshot(projectRoot, snapshot) {
400
+ await writeFile2(resolve2(projectRoot, "package.json"), snapshot);
401
+ }
402
+ async function readAppConfigSnapshot(projectRoot) {
403
+ for (const fileName of APP_CONFIG_FILE_NAMES) {
404
+ const path = resolve2(projectRoot, fileName);
405
+ if (await fileExists(path)) {
406
+ return {
407
+ path,
408
+ contents: await readFile2(path, "utf8")
409
+ };
410
+ }
411
+ }
412
+ return void 0;
413
+ }
414
+ async function restoreAppConfigSnapshot(snapshot) {
415
+ if (!snapshot) {
416
+ return;
417
+ }
418
+ await writeFile2(snapshot.path, snapshot.contents);
419
+ }
420
+ async function readDirectorySnapshot(projectRoot, relativePath) {
421
+ const path = resolve2(projectRoot, relativePath);
422
+ if (!await fileExists(path)) {
423
+ return { path };
424
+ }
425
+ const snapshotPath = await mkdtemp(resolve2(tmpdir(), "holo-cli-plugin-add-"));
426
+ await cp(path, snapshotPath, { recursive: true, force: true });
427
+ return { path, snapshotPath };
428
+ }
429
+ async function restoreDirectorySnapshot(snapshot) {
430
+ await rm(snapshot.path, { recursive: true, force: true });
431
+ if (snapshot.snapshotPath) {
432
+ await cp(snapshot.snapshotPath, snapshot.path, { recursive: true, force: true });
433
+ }
434
+ }
435
+ async function cleanupDirectorySnapshot(snapshot) {
436
+ if (snapshot.snapshotPath) {
437
+ await rm(snapshot.snapshotPath, { recursive: true, force: true });
438
+ }
439
+ }
313
440
  function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, projectExecutors = {}, broadcastExecutors = {}, securityExecutors = {}, cacheExecutors = {}, mediaExecutors = {}) {
314
441
  return [
315
442
  {
@@ -734,6 +861,196 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
734
861
  await runProjectDependencyInstallAfterPackageJsonUpdate(context, projectExecutors, result.updatedPackageJson);
735
862
  }
736
863
  },
864
+ {
865
+ name: "plugin:add",
866
+ aliases: ["plugins:add"],
867
+ description: "Install and activate a Holo plugin package.",
868
+ usage: "holo plugin:add <package>",
869
+ source: "internal",
870
+ async prepare(input) {
871
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
872
+ return { args: [packageName], flags: {} };
873
+ },
874
+ async run(commandContext) {
875
+ const packageName = String(commandContext.args[0] ?? "");
876
+ const plugins = await loadProjectPluginsModule();
877
+ const packageJsonSnapshot = await readPackageJsonSnapshot(context.projectRoot);
878
+ const appConfigSnapshot = await readAppConfigSnapshot(context.projectRoot);
879
+ const holoDirectorySnapshot = await readDirectorySnapshot(context.projectRoot, ".holo-js");
880
+ let dependencyInstallSucceeded = false;
881
+ let updatedDependencies = false;
882
+ let updatedPackageJson = false;
883
+ let loadedPlugin;
884
+ let contributedDependencies = [];
885
+ let updatedContributedDependencies = false;
886
+ let activated = false;
887
+ try {
888
+ updatedPackageJson = await upsertProjectDependency(context.projectRoot, packageName);
889
+ updatedDependencies = updatedPackageJson || updatedDependencies;
890
+ if (updatedPackageJson) {
891
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
892
+ dependencyInstallSucceeded = true;
893
+ await pinProjectDependencyVersions(context.projectRoot, [packageName]);
894
+ }
895
+ loadedPlugin = await plugins.loadHoloPluginFromPackage(context.projectRoot, packageName);
896
+ contributedDependencies = [
897
+ ...loadedPlugin.definition.contributes?.dependencies?.holo ?? [],
898
+ ...loadedPlugin.definition.contributes?.dependencies?.runtime ?? []
899
+ ];
900
+ for (const dependencyName of contributedDependencies) {
901
+ const updatedContributedDependency = await upsertProjectDependency(context.projectRoot, dependencyName);
902
+ updatedContributedDependencies = updatedContributedDependency || updatedContributedDependencies;
903
+ }
904
+ updatedDependencies = updatedContributedDependencies || updatedDependencies;
905
+ if (updatedContributedDependencies) {
906
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
907
+ dependencyInstallSucceeded = true;
908
+ await pinProjectDependencyVersions(context.projectRoot, contributedDependencies);
909
+ }
910
+ activated = await plugins.activateProjectPlugin(context.projectRoot, packageName);
911
+ if (activated) {
912
+ const runProjectPrepare = await resolveProjectExecutor(projectExecutors, "runProjectPrepare");
913
+ await runProjectPrepare(context.projectRoot, context);
914
+ }
915
+ } catch (error) {
916
+ await restoreAppConfigSnapshot(appConfigSnapshot);
917
+ await restorePackageJsonSnapshot(context.projectRoot, packageJsonSnapshot);
918
+ await restoreDirectorySnapshot(holoDirectorySnapshot);
919
+ if (updatedDependencies && dependencyInstallSucceeded) {
920
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot).catch(() => void 0);
921
+ }
922
+ await cleanupDirectorySnapshot(holoDirectorySnapshot);
923
+ throw error;
924
+ }
925
+ writeLine(context.stdout, `Installed Holo plugin: ${formatPluginLabel(loadedPlugin.definition)}`);
926
+ writeLine(context.stdout, ` - package: ${updatedPackageJson ? "added" : "already present"} ${packageName}`);
927
+ if (contributedDependencies.length > 0) {
928
+ writeLine(
929
+ context.stdout,
930
+ ` - dependencies: ${updatedContributedDependencies ? "updated" : "already present"} ${contributedDependencies.join(", ")}`
931
+ );
932
+ }
933
+ writeLine(context.stdout, ` - activation: ${activated ? "updated config/app.ts" : "already active"}`);
934
+ if (activated) {
935
+ writeLine(context.stdout, " - refreshed generated artifacts");
936
+ }
937
+ for (const line of formatPluginContributionLines(loadedPlugin.definition)) {
938
+ writeLine(context.stdout, ` - ${line}`);
939
+ }
940
+ await cleanupDirectorySnapshot(holoDirectorySnapshot);
941
+ }
942
+ },
943
+ {
944
+ name: "plugin:list",
945
+ aliases: ["plugins:list"],
946
+ description: "List active Holo plugins.",
947
+ usage: "holo plugin:list",
948
+ source: "internal",
949
+ async prepare() {
950
+ return { args: [], flags: {} };
951
+ },
952
+ async run() {
953
+ const plugins = await loadProjectPluginsModule();
954
+ const resolvedPlugins = await plugins.resolveProjectPlugins(context.projectRoot);
955
+ writeLine(context.stdout, "Active Holo plugins:");
956
+ if (resolvedPlugins.length === 0) {
957
+ writeLine(context.stdout, " (none)");
958
+ return;
959
+ }
960
+ for (const resolvedPlugin of resolvedPlugins) {
961
+ if (resolvedPlugin.loaded) {
962
+ writeLine(context.stdout, ` - ${resolvedPlugin.packageName}: ${formatPluginLabel(resolvedPlugin.loaded.definition)}`);
963
+ continue;
964
+ }
965
+ writeLine(context.stdout, ` - ${resolvedPlugin.packageName}: failed`);
966
+ if (resolvedPlugin.error) {
967
+ writeLine(context.stdout, ` ${resolvedPlugin.error}`);
968
+ }
969
+ }
970
+ }
971
+ },
972
+ {
973
+ name: "plugin:remove",
974
+ aliases: ["plugins:remove"],
975
+ description: "Deactivate a Holo plugin package.",
976
+ usage: "holo plugin:remove <package> [--uninstall]",
977
+ source: "internal",
978
+ async prepare(input) {
979
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
980
+ return {
981
+ args: [packageName],
982
+ flags: {
983
+ ...resolveBooleanFlag(input.flags, "uninstall") === true ? { uninstall: true } : {}
984
+ }
985
+ };
986
+ },
987
+ async run(commandContext) {
988
+ const packageName = String(commandContext.args[0] ?? "");
989
+ const plugins = await loadProjectPluginsModule();
990
+ const deactivated = await plugins.deactivateProjectPlugin(context.projectRoot, packageName);
991
+ const uninstalled = commandContext.flags.uninstall === true ? await removeProjectDependency(context.projectRoot, packageName) : false;
992
+ if (uninstalled) {
993
+ await runProjectDependencyInstallForProject(context, projectExecutors, context.projectRoot);
994
+ }
995
+ if (deactivated || uninstalled) {
996
+ const runProjectPrepare = await resolveProjectExecutor(projectExecutors, "runProjectPrepare");
997
+ await runProjectPrepare(context.projectRoot, context);
998
+ }
999
+ writeLine(context.stdout, deactivated ? "Removed Holo plugin activation." : "Holo plugin was not active.");
1000
+ writeLine(context.stdout, ` - package: ${packageName}`);
1001
+ if (commandContext.flags.uninstall === true) {
1002
+ writeLine(context.stdout, ` - dependency: ${uninstalled ? "removed from package.json" : "not present in package.json"}`);
1003
+ } else {
1004
+ writeLine(context.stdout, " - dependency: left installed");
1005
+ }
1006
+ }
1007
+ },
1008
+ {
1009
+ name: "plugin:info",
1010
+ aliases: ["plugins:info"],
1011
+ description: "Show metadata for a Holo plugin package.",
1012
+ usage: "holo plugin:info <package>",
1013
+ source: "internal",
1014
+ async prepare(input) {
1015
+ const packageName = await ensureRequiredArg(context, input, 0, "Plugin package");
1016
+ return { args: [packageName], flags: {} };
1017
+ },
1018
+ async run(commandContext) {
1019
+ const packageName = String(commandContext.args[0] ?? "");
1020
+ const plugins = await loadProjectPluginsModule();
1021
+ const loadedPlugin = await plugins.loadHoloPluginFromPackage(context.projectRoot, packageName);
1022
+ writePluginDetails(context, loadedPlugin);
1023
+ }
1024
+ },
1025
+ {
1026
+ name: "plugin:doctor",
1027
+ aliases: ["plugins:doctor"],
1028
+ description: "Validate active Holo plugin packages.",
1029
+ usage: "holo plugin:doctor",
1030
+ source: "internal",
1031
+ async prepare() {
1032
+ return { args: [], flags: {} };
1033
+ },
1034
+ async run() {
1035
+ const plugins = await loadProjectPluginsModule();
1036
+ const resolvedPlugins = await plugins.resolveProjectPlugins(context.projectRoot);
1037
+ const failedPlugins = resolvedPlugins.filter((resolvedPlugin) => !resolvedPlugin.loaded);
1038
+ if (resolvedPlugins.length === 0) {
1039
+ writeLine(context.stdout, "No active Holo plugins.");
1040
+ return;
1041
+ }
1042
+ for (const resolvedPlugin of resolvedPlugins) {
1043
+ if (resolvedPlugin.loaded) {
1044
+ writeLine(context.stdout, `Loaded ${resolvedPlugin.packageName}: ${formatPluginLabel(resolvedPlugin.loaded.definition)}`);
1045
+ continue;
1046
+ }
1047
+ writeLine(context.stdout, `Failed ${resolvedPlugin.packageName}: ${resolvedPlugin.error ?? "Unknown plugin loading error."}`);
1048
+ }
1049
+ if (failedPlugins.length > 0) {
1050
+ throw new Error(`${failedPlugins.length} Holo ${failedPlugins.length === 1 ? "plugin" : "plugins"} failed validation.`);
1051
+ }
1052
+ }
1053
+ },
737
1054
  {
738
1055
  name: "auth:notifications:publish",
739
1056
  description: "Publish editable auth notification definitions into the application.",
@@ -808,13 +1125,18 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
808
1125
  {
809
1126
  name: "start",
810
1127
  description: "Run the production framework server with Holo runtime preloads.",
811
- usage: "holo start",
1128
+ usage: "holo start [...frameworkArgs]",
812
1129
  source: "internal",
813
- async prepare() {
814
- return { args: [], flags: {} };
1130
+ async prepare(input) {
1131
+ return { args: input.args, flags: input.flags };
815
1132
  },
816
- async run() {
1133
+ async run(input) {
817
1134
  const runProjectStartServer = await resolveProjectExecutor(projectExecutors, "runProjectStartServer");
1135
+ const passthroughArgs = serializePassthroughInput(input);
1136
+ if (passthroughArgs.length > 0) {
1137
+ await runProjectStartServer(context, context.projectRoot, void 0, passthroughArgs);
1138
+ return;
1139
+ }
818
1140
  await runProjectStartServer(context, context.projectRoot);
819
1141
  }
820
1142
  },
@@ -1650,10 +1972,15 @@ async function runCli(argv, io) {
1650
1972
  };
1651
1973
  const internalCommands = createInternalCommands(internalContext);
1652
1974
  const registry = [...internalCommands];
1653
- 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";
1975
+ const requestedInternalCommand = requestedCommandName ? findCommand(registry, requestedCommandName) : void 0;
1976
+ 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";
1654
1977
  if (!canSkipAppDiscovery) {
1655
1978
  const initialProject = await loadProject();
1656
- const appCommands = (await (await loadProjectDiscoveryModule()).discoverAppCommands(projectRoot, initialProject.config)).map((entry) => createAppCommandDefinition(entry));
1979
+ const pluginCommands = await (await loadProjectPluginsModule()).loadProjectPluginCommands(projectRoot);
1980
+ const appCommands = [
1981
+ ...pluginCommands,
1982
+ ...await (await loadProjectDiscoveryModule()).discoverAppCommands(projectRoot, initialProject.config)
1983
+ ].map((entry) => createAppCommandDefinition(entry));
1657
1984
  for (const appCommand of appCommands) {
1658
1985
  const duplicate = findCommandConflict(registry, appCommand);
1659
1986
  if (duplicate) {