claudish 3.7.3 → 3.7.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.
Files changed (2) hide show
  1. package/dist/index.js +56 -12
  2. 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)
@@ -62353,6 +62360,7 @@ ENVIRONMENT VARIABLES:
62353
62360
  GLM_API_KEY Alias for ZHIPU_API_KEY
62354
62361
  OLLAMA_API_KEY OllamaCloud API key (for oc/ prefix)
62355
62362
  ANTHROPIC_API_KEY Placeholder (prevents Claude Code dialog)
62363
+ ANTHROPIC_AUTH_TOKEN Placeholder (prevents Claude Code login screen)
62356
62364
 
62357
62365
  Custom endpoints:
62358
62366
  GEMINI_BASE_URL Custom Gemini endpoint
@@ -62996,8 +63004,8 @@ __export(exports_claude_runner, {
62996
63004
  checkClaudeInstalled: () => checkClaudeInstalled
62997
63005
  });
62998
63006
  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";
63007
+ import { writeFileSync as writeFileSync15, unlinkSync as unlinkSync3, mkdirSync as mkdirSync13, existsSync as existsSync11 } from "node:fs";
63008
+ import { tmpdir as tmpdir2, homedir as homedir13 } from "node:os";
63001
63009
  import { join as join19 } from "node:path";
63002
63010
  function isWindows2() {
63003
63011
  return process.platform === "win32";
@@ -63158,8 +63166,10 @@ async function runClaudeWithProxy(config3, proxyUrl) {
63158
63166
  };
63159
63167
  if (config3.monitor) {
63160
63168
  delete env.ANTHROPIC_API_KEY;
63169
+ delete env.ANTHROPIC_AUTH_TOKEN;
63161
63170
  } else {
63162
63171
  env.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || "sk-ant-api03-placeholder-not-used-proxy-handles-auth-with-openrouter-key-xxxxxxxxxxxxxxxxxxxxx";
63172
+ env.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN || "placeholder-token-not-used-proxy-handles-auth";
63163
63173
  }
63164
63174
  const log2 = (message) => {
63165
63175
  if (!config3.quiet) {
@@ -63176,10 +63186,21 @@ async function runClaudeWithProxy(config3, proxyUrl) {
63176
63186
  log2(`[claudish] Arguments: ${claudeArgs.join(" ")}
63177
63187
  `);
63178
63188
  }
63179
- const proc = spawn("claude", claudeArgs, {
63189
+ const claudeBinary = await findClaudeBinary();
63190
+ if (!claudeBinary) {
63191
+ console.error("Error: Claude Code CLI not found");
63192
+ console.error("Install it from: https://claude.com/claude-code");
63193
+ console.error(`
63194
+ Or set CLAUDE_PATH to your custom installation:`);
63195
+ const home = homedir13();
63196
+ const localPath = isWindows2() ? join19(home, ".claude", "local", "claude.exe") : join19(home, ".claude", "local", "claude");
63197
+ console.error(` export CLAUDE_PATH=${localPath}`);
63198
+ process.exit(1);
63199
+ }
63200
+ const proc = spawn(claudeBinary, claudeArgs, {
63180
63201
  env,
63181
63202
  stdio: "inherit",
63182
- shell: isWindows2()
63203
+ shell: false
63183
63204
  });
63184
63205
  setupSignalHandlers(proc, tempSettingsPath, config3.quiet);
63185
63206
  const exitCode = await new Promise((resolve) => {
@@ -63208,23 +63229,43 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet) {
63208
63229
  });
63209
63230
  }
63210
63231
  }
63211
- async function checkClaudeInstalled() {
63232
+ async function findClaudeBinary() {
63233
+ const isWindows3 = process.platform === "win32";
63234
+ if (process.env.CLAUDE_PATH) {
63235
+ if (existsSync11(process.env.CLAUDE_PATH)) {
63236
+ return process.env.CLAUDE_PATH;
63237
+ }
63238
+ }
63239
+ const home = homedir13();
63240
+ const localPath = isWindows3 ? join19(home, ".claude", "local", "claude.exe") : join19(home, ".claude", "local", "claude");
63241
+ if (existsSync11(localPath)) {
63242
+ return localPath;
63243
+ }
63212
63244
  try {
63213
- const isWindows3 = process.platform === "win32";
63214
63245
  const command = isWindows3 ? "where" : "which";
63215
63246
  const proc = spawn(command, ["claude"], {
63216
- stdio: "ignore",
63247
+ stdio: "pipe",
63217
63248
  shell: isWindows3
63218
63249
  });
63250
+ let output = "";
63251
+ proc.stdout?.on("data", (data) => {
63252
+ output += data.toString();
63253
+ });
63219
63254
  const exitCode = await new Promise((resolve) => {
63220
63255
  proc.on("exit", (code) => {
63221
63256
  resolve(code ?? 1);
63222
63257
  });
63223
63258
  });
63224
- return exitCode === 0;
63225
- } catch {
63226
- return false;
63227
- }
63259
+ if (exitCode === 0 && output.trim()) {
63260
+ return output.trim().split(`
63261
+ `)[0];
63262
+ }
63263
+ } catch {}
63264
+ return null;
63265
+ }
63266
+ async function checkClaudeInstalled() {
63267
+ const binary = await findClaudeBinary();
63268
+ return binary !== null;
63228
63269
  }
63229
63270
  var init_claude_runner = __esm(() => {
63230
63271
  init_dist3();
@@ -63342,8 +63383,11 @@ async function runCli() {
63342
63383
  }
63343
63384
  }
63344
63385
  if (!await checkClaudeInstalled2()) {
63345
- console.error("Error: Claude Code CLI is not installed");
63386
+ console.error("Error: Claude Code CLI not found");
63346
63387
  console.error("Install it from: https://claude.com/claude-code");
63388
+ console.error("");
63389
+ console.error("Or if you have a local installation, set CLAUDE_PATH:");
63390
+ console.error(" export CLAUDE_PATH=~/.claude/local/claude");
63347
63391
  process.exit(1);
63348
63392
  }
63349
63393
  if (cliConfig.interactive && !cliConfig.monitor && !cliConfig.openrouterApiKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "3.7.3",
3
+ "version": "3.7.5",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",