claudish 3.7.7 → 3.7.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/dist/index.js +44 -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,31 @@ 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
|
-
|
|
61802
|
-
|
|
61803
|
-
|
|
61804
|
-
|
|
61805
|
-
|
|
61806
|
-
|
|
61807
|
-
|
|
61808
|
-
|
|
61815
|
+
const allModels = [
|
|
61816
|
+
config3.model,
|
|
61817
|
+
config3.modelOpus,
|
|
61818
|
+
config3.modelSonnet,
|
|
61819
|
+
config3.modelHaiku,
|
|
61820
|
+
config3.modelSubagent
|
|
61821
|
+
];
|
|
61822
|
+
const hasNonLocalModel = allModels.some((m) => m && !isLocalModel(m));
|
|
61823
|
+
if (hasNonLocalModel) {
|
|
61824
|
+
const apiKey = process.env[ENV.OPENROUTER_API_KEY];
|
|
61825
|
+
if (!apiKey) {
|
|
61826
|
+
if (!config3.interactive) {
|
|
61827
|
+
console.error("Error: OPENROUTER_API_KEY environment variable is required");
|
|
61828
|
+
console.error("Get your API key from: https://openrouter.ai/keys");
|
|
61829
|
+
console.error("");
|
|
61830
|
+
console.error("Set it now:");
|
|
61831
|
+
console.error(" export OPENROUTER_API_KEY='sk-or-v1-...'");
|
|
61832
|
+
process.exit(1);
|
|
61833
|
+
}
|
|
61834
|
+
config3.openrouterApiKey = undefined;
|
|
61835
|
+
} else {
|
|
61836
|
+
config3.openrouterApiKey = apiKey;
|
|
61809
61837
|
}
|
|
61810
|
-
config3.openrouterApiKey = undefined;
|
|
61811
61838
|
} else {
|
|
61812
|
-
config3.openrouterApiKey =
|
|
61839
|
+
config3.openrouterApiKey = process.env[ENV.OPENROUTER_API_KEY];
|
|
61813
61840
|
}
|
|
61814
61841
|
config3.anthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
61815
61842
|
}
|
|
@@ -62664,7 +62691,7 @@ function printAvailableModelsJSON() {
|
|
|
62664
62691
|
console.log(JSON.stringify(output, null, 2));
|
|
62665
62692
|
}
|
|
62666
62693
|
}
|
|
62667
|
-
var __filename6, __dirname6, VERSION = "3.7.
|
|
62694
|
+
var __filename6, __dirname6, VERSION = "3.7.9", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, ALL_MODELS_JSON_PATH2;
|
|
62668
62695
|
var init_cli = __esm(() => {
|
|
62669
62696
|
init_dist3();
|
|
62670
62697
|
init_model_loader2();
|
|
@@ -63155,12 +63182,12 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
63155
63182
|
claudeArgs.push(...config3.claudeArgs);
|
|
63156
63183
|
}
|
|
63157
63184
|
}
|
|
63158
|
-
const
|
|
63185
|
+
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
63186
|
const env = {
|
|
63160
63187
|
...process.env,
|
|
63161
63188
|
ANTHROPIC_BASE_URL: proxyUrl,
|
|
63162
63189
|
[ENV.CLAUDISH_ACTIVE_MODEL_NAME]: modelId,
|
|
63163
|
-
CLAUDISH_IS_LOCAL:
|
|
63190
|
+
CLAUDISH_IS_LOCAL: isLocalModel2 ? "true" : "false",
|
|
63164
63191
|
[ENV.ANTHROPIC_MODEL]: modelId,
|
|
63165
63192
|
[ENV.ANTHROPIC_SMALL_FAST_MODEL]: modelId
|
|
63166
63193
|
};
|
|
@@ -63404,7 +63431,9 @@ async function runCli() {
|
|
|
63404
63431
|
console.error(" export CLAUDE_PATH=~/.claude/local/claude");
|
|
63405
63432
|
process.exit(1);
|
|
63406
63433
|
}
|
|
63407
|
-
|
|
63434
|
+
const { isLocalModel: isLocalModel2 } = await Promise.resolve().then(() => (init_cli(), exports_cli));
|
|
63435
|
+
const usingLocalModel = isLocalModel2(cliConfig.model);
|
|
63436
|
+
if (cliConfig.interactive && !cliConfig.monitor && !cliConfig.openrouterApiKey && !usingLocalModel) {
|
|
63408
63437
|
cliConfig.openrouterApiKey = await promptForApiKey2();
|
|
63409
63438
|
console.log("");
|
|
63410
63439
|
}
|