import type { LocalContext } from "../../context.js"; import { buildCommand } from "@stricli/core"; import { createApiClient } from "../../utils/api-client.js"; interface AddSiteFlags { org: string; domain: string; } async function addSite(this: LocalContext, flags: AddSiteFlags): Promise { try { const client = await createApiClient(); await client.call("admin.orgs.addSite", { slug: flags.org, domain: flags.domain, }); console.log(`Added site ${flags.domain} to org ${flags.org}`); } catch (error) { console.error( "Error:", error instanceof Error ? error.message : String(error), ); this.process.exit(1); } } export const addSiteCommand = buildCommand({ func: addSite, parameters: { flags: { org: { kind: "parsed", parse: String, brief: "Org slug to add the site to", }, domain: { kind: "parsed", parse: String, brief: "Domain to add (e.g. example.com)", }, }, }, docs: { brief: "Add a site to an organization", fullDescription: "Adds a site domain to an organization via the admin API.", }, });