@holo-js/cli 0.2.6 → 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.
- package/dist/bin/holo.mjs +409 -104
- package/dist/{broadcast-JBQWQZSO.mjs → broadcast-5VZM5SGQ.mjs} +13 -11
- package/dist/{broadcast-YGJFCEPP.mjs → broadcast-AABT52BK.mjs} +10 -8
- package/dist/cache-A42JSVYA.mjs +138 -0
- package/dist/cache-DUVBBOZU.mjs +138 -0
- package/dist/{cache-migrations-77TLXIVG.mjs → cache-migrations-4WKSEN2Q.mjs} +12 -10
- package/dist/{cache-migrations-FKAHRP24.mjs → cache-migrations-PD2T5AV4.mjs} +14 -12
- package/dist/chunk-3RFRE7XG.mjs +491 -0
- package/dist/{chunk-7B2RVYLL.mjs → chunk-6BHJLCAO.mjs} +256 -392
- package/dist/{chunk-KS5TWO75.mjs → chunk-EQUFFLRG.mjs} +7 -7
- package/dist/chunk-HX6MOYBO.mjs +2 -0
- package/dist/{chunk-YEFJBN56.mjs → chunk-JVLZ3SOW.mjs} +11 -8
- package/dist/{chunk-4K4CWMMP.mjs → chunk-KRADH7PK.mjs} +53 -49
- package/dist/chunk-LALDNNPH.mjs +428 -0
- package/dist/chunk-LHK5YUR4.mjs +156 -0
- package/dist/{chunk-LBJAJLKU.mjs → chunk-M3IPUCTM.mjs} +1 -1
- package/dist/{chunk-C624G3R2.mjs → chunk-OI54DOHK.mjs} +256 -392
- package/dist/{chunk-LXGQCG56.mjs → chunk-OLZEMIDQ.mjs} +1 -1
- package/dist/{chunk-VP2E62DF.mjs → chunk-QSVMXMTQ.mjs} +49 -349
- package/dist/{chunk-J76GH2DR.mjs → chunk-R4ZYMEDU.mjs} +129 -86
- package/dist/{chunk-AJLRAC5M.mjs → chunk-TH5YCOZB.mjs} +55 -51
- package/dist/chunk-TRYHX5S4.mjs +360 -0
- package/dist/chunk-XBOVM6LO.mjs +41 -0
- package/dist/{chunk-ILU426CF.mjs → chunk-YACY2572.mjs} +482 -2
- package/dist/{config-MD27U4FM.mjs → config-BZHQK532.mjs} +3 -3
- package/dist/{dev-L4Y2GU2E.mjs → dev-7KGRV56X.mjs} +10 -8
- package/dist/{dev-YPBQBEOE.mjs → dev-GQT37XJU.mjs} +10 -8
- package/dist/{discovery-GWTBF5RZ.mjs → discovery-HNH3BLDL.mjs} +8 -6
- package/dist/{generators-VCYISHWO.mjs → generators-3FVW4AEJ.mjs} +18 -15
- package/dist/{generators-H4NTV4DB.mjs → generators-JWVNGUUE.mjs} +14 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +407 -102
- package/dist/{media-migrations-BNVAPYEM.mjs → media-migrations-EG34NYAG.mjs} +13 -11
- package/dist/{media-migrations-NNB3DAQR.mjs → media-migrations-LGI7R7AR.mjs} +11 -9
- package/dist/plugins-ZGLB6JO6.mjs +24 -0
- package/dist/{queue-5BXSDFCO.mjs → queue-BEZDCZCY.mjs} +54 -16
- package/dist/{queue-D4LSWNS2.mjs → queue-R54DUUYA.mjs} +54 -16
- package/dist/{queue-migrations-EF4AMMSY.mjs → queue-migrations-AM3AKT76.mjs} +16 -11
- package/dist/{queue-migrations-LXEWXJYT.mjs → queue-migrations-U477YSFD.mjs} +18 -13
- package/dist/{runtime-RPMZMTD4.mjs → runtime-4TJYZLQV.mjs} +10 -8
- package/dist/{runtime-UKBJQFXM.mjs → runtime-MSRQD5W5.mjs} +10 -8
- package/dist/{runtime-GSXF4NB3.mjs → runtime-VR5BDPYQ.mjs} +1 -1
- package/dist/runtime-worker.mjs +7 -1
- package/dist/{scaffold-NJ5VH73M.mjs → scaffold-ASEX5LEX.mjs} +8 -4
- package/dist/{scaffold-VV3KTYGO.mjs → scaffold-ZAD3XUSD.mjs} +8 -4
- package/dist/{security-K5PZS3E3.mjs → security-4QLV7QCH.mjs} +8 -6
- package/dist/{security-JR4P7L2C.mjs → security-KYTLP4DF.mjs} +8 -6
- package/package.json +35 -8
- package/dist/cache-HUGRWOHQ.mjs +0 -66
- package/dist/cache-OSJ4PD52.mjs +0 -66
- package/dist/chunk-D7O4SU6N.mjs +0 -2
- 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
|
-
|
|
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
|
-
|
|
30
|
-
} from "../chunk-LBJAJLKU.mjs";
|
|
31
|
-
import "../chunk-D7O4SU6N.mjs";
|
|
32
|
-
import "../chunk-VP2E62DF.mjs";
|
|
33
|
-
import "../chunk-7B2RVYLL.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-
|
|
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/
|
|
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,63 +128,36 @@ 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-
|
|
136
|
+
runtimeModulePromise ??= import("../runtime-MSRQD5W5.mjs");
|
|
133
137
|
return runtimeModulePromise;
|
|
134
138
|
}
|
|
135
|
-
function loadQueueModule() {
|
|
136
|
-
queueModulePromise ??= import("../queue-D4LSWNS2.mjs");
|
|
137
|
-
return queueModulePromise;
|
|
138
|
-
}
|
|
139
|
-
function loadCacheModule() {
|
|
140
|
-
cacheModulePromise ??= import("../cache-OSJ4PD52.mjs");
|
|
141
|
-
return cacheModulePromise;
|
|
142
|
-
}
|
|
143
|
-
function loadQueueMigrationsModule() {
|
|
144
|
-
queueMigrationsModulePromise ??= import("../queue-migrations-LXEWXJYT.mjs");
|
|
145
|
-
return queueMigrationsModulePromise;
|
|
146
|
-
}
|
|
147
|
-
function loadCacheMigrationsModule() {
|
|
148
|
-
cacheMigrationsModulePromise ??= import("../cache-migrations-FKAHRP24.mjs");
|
|
149
|
-
return cacheMigrationsModulePromise;
|
|
150
|
-
}
|
|
151
|
-
function loadMediaMigrationsModule() {
|
|
152
|
-
mediaMigrationsModulePromise ??= import("../media-migrations-BNVAPYEM.mjs");
|
|
153
|
-
return mediaMigrationsModulePromise;
|
|
154
|
-
}
|
|
155
|
-
function loadGeneratorsModule() {
|
|
156
|
-
generatorsModulePromise ??= import("../generators-VCYISHWO.mjs");
|
|
157
|
-
return generatorsModulePromise;
|
|
158
|
-
}
|
|
159
|
-
function loadBroadcastModule() {
|
|
160
|
-
broadcastModulePromise ??= import("../broadcast-JBQWQZSO.mjs");
|
|
161
|
-
return broadcastModulePromise;
|
|
162
|
-
}
|
|
163
139
|
function loadSecurityModule() {
|
|
164
|
-
securityModulePromise ??= import("../security-
|
|
140
|
+
securityModulePromise ??= import("../security-4QLV7QCH.mjs");
|
|
165
141
|
return securityModulePromise;
|
|
166
142
|
}
|
|
167
|
-
function loadDevModule() {
|
|
168
|
-
devModulePromise ??= import("../dev-YPBQBEOE.mjs");
|
|
169
|
-
return devModulePromise;
|
|
170
|
-
}
|
|
171
143
|
function loadProjectConfigModule() {
|
|
172
|
-
projectConfigModulePromise ??= import("../config-
|
|
144
|
+
projectConfigModulePromise ??= import("../config-BZHQK532.mjs");
|
|
173
145
|
return projectConfigModulePromise;
|
|
174
146
|
}
|
|
175
147
|
function loadProjectDiscoveryModule() {
|
|
176
|
-
projectDiscoveryModulePromise ??= import("../discovery-
|
|
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-
|
|
156
|
+
projectRuntimeModulePromise ??= import("../runtime-VR5BDPYQ.mjs");
|
|
181
157
|
return projectRuntimeModulePromise;
|
|
182
158
|
}
|
|
183
159
|
function loadProjectScaffoldModule() {
|
|
184
|
-
projectScaffoldModulePromise ??= import("../scaffold-
|
|
160
|
+
projectScaffoldModulePromise ??= import("../scaffold-ZAD3XUSD.mjs");
|
|
185
161
|
return projectScaffoldModulePromise;
|
|
186
162
|
}
|
|
187
163
|
function loadAgentSkillsModule() {
|
|
@@ -189,63 +165,73 @@ function loadAgentSkillsModule() {
|
|
|
189
165
|
return agentSkillsModulePromise;
|
|
190
166
|
}
|
|
191
167
|
async function resolveRuntimeExecutor(runtimeExecutor) {
|
|
192
|
-
|
|
168
|
+
runtimeModulePromise ??= import("../runtime-MSRQD5W5.mjs");
|
|
169
|
+
return runtimeExecutor ?? (await runtimeModulePromise).withRuntimeEnvironment;
|
|
193
170
|
}
|
|
194
|
-
|
|
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
|
-
|
|
204
|
-
return existing;
|
|
205
|
-
}
|
|
206
|
-
return await loaders[key]();
|
|
173
|
+
return existing ? existing : await loader();
|
|
207
174
|
}
|
|
208
|
-
async function resolveProjectExecutor(
|
|
209
|
-
|
|
175
|
+
async function resolveProjectExecutor(executors, key) {
|
|
176
|
+
devModulePromise ??= import("../dev-7KGRV56X.mjs");
|
|
177
|
+
return resolveExecutor(executors, async () => (await devModulePromise)[key], key);
|
|
210
178
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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(
|
|
238
|
-
return
|
|
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(
|
|
241
|
-
|
|
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(
|
|
244
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -327,6 +313,130 @@ async function runProjectDependencyInstallForProject(context, projectExecutors,
|
|
|
327
313
|
writeLine(context.stdout, " - installed dependencies");
|
|
328
314
|
}
|
|
329
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
|
+
}
|
|
330
440
|
function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, projectExecutors = {}, broadcastExecutors = {}, securityExecutors = {}, cacheExecutors = {}, mediaExecutors = {}) {
|
|
331
441
|
return [
|
|
332
442
|
{
|
|
@@ -751,6 +861,196 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
751
861
|
await runProjectDependencyInstallAfterPackageJsonUpdate(context, projectExecutors, result.updatedPackageJson);
|
|
752
862
|
}
|
|
753
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
|
+
},
|
|
754
1054
|
{
|
|
755
1055
|
name: "auth:notifications:publish",
|
|
756
1056
|
description: "Publish editable auth notification definitions into the application.",
|
|
@@ -1672,10 +1972,15 @@ async function runCli(argv, io) {
|
|
|
1672
1972
|
};
|
|
1673
1973
|
const internalCommands = createInternalCommands(internalContext);
|
|
1674
1974
|
const registry = [...internalCommands];
|
|
1675
|
-
const
|
|
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";
|
|
1676
1977
|
if (!canSkipAppDiscovery) {
|
|
1677
1978
|
const initialProject = await loadProject();
|
|
1678
|
-
const
|
|
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));
|
|
1679
1984
|
for (const appCommand of appCommands) {
|
|
1680
1985
|
const duplicate = findCommandConflict(registry, appCommand);
|
|
1681
1986
|
if (duplicate) {
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
initializeProjectRuntime
|
|
3
|
+
} from "./chunk-EQUFFLRG.mjs";
|
|
4
|
+
import "./chunk-M3IPUCTM.mjs";
|
|
1
5
|
import {
|
|
2
6
|
writeLine
|
|
3
7
|
} from "./chunk-I7QBCEV7.mjs";
|
|
8
|
+
import "./chunk-HX6MOYBO.mjs";
|
|
9
|
+
import "./chunk-6BHJLCAO.mjs";
|
|
4
10
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-LBJAJLKU.mjs";
|
|
8
|
-
import "./chunk-D7O4SU6N.mjs";
|
|
11
|
+
loadProjectConfig
|
|
12
|
+
} from "./chunk-JVLZ3SOW.mjs";
|
|
9
13
|
import {
|
|
10
14
|
prepareProjectDiscovery
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-7B2RVYLL.mjs";
|
|
13
|
-
import {
|
|
14
|
-
loadProjectConfig
|
|
15
|
-
} from "./chunk-YEFJBN56.mjs";
|
|
15
|
+
} from "./chunk-QSVMXMTQ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
loadGeneratedProjectRegistry
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-R4ZYMEDU.mjs";
|
|
19
|
+
import "./chunk-3RFRE7XG.mjs";
|
|
20
|
+
import "./chunk-TRYHX5S4.mjs";
|
|
19
21
|
import {
|
|
20
22
|
importProjectModule,
|
|
21
23
|
resolveProjectPackageImportSpecifier
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YACY2572.mjs";
|
|
23
25
|
|
|
24
26
|
// src/broadcast.ts
|
|
25
27
|
import { basename, extname, resolve } from "path";
|