@illumiarq/lumis 1.2.7 → 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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime selection command.
|
|
3
|
+
*
|
|
4
|
+
* Sets the preferred AI runtime (ollama, anthropic, claude-code, copilot, etc.)
|
|
5
|
+
* in the Lumis config file for future commands.
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
export const SUPPORTED_RUNTIMES = [
|
|
10
|
+
'ollama',
|
|
11
|
+
'anthropic',
|
|
12
|
+
'openai',
|
|
13
|
+
'openrouter',
|
|
14
|
+
'groq',
|
|
15
|
+
'deepseek',
|
|
16
|
+
'mistral',
|
|
17
|
+
'gemini',
|
|
18
|
+
'claude-code',
|
|
19
|
+
'copilot',
|
|
20
|
+
'local',
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Execute the use command to select preferred runtime.
|
|
24
|
+
*
|
|
25
|
+
* @param context - Shared command runtime context.
|
|
26
|
+
* @returns Exit code (0 success, 1 on validation/write errors).
|
|
27
|
+
*/
|
|
28
|
+
export async function executeUseCommand(context) {
|
|
29
|
+
if (context.commandArgs.length === 0) {
|
|
30
|
+
context.writeError('Missing runtime name.\n');
|
|
31
|
+
context.write(`Usage: lumis use <runtime>\n`);
|
|
32
|
+
context.write(`Supported runtimes: ${SUPPORTED_RUNTIMES.join(', ')}\n`);
|
|
33
|
+
context.write(`Example: lumis use claude-code\n`);
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
const requestedRuntime = context.commandArgs[0].toLowerCase();
|
|
37
|
+
if (!SUPPORTED_RUNTIMES.includes(requestedRuntime)) {
|
|
38
|
+
context.writeError(`Unknown runtime: ${requestedRuntime}\n`);
|
|
39
|
+
context.write(`Supported runtimes: ${SUPPORTED_RUNTIMES.join(', ')}\n`);
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
let config = {};
|
|
43
|
+
const configPath = path.join(context.projectRoot, 'lumis.config.json');
|
|
44
|
+
// Load or create config
|
|
45
|
+
if (fs.existsSync(configPath)) {
|
|
46
|
+
try {
|
|
47
|
+
const raw = fs.readFileSync(configPath, 'utf8');
|
|
48
|
+
config = JSON.parse(raw);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
context.writeError(`Failed to read config: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Update config with new runtime preference
|
|
56
|
+
config.preferredRuntime = requestedRuntime;
|
|
57
|
+
// Write back to config file
|
|
58
|
+
try {
|
|
59
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
|
|
60
|
+
context.write(`✔ Set preferred runtime to: ${requestedRuntime}\n`);
|
|
61
|
+
context.write(`Config saved to: ${configPath}\n`);
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
context.writeError(`Failed to write config: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=use.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.command.js","sourceRoot":"","sources":["../../src/commands/use.command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,QAAQ;IACR,aAAa;IACb,SAAS;IACT,OAAO;CACP,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAuB;IAC9D,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAA;QAC7C,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC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,IAAI,CAAC;QACJ,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACrE,OAAO,CAAC,KAAK,CAAC,+BAA+B,gBAAgB,IAAI,CAAC,CAAA;QAClE,OAAO,CAAC,KAAK,CAAC,oBAAoB,UAAU,IAAI,CAAC,CAAA;QACjD,OAAO,CAAC,CAAA;IACT,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,UAAU,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACzG,OAAO,CAAC,CAAA;IACT,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { LumisTraceListener } from './tracing/types.js';
|
|
2
|
+
export type LumisConfig = {
|
|
3
|
+
adapter?: string;
|
|
4
|
+
preferredRuntime?: string;
|
|
5
|
+
routing?: {
|
|
6
|
+
nextjs?: {
|
|
7
|
+
router?: 'app' | 'pages';
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
projectCommands?: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
command: string;
|
|
14
|
+
}>;
|
|
15
|
+
context?: {
|
|
16
|
+
include?: string[];
|
|
17
|
+
exclude?: string[];
|
|
18
|
+
};
|
|
19
|
+
ai?: {
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
provider?: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
mode?: 'manual' | 'auto';
|
|
24
|
+
defaultModel?: string;
|
|
25
|
+
taskModels?: {
|
|
26
|
+
intentParse?: string;
|
|
27
|
+
planPropose?: string;
|
|
28
|
+
tokenSuggest?: string;
|
|
29
|
+
templateVariant?: string;
|
|
30
|
+
};
|
|
31
|
+
systemPromptExtra?: string;
|
|
32
|
+
};
|
|
33
|
+
runtime?: {
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
profileId?: string;
|
|
36
|
+
postMakeTasks?: Array<'typecheck' | 'lint' | 'boundaryCheck' | 'build' | 'test'>;
|
|
37
|
+
taskCommandOverrides?: Partial<Record<'typecheck' | 'lint' | 'boundaryCheck' | 'build' | 'test', string>>;
|
|
38
|
+
failOnTaskError?: boolean;
|
|
39
|
+
policy?: {
|
|
40
|
+
mode?: 'strict' | 'advisory';
|
|
41
|
+
requireApprovalForRemote?: boolean;
|
|
42
|
+
approvalEnvVar?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
presetPrompts?: Array<{
|
|
46
|
+
label: string;
|
|
47
|
+
prompt: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
type LoadLumisConfigOptions = {
|
|
51
|
+
onTrace?: LumisTraceListener;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Load `lumis.config.ts` from project root when present.
|
|
55
|
+
*
|
|
56
|
+
* @param projectRoot - Absolute path of the target project.
|
|
57
|
+
* @returns Parsed Lumis config object, or empty defaults when config is absent.
|
|
58
|
+
*/
|
|
59
|
+
export declare function loadLumisConfig(projectRoot: string, options?: LoadLumisConfigOptions): Promise<LumisConfig>;
|
|
60
|
+
/**
|
|
61
|
+
* Save `lumis.config.json` at project root.
|
|
62
|
+
*
|
|
63
|
+
* @param projectRoot - Absolute path of the target project.
|
|
64
|
+
* @param config - Lumis configuration to persist.
|
|
65
|
+
*/
|
|
66
|
+
export declare function saveLumisConfig(projectRoot: string, config: LumisConfig): void;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,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AAM,EAAE,MAAM,CAAC,CAAC,CAAA;QACzG,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB,MAAM,CAAC,EAAE;YACR,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;YAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAA;YAClC,cAAc,CAAC,EAAE,MAAM,CAAA;SACvB,CAAA;KACD,CAAA;IACD,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACxD,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC7B,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAOD;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAsDrH;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAG9E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host config loading for `lumis` CLI/runtime.
|
|
3
|
+
*
|
|
4
|
+
* The config is optional; when absent, runtime falls back to defaults and
|
|
5
|
+
* detection-based pack resolution.
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
async function emitTrace(onTrace, event) {
|
|
10
|
+
if (!onTrace)
|
|
11
|
+
return;
|
|
12
|
+
await onTrace(event);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load `lumis.config.ts` from project root when present.
|
|
16
|
+
*
|
|
17
|
+
* @param projectRoot - Absolute path of the target project.
|
|
18
|
+
* @returns Parsed Lumis config object, or empty defaults when config is absent.
|
|
19
|
+
*/
|
|
20
|
+
export async function loadLumisConfig(projectRoot, options = {}) {
|
|
21
|
+
await emitTrace(options.onTrace, {
|
|
22
|
+
type: 'config-load',
|
|
23
|
+
status: 'start',
|
|
24
|
+
name: 'lumis.config',
|
|
25
|
+
context: { projectRoot },
|
|
26
|
+
});
|
|
27
|
+
const configPathTs = path.join(projectRoot, 'lumis.config.ts');
|
|
28
|
+
const configPathJson = path.join(projectRoot, 'lumis.config.json');
|
|
29
|
+
if (fs.existsSync(configPathTs)) {
|
|
30
|
+
const module = await import(configPathTs);
|
|
31
|
+
await emitTrace(options.onTrace, {
|
|
32
|
+
type: 'config-load',
|
|
33
|
+
status: 'success',
|
|
34
|
+
name: 'lumis.config.ts',
|
|
35
|
+
context: { configPath: configPathTs },
|
|
36
|
+
});
|
|
37
|
+
return (module.default ?? {});
|
|
38
|
+
}
|
|
39
|
+
if (fs.existsSync(configPathJson)) {
|
|
40
|
+
const raw = fs.readFileSync(configPathJson, 'utf8');
|
|
41
|
+
try {
|
|
42
|
+
const parsed = JSON.parse(raw);
|
|
43
|
+
await emitTrace(options.onTrace, {
|
|
44
|
+
type: 'config-load',
|
|
45
|
+
status: 'success',
|
|
46
|
+
name: 'lumis.config.json',
|
|
47
|
+
context: { configPath: configPathJson },
|
|
48
|
+
});
|
|
49
|
+
return parsed;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
await emitTrace(options.onTrace, {
|
|
53
|
+
type: 'config-load',
|
|
54
|
+
status: 'failure',
|
|
55
|
+
name: 'lumis.config.json',
|
|
56
|
+
message: error instanceof Error ? error.message : String(error),
|
|
57
|
+
context: { configPath: configPathJson },
|
|
58
|
+
});
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
await emitTrace(options.onTrace, {
|
|
63
|
+
type: 'config-load',
|
|
64
|
+
status: 'info',
|
|
65
|
+
name: 'lumis.config',
|
|
66
|
+
message: 'No config file found. Using defaults.',
|
|
67
|
+
context: { projectRoot },
|
|
68
|
+
});
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Save `lumis.config.json` at project root.
|
|
73
|
+
*
|
|
74
|
+
* @param projectRoot - Absolute path of the target project.
|
|
75
|
+
* @param config - Lumis configuration to persist.
|
|
76
|
+
*/
|
|
77
|
+
export function saveLumisConfig(projectRoot, config) {
|
|
78
|
+
const configPath = path.join(projectRoot, 'lumis.config.json');
|
|
79
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAqD5B,KAAK,UAAU,SAAS,CAAC,OAAuC,EAAE,KAAwC;IACzG,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAmB,EAAE,UAAkC,EAAE;IAC9F,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE;QAChC,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE,WAAW,EAAE;KACxB,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;IAC9D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAA;IAElE,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;QACzC,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO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EAAE;KACxB,CAAC,CAAA;IAEF,OAAO,EAAE,CAAA;AACV,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,MAAmB;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAA;IAC9D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AACtE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export type {
|
|
14
|
-
export
|
|
15
|
-
export
|
|
1
|
+
export { loadLumisConfig } from './config-loader.js';
|
|
2
|
+
export type { LumisConfig } from './config-loader.js';
|
|
3
|
+
export { detectBestAdapter, detectBestPack, getBuiltinAdapters, getBuiltinPackByFramework, getBuiltinPacks, resolveAdapterForProject, resolvePackForProject, } from './adapter-loader.js';
|
|
4
|
+
export { runCli } from './cli.js';
|
|
5
|
+
export { executeCommandsListCommand, executeCommandsRunCommand } from './commands/commands.command.js';
|
|
6
|
+
export type { NormalizedCommandEntry } from './commands/commands.command.js';
|
|
7
|
+
export { executeDoctorCommand } from './commands/doctor.command.js';
|
|
8
|
+
export { executeInitCommand } from './commands/init.command.js';
|
|
9
|
+
export { executeRuntimeRunCommand, executeRuntimeTranscriptsListCommand, executeRuntimeTranscriptsPruneCommand, executeRuntimeTranscriptsShowCommand, } from './commands/runtime.command.js';
|
|
10
|
+
export { createCommandContext } from './commands/runtime.js';
|
|
11
|
+
export type { CommandContext, CommandHandler } from './commands/runtime.js';
|
|
12
|
+
export { createDefaultRuntimeProfileStore, getRuntimeProfile, loadRuntimeProfileStore, redactRuntimeProfileForLogs, saveRuntimeProfileStore, validateRuntimeProfileStore, } from './runtime/profiles.js';
|
|
13
|
+
export type { RuntimeProfileValidationResult } from './runtime/profiles.js';
|
|
14
|
+
export { executeOnRuntimeProfile } from './runtime/executor.js';
|
|
15
|
+
export { runPostMakeRuntimeTasks } from './runtime/orchestration.js';
|
|
16
|
+
export { appendRuntimeTranscriptIndex, loadRuntimeTranscriptIndex, persistRuntimeTranscript, pruneRuntimeTranscripts, saveRuntimeTranscriptIndex, summarizeRuntimeTranscripts, } from './runtime/transcripts.js';
|
|
17
|
+
export type { RuntimeExecutionRequest, RuntimeExecutionResult, RuntimeTranscriptEntry, } from './runtime/executor.js';
|
|
18
|
+
export type { RuntimeOrchestrationResult, RuntimeTaskExecution, RuntimeTaskName } from './runtime/orchestration.js';
|
|
19
|
+
export type { PersistedRuntimeTranscript, PruneRuntimeTranscriptsOptions, PruneRuntimeTranscriptsResult, RuntimeTranscriptSummary, RuntimeTranscriptIndex, RuntimeTranscriptIndexEntry, } from './runtime/transcripts.js';
|
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,GACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA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
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
1
|
+
export { loadLumisConfig } from './config-loader.js';
|
|
2
|
+
export { detectBestAdapter, detectBestPack, getBuiltinAdapters, getBuiltinPackByFramework, getBuiltinPacks, resolveAdapterForProject, resolvePackForProject, } from './adapter-loader.js';
|
|
3
|
+
export { runCli } from './cli.js';
|
|
4
|
+
export { executeCommandsListCommand, executeCommandsRunCommand } from './commands/commands.command.js';
|
|
5
|
+
export { executeDoctorCommand } from './commands/doctor.command.js';
|
|
6
|
+
export { executeInitCommand } from './commands/init.command.js';
|
|
7
|
+
export { executeRuntimeRunCommand, executeRuntimeTranscriptsListCommand, executeRuntimeTranscriptsPruneCommand, executeRuntimeTranscriptsShowCommand, } from './commands/runtime.command.js';
|
|
8
|
+
export { createCommandContext } from './commands/runtime.js';
|
|
9
|
+
export { createDefaultRuntimeProfileStore, getRuntimeProfile, loadRuntimeProfileStore, redactRuntimeProfileForLogs, saveRuntimeProfileStore, validateRuntimeProfileStore, } from './runtime/profiles.js';
|
|
10
|
+
export { executeOnRuntimeProfile } from './runtime/executor.js';
|
|
11
|
+
export { runPostMakeRuntimeTasks } from './runtime/orchestration.js';
|
|
12
|
+
export { appendRuntimeTranscriptIndex, loadRuntimeTranscriptIndex, persistRuntimeTranscript, pruneRuntimeTranscripts, saveRuntimeTranscriptIndex, summarizeRuntimeTranscripts, } from './runtime/transcripts.js';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,GACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAEtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EACN,wBAAwB,EACxB,oCAAoC,EACpC,qCAAqC,EACrC,oCAAoC,GACpC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,EACN,gCAAgC,EAChC,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,GAC3B,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EACN,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,GAC3B,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type LauncherResult = {
|
|
2
|
+
kind: 'exit';
|
|
3
|
+
code: number;
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'dispatch';
|
|
6
|
+
argv: string[];
|
|
7
|
+
};
|
|
8
|
+
type LauncherOptions = {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
write: (message: string) => void;
|
|
11
|
+
stdin?: NodeJS.ReadStream;
|
|
12
|
+
stdout?: NodeJS.WriteStream;
|
|
13
|
+
};
|
|
14
|
+
export declare function runInteractiveLauncher(options: LauncherOptions): Promise<LauncherResult>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,cAAc,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAEvC,KAAK,eAAe,GAAG;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAA;CAC3B,CAAA;AA4LD,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAoK9F"}
|
package/dist/launcher.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import readline from 'node:readline';
|
|
3
|
+
import { loadLumisConfig, saveLumisConfig } from './config-loader.js';
|
|
4
|
+
import { SUPPORTED_RUNTIMES } from './commands/use.command.js';
|
|
5
|
+
import { ansi } from './output/ansi.js';
|
|
6
|
+
const RUNTIME_KEY_ENV = {
|
|
7
|
+
anthropic: 'ANTHROPIC_API_KEY',
|
|
8
|
+
openai: 'OPENAI_API_KEY',
|
|
9
|
+
openrouter: 'OPENROUTER_API_KEY',
|
|
10
|
+
groq: 'GROQ_API_KEY',
|
|
11
|
+
deepseek: 'DEEPSEEK_API_KEY',
|
|
12
|
+
mistral: 'MISTRAL_API_KEY',
|
|
13
|
+
gemini: 'GEMINI_API_KEY',
|
|
14
|
+
};
|
|
15
|
+
const RUNTIME_GROUPS = [
|
|
16
|
+
{ label: 'Agent CLIs', ids: ['claude-code', 'copilot'] },
|
|
17
|
+
{ label: 'Model Providers', ids: ['ollama', 'anthropic', 'openai', 'openrouter', 'groq', 'deepseek', 'mistral', 'gemini'] },
|
|
18
|
+
{ label: 'Fallback', ids: ['local'] },
|
|
19
|
+
];
|
|
20
|
+
function commandExists(command) {
|
|
21
|
+
const isWindows = process.platform === 'win32';
|
|
22
|
+
const lookup = isWindows ? 'where' : 'which';
|
|
23
|
+
const result = spawnSync(lookup, [command], {
|
|
24
|
+
stdio: 'ignore',
|
|
25
|
+
env: process.env,
|
|
26
|
+
});
|
|
27
|
+
return result.status === 0;
|
|
28
|
+
}
|
|
29
|
+
async function checkOllamaAvailability(baseUrl, timeoutMs = 1200) {
|
|
30
|
+
try {
|
|
31
|
+
const controller = new AbortController();
|
|
32
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
33
|
+
const response = await fetch(baseUrl, {
|
|
34
|
+
method: 'HEAD',
|
|
35
|
+
signal: controller.signal,
|
|
36
|
+
});
|
|
37
|
+
clearTimeout(timeoutId);
|
|
38
|
+
return response.status === 404 || response.status === 200;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function detectRuntimeScores(preferredRuntime) {
|
|
45
|
+
const preferred = preferredRuntime?.toLowerCase();
|
|
46
|
+
const env = process.env;
|
|
47
|
+
const scores = [];
|
|
48
|
+
const ollamaUrl = env['OLLAMA_BASE_URL'] ?? 'http://localhost:11434/v1';
|
|
49
|
+
const ollamaAvailable = await checkOllamaAvailability(ollamaUrl);
|
|
50
|
+
scores.push({
|
|
51
|
+
id: 'ollama',
|
|
52
|
+
score: ollamaAvailable ? (preferred === 'ollama' ? 100 : 55) : 0,
|
|
53
|
+
reason: ollamaAvailable ? `Running at ${ollamaUrl}` : 'Not running',
|
|
54
|
+
preferred: preferred === 'ollama',
|
|
55
|
+
available: ollamaAvailable,
|
|
56
|
+
});
|
|
57
|
+
const providers = [
|
|
58
|
+
{ id: 'groq', key: 'GROQ_API_KEY', score: 90 },
|
|
59
|
+
{ id: 'openrouter', key: 'OPENROUTER_API_KEY', score: 85 },
|
|
60
|
+
{ id: 'anthropic', key: 'ANTHROPIC_API_KEY', score: 80 },
|
|
61
|
+
{ id: 'openai', key: 'OPENAI_API_KEY', score: 75 },
|
|
62
|
+
{ id: 'deepseek', key: 'DEEPSEEK_API_KEY', score: 70 },
|
|
63
|
+
{ id: 'mistral', key: 'MISTRAL_API_KEY', score: 65 },
|
|
64
|
+
{ id: 'gemini', key: 'GEMINI_API_KEY', score: 60 },
|
|
65
|
+
];
|
|
66
|
+
for (const provider of providers) {
|
|
67
|
+
const configured = (env[provider.key] ?? '').trim().length > 0;
|
|
68
|
+
if (!configured)
|
|
69
|
+
continue;
|
|
70
|
+
const isPreferred = preferred === provider.id;
|
|
71
|
+
scores.push({
|
|
72
|
+
id: provider.id,
|
|
73
|
+
score: isPreferred ? 100 : provider.score,
|
|
74
|
+
reason: `Configured via ${provider.key}`,
|
|
75
|
+
preferred: isPreferred,
|
|
76
|
+
available: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (preferred === 'claude-code') {
|
|
80
|
+
scores.push({ id: 'claude-code', score: 100, reason: 'Preferred runtime requested', preferred: true, available: true });
|
|
81
|
+
}
|
|
82
|
+
if (preferred === 'copilot') {
|
|
83
|
+
scores.push({ id: 'copilot', score: 100, reason: 'Preferred runtime requested', preferred: true, available: true });
|
|
84
|
+
}
|
|
85
|
+
scores.push({
|
|
86
|
+
id: 'local',
|
|
87
|
+
score: preferred === 'local' ? 100 : 5,
|
|
88
|
+
reason: 'Deterministic fallback',
|
|
89
|
+
preferred: preferred === 'local',
|
|
90
|
+
available: true,
|
|
91
|
+
});
|
|
92
|
+
scores.sort((a, b) => b.score - a.score);
|
|
93
|
+
return scores;
|
|
94
|
+
}
|
|
95
|
+
function runtimeStatusLabel(runtimeId, score) {
|
|
96
|
+
if (runtimeId === 'claude-code') {
|
|
97
|
+
if (commandExists('claude'))
|
|
98
|
+
return ansi.green('installed');
|
|
99
|
+
if (score?.preferred)
|
|
100
|
+
return ansi.yellow('preferred (not detected)');
|
|
101
|
+
return ansi.dim('not detected');
|
|
102
|
+
}
|
|
103
|
+
if (runtimeId === 'copilot') {
|
|
104
|
+
if (commandExists('github-copilot'))
|
|
105
|
+
return ansi.green('installed');
|
|
106
|
+
if (score?.preferred)
|
|
107
|
+
return ansi.yellow('preferred (not detected)');
|
|
108
|
+
return ansi.dim('not detected');
|
|
109
|
+
}
|
|
110
|
+
if (score?.available) {
|
|
111
|
+
return ansi.green('available');
|
|
112
|
+
}
|
|
113
|
+
const keyEnv = RUNTIME_KEY_ENV[runtimeId];
|
|
114
|
+
if (keyEnv) {
|
|
115
|
+
return ansi.dim(`missing ${keyEnv}`);
|
|
116
|
+
}
|
|
117
|
+
if (runtimeId === 'ollama') {
|
|
118
|
+
return ansi.dim('not running');
|
|
119
|
+
}
|
|
120
|
+
if (runtimeId === 'local') {
|
|
121
|
+
return ansi.green('always available');
|
|
122
|
+
}
|
|
123
|
+
return ansi.dim('unavailable');
|
|
124
|
+
}
|
|
125
|
+
function renderLauncher(args) {
|
|
126
|
+
const runtimeScores = new Map(args.runtimes.map((runtime) => [runtime.id, runtime]));
|
|
127
|
+
const runtimeIndex = new Map(SUPPORTED_RUNTIMES.map((runtimeId, index) => [runtimeId, index]));
|
|
128
|
+
const lines = [];
|
|
129
|
+
lines.push('\u001Bc');
|
|
130
|
+
lines.push(ansi.label('Interactive Launcher'));
|
|
131
|
+
lines.push('');
|
|
132
|
+
lines.push(ansi.bold('AI Runtime'));
|
|
133
|
+
for (const group of RUNTIME_GROUPS) {
|
|
134
|
+
lines.push(` ${ansi.dim(group.label)}`);
|
|
135
|
+
for (const runtimeId of group.ids) {
|
|
136
|
+
const index = runtimeIndex.get(runtimeId);
|
|
137
|
+
if (index === undefined) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const score = runtimeScores.get(runtimeId);
|
|
141
|
+
const selected = args.mode === 'runtime' && args.selectedIndex === index;
|
|
142
|
+
const pointer = selected ? ansi.cyan('▸') : ' ';
|
|
143
|
+
const preferred = args.preferredRuntime === runtimeId ? ` ${ansi.yellow('★')}` : '';
|
|
144
|
+
const status = runtimeStatusLabel(runtimeId, score);
|
|
145
|
+
const scoreText = score?.available ? ansi.dim(`${score.score}%`) : ansi.dim('--');
|
|
146
|
+
lines.push(` ${pointer} ${runtimeId.padEnd(12)} ${status} ${scoreText}${preferred}`);
|
|
147
|
+
}
|
|
148
|
+
lines.push('');
|
|
149
|
+
}
|
|
150
|
+
lines.push(ansi.bold('Quick Actions'));
|
|
151
|
+
args.actions.forEach((action, index) => {
|
|
152
|
+
const selected = args.mode === 'action' && args.selectedIndex === index;
|
|
153
|
+
const pointer = selected ? ansi.cyan('▸') : ' ';
|
|
154
|
+
lines.push(` ${pointer} ${action.label}`);
|
|
155
|
+
lines.push(` ${ansi.dim(action.description)}`);
|
|
156
|
+
});
|
|
157
|
+
lines.push('');
|
|
158
|
+
lines.push(ansi.dim(args.mode === 'runtime'
|
|
159
|
+
? '↑/↓ navigate • tab switch sections • enter → set runtime & start session • esc quit'
|
|
160
|
+
: '↑/↓ navigate • tab switch sections • enter → run action • esc quit'));
|
|
161
|
+
return `${lines.join('\n')}\n`;
|
|
162
|
+
}
|
|
163
|
+
export async function runInteractiveLauncher(options) {
|
|
164
|
+
const stdin = options.stdin ?? process.stdin;
|
|
165
|
+
const stdout = options.stdout ?? process.stdout;
|
|
166
|
+
if (!stdin.isTTY || !stdout.isTTY || typeof stdin.setRawMode !== 'function') {
|
|
167
|
+
return { kind: 'exit', code: 0 };
|
|
168
|
+
}
|
|
169
|
+
const config = await loadLumisConfig(options.projectRoot);
|
|
170
|
+
const runtimes = await detectRuntimeScores(config.preferredRuntime);
|
|
171
|
+
const actions = [
|
|
172
|
+
{
|
|
173
|
+
label: 'Start AI session',
|
|
174
|
+
description: 'Open interactive AI session using the configured runtime (tinker mode)',
|
|
175
|
+
argv: ['tinker'],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'Run doctor',
|
|
179
|
+
description: 'Diagnostics for environment and pack routing',
|
|
180
|
+
argv: ['doctor'],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: 'Detect pack',
|
|
184
|
+
description: 'Probe this project and select the best adapter',
|
|
185
|
+
argv: ['pack', 'detect'],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: 'List commands',
|
|
189
|
+
description: 'Show available pack/project commands',
|
|
190
|
+
argv: ['commands', 'list'],
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
let preferredRuntime = config.preferredRuntime;
|
|
194
|
+
let mode = 'runtime';
|
|
195
|
+
let selectedIndex = 0;
|
|
196
|
+
const maxIndex = () => (mode === 'runtime' ? SUPPORTED_RUNTIMES.length - 1 : actions.length - 1);
|
|
197
|
+
const render = () => {
|
|
198
|
+
options.write(renderLauncher({
|
|
199
|
+
mode,
|
|
200
|
+
runtimes,
|
|
201
|
+
preferredRuntime,
|
|
202
|
+
actions,
|
|
203
|
+
selectedIndex,
|
|
204
|
+
}));
|
|
205
|
+
};
|
|
206
|
+
const setPreferredRuntime = (runtimeId) => {
|
|
207
|
+
saveLumisConfig(options.projectRoot, {
|
|
208
|
+
...config,
|
|
209
|
+
preferredRuntime: runtimeId,
|
|
210
|
+
});
|
|
211
|
+
// Update local state so next render() shows the ★ on the new selection
|
|
212
|
+
preferredRuntime = runtimeId;
|
|
213
|
+
};
|
|
214
|
+
render();
|
|
215
|
+
return new Promise((resolve) => {
|
|
216
|
+
readline.emitKeypressEvents(stdin);
|
|
217
|
+
stdin.setRawMode(true);
|
|
218
|
+
stdin.resume();
|
|
219
|
+
const cleanup = () => {
|
|
220
|
+
stdin.setRawMode(false);
|
|
221
|
+
stdin.pause();
|
|
222
|
+
stdin.removeListener('keypress', onKeyPress);
|
|
223
|
+
};
|
|
224
|
+
const finish = (result) => {
|
|
225
|
+
cleanup();
|
|
226
|
+
resolve(result);
|
|
227
|
+
};
|
|
228
|
+
const onKeyPress = (_str, key) => {
|
|
229
|
+
if (key.name === 'escape') {
|
|
230
|
+
finish({ kind: 'exit', code: 0 });
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (key.ctrl && key.name === 'c') {
|
|
234
|
+
finish({ kind: 'exit', code: 130 });
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (key.name === 'tab') {
|
|
238
|
+
mode = mode === 'runtime' ? 'action' : 'runtime';
|
|
239
|
+
selectedIndex = Math.min(selectedIndex, maxIndex());
|
|
240
|
+
render();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (key.name === 'up') {
|
|
244
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : maxIndex();
|
|
245
|
+
render();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (key.name === 'down') {
|
|
249
|
+
selectedIndex = selectedIndex < maxIndex() ? selectedIndex + 1 : 0;
|
|
250
|
+
render();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (key.name === 'return' || key.name === 'right') {
|
|
254
|
+
if (mode === 'runtime') {
|
|
255
|
+
const runtimeId = SUPPORTED_RUNTIMES[selectedIndex];
|
|
256
|
+
if (!runtimeId) {
|
|
257
|
+
finish({ kind: 'exit', code: 1 });
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// 1. Persist preference — writes lumis.config.json
|
|
261
|
+
setPreferredRuntime(runtimeId);
|
|
262
|
+
// 2. Re-render so the ★ appears on the saved selection before proceeding
|
|
263
|
+
render();
|
|
264
|
+
// 3. Native CLI tools that are full replacements — spawn them directly
|
|
265
|
+
if (runtimeId === 'claude-code' && commandExists('claude')) {
|
|
266
|
+
cleanup();
|
|
267
|
+
const result = spawnSync('claude', [], { stdio: 'inherit', env: process.env });
|
|
268
|
+
resolve({ kind: 'exit', code: result.status ?? 0 });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (runtimeId === 'copilot' && commandExists('gh')) {
|
|
272
|
+
cleanup();
|
|
273
|
+
const result = spawnSync('gh', ['copilot', 'suggest', '--target', 'shell'], {
|
|
274
|
+
stdio: 'inherit',
|
|
275
|
+
env: process.env,
|
|
276
|
+
});
|
|
277
|
+
resolve({ kind: 'exit', code: result.status ?? 0 });
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (runtimeId === 'ollama' && commandExists('ollama')) {
|
|
281
|
+
cleanup();
|
|
282
|
+
const result = spawnSync('ollama', ['run', 'llama3'], { stdio: 'inherit', env: process.env });
|
|
283
|
+
resolve({ kind: 'exit', code: result.status ?? 0 });
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
// 4. API-based runtimes and local — dispatch to tinker so the AI session starts
|
|
287
|
+
finish({ kind: 'dispatch', argv: ['tinker'] });
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const action = actions[selectedIndex];
|
|
291
|
+
if (!action) {
|
|
292
|
+
finish({ kind: 'exit', code: 1 });
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
finish({ kind: 'dispatch', argv: action.argv });
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
stdin.on('keypress', onKeyPress);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=launcher.js.map
|