@illumiarq/lumis 1.2.10 → 1.2.11
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/bridges/project-bridge.d.ts +2 -0
- package/dist/bridges/project-bridge.d.ts.map +1 -0
- package/dist/bridges/project-bridge.js +174 -0
- package/dist/bridges/project-bridge.js.map +1 -0
- package/dist/cli.d.ts +1 -16
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +538 -170
- package/dist/cli.js.map +1 -1
- package/dist/commands/app/cache-workflows.d.ts +7 -0
- package/dist/commands/app/cache-workflows.d.ts.map +1 -0
- package/dist/commands/app/cache-workflows.js +139 -0
- package/dist/commands/app/cache-workflows.js.map +1 -0
- package/dist/commands/app/command-runtime.d.ts +11 -0
- package/dist/commands/app/command-runtime.d.ts.map +1 -0
- package/dist/commands/app/command-runtime.js +41 -0
- package/dist/commands/app/command-runtime.js.map +1 -0
- package/dist/commands/app/config-cache.d.ts +3 -0
- package/dist/commands/app/config-cache.d.ts.map +1 -0
- package/dist/commands/app/config-cache.js +75 -0
- package/dist/commands/app/config-cache.js.map +1 -0
- package/dist/commands/app/config-publish.d.ts +2 -0
- package/dist/commands/app/config-publish.d.ts.map +1 -0
- package/dist/commands/app/config-publish.js +68 -0
- package/dist/commands/app/config-publish.js.map +1 -0
- package/dist/commands/app/config-stubs.d.ts +3 -0
- package/dist/commands/app/config-stubs.d.ts.map +1 -0
- package/dist/commands/app/config-stubs.js +154 -0
- package/dist/commands/app/config-stubs.js.map +1 -0
- package/dist/commands/app/database.d.ts +3 -0
- package/dist/commands/app/database.d.ts.map +1 -0
- package/dist/commands/app/database.js +221 -0
- package/dist/commands/app/database.js.map +1 -0
- package/dist/commands/app/docs.d.ts +7 -0
- package/dist/commands/app/docs.d.ts.map +1 -0
- package/dist/commands/app/docs.js +61 -0
- package/dist/commands/app/docs.js.map +1 -0
- package/dist/commands/app/routes.d.ts +5 -0
- package/dist/commands/app/routes.d.ts.map +1 -0
- package/dist/commands/app/routes.js +95 -0
- package/dist/commands/app/routes.js.map +1 -0
- package/dist/commands/app/security.d.ts +3 -0
- package/dist/commands/app/security.d.ts.map +1 -0
- package/dist/commands/app/security.js +15 -0
- package/dist/commands/app/security.js.map +1 -0
- package/dist/commands/app/worker-schedule.d.ts +5 -0
- package/dist/commands/app/worker-schedule.d.ts.map +1 -0
- package/dist/commands/app/worker-schedule.js +94 -0
- package/dist/commands/app/worker-schedule.js.map +1 -0
- package/dist/commands/app-commands.d.ts +19 -0
- package/dist/commands/app-commands.d.ts.map +1 -0
- package/dist/commands/app-commands.js +77 -0
- package/dist/commands/app-commands.js.map +1 -0
- package/dist/commands/build-vercel-fn.d.ts +9 -0
- package/dist/commands/build-vercel-fn.d.ts.map +1 -0
- package/dist/commands/build-vercel-fn.js +32 -0
- package/dist/commands/build-vercel-fn.js.map +1 -0
- package/dist/commands/build.d.ts +14 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +24 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/info.d.ts +9 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +41 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/keys.d.ts +3 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +60 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/maintenance.d.ts +9 -0
- package/dist/commands/maintenance.d.ts.map +1 -0
- package/dist/commands/maintenance.js +38 -0
- package/dist/commands/maintenance.js.map +1 -0
- package/dist/commands/module-list.d.ts +2 -0
- package/dist/commands/module-list.d.ts.map +1 -0
- package/dist/commands/module-list.js +27 -0
- package/dist/commands/module-list.js.map +1 -0
- package/dist/commands/preview.d.ts +14 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +49 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/serve.d.ts +16 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +61 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/{output/ansi.d.ts → console.d.ts} +8 -4
- package/dist/console.d.ts.map +1 -0
- package/dist/{output/ansi.js → console.js} +12 -4
- package/dist/console.js.map +1 -0
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +26 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +83 -0
- package/dist/paths.js.map +1 -0
- package/dist/server-wrapper.d.ts +12 -0
- package/dist/server-wrapper.d.ts.map +1 -0
- package/dist/server-wrapper.js +63 -0
- package/dist/server-wrapper.js.map +1 -0
- package/dist/vercel-wrapper.d.ts +6 -0
- package/dist/vercel-wrapper.d.ts.map +1 -0
- package/dist/vercel-wrapper.js +50 -0
- package/dist/vercel-wrapper.js.map +1 -0
- package/package.json +19 -37
- package/README.md +0 -38
- package/dist/adapter-loader.d.ts +0 -67
- package/dist/adapter-loader.d.ts.map +0 -1
- package/dist/adapter-loader.js +0 -273
- package/dist/adapter-loader.js.map +0 -1
- package/dist/commands/commands.command.d.ts +0 -38
- package/dist/commands/commands.command.d.ts.map +0 -1
- package/dist/commands/commands.command.js +0 -176
- package/dist/commands/commands.command.js.map +0 -1
- package/dist/commands/doctor.command.d.ts +0 -9
- package/dist/commands/doctor.command.d.ts.map +0 -1
- package/dist/commands/doctor.command.js +0 -922
- package/dist/commands/doctor.command.js.map +0 -1
- package/dist/commands/init.command.d.ts +0 -9
- package/dist/commands/init.command.d.ts.map +0 -1
- package/dist/commands/init.command.js +0 -135
- package/dist/commands/init.command.js.map +0 -1
- package/dist/commands/intent.command.d.ts +0 -26
- package/dist/commands/intent.command.d.ts.map +0 -1
- package/dist/commands/intent.command.js +0 -211
- package/dist/commands/intent.command.js.map +0 -1
- package/dist/commands/ir-rebuild.command.d.ts +0 -9
- package/dist/commands/ir-rebuild.command.d.ts.map +0 -1
- package/dist/commands/ir-rebuild.command.js +0 -36
- package/dist/commands/ir-rebuild.command.js.map +0 -1
- package/dist/commands/ir-show.command.d.ts +0 -9
- package/dist/commands/ir-show.command.d.ts.map +0 -1
- package/dist/commands/ir-show.command.js +0 -32
- package/dist/commands/ir-show.command.js.map +0 -1
- package/dist/commands/make.command.d.ts +0 -9
- package/dist/commands/make.command.d.ts.map +0 -1
- package/dist/commands/make.command.js +0 -93
- package/dist/commands/make.command.js.map +0 -1
- package/dist/commands/pack.command.d.ts +0 -16
- package/dist/commands/pack.command.d.ts.map +0 -1
- package/dist/commands/pack.command.js +0 -44
- package/dist/commands/pack.command.js.map +0 -1
- package/dist/commands/runtime.command.d.ts +0 -6
- package/dist/commands/runtime.command.d.ts.map +0 -1
- package/dist/commands/runtime.command.js +0 -379
- package/dist/commands/runtime.command.js.map +0 -1
- package/dist/commands/runtime.d.ts +0 -45
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/runtime.js +0 -66
- package/dist/commands/runtime.js.map +0 -1
- package/dist/commands/tinker-agent-plan.d.ts +0 -26
- package/dist/commands/tinker-agent-plan.d.ts.map +0 -1
- package/dist/commands/tinker-agent-plan.js +0 -115
- package/dist/commands/tinker-agent-plan.js.map +0 -1
- package/dist/commands/tinker-chat-commands.d.ts +0 -19
- package/dist/commands/tinker-chat-commands.d.ts.map +0 -1
- package/dist/commands/tinker-chat-commands.js +0 -263
- package/dist/commands/tinker-chat-commands.js.map +0 -1
- package/dist/commands/tinker-chat-runtime.d.ts +0 -30
- package/dist/commands/tinker-chat-runtime.d.ts.map +0 -1
- package/dist/commands/tinker-chat-runtime.js +0 -227
- package/dist/commands/tinker-chat-runtime.js.map +0 -1
- package/dist/commands/tinker-classic-mode.d.ts +0 -15
- package/dist/commands/tinker-classic-mode.d.ts.map +0 -1
- package/dist/commands/tinker-classic-mode.js +0 -160
- package/dist/commands/tinker-classic-mode.js.map +0 -1
- package/dist/commands/tinker-eval.command.d.ts +0 -3
- package/dist/commands/tinker-eval.command.d.ts.map +0 -1
- package/dist/commands/tinker-eval.command.js +0 -151
- package/dist/commands/tinker-eval.command.js.map +0 -1
- package/dist/commands/tinker-repl-display.d.ts +0 -15
- package/dist/commands/tinker-repl-display.d.ts.map +0 -1
- package/dist/commands/tinker-repl-display.js +0 -147
- package/dist/commands/tinker-repl-display.js.map +0 -1
- package/dist/commands/tinker-session-runtime.d.ts +0 -27
- package/dist/commands/tinker-session-runtime.d.ts.map +0 -1
- package/dist/commands/tinker-session-runtime.js +0 -196
- package/dist/commands/tinker-session-runtime.js.map +0 -1
- package/dist/commands/tinker.command.d.ts +0 -9
- package/dist/commands/tinker.command.d.ts.map +0 -1
- package/dist/commands/tinker.command.js +0 -142
- package/dist/commands/tinker.command.js.map +0 -1
- package/dist/commands/use.command.d.ts +0 -10
- package/dist/commands/use.command.d.ts.map +0 -1
- package/dist/commands/use.command.js +0 -69
- package/dist/commands/use.command.js.map +0 -1
- package/dist/config-loader.d.ts +0 -110
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -119
- package/dist/config-loader.js.map +0 -1
- package/dist/launcher.d.ts +0 -16
- package/dist/launcher.d.ts.map +0 -1
- package/dist/launcher.js +0 -301
- package/dist/launcher.js.map +0 -1
- package/dist/lib/file-scanner.d.ts +0 -8
- package/dist/lib/file-scanner.d.ts.map +0 -1
- package/dist/lib/file-scanner.js +0 -70
- package/dist/lib/file-scanner.js.map +0 -1
- package/dist/lib/tinker-memory.d.ts +0 -19
- package/dist/lib/tinker-memory.d.ts.map +0 -1
- package/dist/lib/tinker-memory.js +0 -107
- package/dist/lib/tinker-memory.js.map +0 -1
- package/dist/lib/tinker-observer.d.ts +0 -47
- package/dist/lib/tinker-observer.d.ts.map +0 -1
- package/dist/lib/tinker-observer.js +0 -77
- package/dist/lib/tinker-observer.js.map +0 -1
- package/dist/lib/tinker-policy.d.ts +0 -21
- package/dist/lib/tinker-policy.d.ts.map +0 -1
- package/dist/lib/tinker-policy.js +0 -102
- package/dist/lib/tinker-policy.js.map +0 -1
- package/dist/lib/tinker-replay.d.ts +0 -51
- package/dist/lib/tinker-replay.d.ts.map +0 -1
- package/dist/lib/tinker-replay.js +0 -123
- package/dist/lib/tinker-replay.js.map +0 -1
- package/dist/output/ansi.d.ts.map +0 -1
- package/dist/output/ansi.js.map +0 -1
- package/dist/output/plan-display.d.ts +0 -4
- package/dist/output/plan-display.d.ts.map +0 -1
- package/dist/output/plan-display.js +0 -49
- package/dist/output/plan-display.js.map +0 -1
- package/dist/output/result-display.d.ts +0 -5
- package/dist/output/result-display.d.ts.map +0 -1
- package/dist/output/result-display.js +0 -17
- package/dist/output/result-display.js.map +0 -1
- package/dist/plugins/tinker-plugin.d.ts +0 -86
- package/dist/plugins/tinker-plugin.d.ts.map +0 -1
- package/dist/plugins/tinker-plugin.js +0 -42
- package/dist/plugins/tinker-plugin.js.map +0 -1
- package/dist/router-preferences.d.ts +0 -5
- package/dist/router-preferences.d.ts.map +0 -1
- package/dist/router-preferences.js +0 -22
- package/dist/router-preferences.js.map +0 -1
- package/dist/runtime/executor.d.ts +0 -33
- package/dist/runtime/executor.d.ts.map +0 -1
- package/dist/runtime/executor.js +0 -180
- package/dist/runtime/executor.js.map +0 -1
- package/dist/runtime/orchestration.d.ts +0 -43
- package/dist/runtime/orchestration.d.ts.map +0 -1
- package/dist/runtime/orchestration.js +0 -209
- package/dist/runtime/orchestration.js.map +0 -1
- package/dist/runtime/policy.d.ts +0 -49
- package/dist/runtime/policy.d.ts.map +0 -1
- package/dist/runtime/policy.js +0 -78
- package/dist/runtime/policy.js.map +0 -1
- package/dist/runtime/profiles.d.ts +0 -15
- package/dist/runtime/profiles.d.ts.map +0 -1
- package/dist/runtime/profiles.js +0 -131
- package/dist/runtime/profiles.js.map +0 -1
- package/dist/runtime/transcripts.d.ts +0 -59
- package/dist/runtime/transcripts.d.ts.map +0 -1
- package/dist/runtime/transcripts.js +0 -172
- package/dist/runtime/transcripts.js.map +0 -1
- package/dist/tools/git-diff.d.ts +0 -3
- package/dist/tools/git-diff.d.ts.map +0 -1
- package/dist/tools/git-diff.js +0 -16
- package/dist/tools/git-diff.js.map +0 -1
- package/dist/tools/index.d.ts +0 -24
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -88
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/lint.d.ts +0 -3
- package/dist/tools/lint.d.ts.map +0 -1
- package/dist/tools/lint.js +0 -35
- package/dist/tools/lint.js.map +0 -1
- package/dist/tools/read-file.d.ts +0 -3
- package/dist/tools/read-file.d.ts.map +0 -1
- package/dist/tools/read-file.js +0 -47
- package/dist/tools/read-file.js.map +0 -1
- package/dist/tools/run-command.d.ts +0 -3
- package/dist/tools/run-command.d.ts.map +0 -1
- package/dist/tools/run-command.js +0 -71
- package/dist/tools/run-command.js.map +0 -1
- package/dist/tools/run-tests.d.ts +0 -3
- package/dist/tools/run-tests.d.ts.map +0 -1
- package/dist/tools/run-tests.js +0 -49
- package/dist/tools/run-tests.js.map +0 -1
- package/dist/tools/tool-dispatch.d.ts +0 -32
- package/dist/tools/tool-dispatch.d.ts.map +0 -1
- package/dist/tools/tool-dispatch.js +0 -120
- package/dist/tools/tool-dispatch.js.map +0 -1
- package/dist/tools/typecheck.d.ts +0 -3
- package/dist/tools/typecheck.d.ts.map +0 -1
- package/dist/tools/typecheck.js +0 -48
- package/dist/tools/typecheck.js.map +0 -1
- package/dist/tools/types.d.ts +0 -62
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -7
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/write-file.d.ts +0 -15
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js +0 -52
- package/dist/tools/write-file.js.map +0 -1
- package/dist/tracing/types.d.ts +0 -10
- package/dist/tracing/types.d.ts.map +0 -1
- package/dist/tracing/types.js +0 -2
- package/dist/tracing/types.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,192 +1,560 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* @illumiarq/lumis — extended CLI entry point.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Intercepts LumiARQ-specific commands (serve / build / preview) and
|
|
6
|
+
* delegates everything else to the base @lumiarq/lumis runCli().
|
|
6
7
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
8
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { ui, writeError, writeLine } from './console.js';
|
|
11
|
+
import { readStorageRoot } from './paths.js';
|
|
12
|
+
import { serveApp } from './commands/serve.js';
|
|
13
|
+
import { buildApp } from './commands/build.js';
|
|
14
|
+
import { buildVercelFunction } from './commands/build-vercel-fn.js';
|
|
15
|
+
import { previewApp } from './commands/preview.js';
|
|
16
|
+
import { showInfo } from './commands/info.js';
|
|
17
|
+
import { listModules } from './commands/module-list.js';
|
|
18
|
+
import { generateKeys, rotateKeys } from './commands/keys.js';
|
|
19
|
+
import { enableMaintenanceMode, disableMaintenanceMode } from './commands/maintenance.js';
|
|
20
|
+
import { cacheConfig, cacheRoutes, cacheSearchIndex, cacheViews, checkRoutes, clearConfigCache, clearOptimizationCaches, clearRouteCache, clearSearchIndex, clearViews, installAuth, listRoutes, optimizeForProduction, publishConfig, publishStubs, runDatabaseCommand, scheduleList, scheduleRun, showResolvedConfig, workerList, workerStart, } from './commands/app-commands.js';
|
|
21
|
+
const argv = process.argv.slice(2);
|
|
22
|
+
const cmd = argv[0];
|
|
23
|
+
async function main() {
|
|
24
|
+
if (argv.includes('--help') || cmd === 'help') {
|
|
25
|
+
return renderCombinedHelp();
|
|
26
|
+
}
|
|
27
|
+
// ── LumiARQ-specific commands ──────────────────────────────────────────────
|
|
28
|
+
if (cmd === 'serve') {
|
|
29
|
+
const port = parsePort(argv);
|
|
30
|
+
const host = parseHost(argv);
|
|
31
|
+
return serveApp({ ...(port !== undefined ? { port } : {}), ...(host ? { host } : {}) });
|
|
32
|
+
}
|
|
33
|
+
if (cmd === 'preview') {
|
|
34
|
+
const port = parsePort(argv);
|
|
35
|
+
const target = parsePreviewTarget(argv);
|
|
36
|
+
return previewApp({ ...(port !== undefined ? { port } : {}), ...(target ? { target } : {}) });
|
|
37
|
+
}
|
|
38
|
+
if (cmd === 'build') {
|
|
39
|
+
const target = parseTarget(argv);
|
|
40
|
+
return buildApp(target !== undefined ? { target } : {});
|
|
41
|
+
}
|
|
42
|
+
if (cmd === 'build:vercel') {
|
|
43
|
+
return buildApp({ target: 'vercel' });
|
|
44
|
+
}
|
|
45
|
+
if (cmd === 'build:vercel-fn') {
|
|
46
|
+
return buildVercelFunction();
|
|
47
|
+
}
|
|
48
|
+
if (cmd === 'info') {
|
|
49
|
+
return showInfo();
|
|
50
|
+
}
|
|
51
|
+
if (cmd === 'health') {
|
|
52
|
+
runHealthPreChecks();
|
|
53
|
+
const { runCli } = await import('@lumiarq/lumis');
|
|
54
|
+
return runCli(['doctor', ...argv.slice(1)]);
|
|
55
|
+
}
|
|
56
|
+
if (cmd === 'doctor') {
|
|
57
|
+
runHealthPreChecks();
|
|
58
|
+
const { runCli } = await import('@lumiarq/lumis');
|
|
59
|
+
return runCli(argv);
|
|
60
|
+
}
|
|
61
|
+
if (cmd === 'module:list') {
|
|
62
|
+
return listModules();
|
|
63
|
+
}
|
|
64
|
+
if (cmd === 'test') {
|
|
65
|
+
return runTest(argv.slice(1));
|
|
66
|
+
}
|
|
67
|
+
if (cmd === 'prettier:sync') {
|
|
68
|
+
return syncPrettierConfig();
|
|
69
|
+
}
|
|
70
|
+
if (cmd === 'key:generate') {
|
|
71
|
+
return generateKeys();
|
|
72
|
+
}
|
|
73
|
+
if (cmd === 'key:rotate') {
|
|
74
|
+
return rotateKeys();
|
|
75
|
+
}
|
|
76
|
+
if (cmd === 'config:show') {
|
|
77
|
+
const configName = argv[1];
|
|
78
|
+
if (!configName) {
|
|
79
|
+
writeError(ui.fail('Usage: lumis config:show <name> [--json]'));
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
return showResolvedConfig(configName);
|
|
83
|
+
}
|
|
84
|
+
if (cmd === 'config:cache') {
|
|
85
|
+
return cacheConfig();
|
|
86
|
+
}
|
|
87
|
+
if (cmd === 'config:clear') {
|
|
88
|
+
return clearConfigCache();
|
|
89
|
+
}
|
|
90
|
+
if (cmd?.startsWith('db:')) {
|
|
91
|
+
return await runDatabaseCommand(cmd, argv.slice(1));
|
|
92
|
+
}
|
|
93
|
+
if (cmd === 'route:list') {
|
|
94
|
+
return listRoutes();
|
|
95
|
+
}
|
|
96
|
+
if (cmd === 'route:check') {
|
|
97
|
+
return checkRoutes();
|
|
98
|
+
}
|
|
99
|
+
if (cmd === 'route:cache') {
|
|
100
|
+
return cacheRoutes();
|
|
101
|
+
}
|
|
102
|
+
if (cmd === 'route:clear') {
|
|
103
|
+
return clearRouteCache();
|
|
104
|
+
}
|
|
105
|
+
if (cmd === 'view:cache') {
|
|
106
|
+
return cacheViews();
|
|
107
|
+
}
|
|
108
|
+
if (cmd === 'view:clear') {
|
|
109
|
+
return clearViews();
|
|
110
|
+
}
|
|
111
|
+
if (cmd === 'search:index') {
|
|
112
|
+
return cacheSearchIndex();
|
|
113
|
+
}
|
|
114
|
+
if (cmd === 'search:clear') {
|
|
115
|
+
return clearSearchIndex();
|
|
116
|
+
}
|
|
117
|
+
if (cmd === 'optimize') {
|
|
118
|
+
return optimizeForProduction();
|
|
45
119
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
120
|
+
if (cmd === 'optimize:clear') {
|
|
121
|
+
return clearOptimizationCaches();
|
|
122
|
+
}
|
|
123
|
+
if (cmd === 'down') {
|
|
124
|
+
const message = parseStringFlag(argv, '--message');
|
|
125
|
+
const secret = parseStringFlag(argv, '--secret');
|
|
126
|
+
const allowedIps = parseRepeatedFlag(argv, '--allow');
|
|
127
|
+
return enableMaintenanceMode({
|
|
128
|
+
...(message ? { message } : {}),
|
|
129
|
+
...(secret ? { secret } : {}),
|
|
130
|
+
...(allowedIps.length > 0 ? { allowedIps } : {}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (cmd === 'up') {
|
|
134
|
+
return disableMaintenanceMode();
|
|
135
|
+
}
|
|
136
|
+
if (cmd === 'stub:publish') {
|
|
137
|
+
return publishStubs({ all: argv.includes('--all'), iam: argv.includes('--iam') });
|
|
138
|
+
}
|
|
139
|
+
if (cmd === 'auth:install') {
|
|
140
|
+
const uiFramework = parseStringFlag(argv, '--ui');
|
|
141
|
+
return installAuth({
|
|
142
|
+
iam: argv.includes('--iam'),
|
|
143
|
+
...(uiFramework ? { ui: uiFramework } : {}),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (cmd === 'publish') {
|
|
147
|
+
const subCmd = argv[1];
|
|
148
|
+
if (subCmd === 'config') {
|
|
149
|
+
const configName = argv[2] ?? 'list';
|
|
150
|
+
return publishConfig(configName, argv.includes('--force'));
|
|
151
|
+
}
|
|
152
|
+
if (subCmd === 'stub' || subCmd === 'stubs') {
|
|
153
|
+
return publishStubs({ all: argv.includes('--all'), iam: argv.includes('--iam') });
|
|
154
|
+
}
|
|
155
|
+
writeError(ui.fail(`Unknown publish subcommand: "${subCmd}". Try: publish config <name>`));
|
|
156
|
+
return 1;
|
|
157
|
+
}
|
|
158
|
+
if (cmd === 'worker:start') {
|
|
159
|
+
return workerStart(argv.includes('--dev'));
|
|
160
|
+
}
|
|
161
|
+
if (cmd === 'worker:list') {
|
|
162
|
+
return workerList();
|
|
163
|
+
}
|
|
164
|
+
if (cmd === 'schedule:list') {
|
|
165
|
+
return scheduleList();
|
|
166
|
+
}
|
|
167
|
+
if (cmd === 'schedule:run') {
|
|
168
|
+
return scheduleRun(argv[1] ?? '');
|
|
169
|
+
}
|
|
170
|
+
const projectCommandExit = await runProjectCommandDirect(argv);
|
|
171
|
+
if (projectCommandExit !== null) {
|
|
172
|
+
return projectCommandExit;
|
|
173
|
+
}
|
|
174
|
+
// ── Delegate to base @lumiarq/lumis (lazy import avoids auto-run side effect)
|
|
175
|
+
const { runCli } = await import('@lumiarq/lumis');
|
|
176
|
+
return runCli(argv);
|
|
56
177
|
}
|
|
57
|
-
async function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
await
|
|
178
|
+
async function renderCombinedHelp() {
|
|
179
|
+
renderWrapperHelp();
|
|
180
|
+
writeLine(ui.section('Base Lumis Commands'));
|
|
181
|
+
const { runCli } = await import('@lumiarq/lumis');
|
|
182
|
+
return runCli(['--help']);
|
|
61
183
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
184
|
+
function renderWrapperHelp() {
|
|
185
|
+
writeLine();
|
|
186
|
+
writeLine(ui.section('LumiARQ CLI'));
|
|
187
|
+
writeLine(` ${ui.dim('Wrapper commands are shown first; core Lumis commands remain available underneath.')}`);
|
|
188
|
+
writeLine();
|
|
189
|
+
writeLine(` ${ui.bold('Runtime')}`);
|
|
190
|
+
writeLine(' lumis serve [--port|-p <port>] [--host|-H <host>]');
|
|
191
|
+
writeLine(' lumis build [--target|--to|--t|-t <node|static|cloudflare|vercel>]');
|
|
192
|
+
writeLine(' lumis build:vercel');
|
|
193
|
+
writeLine(' lumis preview [--target|--to|--t|-t <node|static|cloudflare>]');
|
|
194
|
+
writeLine();
|
|
195
|
+
writeLine(` ${ui.bold('App')}`);
|
|
196
|
+
writeLine(' lumis info');
|
|
197
|
+
writeLine(' lumis health');
|
|
198
|
+
writeLine(' lumis module:list');
|
|
199
|
+
writeLine(' lumis config:show <name>');
|
|
200
|
+
writeLine(' lumis config:cache | config:clear');
|
|
201
|
+
writeLine(' lumis route:list | route:check | route:cache | route:clear');
|
|
202
|
+
writeLine(' lumis view:cache | view:clear');
|
|
203
|
+
writeLine(' lumis search:index | search:clear');
|
|
204
|
+
writeLine(' lumis optimize | optimize:clear');
|
|
205
|
+
writeLine(' lumis key:generate | key:rotate');
|
|
206
|
+
writeLine(' lumis down [--message <text>] [--secret <token>] [--allow <ip>]');
|
|
207
|
+
writeLine(' lumis up');
|
|
208
|
+
writeLine(' lumis auth:install [--iam] [--ui react]');
|
|
209
|
+
writeLine(' lumis stub:publish [--all|--iam]');
|
|
210
|
+
writeLine();
|
|
211
|
+
writeLine(` ${ui.bold('Database')}`);
|
|
212
|
+
writeLine(' lumis db:generate | db:migrate');
|
|
213
|
+
writeLine(' lumis db:ping — verify DB connection and diagnose failures');
|
|
214
|
+
writeLine(' lumis db:seed');
|
|
215
|
+
writeLine(' lumis db:fresh — migrate + seed (destructive)');
|
|
216
|
+
writeLine(' lumis db:reset — drop all tables + migrate');
|
|
217
|
+
writeLine(' lumis db:studio — open drizzle-kit studio');
|
|
218
|
+
writeLine();
|
|
219
|
+
writeLine(` ${ui.bold('Config')}`);
|
|
220
|
+
writeLine(' lumis publish config <name> — mail | queue | cache | storage | session | security | logging | auth');
|
|
221
|
+
writeLine(' lumis publish config all — publish every config file');
|
|
222
|
+
writeLine(' lumis publish config list — show available configs');
|
|
223
|
+
writeLine();
|
|
224
|
+
writeLine(` ${ui.bold('Workers & Scheduling')}`);
|
|
225
|
+
writeLine(' lumis worker:start [--dev] — start background worker process');
|
|
226
|
+
writeLine(' lumis worker:list — list registered workers + scheduled jobs');
|
|
227
|
+
writeLine(' lumis schedule:list — list all cron jobs');
|
|
228
|
+
writeLine(' lumis schedule:run <name> — run a specific cron job immediately');
|
|
229
|
+
writeLine();
|
|
230
|
+
writeLine(` ${ui.bold('Core Lumis')}`);
|
|
231
|
+
writeLine(' lumis doctor | init | make | intent | ir:* | runtime:* | tinker');
|
|
232
|
+
writeLine();
|
|
233
|
+
writeLine(` ${ui.bold('Project Commands')}`);
|
|
234
|
+
writeLine(' lumis <your:command> — run projectCommands entries directly');
|
|
235
|
+
writeLine(' lumis commands run project <name>');
|
|
236
|
+
writeLine();
|
|
74
237
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
238
|
+
const BASE_COMMAND_ROOTS = new Set([
|
|
239
|
+
'use',
|
|
240
|
+
'pack',
|
|
241
|
+
'commands',
|
|
242
|
+
'doctor',
|
|
243
|
+
'init',
|
|
244
|
+
'make',
|
|
245
|
+
'intent',
|
|
246
|
+
'ir',
|
|
247
|
+
'runtime',
|
|
248
|
+
'tinker',
|
|
249
|
+
]);
|
|
250
|
+
async function runProjectCommandDirect(args) {
|
|
251
|
+
const candidate = args[0];
|
|
252
|
+
if (!candidate) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
if (BASE_COMMAND_ROOTS.has(candidate)) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const { runCli } = await import('@lumiarq/lumis');
|
|
259
|
+
let stdout = '';
|
|
260
|
+
let stderr = '';
|
|
261
|
+
const listExit = await runCli(['commands', 'list', '--json'], {
|
|
262
|
+
write: (chunk) => {
|
|
263
|
+
stdout += chunk;
|
|
264
|
+
},
|
|
265
|
+
writeError: (chunk) => {
|
|
266
|
+
stderr += chunk;
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
if (listExit !== 0 || stderr.trim().length > 0) {
|
|
94
270
|
return null;
|
|
95
271
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
272
|
+
let commands = [];
|
|
273
|
+
try {
|
|
274
|
+
commands = JSON.parse(stdout);
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
const exists = commands.some((entry) => entry.source === 'project' && entry.name === candidate);
|
|
280
|
+
if (!exists) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
return runCli(['commands', 'run', 'project', candidate, ...args.slice(1)]);
|
|
100
284
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
285
|
+
async function runTest(extraArgs) {
|
|
286
|
+
const cwd = process.cwd();
|
|
287
|
+
const { execSync } = await import('node:child_process');
|
|
288
|
+
// Prefer flat pkg/vitest.config.ts; fall back to legacy pkg/vitest/config.ts
|
|
289
|
+
const flatConfig = join(cwd, 'pkg', 'vitest.config.ts');
|
|
290
|
+
const subdirConfig = join(cwd, 'pkg', 'vitest', 'config.ts');
|
|
291
|
+
const configPath = existsSync(flatConfig)
|
|
292
|
+
? flatConfig
|
|
293
|
+
: existsSync(subdirConfig)
|
|
294
|
+
? subdirConfig
|
|
295
|
+
: null;
|
|
296
|
+
const configFlag = configPath ? ['--config', configPath] : [];
|
|
297
|
+
const vitestArgs = ['vitest', 'run', ...configFlag, ...extraArgs].join(' ');
|
|
298
|
+
try {
|
|
299
|
+
execSync(`pnpm exec ${vitestArgs}`, { stdio: 'inherit', cwd });
|
|
300
|
+
return 0;
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return 1;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async function syncPrettierConfig() {
|
|
307
|
+
const cwd = process.cwd();
|
|
308
|
+
const { writeFileSync } = await import('node:fs');
|
|
309
|
+
const { pathToFileURL } = await import('node:url');
|
|
310
|
+
const srcPath = join(cwd, 'pkg', 'prettier.config.ts');
|
|
311
|
+
if (!existsSync(srcPath)) {
|
|
312
|
+
writeError(ui.fail('pkg/prettier.config.ts not found. Create it first.\n'));
|
|
313
|
+
return 1;
|
|
314
|
+
}
|
|
315
|
+
let config;
|
|
316
|
+
try {
|
|
317
|
+
const mod = await import(pathToFileURL(srcPath).href);
|
|
318
|
+
config = mod.default ?? mod;
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
writeError(ui.fail(`Failed to load pkg/prettier.config.ts: ${String(e)}\n`));
|
|
322
|
+
return 1;
|
|
323
|
+
}
|
|
324
|
+
const out = [
|
|
325
|
+
'// Auto-generated by lumis prettier:sync — edit pkg/prettier.config.ts instead.',
|
|
326
|
+
'// Run `lumis prettier:sync` to regenerate after changing pkg/prettier.config.ts.',
|
|
327
|
+
"/** @type {import('prettier').Config} */",
|
|
328
|
+
`export default ${JSON.stringify(config, null, 2)};`,
|
|
329
|
+
'',
|
|
330
|
+
].join('\n');
|
|
331
|
+
writeFileSync(join(cwd, 'prettier.config.mjs'), out, 'utf8');
|
|
332
|
+
writeLine(ui.ok('prettier.config.mjs generated from pkg/prettier.config.ts'));
|
|
333
|
+
return 0;
|
|
334
|
+
}
|
|
335
|
+
function runHealthPreChecks() {
|
|
336
|
+
const cwd = process.cwd();
|
|
337
|
+
const checks = [];
|
|
338
|
+
// Required bootstrap files
|
|
339
|
+
checks.push({
|
|
340
|
+
label: 'bootstrap/entry.ts present',
|
|
341
|
+
pass: existsSync(join(cwd, 'bootstrap', 'entry.ts')),
|
|
342
|
+
fix: 'bootstrap/entry.ts is missing — this is the HTTP server entrypoint.',
|
|
343
|
+
});
|
|
344
|
+
checks.push({
|
|
345
|
+
label: 'bootstrap/providers.ts present',
|
|
346
|
+
pass: existsSync(join(cwd, 'bootstrap', 'providers.ts')),
|
|
347
|
+
fix: "bootstrap/providers.ts is missing — service container won't boot.",
|
|
348
|
+
});
|
|
349
|
+
checks.push({
|
|
350
|
+
label: 'src/config/app.ts present',
|
|
351
|
+
pass: existsSync(join(cwd, 'src', 'config', 'app.ts')),
|
|
352
|
+
fix: 'src/config/app.ts is missing — run: lumis publish config app',
|
|
353
|
+
});
|
|
354
|
+
checks.push({
|
|
355
|
+
label: '@types/node installed',
|
|
356
|
+
pass: existsSync(join(cwd, 'node_modules', '@types', 'node')) ||
|
|
357
|
+
existsSync(join(cwd, '..', 'node_modules', '@types', 'node')),
|
|
358
|
+
fix: 'Install @types/node: pnpm add -D @types/node',
|
|
359
|
+
});
|
|
360
|
+
checks.push({
|
|
361
|
+
label: 'drizzle config uses canonical pkg path',
|
|
362
|
+
pass: !existsSync(join(cwd, 'drizzle.config.ts')) ||
|
|
363
|
+
existsSync(join(cwd, 'pkg', 'drizzle.config.ts')) ||
|
|
364
|
+
existsSync(join(cwd, 'pkg', 'drizzle', 'config.ts')), // legacy subdir — migrate to flat
|
|
365
|
+
fix: 'Move Drizzle config to pkg/drizzle.config.ts. No root shim needed — lumis db:* reads pkg/ directly.',
|
|
366
|
+
});
|
|
367
|
+
checks.push({
|
|
368
|
+
label: 'vitest config uses canonical pkg path',
|
|
369
|
+
pass: !existsSync(join(cwd, 'vitest.config.ts')) ||
|
|
370
|
+
existsSync(join(cwd, 'pkg', 'vitest.config.ts')) ||
|
|
371
|
+
existsSync(join(cwd, 'pkg', 'vitest', 'config.ts')), // legacy subdir — migrate to flat
|
|
372
|
+
fix: 'Move Vitest config to pkg/vitest.config.ts. No root shim needed — lumis test reads pkg/ directly.',
|
|
373
|
+
});
|
|
374
|
+
checks.push({
|
|
375
|
+
label: 'lumis config uses canonical pkg path',
|
|
376
|
+
pass: (!existsSync(join(cwd, 'lumis.config.ts')) && !existsSync(join(cwd, 'lumis.config.json'))) ||
|
|
377
|
+
existsSync(join(cwd, 'pkg', 'lumis.config.ts')) ||
|
|
378
|
+
existsSync(join(cwd, 'pkg', 'lumis', 'config.ts')), // legacy subdir — migrate to flat
|
|
379
|
+
fix: 'Move lumis config to pkg/lumis.config.ts and remove the root lumis.config.* file.',
|
|
380
|
+
});
|
|
381
|
+
checks.push({
|
|
382
|
+
label: 'prettier config uses canonical pkg path',
|
|
383
|
+
pass: !existsSync(join(cwd, '.prettierrc')) || existsSync(join(cwd, 'pkg', 'prettier.config.ts')),
|
|
384
|
+
fix: 'Create pkg/prettier.config.ts and run `lumis prettier:sync` to generate prettier.config.mjs. Then delete .prettierrc.',
|
|
385
|
+
});
|
|
386
|
+
// Warn if queue driver isn't stub but worker.ts is missing
|
|
387
|
+
const queueConfigPath = existsSync(join(cwd, 'src', 'config', 'queue.ts'))
|
|
388
|
+
? join(cwd, 'src', 'config', 'queue.ts')
|
|
389
|
+
: join(cwd, 'config', 'queue.ts'); // legacy fallback
|
|
390
|
+
if (existsSync(queueConfigPath)) {
|
|
391
|
+
const queueSrc = readFileSync(queueConfigPath, 'utf8');
|
|
392
|
+
const usesBullmq = queueSrc.includes("'bullmq'") || queueSrc.includes('"bullmq"');
|
|
393
|
+
if (usesBullmq) {
|
|
394
|
+
checks.push({
|
|
395
|
+
label: 'bootstrap/worker.ts present (queue driver: bullmq)',
|
|
396
|
+
pass: existsSync(join(cwd, 'bootstrap', 'worker.ts')),
|
|
397
|
+
fix: "Queue driver is 'bullmq' but bootstrap/worker.ts is missing. Create it to process queued jobs.",
|
|
138
398
|
});
|
|
139
|
-
return launcherResult.code;
|
|
140
399
|
}
|
|
141
|
-
argv = launcherResult.argv;
|
|
142
|
-
}
|
|
143
|
-
if (argv.includes('--help') || argv.length === 0) {
|
|
144
|
-
await emitTrace(onTrace, {
|
|
145
|
-
type: 'command-dispatch',
|
|
146
|
-
status: 'info',
|
|
147
|
-
name: 'help',
|
|
148
|
-
context: { argvLength: argv.length },
|
|
149
|
-
});
|
|
150
|
-
write(formatUsage());
|
|
151
|
-
return 0;
|
|
152
400
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
401
|
+
// Vercel deployment hygiene (Phase 0)
|
|
402
|
+
const vercelJsonPath = join(cwd, 'vercel.json');
|
|
403
|
+
if (existsSync(vercelJsonPath)) {
|
|
404
|
+
let vercelRaw = '';
|
|
405
|
+
try {
|
|
406
|
+
vercelRaw = readFileSync(vercelJsonPath, 'utf8');
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
vercelRaw = '';
|
|
410
|
+
}
|
|
411
|
+
const usesLegacyRoutes = vercelRaw.includes('"routes"') &&
|
|
412
|
+
vercelRaw.includes('"handle"') &&
|
|
413
|
+
vercelRaw.includes('filesystem');
|
|
414
|
+
checks.push({
|
|
415
|
+
label: 'vercel.json uses rewrites (not legacy routes + filesystem)',
|
|
416
|
+
pass: !usesLegacyRoutes && vercelRaw.includes('"rewrites"'),
|
|
417
|
+
fix: 'Replace deprecated routes/handle:filesystem with rewrites → /api/index. See lumiarq-vercel-deployment-fix skill.',
|
|
418
|
+
});
|
|
419
|
+
checks.push({
|
|
420
|
+
label: 'vercel.json installCommand pins pnpm',
|
|
421
|
+
pass: vercelRaw.includes('"installCommand"') && vercelRaw.includes('pnpm'),
|
|
422
|
+
fix: 'Add installCommand: "corepack enable && pnpm install --frozen-lockfile" to vercel.json.',
|
|
423
|
+
});
|
|
424
|
+
checks.push({
|
|
425
|
+
label: 'vercel.json bundles framework cache for serverless',
|
|
426
|
+
pass: vercelRaw.includes('"includeFiles"') && vercelRaw.includes('src/storage/framework/cache'),
|
|
427
|
+
fix: 'Add functions.api/index.js.includeFiles: "src/storage/framework/cache/**" so route/view caches ship with the function.',
|
|
160
428
|
});
|
|
161
|
-
writeError(`${ansi.fail(`Unknown command: ${argv.join(' ')}`)}\n`);
|
|
162
|
-
write(formatUsage());
|
|
163
|
-
return 1;
|
|
164
429
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
context: { args: matched.args },
|
|
430
|
+
checks.push({
|
|
431
|
+
label: 'api/index.js present (run pnpm run build:vercel first)',
|
|
432
|
+
pass: existsSync(join(cwd, 'api', 'index.js')),
|
|
433
|
+
fix: 'Run pnpm run build:vercel locally — Vercel requires api/index.js as the serverless entry.',
|
|
170
434
|
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
435
|
+
// Route loader cache path checks (Wave 2 canonical layout)
|
|
436
|
+
const storageRoot = readStorageRoot(cwd);
|
|
437
|
+
const routesLoader = join(cwd, storageRoot, 'framework', 'cache', 'routes.loader.ts');
|
|
438
|
+
const staleRootStorageLoader = join(cwd, 'storage', 'framework', 'cache', 'routes.loader.ts');
|
|
439
|
+
if (storageRoot !== 'storage' && existsSync(staleRootStorageLoader)) {
|
|
440
|
+
checks.push({
|
|
441
|
+
label: 'no stale root storage/ cache (use configured storage root)',
|
|
442
|
+
pass: false,
|
|
443
|
+
fix: `Remove storage/framework/cache — lumis should write to ${storageRoot}/framework/cache only.`,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
const bootstrapRoutesLoader = join(cwd, 'bootstrap', 'cache', 'routes.loader.ts');
|
|
447
|
+
checks.push({
|
|
448
|
+
label: 'route loader cache path is canonical',
|
|
449
|
+
pass: !(existsSync(routesLoader) && existsSync(bootstrapRoutesLoader)),
|
|
450
|
+
fix: `Duplicate route cache detected. Keep only ${storageRoot}/framework/cache/routes.loader.ts and remove bootstrap/cache/routes.loader.ts`,
|
|
179
451
|
});
|
|
180
|
-
|
|
452
|
+
// Stale route loader warning
|
|
453
|
+
if (existsSync(routesLoader)) {
|
|
454
|
+
const loaderMtime = statSync(routesLoader).mtimeMs;
|
|
455
|
+
const routesRoot = join(cwd, 'src', 'modules');
|
|
456
|
+
let stale = false;
|
|
457
|
+
if (existsSync(routesRoot)) {
|
|
458
|
+
const stack = [routesRoot];
|
|
459
|
+
while (stack.length > 0) {
|
|
460
|
+
const dir = stack.pop();
|
|
461
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
462
|
+
if (entry.isDirectory()) {
|
|
463
|
+
stack.push(join(dir, entry.name));
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (/\/http\/routes\/.+\.(ts|js)$/.test(join(dir, entry.name))) {
|
|
467
|
+
if (statSync(join(dir, entry.name)).mtimeMs > loaderMtime) {
|
|
468
|
+
stale = true;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (stale)
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
checks.push({
|
|
478
|
+
label: 'route cache is fresh',
|
|
479
|
+
pass: !stale,
|
|
480
|
+
fix: 'Route files have changed since last cache. Run: lumis route:cache',
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
const warnings = checks.filter((c) => !c.pass);
|
|
484
|
+
if (warnings.length > 0) {
|
|
485
|
+
writeLine();
|
|
486
|
+
writeLine(ui.section('Health Pre-checks'));
|
|
487
|
+
for (const w of warnings) {
|
|
488
|
+
writeLine(` ${ui.warn(w.label)}`);
|
|
489
|
+
if (w.fix)
|
|
490
|
+
writeLine(` ${ui.dim(w.fix)}`);
|
|
491
|
+
}
|
|
492
|
+
writeLine();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function parsePort(args) {
|
|
496
|
+
const idx = args.findIndex((a) => a === '--port' || a === '-p');
|
|
497
|
+
const inline = args.find((a) => a.startsWith('--port='));
|
|
498
|
+
const raw = inline ? inline.split('=')[1] : idx !== -1 ? args[idx + 1] : undefined;
|
|
499
|
+
if (raw)
|
|
500
|
+
return parseInt(raw, 10);
|
|
501
|
+
return undefined;
|
|
502
|
+
}
|
|
503
|
+
function parseHost(args) {
|
|
504
|
+
const idx = args.findIndex((a) => a === '--host' || a === '-H');
|
|
505
|
+
const inline = args.find((a) => a.startsWith('--host='));
|
|
506
|
+
if (inline)
|
|
507
|
+
return inline.split('=')[1];
|
|
508
|
+
if (idx !== -1)
|
|
509
|
+
return args[idx + 1];
|
|
510
|
+
return undefined;
|
|
511
|
+
}
|
|
512
|
+
function parseTarget(args) {
|
|
513
|
+
const idx = args.findIndex((a) => a === '--target' || a === '--to' || a === '--t' || a === '-t');
|
|
514
|
+
const inline = args.find((a) => a.startsWith('--target=') || a.startsWith('--to=') || a.startsWith('--t='));
|
|
515
|
+
if (inline) {
|
|
516
|
+
const val = inline.slice(inline.indexOf('=') + 1);
|
|
517
|
+
if (val === 'node' || val === 'static' || val === 'cloudflare' || val === 'vercel')
|
|
518
|
+
return val;
|
|
519
|
+
}
|
|
520
|
+
if (idx !== -1) {
|
|
521
|
+
const val = args[idx + 1];
|
|
522
|
+
if (val === 'node' || val === 'static' || val === 'cloudflare' || val === 'vercel')
|
|
523
|
+
return val;
|
|
524
|
+
}
|
|
525
|
+
return undefined;
|
|
181
526
|
}
|
|
182
|
-
function
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
|
|
527
|
+
function parsePreviewTarget(args) {
|
|
528
|
+
const target = parseTarget(args);
|
|
529
|
+
if (target === 'vercel') {
|
|
530
|
+
writeError(ui.fail('`preview` does not support target "vercel". Use: lumis build --target vercel'));
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
return target;
|
|
534
|
+
}
|
|
535
|
+
function parseStringFlag(args, flag) {
|
|
536
|
+
const index = args.findIndex((value) => value === flag);
|
|
537
|
+
const inline = args.find((value) => value.startsWith(`${flag}=`));
|
|
538
|
+
if (inline) {
|
|
539
|
+
return inline.slice(flag.length + 1);
|
|
540
|
+
}
|
|
541
|
+
if (index !== -1) {
|
|
542
|
+
return args[index + 1];
|
|
186
543
|
}
|
|
187
|
-
return
|
|
544
|
+
return undefined;
|
|
188
545
|
}
|
|
189
|
-
|
|
190
|
-
|
|
546
|
+
function parseRepeatedFlag(args, flag) {
|
|
547
|
+
const values = [];
|
|
548
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
549
|
+
const token = args[index];
|
|
550
|
+
if (token === flag && args[index + 1]) {
|
|
551
|
+
values.push(args[index + 1]);
|
|
552
|
+
}
|
|
553
|
+
if (token?.startsWith(`${flag}=`)) {
|
|
554
|
+
values.push(token.slice(flag.length + 1));
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return values;
|
|
191
558
|
}
|
|
559
|
+
main().then((code) => process.exit(code));
|
|
192
560
|
//# sourceMappingURL=cli.js.map
|