claudish 3.7.3 → 3.7.4
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 +53 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62339,6 +62339,13 @@ NOTES:
|
|
|
62339
62339
|
ENVIRONMENT VARIABLES:
|
|
62340
62340
|
Claudish automatically loads .env file from current directory.
|
|
62341
62341
|
|
|
62342
|
+
Claude Code installation:
|
|
62343
|
+
CLAUDE_PATH Custom path to Claude Code binary (optional)
|
|
62344
|
+
Default search order:
|
|
62345
|
+
1. CLAUDE_PATH env var
|
|
62346
|
+
2. ~/.claude/local/claude (local install)
|
|
62347
|
+
3. Global PATH (npm -g install)
|
|
62348
|
+
|
|
62342
62349
|
API Keys (at least one required for cloud models):
|
|
62343
62350
|
OPENROUTER_API_KEY OpenRouter API key (default backend)
|
|
62344
62351
|
GEMINI_API_KEY Google Gemini API key (for g/ prefix)
|
|
@@ -62996,8 +63003,8 @@ __export(exports_claude_runner, {
|
|
|
62996
63003
|
checkClaudeInstalled: () => checkClaudeInstalled
|
|
62997
63004
|
});
|
|
62998
63005
|
import { spawn } from "node:child_process";
|
|
62999
|
-
import { writeFileSync as writeFileSync15, unlinkSync as unlinkSync3, mkdirSync as mkdirSync13 } from "node:fs";
|
|
63000
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
63006
|
+
import { writeFileSync as writeFileSync15, unlinkSync as unlinkSync3, mkdirSync as mkdirSync13, existsSync as existsSync11 } from "node:fs";
|
|
63007
|
+
import { tmpdir as tmpdir2, homedir as homedir13 } from "node:os";
|
|
63001
63008
|
import { join as join19 } from "node:path";
|
|
63002
63009
|
function isWindows2() {
|
|
63003
63010
|
return process.platform === "win32";
|
|
@@ -63176,10 +63183,21 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
63176
63183
|
log2(`[claudish] Arguments: ${claudeArgs.join(" ")}
|
|
63177
63184
|
`);
|
|
63178
63185
|
}
|
|
63179
|
-
const
|
|
63186
|
+
const claudeBinary = await findClaudeBinary();
|
|
63187
|
+
if (!claudeBinary) {
|
|
63188
|
+
console.error("Error: Claude Code CLI not found");
|
|
63189
|
+
console.error("Install it from: https://claude.com/claude-code");
|
|
63190
|
+
console.error(`
|
|
63191
|
+
Or set CLAUDE_PATH to your custom installation:`);
|
|
63192
|
+
const home = homedir13();
|
|
63193
|
+
const localPath = isWindows2() ? join19(home, ".claude", "local", "claude.exe") : join19(home, ".claude", "local", "claude");
|
|
63194
|
+
console.error(` export CLAUDE_PATH=${localPath}`);
|
|
63195
|
+
process.exit(1);
|
|
63196
|
+
}
|
|
63197
|
+
const proc = spawn(claudeBinary, claudeArgs, {
|
|
63180
63198
|
env,
|
|
63181
63199
|
stdio: "inherit",
|
|
63182
|
-
shell:
|
|
63200
|
+
shell: false
|
|
63183
63201
|
});
|
|
63184
63202
|
setupSignalHandlers(proc, tempSettingsPath, config3.quiet);
|
|
63185
63203
|
const exitCode = await new Promise((resolve) => {
|
|
@@ -63208,23 +63226,43 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet) {
|
|
|
63208
63226
|
});
|
|
63209
63227
|
}
|
|
63210
63228
|
}
|
|
63211
|
-
async function
|
|
63229
|
+
async function findClaudeBinary() {
|
|
63230
|
+
const isWindows3 = process.platform === "win32";
|
|
63231
|
+
if (process.env.CLAUDE_PATH) {
|
|
63232
|
+
if (existsSync11(process.env.CLAUDE_PATH)) {
|
|
63233
|
+
return process.env.CLAUDE_PATH;
|
|
63234
|
+
}
|
|
63235
|
+
}
|
|
63236
|
+
const home = homedir13();
|
|
63237
|
+
const localPath = isWindows3 ? join19(home, ".claude", "local", "claude.exe") : join19(home, ".claude", "local", "claude");
|
|
63238
|
+
if (existsSync11(localPath)) {
|
|
63239
|
+
return localPath;
|
|
63240
|
+
}
|
|
63212
63241
|
try {
|
|
63213
|
-
const isWindows3 = process.platform === "win32";
|
|
63214
63242
|
const command = isWindows3 ? "where" : "which";
|
|
63215
63243
|
const proc = spawn(command, ["claude"], {
|
|
63216
|
-
stdio: "
|
|
63244
|
+
stdio: "pipe",
|
|
63217
63245
|
shell: isWindows3
|
|
63218
63246
|
});
|
|
63247
|
+
let output = "";
|
|
63248
|
+
proc.stdout?.on("data", (data) => {
|
|
63249
|
+
output += data.toString();
|
|
63250
|
+
});
|
|
63219
63251
|
const exitCode = await new Promise((resolve) => {
|
|
63220
63252
|
proc.on("exit", (code) => {
|
|
63221
63253
|
resolve(code ?? 1);
|
|
63222
63254
|
});
|
|
63223
63255
|
});
|
|
63224
|
-
|
|
63225
|
-
|
|
63226
|
-
|
|
63227
|
-
|
|
63256
|
+
if (exitCode === 0 && output.trim()) {
|
|
63257
|
+
return output.trim().split(`
|
|
63258
|
+
`)[0];
|
|
63259
|
+
}
|
|
63260
|
+
} catch {}
|
|
63261
|
+
return null;
|
|
63262
|
+
}
|
|
63263
|
+
async function checkClaudeInstalled() {
|
|
63264
|
+
const binary = await findClaudeBinary();
|
|
63265
|
+
return binary !== null;
|
|
63228
63266
|
}
|
|
63229
63267
|
var init_claude_runner = __esm(() => {
|
|
63230
63268
|
init_dist3();
|
|
@@ -63342,8 +63380,11 @@ async function runCli() {
|
|
|
63342
63380
|
}
|
|
63343
63381
|
}
|
|
63344
63382
|
if (!await checkClaudeInstalled2()) {
|
|
63345
|
-
console.error("Error: Claude Code CLI
|
|
63383
|
+
console.error("Error: Claude Code CLI not found");
|
|
63346
63384
|
console.error("Install it from: https://claude.com/claude-code");
|
|
63385
|
+
console.error("");
|
|
63386
|
+
console.error("Or if you have a local installation, set CLAUDE_PATH:");
|
|
63387
|
+
console.error(" export CLAUDE_PATH=~/.claude/local/claude");
|
|
63347
63388
|
process.exit(1);
|
|
63348
63389
|
}
|
|
63349
63390
|
if (cliConfig.interactive && !cliConfig.monitor && !cliConfig.openrouterApiKey) {
|