#!/usr/bin/env node // Copyright (C) 2026 Whiterun LLC, // This software is licensed under the GNU Lesser General Public License (LGPL), version 3.0 or later. // A copy of the license can be found in the LICENSE file or at https://www.gnu.org/licenses/lgpl-3.0.html import { Command } from "commander"; import { runDappMode } from "./dapp.js"; import { runWalletMode } from "./wallet.js"; const program = new Command(); program .name("wiz-test") .description("WizardConnect protocol test CLI") .version("0.1.0"); program .command("dapp") .description( "Run as a dapp — generates URI, waits for wallet connection, logs all messages", ) .option( "-r, --relay ", "Nostr relay WebSocket URL", "wss://relay.cauldron.quest:443", ) .option( "-k, --private-key ", "Existing dapp private key (64 hex chars) — for reconnection testing", ) .option("--secret ", "Existing secret (hex) — for reconnection testing") .option( "--sign", "Send a dummy sign request after wallet is ready (tests approval flow)", ) .action(async (options) => { await runDappMode(options); }); program .command("wallet") .description("Run as a wallet — connects to a dapp URI, pushes test pubkeys") .option( "-r, --relay ", "Nostr relay WebSocket URL", "wss://relay.cauldron.quest:443", ) .requiredOption("-u, --uri ", "wiz:// URI from dapp") .option( "-k, --private-key ", "Wallet private key (64 hex chars) — random if omitted", ) .action(async (options) => { await runWalletMode(options); }); // Strip bare "--" that npm inserts when forwarding arguments through // multiple script layers (e.g. `npm run wallet -- --uri ...`). const argv = process.argv.filter((arg) => arg !== "--"); program.parse(argv);