@kyan-du/agent-wechat-cli 0.12.0-next.0

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 ADDED
@@ -0,0 +1,86 @@
1
+ # @kyan-du/agent-wechat-cli
2
+
3
+ Single-instance CLI for managing agent-wechat and interacting with WeChat.
4
+
5
+ > **Release boundary: P1-B remains unavailable until an owner/legal-approved prerelease publishes and independently verifies npm and GHCR artifacts.** All commands in this document use the repository-only `pnpm cli` form; do not substitute bare `wx` before that gate is cleared.
6
+
7
+ ## Install
8
+
9
+ The fork package is not published yet. From a repository checkout run:
10
+
11
+ ```bash
12
+ corepack enable
13
+ pnpm install --frozen-lockfile
14
+ pnpm build
15
+ pnpm build:image
16
+ pnpm cli start
17
+ pnpm cli auth login
18
+ ```
19
+
20
+ After publication is independently verified, the release runbook will provide the exact npm installation command and bare `wx` invocation. Until then, do not attempt a global install.
21
+
22
+ Uninstall with npm after a real install exists. The CLI intentionally has no uninstall subcommand. To erase the trusted default instance first, use the repository form `pnpm cli stop --purge` and confirm the displayed resource list, then use the package manager that installed it.
23
+
24
+ ## Command surface
25
+
26
+ ```text
27
+ pnpm cli start [--image <fork-semver-or-digest>] [--pull | --offline] [--proxy <url>]
28
+ pnpm cli stop [--purge] [--yes]
29
+ pnpm cli restart
30
+ pnpm cli status
31
+ pnpm cli doctor
32
+ pnpm cli logs
33
+
34
+ pnpm cli auth login [--timeout <seconds>] [--new]
35
+ pnpm cli auth logout
36
+ pnpm cli auth reset [--yes]
37
+ pnpm cli auth status
38
+
39
+ pnpm cli chats [--unread] [--limit <n>] [--cursor <cursor>]
40
+ pnpm cli chats show <chat-id>
41
+ pnpm cli chats mark-read <chat-id>
42
+ pnpm cli contacts [--limit <n>] [--cursor <cursor>]
43
+ pnpm cli contacts find <name>
44
+ pnpm cli messages <chat-id> [--limit <n>] [--cursor <cursor>]
45
+ pnpm cli send <chat-id> (--text <message> | --image <path> | --file <path>)
46
+ [--idempotency-key <key>] [--confirm-similar]
47
+
48
+ pnpm cli upgrade [--check | --cli | --image <fork-semver-or-digest>]
49
+ ```
50
+
51
+ The first fork prerelease is deliberately single-instance. Removed `up`, `down`, `update`, and `session` commands exit nonzero with migration guidance; they never execute old behavior and do not migrate historical state.
52
+
53
+ ### Lifecycle guarantees
54
+
55
+ - `start` runs a local architecture build during source development, or an explicit fork semver/digest. Floating `latest`, foreign repositories, and malformed references are rejected.
56
+ - A published tag is pulled and resolved to its immutable fork repository digest. The inventory records the exact container ID, digest, port, volumes, token path, and identity directory.
57
+ - Offline `--offline` succeeds only when the selected compatible image already exists locally.
58
+ - Existing containers are reused only when their ID, ownership label, volumes, identity, port, and requested image match the trusted inventory.
59
+ - `status` and `doctor` are read-only. They never pull, start, migrate, repair, or expose token/proxy contents.
60
+ - `stop` removes only the trusted container and keeps data. `stop --purge` deletes only resources named by the validated default-instance inventory; `--yes` skips confirmation but never validation.
61
+
62
+ ### Authentication and reads
63
+
64
+ `auth logout` verifies the WeChat UI logout and preserves instance data. `auth reset` stops the session, transactionally clears server-side authentication state, deletes the WeChat home volume, and clears both the host and `/data/device-identity` copies before requiring a fresh `start`/login. It is narrower than full purge: agent DB, token, and the default instance inventory remain.
65
+
66
+ `chats`, `contacts`, and `messages` are read-only. Their opaque, versioned cursor uses stable keyset ordering; adding new messages does not shift later pages. `chats --unread` means only conversation-level `unreadCount > 0`. Message reads never open the UI or change unread state. `mark-read` is a separate UI operation and succeeds only when the target and before/after unread state are verified.
67
+
68
+ ### Sending
69
+
70
+ The first prerelease accepts only a stable chat ID. It never resolves a display name or guesses among contacts. Exactly one payload flag is required. Uploads must be regular, non-symlink files no larger than the server limit. `--idempotency-key` exposes durable retry/reconciliation behavior. Similar-content confirmation, `429` metadata, and `commitAttempted` uncertain outcomes remain distinct; an uncertain send is never automatically retried.
71
+
72
+ ### Machine output
73
+
74
+ Global `--json` emits exactly one versioned JSON envelope on stdout. Diagnostics are written to stderr. Stable exit categories distinguish arguments (`2`), environment (`3`), service (`4`), authentication (`5`), target (`6`), confirmation (`7`), rate limit (`8`), uncertain send (`9`), cleanup (`10`), and rollback (`11`).
75
+
76
+ ## Upgrade
77
+
78
+ - `wx upgrade --check` is read-only.
79
+ - `pnpm cli upgrade --cli` fails with `CLI_UPGRADE_UNAVAILABLE` until P1-B npm publication is independently verified; it never prints or executes a premature install command.
80
+ - `wx upgrade --image <reference>` resolves an immutable digest, rebuilds the container with persistent volumes, verifies health, and rolls the container/image back on failure. It does not claim atomic CLI+image rollback.
81
+
82
+ The hidden `pnpm cli dev sync-server --binary <path> --sha256 <hex>` command is only for checked local development artifacts. It checksum-verifies the binary and restores the previous server if health validation fails.
83
+
84
+ ## Release boundary
85
+
86
+ No npm package, GHCR image, tag, or GitHub Release is available until the separate validation, licensing, owner, and redistribution gates are satisfied. Repository instructions must continue to use `pnpm cli` until real publication is independently verified.