@illumiarq/lumis 1.2.8 → 1.2.9
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/README.md +38 -0
- package/dist/adapter-loader.d.ts +67 -0
- package/dist/adapter-loader.d.ts.map +1 -0
- package/dist/adapter-loader.js +273 -0
- package/dist/adapter-loader.js.map +1 -0
- package/dist/cli.d.ts +16 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +173 -402
- package/dist/cli.js.map +1 -1
- package/dist/commands/commands.command.d.ts +38 -0
- package/dist/commands/commands.command.d.ts.map +1 -0
- package/dist/commands/commands.command.js +176 -0
- package/dist/commands/commands.command.js.map +1 -0
- package/dist/commands/doctor.command.d.ts +9 -0
- package/dist/commands/doctor.command.d.ts.map +1 -0
- package/dist/commands/doctor.command.js +640 -0
- package/dist/commands/doctor.command.js.map +1 -0
- package/dist/commands/init.command.d.ts +9 -0
- package/dist/commands/init.command.d.ts.map +1 -0
- package/dist/commands/init.command.js +121 -0
- package/dist/commands/init.command.js.map +1 -0
- package/dist/commands/intent.command.d.ts +26 -0
- package/dist/commands/intent.command.d.ts.map +1 -0
- package/dist/commands/intent.command.js +211 -0
- package/dist/commands/intent.command.js.map +1 -0
- package/dist/commands/ir-rebuild.command.d.ts +9 -0
- package/dist/commands/ir-rebuild.command.d.ts.map +1 -0
- package/dist/commands/ir-rebuild.command.js +36 -0
- package/dist/commands/ir-rebuild.command.js.map +1 -0
- package/dist/commands/ir-show.command.d.ts +9 -0
- package/dist/commands/ir-show.command.d.ts.map +1 -0
- package/dist/commands/ir-show.command.js +32 -0
- package/dist/commands/ir-show.command.js.map +1 -0
- package/dist/commands/make.command.d.ts +9 -0
- package/dist/commands/make.command.d.ts.map +1 -0
- package/dist/commands/make.command.js +93 -0
- package/dist/commands/make.command.js.map +1 -0
- package/dist/commands/pack.command.d.ts +16 -0
- package/dist/commands/pack.command.d.ts.map +1 -0
- package/dist/commands/pack.command.js +44 -0
- package/dist/commands/pack.command.js.map +1 -0
- package/dist/commands/runtime.command.d.ts +6 -0
- package/dist/commands/runtime.command.d.ts.map +1 -0
- package/dist/commands/runtime.command.js +379 -0
- package/dist/commands/runtime.command.js.map +1 -0
- package/dist/commands/runtime.d.ts +45 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +66 -0
- package/dist/commands/runtime.js.map +1 -0
- package/dist/commands/tinker-agent-plan.d.ts +26 -0
- package/dist/commands/tinker-agent-plan.d.ts.map +1 -0
- package/dist/commands/tinker-agent-plan.js +115 -0
- package/dist/commands/tinker-agent-plan.js.map +1 -0
- package/dist/commands/tinker-chat-commands.d.ts +19 -0
- package/dist/commands/tinker-chat-commands.d.ts.map +1 -0
- package/dist/commands/tinker-chat-commands.js +263 -0
- package/dist/commands/tinker-chat-commands.js.map +1 -0
- package/dist/commands/tinker-chat-runtime.d.ts +30 -0
- package/dist/commands/tinker-chat-runtime.d.ts.map +1 -0
- package/dist/commands/tinker-chat-runtime.js +227 -0
- package/dist/commands/tinker-chat-runtime.js.map +1 -0
- package/dist/commands/tinker-classic-mode.d.ts +15 -0
- package/dist/commands/tinker-classic-mode.d.ts.map +1 -0
- package/dist/commands/tinker-classic-mode.js +160 -0
- package/dist/commands/tinker-classic-mode.js.map +1 -0
- package/dist/commands/tinker-eval.command.d.ts +3 -0
- package/dist/commands/tinker-eval.command.d.ts.map +1 -0
- package/dist/commands/tinker-eval.command.js +151 -0
- package/dist/commands/tinker-eval.command.js.map +1 -0
- package/dist/commands/tinker-repl-display.d.ts +15 -0
- package/dist/commands/tinker-repl-display.d.ts.map +1 -0
- package/dist/commands/tinker-repl-display.js +147 -0
- package/dist/commands/tinker-repl-display.js.map +1 -0
- package/dist/commands/tinker-session-runtime.d.ts +27 -0
- package/dist/commands/tinker-session-runtime.d.ts.map +1 -0
- package/dist/commands/tinker-session-runtime.js +196 -0
- package/dist/commands/tinker-session-runtime.js.map +1 -0
- package/dist/commands/tinker.command.d.ts +9 -0
- package/dist/commands/tinker.command.d.ts.map +1 -0
- package/dist/commands/tinker.command.js +142 -0
- package/dist/commands/tinker.command.js.map +1 -0
- package/dist/commands/use.command.d.ts +10 -0
- package/dist/commands/use.command.d.ts.map +1 -0
- package/dist/commands/use.command.js +69 -0
- package/dist/commands/use.command.js.map +1 -0
- package/dist/config-loader.d.ts +68 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +81 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/index.d.ts +19 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +16 -0
- package/dist/launcher.d.ts.map +1 -0
- package/dist/launcher.js +301 -0
- package/dist/launcher.js.map +1 -0
- package/dist/lib/file-scanner.d.ts +8 -0
- package/dist/lib/file-scanner.d.ts.map +1 -0
- package/dist/lib/file-scanner.js +70 -0
- package/dist/lib/file-scanner.js.map +1 -0
- package/dist/lib/tinker-memory.d.ts +19 -0
- package/dist/lib/tinker-memory.d.ts.map +1 -0
- package/dist/lib/tinker-memory.js +107 -0
- package/dist/lib/tinker-memory.js.map +1 -0
- package/dist/lib/tinker-observer.d.ts +47 -0
- package/dist/lib/tinker-observer.d.ts.map +1 -0
- package/dist/lib/tinker-observer.js +77 -0
- package/dist/lib/tinker-observer.js.map +1 -0
- package/dist/lib/tinker-policy.d.ts +21 -0
- package/dist/lib/tinker-policy.d.ts.map +1 -0
- package/dist/lib/tinker-policy.js +102 -0
- package/dist/lib/tinker-policy.js.map +1 -0
- package/dist/lib/tinker-replay.d.ts +51 -0
- package/dist/lib/tinker-replay.d.ts.map +1 -0
- package/dist/lib/tinker-replay.js +123 -0
- package/dist/lib/tinker-replay.js.map +1 -0
- package/dist/{console.d.ts → output/ansi.d.ts} +4 -8
- package/dist/output/ansi.d.ts.map +1 -0
- package/dist/{console.js → output/ansi.js} +4 -12
- package/dist/output/ansi.js.map +1 -0
- package/dist/output/plan-display.d.ts +4 -0
- package/dist/output/plan-display.d.ts.map +1 -0
- package/dist/output/plan-display.js +49 -0
- package/dist/output/plan-display.js.map +1 -0
- package/dist/output/result-display.d.ts +5 -0
- package/dist/output/result-display.d.ts.map +1 -0
- package/dist/output/result-display.js +17 -0
- package/dist/output/result-display.js.map +1 -0
- package/dist/plugins/tinker-plugin.d.ts +86 -0
- package/dist/plugins/tinker-plugin.d.ts.map +1 -0
- package/dist/plugins/tinker-plugin.js +42 -0
- package/dist/plugins/tinker-plugin.js.map +1 -0
- package/dist/router-preferences.d.ts +5 -0
- package/dist/router-preferences.d.ts.map +1 -0
- package/dist/router-preferences.js +22 -0
- package/dist/router-preferences.js.map +1 -0
- package/dist/runtime/executor.d.ts +33 -0
- package/dist/runtime/executor.d.ts.map +1 -0
- package/dist/runtime/executor.js +180 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/orchestration.d.ts +43 -0
- package/dist/runtime/orchestration.d.ts.map +1 -0
- package/dist/runtime/orchestration.js +209 -0
- package/dist/runtime/orchestration.js.map +1 -0
- package/dist/runtime/policy.d.ts +23 -0
- package/dist/runtime/policy.d.ts.map +1 -0
- package/dist/runtime/policy.js +43 -0
- package/dist/runtime/policy.js.map +1 -0
- package/dist/runtime/profiles.d.ts +15 -0
- package/dist/runtime/profiles.d.ts.map +1 -0
- package/dist/runtime/profiles.js +131 -0
- package/dist/runtime/profiles.js.map +1 -0
- package/dist/runtime/transcripts.d.ts +59 -0
- package/dist/runtime/transcripts.d.ts.map +1 -0
- package/dist/runtime/transcripts.js +172 -0
- package/dist/runtime/transcripts.js.map +1 -0
- package/dist/tools/git-diff.d.ts +3 -0
- package/dist/tools/git-diff.d.ts.map +1 -0
- package/dist/tools/git-diff.js +16 -0
- package/dist/tools/git-diff.js.map +1 -0
- package/dist/tools/index.d.ts +24 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +88 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lint.d.ts +3 -0
- package/dist/tools/lint.d.ts.map +1 -0
- package/dist/tools/lint.js +35 -0
- package/dist/tools/lint.js.map +1 -0
- package/dist/tools/read-file.d.ts +3 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +47 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/run-command.d.ts +3 -0
- package/dist/tools/run-command.d.ts.map +1 -0
- package/dist/tools/run-command.js +71 -0
- package/dist/tools/run-command.js.map +1 -0
- package/dist/tools/run-tests.d.ts +3 -0
- package/dist/tools/run-tests.d.ts.map +1 -0
- package/dist/tools/run-tests.js +49 -0
- package/dist/tools/run-tests.js.map +1 -0
- package/dist/tools/tool-dispatch.d.ts +32 -0
- package/dist/tools/tool-dispatch.d.ts.map +1 -0
- package/dist/tools/tool-dispatch.js +120 -0
- package/dist/tools/tool-dispatch.js.map +1 -0
- package/dist/tools/typecheck.d.ts +3 -0
- package/dist/tools/typecheck.d.ts.map +1 -0
- package/dist/tools/typecheck.js +48 -0
- package/dist/tools/typecheck.js.map +1 -0
- package/dist/tools/types.d.ts +62 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +7 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/write-file.d.ts +15 -0
- package/dist/tools/write-file.d.ts.map +1 -0
- package/dist/tools/write-file.js +52 -0
- package/dist/tools/write-file.js.map +1 -0
- package/dist/tracing/types.d.ts +10 -0
- package/dist/tracing/types.d.ts.map +1 -0
- package/dist/tracing/types.js +2 -0
- package/dist/tracing/types.js.map +1 -0
- package/package.json +37 -19
- package/dist/bridges/project-bridge.d.ts +0 -2
- package/dist/bridges/project-bridge.d.ts.map +0 -1
- package/dist/bridges/project-bridge.js +0 -171
- package/dist/bridges/project-bridge.js.map +0 -1
- package/dist/commands/app/cache-workflows.d.ts +0 -7
- package/dist/commands/app/cache-workflows.d.ts.map +0 -1
- package/dist/commands/app/cache-workflows.js +0 -139
- package/dist/commands/app/cache-workflows.js.map +0 -1
- package/dist/commands/app/command-runtime.d.ts +0 -11
- package/dist/commands/app/command-runtime.d.ts.map +0 -1
- package/dist/commands/app/command-runtime.js +0 -41
- package/dist/commands/app/command-runtime.js.map +0 -1
- package/dist/commands/app/config-cache.d.ts +0 -3
- package/dist/commands/app/config-cache.d.ts.map +0 -1
- package/dist/commands/app/config-cache.js +0 -75
- package/dist/commands/app/config-cache.js.map +0 -1
- package/dist/commands/app/config-publish.d.ts +0 -2
- package/dist/commands/app/config-publish.d.ts.map +0 -1
- package/dist/commands/app/config-publish.js +0 -68
- package/dist/commands/app/config-publish.js.map +0 -1
- package/dist/commands/app/config-stubs.d.ts +0 -3
- package/dist/commands/app/config-stubs.d.ts.map +0 -1
- package/dist/commands/app/config-stubs.js +0 -154
- package/dist/commands/app/config-stubs.js.map +0 -1
- package/dist/commands/app/database.d.ts +0 -3
- package/dist/commands/app/database.d.ts.map +0 -1
- package/dist/commands/app/database.js +0 -221
- package/dist/commands/app/database.js.map +0 -1
- package/dist/commands/app/docs.d.ts +0 -7
- package/dist/commands/app/docs.d.ts.map +0 -1
- package/dist/commands/app/docs.js +0 -61
- package/dist/commands/app/docs.js.map +0 -1
- package/dist/commands/app/routes.d.ts +0 -5
- package/dist/commands/app/routes.d.ts.map +0 -1
- package/dist/commands/app/routes.js +0 -95
- package/dist/commands/app/routes.js.map +0 -1
- package/dist/commands/app/security.d.ts +0 -3
- package/dist/commands/app/security.d.ts.map +0 -1
- package/dist/commands/app/security.js +0 -15
- package/dist/commands/app/security.js.map +0 -1
- package/dist/commands/app/worker-schedule.d.ts +0 -5
- package/dist/commands/app/worker-schedule.d.ts.map +0 -1
- package/dist/commands/app/worker-schedule.js +0 -94
- package/dist/commands/app/worker-schedule.js.map +0 -1
- package/dist/commands/app-commands.d.ts +0 -19
- package/dist/commands/app-commands.d.ts.map +0 -1
- package/dist/commands/app-commands.js +0 -77
- package/dist/commands/app-commands.js.map +0 -1
- package/dist/commands/build-vercel-fn.d.ts +0 -9
- package/dist/commands/build-vercel-fn.d.ts.map +0 -1
- package/dist/commands/build-vercel-fn.js +0 -32
- package/dist/commands/build-vercel-fn.js.map +0 -1
- package/dist/commands/build.d.ts +0 -14
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -24
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/info.d.ts +0 -2
- package/dist/commands/info.d.ts.map +0 -1
- package/dist/commands/info.js +0 -25
- package/dist/commands/info.js.map +0 -1
- package/dist/commands/keys.d.ts +0 -3
- package/dist/commands/keys.d.ts.map +0 -1
- package/dist/commands/keys.js +0 -60
- package/dist/commands/keys.js.map +0 -1
- package/dist/commands/maintenance.d.ts +0 -9
- package/dist/commands/maintenance.d.ts.map +0 -1
- package/dist/commands/maintenance.js +0 -38
- package/dist/commands/maintenance.js.map +0 -1
- package/dist/commands/module-list.d.ts +0 -2
- package/dist/commands/module-list.d.ts.map +0 -1
- package/dist/commands/module-list.js +0 -27
- package/dist/commands/module-list.js.map +0 -1
- package/dist/commands/preview.d.ts +0 -14
- package/dist/commands/preview.d.ts.map +0 -1
- package/dist/commands/preview.js +0 -49
- package/dist/commands/preview.js.map +0 -1
- package/dist/commands/serve.d.ts +0 -16
- package/dist/commands/serve.d.ts.map +0 -1
- package/dist/commands/serve.js +0 -61
- package/dist/commands/serve.js.map +0 -1
- package/dist/console.d.ts.map +0 -1
- package/dist/console.js.map +0 -1
- package/dist/paths.d.ts +0 -21
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -47
- package/dist/paths.js.map +0 -1
- package/dist/server-wrapper.d.ts +0 -12
- package/dist/server-wrapper.d.ts.map +0 -1
- package/dist/server-wrapper.js +0 -63
- package/dist/server-wrapper.js.map +0 -1
- package/dist/vercel-wrapper.d.ts +0 -6
- package/dist/vercel-wrapper.d.ts.map +0 -1
- package/dist/vercel-wrapper.js +0 -50
- package/dist/vercel-wrapper.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,421 +1,192 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Host CLI entrypoint and command dispatcher.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Commands are declared in a registry and resolved by longest prefix match,
|
|
5
|
+
* enabling subcommands with free-form trailing arguments (e.g. `intent <text>`).
|
|
7
6
|
*/
|
|
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
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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 === 'module:list') {
|
|
57
|
-
return listModules();
|
|
58
|
-
}
|
|
59
|
-
if (cmd === 'key:generate') {
|
|
60
|
-
return generateKeys();
|
|
61
|
-
}
|
|
62
|
-
if (cmd === 'key:rotate') {
|
|
63
|
-
return rotateKeys();
|
|
64
|
-
}
|
|
65
|
-
if (cmd === 'config:show') {
|
|
66
|
-
const configName = argv[1];
|
|
67
|
-
if (!configName) {
|
|
68
|
-
writeError(ui.fail('Usage: lumis config:show <name> [--json]'));
|
|
69
|
-
return 1;
|
|
70
|
-
}
|
|
71
|
-
return showResolvedConfig(configName);
|
|
72
|
-
}
|
|
73
|
-
if (cmd === 'config:cache') {
|
|
74
|
-
return cacheConfig();
|
|
75
|
-
}
|
|
76
|
-
if (cmd === 'config:clear') {
|
|
77
|
-
return clearConfigCache();
|
|
78
|
-
}
|
|
79
|
-
if (cmd?.startsWith('db:')) {
|
|
80
|
-
return await runDatabaseCommand(cmd, argv.slice(1));
|
|
81
|
-
}
|
|
82
|
-
if (cmd === 'route:list') {
|
|
83
|
-
return listRoutes();
|
|
84
|
-
}
|
|
85
|
-
if (cmd === 'route:check') {
|
|
86
|
-
return checkRoutes();
|
|
87
|
-
}
|
|
88
|
-
if (cmd === 'route:cache') {
|
|
89
|
-
return cacheRoutes();
|
|
90
|
-
}
|
|
91
|
-
if (cmd === 'route:clear') {
|
|
92
|
-
return clearRouteCache();
|
|
93
|
-
}
|
|
94
|
-
if (cmd === 'view:cache') {
|
|
95
|
-
return cacheViews();
|
|
96
|
-
}
|
|
97
|
-
if (cmd === 'view:clear') {
|
|
98
|
-
return clearViews();
|
|
99
|
-
}
|
|
100
|
-
if (cmd === 'search:index') {
|
|
101
|
-
return cacheSearchIndex();
|
|
102
|
-
}
|
|
103
|
-
if (cmd === 'search:clear') {
|
|
104
|
-
return clearSearchIndex();
|
|
105
|
-
}
|
|
106
|
-
if (cmd === 'optimize') {
|
|
107
|
-
return optimizeForProduction();
|
|
108
|
-
}
|
|
109
|
-
if (cmd === 'optimize:clear') {
|
|
110
|
-
return clearOptimizationCaches();
|
|
111
|
-
}
|
|
112
|
-
if (cmd === 'down') {
|
|
113
|
-
const message = parseStringFlag(argv, '--message');
|
|
114
|
-
const secret = parseStringFlag(argv, '--secret');
|
|
115
|
-
const allowedIps = parseRepeatedFlag(argv, '--allow');
|
|
116
|
-
return enableMaintenanceMode({
|
|
117
|
-
...(message ? { message } : {}),
|
|
118
|
-
...(secret ? { secret } : {}),
|
|
119
|
-
...(allowedIps.length > 0 ? { allowedIps } : {}),
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
if (cmd === 'up') {
|
|
123
|
-
return disableMaintenanceMode();
|
|
124
|
-
}
|
|
125
|
-
if (cmd === 'stub:publish') {
|
|
126
|
-
return publishStubs({ all: argv.includes('--all'), iam: argv.includes('--iam') });
|
|
127
|
-
}
|
|
128
|
-
if (cmd === 'auth:install') {
|
|
129
|
-
const uiFramework = parseStringFlag(argv, '--ui');
|
|
130
|
-
return installAuth({
|
|
131
|
-
iam: argv.includes('--iam'),
|
|
132
|
-
...(uiFramework ? { ui: uiFramework } : {}),
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (cmd === 'publish') {
|
|
136
|
-
const subCmd = argv[1];
|
|
137
|
-
if (subCmd === 'config') {
|
|
138
|
-
const configName = argv[2] ?? 'list';
|
|
139
|
-
return publishConfig(configName, argv.includes('--force'));
|
|
140
|
-
}
|
|
141
|
-
if (subCmd === 'stub' || subCmd === 'stubs') {
|
|
142
|
-
return publishStubs({ all: argv.includes('--all'), iam: argv.includes('--iam') });
|
|
143
|
-
}
|
|
144
|
-
writeError(ui.fail(`Unknown publish subcommand: "${subCmd}". Try: publish config <name>`));
|
|
145
|
-
return 1;
|
|
146
|
-
}
|
|
147
|
-
if (cmd === 'worker:start') {
|
|
148
|
-
return workerStart(argv.includes('--dev'));
|
|
149
|
-
}
|
|
150
|
-
if (cmd === 'worker:list') {
|
|
151
|
-
return workerList();
|
|
152
|
-
}
|
|
153
|
-
if (cmd === 'schedule:list') {
|
|
154
|
-
return scheduleList();
|
|
155
|
-
}
|
|
156
|
-
if (cmd === 'schedule:run') {
|
|
157
|
-
return scheduleRun(argv[1] ?? '');
|
|
158
|
-
}
|
|
159
|
-
const projectCommandExit = await runProjectCommandDirect(argv);
|
|
160
|
-
if (projectCommandExit !== null) {
|
|
161
|
-
return projectCommandExit;
|
|
7
|
+
import { executeIntentCommand } from './commands/intent.command.js';
|
|
8
|
+
import { executeIrRebuildCommand } from './commands/ir-rebuild.command.js';
|
|
9
|
+
import { executeIrShowCommand } from './commands/ir-show.command.js';
|
|
10
|
+
import { executeMakeCommand } from './commands/make.command.js';
|
|
11
|
+
import { executeCommandsListCommand, executeCommandsRunCommand } from './commands/commands.command.js';
|
|
12
|
+
import { executeDoctorCommand } from './commands/doctor.command.js';
|
|
13
|
+
import { executeInitCommand } from './commands/init.command.js';
|
|
14
|
+
import { executeUseCommand } from './commands/use.command.js';
|
|
15
|
+
import { ansi } from './output/ansi.js';
|
|
16
|
+
import { executePackDetectCommand, executePackListCommand } from './commands/pack.command.js';
|
|
17
|
+
import { executeRuntimeRunCommand, executeRuntimeTranscriptsListCommand, executeRuntimeTranscriptsPruneCommand, executeRuntimeTranscriptsShowCommand, } from './commands/runtime.command.js';
|
|
18
|
+
import { createCommandContext } from './commands/runtime.js';
|
|
19
|
+
import { executeTinkerCommand } from './commands/tinker.command.js';
|
|
20
|
+
import { executeTinkerEvalCommand } from './commands/tinker-eval.command.js';
|
|
21
|
+
import { runInteractiveLauncher } from './launcher.js';
|
|
22
|
+
import { pathToFileURL } from 'node:url';
|
|
23
|
+
const COMMANDS = [
|
|
24
|
+
{ path: ['use'], description: 'Set preferred AI runtime', handler: executeUseCommand },
|
|
25
|
+
{ path: ['pack', 'list'], description: 'List built-in packs', handler: executePackListCommand },
|
|
26
|
+
{ path: ['pack', 'detect'], description: 'Detect best pack for project', handler: executePackDetectCommand },
|
|
27
|
+
{ path: ['commands', 'list'], description: 'List pack and project commands', handler: executeCommandsListCommand },
|
|
28
|
+
{ path: ['commands', 'run'], description: 'Run a pack or project command', handler: executeCommandsRunCommand },
|
|
29
|
+
{ path: ['doctor'], description: 'Run Lumis diagnostics for this project', handler: executeDoctorCommand },
|
|
30
|
+
{ path: ['init'], description: 'Initialize Lumis in this project', handler: executeInitCommand },
|
|
31
|
+
{ path: ['make'], description: 'Create artifacts from intent', handler: executeMakeCommand },
|
|
32
|
+
{ path: ['intent'], description: 'Parse and inspect intent', handler: executeIntentCommand },
|
|
33
|
+
{ path: ['ir', 'show'], description: 'Show current IR', handler: executeIrShowCommand },
|
|
34
|
+
{ path: ['ir', 'rebuild'], description: 'Rebuild project IR', handler: executeIrRebuildCommand },
|
|
35
|
+
{ path: ['runtime', 'run'], description: 'Run runtime profile tasks', handler: executeRuntimeRunCommand },
|
|
36
|
+
{ path: ['runtime', 'transcripts', 'list'], description: 'List runtime transcripts', handler: executeRuntimeTranscriptsListCommand },
|
|
37
|
+
{ path: ['runtime', 'transcripts', 'show'], description: 'Show runtime transcript details', handler: executeRuntimeTranscriptsShowCommand },
|
|
38
|
+
{ path: ['runtime', 'transcripts', 'prune'], description: 'Prune runtime transcripts', handler: executeRuntimeTranscriptsPruneCommand },
|
|
39
|
+
{ path: ['tinker', 'eval'], description: 'Run Tinker evaluation harness', handler: executeTinkerEvalCommand },
|
|
40
|
+
{ path: ['tinker'], description: 'Run interactive tinker mode', handler: executeTinkerCommand },
|
|
41
|
+
];
|
|
42
|
+
function createTraceListener() {
|
|
43
|
+
if (process.env.LUMIS_TRACE !== '1') {
|
|
44
|
+
return undefined;
|
|
162
45
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
46
|
+
return async (event) => {
|
|
47
|
+
const payload = {
|
|
48
|
+
type: event.type,
|
|
49
|
+
name: event.name,
|
|
50
|
+
status: event.status,
|
|
51
|
+
...(event.message ? { message: event.message } : {}),
|
|
52
|
+
...(event.context ? { context: event.context } : {}),
|
|
53
|
+
};
|
|
54
|
+
process.stderr.write(`[lumis-trace] ${JSON.stringify(payload)}\n`);
|
|
55
|
+
};
|
|
166
56
|
}
|
|
167
|
-
async function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return runCli(['--help']);
|
|
57
|
+
async function emitTrace(onTrace, event) {
|
|
58
|
+
if (!onTrace)
|
|
59
|
+
return;
|
|
60
|
+
await onTrace(event);
|
|
172
61
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
writeLine(' lumis info');
|
|
186
|
-
writeLine(' lumis health');
|
|
187
|
-
writeLine(' lumis module:list');
|
|
188
|
-
writeLine(' lumis config:show <name>');
|
|
189
|
-
writeLine(' lumis config:cache | config:clear');
|
|
190
|
-
writeLine(' lumis route:list | route:check | route:cache | route:clear');
|
|
191
|
-
writeLine(' lumis view:cache | view:clear');
|
|
192
|
-
writeLine(' lumis search:index | search:clear');
|
|
193
|
-
writeLine(' lumis optimize | optimize:clear');
|
|
194
|
-
writeLine(' lumis key:generate | key:rotate');
|
|
195
|
-
writeLine(' lumis down [--message <text>] [--secret <token>] [--allow <ip>]');
|
|
196
|
-
writeLine(' lumis up');
|
|
197
|
-
writeLine(' lumis auth:install [--iam] [--ui react]');
|
|
198
|
-
writeLine(' lumis stub:publish [--all|--iam]');
|
|
199
|
-
writeLine();
|
|
200
|
-
writeLine(` ${ui.bold('Database')}`);
|
|
201
|
-
writeLine(' lumis db:generate | db:migrate');
|
|
202
|
-
writeLine(' lumis db:ping — verify DB connection and diagnose failures');
|
|
203
|
-
writeLine(' lumis db:seed');
|
|
204
|
-
writeLine(' lumis db:fresh — migrate + seed (destructive)');
|
|
205
|
-
writeLine(' lumis db:reset — drop all tables + migrate');
|
|
206
|
-
writeLine(' lumis db:studio — open drizzle-kit studio');
|
|
207
|
-
writeLine();
|
|
208
|
-
writeLine(` ${ui.bold('Config')}`);
|
|
209
|
-
writeLine(' lumis publish config <name> — mail | queue | cache | storage | session | security | logging | auth');
|
|
210
|
-
writeLine(' lumis publish config all — publish every config file');
|
|
211
|
-
writeLine(' lumis publish config list — show available configs');
|
|
212
|
-
writeLine();
|
|
213
|
-
writeLine(` ${ui.bold('Workers & Scheduling')}`);
|
|
214
|
-
writeLine(' lumis worker:start [--dev] — start background worker process');
|
|
215
|
-
writeLine(' lumis worker:list — list registered workers + scheduled jobs');
|
|
216
|
-
writeLine(' lumis schedule:list — list all cron jobs');
|
|
217
|
-
writeLine(' lumis schedule:run <name> — run a specific cron job immediately');
|
|
218
|
-
writeLine();
|
|
219
|
-
writeLine(` ${ui.bold('Core Lumis')}`);
|
|
220
|
-
writeLine(' lumis doctor | init | make | intent | ir:* | runtime:* | tinker');
|
|
221
|
-
writeLine();
|
|
222
|
-
writeLine(` ${ui.bold('Project Commands')}`);
|
|
223
|
-
writeLine(' lumis <your:command> — run projectCommands entries directly');
|
|
224
|
-
writeLine(' lumis commands run project <name>');
|
|
225
|
-
writeLine();
|
|
62
|
+
function formatUsage() {
|
|
63
|
+
const lines = [
|
|
64
|
+
ansi.label('Core CLI'),
|
|
65
|
+
` ${ansi.dim('Prompt -> Plan -> Confirm -> Execute -> Verified Result')}`,
|
|
66
|
+
'',
|
|
67
|
+
`${ansi.bold('Usage')}:`,
|
|
68
|
+
` ${ansi.cyan('lumis --help')}`,
|
|
69
|
+
];
|
|
70
|
+
for (const command of COMMANDS) {
|
|
71
|
+
lines.push(` ${ansi.cyan(`lumis ${command.path.join(' ')}`)} ${ansi.dim(`# ${command.description}`)}`);
|
|
72
|
+
}
|
|
73
|
+
return `${lines.join('\n')}\n`;
|
|
226
74
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
const { runCli } = await import('@lumiarq/lumis');
|
|
248
|
-
let stdout = '';
|
|
249
|
-
let stderr = '';
|
|
250
|
-
const listExit = await runCli(['commands', 'list', '--json'], {
|
|
251
|
-
write: (chunk) => {
|
|
252
|
-
stdout += chunk;
|
|
253
|
-
},
|
|
254
|
-
writeError: (chunk) => {
|
|
255
|
-
stderr += chunk;
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
if (listExit !== 0 || stderr.trim().length > 0) {
|
|
259
|
-
return null;
|
|
260
|
-
}
|
|
261
|
-
let commands = [];
|
|
262
|
-
try {
|
|
263
|
-
commands = JSON.parse(stdout);
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
const exists = commands.some((entry) => entry.source === 'project' && entry.name === candidate);
|
|
269
|
-
if (!exists) {
|
|
75
|
+
/**
|
|
76
|
+
* Resolve command using longest prefix semantics.
|
|
77
|
+
*
|
|
78
|
+
* Example:
|
|
79
|
+
* - argv: ['intent', 'create', 'record']
|
|
80
|
+
* - match: ['intent'] with args ['create', 'record']
|
|
81
|
+
*
|
|
82
|
+
* @param argv - Raw command tokens after the executable name.
|
|
83
|
+
* @returns Matched command and trailing arguments, or null when no command matches.
|
|
84
|
+
*/
|
|
85
|
+
function matchCommand(argv) {
|
|
86
|
+
const matches = COMMANDS.filter((command) => {
|
|
87
|
+
if (command.path.length > argv.length) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return command.path.every((segment, index) => segment === argv[index]);
|
|
91
|
+
}).sort((left, right) => right.path.length - left.path.length);
|
|
92
|
+
const command = matches[0];
|
|
93
|
+
if (!command) {
|
|
270
94
|
return null;
|
|
271
95
|
}
|
|
272
|
-
return
|
|
96
|
+
return {
|
|
97
|
+
command,
|
|
98
|
+
args: argv.slice(command.path.length),
|
|
99
|
+
};
|
|
273
100
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Execute the host CLI command flow.
|
|
103
|
+
*
|
|
104
|
+
* @param argv - CLI arguments excluding the node/script prefix.
|
|
105
|
+
* @param options - Optional execution overrides for project root and output writers.
|
|
106
|
+
* @returns Exit code (0 success, non-zero failure).
|
|
107
|
+
*/
|
|
108
|
+
export async function runCli(argv, options = {}) {
|
|
109
|
+
const write = options.write ?? ((message) => process.stdout.write(message));
|
|
110
|
+
const writeError = options.writeError ?? ((message) => process.stderr.write(message));
|
|
111
|
+
const onTrace = createTraceListener();
|
|
112
|
+
const stdin = options.stdin ?? process.stdin;
|
|
113
|
+
const stdout = options.stdout ?? process.stdout;
|
|
114
|
+
const interactiveMode = options.interactiveMode ?? 'auto';
|
|
115
|
+
const shouldRunInteractiveMenu = argv.length === 0 &&
|
|
116
|
+
!argv.includes('--help') &&
|
|
117
|
+
(interactiveMode === 'on' ||
|
|
118
|
+
(interactiveMode === 'auto' && process.env.CI !== 'true' && process.env.LUMIS_NO_TUI !== '1' && stdin.isTTY && stdout.isTTY));
|
|
119
|
+
if (shouldRunInteractiveMenu) {
|
|
120
|
+
await emitTrace(onTrace, {
|
|
121
|
+
type: 'command-dispatch',
|
|
122
|
+
status: 'start',
|
|
123
|
+
name: 'interactive-launcher',
|
|
124
|
+
context: { mode: interactiveMode },
|
|
125
|
+
});
|
|
126
|
+
const launcherResult = await runInteractiveLauncher({
|
|
127
|
+
projectRoot: options.projectRoot ?? process.cwd(),
|
|
128
|
+
write,
|
|
129
|
+
stdin,
|
|
130
|
+
stdout,
|
|
131
|
+
});
|
|
132
|
+
if (launcherResult.kind === 'exit') {
|
|
133
|
+
await emitTrace(onTrace, {
|
|
134
|
+
type: 'command-dispatch',
|
|
135
|
+
status: launcherResult.code === 0 ? 'success' : 'failure',
|
|
136
|
+
name: 'interactive-launcher',
|
|
137
|
+
context: { exitCode: launcherResult.code },
|
|
309
138
|
});
|
|
139
|
+
return launcherResult.code;
|
|
310
140
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const stack = [routesRoot];
|
|
320
|
-
while (stack.length > 0) {
|
|
321
|
-
const dir = stack.pop();
|
|
322
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
323
|
-
if (entry.isDirectory()) {
|
|
324
|
-
stack.push(join(dir, entry.name));
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
if (/\/http\/routes\/.+\.(ts|js)$/.test(join(dir, entry.name))) {
|
|
328
|
-
if (statSync(join(dir, entry.name)).mtimeMs > loaderMtime) {
|
|
329
|
-
stale = true;
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (stale)
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
checks.push({
|
|
339
|
-
label: 'route cache is fresh',
|
|
340
|
-
pass: !stale,
|
|
341
|
-
fix: 'Route files have changed since last cache. Run: lumis route:cache',
|
|
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 },
|
|
342
149
|
});
|
|
150
|
+
write(formatUsage());
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
const matched = matchCommand(argv);
|
|
154
|
+
if (!matched) {
|
|
155
|
+
await emitTrace(onTrace, {
|
|
156
|
+
type: 'command-dispatch',
|
|
157
|
+
status: 'failure',
|
|
158
|
+
name: 'unknown-command',
|
|
159
|
+
message: argv.join(' '),
|
|
160
|
+
});
|
|
161
|
+
writeError(`${ansi.fail(`Unknown command: ${argv.join(' ')}`)}\n`);
|
|
162
|
+
write(formatUsage());
|
|
163
|
+
return 1;
|
|
343
164
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (raw)
|
|
361
|
-
return parseInt(raw, 10);
|
|
362
|
-
return undefined;
|
|
363
|
-
}
|
|
364
|
-
function parseHost(args) {
|
|
365
|
-
const idx = args.findIndex((a) => a === '--host' || a === '-H');
|
|
366
|
-
const inline = args.find((a) => a.startsWith('--host='));
|
|
367
|
-
if (inline)
|
|
368
|
-
return inline.split('=')[1];
|
|
369
|
-
if (idx !== -1)
|
|
370
|
-
return args[idx + 1];
|
|
371
|
-
return undefined;
|
|
372
|
-
}
|
|
373
|
-
function parseTarget(args) {
|
|
374
|
-
const idx = args.findIndex((a) => a === '--target' || a === '--to' || a === '--t' || a === '-t');
|
|
375
|
-
const inline = args.find((a) => a.startsWith('--target=') || a.startsWith('--to=') || a.startsWith('--t='));
|
|
376
|
-
if (inline) {
|
|
377
|
-
const val = inline.slice(inline.indexOf('=') + 1);
|
|
378
|
-
if (val === 'node' || val === 'static' || val === 'cloudflare' || val === 'vercel')
|
|
379
|
-
return val;
|
|
380
|
-
}
|
|
381
|
-
if (idx !== -1) {
|
|
382
|
-
const val = args[idx + 1];
|
|
383
|
-
if (val === 'node' || val === 'static' || val === 'cloudflare' || val === 'vercel')
|
|
384
|
-
return val;
|
|
385
|
-
}
|
|
386
|
-
return undefined;
|
|
387
|
-
}
|
|
388
|
-
function parsePreviewTarget(args) {
|
|
389
|
-
const target = parseTarget(args);
|
|
390
|
-
if (target === 'vercel') {
|
|
391
|
-
writeError(ui.fail('`preview` does not support target "vercel". Use: lumis build --target vercel'));
|
|
392
|
-
return undefined;
|
|
393
|
-
}
|
|
394
|
-
return target;
|
|
165
|
+
await emitTrace(onTrace, {
|
|
166
|
+
type: 'command-dispatch',
|
|
167
|
+
status: 'start',
|
|
168
|
+
name: matched.command.path.join(' '),
|
|
169
|
+
context: { args: matched.args },
|
|
170
|
+
});
|
|
171
|
+
const context = await createCommandContext({
|
|
172
|
+
argv,
|
|
173
|
+
commandPath: matched.command.path,
|
|
174
|
+
commandArgs: matched.args,
|
|
175
|
+
projectRoot: options.projectRoot ?? process.cwd(),
|
|
176
|
+
write,
|
|
177
|
+
writeError,
|
|
178
|
+
...(onTrace ? { onTrace } : {}),
|
|
179
|
+
});
|
|
180
|
+
return matched.command.handler(context);
|
|
395
181
|
}
|
|
396
|
-
function
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return inline.slice(flag.length + 1);
|
|
401
|
-
}
|
|
402
|
-
if (index !== -1) {
|
|
403
|
-
return args[index + 1];
|
|
182
|
+
function isMainModule() {
|
|
183
|
+
const argv1 = process.argv[1];
|
|
184
|
+
if (!argv1) {
|
|
185
|
+
return false;
|
|
404
186
|
}
|
|
405
|
-
return
|
|
187
|
+
return import.meta.url === pathToFileURL(argv1).href;
|
|
406
188
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
410
|
-
const token = args[index];
|
|
411
|
-
if (token === flag && args[index + 1]) {
|
|
412
|
-
values.push(args[index + 1]);
|
|
413
|
-
}
|
|
414
|
-
if (token?.startsWith(`${flag}=`)) {
|
|
415
|
-
values.push(token.slice(flag.length + 1));
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
return values;
|
|
189
|
+
if (isMainModule()) {
|
|
190
|
+
void runCli(process.argv.slice(2));
|
|
419
191
|
}
|
|
420
|
-
main().then((code) => process.exit(code));
|
|
421
192
|
//# sourceMappingURL=cli.js.map
|