@agent-wechat/cli 0.2.0 → 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.
- package/README.md +2 -1
- package/dist/cli.js +24 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ This installs the `wx` command globally.
|
|
|
13
13
|
## Prerequisites
|
|
14
14
|
|
|
15
15
|
- [Docker](https://docs.docker.com/get-docker/) installed and running
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
`wx up` automatically pulls the Docker image from ghcr.io if it isn't found locally.
|
|
17
18
|
|
|
18
19
|
> **Note:** agent-wechat requires `SYS_PTRACE` and `seccomp=unconfined` to interact with the WeChat desktop process. It cannot run in serverless or restricted container environments (AWS Fargate, Cloud Run, etc.). Use a VM or bare-metal Docker host.
|
|
19
20
|
|
package/dist/cli.js
CHANGED
|
@@ -7904,8 +7904,9 @@ 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.
|
|
7907
|
+
var VERSION = "0.2.2";
|
|
7908
7908
|
var CONTAINER_NAME = "agent-wechat";
|
|
7909
|
+
var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
|
|
7909
7910
|
var DEFAULT_PORT = 6174;
|
|
7910
7911
|
var VNC_PORT = 5900;
|
|
7911
7912
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -7939,9 +7940,7 @@ function getConfig() {
|
|
|
7939
7940
|
};
|
|
7940
7941
|
}
|
|
7941
7942
|
function getImageTag() {
|
|
7942
|
-
|
|
7943
|
-
if (arch === "arm64") return "agent-wechat:arm64";
|
|
7944
|
-
return "agent-wechat:amd64";
|
|
7943
|
+
return `${GHCR_IMAGE}:${VERSION}`;
|
|
7945
7944
|
}
|
|
7946
7945
|
var program2 = new Command();
|
|
7947
7946
|
program2.name("wx").description("WeChat automation CLI").version(VERSION).option("-s, --session <name>", "Use specified session", "default");
|
|
@@ -8416,7 +8415,7 @@ async function cmdSessionDelete(client, idOrName) {
|
|
|
8416
8415
|
}
|
|
8417
8416
|
}
|
|
8418
8417
|
async function cmdUp() {
|
|
8419
|
-
|
|
8418
|
+
let image = getImageTag();
|
|
8420
8419
|
try {
|
|
8421
8420
|
const existingId = execSync(`docker ps -aq -f "name=^${CONTAINER_NAME}$"`, { encoding: "utf-8" }).trim();
|
|
8422
8421
|
if (existingId) {
|
|
@@ -8438,9 +8437,25 @@ async function cmdUp() {
|
|
|
8438
8437
|
try {
|
|
8439
8438
|
execSync(`docker image inspect ${image}`, { stdio: "ignore" });
|
|
8440
8439
|
} catch {
|
|
8441
|
-
console.
|
|
8442
|
-
|
|
8443
|
-
|
|
8440
|
+
console.log(`Image ${image} not found locally. Pulling...`);
|
|
8441
|
+
try {
|
|
8442
|
+
execSync(`docker pull ${image}`, { stdio: "inherit" });
|
|
8443
|
+
} catch {
|
|
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
|
+
}
|
|
8458
|
+
}
|
|
8444
8459
|
}
|
|
8445
8460
|
const token = ensureToken();
|
|
8446
8461
|
console.log(`Starting container ${CONTAINER_NAME} from ${image}...`);
|
|
@@ -8484,7 +8499,7 @@ Waiting for server to be ready...`);
|
|
|
8484
8499
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
8485
8500
|
process.stdout.write(".");
|
|
8486
8501
|
}
|
|
8487
|
-
console.log("\nServer did not become ready in time. Check logs with:
|
|
8502
|
+
console.log("\nServer did not become ready in time. Check logs with: wx logs");
|
|
8488
8503
|
} catch (error) {
|
|
8489
8504
|
console.error("Failed to start container:", error);
|
|
8490
8505
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-wechat/cli",
|
|
3
|
-
"version": "0.2.
|
|
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": "
|
|
32
|
+
"build": "node build.js",
|
|
33
33
|
"typecheck": "tsc --noEmit"
|
|
34
34
|
}
|
|
35
35
|
}
|