import type { Command } from "commander"; import { danger } from "../globals.js"; import { DEFAULT_GMAIL_LABEL, DEFAULT_GMAIL_MAX_BYTES, DEFAULT_GMAIL_RENEW_MINUTES, DEFAULT_GMAIL_SERVE_BIND, DEFAULT_GMAIL_SERVE_PATH, DEFAULT_GMAIL_SERVE_PORT, DEFAULT_GMAIL_SUBSCRIPTION, DEFAULT_GMAIL_TOPIC, } from "../hooks/gmail.js"; import { type GmailRunOptions, type GmailSetupOptions, runGmailService, runGmailSetup, } from "../hooks/gmail-ops.js"; import { defaultRuntime } from "../runtime.js"; export function registerHooksCli(program: Command) { const hooks = program .command("hooks") .description("Webhook helpers and hook-based integrations"); const gmail = hooks .command("gmail") .description("Gmail Pub/Sub hooks (via gogcli)"); gmail .command("setup") .description("Configure Gmail watch + Pub/Sub + Clawdbot hooks") .requiredOption("--account ", "Gmail account to watch") .option("--project ", "GCP project id (OAuth client owner)") .option("--topic ", "Pub/Sub topic name", DEFAULT_GMAIL_TOPIC) .option( "--subscription ", "Pub/Sub subscription name", DEFAULT_GMAIL_SUBSCRIPTION, ) .option("--label