@agent-wechat/cli 0.7.3 → 0.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/cli.js +14 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7904,7 +7904,7 @@ import qrTerminal from "qrcode-terminal";
7904
7904
  import os from "os";
7905
7905
  import path from "path";
7906
7906
  import { fileURLToPath } from "url";
7907
- var VERSION = "0.7.3";
7907
+ var VERSION = "0.7.5";
7908
7908
  var CONTAINER_NAME = "agent-wechat";
7909
7909
  var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
7910
7910
  var DEFAULT_PORT = 6174;
@@ -8441,17 +8441,21 @@ async function cmdUpdate() {
8441
8441
  const arch = uname === "x86_64" ? "amd64" : "arm64";
8442
8442
  const assetName = `agent-server-${version}-linux-${arch}`;
8443
8443
  const tmpFile = path.join(os.tmpdir(), assetName);
8444
+ const releaseUrl = `https://github.com/thisnick/agent-wechat/releases/download/v${version}/${assetName}`;
8444
8445
  console.log(`Downloading ${assetName}...`);
8445
8446
  try {
8446
- execSync(
8447
- `gh release download "v${version}" --repo thisnick/agent-wechat -p "${assetName}" -D "${os.tmpdir()}" --clobber`,
8448
- { stdio: "inherit" }
8449
- );
8450
- } catch {
8447
+ const resp = await fetch(releaseUrl, { redirect: "follow" });
8448
+ if (!resp.ok) {
8449
+ throw new Error(`HTTP ${resp.status}: ${resp.statusText}`);
8450
+ }
8451
+ const buffer = Buffer.from(await resp.arrayBuffer());
8452
+ fs.writeFileSync(tmpFile, buffer, { mode: 493 });
8453
+ } catch (err) {
8451
8454
  console.error(
8452
8455
  `Failed to download ${assetName} from GitHub Releases.
8453
8456
  Make sure v${version} has been released with binary assets.
8454
- You may need to install the GitHub CLI: https://cli.github.com`
8457
+ URL: ${releaseUrl}
8458
+ Error: ${err instanceof Error ? err.message : String(err)}`
8455
8459
  );
8456
8460
  process.exit(1);
8457
8461
  }
@@ -8459,6 +8463,9 @@ You may need to install the GitHub CLI: https://cli.github.com`
8459
8463
  execSync(`docker cp "${tmpFile}" "${container}:/opt/agent-server/agent-server"`, {
8460
8464
  stdio: "inherit"
8461
8465
  });
8466
+ execSync(`docker exec "${container}" chmod +x /opt/agent-server/agent-server`, {
8467
+ stdio: "inherit"
8468
+ });
8462
8469
  execSync(
8463
8470
  `docker exec "${container}" pkill -f "/opt/agent-server/agent-server" 2>/dev/null || true`,
8464
8471
  { stdio: "inherit" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/cli",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wx": "./dist/cli.js"