@agent-wechat/cli 0.2.1 → 0.2.2

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 +17 -5
  2. package/package.json +2 -2
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.1.0";
7907
+ var VERSION = "0.2.2";
7908
7908
  var CONTAINER_NAME = "agent-wechat";
7909
7909
  var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
7910
7910
  var DEFAULT_PORT = 6174;
@@ -7940,7 +7940,7 @@ function getConfig() {
7940
7940
  };
7941
7941
  }
7942
7942
  function getImageTag() {
7943
- return `${GHCR_IMAGE}:latest`;
7943
+ return `${GHCR_IMAGE}:${VERSION}`;
7944
7944
  }
7945
7945
  var program2 = new Command();
7946
7946
  program2.name("wx").description("WeChat automation CLI").version(VERSION).option("-s, --session <name>", "Use specified session", "default");
@@ -8415,7 +8415,7 @@ async function cmdSessionDelete(client, idOrName) {
8415
8415
  }
8416
8416
  }
8417
8417
  async function cmdUp() {
8418
- const image = getImageTag();
8418
+ let image = getImageTag();
8419
8419
  try {
8420
8420
  const existingId = execSync(`docker ps -aq -f "name=^${CONTAINER_NAME}$"`, { encoding: "utf-8" }).trim();
8421
8421
  if (existingId) {
@@ -8441,8 +8441,20 @@ async function cmdUp() {
8441
8441
  try {
8442
8442
  execSync(`docker pull ${image}`, { stdio: "inherit" });
8443
8443
  } catch {
8444
- console.error(`Failed to pull ${image}. Check your internet connection and Docker setup.`);
8445
- process.exit(1);
8444
+ const fallback = `${GHCR_IMAGE}:latest`;
8445
+ if (image !== fallback) {
8446
+ console.log(`Tag ${VERSION} not found, trying latest...`);
8447
+ try {
8448
+ execSync(`docker pull ${fallback}`, { stdio: "inherit" });
8449
+ image = fallback;
8450
+ } catch {
8451
+ console.error(`Failed to pull ${fallback}. Check your internet connection and Docker setup.`);
8452
+ process.exit(1);
8453
+ }
8454
+ } else {
8455
+ console.error(`Failed to pull ${image}. Check your internet connection and Docker setup.`);
8456
+ process.exit(1);
8457
+ }
8446
8458
  }
8447
8459
  }
8448
8460
  const token = ensureToken();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wx": "./dist/cli.js"
@@ -29,7 +29,7 @@
29
29
  "directory": "packages/cli"
30
30
  },
31
31
  "scripts": {
32
- "build": "esbuild src/cli.ts --bundle --format=esm --platform=node --outfile=dist/cli.js --banner:js='#!/usr/bin/env node\nimport{createRequire}from\"module\";const require=createRequire(import.meta.url);' --external:qrcode-terminal",
32
+ "build": "node build.js",
33
33
  "typecheck": "tsc --noEmit"
34
34
  }
35
35
  }