feat(cli): move provider login/logout

This commit is contained in:
Peter Steinberger
2026-01-08 07:40:08 +01:00
parent 903f5af59c
commit e83c6ac088
19 changed files with 153 additions and 68 deletions

View File

@@ -44,13 +44,13 @@ clawdbot [--dev] [--profile <name>] <command>
onboard
configure (alias: config)
doctor
login
logout
providers
list
status
add
remove
login
logout
skills
list
info
@@ -138,8 +138,6 @@ clawdbot [--dev] [--profile <name>] <command>
pairing
list
approve
telegram
pairing list|approve
docs
dns
setup
@@ -198,22 +196,7 @@ Options:
- `--non-interactive`: skip prompts; apply safe migrations only.
- `--deep`: scan system services for extra gateway installs.
## Auth + provider helpers
### `login`
Link a WhatsApp Web account via QR.
Options:
- `--verbose`
- `--provider <provider>` (default `whatsapp`)
- `--account <id>`
### `logout`
Clear cached WhatsApp Web credentials.
Options:
- `--provider <provider>`
- `--account <id>`
## Provider helpers
### `providers`
Manage chat provider accounts (WhatsApp/Telegram/Discord/Slack/Signal/iMessage).
@@ -223,12 +206,23 @@ Subcommands:
- `providers status`: check gateway reachability and provider health (`--probe` to verify credentials; use `status --deep` for local-only probes).
- `providers add`: wizard-style setup when no flags are passed; flags switch to non-interactive mode.
- `providers remove`: disable by default; pass `--delete` to remove config entries without prompts.
- `providers login`: interactive provider login (WhatsApp Web only).
- `providers logout`: log out of a provider session (WhatsApp Web only).
Common options:
- `--provider <name>`: `whatsapp|telegram|discord|slack|signal|imessage`
- `--account <id>`: provider account id (default `default`)
- `--name <label>`: display name for the account
`providers login` options:
- `--provider <provider>` (default `whatsapp`; supports `whatsapp`/`web`)
- `--account <id>`
- `--verbose`
`providers logout` options:
- `--provider <provider>` (default `whatsapp`; supports `whatsapp`/`web`)
- `--account <id>`
`providers list` options:
- `--no-usage`: skip provider usage/quota snapshots (OAuth/API-backed only).
- `--json`: output JSON (includes usage unless `--no-usage` is set).

View File

@@ -17,10 +17,10 @@ Short guide to verify the WhatsApp Web / Baileys stack without guessing.
## Deep diagnostics
- Creds on disk: `ls -l ~/.clawdbot/credentials/whatsapp/<accountId>/creds.json` (mtime should be recent).
- Session store: `ls -l ~/.clawdbot/agents/<agentId>/sessions/sessions.json` (path can be overridden in config). Count and recent recipients are surfaced via `status`.
- Relink flow: `clawdbot logout && clawdbot login --verbose` when status codes 409515 or `loggedOut` appear in logs. (Note: the QR login flow auto-restarts once for status 515 after pairing.)
- Relink flow: `clawdbot providers logout && clawdbot providers login --verbose` when status codes 409515 or `loggedOut` appear in logs. (Note: the QR login flow auto-restarts once for status 515 after pairing.)
## When something fails
- `logged out` or status 409515 → relink with `clawdbot logout` then `clawdbot login`.
- `logged out` or status 409515 → relink with `clawdbot providers logout` then `clawdbot providers login`.
- Gateway unreachable → start it: `clawdbot gateway --port 18789` (use `--force` if the port is busy).
- No inbound messages → confirm linked phone is online and the sender is allowed (`whatsapp.allowFrom`); for group chats, ensure allowlist + mention rules match (`whatsapp.groups`, `routing.groupChat.mentionPatterns`).

View File

