claudish 3.7.7 → 3.7.8
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/index.js +37 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61609,6 +61609,7 @@ function fuzzyScore2(text, query) {
|
|
|
61609
61609
|
var exports_cli = {};
|
|
61610
61610
|
__export(exports_cli, {
|
|
61611
61611
|
parseArgs: () => parseArgs,
|
|
61612
|
+
isLocalModel: () => isLocalModel,
|
|
61612
61613
|
getVersion: () => getVersion
|
|
61613
61614
|
});
|
|
61614
61615
|
import { readFileSync as readFileSync7, writeFileSync as writeFileSync13, existsSync as existsSync9, mkdirSync as mkdirSync11, copyFileSync } from "node:fs";
|
|
@@ -61617,6 +61618,20 @@ import { dirname as dirname5, join as join17 } from "node:path";
|
|
|
61617
61618
|
function getVersion() {
|
|
61618
61619
|
return VERSION;
|
|
61619
61620
|
}
|
|
61621
|
+
function isLocalModel(modelId) {
|
|
61622
|
+
if (!modelId)
|
|
61623
|
+
return false;
|
|
61624
|
+
const localPrefixes = [
|
|
61625
|
+
"ollama/",
|
|
61626
|
+
"ollama:",
|
|
61627
|
+
"lmstudio/",
|
|
61628
|
+
"vllm/",
|
|
61629
|
+
"mlx/",
|
|
61630
|
+
"http://",
|
|
61631
|
+
"https://localhost"
|
|
61632
|
+
];
|
|
61633
|
+
return localPrefixes.some((prefix) => modelId.toLowerCase().startsWith(prefix));
|
|
61634
|
+
}
|
|
61620
61635
|
async function parseArgs(args) {
|
|
61621
61636
|
const config3 = {
|
|
61622
61637
|
model: undefined,
|
|
@@ -61797,19 +61812,24 @@ async function parseArgs(args) {
|
|
|
61797
61812
|
console.log("[claudish] Ensure you are logged in to Claude Code (claude auth login)");
|
|
61798
61813
|
}
|
|
61799
61814
|
} else {
|
|
61800
|
-
const
|
|
61801
|
-
if (!
|
|
61802
|
-
|
|
61803
|
-
|
|
61804
|
-
|
|
61805
|
-
|
|
61806
|
-
|
|
61807
|
-
|
|
61808
|
-
|
|
61815
|
+
const usingLocalModel = isLocalModel(config3.model);
|
|
61816
|
+
if (!usingLocalModel) {
|
|
61817
|
+
const apiKey = process.env[ENV.OPENROUTER_API_KEY];
|
|
61818
|
+
if (!apiKey) {
|
|
61819
|
+
if (!config3.interactive) {
|
|
61820
|
+
console.error("Error: OPENROUTER_API_KEY environment variable is required");
|
|
61821
|
+
console.error("Get your API key from: https://openrouter.ai/keys");
|
|
61822
|
+
console.error("");
|
|
61823
|
+
console.error("Set it now:");
|
|
61824
|
+
console.error(" export OPENROUTER_API_KEY='sk-or-v1-...'");
|
|
61825
|
+
process.exit(1);
|
|
61826
|
+
}
|
|
61827
|
+
config3.openrouterApiKey = undefined;
|
|
61828
|
+
} else {
|
|
61829
|
+
config3.openrouterApiKey = apiKey;
|
|
61809
61830
|
}
|
|
61810
|
-
config3.openrouterApiKey = undefined;
|
|
61811
61831
|
} else {
|
|
61812
|
-
config3.openrouterApiKey =
|
|
61832
|
+
config3.openrouterApiKey = process.env[ENV.OPENROUTER_API_KEY];
|
|
61813
61833
|
}
|
|
61814
61834
|
config3.anthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
61815
61835
|
}
|
|
@@ -62664,7 +62684,7 @@ function printAvailableModelsJSON() {
|
|
|
62664
62684
|
console.log(JSON.stringify(output, null, 2));
|
|
62665
62685
|
}
|
|
62666
62686
|
}
|
|
62667
|
-
var __filename6, __dirname6, VERSION = "3.7.
|
|
62687
|
+
var __filename6, __dirname6, VERSION = "3.7.8", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, ALL_MODELS_JSON_PATH2;
|
|
62668
62688
|
var init_cli = __esm(() => {
|
|
62669
62689
|
init_dist3();
|
|
62670
62690
|
init_model_loader2();
|
|
@@ -63155,12 +63175,12 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
63155
63175
|
claudeArgs.push(...config3.claudeArgs);
|
|
63156
63176
|
}
|
|
63157
63177
|
}
|
|
63158
|
-
const
|
|
63178
|
+
const isLocalModel2 = modelId.startsWith("ollama/") || modelId.startsWith("ollama:") || modelId.startsWith("lmstudio/") || modelId.startsWith("lmstudio:") || modelId.startsWith("vllm/") || modelId.startsWith("vllm:") || modelId.startsWith("mlx/") || modelId.startsWith("mlx:") || modelId.startsWith("http://") || modelId.startsWith("https://");
|
|
63159
63179
|
const env = {
|
|
63160
63180
|
...process.env,
|
|
63161
63181
|
ANTHROPIC_BASE_URL: proxyUrl,
|
|
63162
63182
|
[ENV.CLAUDISH_ACTIVE_MODEL_NAME]: modelId,
|
|
63163
|
-
CLAUDISH_IS_LOCAL:
|
|
63183
|
+
CLAUDISH_IS_LOCAL: isLocalModel2 ? "true" : "false",
|
|
63164
63184
|
[ENV.ANTHROPIC_MODEL]: modelId,
|
|
63165
63185
|
[ENV.ANTHROPIC_SMALL_FAST_MODEL]: modelId
|
|
63166
63186
|
};
|
|
@@ -63404,7 +63424,9 @@ async function runCli() {
|
|
|
63404
63424
|
console.error(" export CLAUDE_PATH=~/.claude/local/claude");
|
|
63405
63425
|
process.exit(1);
|
|
63406
63426
|
}
|
|
63407
|
-
|
|
63427
|
+
const { isLocalModel: isLocalModel2 } = await Promise.resolve().then(() => (init_cli(), exports_cli));
|
|
63428
|
+
const usingLocalModel = isLocalModel2(cliConfig.model);
|
|
63429
|
+
if (cliConfig.interactive && !cliConfig.monitor && !cliConfig.openrouterApiKey && !usingLocalModel) {
|
|
63408
63430
|
cliConfig.openrouterApiKey = await promptForApiKey2();
|
|
63409
63431
|
console.log("");
|
|
63410
63432
|
}
|