@simonyea/holysheep-cli 2.1.47 → 2.1.49

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.
@@ -3993,11 +3993,11 @@ var require_package = __commonJS({
3993
3993
  "package.json"(exports2, module2) {
3994
3994
  module2.exports = {
3995
3995
  name: "@simonyea/holysheep-cli",
3996
- version: "2.1.47",
3996
+ version: "2.1.49",
3997
3997
  description: "Claude Code/Cursor/Cline API relay for China \u2014 \xA51=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
3998
3998
  scripts: {
3999
3999
  build: "node scripts/build.mjs",
4000
- test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js",
4000
+ test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
4001
4001
  prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
4002
4002
  },
4003
4003
  keywords: [
package/dist/index.js CHANGED
@@ -12,11 +12,11 @@ var require_package = __commonJS({
12
12
  "package.json"(exports2, module2) {
13
13
  module2.exports = {
14
14
  name: "@simonyea/holysheep-cli",
15
- version: "2.1.47",
15
+ version: "2.1.49",
16
16
  description: "Claude Code/Cursor/Cline API relay for China \u2014 \xA51=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
17
17
  scripts: {
18
18
  build: "node scripts/build.mjs",
19
- test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js",
19
+ test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
20
20
  prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
21
21
  },
22
22
  keywords: [
@@ -5878,6 +5878,123 @@ var require_openclaw2 = __commonJS({
5878
5878
  }
5879
5879
  });
5880
5880
 
5881
+ // src/utils/version-check.js
5882
+ var require_version_check = __commonJS({
5883
+ "src/utils/version-check.js"(exports2, module2) {
5884
+ "use strict";
5885
+ var fs = require("fs");
5886
+ var os = require("os");
5887
+ var path = require("path");
5888
+ var { exec } = require("child_process");
5889
+ var chalk2 = require("chalk");
5890
+ var PACKAGE_NAME = "@simonyea/holysheep-cli";
5891
+ var CACHE_PATH = path.join(os.homedir(), ".holysheep", "last-version-check.json");
5892
+ var CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
5893
+ var NPM_VIEW_TIMEOUT_MS = 3e3;
5894
+ function parseSemver(v) {
5895
+ if (!v || typeof v !== "string") return null;
5896
+ const m = v.trim().replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
5897
+ if (!m) return null;
5898
+ return [Number(m[1]), Number(m[2]), Number(m[3])];
5899
+ }
5900
+ __name(parseSemver, "parseSemver");
5901
+ function compareSemver(a, b) {
5902
+ const pa = parseSemver(a);
5903
+ const pb = parseSemver(b);
5904
+ if (!pa || !pb) return 0;
5905
+ for (let i = 0; i < 3; i++) {
5906
+ if (pa[i] !== pb[i]) return pa[i] - pb[i];
5907
+ }
5908
+ return 0;
5909
+ }
5910
+ __name(compareSemver, "compareSemver");
5911
+ function readCache() {
5912
+ try {
5913
+ const raw = fs.readFileSync(CACHE_PATH, "utf8");
5914
+ const j = JSON.parse(raw);
5915
+ if (j && typeof j.ts === "number" && typeof j.remote === "string") return j;
5916
+ } catch {
5917
+ }
5918
+ return null;
5919
+ }
5920
+ __name(readCache, "readCache");
5921
+ function writeCache(remote) {
5922
+ try {
5923
+ const dir = path.dirname(CACHE_PATH);
5924
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
5925
+ fs.writeFileSync(CACHE_PATH, JSON.stringify({ ts: Date.now(), remote }) + "\n", { mode: 384 });
5926
+ } catch {
5927
+ }
5928
+ }
5929
+ __name(writeCache, "writeCache");
5930
+ function fetchLatestFromNpm() {
5931
+ return new Promise((resolve) => {
5932
+ const p = exec(
5933
+ `npm view ${PACKAGE_NAME} version --silent`,
5934
+ { timeout: NPM_VIEW_TIMEOUT_MS, windowsHide: true },
5935
+ (err, stdout) => {
5936
+ if (err) return resolve(null);
5937
+ const ver = String(stdout || "").trim();
5938
+ if (parseSemver(ver)) resolve(ver);
5939
+ else resolve(null);
5940
+ }
5941
+ );
5942
+ setTimeout(() => {
5943
+ try {
5944
+ p.kill("SIGKILL");
5945
+ } catch {
5946
+ }
5947
+ resolve(null);
5948
+ }, NPM_VIEW_TIMEOUT_MS + 500);
5949
+ });
5950
+ }
5951
+ __name(fetchLatestFromNpm, "fetchLatestFromNpm");
5952
+ function printBanner2(localVersion, remoteVersion) {
5953
+ const line = "\u2501".repeat(54);
5954
+ console.log();
5955
+ console.log(chalk2.yellow(line));
5956
+ console.log(chalk2.yellow.bold(`\u26A0 HolySheep CLI \u6709\u65B0\u7248\u672C: ${localVersion} \u2192 ${remoteVersion}`));
5957
+ console.log(chalk2.yellow(" \u542B\u5173\u952E\u4FEE\u590D\uFF08\u542B Windows aionui Claude 403 \u8BA4\u8BC1\u4FEE\u590D\uFF09"));
5958
+ console.log(chalk2.yellow.bold(" \u5347\u7EA7\u547D\u4EE4: ") + chalk2.cyan.bold(`npm i -g ${PACKAGE_NAME}@latest`));
5959
+ console.log(chalk2.gray(" \u8DF3\u8FC7\u6B64\u68C0\u67E5: HOLYSHEEP_SKIP_VERSION_CHECK=1"));
5960
+ console.log(chalk2.yellow(line));
5961
+ console.log();
5962
+ }
5963
+ __name(printBanner2, "printBanner");
5964
+ function scheduleUpgradeBannerCheck({ localVersion }) {
5965
+ if (process.env.HOLYSHEEP_SKIP_VERSION_CHECK === "1") return;
5966
+ if (!parseSemver(localVersion)) return;
5967
+ (async () => {
5968
+ try {
5969
+ const cached = readCache();
5970
+ const now = Date.now();
5971
+ let remote = null;
5972
+ if (cached && now - cached.ts < CACHE_TTL_MS && parseSemver(cached.remote)) {
5973
+ remote = cached.remote;
5974
+ } else {
5975
+ remote = await fetchLatestFromNpm();
5976
+ if (remote) writeCache(remote);
5977
+ }
5978
+ if (!remote) return;
5979
+ if (compareSemver(remote, localVersion) > 0) {
5980
+ printBanner2(localVersion, remote);
5981
+ }
5982
+ } catch {
5983
+ }
5984
+ })();
5985
+ }
5986
+ __name(scheduleUpgradeBannerCheck, "scheduleUpgradeBannerCheck");
5987
+ module2.exports = {
5988
+ scheduleUpgradeBannerCheck,
5989
+ // exported for tests
5990
+ _parseSemver: parseSemver,
5991
+ _compareSemver: compareSemver,
5992
+ CACHE_PATH,
5993
+ CACHE_TTL_MS
5994
+ };
5995
+ }
5996
+ });
5997
+
5881
5998
  // src/webui/aionui-runtime-fetcher.js
5882
5999
  var require_aionui_runtime_fetcher = __commonJS({
5883
6000
  "src/webui/aionui-runtime-fetcher.js"(exports2, module2) {
@@ -5890,9 +6007,9 @@ var require_aionui_runtime_fetcher = __commonJS({
5890
6007
  var http = require("http");
5891
6008
  var USER_CACHE_DIR = path.join(os.homedir(), ".holysheep", "aionui-runtime");
5892
6009
  var VENDOR_DIR = path.join(__dirname, "vendor", "aionui");
5893
- var DEFAULT_RUNTIME_URL = "https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep-hs34.tar.gz";
5894
- var DEFAULT_RUNTIME_SHA256 = "5f656f6c049c935a26b76a70539147e7af17325817fe539a65ca46315590ecb1";
5895
- var DEFAULT_RUNTIME_VERSION = "1.9.18-holysheep-hs34";
6010
+ var DEFAULT_RUNTIME_URL = "https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep-hs35.tar.gz";
6011
+ var DEFAULT_RUNTIME_SHA256 = "8f0378f8e15d7668429b02e196877e93d8b773055ce6953d83f9b2567b493a99";
6012
+ var DEFAULT_RUNTIME_VERSION = "1.9.18-holysheep-hs35";
5896
6013
  function isValidRuntimeDir(dir) {
5897
6014
  if (!dir) return false;
5898
6015
  try {
@@ -6897,13 +7014,30 @@ var require_claude = __commonJS({
6897
7014
  if (!apiKey) {
6898
7015
  throw new Error("Missing API Key. Run hs setup first.");
6899
7016
  }
7017
+ try {
7018
+ const { scheduleUpgradeBannerCheck } = require_version_check();
7019
+ const pkg2 = require_package();
7020
+ scheduleUpgradeBannerCheck({ localVersion: pkg2.version });
7021
+ } catch {
7022
+ }
6900
7023
  ensureClaudeProxyConfig(apiKey);
7024
+ const runtime = typeof claudeCodeTool.detectClaudeRuntime === "function" ? claudeCodeTool.detectClaudeRuntime() : { kind: "unknown", launchMode: "env-proxy" };
7025
+ if (runtime.kind === "missing") {
7026
+ const installCmd = process.platform === "win32" ? "irm https://claude.ai/install.ps1 | iex" : "curl -fsSL https://claude.ai/install.sh | bash";
7027
+ const err = new Error(
7028
+ `\u672A\u627E\u5230 claude \u547D\u4EE4 \u2014 Claude Code \u5C1A\u672A\u5B89\u88C5\u3002
7029
+ \u8BF7\u5148\u8FD0\u884C: ${installCmd}
7030
+ \u5B89\u88C5\u540E\u91CD\u5F00\u7EC8\u7AEF\u518D\u6267\u884C hs claude\u3002`
7031
+ );
7032
+ err.code = "CLAUDE_NOT_INSTALLED";
7033
+ err.exitCode = 127;
7034
+ throw err;
7035
+ }
6901
7036
  const settings = claudeCodeTool.readSettings();
6902
7037
  if ((_a = settings.env) == null ? void 0 : _a.ANTHROPIC_BASE_URL) {
6903
7038
  delete settings.env.ANTHROPIC_BASE_URL;
6904
7039
  claudeCodeTool.writeSettings(settings);
6905
7040
  }
6906
- const runtime = typeof claudeCodeTool.detectClaudeRuntime === "function" ? claudeCodeTool.detectClaudeRuntime() : { kind: "unknown", launchMode: "env-proxy" };
6907
7041
  const { server, port, sessionId } = await startProcessProxy({});
6908
7042
  const proxyUrl = getLocalProxyUrl(port);
6909
7043
  const launchMode = runtime.launchMode === "node-inject" ? "local-api + connect-fallback + node-inject" : "whole-process-proxy + local-api";
@@ -9502,6 +9636,7 @@ var require_webui = __commonJS({
9502
9636
  var fs = require("fs");
9503
9637
  var path = require("path");
9504
9638
  var http = require("http");
9639
+ var { scheduleUpgradeBannerCheck } = require_version_check();
9505
9640
  function isLegacy(opts) {
9506
9641
  return process.env.HOLYSHEEP_WEBUI_LEGACY === "1";
9507
9642
  }
@@ -9855,6 +9990,11 @@ var require_webui = __commonJS({
9855
9990
  console.log(chalk2.bold("\u{1F310} HolySheep WebUI"));
9856
9991
  console.log(chalk2.gray("\u2501".repeat(50)));
9857
9992
  console.log();
9993
+ try {
9994
+ const pkg2 = require_package();
9995
+ scheduleUpgradeBannerCheck({ localVersion: pkg2.version });
9996
+ } catch {
9997
+ }
9858
9998
  try {
9859
9999
  if (isLegacy(opts) && !opts.aionui) {
9860
10000
  console.log(chalk2.gray(`[mode=legacy platform=${process.platform}]`));
@@ -9984,8 +10124,20 @@ program.command("web").alias("webui").description("\u542F\u52A8 HolySheep WebUI
9984
10124
  });
9985
10125
  program.command("claude [args...]").allowUnknownOption(true).passThroughOptions().description("\u901A\u8FC7 HolySheep \u6574\u8FDB\u7A0B\u4EE3\u7406\u542F\u52A8 Claude Code").action(async (args = []) => {
9986
10126
  const runClaude = require_claude();
9987
- const code = await runClaude(args);
9988
- process.exit(code);
10127
+ try {
10128
+ const code = await runClaude(args);
10129
+ process.exit(code);
10130
+ } catch (err) {
10131
+ const knownCodes = /* @__PURE__ */ new Set(["CLAUDE_NOT_INSTALLED"]);
10132
+ if (err && knownCodes.has(err.code)) {
10133
+ process.stderr.write(`
10134
+ ${err.message}
10135
+
10136
+ `);
10137
+ process.exit(typeof err.exitCode === "number" ? err.exitCode : 1);
10138
+ }
10139
+ throw err;
10140
+ }
9989
10141
  });
9990
10142
  program.command("claude-proxy [args...]").allowUnknownOption(true).description("\u542F\u52A8 Claude \u4EE3\u7406\u670D\u52A1\uFF08\u8BA9 VS Code Claude \u6269\u5C55\u4E5F\u80FD\u7528 HolySheep\uFF09").action(async (args = []) => {
9991
10143
  const claudeProxy = require_claude_proxy();
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "2.1.47",
3
+ "version": "2.1.49",
4
4
  "description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.mjs",
7
- "test": "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js",
7
+ "test": "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
8
8
  "prepublishOnly": "npm run build && npm test && node scripts/check-tarball-size.js"
9
9
  },
10
10
  "keywords": [