@codemap-ai/cli 0.1.2 → 0.1.5
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/{chat-terminal-DFFYQ6AF.js → chat-terminal-7KX3PEP3.js} +4 -4
- package/dist/{chunk-KWYP3ADN.js → chunk-EUHYFJ32.js} +1 -1
- package/dist/{chunk-FFFJKKKM.js → chunk-GGIXJZYK.js} +0 -6
- package/dist/{chunk-WNJNT3FC.js → chunk-MF6QRGI5.js} +1 -1
- package/dist/index.js +211 -43
- package/dist/{pi-tui-app-GVZ3AN42.js → pi-tui-app-DCD7TEN5.js} +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{createRequire as __cmr}from"node:module";import{fileURLToPath as __f2p}from"node:url";import{dirname as __dn}from"node:path";var require=__cmr(import.meta.url);var __filename=__f2p(import.meta.url);var __dirname=__dn(__filename);
|
|
2
2
|
import {
|
|
3
3
|
fetchResourceContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MF6QRGI5.js";
|
|
5
5
|
import {
|
|
6
6
|
executeCommand,
|
|
7
7
|
getCachedContext,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
loadThreadIntoUI,
|
|
11
11
|
runShell,
|
|
12
12
|
warmupFileSearch
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EUHYFJ32.js";
|
|
14
14
|
import {
|
|
15
15
|
buildLocalIndex,
|
|
16
16
|
getMastraCurrentModelId,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
switchMastraThread,
|
|
27
27
|
tryGetCurrentWorkspaceInfo,
|
|
28
28
|
warmupHarness
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-GGIXJZYK.js";
|
|
30
30
|
import {
|
|
31
31
|
C_ERROR,
|
|
32
32
|
C_SUCCESS,
|
|
@@ -1025,7 +1025,7 @@ var ChatTerminal = class {
|
|
|
1025
1025
|
this.store.dispatch({ synthRunning: false });
|
|
1026
1026
|
this.bus.scheduleRefresh();
|
|
1027
1027
|
});
|
|
1028
|
-
const { startPiTuiApp } = await import("./pi-tui-app-
|
|
1028
|
+
const { startPiTuiApp } = await import("./pi-tui-app-DCD7TEN5.js");
|
|
1029
1029
|
await startPiTuiApp(this);
|
|
1030
1030
|
}
|
|
1031
1031
|
// ─── Session management ───────────────────────────────────
|
|
@@ -216811,14 +216811,8 @@ async function runStatusCommand() {
|
|
|
216811
216811
|
|
|
216812
216812
|
// src/cli-agent/chat/harness/models.ts
|
|
216813
216813
|
var FALLBACK_GATEWAY_MODEL = process.env.CODEMAP_LLM_GATEWAY_DEFAULT_MODEL ?? "cx/gpt-5.3-codex";
|
|
216814
|
-
var KNOWN_PROFILE_LABELS = /* @__PURE__ */ new Set(["planner", "coder", "reviewer"]);
|
|
216815
216814
|
function resolveGatewayModel(modelId, availableModels, availableCombos) {
|
|
216816
216815
|
if (availableCombos?.includes(modelId)) return modelId;
|
|
216817
|
-
if (KNOWN_PROFILE_LABELS.has(modelId)) {
|
|
216818
|
-
console.warn(
|
|
216819
|
-
`[resolveGatewayModel] Received profile label "${modelId}" \u2014 callers should resolve profiles to a concrete model ID or combo ID before calling this function.`
|
|
216820
|
-
);
|
|
216821
|
-
}
|
|
216822
216816
|
if (availableModels && availableModels.length > 0) {
|
|
216823
216817
|
if (availableModels.includes(modelId)) return modelId;
|
|
216824
216818
|
const fallback = availableModels[0];
|
|
@@ -2,7 +2,7 @@ import{createRequire as __cmr}from"node:module";import{fileURLToPath as __f2p}fr
|
|
|
2
2
|
import {
|
|
3
3
|
readMcpServerConfigs,
|
|
4
4
|
readPriorityResources
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GGIXJZYK.js";
|
|
6
6
|
|
|
7
7
|
// src/cli-agent/chat/mcp-tools/mcp-tool-client.ts
|
|
8
8
|
import { existsSync } from "fs";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-A2QHID6K.js";
|
|
6
6
|
import {
|
|
7
7
|
CodeMapMcpToolClient
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MF6QRGI5.js";
|
|
9
9
|
import {
|
|
10
10
|
buildImportHealth,
|
|
11
11
|
buildLocalIndex,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
shouldUseLocalIndexBeforeRemote,
|
|
30
30
|
toRepoRelativePath,
|
|
31
31
|
tryGetCurrentWorkspaceInfo
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GGIXJZYK.js";
|
|
33
33
|
import {
|
|
34
34
|
clearGlobalAuthConfig,
|
|
35
35
|
createCodeMapClient,
|
|
@@ -8175,6 +8175,9 @@ async function writeGatewayConfig(options) {
|
|
|
8175
8175
|
if (options.apiKey) {
|
|
8176
8176
|
config.apiKey = options.apiKey;
|
|
8177
8177
|
}
|
|
8178
|
+
if (options.defaultModel) {
|
|
8179
|
+
config.defaultModel = options.defaultModel;
|
|
8180
|
+
}
|
|
8178
8181
|
try {
|
|
8179
8182
|
await mkdir2(path12.dirname(configPath), { recursive: true });
|
|
8180
8183
|
await writeFile5(configPath, `${JSON.stringify(config, null, 2)}
|
|
@@ -8668,7 +8671,7 @@ async function runChat(ctx) {
|
|
|
8668
8671
|
});
|
|
8669
8672
|
try {
|
|
8670
8673
|
const mcpConfig = await loadConfig();
|
|
8671
|
-
const { ChatTerminal } = await import("./chat-terminal-
|
|
8674
|
+
const { ChatTerminal } = await import("./chat-terminal-7KX3PEP3.js");
|
|
8672
8675
|
const terminal = new ChatTerminal({
|
|
8673
8676
|
provider,
|
|
8674
8677
|
model,
|
|
@@ -8882,6 +8885,59 @@ function prompt(question, defaultValue) {
|
|
|
8882
8885
|
});
|
|
8883
8886
|
});
|
|
8884
8887
|
}
|
|
8888
|
+
function select(question, options) {
|
|
8889
|
+
return new Promise((resolve) => {
|
|
8890
|
+
let current = 0;
|
|
8891
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
8892
|
+
process.stdin.setRawMode?.(true);
|
|
8893
|
+
process.stdin.resume();
|
|
8894
|
+
process.stdin.setEncoding("utf8");
|
|
8895
|
+
const render = () => {
|
|
8896
|
+
if (rendered > 0) {
|
|
8897
|
+
process.stdout.write(`\x1B[${rendered}A`);
|
|
8898
|
+
}
|
|
8899
|
+
process.stdout.write(`\r${question}
|
|
8900
|
+
`);
|
|
8901
|
+
for (let i = 0; i < options.length; i++) {
|
|
8902
|
+
const opt = options[i];
|
|
8903
|
+
const prefix = i === current ? "\u276F " : " ";
|
|
8904
|
+
const line = `${prefix}${opt.label}${opt.description ? ` \u2014 ${opt.description}` : ""}`;
|
|
8905
|
+
process.stdout.write(`\x1B[2K${line}
|
|
8906
|
+
`);
|
|
8907
|
+
}
|
|
8908
|
+
rendered = options.length + 1;
|
|
8909
|
+
};
|
|
8910
|
+
let rendered = 0;
|
|
8911
|
+
render();
|
|
8912
|
+
const onData = (key) => {
|
|
8913
|
+
if (key === "\x1B[A") {
|
|
8914
|
+
current = (current - 1 + options.length) % options.length;
|
|
8915
|
+
render();
|
|
8916
|
+
} else if (key === "\x1B[B") {
|
|
8917
|
+
current = (current + 1) % options.length;
|
|
8918
|
+
render();
|
|
8919
|
+
} else if (key === "\r" || key === "\n") {
|
|
8920
|
+
cleanup();
|
|
8921
|
+
process.stdout.write("\n");
|
|
8922
|
+
resolve(options[current].value);
|
|
8923
|
+
} else if (key >= "1" && key <= String(options.length)) {
|
|
8924
|
+
cleanup();
|
|
8925
|
+
process.stdout.write("\n");
|
|
8926
|
+
resolve(options[Number(key) - 1].value);
|
|
8927
|
+
} else if (key === "") {
|
|
8928
|
+
cleanup();
|
|
8929
|
+
process.exit(0);
|
|
8930
|
+
}
|
|
8931
|
+
};
|
|
8932
|
+
const cleanup = () => {
|
|
8933
|
+
process.stdin.removeListener("data", onData);
|
|
8934
|
+
process.stdin.setRawMode?.(false);
|
|
8935
|
+
process.stdin.pause();
|
|
8936
|
+
rl.close();
|
|
8937
|
+
};
|
|
8938
|
+
process.stdin.on("data", onData);
|
|
8939
|
+
});
|
|
8940
|
+
}
|
|
8885
8941
|
function confirm(question, defaultValue = true) {
|
|
8886
8942
|
return new Promise((resolve) => {
|
|
8887
8943
|
const rl = createInterface({
|
|
@@ -8897,6 +8953,31 @@ function confirm(question, defaultValue = true) {
|
|
|
8897
8953
|
});
|
|
8898
8954
|
});
|
|
8899
8955
|
}
|
|
8956
|
+
async function fetchModels(baseUrl, apiKey) {
|
|
8957
|
+
const url = `${baseUrl}/models`;
|
|
8958
|
+
const headers = {
|
|
8959
|
+
"Content-Type": "application/json"
|
|
8960
|
+
};
|
|
8961
|
+
if (apiKey) {
|
|
8962
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
8963
|
+
}
|
|
8964
|
+
try {
|
|
8965
|
+
const response = await fetch(url, {
|
|
8966
|
+
method: "GET",
|
|
8967
|
+
headers,
|
|
8968
|
+
signal: AbortSignal.timeout(1e4)
|
|
8969
|
+
});
|
|
8970
|
+
if (!response.ok) {
|
|
8971
|
+
console.log(`\u26A0\uFE0F Failed to fetch models: HTTP ${response.status}`);
|
|
8972
|
+
return [];
|
|
8973
|
+
}
|
|
8974
|
+
const data = await response.json();
|
|
8975
|
+
return data.data || [];
|
|
8976
|
+
} catch (error) {
|
|
8977
|
+
console.log("\u26A0\uFE0F Could not connect to API to fetch models.");
|
|
8978
|
+
return [];
|
|
8979
|
+
}
|
|
8980
|
+
}
|
|
8900
8981
|
function is9RouterInstalled() {
|
|
8901
8982
|
try {
|
|
8902
8983
|
execSync("which 9router", { stdio: "ignore" });
|
|
@@ -8909,6 +8990,17 @@ async function install9Router() {
|
|
|
8909
8990
|
console.log(" Installing 9router globally...");
|
|
8910
8991
|
execSync("npm install -g 9router", { stdio: "inherit" });
|
|
8911
8992
|
}
|
|
8993
|
+
async function is9RouterRunning() {
|
|
8994
|
+
try {
|
|
8995
|
+
await fetch(`http://localhost:${NINE_ROUTER_LOCAL_PORT}/v1/models`, {
|
|
8996
|
+
method: "GET",
|
|
8997
|
+
signal: AbortSignal.timeout(2e3)
|
|
8998
|
+
});
|
|
8999
|
+
return true;
|
|
9000
|
+
} catch {
|
|
9001
|
+
return false;
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
8912
9004
|
function start9Router() {
|
|
8913
9005
|
console.log(" Starting 9router in the background...");
|
|
8914
9006
|
const child = spawn("9router", ["--port", String(NINE_ROUTER_LOCAL_PORT)], {
|
|
@@ -8920,43 +9012,59 @@ function start9Router() {
|
|
|
8920
9012
|
async function runInteractiveSetup() {
|
|
8921
9013
|
console.log(`
|
|
8922
9014
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
8923
|
-
\u2551 \u{1F680} CodeMap
|
|
9015
|
+
\u2551 \u{1F680} CodeMap Setup \u2551
|
|
8924
9016
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
8925
9017
|
|
|
8926
|
-
CodeMap needs
|
|
9018
|
+
CodeMap needs an LLM API to power its AI features.
|
|
8927
9019
|
|
|
8928
9020
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
8929
|
-
\u{1F4CC}
|
|
9021
|
+
\u{1F4CC} How it works
|
|
8930
9022
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
8931
9023
|
|
|
8932
|
-
|
|
8933
|
-
|
|
9024
|
+
CodeMap sends prompts to any OpenAI-compatible API endpoint.
|
|
9025
|
+
You can use OpenAI, OpenRouter, a local model, or 9router \u2014 whichever you prefer.
|
|
8934
9026
|
|
|
8935
9027
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
8936
9028
|
|
|
8937
9029
|
`);
|
|
8938
|
-
console.log("\u2501\u2501\u2501
|
|
8939
|
-
console.log("");
|
|
8940
|
-
console.log(" 1. 9router local (default) \u2014 install and run locally");
|
|
8941
|
-
console.log(" \u2022 Free, runs on your machine");
|
|
8942
|
-
console.log(" \u2022 Pre-configured model routing (planner, coder, reviewer)");
|
|
8943
|
-
console.log(" \u2022 No per-model API keys needed");
|
|
8944
|
-
console.log("");
|
|
8945
|
-
console.log(" 2. 9router Cloud \u2014 managed gateway at 9router.dev");
|
|
8946
|
-
console.log(" \u2022 Usage-based billing");
|
|
8947
|
-
console.log(" \u2022 Get your API key at: https://9router.dev/settings/api-keys");
|
|
8948
|
-
console.log("");
|
|
8949
|
-
console.log(" 3. Self-hosted \u2014 run your own gateway");
|
|
8950
|
-
console.log(" \u2022 Set baseUrl to your gateway URL");
|
|
8951
|
-
console.log(" \u2022 Useful for local models or custom routing logic");
|
|
9030
|
+
console.log("\u2501\u2501\u2501 API Provider \u2501\u2501\u2501");
|
|
8952
9031
|
console.log("");
|
|
8953
|
-
const
|
|
8954
|
-
|
|
9032
|
+
const choice = await select("Choose API provider:", [
|
|
9033
|
+
{
|
|
9034
|
+
value: "1",
|
|
9035
|
+
label: "9router local (recommended)",
|
|
9036
|
+
description: "free, runs on your machine"
|
|
9037
|
+
},
|
|
9038
|
+
{
|
|
9039
|
+
value: "2",
|
|
9040
|
+
label: "OpenAI-compatible API",
|
|
9041
|
+
description: "use your own API key"
|
|
9042
|
+
},
|
|
9043
|
+
{
|
|
9044
|
+
value: "3",
|
|
9045
|
+
label: "Self-hosted",
|
|
9046
|
+
description: "run your own gateway"
|
|
9047
|
+
}
|
|
9048
|
+
]);
|
|
8955
9049
|
let baseUrl;
|
|
8956
9050
|
let nineRouterDashUrl;
|
|
8957
9051
|
if (choice === "2") {
|
|
8958
|
-
|
|
8959
|
-
|
|
9052
|
+
console.log("");
|
|
9053
|
+
console.log("\u2501\u2501\u2501 OpenAI-compatible API \u2501\u2501\u2501");
|
|
9054
|
+
console.log("Common base URLs:");
|
|
9055
|
+
console.log(" \u2022 OpenAI: https://api.openai.com/v1");
|
|
9056
|
+
console.log(" \u2022 OpenRouter: https://openrouter.ai/api/v1");
|
|
9057
|
+
console.log("");
|
|
9058
|
+
baseUrl = await prompt("Base URL", "https://api.openai.com/v1");
|
|
9059
|
+
while (baseUrl) {
|
|
9060
|
+
try {
|
|
9061
|
+
new URL(baseUrl);
|
|
9062
|
+
break;
|
|
9063
|
+
} catch {
|
|
9064
|
+
console.log("\u274C Invalid URL. Please try again.");
|
|
9065
|
+
baseUrl = await prompt("Base URL", "https://api.openai.com/v1");
|
|
9066
|
+
}
|
|
9067
|
+
}
|
|
8960
9068
|
} else if (choice === "3") {
|
|
8961
9069
|
console.log("");
|
|
8962
9070
|
console.log("\u2501\u2501\u2501 Self-hosted Gateway URL \u2501\u2501\u2501");
|
|
@@ -8984,8 +9092,12 @@ It manages model routing, load balancing, and token accounting.
|
|
|
8984
9092
|
}
|
|
8985
9093
|
}
|
|
8986
9094
|
if (is9RouterInstalled()) {
|
|
8987
|
-
|
|
8988
|
-
|
|
9095
|
+
if (await is9RouterRunning()) {
|
|
9096
|
+
console.log(` 9router is already running at http://localhost:${NINE_ROUTER_LOCAL_PORT}`);
|
|
9097
|
+
} else {
|
|
9098
|
+
start9Router();
|
|
9099
|
+
console.log(` 9router started at http://localhost:${NINE_ROUTER_LOCAL_PORT}`);
|
|
9100
|
+
}
|
|
8989
9101
|
}
|
|
8990
9102
|
baseUrl = NINE_ROUTER_LOCAL_BASE_URL;
|
|
8991
9103
|
nineRouterDashUrl = `http://localhost:${NINE_ROUTER_LOCAL_PORT}/dashboard/endpoint`;
|
|
@@ -8994,31 +9106,86 @@ It manages model routing, load balancing, and token accounting.
|
|
|
8994
9106
|
console.log("\u2501\u2501\u2501 API Key \u2501\u2501\u2501");
|
|
8995
9107
|
if (nineRouterDashUrl) {
|
|
8996
9108
|
console.log(`Get your API key from: ${nineRouterDashUrl}`);
|
|
9109
|
+
console.log("Leave empty if your gateway doesn't require auth.");
|
|
9110
|
+
} else if (choice === "2") {
|
|
9111
|
+
console.log("Enter your API key for the provider.");
|
|
9112
|
+
} else {
|
|
9113
|
+
console.log("Leave empty if your gateway doesn't require auth.");
|
|
8997
9114
|
}
|
|
8998
|
-
console.log("Leave empty if your gateway doesn't require auth.");
|
|
8999
9115
|
console.log("");
|
|
9000
9116
|
const apiKey = await prompt(
|
|
9001
9117
|
"API key (press Enter to skip)",
|
|
9002
9118
|
""
|
|
9003
9119
|
);
|
|
9004
9120
|
console.log("");
|
|
9121
|
+
console.log("\u2501\u2501\u2501 Default Model \u2501\u2501\u2501");
|
|
9122
|
+
console.log("Fetching available models...");
|
|
9123
|
+
console.log("");
|
|
9124
|
+
let defaultModel = "coder";
|
|
9125
|
+
const models = await fetchModels(baseUrl, apiKey || void 0);
|
|
9126
|
+
if (models.length > 0) {
|
|
9127
|
+
console.log(`Found ${models.length} model(s):`);
|
|
9128
|
+
console.log("");
|
|
9129
|
+
const modelOptions = models.slice(0, 20).map((m) => ({
|
|
9130
|
+
value: m.id,
|
|
9131
|
+
label: m.id,
|
|
9132
|
+
description: m.owned_by
|
|
9133
|
+
}));
|
|
9134
|
+
modelOptions.push({
|
|
9135
|
+
value: "__custom__",
|
|
9136
|
+
label: "Enter custom model ID",
|
|
9137
|
+
description: "type your own model name"
|
|
9138
|
+
});
|
|
9139
|
+
const selectedModel = await select("Choose default model:", modelOptions);
|
|
9140
|
+
if (selectedModel === "__custom__") {
|
|
9141
|
+
defaultModel = await prompt("Model ID", "");
|
|
9142
|
+
if (!defaultModel) {
|
|
9143
|
+
defaultModel = "coder";
|
|
9144
|
+
console.log("Using default profile: coder");
|
|
9145
|
+
}
|
|
9146
|
+
} else {
|
|
9147
|
+
defaultModel = selectedModel;
|
|
9148
|
+
}
|
|
9149
|
+
} else {
|
|
9150
|
+
console.log("No models returned by the API.");
|
|
9151
|
+
console.log("");
|
|
9152
|
+
console.log("You can enter a model ID manually, or use a profile label:");
|
|
9153
|
+
console.log(" \u2022 coder \u2014 for code generation tasks");
|
|
9154
|
+
console.log(" \u2022 planner \u2014 for planning and reasoning");
|
|
9155
|
+
console.log(" \u2022 reviewer \u2014 for code review tasks");
|
|
9156
|
+
console.log("");
|
|
9157
|
+
console.log("Leave empty to use 'coder' profile.");
|
|
9158
|
+
console.log("");
|
|
9159
|
+
defaultModel = await prompt("Model ID or profile", "coder");
|
|
9160
|
+
if (!defaultModel) {
|
|
9161
|
+
defaultModel = "coder";
|
|
9162
|
+
}
|
|
9163
|
+
}
|
|
9164
|
+
console.log("");
|
|
9165
|
+
console.log(` Default model set to: ${defaultModel}`);
|
|
9166
|
+
console.log("");
|
|
9005
9167
|
console.log("\u2501\u2501\u2501 Config Scope \u2501\u2501\u2501");
|
|
9006
|
-
console.log("\u2022 global \u2014 ~/.codemap/llm-gateway.json (default, all projects)");
|
|
9007
|
-
console.log("\u2022 project \u2014 .codemap/llm-gateway.json (current project only)");
|
|
9008
9168
|
console.log("");
|
|
9009
9169
|
let scope = "global";
|
|
9010
|
-
const
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9170
|
+
const scopeChoice = await select("Save config to:", [
|
|
9171
|
+
{
|
|
9172
|
+
value: "global",
|
|
9173
|
+
label: "Global",
|
|
9174
|
+
description: "~/.codemap/llm-gateway.json (all projects)"
|
|
9175
|
+
},
|
|
9176
|
+
{
|
|
9177
|
+
value: "project",
|
|
9178
|
+
label: "Project",
|
|
9179
|
+
description: ".codemap/llm-gateway.json (current project only)"
|
|
9180
|
+
}
|
|
9181
|
+
]);
|
|
9182
|
+
scope = scopeChoice;
|
|
9017
9183
|
const result = await writeGatewayConfig({
|
|
9018
9184
|
scope,
|
|
9019
9185
|
force: true,
|
|
9020
9186
|
baseUrl,
|
|
9021
|
-
apiKey: apiKey || void 0
|
|
9187
|
+
apiKey: apiKey || void 0,
|
|
9188
|
+
defaultModel
|
|
9022
9189
|
});
|
|
9023
9190
|
console.log(`
|
|
9024
9191
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
@@ -9026,9 +9193,10 @@ It manages model routing, load balancing, and token accounting.
|
|
|
9026
9193
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
9027
9194
|
|
|
9028
9195
|
Current settings:
|
|
9029
|
-
\u2022 Base URL:
|
|
9030
|
-
\u2022 API Key:
|
|
9031
|
-
\u2022
|
|
9196
|
+
\u2022 Base URL: ${baseUrl}
|
|
9197
|
+
\u2022 API Key: ${apiKey ? apiKey.substring(0, 10) + "...***" : "(not set)"}
|
|
9198
|
+
\u2022 Default Model: ${defaultModel}
|
|
9199
|
+
\u2022 Scope: ${scope}
|
|
9032
9200
|
|
|
9033
9201
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
9034
9202
|
\u{1F4A1} Advanced: Environment Variables
|
|
@@ -9036,7 +9204,7 @@ Current settings:
|
|
|
9036
9204
|
|
|
9037
9205
|
You can override config using environment variables:
|
|
9038
9206
|
|
|
9039
|
-
CODEMAP_LLM_GATEWAY_BASE_URL
|
|
9207
|
+
CODEMAP_LLM_GATEWAY_BASE_URL API base URL
|
|
9040
9208
|
CODEMAP_LLM_GATEWAY_API_KEY API key
|
|
9041
9209
|
CODEMAP_LLM_GATEWAY_PLANNER_MODEL Planner model ID
|
|
9042
9210
|
CODEMAP_LLM_GATEWAY_CODER_MODEL Coder model ID
|