feat(web): add logout command and tests

This commit is contained in:
Peter Steinberger
2025-11-26 01:29:02 +01:00
parent 1fd4485716
commit a2586b8b06
8 changed files with 99 additions and 14 deletions

View File

@@ -5,7 +5,12 @@ import { statusCommand } from "../commands/status.js";
import { webhookCommand } from "../commands/webhook.js";
import { ensureTwilioEnv } from "../env.js";
import { danger, info, setVerbose, setYes, warn } from "../globals.js";
import { loginWeb, monitorWebProvider, pickProvider } from "../provider-web.js";
import {
loginWeb,
logoutWeb,
monitorWebProvider,
pickProvider,
} from "../provider-web.js";
import { defaultRuntime } from "../runtime.js";
import type { Provider } from "../utils.js";
import { VERSION } from "../version.js";
@@ -104,6 +109,18 @@ export function buildProgram() {
}
});
program
.command("logout")
.description("Clear cached WhatsApp Web credentials")
.action(async () => {
try {
await logoutWeb(defaultRuntime);
} catch (err) {
defaultRuntime.error(danger(`Logout failed: ${String(err)}`));
defaultRuntime.exit(1);
}
});
program
.command("send")
.description("Send a WhatsApp message")