@@ -138,9 +138,9 @@ clawdbot gateway --verbose
If youre logged out / unlinked:
```bash
clawdbot logout
clawdbot providers logout
trash ~/.clawdbot/credentials # if logout can't cleanly remove everything
clawdbot login --verbose # re-scan QR
clawdbot providers login --verbose # re-scan QR
```
### Media Send Failing
@@ -219,7 +219,7 @@ Get verbose logging:
#
# Then run verbose commands to mirror debug output to stdout:
clawdbot gateway --verbose
clawdbot login --verbose
clawdbot providers login --verbose
```
## Log Locations
@@ -250,7 +250,7 @@ Nuclear option:
```bash
trash ~/.clawdbot
clawdbot login # re-pair WhatsApp
clawdbot providers login # re-pair WhatsApp
clawdbot gateway # start the Gateway again
```

View File

@@ -104,7 +104,7 @@ pnpm build
pnpm link --global
# Pair WhatsApp Web (shows QR)
clawdbot login
clawdbot providers login
# Run the Gateway (leave running)
clawdbot gateway --port 18789

View File

@@ -38,7 +38,7 @@ This flow lets the macOS app act as a full remote control for a Clawdbot gateway
- Nodes advertise their permission state via `node.list` / `node.describe` so agents know whats available.
## WhatsApp login flow (remote)
- Run `clawdbot login --verbose` **on the remote host**. Scan the QR with WhatsApp on your phone.
- Run `clawdbot providers login --verbose` **on the remote host**. Scan the QR with WhatsApp on your phone.
- Re-run login on that host if auth expires. Health check will surface link problems.
## Troubleshooting

View File

@@ -43,13 +43,13 @@ WhatsApp requires a real mobile number for verification. VoIP and virtual number
- Result: unreliable delivery and frequent blocks, so support was removed.
## Login + credentials
- Login command: `clawdbot login` (QR via Linked Devices).
- Multi-account login: `clawdbot login --account <id>` (`<id>` = `accountId`).
- Login command: `clawdbot providers login` (QR via Linked Devices).
- Multi-account login: `clawdbot providers login --account <id>` (`<id>` = `accountId`).
- Default account (when `--account` is omitted): `default` if present, otherwise the first configured account id (sorted).
- Credentials stored in `~/.clawdbot/credentials/whatsapp/<accountId>/creds.json`.
- Backup copy at `creds.json.bak` (restored on corruption).
- Legacy compatibility: older installs stored Baileys files directly in `~/.clawdbot/credentials/`.
- Logout: `clawdbot logout` (or `--account <id>`) deletes WhatsApp auth state (but keeps shared `oauth.json`).
- Logout: `clawdbot providers logout` (or `--account <id>`) deletes WhatsApp auth state (but keeps shared `oauth.json`).
- Logged-out socket => error instructs re-link.
## Inbound flow (DM + group)

View File

@@ -60,7 +60,7 @@ If you link your personal WhatsApp to CLAWDBOT, every message to you becomes “
1) Pair WhatsApp Web (shows QR; scan with the assistant phone):
```bash
clawdbot login
clawdbot providers login
```
2) Start the Gateway (leave it running):

View File

@@ -430,7 +430,7 @@ You can add options like `debounce:2s cap:25 drop:summarize` for followup modes.
Run the login command again and scan the QR code:
```bash
clawdbot login
clawdbot providers login
```
### Build errors on `main` — whats the standard fix path?

View File

@@ -99,7 +99,7 @@ https://github.com/oven-sh/bun/issues/5951
### WhatsApp (QR login)
```bash
pnpm clawdbot login
pnpm clawdbot providers login
```
Scan via WhatsApp → Settings → Linked Devices.

View File

@@ -46,7 +46,7 @@ pnpm clawdbot setup
4) Link surfaces (example: WhatsApp):
```bash
clawdbot login
clawdbot providers login
```
5) Sanity check:
@@ -56,7 +56,7 @@ clawdbot health
```
If onboarding is still WIP/broken on your build:
- Run `clawdbot setup`, then `clawdbot login`, then start the Gateway manually (`clawdbot gateway`).
- Run `clawdbot setup`, then `clawdbot providers login`, then start the Gateway manually (`clawdbot gateway`).
## Bleeding edge workflow (Gateway in a terminal)