From 80a3c222a12ed6586fb8940156cef705e59c6206 Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 02:53:11 +0100 Subject: [PATCH 1/4] feat(session)!: session list and session status, and account list is gone The owner moved the profile list from `account list` to `session list` with no alias, and gave every messenger `session status` (NEED-2915 A, WC-CMD-8, WC-ACCT-12). - The session group mounts cli-core's messengerSessionCommands. - cli-core 0.715.0 -> 0.751.0 for now; the next push pins the cli-core release that drops `account list` from the shared account group. - Docs, the skill, the help and manifest contracts and the tests say `session list`; a test drives `session status` with and without --check. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- bin/fix-own-contact-name | 2 +- bin/lib/live.sh | 6 +++--- bin/live-fresh-link | 4 ++-- bin/move-to-shared-store | 4 ++-- changes/feat-session-list.md | 14 ++++++++++++ contracts/help.snap | 2 +- contracts/wirecat.json | 32 +++++++++++++++++---------- docs/bot.md | 2 +- docs/commands.md | 38 ++++++++++++++++++++++----------- docs/dev/BACKLOG-NOTES.md | 2 +- docs/dev/live-scenarios.md | 14 ++++++------ docs/dev/test-matrix.md | 2 +- docs/profiles.md | 4 ++-- docs/sessions.md | 4 ++-- scripts/commands.ts | 2 +- scripts/test-matrix-untested.ts | 2 +- skills/whatsapp-cli/SKILL.md | 2 +- src/commands/bot.test.ts | 4 ++-- src/commands/session.test.ts | 13 +++++++++++ src/commands/session.ts | 2 ++ 21 files changed, 104 insertions(+), 53 deletions(-) create mode 100644 changes/feat-session-list.md diff --git a/README.md b/README.md index ae7b75f7..58dd03a7 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ link once, from the phone, and the device keys go to one file only your user can wa personal session start # a QR code: WhatsApp → Settings → Linked devices → Link a device wa personal session start phone # or your number, then a pairing code you type on the phone wa personal account show # who this profile is linked as -wa account list # every profile here, and who each is linked as +wa session list # every profile here, and who each is linked as wa personal session end # unlink, and delete the device keys here ``` diff --git a/bin/fix-own-contact-name b/bin/fix-own-contact-name index d7d4d6e1..e76630d8 100755 --- a/bin/fix-own-contact-name +++ b/bin/fix-own-contact-name @@ -94,7 +94,7 @@ cleanup() { # The keys stay if WhatsApp did not answer; they go anyway, and the phone can still remove the device. drop_keys rmdir -- "$state/profiles/$profile" 2>/dev/null || true - # session end leaves the account record, which holds the main account's id and keeps fix-own in `account list`. + # session end leaves the account record, which holds the main account's id and keeps fix-own in `session list`. rm -f -- "$state/accounts/$profile.json" rm -rf -- "$store" echo "device unlinked: $unlinked" diff --git a/bin/lib/live.sh b/bin/lib/live.sh index a97557a3..09555cd6 100644 --- a/bin/lib/live.sh +++ b/bin/lib/live.sh @@ -76,12 +76,12 @@ json() { } profiles() { - wa_json account list --timeout 30s | json 'd.items.map((one) => one.profile).join(" ")' + wa_json session list --timeout 30s | json 'd.items.map((one) => one.profile).join(" ")' } # Never picks a profile: a missing or unknown one stops with the choices. need_profile() { - known=$(profiles) || die "wa account list failed" + known=$(profiles) || die "wa session list failed" [ -n "${1:-}" ] || die "name the profile: $(basename -- "$0") — profiles here: ${known:-none}" case " $known " in *" $1 "*) ;; @@ -91,7 +91,7 @@ need_profile() { # The account's own chat, as the profile recorded it at login. Kept in a variable by the caller; never printed. own_chat() { - own=$(wa_json account list --timeout 30s | json 'd.items.find((one) => one.profile === a)?.account' "$1") + own=$(wa_json session list --timeout 30s | json 'd.items.find((one) => one.profile === a)?.account' "$1") case "$own" in *@lid) printf '%s\n' "$own" ;; *) die "profile $1 has no recorded own id in LID form — run $wa $1 account show once" ;; diff --git a/bin/live-fresh-link b/bin/live-fresh-link index 044c992a..d9e3e793 100755 --- a/bin/live-fresh-link +++ b/bin/live-fresh-link @@ -26,7 +26,7 @@ case "$mode" in "" | --finish) ;; *) die "usage: $(basename -- "$0") , or $(basename -- "$0") --finish" ;; esac -known=$(profiles) || die "wa account list failed" +known=$(profiles) || die "wa session list failed" [ -n "$profile" ] || die "name a new profile: $(basename -- "$0") — taken already: ${known:-none}" has_device() { wa_json "$profile" doctor --timeout 30s | json 'd.item.whatsapp.device.exists' @@ -120,7 +120,7 @@ kept=$(fresh "$profile" doctor --json --no-input --timeout 30s 2>/dev/null | chats=${kept%% *} messages=${kept##* } # The id itself names the account, so only whether it was recorded, in LID form, leaves this script. -self=$(fresh account list --json --no-input --timeout 30s 2>/dev/null | +self=$(fresh session list --json --no-input --timeout 30s 2>/dev/null | json 'd.items.find((one) => one.profile === a)?.account?.endsWith("@lid") ? "yes" : "no"' "$profile") || self="no" verdict=FAIL diff --git a/bin/move-to-shared-store b/bin/move-to-shared-store index 55e636fb..0f049589 100755 --- a/bin/move-to-shared-store +++ b/bin/move-to-shared-store @@ -7,7 +7,7 @@ # bin/move-to-shared-store compare after the re-sync: the old counts beside the shared store's # # Before the backup only `config show`, `doctor` and `server status` touch the shared file, and they open it without -# migrating. `account list` and every messages or store command (other than `store backup`) migrate it to this +# migrating. `session list` and every messages or store command (other than `store backup`) migrate it to this # build's schema, which cannot be undone, so none of them runs before the backup. # shellcheck disable=SC2016 # json takes JavaScript, whose ${} is its own set -eu @@ -99,7 +99,7 @@ What is left, by hand: 1. Start serve: $wa $profile serve (or $wa $profile server start, with a service) 2. From the phone, send yourself one message in your own chat. A sync counts back from the oldest message held, so an empty chat cannot be asked about. -3. Your own chat's id is the …@lid value under "account" in: $wa account list --json +3. Your own chat's id is the …@lid value under "account" in: $wa session list --json 4. Keep WhatsApp open on the phone. Run, until it brings nothing new: $wa $profile messages sync 5. Compare: $main/bin/move-to-shared-store $profile compare diff --git a/changes/feat-session-list.md b/changes/feat-session-list.md new file mode 100644 index 00000000..0b2dc8fd --- /dev/null +++ b/changes/feat-session-list.md @@ -0,0 +1,14 @@ +### Changed — may break callers + +- **`wa session list` lists the profiles on this computer, and `wa account list` is gone** (WC-ACCT-12, WC-CMD-8). + It answers the same rows, takes the same query (`profile:`, `current:`) and needs no profile. There is no alias: + a script that runs `wa account list` must say `wa session list`. `account show`, `account update`, + `account sessions` and the rest of `account` stay. +- **The store moves to version 72** on its first open (cli-core 0.722.0). Like every store migration it only goes + forward. + +### Added + +- **`wa session status` says whether the profile is logged in, and as whom**, from this computer alone. + `--check` asks the messenger whether the session still works, and leaves the phone number out (`account show` + has it). From cli-core 0.751.0 (was 0.715.0). diff --git a/contracts/help.snap b/contracts/help.snap index 3c038bbb..f25f89b8 100644 --- a/contracts/help.snap +++ b/contracts/help.snap @@ -31,7 +31,7 @@ Works with: linear Linear issues and projects, searchable with your other WireCat data Start here: wa personal setup (any profile name works) - wa account list your profiles and their logged-in accounts + wa session list your profiles and their logged-in accounts Next: wa commands every command, by section wa guide scenarios: command sequences for common tasks wa help options output, offline, timeouts, dry run diff --git a/contracts/wirecat.json b/contracts/wirecat.json index c73481b2..dad7ad70 100644 --- a/contracts/wirecat.json +++ b/contracts/wirecat.json @@ -32,28 +32,38 @@ }, { "path": [ - "setup" + "session", + "status" ], - "summary": "set up WhatsApp and connect your agent", + "summary": "show whether this profile is logged in, and as whom", "effects": { - "remote": "write", - "local": "write" - }, - "entity": "setup" + "remote": "read", + "local": "read" + } }, { "path": [ - "account", + "session", "list" ], - "summary": "profiles on this computer and their signed-in accounts", + "summary": "list the profiles on this computer and the account each is logged in as", "effects": { - "remote": "read", + "remote": "none", "local": "read" }, - "permission": "account.list", "entity": "account_profile" }, + { + "path": [ + "setup" + ], + "summary": "set up WhatsApp and connect your agent", + "effects": { + "remote": "write", + "local": "write" + }, + "entity": "setup" + }, { "path": [ "account", @@ -5481,7 +5491,7 @@ "tagline": "Your WhatsApp account, searchable on your computer", "profiles": { "args": [ - "account", + "session", "list", "--no-record", "--json" diff --git a/docs/bot.md b/docs/bot.md index a84bb53a..8e787c79 100644 --- a/docs/bot.md +++ b/docs/bot.md @@ -25,7 +25,7 @@ no WhatsApp account. | `bot mcp serve` | The bot's commands as MCP tools for an agent. | | `bot list` | Every bot profile on this computer that has a token; `--check` asks Meta which number each is. Needs no profile word. | -A bot profile is not one of your accounts: `wa account list` leaves out a name that only a bot uses, and marks a +A bot profile is not one of your accounts: `wa session list` leaves out a name that only a bot uses, and marks a name that is your account and a bot too with `bot: true`. A chat is the person's phone number in digits, such as `70000000001`. Meta names some people only by a diff --git a/docs/commands.md b/docs/commands.md index 6100926c..10b9ea8d 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -17,7 +17,7 @@ wa [profile] [options] [arguments] profile `work`. `WA_PROFILE` does the same for a whole shell session; no setting in the config file picks one. **No profile is assumed**, not even the only one: without either, a command that uses an account stops with exit 2 and lists the profiles on this computer. Commands that use no -account (`--help`, `--version`, `commands`, `skill show`, `account list`, `config show`) run +account (`--help`, `--version`, `commands`, `skill show`, `session list`, `config show`) run without one. ## Options for every command @@ -76,6 +76,30 @@ unlink this device on WhatsApp's side and delete its keys here wa session end ``` +### `wa session status` + +show whether this profile has a session on this computer and the account it was logged in as; --check asks the messenger whose the session is, without the phone number (`account show` has it) + +```sh +wa session status [options] +``` + +| Option | What it does | +|---|---| +| `--check` | ask the messenger whether the session still works, and whose it is. | + +### `wa session list` + +every account profile on this computer, and the account each is logged in as; a name that is only a bot is left out (`bot list` has it), one that is a bot too says `bot: true`; asks the messenger nothing + +```sh +wa session list [query] +``` + +| Argument | | What it is | +|---|---|---| +| `query` | optional | field:value terms that narrow the list — the fields are below. | + ## `wa setup` set up WhatsApp and connect your agent @@ -95,18 +119,6 @@ wa setup [options] the logged-in account -### `wa account list` - -every account profile on this computer, and the account each is logged in as; a name that is only a bot is left out (`bot list` has it), one that is a bot too says `bot: true`; asks the messenger nothing - -```sh -wa account list [query] -``` - -| Argument | | What it is | -|---|---|---| -| `query` | optional | field:value terms that narrow the list — the fields are below. | - ### `wa account show` who this profile is logged in as, with the phone number diff --git a/docs/dev/BACKLOG-NOTES.md b/docs/dev/BACKLOG-NOTES.md index 39bdd57d..93821060 100644 --- a/docs/dev/BACKLOG-NOTES.md +++ b/docs/dev/BACKLOG-NOTES.md @@ -93,7 +93,7 @@ since the plain shape is the one seen to group. A fresh `session start` must keep the history push, and `self()` must be set right after pairing: the engine's `link` answers with `me()`, which fails while WhatsApp has not given the account its LID, so a `session start` that exits 0 has one. `bin/live-fresh-link` links a new profile, counts what the push left in a throwaway store and -checks that `account list` recorded the own id in LID form; its last line is `WA-5: PASS` or `FAIL`. The owner's run +checks that `session list` recorded the own id in LID form; its last line is `WA-5: PASS` or `FAIL`. The owner's run of 2026-11-08 linking a spare account (profile `spar`) ended `WA-5: PASS`. ## WA-11 · How long a rate limit and a ban hold writes diff --git a/docs/dev/live-scenarios.md b/docs/dev/live-scenarios.md index f45ba8b4..dfa06139 100644 --- a/docs/dev/live-scenarios.md +++ b/docs/dev/live-scenarios.md @@ -86,7 +86,7 @@ also say the phone answered the LID chat under another id, such as its phone num These checks are scripts in `bin/`; most need a person at the phone. Only the owner runs them, from a terminal; an agent never does (`WC-TEST-18`). Each takes the profile as its first argument and never picks one: without it, or -with a name that is not there, it stops and lists the profiles `account list` knows (`WC-ACCT-3`). Each runs the +with a name that is not there, it stops and lists the profiles `session list` knows (`WC-ACCT-3`). Each runs the main checkout's `bin/wa`, the one whose `serve` holds the device, with `--json`, `--no-input` and a `--timeout` (`WC-LIFE-5`). Some calls differ: the restarted `serve` runs without a timeout, `live-fresh-link` runs `session start` through `node` with a throwaway store, in human mode on the terminal so that wa draws the QR code @@ -121,7 +121,7 @@ Confirm the plan once at the terminal. No phone typing is needed in this mode; o alone does not create the marker and control messages. Without `--sender-profile`, the script instead prompts you to send both words from the phone's Message yourself chat. Both modes use the main checkout's installed build. -1. Read both accounts' LIDs from `account list`, without printing them. Automatic mode refuses missing profiles +1. Read both accounts' LIDs from `session list`, without printing them. Automatic mode refuses missing profiles and profiles for the same account. Verify receiver `serve` and its engine by the device lock and process arguments; stop nothing if they cannot be restored the same way. For a persistent systemd user service, verify its MainPID and use the same service to stop and start. An implicit profile must be set by the unit's @@ -151,7 +151,7 @@ The owner deletes the two probe messages from the phone afterwards. The script c recipient lists and sends no read receipts. While receiver `serve` is stopped, other incoming messages queue too. **`live-poll-vote`** needs `serve` running, so its writes go through it and no one-shot connection takes the -device. It reads the own chat's id from `account list` (it must be in LID form) and never prints it. Then: +device. It reads the own chat's id from `session list` (it must be in LID form) and never prints it. Then: `polls create` with a question carrying a fresh run number and the answers `yes` and `no`; `polls show` for the answer ids; `polls vote` for `yes`; `polls show` again after 10 s; `messages delete --for-everyone`. It prints the votes per answer and whether the owner's vote is the chosen one, from the vote's answer and from the store. @@ -181,7 +181,7 @@ and checks `serve` as `live-oneshot-drop` does (the helpers are shared in `bin/l is no verdict: the store may already hold the chat's start, or the phone was offline. 6. The `EXIT` trap deletes the log. -**`live-fresh-link`** refuses a profile that `account list` shows or that has device keys. It says plainly that it +**`live-fresh-link`** refuses a profile that `session list` shows or that has device keys. It says plainly that it links a second device and goes on only after `yes`. It runs `session start qr --timeout 15m` in human mode, with the terminal attached and nothing redirected, so wa draws the QR code in the terminal as tg and max do; Ctrl+C there ends the history wait, not the script. That run's own lines name the account, so only the result block is pasted. @@ -189,20 +189,20 @@ The device keys go to the main checkout's `.wa/state`, like any profile there. T store, removed at the end, because the store keys an account by its WhatsApp id and not by its profile: the push would otherwise land in the owner's store. The result block holds `session start`'s exit code and the chats and messages in that store, read afterwards with `doctor --json`: distinct rows, which can be fewer than the pushed batches held, and -whether `account list` recorded the profile's own id in LID form (the id itself is not printed). The last line is +whether `session list` recorded the profile's own id in LID form (the id itself is not printed). The last line is `WA-5: PASS` only for exit 0, the own id and more than 0 chats and messages; the exit code follows it. On every exit, Ctrl-C included, it removes the throwaway store and, while the new profile has device keys, says how to unlink it. A store that was never created reads "nothing", not a count. When `session start` fails but the device is linked, the result block says to run `--finish`. That refuses a profile without device keys and one whose lock is held, and goes on only after `yes`. It asks for the device keys, not for -`account list`: a link that ended early may never have saved the account record, and the `watch` connection saves +`session list`: a link that ended early may never have saved the account record, and the `watch` connection saves it. It runs `watch --jsonl --timeout 5m` with stdout to `/dev/null` and the same throwaway store, so whatever the phone still pushes, and whatever WhatsApp queued for that device, lands there and is counted the same way. `--jsonl`, because a stdout that is not a terminal gets `--json`, which `watch` refuses. It is only for a profile this script linked: the queued messages are gone with the throwaway store. -**`live-chat-state`** needs `serve` running, and works in the own chat only, by its LID id from `account list`, +**`live-chat-state`** needs `serve` running, and works in the own chat only, by its LID id from `session list`, never printed. After each step it asks the owner what the phone shows and records yes or no: 1. `account privacy show`, read only. It prints each setting that came back with its value (`everyone`, diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index 82a4ddb2..599a0e00 100644 --- a/docs/dev/test-matrix.md +++ b/docs/dev/test-matrix.md @@ -17,7 +17,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `setup` | | ✅ | | | `setup` | `--agent` | ✅ | | | `setup` | `--method` | ✅ | | -| `account list` | | ✅ | | +| `session list` | | ✅ | | | `account show` | | ✅ | | | `account show` | `--hide-phone` | ✅ | | | `account update` | | ✅ | | diff --git a/docs/profiles.md b/docs/profiles.md index 612a5c50..cabc3846 100644 --- a/docs/profiles.md +++ b/docs/profiles.md @@ -14,7 +14,7 @@ know how to pick a profile for a command and how to give it its own settings. | Use two WhatsApp accounts on one computer | Link once per profile: `wa work session start` | | Give your agent fewer rights than you have | A profile with its own [permissions](permissions.md) | | Keep an agent on that one profile | `WA_PROFILE_LOCK` ([profiles in linking](sessions.md#profiles)) | -| See every profile on this computer | `wa account list` | +| See every profile on this computer | `wa session list` | ## Choose a profile @@ -24,7 +24,7 @@ Put the profile name before the command: wa work config show ``` -`wa account list` shows every profile on this computer and the account each is linked as; `wa work session end` +`wa session list` shows every profile on this computer and the account each is linked as; `wa work session end` unlinks the profile `work`. A setting under `profiles.work` in the config file applies to that profile; values under `defaults` apply when it diff --git a/docs/sessions.md b/docs/sessions.md index 9b6e5344..006731bb 100644 --- a/docs/sessions.md +++ b/docs/sessions.md @@ -87,7 +87,7 @@ news and says so in one more `"step":"waiting"` line: keep WhatsApp open on the ```sh wa personal account show # who this profile is linked as; the phone number shows only its last four digits -wa account list # every profile on this computer, and the account each is linked as +wa session list # every profile on this computer, and the account each is linked as wa personal session end # unlink the device on WhatsApp's side, and delete its keys here ``` @@ -171,7 +171,7 @@ a digit. The order, first match wins: the first word, then `WA_PROFILE`. With neither, a command that uses an account stops with exit code `2` and lists the profiles on this computer. `wa` never picks one, not even the only one. Commands -that use no account run without a profile: `--help`, `--version`, `commands`, `skill show`, `account list` and +that use no account run without a profile: `--help`, `--version`, `commands`, `skill show`, `session list` and `config show`. **`WA_PROFILE_LOCK` pins a process to one profile.** Set it where an agent runs, and a first word or `WA_PROFILE` diff --git a/scripts/commands.ts b/scripts/commands.ts index 860155a3..f8ce01b1 100644 --- a/scripts/commands.ts +++ b/scripts/commands.ts @@ -42,7 +42,7 @@ wa [profile] [options] [arguments] profile \`work\`. \`WA_PROFILE\` does the same for a whole shell session; no setting in the config file picks one. **No profile is assumed**, not even the only one: without either, a command that uses an account stops with exit 2 and lists the profiles on this computer. Commands that use no -account (\`--help\`, \`--version\`, \`commands\`, \`skill show\`, \`account list\`, \`config show\`) run +account (\`--help\`, \`--version\`, \`commands\`, \`skill show\`, \`session list\`, \`config show\`) run without one.`, globalHeading: "Options for every command", globalIntro: "", diff --git a/scripts/test-matrix-untested.ts b/scripts/test-matrix-untested.ts index 99644dd3..0d71f2da 100644 --- a/scripts/test-matrix-untested.ts +++ b/scripts/test-matrix-untested.ts @@ -158,7 +158,7 @@ export const UNTESTED: Untested[] = [ "src/program.test.ts («commands WhatsApp has no counterpart for») drives the refusal, cli-core " + "src/cli/messenger/command-capabilities.test.ts the rule", })), - ...cliCore("src/services/account-list.test.ts", [["account list"]]), + ...cliCore("src/services/account-list.test.ts", [["session list"]]), ...cliCore("src/cli/messenger/attachments.test.ts", [["messages download", "--attachment"]]), ...cliCore("src/services/history-limits.test.ts and src/cli/messenger/stored.test.ts", [ ["messages sync", "--full-history"], diff --git a/skills/whatsapp-cli/SKILL.md b/skills/whatsapp-cli/SKILL.md index 056e36b6..ea638515 100644 --- a/skills/whatsapp-cli/SKILL.md +++ b/skills/whatsapp-cli/SKILL.md @@ -31,7 +31,7 @@ slow down is a hold — stop, do not retry, tell the owner. The first word is the profile when it is not a command: `wa work chats list` is profile `work`. There is no `--profile` flag; `WA_PROFILE` does the same. No profile is assumed: without one, an account command exits `2` and -lists the profiles (`wa account list` shows them too). **Never pick one for the owner**; ask which, unless the task or +lists the profiles (`wa session list` shows them too). **Never pick one for the owner**; ask which, unless the task or `WA_PROFILE` says. The examples use `personal`. ## Answer a question from the chats diff --git a/src/commands/bot.test.ts b/src/commands/bot.test.ts index d1d87680..c4e350de 100644 --- a/src/commands/bot.test.ts +++ b/src/commands/bot.test.ts @@ -373,12 +373,12 @@ describe("a bot profile beside the accounts", () => { ).toMatchObject({ phone_number_id: long }) }) - it("**is no account in `account list`**, and `bot list` names it with no profile word", async () => { + it("**is no account in `session list`**, and `bot list` names it with no profile word", async () => { const sandboxProfile = process.env.WA_PROFILE delete process.env.WA_PROFILE const unnamed = async () => { try { - return { accounts: await wa(["account", "list", "--json"]), bots: await wa(["bot", "list", "--json"]) } + return { accounts: await wa(["session", "list", "--json"]), bots: await wa(["bot", "list", "--json"]) } } finally { process.env.WA_PROFILE = sandboxProfile } diff --git a/src/commands/session.test.ts b/src/commands/session.test.ts index ba79c3dc..5f476bf0 100644 --- a/src/commands/session.test.ts +++ b/src/commands/session.test.ts @@ -598,3 +598,16 @@ describe("wa session end", () => { expect(JSON.parse(result.stdout).item).toEqual({ profile: "never", ended: false }) }) }) + +describe("session status", () => { + it("**says a profile that was never linked is not logged in**, even with --check, starting no engine", async () => { + for (const argv of [ + ["never", "session", "status", "--json"], + ["never", "session", "status", "--check", "--json"], + ]) { + const result = await wa(argv, never) + expect(result.code).toBe(0) + expect(JSON.parse(result.stdout).item).toMatchObject({ profile: "never", signed_in: false, verified: false }) + } + }) +}) diff --git a/src/commands/session.ts b/src/commands/session.ts index d78edb42..1ce3bb2a 100644 --- a/src/commands/session.ts +++ b/src/commands/session.ts @@ -9,6 +9,7 @@ import { logsInOrOut, mayRevoke, messengerContext, + messengerSessionCommands, printItem, REMOTE_WRITE, refuseCommandName, @@ -123,6 +124,7 @@ const sessionCommandDefinition = (): Command => { printItem(context, answer) }) + for (const command of messengerSessionCommands(WHATSAPP)) session.addCommand(command) return session } From a52807ea05edcb9919253895420cf2e5b6329705 Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 03:36:29 +0100 Subject: [PATCH 2/4] test(live): the one-shot fixture answers session list; matrix rows for session status and search conversations --like Co-Authored-By: Claude Opus 5.5 --- docs/dev/test-matrix.md | 7 ++++--- scripts/fixtures/oneshot-cli.mjs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index 599a0e00..d795e934 100644 --- a/docs/dev/test-matrix.md +++ b/docs/dev/test-matrix.md @@ -7,17 +7,19 @@ ran it · ⛔ not tested offline, with the reason and where it is checked instea Measured from the test run (`coverage/argv.jsonl`), not searched for — see [TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands. -**287 ✅ · 878 ⛔ · 0 ❌** — 383 commands, 782 options. +**289 ✅ · 877 ⛔ · 0 ❌** — 384 commands, 782 options. | Command | Option | | Note | |---|---|---|---| | `session start` | | ✅ | | | `session start` | `--answer-stdin` | ✅ | | | `session end` | | ✅ | | +| `session status` | | ✅ | | +| `session status` | `--check` | ✅ | | +| `session list` | | ✅ | | | `setup` | | ✅ | | | `setup` | `--agent` | ✅ | | | `setup` | `--method` | ✅ | | -| `session list` | | ✅ | | | `account show` | | ✅ | | | `account show` | `--hide-phone` | ✅ | | | `account update` | | ✅ | | @@ -326,7 +328,6 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `store info` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store check` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store migrate` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | -| `store migrate` | `--no-backup` | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store rebuild` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store backup` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store backup` | `--encrypt` | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | diff --git a/scripts/fixtures/oneshot-cli.mjs b/scripts/fixtures/oneshot-cli.mjs index 6496ac99..6f62d9d6 100644 --- a/scripts/fixtures/oneshot-cli.mjs +++ b/scripts/fixtures/oneshot-cli.mjs @@ -33,7 +33,7 @@ if (args[0] === "__stop") { } else if (args[0] === "__lock") { if (!state.running && mode === "lock-unreadable") process.exit(1) console.log(state.running ? "serve (pid 102)|102|true" : "||false") -} else if (args[0] === "account" && args[1] === "list") { +} else if (args[0] === "session" && args[1] === "list") { answer({ items: Object.entries(accounts).map(([profile, account]) => ({ profile, account })) }) } else { const [profile, root, command] = args From 5318a9da7703a449b313cb0c21b44d346db3c974 Mon Sep 17 00:00:00 2001 From: leemour Date: Thu, 26 Nov 2026 01:05:46 +0100 Subject: [PATCH 3/4] chore(contracts): regenerate the manifest and test matrix against the cli-core session list branch Co-Authored-By: Claude Opus 5.5 --- contracts/wirecat.json | 4 ++++ docs/dev/test-matrix.md | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/wirecat.json b/contracts/wirecat.json index dad7ad70..786b730c 100644 --- a/contracts/wirecat.json +++ b/contracts/wirecat.json @@ -5234,6 +5234,8 @@ "label", "list", "is", + "type", + "reach", "chat", "date", "source", @@ -5277,6 +5279,8 @@ "label", "list", "is", + "type", + "reach", "chat", "date", "source", diff --git a/docs/dev/test-matrix.md b/docs/dev/test-matrix.md index d795e934..48add2e4 100644 --- a/docs/dev/test-matrix.md +++ b/docs/dev/test-matrix.md @@ -7,7 +7,7 @@ ran it · ⛔ not tested offline, with the reason and where it is checked instea Measured from the test run (`coverage/argv.jsonl`), not searched for — see [TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands. -**289 ✅ · 877 ⛔ · 0 ❌** — 384 commands, 782 options. +**289 ✅ · 878 ⛔ · 0 ❌** — 384 commands, 783 options. | Command | Option | | Note | |---|---|---|---| @@ -328,6 +328,7 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see | `store info` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store check` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store migrate` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | +| `store migrate` | `--no-backup` | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store rebuild` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store backup` | | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | | `store backup` | `--encrypt` | ⛔ | shared cli-core command mounted unchanged, over the store; tested in cli-core (src/cli/messenger/store-maintenance.test.ts, gaps.test.ts and store-mode.test.ts) | From cffcc0a2f034d6be46bd6cc909ee76091a92d5db Mon Sep 17 00:00:00 2001 From: leemour Date: Thu, 26 Nov 2026 02:10:13 +0100 Subject: [PATCH 4/4] build(deps): cli-core 1.3.0, which drops account list and adds session status and list Co-Authored-By: Claude Opus 5.5 --- changes/feat-session-list.md | 6 +++--- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/changes/feat-session-list.md b/changes/feat-session-list.md index 0b2dc8fd..63dde235 100644 --- a/changes/feat-session-list.md +++ b/changes/feat-session-list.md @@ -4,11 +4,11 @@ It answers the same rows, takes the same query (`profile:`, `current:`) and needs no profile. There is no alias: a script that runs `wa account list` must say `wa session list`. `account show`, `account update`, `account sessions` and the rest of `account` stay. -- **The store moves to version 72** on its first open (cli-core 0.722.0). Like every store migration it only goes - forward. +- **The store moves to version 77** on its first open (cli-core 1.1.0 and 1.2.0). Like every store migration it only + goes forward. ### Added - **`wa session status` says whether the profile is logged in, and as whom**, from this computer alone. `--check` asks the messenger whether the session still works, and leaves the phone number out (`account show` - has it). From cli-core 0.751.0 (was 0.715.0). + has it). From cli-core 1.3.0 (was 1.0.0). diff --git a/package.json b/package.json index fe8ed673..43e0fcf8 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ }, "dependencies": { "@wirecat/cli-base": "1.0.0", - "@wirecat/cli-core": "1.0.0", + "@wirecat/cli-core": "1.3.0", "commander": "15.0.0", "valibot": "1.5.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab5ea35b..d3450f4d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ importers: specifier: 1.0.0 version: 1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5) '@wirecat/cli-core': - specifier: 1.0.0 - version: 1.0.0(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7) + specifier: 1.3.0 + version: 1.3.0(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7) commander: specifier: 15.0.0 version: 15.0.0 @@ -1192,8 +1192,8 @@ packages: '@wirecat/cli-core-sqlite@1.1.0': resolution: {integrity: sha512-GpGlh/dAIX/nblBYCdT6DfWSLFxav9mxxeELQAfEuw+QZdT9unKxbi5xa02s/s4JS1P7n0PQx2sCABj4FlMRNw==} - '@wirecat/cli-core@1.0.0': - resolution: {integrity: sha512-0avQTqu3FAFKE0s+8Pz1Up/TMHTYqCdDn37lcZmkH30sMCMrgJwHzoG4Q0fjVzPsB85u+zBVHHhtQjF/eSTpuw==} + '@wirecat/cli-core@1.3.0': + resolution: {integrity: sha512-tCRgrnXf2YXNkRLFqRHf8iHcm6v1G4D2jn7coSsmqobmOqJvALPOvCiWpoPlVYGprIkXC4Twp+rR367Md2XULg==} engines: {node: ^22.16.0 || >=24} hasBin: true peerDependencies: @@ -3322,7 +3322,7 @@ snapshots: '@wirecat/cli-core-sqlite@1.1.0': {} - '@wirecat/cli-core@1.0.0(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7)': + '@wirecat/cli-core@1.3.0(@wirecat/cli-base@1.0.0(commander@15.0.0)(esbuild@0.28.2)(typescript@7.0.2)(vitest@5.0.5))(commander@15.0.0)(typescript@7.0.2)(zod@4.6.7)': dependencies: '@anthropic-ai/sdk': 1.3.0(zod@4.6.7) '@bomb.sh/tab': 0.0.22(commander@15.0.0)