claudish 7.12.5 → 7.12.6

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 +70 -16
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -581,7 +581,7 @@ var init_onepassword_config = __esm(() => {
581
581
  });
582
582
 
583
583
  // src/version.ts
584
- var VERSION = "7.12.5";
584
+ var VERSION = "7.12.6";
585
585
 
586
586
  // src/logger.ts
587
587
  var exports_logger = {};
@@ -63860,6 +63860,7 @@ var init_cli = __esm(() => {
63860
63860
  // src/update-checker.ts
63861
63861
  var exports_update_checker = {};
63862
63862
  __export(exports_update_checker, {
63863
+ fetchLatestVersionOrThrow: () => fetchLatestVersionOrThrow,
63863
63864
  fetchLatestVersion: () => fetchLatestVersion,
63864
63865
  compareVersions: () => compareVersions,
63865
63866
  clearCache: () => clearCache,
@@ -63932,20 +63933,39 @@ function compareVersions(v1, v2) {
63932
63933
  }
63933
63934
  return 0;
63934
63935
  }
63935
- async function fetchLatestVersion() {
63936
- try {
63936
+ async function fetchLatestVersionOrThrow(options = {}) {
63937
+ const { timeoutMs = 5000, retries = 0 } = options;
63938
+ let lastError = new Error("unknown error");
63939
+ for (let attempt = 0;attempt <= retries; attempt++) {
63937
63940
  const controller = new AbortController;
63938
- const timeout = setTimeout(() => controller.abort(), 5000);
63939
- const response = await fetch(NPM_REGISTRY_URL, {
63940
- signal: controller.signal,
63941
- headers: { Accept: "application/json" }
63942
- });
63943
- clearTimeout(timeout);
63944
- if (!response.ok) {
63945
- return null;
63941
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
63942
+ try {
63943
+ const response = await fetch(NPM_REGISTRY_URL, {
63944
+ signal: controller.signal,
63945
+ headers: { Accept: "application/json" }
63946
+ });
63947
+ if (!response.ok) {
63948
+ throw new Error(`npm registry returned HTTP ${response.status}`);
63949
+ }
63950
+ const data = await response.json();
63951
+ if (!data.version) {
63952
+ throw new Error("npm registry response contained no version field");
63953
+ }
63954
+ return data.version;
63955
+ } catch (error46) {
63956
+ lastError = error46 instanceof Error && error46.name === "AbortError" ? new Error(`request timed out after ${timeoutMs}ms`) : error46 instanceof Error ? error46 : new Error(String(error46));
63957
+ if (attempt < retries) {
63958
+ await new Promise((resolve3) => setTimeout(resolve3, 300 * (attempt + 1)));
63959
+ }
63960
+ } finally {
63961
+ clearTimeout(timeout);
63946
63962
  }
63947
- const data = await response.json();
63948
- return data.version || null;
63963
+ }
63964
+ throw lastError;
63965
+ }
63966
+ async function fetchLatestVersion(options = {}) {
63967
+ try {
63968
+ return await fetchLatestVersionOrThrow(options);
63949
63969
  } catch {
63950
63970
  return null;
63951
63971
  }
@@ -64146,16 +64166,50 @@ ${BOLD2}Unable to detect installation method.${RESET2}`);
64146
64166
  console.log(` ${CYAN2}brew:${RESET2} brew upgrade claudish
64147
64167
  `);
64148
64168
  }
64169
+ function fetchLatestVersionViaNpm() {
64170
+ try {
64171
+ const output = execSync("npm view claudish version", {
64172
+ encoding: "utf-8",
64173
+ timeout: 20000,
64174
+ stdio: ["ignore", "pipe", "ignore"]
64175
+ });
64176
+ const version2 = output.trim();
64177
+ return /^\d+\.\d+\.\d+/.test(version2) ? version2 : null;
64178
+ } catch {
64179
+ return null;
64180
+ }
64181
+ }
64182
+ async function resolveLatestVersion() {
64183
+ let fetchError;
64184
+ try {
64185
+ return { version: await fetchLatestVersionOrThrow({ timeoutMs: 15000, retries: 2 }) };
64186
+ } catch (error46) {
64187
+ fetchError = error46 instanceof Error ? error46.message : String(error46);
64188
+ }
64189
+ const viaNpm = fetchLatestVersionViaNpm();
64190
+ if (viaNpm)
64191
+ return { version: viaNpm };
64192
+ return { error: fetchError };
64193
+ }
64149
64194
  async function updateCommand() {
64150
64195
  const currentVersion = getVersion3();
64151
64196
  const installInfo = detectInstallationMethod();
64152
- const latestVersion = await fetchLatestVersion();
64153
- if (!latestVersion) {
64197
+ const result = await resolveLatestVersion();
64198
+ if ("error" in result) {
64154
64199
  console.error(`${RED2}\u2717${RESET2} Unable to fetch latest version from npm registry.`);
64155
- console.error(`${YELLOW}Please check your internet connection and try again.${RESET2}
64200
+ console.error(`${DIM2}Reason: ${result.error}${RESET2}`);
64201
+ console.error(`${YELLOW}The npm registry may be slow or unreachable from this network.${RESET2}`);
64202
+ const manualCommand = getUpdateCommand(installInfo.method);
64203
+ if (manualCommand) {
64204
+ console.error(`${YELLOW}You can update manually:${RESET2}`);
64205
+ console.error(` ${CYAN2}${manualCommand}${RESET2}
64156
64206
  `);
64207
+ } else {
64208
+ printManualInstructions();
64209
+ }
64157
64210
  process.exit(1);
64158
64211
  }
64212
+ const latestVersion = result.version;
64159
64213
  const comparison = compareVersions(latestVersion, currentVersion);
64160
64214
  if (comparison <= 0) {
64161
64215
  console.log(`${GREEN2}\u2713${RESET2} ${BOLD2}Already up-to-date!${RESET2}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "7.12.5",
3
+ "version": "7.12.6",
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",
@@ -60,10 +60,10 @@
60
60
  "ai"
61
61
  ],
62
62
  "optionalDependencies": {
63
- "@claudish/magmux-darwin-arm64": "7.12.5",
64
- "@claudish/magmux-darwin-x64": "7.12.5",
65
- "@claudish/magmux-linux-arm64": "7.12.5",
66
- "@claudish/magmux-linux-x64": "7.12.5"
63
+ "@claudish/magmux-darwin-arm64": "7.12.6",
64
+ "@claudish/magmux-darwin-x64": "7.12.6",
65
+ "@claudish/magmux-linux-arm64": "7.12.6",
66
+ "@claudish/magmux-linux-x64": "7.12.6"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",