import type { LocalContext } from "../../context.js"; import { buildCommand } from "@stricli/core"; import { createApiClient } from "../../utils/api-client.js"; import { formatError } from "../../utils/format-error.js"; interface CreateOrgFlags { slug: string; name: string; owner: string; } async function create( this: LocalContext, flags: CreateOrgFlags, ): Promise { try { const api = await createApiClient(); const result = await api.admin.orgs.create({ slug: flags.slug, displayName: flags.name, ownerEmail: flags.owner, }); console.log(`Created org: ${result.slug}`); console.log(`Owner: ${flags.owner}`); } catch (error) { console.error("Error:", formatError(error)); this.process.exit(1); } } export const createCommand = buildCommand({ func: create, parameters: { flags: { slug: { kind: "parsed", parse: String, brief: "URL-friendly slug for the org", }, name: { kind: "parsed", parse: String, brief: "Display name for the org", }, owner: { kind: "parsed", parse: String, brief: "Email of the org owner", }, }, }, docs: { brief: "Create an organization", fullDescription: "Creates a new organization with the specified owner via the admin API.", }, });