@thecorporation/cli 26.3.2 → 26.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts","../src/api-client.ts","../src/output.ts","../src/commands/setup.ts","../src/animation.ts","../src/spinner.ts","../src/commands/status.ts","../src/commands/config.ts","../src/commands/obligations.ts","../src/commands/digest.ts","../src/commands/link.ts","../src/commands/claim.ts","../src/llm.ts","../src/tools.ts","../src/chat.ts","../src/commands/entities.ts","../src/commands/contacts.ts","../src/commands/cap-table.ts","../src/commands/finance.ts","../src/commands/governance.ts","../src/commands/documents.ts","../src/commands/tax.ts","../src/commands/agents.ts","../src/commands/billing.ts","../src/commands/approvals.ts","../src/commands/form.ts","../src/commands/api-keys.ts","../src/commands/demo.ts","../src/commands/serve.ts","../src/index.ts"],"sourcesContent":["import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport type { CorpConfig } from \"./types.js\";\n\nconst CONFIG_DIR = process.env.CORP_CONFIG_DIR || join(homedir(), \".corp\");\nconst CONFIG_FILE = join(CONFIG_DIR, \"config.json\");\n\nconst DEFAULTS: CorpConfig = {\n api_url: process.env.CORP_API_URL || \"https://api.thecorporation.ai\",\n api_key: \"\",\n workspace_id: \"\",\n hosting_mode: \"\",\n llm: {\n provider: \"anthropic\",\n api_key: \"\",\n model: \"claude-sonnet-4-6\",\n },\n user: { name: \"\", email: \"\" },\n active_entity_id: \"\",\n};\n\nfunction deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): void {\n for (const [key, value] of Object.entries(override)) {\n if (\n key in base &&\n typeof base[key] === \"object\" &&\n base[key] !== null &&\n !Array.isArray(base[key]) &&\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n ) {\n deepMerge(base[key] as Record<string, unknown>, value as Record<string, unknown>);\n } else {\n base[key] = value;\n }\n }\n}\n\nexport function loadConfig(): CorpConfig {\n const cfg = structuredClone(DEFAULTS);\n if (existsSync(CONFIG_FILE)) {\n const saved = JSON.parse(readFileSync(CONFIG_FILE, \"utf-8\"));\n deepMerge(cfg as unknown as Record<string, unknown>, saved);\n }\n return cfg;\n}\n\nexport function saveConfig(cfg: CorpConfig): void {\n mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });\n writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2) + \"\\n\", { mode: 0o600 });\n}\n\nexport function getValue(cfg: Record<string, unknown>, dotPath: string): unknown {\n const keys = dotPath.split(\".\");\n let current: unknown = cfg;\n for (const key of keys) {\n if (typeof current === \"object\" && current !== null && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n return undefined;\n }\n }\n return current;\n}\n\nexport function setValue(cfg: Record<string, unknown>, dotPath: string, value: string): void {\n const keys = dotPath.split(\".\");\n let current = cfg;\n for (const key of keys.slice(0, -1)) {\n if (!(key in current) || typeof current[key] !== \"object\" || current[key] === null) {\n current[key] = {};\n }\n current = current[key] as Record<string, unknown>;\n }\n current[keys[keys.length - 1]] = value;\n}\n\nexport function requireConfig(...fields: string[]): CorpConfig {\n const cfg = loadConfig();\n const missing = fields.filter((f) => !getValue(cfg as unknown as Record<string, unknown>, f));\n if (missing.length > 0) {\n console.error(`Missing config: ${missing.join(\", \")}`);\n console.error(\"Run 'corp setup' to configure.\");\n process.exit(1);\n }\n return cfg;\n}\n\nexport function maskKey(value: string): string {\n if (!value || value.length < 8) return \"***\";\n return \"***\" + value.slice(-4);\n}\n\nexport function configForDisplay(cfg: CorpConfig): Record<string, unknown> {\n const display = { ...cfg } as Record<string, unknown>;\n if (display.api_key) display.api_key = maskKey(display.api_key as string);\n if (typeof display.llm === \"object\" && display.llm !== null) {\n const llm = { ...(display.llm as Record<string, unknown>) };\n if (llm.api_key) llm.api_key = maskKey(llm.api_key as string);\n display.llm = llm;\n }\n return display;\n}\n\nexport function resolveEntityId(cfg: CorpConfig, explicitId?: string): string {\n const eid = explicitId || cfg.active_entity_id;\n if (!eid) {\n console.error(\n \"No entity specified. Use --entity-id or set active_entity_id via 'corp config set active_entity_id <id>'.\"\n );\n process.exit(1);\n }\n return eid;\n}\n","export { CorpAPIClient, SessionExpiredError, provisionWorkspace } from \"@thecorporation/corp-tools\";\n","import chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport type { ApiRecord } from \"./types.js\";\n\nconst URGENCY_COLORS: Record<string, (s: string) => string> = {\n overdue: chalk.red.bold,\n due_today: chalk.yellow.bold,\n d1: chalk.yellow,\n d7: chalk.cyan,\n d14: chalk.blue,\n d30: chalk.dim,\n upcoming: chalk.dim,\n};\n\nexport function printError(msg: string): void {\n console.error(chalk.red(\"Error:\"), msg);\n}\n\nexport function printSuccess(msg: string): void {\n console.log(chalk.green(msg));\n}\n\nexport function printWarning(msg: string): void {\n console.log(chalk.yellow(msg));\n}\n\nexport function printJson(data: unknown): void {\n console.log(JSON.stringify(data, null, 2));\n}\n\n// --- Status Panel ---\n\nexport function printStatusPanel(data: ApiRecord): void {\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(chalk.blue.bold(\" Corp Status\"));\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(` ${chalk.bold(\"Workspace:\")} ${data.workspace_id ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Entities:\")} ${data.entity_count ?? 0}`);\n\n const urgency = (data.urgency_counts ?? {}) as Record<string, number>;\n if (Object.keys(urgency).length > 0) {\n console.log(`\\n ${chalk.bold(\"Obligations:\")}`);\n for (const [tier, count] of Object.entries(urgency)) {\n const colorFn = URGENCY_COLORS[tier] ?? ((s: string) => s);\n console.log(` ${colorFn(`${tier}:`)} ${count}`);\n }\n }\n\n if (data.next_deadline) {\n console.log(`\\n ${chalk.bold(\"Next deadline:\")} ${data.next_deadline}`);\n }\n console.log(chalk.blue(\"─\".repeat(50)));\n}\n\n// --- Generic table helper ---\n\nfunction makeTable(title: string, columns: string[]): Table.Table {\n console.log(`\\n${chalk.bold(title)}`);\n return new Table({ head: columns.map((c) => chalk.dim(c)) });\n}\n\nfunction s(val: unknown, maxLen?: number): string {\n const str = val == null ? \"\" : String(val);\n if (maxLen && str.length > maxLen) return str.slice(0, maxLen);\n return str;\n}\n\nfunction money(val: unknown): string {\n if (typeof val === \"number\") return `$${val.toLocaleString()}`;\n return String(val ?? \"\");\n}\n\n// --- Domain tables ---\n\nexport function printEntitiesTable(entities: ApiRecord[]): void {\n const table = makeTable(\"Entities\", [\"ID\", \"Name\", \"Type\", \"Jurisdiction\", \"Status\"]);\n for (const e of entities) {\n table.push([s(e.entity_id, 12), s(e.name), s(e.entity_type), s(e.jurisdiction), s(e.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printObligationsTable(obligations: ApiRecord[]): void {\n const table = makeTable(\"Obligations\", [\"ID\", \"Type\", \"Urgency\", \"Due\", \"Status\"]);\n for (const o of obligations) {\n const urg = s(o.urgency) || \"upcoming\";\n const colorFn = URGENCY_COLORS[urg] ?? ((x: string) => x);\n table.push([s(o.obligation_id, 12), s(o.obligation_type), colorFn(urg), s(o.due_at), s(o.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printContactsTable(contacts: ApiRecord[]): void {\n const table = makeTable(\"Contacts\", [\"ID\", \"Name\", \"Email\", \"Category\", \"Entity\"]);\n for (const c of contacts) {\n table.push([\n s(c.contact_id ?? c.id, 12),\n s(c.name),\n s(c.email),\n s(c.category),\n s(c.entity_name ?? c.entity_id),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printCapTable(data: ApiRecord): void {\n const accessLevel = s(data.access_level) || \"admin\";\n const shareClasses = (data.share_classes ?? []) as ApiRecord[];\n if (shareClasses.length > 0) {\n const cols = [\"Class\", \"Authorized\", \"Outstanding\"];\n if (accessLevel !== \"summary\") cols.push(\"Holders\");\n const table = makeTable(\"Cap Table — Share Classes\", cols);\n for (const sc of shareClasses) {\n const row = [s(sc.class_code ?? sc.name), s(sc.authorized), s(sc.outstanding)];\n if (accessLevel !== \"summary\") {\n const holders = (sc.holders ?? []) as ApiRecord[];\n row.push(holders.map((h) => `${h.name ?? \"?\"}(${h.percentage ?? \"?\"}%)`).join(\", \"));\n }\n table.push(row);\n }\n console.log(table.toString());\n }\n\n const ownership = (data.ownership ?? []) as ApiRecord[];\n if (ownership.length > 0 && accessLevel !== \"summary\") {\n const table = makeTable(\"Ownership Breakdown\", [\"Holder\", \"Shares\", \"Percentage\", \"Class\"]);\n for (const o of ownership) {\n table.push([s(o.holder_name ?? o.name), s(o.shares), `${o.percentage ?? \"\"}%`, s(o.share_class)]);\n }\n console.log(table.toString());\n }\n\n const pools = (data.option_pools ?? []) as ApiRecord[];\n if (pools.length > 0) {\n const table = makeTable(\"Option Pools\", [\"Name\", \"Authorized\", \"Granted\", \"Available\"]);\n for (const p of pools) {\n table.push([s(p.name), s(p.authorized), s(p.granted), s(p.available)]);\n }\n console.log(table.toString());\n }\n\n if (data.fully_diluted_shares != null) {\n const fd = data.fully_diluted_shares;\n console.log(`\\n${chalk.bold(\"Fully Diluted Shares:\")} ${typeof fd === \"number\" ? fd.toLocaleString() : fd}`);\n }\n}\n\nexport function printSafesTable(safes: ApiRecord[]): void {\n const table = makeTable(\"SAFE Notes\", [\"ID\", \"Investor\", \"Amount\", \"Cap\", \"Discount\", \"Date\"]);\n for (const s_ of safes) {\n table.push([\n s(s_.safe_id ?? s_.id, 12),\n s(s_.investor_name ?? s_.investor),\n money(s_.investment_amount ?? s_.amount),\n s(s_.valuation_cap ?? s_.cap),\n s(s_.discount_rate ?? s_.discount),\n s(s_.date ?? s_.created_at),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printTransfersTable(transfers: ApiRecord[]): void {\n const table = makeTable(\"Share Transfers\", [\"ID\", \"From\", \"To\", \"Shares\", \"Class\", \"Date\"]);\n for (const t of transfers) {\n table.push([\n s(t.transfer_id ?? t.id, 12),\n s(t.from_holder ?? t.from),\n s(t.to_holder ?? t.to),\n s(t.shares),\n s(t.share_class),\n s(t.date ?? t.transfer_date),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printValuationsTable(valuations: ApiRecord[]): void {\n const table = makeTable(\"Valuations\", [\"Date\", \"Type\", \"Valuation\", \"PPS\"]);\n for (const v of valuations) {\n table.push([\n s(v.valuation_date ?? v.date),\n s(v.valuation_type ?? v.type),\n s(v.enterprise_value ?? v.valuation),\n s(v.price_per_share ?? v.pps ?? v.fmv_per_share),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printGovernanceTable(bodies: ApiRecord[]): void {\n const table = makeTable(\"Governance Bodies\", [\"ID\", \"Body\", \"Type\", \"Seats\", \"Meetings\"]);\n for (const b of bodies) {\n table.push([\n s(b.body_id ?? b.id, 12),\n s(b.name),\n s(b.body_type ?? b.type),\n s(b.seat_count ?? b.seats),\n s(b.meeting_count ?? b.meetings),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printSeatsTable(seats: ApiRecord[]): void {\n const table = makeTable(\"Seats\", [\"Seat\", \"Holder\", \"Role\", \"Status\"]);\n for (const st of seats) {\n table.push([s(st.seat_name ?? st.title), s(st.holder_name ?? st.holder), s(st.role), s(st.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printMeetingsTable(meetings: ApiRecord[]): void {\n const table = makeTable(\"Meetings\", [\"ID\", \"Title\", \"Date\", \"Status\", \"Resolutions\"]);\n for (const m of meetings) {\n table.push([\n s(m.meeting_id ?? m.id, 12),\n s(m.title ?? m.name),\n s(m.meeting_date ?? m.date),\n s(m.status),\n s(m.resolution_count ?? m.resolutions),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printResolutionsTable(resolutions: ApiRecord[]): void {\n const table = makeTable(\"Resolutions\", [\"ID\", \"Title\", \"Type\", \"Status\", \"For\", \"Against\"]);\n for (const r of resolutions) {\n table.push([\n s(r.resolution_id ?? r.id, 12),\n s(r.title),\n s(r.resolution_type ?? r.type),\n s(r.status),\n s(r.votes_for),\n s(r.votes_against),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printDocumentsTable(docs: ApiRecord[]): void {\n const table = makeTable(\"Documents\", [\"ID\", \"Title\", \"Type\", \"Date\", \"Status\", \"Signatures\"]);\n for (const d of docs) {\n const sigs = d.signatures;\n const sigStr = Array.isArray(sigs) ? `${sigs.length} signed` : s(sigs);\n table.push([\n s(d.document_id ?? d.id, 12),\n s(d.title ?? d.name),\n s(d.document_type ?? d.type),\n s(d.date ?? d.created_at),\n s(d.status),\n sigStr,\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printAgentsTable(agents: ApiRecord[]): void {\n const table = makeTable(\"Agents\", [\"ID\", \"Name\", \"Status\", \"Model\"]);\n for (const a of agents) {\n const status = s(a.status);\n const colored =\n status === \"active\" ? chalk.green(status) : status === \"paused\" ? chalk.yellow(status) : status;\n table.push([s(a.agent_id ?? a.id, 12), s(a.name), colored, s(a.model)]);\n }\n console.log(table.toString());\n}\n\nexport function printApprovalsTable(approvals: ApiRecord[]): void {\n const table = makeTable(\"Pending Approvals\", [\"ID\", \"Type\", \"Requested By\", \"Description\", \"Created\"]);\n for (const a of approvals) {\n let desc = s(a.description ?? a.summary);\n if (desc.length > 60) desc = desc.slice(0, 57) + \"...\";\n table.push([\n s(a.approval_id ?? a.id, 12),\n s(a.approval_type ?? a.type),\n s(a.requested_by ?? a.requester),\n desc,\n s(a.created_at),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printBillingPanel(status: ApiRecord, plans: ApiRecord[]): void {\n const tier = s(status.tier ?? status.plan) || \"free\";\n const subs = (status.subscriptions ?? []) as ApiRecord[];\n const usageCount = status.usage_count ?? 0;\n\n console.log(chalk.green(\"─\".repeat(50)));\n console.log(chalk.green.bold(\" Billing Status\"));\n console.log(chalk.green(\"─\".repeat(50)));\n console.log(` ${chalk.bold(\"Current Tier:\")} ${tier}`);\n console.log(` ${chalk.bold(\"Active Subscriptions:\")} ${subs.length}`);\n for (const sub of subs) {\n console.log(` - ${sub.tier ?? \"N/A\"} (${sub.status ?? \"N/A\"})`);\n }\n console.log(` ${chalk.bold(\"Tool Calls:\")} ${usageCount}`);\n console.log(chalk.dim(\" Manage: corp billing portal\"));\n console.log(chalk.dim(\" Upgrade: corp billing upgrade\"));\n console.log(chalk.green(\"─\".repeat(50)));\n\n if (plans.length > 0) {\n const table = makeTable(\"Available Plans\", [\"Tier\", \"Price\", \"Type\", \"Description\"]);\n for (const p of plans) {\n const amount = (p.amount ?? 0) as number;\n const interval = s(p.interval);\n let priceStr = \"Free\";\n if (amount > 0) {\n priceStr = interval ? `$${Math.round(amount / 100)}/${interval[0]}` : `$${Math.round(amount / 100)}`;\n }\n let name = s(p.name ?? p.tier);\n if (p.addon) name += chalk.dim(\" (add-on)\");\n let desc = s(p.description);\n if (desc.length > 60) desc = desc.slice(0, 57) + \"...\";\n table.push([name, priceStr, s(p.type), desc]);\n }\n console.log(table.toString());\n }\n}\n","import { input, confirm } from \"@inquirer/prompts\";\nimport { loadConfig, saveConfig } from \"../config.js\";\nimport { provisionWorkspace } from \"../api-client.js\";\nimport { printSuccess, printError } from \"../output.js\";\n\nconst API_URL = \"https://api.thecorporation.ai\";\n\nexport async function setupCommand(): Promise<void> {\n const cfg = loadConfig();\n console.log(\"Welcome to corp — corporate governance from the terminal.\\n\");\n\n cfg.api_url = API_URL;\n\n console.log(\"--- User Info ---\");\n const user = cfg.user ?? { name: \"\", email: \"\" };\n user.name = await input({ message: \"Your name\", default: user.name || undefined });\n user.email = await input({ message: \"Your email\", default: user.email || undefined });\n cfg.user = user;\n\n if (!cfg.api_key || !cfg.workspace_id) {\n console.log(\"\\nProvisioning workspace...\");\n try {\n const result = await provisionWorkspace(cfg.api_url, `${user.name}'s workspace`);\n cfg.api_key = result.api_key as string;\n cfg.workspace_id = result.workspace_id as string;\n console.log(`Workspace provisioned: ${result.workspace_id}`);\n } catch (err) {\n printError(`Auto-provision failed: ${err}`);\n console.log(\"You can manually set credentials with: corp config set api_key <key>\");\n }\n } else {\n console.log(\"\\nVerifying existing credentials...\");\n let keyValid = false;\n try {\n const resp = await fetch(\n `${cfg.api_url.replace(/\\/+$/, \"\")}/v1/workspaces/${cfg.workspace_id}/status`,\n { headers: { Authorization: `Bearer ${cfg.api_key}` } }\n );\n keyValid = resp.status !== 401;\n } catch {\n // network error — treat as potentially valid\n }\n\n if (keyValid) {\n console.log(\"Credentials OK.\");\n } else {\n console.log(\"API key is no longer valid.\");\n const reprovision = await confirm({\n message: \"Provision a new workspace? (This will replace your current credentials)\",\n default: false,\n });\n if (reprovision) {\n try {\n const result = await provisionWorkspace(cfg.api_url, `${user.name}'s workspace`);\n cfg.api_key = result.api_key as string;\n cfg.workspace_id = result.workspace_id as string;\n console.log(`Workspace provisioned: ${result.workspace_id}`);\n } catch (err) {\n printError(`Provisioning failed: ${err}`);\n }\n } else {\n console.log(\"Keeping existing credentials. You can manually update with: corp config set api_key <key>\");\n }\n }\n }\n\n saveConfig(cfg);\n console.log(\"\\nConfig saved to ~/.corp/config.json\");\n console.log(\"Run 'corp status' to verify your connection.\");\n}\n","/**\n * Rising cityscape boot animation — ported from packages/cli/corp/tui/widgets/mascot.py\n */\n\n// prettier-ignore\nconst BUILDINGS: string[][] = [\n [\n \" ┌┐ \",\n \" ││ \",\n \" ││ \",\n \" ┌┤├┐ \",\n \" │││││\",\n \" │││││\",\n ],\n [\n \" ╔══╗ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n ],\n [\n \" /\\\\ \",\n \" / \\\\ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n ],\n [\n \" ┌──┐ \",\n \" │≋≋│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n ],\n [\n \" ╻ \",\n \" ┃ \",\n \" ┌┤┐ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n [\n \" ┌┐ \",\n \" ├┤ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n [\n \" ╔═══╗\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n ],\n [\n \" ┬─┬ \",\n \" │~│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n];\n\nconst MAX_HEIGHT = Math.max(...BUILDINGS.map((b) => b.length));\nconst TOTAL_FRAMES = MAX_HEIGHT + 4; // 15 frames, ~1.5s at 100ms\n\nconst GOLD = \"\\x1b[38;2;212;160;23m\";\nconst RESET = \"\\x1b[0m\";\n\nexport function renderFrame(frame: number): string {\n const cols: string[][] = [];\n for (let i = 0; i < BUILDINGS.length; i++) {\n const building = BUILDINGS[i];\n const h = building.length;\n const visible = Math.max(0, Math.min(h, frame - i));\n const width = building[0]?.length ?? 6;\n const blank = \" \".repeat(width);\n const col: string[] = Array(MAX_HEIGHT - visible).fill(blank);\n col.push(...building.slice(h - visible));\n cols.push(col);\n }\n\n const lines: string[] = [];\n for (let row = 0; row < MAX_HEIGHT; row++) {\n lines.push(cols.map((col) => col[row]).join(\"\"));\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Run an async function while displaying the rising cityscape animation.\n * No-ops when stdout is not a TTY (piped, CI, etc.).\n */\nexport async function withAnimation<T>(fn: () => Promise<T>): Promise<T> {\n if (!process.stdout.isTTY) {\n return fn();\n }\n\n let frame = 0;\n let animDone = false;\n const spinChars = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n let spinIdx = 0;\n let lastLineCount = 0;\n\n const clearPrev = () => {\n if (lastLineCount > 0) {\n process.stdout.write(`\\x1b[${lastLineCount}A\\x1b[0J`);\n }\n };\n\n const drawFrame = () => {\n clearPrev();\n if (!animDone) {\n const art = renderFrame(frame);\n const output = `${GOLD}${art}${RESET}\\n`;\n process.stdout.write(output);\n lastLineCount = MAX_HEIGHT + 1;\n frame++;\n if (frame >= TOTAL_FRAMES) {\n animDone = true;\n }\n } else {\n // Dot spinner fallback after animation finishes\n const line = `${GOLD}${spinChars[spinIdx % spinChars.length]} Loading...${RESET}\\n`;\n process.stdout.write(line);\n lastLineCount = 1;\n spinIdx++;\n }\n };\n\n drawFrame();\n const timer = setInterval(drawFrame, 100);\n\n try {\n const result = await fn();\n return result;\n } finally {\n clearInterval(timer);\n clearPrev();\n }\n}\n","import { withAnimation } from \"./animation.js\";\n\n/**\n * Run an async function with a loading animation.\n * Silently skipped when `json` is truthy (pure JSON output) or non-TTY.\n */\nexport async function withSpinner<T>(\n _label: string,\n fn: () => Promise<T>,\n json?: boolean,\n): Promise<T> {\n if (json) {\n return fn();\n }\n return withAnimation(fn);\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printStatusPanel } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\n\nexport async function statusCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await withSpinner(\"Loading\", () => client.getStatus());\n printStatusPanel(data);\n } catch (err) {\n printError(`Failed to fetch status: ${err}`);\n process.exit(1);\n }\n}\n","import { configForDisplay, getValue, loadConfig, saveConfig, setValue } from \"../config.js\";\nimport { printError, printJson } from \"../output.js\";\n\nexport function configSetCommand(key: string, value: string): void {\n const cfg = loadConfig();\n setValue(cfg as unknown as Record<string, unknown>, key, value);\n saveConfig(cfg);\n console.log(`${key} = ${value}`);\n}\n\nexport function configGetCommand(key: string): void {\n const cfg = loadConfig();\n const val = getValue(cfg as unknown as Record<string, unknown>, key);\n if (val === undefined) {\n printError(`Key not found: ${key}`);\n process.exit(1);\n }\n if (typeof val === \"object\" && val !== null) {\n printJson(val);\n } else {\n console.log(String(val));\n }\n}\n\nexport function configListCommand(): void {\n const cfg = loadConfig();\n printJson(configForDisplay(cfg));\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printObligationsTable, printError, printJson } from \"../output.js\";\n\nexport async function obligationsCommand(opts: { tier?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getObligations(opts.tier);\n const obligations = (data.obligations ?? []) as Record<string, unknown>[];\n if (opts.json) printJson(obligations);\n else if (obligations.length === 0) console.log(\"No obligations found.\");\n else printObligationsTable(obligations);\n } catch (err) { printError(`Failed to fetch obligations: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function digestCommand(opts: { trigger?: boolean; key?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n if (opts.trigger) {\n const result = await client.triggerDigest();\n printSuccess(\"Digest triggered.\");\n printJson(result);\n } else if (opts.key) {\n const result = await client.getDigest(opts.key);\n printJson(result);\n } else {\n const digests = await client.listDigests();\n if (digests.length === 0) console.log(\"No digest history found.\");\n else printJson(digests);\n }\n } catch (err) { printError(`Failed: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError } from \"../output.js\";\n\nexport async function linkCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.createLink();\n const code = data.code as string;\n const expires = (data.expires_in_seconds ?? 900) as number;\n console.log();\n console.log(` ${code}`);\n console.log();\n console.log(`Run this on the other device (expires in ${Math.floor(expires / 60)} minutes):`);\n console.log(` corp claim ${code}`);\n console.log();\n } catch (err) {\n printError(`${err}`);\n process.exit(1);\n }\n}\n","import { loadConfig, saveConfig } from \"../config.js\";\nimport { printError } from \"../output.js\";\n\nexport async function claimCommand(code: string): Promise<void> {\n const cfg = loadConfig();\n const apiUrl = (cfg.api_url || \"https://api.thecorporation.ai\").replace(/\\/+$/, \"\");\n try {\n const resp = await fetch(`${apiUrl}/v1/workspaces/claim`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ code }),\n });\n if (!resp.ok) {\n let detail = \"\";\n try { const body = await resp.json() as Record<string, string>; detail = body.detail ?? \"\"; } catch { /* ignore */ }\n printError(detail || `${resp.status} ${resp.statusText}`);\n process.exit(1);\n }\n const data = await resp.json() as Record<string, string>;\n cfg.api_key = data.api_key;\n cfg.workspace_id = data.workspace_id;\n saveConfig(cfg);\n console.log(`Workspace joined: ${data.workspace_id}`);\n console.log(\"Credentials saved to ~/.corp/config.json\");\n } catch (err) {\n printError(`${err}`);\n process.exit(1);\n }\n}\n","import type { ToolCall, LLMResponse } from \"./types.js\";\n\nconst PROVIDER_BASE_URLS: Record<string, string> = {\n openrouter: \"https://openrouter.ai/api/v1\",\n};\n\nexport async function chat(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n provider = \"anthropic\",\n apiKey = \"\",\n model = \"\",\n baseUrl?: string,\n): Promise<LLMResponse> {\n if (provider === \"anthropic\") {\n return chatAnthropic(messages, tools, apiKey, model);\n } else if (provider === \"openai\" || provider === \"openrouter\") {\n const effectiveUrl = baseUrl ?? PROVIDER_BASE_URLS[provider];\n return chatOpenAI(messages, tools, apiKey, model, effectiveUrl);\n }\n throw new Error(`Unknown LLM provider: ${provider}`);\n}\n\nasync function chatAnthropic(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n apiKey = \"\",\n model = \"\",\n): Promise<LLMResponse> {\n const { default: Anthropic } = await import(\"@anthropic-ai/sdk\");\n const client = new Anthropic({ apiKey });\n\n let systemText = \"\";\n const convMessages: Record<string, unknown>[] = [];\n\n for (const msg of messages) {\n if (msg.role === \"system\") {\n systemText = msg.content as string;\n } else if (msg.role === \"tool\") {\n convMessages.push({\n role: \"user\",\n content: [{\n type: \"tool_result\",\n tool_use_id: msg.tool_call_id,\n content: msg.content,\n }],\n });\n } else if (msg.role === \"assistant\" && msg.tool_calls) {\n const contentBlocks: Record<string, unknown>[] = [];\n if (msg.content) contentBlocks.push({ type: \"text\", text: msg.content });\n for (const tc of msg.tool_calls as Record<string, unknown>[]) {\n const fn = tc.function as Record<string, unknown>;\n let args = fn.arguments;\n if (typeof args === \"string\") args = JSON.parse(args);\n contentBlocks.push({ type: \"tool_use\", id: tc.id, name: fn.name, input: args });\n }\n convMessages.push({ role: \"assistant\", content: contentBlocks });\n } else {\n convMessages.push({ role: msg.role, content: msg.content ?? \"\" });\n }\n }\n\n let anthropicTools: Record<string, unknown>[] | undefined;\n if (tools?.length) {\n anthropicTools = tools.map((t) => {\n const fn = (t as Record<string, unknown>).function as Record<string, unknown>;\n return {\n name: fn.name,\n description: fn.description ?? \"\",\n input_schema: fn.parameters ?? { type: \"object\", properties: {} },\n };\n });\n }\n\n const kwargs: Record<string, unknown> = {\n model: model || \"claude-sonnet-4-20250514\",\n max_tokens: 4096,\n messages: convMessages,\n };\n if (systemText) kwargs.system = systemText;\n if (anthropicTools) kwargs.tools = anthropicTools;\n\n const response = await client.messages.create(kwargs as Parameters<typeof client.messages.create>[0]);\n\n let content: string | null = null;\n const toolCallsOut: ToolCall[] = [];\n for (const block of response.content) {\n if (block.type === \"text\") {\n content = block.text;\n } else if (block.type === \"tool_use\") {\n toolCallsOut.push({\n id: block.id,\n name: block.name,\n arguments: typeof block.input === \"object\" ? (block.input as Record<string, unknown>) : {},\n });\n }\n }\n\n return {\n content,\n tool_calls: toolCallsOut,\n usage: {\n prompt_tokens: response.usage.input_tokens,\n completion_tokens: response.usage.output_tokens,\n total_tokens: response.usage.input_tokens + response.usage.output_tokens,\n },\n finish_reason: response.stop_reason ?? null,\n };\n}\n\nasync function chatOpenAI(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n apiKey = \"\",\n model = \"\",\n baseUrl?: string,\n): Promise<LLMResponse> {\n const { default: OpenAI } = await import(\"openai\");\n const clientOpts: Record<string, unknown> = { apiKey };\n if (baseUrl) clientOpts.baseURL = baseUrl;\n const client = new OpenAI(clientOpts as ConstructorParameters<typeof OpenAI>[0]);\n\n const kwargs: Record<string, unknown> = {\n model: model || \"gpt-4o\",\n messages,\n max_tokens: 4096,\n };\n if (tools?.length) {\n kwargs.tools = tools;\n kwargs.tool_choice = \"auto\";\n }\n\n const response = await client.chat.completions.create(kwargs as Parameters<typeof client.chat.completions.create>[0]);\n const choice = response.choices[0];\n const message = choice.message;\n\n const toolCallsOut: ToolCall[] = [];\n if (message.tool_calls) {\n for (const tc of message.tool_calls) {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(tc.function.arguments);\n } catch {\n args = { _raw: tc.function.arguments };\n }\n toolCallsOut.push({ id: tc.id, name: tc.function.name, arguments: args });\n }\n }\n\n return {\n content: message.content,\n tool_calls: toolCallsOut,\n usage: {\n prompt_tokens: response.usage?.prompt_tokens ?? 0,\n completion_tokens: response.usage?.completion_tokens ?? 0,\n total_tokens: response.usage?.total_tokens ?? 0,\n },\n finish_reason: choice.finish_reason ?? null,\n };\n}\n","import {\n TOOL_DEFINITIONS as _TOOL_DEFINITIONS,\n isWriteTool as _isWriteTool,\n executeTool as _executeTool,\n} from \"@thecorporation/corp-tools\";\nimport type { CorpAPIClient } from \"@thecorporation/corp-tools\";\nimport { loadConfig, saveConfig } from \"./config.js\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nexport const TOOL_DEFINITIONS = _TOOL_DEFINITIONS;\nexport const isWriteTool: (name: string, args?: Record<string, unknown>) => boolean = _isWriteTool;\n\nexport async function executeTool(\n name: string,\n args: Record<string, unknown>,\n client: CorpAPIClient,\n): Promise<string> {\n return _executeTool(name, args, client, {\n dataDir: join(homedir(), \".corp\"),\n onEntityFormed: (entityId) => {\n try {\n const cfg = loadConfig();\n cfg.active_entity_id = entityId;\n saveConfig(cfg);\n } catch { /* ignore */ }\n },\n });\n}\n","import { createInterface } from \"node:readline\";\nimport chalk from \"chalk\";\nimport { requireConfig, configForDisplay, getValue, setValue, saveConfig } from \"./config.js\";\nimport { CorpAPIClient } from \"./api-client.js\";\nimport { chat as llmChat } from \"./llm.js\";\nimport { TOOL_DEFINITIONS, executeTool, isWriteTool } from \"./tools.js\";\nimport { printError, printStatusPanel, printObligationsTable, printJson } from \"./output.js\";\nimport type { CorpConfig, LLMResponse, ToolCall } from \"./types.js\";\n\nconst SYSTEM_PROMPT = `You are **corp**, an AI assistant for corporate governance.\nYou help users manage their companies — entities, cap tables, compliance, governance, finances, and more.\nYou have tools to read and write corporate data. Use them to fulfill user requests.\nFor write operations, confirm with the user before proceeding.\nMonetary values are in cents (e.g. 100000 = $1,000.00).\nDocuments must be signed by the human — you cannot sign on their behalf.\nAfter completing actions, suggest logical next steps.`;\n\nexport async function chatCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\", \"llm.api_key\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n const messages: Record<string, unknown>[] = [{ role: \"system\", content: SYSTEM_PROMPT }];\n let totalTokens = 0;\n\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n const prompt = () => new Promise<string>((resolve) => rl.question(chalk.green.bold(\"> \"), resolve));\n\n console.log(chalk.blue.bold(\"corp chat\") + \" — type /help for commands, /quit to exit\\n\");\n\n const slashHandlers: Record<string, (args: string) => void> = {\n \"/status\": async () => {\n try { printStatusPanel(await client.getStatus()); } catch (e) { printError(`Status error: ${e}`); }\n },\n \"/obligations\": async () => {\n try {\n const data = await client.getObligations();\n const obls = (data.obligations ?? []) as Record<string, unknown>[];\n if (obls.length) printObligationsTable(obls);\n else console.log(chalk.dim(\"No obligations found.\"));\n } catch (e) { printError(`Obligations error: ${e}`); }\n },\n \"/digest\": async () => {\n try {\n const digests = await client.listDigests();\n if (digests.length) printJson(digests);\n else console.log(chalk.dim(\"No digest history.\"));\n } catch (e) { printError(`Digest error: ${e}`); }\n },\n \"/config\": () => printJson(configForDisplay(cfg)),\n \"/model\": (args: string) => {\n const model = args.trim();\n if (!model) { console.log(`Current model: ${getValue(cfg as unknown as Record<string, unknown>, \"llm.model\")}`); return; }\n setValue(cfg as unknown as Record<string, unknown>, \"llm.model\", model);\n saveConfig(cfg);\n console.log(`Model switched to: ${model}`);\n },\n \"/cost\": () => console.log(`Session tokens used: ${totalTokens.toLocaleString()}`),\n \"/clear\": () => {\n messages.length = 0;\n messages.push({ role: \"system\", content: SYSTEM_PROMPT });\n totalTokens = 0;\n console.log(chalk.dim(\"Conversation cleared.\"));\n },\n \"/help\": () => {\n console.log(`\n${chalk.bold(\"Chat Slash Commands\")}\n /status Show workspace status\n /obligations List obligations\n /digest Show digest history\n /config Show current config (masked keys)\n /model <name> Switch LLM model\n /cost Show token usage\n /clear Clear conversation\n /help Show this help\n /quit Exit chat`);\n },\n };\n\n try {\n while (true) {\n let userInput: string;\n try {\n userInput = (await prompt()).trim();\n } catch {\n console.log(\"\\n\" + chalk.dim(\"Goodbye.\"));\n break;\n }\n\n if (!userInput) continue;\n\n if (userInput.startsWith(\"/\")) {\n const [cmd, ...rest] = userInput.split(/\\s+/);\n const args = rest.join(\" \");\n if (cmd === \"/quit\" || cmd === \"/exit\") {\n console.log(chalk.dim(\"Goodbye.\"));\n break;\n }\n const handler = slashHandlers[cmd.toLowerCase()];\n if (handler) { await handler(args); continue; }\n printError(`Unknown command: ${cmd}. Type /help for available commands.`);\n continue;\n }\n\n messages.push({ role: \"user\", content: userInput });\n\n const llmCfg = cfg.llm;\n while (true) {\n let response: LLMResponse;\n try {\n response = await llmChat(\n messages, TOOL_DEFINITIONS, llmCfg.provider, llmCfg.api_key, llmCfg.model, llmCfg.base_url,\n );\n } catch (err) {\n printError(`LLM error: ${err}`);\n break;\n }\n\n totalTokens += response.usage.total_tokens;\n\n const assistantMsg: Record<string, unknown> = { role: \"assistant\", content: response.content };\n if (response.tool_calls.length > 0) {\n assistantMsg.tool_calls = response.tool_calls.map((tc) => ({\n id: tc.id, type: \"function\",\n function: { name: tc.name, arguments: JSON.stringify(tc.arguments) },\n }));\n if (!response.content) assistantMsg.content = null;\n }\n messages.push(assistantMsg);\n\n if (response.tool_calls.length === 0) {\n if (response.content) console.log(\"\\n\" + response.content + \"\\n\");\n break;\n }\n\n for (const tc of response.tool_calls) {\n console.log(chalk.dim(` ${isWriteTool(tc.name, tc.arguments) ? \"\\u2699\" : \"\\u2139\"} ${tc.name}(${JSON.stringify(tc.arguments).slice(0, 80)})`));\n const result = await executeTool(tc.name, tc.arguments, client);\n const short = result.length > 200 ? result.slice(0, 197) + \"...\" : result;\n console.log(chalk.dim(` => ${short}`));\n messages.push({ role: \"tool\", tool_call_id: tc.id, content: result });\n }\n }\n }\n } finally {\n rl.close();\n }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printEntitiesTable, printError, printSuccess, printJson } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\nimport chalk from \"chalk\";\n\nexport async function entitiesCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const entities = await withSpinner(\"Loading\", () => client.listEntities(), opts.json);\n if (opts.json) {\n printJson(entities);\n } else if (entities.length === 0) {\n console.log(\"No entities found.\");\n } else {\n printEntitiesTable(entities);\n }\n } catch (err) {\n printError(`Failed to fetch entities: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesShowCommand(entityId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const entities = await client.listEntities();\n const entity = entities.find((e) => e.entity_id === entityId);\n if (!entity) {\n printError(`Entity not found: ${entityId}`);\n process.exit(1);\n }\n if (opts.json) {\n printJson(entity);\n } else {\n console.log(chalk.blue(\"─\".repeat(40)));\n console.log(chalk.blue.bold(\" Entity Detail\"));\n console.log(chalk.blue(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${entity.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Type:\")} ${entity.entity_type ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Jurisdiction:\")} ${entity.jurisdiction ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Status:\")} ${entity.status ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"ID:\")} ${entity.entity_id ?? \"N/A\"}`);\n if (entity.formation_date) console.log(` ${chalk.bold(\"Formation Date:\")} ${entity.formation_date}`);\n if (entity.ein) console.log(` ${chalk.bold(\"EIN:\")} ${entity.ein}`);\n console.log(chalk.blue(\"─\".repeat(40)));\n }\n } catch (err) {\n printError(`Failed to fetch entities: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesConvertCommand(\n entityId: string,\n opts: { to: string; jurisdiction?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: Record<string, string> = { new_entity_type: opts.to };\n if (opts.jurisdiction) data.new_jurisdiction = opts.jurisdiction;\n const result = await client.convertEntity(entityId, data);\n printSuccess(`Entity conversion initiated: ${result.conversion_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to convert entity: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesDissolveCommand(\n entityId: string,\n opts: { reason: string; effectiveDate?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: Record<string, string> = { reason: opts.reason };\n if (opts.effectiveDate) data.effective_date = opts.effectiveDate;\n const result = await client.dissolveEntity(entityId, data);\n printSuccess(`Dissolution initiated: ${result.dissolution_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to dissolve entity: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printContactsTable, printError, printSuccess, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport type { ApiRecord } from \"../types.js\";\n\nexport async function contactsListCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const contacts = await client.listContacts();\n if (opts.json) printJson(contacts);\n else if (contacts.length === 0) console.log(\"No contacts found.\");\n else printContactsTable(contacts);\n } catch (err) {\n printError(`Failed to fetch contacts: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsShowCommand(contactId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const profile = await client.getContactProfile(contactId);\n if (opts.json) {\n printJson(profile);\n } else {\n const contact = (profile.contact ?? profile) as ApiRecord;\n console.log(chalk.cyan(\"─\".repeat(40)));\n console.log(chalk.cyan.bold(\" Contact Profile\"));\n console.log(chalk.cyan(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${contact.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Email:\")} ${contact.email ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Category:\")} ${contact.category ?? \"N/A\"}`);\n if (contact.phone) console.log(` ${chalk.bold(\"Phone:\")} ${contact.phone}`);\n if (contact.notes) console.log(` ${chalk.bold(\"Notes:\")} ${contact.notes}`);\n const holdings = profile.equity_holdings as ApiRecord[] | undefined;\n if (holdings?.length) {\n console.log(`\\n ${chalk.bold(\"Equity Holdings:\")}`);\n for (const h of holdings) console.log(` ${h.share_class ?? \"?\"}: ${h.shares ?? \"?\"} shares`);\n }\n const obls = profile.obligations as unknown[];\n if (obls?.length) console.log(`\\n ${chalk.bold(\"Obligations:\")} ${obls.length}`);\n console.log(chalk.cyan(\"─\".repeat(40)));\n }\n } catch (err) {\n printError(`Failed to fetch contact: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsAddCommand(opts: {\n name: string;\n email: string;\n category?: string;\n phone?: string;\n notes?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = { name: opts.name, email: opts.email };\n if (opts.category) data.category = opts.category;\n if (opts.phone) data.phone = opts.phone;\n if (opts.notes) data.notes = opts.notes;\n const result = await client.createContact(data);\n printSuccess(`Contact created: ${result.contact_id ?? result.id ?? \"OK\"}`);\n } catch (err) {\n printError(`Failed to create contact: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsEditCommand(\n contactId: string,\n opts: { name?: string; email?: string; category?: string; phone?: string; notes?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = {};\n if (opts.name != null) data.name = opts.name;\n if (opts.email != null) data.email = opts.email;\n if (opts.category != null) data.category = opts.category;\n if (opts.phone != null) data.phone = opts.phone;\n if (opts.notes != null) data.notes = opts.notes;\n if (Object.keys(data).length === 0) {\n console.log(\"No fields to update.\");\n return;\n }\n await client.updateContact(contactId, data);\n printSuccess(\"Contact updated.\");\n } catch (err) {\n printError(`Failed to update contact: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport {\n printCapTable, printSafesTable, printTransfersTable,\n printValuationsTable, printError, printSuccess, printJson,\n} from \"../output.js\";\nimport chalk from \"chalk\";\n\nexport async function capTableCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getCapTable(eid);\n if (opts.json) { printJson(data); return; }\n if ((data.access_level as string) === \"none\") {\n printError(\"You do not have access to this entity's cap table.\");\n process.exit(1);\n }\n printCapTable(data);\n try {\n const val = await client.getCurrent409a(eid);\n if (val) print409a(val);\n } catch { /* ignore */ }\n } catch (err) {\n printError(`Failed to fetch cap table: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function safesCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const safes = await client.getSafeNotes(eid);\n if (opts.json) printJson(safes);\n else if (safes.length === 0) console.log(\"No SAFE notes found.\");\n else printSafesTable(safes);\n } catch (err) {\n printError(`Failed to fetch SAFE notes: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function transfersCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const transfers = await client.getShareTransfers(eid);\n if (opts.json) printJson(transfers);\n else if (transfers.length === 0) console.log(\"No share transfers found.\");\n else printTransfersTable(transfers);\n } catch (err) {\n printError(`Failed to fetch transfers: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function valuationsCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const valuations = await client.getValuations(eid);\n if (opts.json) printJson(valuations);\n else if (valuations.length === 0) console.log(\"No valuations found.\");\n else printValuationsTable(valuations);\n } catch (err) {\n printError(`Failed to fetch valuations: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function fourOhNineACommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getCurrent409a(eid);\n if (opts.json) printJson(data);\n else if (!data || Object.keys(data).length === 0) console.log(\"No 409A valuation found.\");\n else print409a(data);\n } catch (err) {\n printError(`Failed to fetch 409A valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueEquityCommand(opts: {\n entityId?: string;\n grantType: string;\n shares: number;\n recipient: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.issueEquity({\n entity_id: eid, grant_type: opts.grantType, shares: opts.shares, recipient_name: opts.recipient,\n });\n printSuccess(`Equity issued: ${result.grant_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to issue equity: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueSafeCommand(opts: {\n entityId?: string;\n investor: string;\n amount: number;\n safeType: string;\n valuationCap: number;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.issueSafe({\n entity_id: eid, investor_name: opts.investor, principal_amount_cents: opts.amount,\n safe_type: opts.safeType, valuation_cap_cents: opts.valuationCap,\n });\n printSuccess(`SAFE issued: ${result.safe_note_id ?? result.safe_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to issue SAFE: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function transferSharesCommand(opts: {\n entityId?: string;\n fromGrant: string;\n to: string;\n shares: number;\n type: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.transferShares({\n entity_id: eid, from_holder: opts.fromGrant, to_holder: opts.to,\n shares: opts.shares, transfer_type: opts.type,\n });\n printSuccess(`Transfer complete: ${result.transfer_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to transfer shares: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function distributeCommand(opts: {\n entityId?: string;\n amount: number;\n type: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.calculateDistribution({\n entity_id: eid, total_amount_cents: opts.amount, distribution_type: opts.type,\n });\n printSuccess(`Distribution calculated: ${result.distribution_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to calculate distribution: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function startRoundCommand(opts: {\n entityId?: string;\n name: string;\n issuerLegalEntityId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.startEquityRound({\n entity_id: eid,\n name: opts.name,\n issuer_legal_entity_id: opts.issuerLegalEntityId,\n });\n printSuccess(`Round started: ${result.round_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to start round: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function addSecurityCommand(opts: {\n entityId?: string;\n roundId: string;\n holderId?: string;\n email?: string;\n instrumentId: string;\n quantity: number;\n recipientName: string;\n principalCents?: number;\n grantType?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const body: Record<string, unknown> = {\n entity_id: eid,\n instrument_id: opts.instrumentId,\n quantity: opts.quantity,\n recipient_name: opts.recipientName,\n };\n if (opts.holderId) body.holder_id = opts.holderId;\n if (opts.email) body.email = opts.email;\n if (opts.principalCents) body.principal_cents = opts.principalCents;\n if (opts.grantType) body.grant_type = opts.grantType;\n const result = await client.addRoundSecurity(opts.roundId, body);\n printSuccess(`Security added for ${opts.recipientName}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to add security: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueRoundCommand(opts: {\n entityId?: string;\n roundId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.issueRound(opts.roundId, { entity_id: eid });\n printSuccess(\"Round issued and closed\");\n printJson(result);\n } catch (err) {\n printError(`Failed to issue round: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function createValuationCommand(opts: {\n entityId?: string;\n type: string;\n date: string;\n methodology: string;\n fmv?: number;\n enterpriseValue?: number;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const body: Record<string, unknown> = {\n entity_id: eid,\n valuation_type: opts.type,\n effective_date: opts.date,\n methodology: opts.methodology,\n };\n if (opts.fmv != null) body.fmv_per_share_cents = opts.fmv;\n if (opts.enterpriseValue != null) body.enterprise_value_cents = opts.enterpriseValue;\n const result = await client.createValuation(body);\n printSuccess(`Valuation created: ${result.valuation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to create valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function submitValuationCommand(opts: {\n entityId?: string;\n valuationId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.submitValuationForApproval(opts.valuationId, eid);\n printSuccess(`Valuation submitted for approval: ${result.valuation_id ?? \"OK\"}`);\n if (result.meeting_id) console.log(` Meeting: ${result.meeting_id}`);\n if (result.agenda_item_id) console.log(` Agenda Item: ${result.agenda_item_id}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to submit valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function approveValuationCommand(opts: {\n entityId?: string;\n valuationId: string;\n resolutionId?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.approveValuation(opts.valuationId, eid, opts.resolutionId);\n printSuccess(`Valuation approved: ${result.valuation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to approve valuation: ${err}`);\n process.exit(1);\n }\n}\n\nfunction print409a(data: Record<string, unknown>): void {\n console.log(chalk.green(\"─\".repeat(40)));\n console.log(chalk.green.bold(\" 409A Valuation\"));\n console.log(chalk.green(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"FMV/Share:\")} $${data.fmv_per_share ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Enterprise Value:\")} $${data.enterprise_value ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Valuation Date:\")} ${data.valuation_date ?? \"N/A\"}`);\n if (data.provider) console.log(` ${chalk.bold(\"Provider:\")} ${data.provider}`);\n console.log(chalk.green(\"─\".repeat(40)));\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function financeInvoiceCommand(opts: {\n entityId?: string; customer: string; amount: number; dueDate: string; description: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.createInvoice({\n entity_id: eid, customer_name: opts.customer, amount_cents: opts.amount,\n due_date: opts.dueDate, description: opts.description,\n });\n printSuccess(`Invoice created: ${result.invoice_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to create invoice: ${err}`); process.exit(1); }\n}\n\nexport async function financePayrollCommand(opts: {\n entityId?: string; periodStart: string; periodEnd: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.runPayroll({\n entity_id: eid, pay_period_start: opts.periodStart, pay_period_end: opts.periodEnd,\n });\n printSuccess(`Payroll run created: ${result.payroll_run_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to run payroll: ${err}`); process.exit(1); }\n}\n\nexport async function financePayCommand(opts: {\n entityId?: string; amount: number; recipient: string; method: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.submitPayment({\n entity_id: eid, amount_cents: opts.amount, recipient: opts.recipient,\n description: `Payment via ${opts.method}`,\n });\n printSuccess(`Payment submitted: ${result.payment_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to submit payment: ${err}`); process.exit(1); }\n}\n\nexport async function financeOpenAccountCommand(opts: {\n entityId?: string; institution: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.openBankAccount({ entity_id: eid, institution_name: opts.institution });\n printSuccess(`Bank account opened: ${result.account_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to open bank account: ${err}`); process.exit(1); }\n}\n\nexport async function financeClassifyContractorCommand(opts: {\n entityId?: string; name: string; state: string; hours: number;\n exclusive: boolean; duration: number; providesTools: boolean;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.classifyContractor({\n entity_id: eid, contractor_name: opts.name, state: opts.state, hours_per_week: opts.hours,\n exclusive_client: opts.exclusive, duration_months: opts.duration, provides_tools: opts.providesTools,\n });\n printSuccess(`Classification: ${result.risk_level ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to classify contractor: ${err}`); process.exit(1); }\n}\n\nexport async function financeReconcileCommand(opts: {\n entityId?: string; startDate: string; endDate: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.reconcileLedger({\n entity_id: eid, start_date: opts.startDate, end_date: opts.endDate,\n });\n printSuccess(`Ledger reconciled: ${result.reconciliation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to reconcile ledger: ${err}`); process.exit(1); }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport {\n printGovernanceTable, printSeatsTable, printMeetingsTable,\n printResolutionsTable, printError, printSuccess, printJson,\n} from \"../output.js\";\n\nexport async function governanceListCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const bodies = await client.listGovernanceBodies(eid);\n if (opts.json) printJson(bodies);\n else if (bodies.length === 0) console.log(\"No governance bodies found.\");\n else printGovernanceTable(bodies);\n } catch (err) { printError(`Failed to fetch governance bodies: ${err}`); process.exit(1); }\n}\n\nexport async function governanceSeatsCommand(bodyId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const seats = await client.getGovernanceSeats(bodyId);\n if (opts.json) printJson(seats);\n else if (seats.length === 0) console.log(\"No seats found.\");\n else printSeatsTable(seats);\n } catch (err) { printError(`Failed to fetch seats: ${err}`); process.exit(1); }\n}\n\nexport async function governanceMeetingsCommand(bodyId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const meetings = await client.listMeetings(bodyId);\n if (opts.json) printJson(meetings);\n else if (meetings.length === 0) console.log(\"No meetings found.\");\n else printMeetingsTable(meetings);\n } catch (err) { printError(`Failed to fetch meetings: ${err}`); process.exit(1); }\n}\n\nexport async function governanceResolutionsCommand(meetingId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const resolutions = await client.getMeetingResolutions(meetingId);\n if (opts.json) printJson(resolutions);\n else if (resolutions.length === 0) console.log(\"No resolutions found.\");\n else printResolutionsTable(resolutions);\n } catch (err) { printError(`Failed to fetch resolutions: ${err}`); process.exit(1); }\n}\n\nexport async function governanceConveneCommand(opts: {\n entityId?: string; body: string; meetingType: string; title: string; date: string; agenda: string[];\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.scheduleMeeting({\n entity_id: eid, body_id: opts.body, meeting_type: opts.meetingType,\n title: opts.title, scheduled_date: opts.date,\n agenda_item_titles: opts.agenda,\n });\n printSuccess(`Meeting scheduled: ${result.meeting_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to schedule meeting: ${err}`); process.exit(1); }\n}\n\nexport async function governanceVoteCommand(\n meetingId: string,\n itemId: string,\n opts: { voter: string; vote: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, undefined);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.castVote(eid, meetingId, itemId, {\n voter_id: opts.voter, vote_value: opts.vote,\n });\n printSuccess(`Vote cast: ${result.vote_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to cast vote: ${err}`); process.exit(1); }\n}\n\nexport async function sendNoticeCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.sendNotice(meetingId, eid);\n printSuccess(`Notice sent for meeting ${meetingId}`);\n printJson(result);\n } catch (err) { printError(`Failed to send notice: ${err}`); process.exit(1); }\n}\n\nexport async function adjournMeetingCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.adjournMeeting(meetingId, eid);\n printSuccess(`Meeting ${meetingId} adjourned`);\n printJson(result);\n } catch (err) { printError(`Failed to adjourn meeting: ${err}`); process.exit(1); }\n}\n\nexport async function cancelMeetingCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.cancelMeeting(meetingId, eid);\n printSuccess(`Meeting ${meetingId} cancelled`);\n printJson(result);\n } catch (err) { printError(`Failed to cancel meeting: ${err}`); process.exit(1); }\n}\n\nexport async function finalizeAgendaItemCommand(\n meetingId: string, itemId: string, opts: { status: string; entityId?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.finalizeAgendaItem(meetingId, itemId, {\n entity_id: eid, status: opts.status,\n });\n printSuccess(`Agenda item ${itemId} finalized as ${opts.status}`);\n printJson(result);\n } catch (err) { printError(`Failed to finalize agenda item: ${err}`); process.exit(1); }\n}\n\nexport async function computeResolutionCommand(\n meetingId: string, itemId: string, opts: { text: string; entityId?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.computeResolution(meetingId, itemId, eid, {\n resolution_text: opts.text,\n });\n printSuccess(`Resolution computed for agenda item ${itemId}`);\n printJson(result);\n } catch (err) { printError(`Failed to compute resolution: ${err}`); process.exit(1); }\n}\n\nexport async function writtenConsentCommand(opts: {\n body: string; title: string; description: string; entityId?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.writtenConsent({\n entity_id: eid, body_id: opts.body, title: opts.title, description: opts.description,\n });\n printSuccess(`Written consent created: ${result.meeting_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to create written consent: ${err}`); process.exit(1); }\n}\n\nexport async function listAgendaItemsCommand(meetingId: string, opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const items = await client.listAgendaItems(meetingId, eid);\n if (opts.json) printJson(items);\n else if (items.length === 0) console.log(\"No agenda items found.\");\n else printJson(items);\n } catch (err) { printError(`Failed to list agenda items: ${err}`); process.exit(1); }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printDocumentsTable, printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function documentsListCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const docs = await client.getEntityDocuments(eid);\n if (opts.json) printJson(docs);\n else if (docs.length === 0) console.log(\"No documents found.\");\n else printDocumentsTable(docs);\n } catch (err) { printError(`Failed to fetch documents: ${err}`); process.exit(1); }\n}\n\nexport async function documentsSigningLinkCommand(docId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = client.getSigningLink(docId);\n printSuccess(`Signing link: ${result.signing_url}`);\n console.log(\"Open this link in your browser to sign the document.\");\n } catch (err) { printError(`Failed to get signing link: ${err}`); process.exit(1); }\n}\n\nexport async function documentsGenerateCommand(opts: {\n entityId?: string; template: string; counterparty: string; effectiveDate?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.generateContract({\n entity_id: eid, template_type: opts.template,\n parameters: { counterparty_name: opts.counterparty, effective_date: opts.effectiveDate ?? \"\" },\n });\n printSuccess(`Contract generated: ${result.contract_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to generate contract: ${err}`); process.exit(1); }\n}\n\nexport async function documentsPreviewPdfCommand(opts: {\n entityId?: string; documentId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const apiUrl = cfg.api_url.replace(/\\/+$/, \"\");\n const qs = new URLSearchParams({ entity_id: eid, document_id: opts.documentId }).toString();\n const url = `${apiUrl}/v1/documents/preview/pdf?${qs}`;\n printSuccess(`Preview PDF URL: ${url}`);\n console.log(\"Use your API key to authenticate the download.\");\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function taxFileCommand(opts: { entityId?: string; type: string; year: number }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.fileTaxDocument({ entity_id: eid, document_type: opts.type, tax_year: opts.year });\n printSuccess(`Tax document filed: ${result.filing_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to file tax document: ${err}`); process.exit(1); }\n}\n\nexport async function taxDeadlineCommand(opts: {\n entityId?: string; type: string; dueDate: string; description: string; recurrence?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.trackDeadline({\n entity_id: eid, deadline_type: opts.type, due_date: opts.dueDate,\n description: opts.description, recurrence: opts.recurrence ?? \"\",\n });\n printSuccess(`Deadline tracked: ${result.deadline_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to track deadline: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printAgentsTable, printError, printSuccess, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport type { ApiRecord } from \"../types.js\";\n\nexport async function agentsListCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const agents = await client.listAgents();\n if (opts.json) printJson(agents);\n else if (agents.length === 0) console.log(\"No agents found.\");\n else printAgentsTable(agents);\n } catch (err) { printError(`Failed to fetch agents: ${err}`); process.exit(1); }\n}\n\nexport async function agentsShowCommand(agentId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const agent = await client.getAgent(agentId);\n let usage: ApiRecord = {};\n try { usage = await client.getAgentUsage(agentId); } catch { /* ignore */ }\n if (opts.json) { printJson({ agent, usage }); return; }\n console.log(chalk.magenta(\"─\".repeat(40)));\n console.log(chalk.magenta.bold(\" Agent Detail\"));\n console.log(chalk.magenta(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${agent.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Status:\")} ${agent.status ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Model:\")} ${agent.model ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"ID:\")} ${agent.agent_id ?? \"N/A\"}`);\n if (agent.system_prompt) {\n let prompt = String(agent.system_prompt);\n if (prompt.length > 100) prompt = prompt.slice(0, 97) + \"...\";\n console.log(` ${chalk.bold(\"Prompt:\")} ${prompt}`);\n }\n if (Object.keys(usage).length > 0) {\n console.log(`\\n ${chalk.bold(\"Usage:\")}`);\n for (const [k, v] of Object.entries(usage)) {\n if (k !== \"agent_id\") console.log(` ${k}: ${v}`);\n }\n }\n console.log(chalk.magenta(\"─\".repeat(40)));\n } catch (err) { printError(`Failed to fetch agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsCreateCommand(opts: { name: string; prompt: string; model?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = { name: opts.name, system_prompt: opts.prompt };\n if (opts.model) data.model = opts.model;\n const result = await client.createAgent(data);\n printSuccess(`Agent created: ${result.agent_id ?? result.id ?? \"OK\"}`);\n } catch (err) { printError(`Failed to create agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsPauseCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.updateAgent(agentId, { status: \"paused\" });\n printSuccess(`Agent ${agentId} paused.`);\n } catch (err) { printError(`Failed to pause agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsResumeCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.updateAgent(agentId, { status: \"active\" });\n printSuccess(`Agent ${agentId} resumed.`);\n } catch (err) { printError(`Failed to resume agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsDeleteCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.deleteAgent(agentId);\n printSuccess(`Agent ${agentId} deleted.`);\n } catch (err) { printError(`Failed to delete agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsMessageCommand(agentId: string, opts: { body: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.sendAgentMessage(agentId, opts.body);\n printSuccess(`Message sent. Execution: ${result.execution_id ?? \"OK\"}`);\n } catch (err) { printError(`Failed to send message: ${err}`); process.exit(1); }\n}\n\nexport async function agentsExecutionsCommand(agentId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const executions = await client.listAgentExecutions(agentId);\n if (opts.json) { printJson(executions); return; }\n if (executions.length === 0) { console.log(\"No executions found.\"); return; }\n console.log(`\\n${chalk.bold(\"Agent Executions\")}`);\n const table = new Table({ head: [chalk.dim(\"ID\"), chalk.dim(\"Status\"), chalk.dim(\"Started\"), chalk.dim(\"Duration\")] });\n for (const ex of executions) {\n table.push([\n String(ex.execution_id ?? \"\").slice(0, 12),\n String(ex.status ?? \"\"),\n String(ex.started_at ?? \"\"),\n String(ex.duration ?? \"\"),\n ]);\n }\n console.log(table.toString());\n } catch (err) { printError(`Failed to fetch executions: ${err}`); process.exit(1); }\n}\n\nexport async function agentsSkillCommand(agentId: string, opts: {\n name: string; description: string; instructions?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.addAgentSkill(agentId, {\n skill_name: opts.name, description: opts.description, instructions: opts.instructions ?? \"\",\n });\n printSuccess(`Skill '${opts.name}' added to agent ${agentId}.`);\n printJson(result);\n } catch (err) { printError(`Failed to add skill: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printBillingPanel, printError, printSuccess, printJson } from \"../output.js\";\nimport { execSync } from \"node:child_process\";\n\nfunction makeClient() {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n return new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n}\n\nfunction openUrl(url: string) {\n try {\n const cmd = process.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"start\" : \"xdg-open\";\n execSync(`${cmd} ${JSON.stringify(url)}`, { stdio: \"ignore\" });\n } catch { /* browser open is best-effort */ }\n}\n\nexport async function billingCommand(opts: { json?: boolean }): Promise<void> {\n const client = makeClient();\n try {\n const [status, plans] = await Promise.all([client.getBillingStatus(), client.getBillingPlans()]);\n if (opts.json) printJson({ status, plans });\n else printBillingPanel(status, plans);\n } catch (err) { printError(`Failed to fetch billing info: ${err}`); process.exit(1); }\n}\n\nexport async function billingPortalCommand(): Promise<void> {\n const client = makeClient();\n try {\n const result = await client.createBillingPortal();\n const url = result.portal_url as string;\n if (!url) { printError(\"No portal URL returned. Ensure you have an active subscription.\"); process.exit(1); }\n console.log(`Opening Stripe Customer Portal...\\n${url}`);\n openUrl(url);\n printSuccess(\"Portal opened in your browser.\");\n } catch (err) { printError(`Failed to create portal session: ${err}`); process.exit(1); }\n}\n\nexport async function billingUpgradeCommand(opts: { tier: string }): Promise<void> {\n const client = makeClient();\n try {\n const result = await client.createBillingCheckout(opts.tier);\n const url = result.checkout_url as string;\n if (!url) { printError(\"No checkout URL returned.\"); process.exit(1); }\n console.log(`Opening Stripe Checkout for ${opts.tier}...\\n${url}`);\n openUrl(url);\n printSuccess(\"Checkout opened in your browser.\");\n } catch (err) { printError(`Failed to create checkout session: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printApprovalsTable, printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function approvalsListCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const approvals = await client.listPendingApprovals();\n if (opts.json) printJson(approvals);\n else if (approvals.length === 0) console.log(\"No pending approvals.\");\n else printApprovalsTable(approvals);\n } catch (err) { printError(`Failed to fetch approvals: ${err}`); process.exit(1); }\n}\n\nexport async function approvalsRespondCommand(\n approvalId: string,\n decision: string,\n opts: { message?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.respondApproval(approvalId, decision, opts.message);\n printSuccess(`Approval ${approvalId} ${decision}d.`);\n } catch (err) { printError(`Failed to respond to approval: ${err}`); process.exit(1); }\n}\n","import { input, select, confirm, number } from \"@inquirer/prompts\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess } from \"../output.js\";\nimport type { ApiRecord } from \"../types.js\";\n\n// ── Types ──────────────────────────────────────────────────────\n\ninterface FounderInfo {\n name: string;\n email: string;\n role: string;\n address?: { street: string; city: string; state: string; zip: string };\n officer_title?: string;\n is_incorporator?: boolean;\n shares_purchased?: number;\n ownership_pct?: number;\n vesting?: { total_months: number; cliff_months: number; acceleration?: string };\n ip_description?: string;\n}\n\ninterface FormOptions {\n type?: string;\n name?: string;\n jurisdiction?: string;\n member?: string[];\n fiscalYearEnd?: string;\n sCorp?: boolean;\n transferRestrictions?: boolean;\n rofr?: boolean;\n address?: string;\n}\n\n// ── Helpers ────────────────────────────────────────────────────\n\nfunction isCorp(entityType: string): boolean {\n return entityType === \"c_corp\" || entityType === \"s_corp\" || entityType === \"corporation\";\n}\n\nfunction sectionHeader(title: string): void {\n console.log();\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(chalk.blue.bold(` ${title}`));\n console.log(chalk.blue(\"─\".repeat(50)));\n}\n\nasync function promptAddress(): Promise<{ street: string; city: string; state: string; zip: string }> {\n const street = await input({ message: \" Street address\" });\n const city = await input({ message: \" City\" });\n const state = await input({ message: \" State (2-letter)\", default: \"DE\" });\n const zip = await input({ message: \" ZIP code\" });\n return { street, city, state, zip };\n}\n\n// ── Phase 1: Entity Details ────────────────────────────────────\n\nasync function phaseEntityDetails(opts: FormOptions, serverCfg: ApiRecord, scripted: boolean) {\n if (!scripted) sectionHeader(\"Phase 1: Entity Details\");\n\n let entityType = opts.type;\n if (!entityType) {\n if (scripted) { entityType = \"llc\"; }\n else {\n const types = (serverCfg.entity_types ?? [\"llc\", \"c_corp\"]) as string[];\n entityType = await select({\n message: \"Entity type\",\n choices: types.map((t) => ({\n value: t,\n name: t === \"c_corp\" ? \"C Corporation\" : t === \"s_corp\" ? \"S Corporation\" : t.toUpperCase(),\n })),\n });\n }\n }\n\n let name = opts.name;\n if (!name) {\n if (scripted) { printError(\"--name is required in scripted mode\"); process.exit(1); }\n name = await input({ message: \"Legal name\" });\n }\n\n let jurisdiction = opts.jurisdiction;\n if (!jurisdiction) {\n const defaultJ = entityType === \"llc\" ? \"US-WY\" : \"US-DE\";\n if (scripted) { jurisdiction = defaultJ; }\n else { jurisdiction = await input({ message: \"Jurisdiction\", default: defaultJ }); }\n }\n\n let companyAddress: { street: string; city: string; state: string; zip: string } | undefined;\n if (opts.address) {\n const parts = opts.address.split(\",\").map((p) => p.trim());\n if (parts.length === 4) {\n companyAddress = { street: parts[0], city: parts[1], state: parts[2], zip: parts[3] };\n }\n }\n if (!companyAddress && !scripted) {\n const wantAddress = await confirm({ message: \"Add company address?\", default: false });\n if (wantAddress) {\n companyAddress = await promptAddress();\n }\n }\n\n const fiscalYearEnd = opts.fiscalYearEnd ?? \"12-31\";\n\n let sCorpElection = opts.sCorp ?? false;\n if (!scripted && isCorp(entityType) && opts.sCorp === undefined) {\n sCorpElection = await confirm({ message: \"S-Corp election?\", default: false });\n }\n\n return { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection };\n}\n\n// ── Phase 2: People ────────────────────────────────────────────\n\nasync function phasePeople(\n opts: FormOptions,\n entityType: string,\n scripted: boolean,\n): Promise<FounderInfo[]> {\n if (!scripted) sectionHeader(\"Phase 2: Founders & Officers\");\n\n const founders: FounderInfo[] = [];\n\n // CLI-provided members (scripted mode)\n if (scripted) {\n for (const m of opts.member!) {\n const parts = m.split(\",\").map((p) => p.trim());\n if (parts.length < 3) {\n printError(`Invalid member format: ${m}. Expected: name,email,role[,pct]`);\n process.exit(1);\n }\n const f: FounderInfo = { name: parts[0], email: parts[1], role: parts[2] };\n if (parts.length >= 4) f.ownership_pct = parseFloat(parts[3]);\n founders.push(f);\n }\n return founders;\n }\n\n // Interactive mode\n const founderCount = (await number({ message: \"Number of founders (1-6)\", default: 1 })) ?? 1;\n\n for (let i = 0; i < founderCount; i++) {\n console.log(chalk.dim(`\\n Founder ${i + 1} of ${founderCount}:`));\n const name = await input({ message: ` Name` });\n const email = await input({ message: ` Email` });\n\n let role = \"member\";\n if (isCorp(entityType)) {\n role = await select({\n message: \" Role\",\n choices: [\n { value: \"director\", name: \"Director\" },\n { value: \"officer\", name: \"Officer\" },\n { value: \"member\", name: \"Shareholder only\" },\n ],\n });\n }\n\n const wantAddress = await confirm({ message: \" Add address?\", default: false });\n const address = wantAddress ? await promptAddress() : undefined;\n\n let officerTitle: string | undefined;\n if (isCorp(entityType)) {\n const wantOfficer = role === \"officer\" || await confirm({ message: \" Assign officer title?\", default: i === 0 });\n if (wantOfficer) {\n officerTitle = await select({\n message: \" Officer title\",\n choices: [\n { value: \"ceo\", name: \"CEO\" },\n { value: \"cfo\", name: \"CFO\" },\n { value: \"secretary\", name: \"Secretary\" },\n { value: \"president\", name: \"President\" },\n { value: \"vp\", name: \"VP\" },\n ],\n });\n }\n }\n\n let isIncorporator = false;\n if (isCorp(entityType) && i === 0 && founderCount === 1) {\n isIncorporator = true;\n } else if (isCorp(entityType)) {\n isIncorporator = await confirm({ message: \" Designate as sole incorporator?\", default: i === 0 });\n }\n\n founders.push({ name, email, role, address, officer_title: officerTitle, is_incorporator: isIncorporator });\n }\n\n return founders;\n}\n\n// ── Phase 3: Stock & Finalize ──────────────────────────────────\n\nasync function phaseStock(\n opts: FormOptions,\n entityType: string,\n founders: FounderInfo[],\n scripted: boolean,\n): Promise<{ founders: FounderInfo[]; transferRestrictions: boolean; rofr: boolean }> {\n if (!scripted) sectionHeader(\"Phase 3: Equity & Finalize\");\n\n const transferRestrictions = opts.transferRestrictions ?? (\n !scripted && isCorp(entityType)\n ? await confirm({ message: \"Transfer restrictions on shares?\", default: true })\n : isCorp(entityType)\n );\n\n const rofr = opts.rofr ?? (\n !scripted && isCorp(entityType)\n ? await confirm({ message: \"Right of first refusal?\", default: true })\n : isCorp(entityType)\n );\n\n if (!scripted) {\n for (const f of founders) {\n console.log(chalk.dim(`\\n Equity for ${f.name}:`));\n\n if (isCorp(entityType)) {\n const shares = await number({ message: ` Shares to purchase`, default: 0 });\n f.shares_purchased = shares ?? 0;\n if (f.shares_purchased === 0) {\n const pct = await number({ message: ` Ownership % (1-100)`, default: founders.length === 1 ? 100 : 0 });\n f.ownership_pct = pct ?? 0;\n }\n } else {\n const pct = await number({\n message: ` Ownership % (1-100)`,\n default: founders.length === 1 ? 100 : 0,\n });\n f.ownership_pct = pct ?? 0;\n }\n\n if (isCorp(entityType)) {\n const wantVesting = await confirm({ message: \" Add vesting schedule?\", default: false });\n if (wantVesting) {\n const totalMonths = (await number({ message: \" Total vesting months\", default: 48 })) ?? 48;\n const cliffMonths = (await number({ message: \" Cliff months\", default: 12 })) ?? 12;\n const acceleration = await select({\n message: \" Acceleration\",\n choices: [\n { value: \"none\", name: \"None\" },\n { value: \"single_trigger\", name: \"Single trigger\" },\n { value: \"double_trigger\", name: \"Double trigger\" },\n ],\n });\n f.vesting = {\n total_months: totalMonths,\n cliff_months: cliffMonths,\n acceleration: acceleration === \"none\" ? undefined : acceleration,\n };\n }\n }\n\n const wantIp = await confirm({ message: \" Contributing IP?\", default: false });\n if (wantIp) {\n f.ip_description = await input({ message: \" Describe IP being contributed\" });\n }\n }\n }\n\n return { founders, transferRestrictions, rofr };\n}\n\n// ── Summary Table ──────────────────────────────────────────────\n\nfunction printSummary(\n entityType: string,\n name: string,\n jurisdiction: string,\n fiscalYearEnd: string,\n sCorpElection: boolean,\n founders: FounderInfo[],\n transferRestrictions: boolean,\n rofr: boolean,\n): void {\n sectionHeader(\"Formation Summary\");\n\n console.log(` ${chalk.bold(\"Entity:\")} ${name}`);\n console.log(` ${chalk.bold(\"Type:\")} ${entityType}`);\n console.log(` ${chalk.bold(\"Jurisdiction:\")} ${jurisdiction}`);\n console.log(` ${chalk.bold(\"Fiscal Year End:\")} ${fiscalYearEnd}`);\n if (isCorp(entityType)) {\n console.log(` ${chalk.bold(\"S-Corp Election:\")} ${sCorpElection ? \"Yes\" : \"No\"}`);\n console.log(` ${chalk.bold(\"Transfer Restrictions:\")} ${transferRestrictions ? \"Yes\" : \"No\"}`);\n console.log(` ${chalk.bold(\"Right of First Refusal:\")} ${rofr ? \"Yes\" : \"No\"}`);\n }\n\n const table = new Table({\n head: [chalk.dim(\"Name\"), chalk.dim(\"Email\"), chalk.dim(\"Role\"), chalk.dim(\"Equity\"), chalk.dim(\"Officer\")],\n });\n for (const f of founders) {\n const equity = f.shares_purchased\n ? `${f.shares_purchased.toLocaleString()} shares`\n : f.ownership_pct\n ? `${f.ownership_pct}%`\n : \"—\";\n table.push([f.name, f.email, f.role, equity, f.officer_title ?? \"—\"]);\n }\n console.log(table.toString());\n}\n\n// ── Main Command ───────────────────────────────────────────────\n\nexport async function formCommand(opts: FormOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n let serverCfg: ApiRecord = {};\n try { serverCfg = await client.getConfig(); } catch { /* ignore */ }\n\n const scripted = !!(opts.member && opts.member.length > 0);\n\n // Phase 1: Entity Details\n const { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection } =\n await phaseEntityDetails(opts, serverCfg, scripted);\n\n // Phase 2: People\n const founders = await phasePeople(opts, entityType, scripted);\n\n // Phase 3: Stock & Finalize\n const { transferRestrictions, rofr } = await phaseStock(opts, entityType, founders, scripted);\n\n // Summary & Confirm\n printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);\n\n const shouldProceed = scripted\n ? true\n : await confirm({ message: \"Proceed with formation?\", default: true });\n\n if (!shouldProceed) {\n console.log(chalk.yellow(\"Formation cancelled.\"));\n return;\n }\n\n // Build members payload\n const members: ApiRecord[] = founders.map((f) => {\n const m: ApiRecord = {\n name: f.name,\n email: f.email,\n role: f.role,\n investor_type: \"natural_person\",\n };\n if (f.ownership_pct) m.ownership_pct = f.ownership_pct;\n if (f.shares_purchased) m.shares_purchased = f.shares_purchased;\n if (f.address) m.address = f.address;\n if (f.officer_title) m.officer_title = f.officer_title;\n if (f.is_incorporator) m.is_incorporator = true;\n if (f.vesting) m.vesting = f.vesting;\n if (f.ip_description) m.ip_description = f.ip_description;\n return m;\n });\n\n const payload: ApiRecord = {\n entity_type: entityType,\n legal_name: name,\n jurisdiction,\n members,\n workspace_id: cfg.workspace_id,\n fiscal_year_end: fiscalYearEnd,\n s_corp_election: sCorpElection,\n transfer_restrictions: transferRestrictions,\n right_of_first_refusal: rofr,\n };\n if (companyAddress) payload.company_address = companyAddress;\n\n const result = await client.createFormationWithCapTable(payload);\n\n // Output results\n printSuccess(`Formation created: ${result.formation_id ?? result.id ?? \"OK\"}`);\n if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);\n if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);\n if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);\n\n const docIds = (result.document_ids ?? []) as string[];\n if (docIds.length > 0) {\n console.log(` Documents: ${docIds.length} generated`);\n }\n\n const holders = (result.holders ?? []) as ApiRecord[];\n if (holders.length > 0) {\n console.log();\n const table = new Table({\n head: [chalk.dim(\"Holder\"), chalk.dim(\"Shares\"), chalk.dim(\"Ownership %\")],\n });\n for (const h of holders) {\n const pct = typeof h.ownership_pct === \"number\" ? `${h.ownership_pct.toFixed(1)}%` : \"—\";\n table.push([String(h.name ?? \"?\"), String(h.shares ?? 0), pct]);\n }\n console.log(chalk.bold(\" Cap Table:\"));\n console.log(table.toString());\n }\n\n if (result.next_action) {\n console.log(chalk.yellow(`\\n Next: ${result.next_action}`));\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes(\"exit\")) throw err;\n printError(`Failed to create formation: ${err}`);\n process.exit(1);\n }\n}\n\n// ── Staged Formation Subcommands ─────────────────────────────\n\ninterface FormCreateOptions {\n type: string;\n name: string;\n jurisdiction?: string;\n}\n\nexport async function formCreateCommand(opts: FormCreateOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const entityType = opts.type === \"c_corp\" || opts.type === \"corporation\" ? \"corporation\" : \"llc\";\n const payload: ApiRecord = {\n entity_type: entityType,\n legal_name: opts.name,\n };\n if (opts.jurisdiction) payload.jurisdiction = opts.jurisdiction;\n\n const result = await client.createPendingEntity(payload);\n printSuccess(`Pending entity created: ${result.entity_id}`);\n console.log(` Name: ${result.legal_name}`);\n console.log(` Type: ${result.entity_type}`);\n console.log(` Jurisdiction: ${result.jurisdiction}`);\n console.log(` Status: ${result.formation_status}`);\n console.log(chalk.yellow(`\\n Next: corp form add-founder ${result.entity_id} --name \"...\" --email \"...\" --role member --pct 50`));\n } catch (err) {\n printError(`Failed to create pending entity: ${err}`);\n process.exit(1);\n }\n}\n\ninterface FormAddFounderOptions {\n name: string;\n email: string;\n role: string;\n pct: string;\n officerTitle?: string;\n incorporator?: boolean;\n}\n\nexport async function formAddFounderCommand(entityId: string, opts: FormAddFounderOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const payload: ApiRecord = {\n name: opts.name,\n email: opts.email,\n role: opts.role,\n ownership_pct: parseFloat(opts.pct),\n };\n if (opts.officerTitle) payload.officer_title = opts.officerTitle;\n if (opts.incorporator) payload.is_incorporator = true;\n\n const result = await client.addFounder(entityId, payload);\n printSuccess(`Founder added (${result.member_count} total)`);\n const members = (result.members ?? []) as ApiRecord[];\n for (const m of members) {\n const pct = typeof m.ownership_pct === \"number\" ? ` (${m.ownership_pct}%)` : \"\";\n console.log(` - ${m.name} <${m.email ?? \"no email\"}> [${m.role ?? \"member\"}]${pct}`);\n }\n console.log(chalk.yellow(`\\n Next: add more founders or run: corp form finalize ${entityId}`));\n } catch (err) {\n printError(`Failed to add founder: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function formFinalizeCommand(entityId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const result = await client.finalizeFormation(entityId);\n printSuccess(`Formation finalized: ${result.entity_id}`);\n if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);\n if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);\n\n const docIds = (result.document_ids ?? []) as string[];\n if (docIds.length > 0) {\n console.log(` Documents: ${docIds.length} generated`);\n }\n\n const holders = (result.holders ?? []) as ApiRecord[];\n if (holders.length > 0) {\n console.log();\n const table = new Table({\n head: [chalk.dim(\"Holder\"), chalk.dim(\"Shares\"), chalk.dim(\"Ownership %\")],\n });\n for (const h of holders) {\n const pct = typeof h.ownership_pct === \"number\" ? `${h.ownership_pct.toFixed(1)}%` : \"—\";\n table.push([String(h.name ?? \"?\"), String(h.shares ?? 0), pct]);\n }\n console.log(chalk.bold(\" Cap Table:\"));\n console.log(table.toString());\n }\n\n if (result.next_action) {\n console.log(chalk.yellow(`\\n Next: ${result.next_action}`));\n }\n } catch (err) {\n printError(`Failed to finalize formation: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig, maskKey } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\n\nexport async function apiKeysCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const keys = await client.listApiKeys();\n if (opts.json) { printJson(keys); return; }\n if (keys.length === 0) { console.log(\"No API keys found.\"); return; }\n console.log(`\\n${chalk.bold(\"API Keys\")}`);\n const table = new Table({\n head: [chalk.dim(\"ID\"), chalk.dim(\"Name\"), chalk.dim(\"Key\"), chalk.dim(\"Created\"), chalk.dim(\"Last Used\")],\n });\n for (const k of keys) {\n table.push([\n String(k.id ?? k.api_key_id ?? \"\").slice(0, 12),\n String(k.name ?? \"\"),\n maskKey(String(k.key ?? k.api_key ?? \"\")),\n String(k.created_at ?? \"\"),\n String(k.last_used_at ?? \"\"),\n ]);\n }\n console.log(table.toString());\n } catch (err) { printError(`Failed to fetch API keys: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\n\nexport async function demoCommand(opts: { name: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await withSpinner(\"Loading\", () => client.seedDemo(opts.name));\n printSuccess(`Demo seeded: ${result.entity_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to seed demo: ${err}`); process.exit(1); }\n}\n","import type { ChildProcess } from \"node:child_process\";\n\ninterface ServeOptions {\n port: string;\n dataDir: string;\n}\n\nexport async function serveCommand(opts: ServeOptions): Promise<void> {\n let server: { getBinaryPath: () => string | null; isAvailable: () => boolean; startServer: (options: Record<string, unknown>) => ChildProcess };\n try {\n server = await import(\"@thecorporation/server\");\n } catch {\n console.error(\n \"Error: @thecorporation/server is not installed.\\n\\n\" +\n \"Install it with:\\n\" +\n \" npm install @thecorporation/server\\n\\n\" +\n \"Or run the Rust binary directly:\\n\" +\n \" cd services/api-rs && cargo run\"\n );\n process.exit(1);\n }\n\n if (!server.isAvailable()) {\n console.error(\n \"Error: No server binary available for this platform.\\n\\n\" +\n \"Pre-built binaries are available for:\\n\" +\n \" - linux-x64, linux-arm64\\n\" +\n \" - darwin-x64, darwin-arm64\\n\" +\n \" - win32-x64\\n\\n\" +\n \"You can build from source:\\n\" +\n \" cd services/api-rs && cargo build --release\"\n );\n process.exit(1);\n }\n\n const port = parseInt(opts.port, 10);\n if (isNaN(port) || port < 1 || port > 65535) {\n console.error(`Error: Invalid port \"${opts.port}\"`);\n process.exit(1);\n }\n\n console.log(`Starting server on port ${port}...`);\n console.log(`Data directory: ${opts.dataDir}`);\n\n const child = server.startServer({\n port,\n dataDir: opts.dataDir,\n });\n\n const shutdown = () => {\n console.log(\"\\nShutting down server...\");\n child.kill(\"SIGTERM\");\n };\n\n process.on(\"SIGINT\", shutdown);\n process.on(\"SIGTERM\", shutdown);\n\n child.on(\"exit\", (code) => {\n process.exit(code ?? 0);\n });\n}\n","import { Command } from \"commander\";\nimport { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\");\n\nconst program = new Command();\nprogram\n .name(\"corp\")\n .description(\"corp — Corporate governance from the terminal\")\n .version(pkg.version);\n\n// --- setup ---\nprogram\n .command(\"setup\")\n .description(\"Interactive setup wizard\")\n .action(async () => {\n const { setupCommand } = await import(\"./commands/setup.js\");\n await setupCommand();\n });\n\n// --- status ---\nprogram\n .command(\"status\")\n .description(\"Workspace summary\")\n .action(async () => {\n const { statusCommand } = await import(\"./commands/status.js\");\n await statusCommand();\n });\n\n// --- config ---\nconst configCmd = program.command(\"config\").description(\"Manage configuration\");\nconfigCmd\n .command(\"set <key> <value>\")\n .description(\"Set a config value (dot-path)\")\n .action(async (key: string, value: string) => {\n const { configSetCommand } = await import(\"./commands/config.js\");\n configSetCommand(key, value);\n });\nconfigCmd\n .command(\"get <key>\")\n .description(\"Get a config value (dot-path)\")\n .action(async (key: string) => {\n const { configGetCommand } = await import(\"./commands/config.js\");\n configGetCommand(key);\n });\nconfigCmd\n .command(\"list\")\n .description(\"List all config (API keys masked)\")\n .action(async () => {\n const { configListCommand } = await import(\"./commands/config.js\");\n configListCommand();\n });\n\n// --- obligations ---\nprogram\n .command(\"obligations\")\n .description(\"List obligations with urgency tiers\")\n .option(\"--tier <tier>\", \"Filter by urgency tier\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { obligationsCommand } = await import(\"./commands/obligations.js\");\n await obligationsCommand(opts);\n });\n\n// --- digest ---\nprogram\n .command(\"digest\")\n .description(\"View or trigger daily digests\")\n .option(\"--trigger\", \"Trigger digest now\")\n .option(\"--key <key>\", \"Get specific digest by key\")\n .action(async (opts) => {\n const { digestCommand } = await import(\"./commands/digest.js\");\n await digestCommand(opts);\n });\n\n// --- link ---\nprogram\n .command(\"link\")\n .description(\"Generate a claim code to pair another device\")\n .action(async () => {\n const { linkCommand } = await import(\"./commands/link.js\");\n await linkCommand();\n });\n\n// --- claim ---\nprogram\n .command(\"claim <code>\")\n .description(\"Redeem a claim code to join a workspace\")\n .action(async (code: string) => {\n const { claimCommand } = await import(\"./commands/claim.js\");\n await claimCommand(code);\n });\n\n// --- chat ---\nprogram\n .command(\"chat\")\n .description(\"Interactive LLM chat session\")\n .action(async () => {\n const { chatCommand } = await import(\"./chat.js\");\n await chatCommand();\n });\n\n// --- entities ---\nconst entitiesCmd = program\n .command(\"entities\")\n .description(\"List entities, show detail, convert, or dissolve\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { entitiesCommand } = await import(\"./commands/entities.js\");\n await entitiesCommand(opts);\n });\nentitiesCmd\n .command(\"show <entity-id>\")\n .option(\"--json\", \"Output as JSON\")\n .description(\"Show entity detail\")\n .action(async (entityId: string, opts) => {\n const { entitiesShowCommand } = await import(\"./commands/entities.js\");\n await entitiesShowCommand(entityId, opts);\n });\nentitiesCmd\n .command(\"convert <entity-id>\")\n .requiredOption(\"--to <type>\", \"Target entity type (llc, corporation)\")\n .option(\"--jurisdiction <jurisdiction>\", \"New jurisdiction\")\n .description(\"Convert entity to a different type\")\n .action(async (entityId: string, opts) => {\n const { entitiesConvertCommand } = await import(\"./commands/entities.js\");\n await entitiesConvertCommand(entityId, opts);\n });\nentitiesCmd\n .command(\"dissolve <entity-id>\")\n .requiredOption(\"--reason <reason>\", \"Dissolution reason\")\n .option(\"--effective-date <date>\", \"Effective date (ISO 8601)\")\n .description(\"Dissolve an entity\")\n .action(async (entityId: string, opts) => {\n const { entitiesDissolveCommand } = await import(\"./commands/entities.js\");\n await entitiesDissolveCommand(entityId, opts);\n });\n\n// --- contacts ---\nconst contactsCmd = program\n .command(\"contacts\")\n .description(\"Contact management\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { contactsListCommand } = await import(\"./commands/contacts.js\");\n await contactsListCommand(opts);\n });\ncontactsCmd\n .command(\"show <contact-id>\")\n .option(\"--json\", \"Output as JSON\")\n .description(\"Show contact detail/profile\")\n .action(async (contactId: string, opts) => {\n const { contactsShowCommand } = await import(\"./commands/contacts.js\");\n await contactsShowCommand(contactId, opts);\n });\ncontactsCmd\n .command(\"add\")\n .requiredOption(\"--name <name>\", \"Contact name\")\n .requiredOption(\"--email <email>\", \"Contact email\")\n .option(\"--category <category>\", \"Contact category\")\n .option(\"--phone <phone>\", \"Phone number\")\n .option(\"--notes <notes>\", \"Notes\")\n .description(\"Add a new contact\")\n .action(async (opts) => {\n const { contactsAddCommand } = await import(\"./commands/contacts.js\");\n await contactsAddCommand(opts);\n });\ncontactsCmd\n .command(\"edit <contact-id>\")\n .option(\"--name <name>\", \"Contact name\")\n .option(\"--email <email>\", \"Contact email\")\n .option(\"--category <category>\", \"Contact category\")\n .option(\"--phone <phone>\", \"Phone number\")\n .option(\"--notes <notes>\", \"Notes\")\n .description(\"Edit an existing contact\")\n .action(async (contactId: string, opts) => {\n const { contactsEditCommand } = await import(\"./commands/contacts.js\");\n await contactsEditCommand(contactId, opts);\n });\n\n// --- cap-table ---\nconst capTableCmd = program\n .command(\"cap-table\")\n .description(\"Cap table, SAFEs, transfers, valuations\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { capTableCommand } = await import(\"./commands/cap-table.js\");\n await capTableCommand(opts);\n });\ncapTableCmd.command(\"safes\").description(\"SAFE notes\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { safesCommand } = await import(\"./commands/cap-table.js\");\n await safesCommand(parent);\n});\ncapTableCmd.command(\"transfers\").description(\"Share transfers\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { transfersCommand } = await import(\"./commands/cap-table.js\");\n await transfersCommand(parent);\n});\ncapTableCmd.command(\"valuations\").description(\"Valuations history\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { valuationsCommand } = await import(\"./commands/cap-table.js\");\n await valuationsCommand(parent);\n});\ncapTableCmd.command(\"409a\").description(\"Current 409A valuation\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { fourOhNineACommand } = await import(\"./commands/cap-table.js\");\n await fourOhNineACommand(parent);\n});\ncapTableCmd\n .command(\"issue-equity\")\n .requiredOption(\"--grant-type <type>\", \"Grant type\")\n .requiredOption(\"--shares <n>\", \"Number of shares\", parseInt)\n .requiredOption(\"--recipient <name>\", \"Recipient name\")\n .description(\"Issue an equity grant\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueEquityCommand } = await import(\"./commands/cap-table.js\");\n await issueEquityCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"issue-safe\")\n .requiredOption(\"--investor <name>\", \"Investor name\")\n .requiredOption(\"--amount <n>\", \"Principal amount in cents\", parseInt)\n .option(\"--safe-type <type>\", \"SAFE type\", \"post_money\")\n .requiredOption(\"--valuation-cap <n>\", \"Valuation cap in cents\", parseInt)\n .description(\"Issue a SAFE note\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueSafeCommand } = await import(\"./commands/cap-table.js\");\n await issueSafeCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"transfer\")\n .requiredOption(\"--from-grant <id>\", \"Source grant ID\")\n .requiredOption(\"--to <name>\", \"Recipient name\")\n .requiredOption(\"--shares <n>\", \"Number of shares\", parseInt)\n .option(\"--type <type>\", \"Transfer type\", \"sale\")\n .description(\"Transfer shares\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { transferSharesCommand } = await import(\"./commands/cap-table.js\");\n await transferSharesCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"distribute\")\n .requiredOption(\"--amount <n>\", \"Total distribution amount in cents\", parseInt)\n .option(\"--type <type>\", \"Distribution type\", \"pro_rata\")\n .description(\"Calculate a distribution\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { distributeCommand } = await import(\"./commands/cap-table.js\");\n await distributeCommand({ ...opts, entityId: parent.entityId });\n });\n\ncapTableCmd\n .command(\"start-round\")\n .requiredOption(\"--name <name>\", \"Round name\")\n .requiredOption(\"--issuer-legal-entity-id <id>\", \"Issuer legal entity ID\")\n .description(\"Start a staged equity round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { startRoundCommand } = await import(\"./commands/cap-table.js\");\n await startRoundCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"add-security\")\n .requiredOption(\"--round-id <id>\", \"Round ID\")\n .requiredOption(\"--instrument-id <id>\", \"Instrument ID\")\n .requiredOption(\"--quantity <n>\", \"Number of shares/units\", parseInt)\n .requiredOption(\"--recipient-name <name>\", \"Recipient display name\")\n .option(\"--holder-id <id>\", \"Existing holder ID\")\n .option(\"--email <email>\", \"Recipient email (to find or create holder)\")\n .option(\"--principal-cents <n>\", \"Principal amount in cents\", parseInt)\n .option(\"--grant-type <type>\", \"Grant type\")\n .description(\"Add a security to a staged equity round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { addSecurityCommand } = await import(\"./commands/cap-table.js\");\n await addSecurityCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"issue-round\")\n .requiredOption(\"--round-id <id>\", \"Round ID\")\n .description(\"Issue all securities and close a staged round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueRoundCommand } = await import(\"./commands/cap-table.js\");\n await issueRoundCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"create-valuation\")\n .requiredOption(\"--type <type>\", \"Valuation type (four_oh_nine_a, fair_market_value, etc.)\")\n .requiredOption(\"--date <date>\", \"Effective date (ISO 8601)\")\n .requiredOption(\"--methodology <method>\", \"Methodology (income, market, asset, backsolve, hybrid)\")\n .option(\"--fmv <cents>\", \"FMV per share in cents\", parseInt)\n .option(\"--enterprise-value <cents>\", \"Enterprise value in cents\", parseInt)\n .description(\"Create a valuation\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { createValuationCommand } = await import(\"./commands/cap-table.js\");\n await createValuationCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"submit-valuation <valuation-id>\")\n .description(\"Submit a valuation for board approval\")\n .action(async (valuationId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { submitValuationCommand } = await import(\"./commands/cap-table.js\");\n await submitValuationCommand({ valuationId, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"approve-valuation <valuation-id>\")\n .option(\"--resolution-id <id>\", \"Resolution ID from the board vote\")\n .description(\"Approve a valuation\")\n .action(async (valuationId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { approveValuationCommand } = await import(\"./commands/cap-table.js\");\n await approveValuationCommand({ ...opts, valuationId, entityId: parent.entityId });\n });\n\n// --- finance ---\nconst financeCmd = program\n .command(\"finance\")\n .description(\"Invoicing, payroll, payments, banking\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\");\nfinanceCmd\n .command(\"invoice\")\n .requiredOption(\"--customer <name>\", \"Customer name\")\n .requiredOption(\"--amount <n>\", \"Amount in cents\", parseInt)\n .requiredOption(\"--due-date <date>\", \"Due date (ISO 8601)\")\n .option(\"--description <desc>\", \"Description\", \"Services rendered\")\n .description(\"Create an invoice\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeInvoiceCommand } = await import(\"./commands/finance.js\");\n await financeInvoiceCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"payroll\")\n .requiredOption(\"--period-start <date>\", \"Pay period start\")\n .requiredOption(\"--period-end <date>\", \"Pay period end\")\n .description(\"Run payroll\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financePayrollCommand } = await import(\"./commands/finance.js\");\n await financePayrollCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"pay\")\n .requiredOption(\"--amount <n>\", \"Amount in cents\", parseInt)\n .requiredOption(\"--recipient <name>\", \"Recipient name\")\n .option(\"--method <method>\", \"Payment method\", \"ach\")\n .description(\"Submit a payment\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financePayCommand } = await import(\"./commands/finance.js\");\n await financePayCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"open-account\")\n .option(\"--institution <name>\", \"Banking institution\", \"Mercury\")\n .description(\"Open a business bank account\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeOpenAccountCommand } = await import(\"./commands/finance.js\");\n await financeOpenAccountCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"classify-contractor\")\n .requiredOption(\"--name <name>\", \"Contractor name\")\n .requiredOption(\"--state <code>\", \"US state code\")\n .requiredOption(\"--hours <n>\", \"Hours per week\", parseInt)\n .option(\"--exclusive\", \"Exclusive client\", false)\n .requiredOption(\"--duration <n>\", \"Duration in months\", parseInt)\n .option(\"--provides-tools\", \"Company provides tools\", false)\n .description(\"Analyze contractor classification risk\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeClassifyContractorCommand } = await import(\"./commands/finance.js\");\n await financeClassifyContractorCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"reconcile\")\n .requiredOption(\"--start-date <date>\", \"Period start\")\n .requiredOption(\"--end-date <date>\", \"Period end\")\n .description(\"Reconcile ledger\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeReconcileCommand } = await import(\"./commands/finance.js\");\n await financeReconcileCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- governance ---\nconst governanceCmd = program\n .command(\"governance\")\n .description(\"Governance bodies, seats, meetings, resolutions\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { governanceListCommand } = await import(\"./commands/governance.js\");\n await governanceListCommand(opts);\n });\ngovernanceCmd\n .command(\"seats <body-id>\")\n .description(\"Seats for a governance body\")\n .action(async (bodyId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceSeatsCommand } = await import(\"./commands/governance.js\");\n await governanceSeatsCommand(bodyId, parent);\n });\ngovernanceCmd\n .command(\"meetings <body-id>\")\n .description(\"Meetings for a governance body\")\n .action(async (bodyId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceMeetingsCommand } = await import(\"./commands/governance.js\");\n await governanceMeetingsCommand(bodyId, parent);\n });\ngovernanceCmd\n .command(\"resolutions <meeting-id>\")\n .description(\"Resolutions for a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceResolutionsCommand } = await import(\"./commands/governance.js\");\n await governanceResolutionsCommand(meetingId, parent);\n });\ngovernanceCmd\n .command(\"convene\")\n .requiredOption(\"--body <id>\", \"Governance body ID\")\n .requiredOption(\"--type <type>\", \"Meeting type\")\n .requiredOption(\"--title <title>\", \"Meeting title\")\n .requiredOption(\"--date <date>\", \"Meeting date (ISO 8601)\")\n .option(\"--agenda <item>\", \"Agenda item (repeatable)\", (v: string, a: string[]) => [...a, v], [] as string[])\n .description(\"Convene a governance meeting\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceConveneCommand } = await import(\"./commands/governance.js\");\n await governanceConveneCommand({ ...opts, meetingType: opts.type, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"vote <meeting-id> <item-id>\")\n .requiredOption(\"--voter <name>\", \"Voter name/ID\")\n .requiredOption(\"--vote <value>\", \"Vote (yea, nay, abstain)\")\n .description(\"Cast a vote on an agenda item\")\n .action(async (meetingId: string, itemId: string, opts) => {\n const { governanceVoteCommand } = await import(\"./commands/governance.js\");\n await governanceVoteCommand(meetingId, itemId, opts);\n });\ngovernanceCmd\n .command(\"notice <meeting-id>\")\n .description(\"Send meeting notice\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { sendNoticeCommand } = await import(\"./commands/governance.js\");\n await sendNoticeCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"adjourn <meeting-id>\")\n .description(\"Adjourn a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { adjournMeetingCommand } = await import(\"./commands/governance.js\");\n await adjournMeetingCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"cancel <meeting-id>\")\n .description(\"Cancel a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { cancelMeetingCommand } = await import(\"./commands/governance.js\");\n await cancelMeetingCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"agenda-items <meeting-id>\")\n .description(\"List agenda items for a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { listAgendaItemsCommand } = await import(\"./commands/governance.js\");\n await listAgendaItemsCommand(meetingId, { entityId: parent.entityId, json: parent.json });\n });\ngovernanceCmd\n .command(\"finalize-item <meeting-id> <item-id>\")\n .requiredOption(\"--status <status>\", \"Status: Voted, Discussed, Tabled, or Withdrawn\")\n .description(\"Finalize an agenda item\")\n .action(async (meetingId: string, itemId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { finalizeAgendaItemCommand } = await import(\"./commands/governance.js\");\n await finalizeAgendaItemCommand(meetingId, itemId, { ...opts, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"resolve <meeting-id> <item-id>\")\n .requiredOption(\"--text <resolution_text>\", \"Resolution text\")\n .description(\"Compute a resolution for an agenda item\")\n .action(async (meetingId: string, itemId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { computeResolutionCommand } = await import(\"./commands/governance.js\");\n await computeResolutionCommand(meetingId, itemId, { ...opts, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"written-consent\")\n .requiredOption(\"--body <id>\", \"Governance body ID\")\n .requiredOption(\"--title <title>\", \"Title\")\n .requiredOption(\"--description <desc>\", \"Description\")\n .description(\"Create a written consent action\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { writtenConsentCommand } = await import(\"./commands/governance.js\");\n await writtenConsentCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- documents ---\nconst documentsCmd = program\n .command(\"documents\")\n .description(\"Documents and signing\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { documentsListCommand } = await import(\"./commands/documents.js\");\n await documentsListCommand(opts);\n });\ndocumentsCmd\n .command(\"signing-link <doc-id>\")\n .description(\"Get a signing link for a document\")\n .action(async (docId: string) => {\n const { documentsSigningLinkCommand } = await import(\"./commands/documents.js\");\n await documentsSigningLinkCommand(docId);\n });\ndocumentsCmd\n .command(\"generate\")\n .requiredOption(\"--template <type>\", \"Template type\")\n .requiredOption(\"--counterparty <name>\", \"Counterparty name\")\n .option(\"--effective-date <date>\", \"Effective date (ISO 8601)\")\n .description(\"Generate a contract from a template\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { documentsGenerateCommand } = await import(\"./commands/documents.js\");\n await documentsGenerateCommand({ ...opts, entityId: parent.entityId });\n });\ndocumentsCmd\n .command(\"preview-pdf\")\n .requiredOption(\"--document-id <id>\", \"AST document definition ID (e.g. 'bylaws')\")\n .description(\"Preview a governance document as PDF\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { documentsPreviewPdfCommand } = await import(\"./commands/documents.js\");\n await documentsPreviewPdfCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- tax ---\nconst taxCmd = program\n .command(\"tax\")\n .description(\"Tax filings and deadline tracking\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\");\ntaxCmd\n .command(\"file\")\n .requiredOption(\"--type <type>\", \"Document type\")\n .requiredOption(\"--year <year>\", \"Tax year\", parseInt)\n .description(\"File a tax document\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { taxFileCommand } = await import(\"./commands/tax.js\");\n await taxFileCommand({ ...opts, entityId: parent.entityId });\n });\ntaxCmd\n .command(\"deadline\")\n .requiredOption(\"--type <type>\", \"Deadline type\")\n .requiredOption(\"--due-date <date>\", \"Due date (ISO 8601)\")\n .requiredOption(\"--description <desc>\", \"Description\")\n .option(\"--recurrence <recurrence>\", \"Recurrence\")\n .description(\"Track a compliance deadline\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { taxDeadlineCommand } = await import(\"./commands/tax.js\");\n await taxDeadlineCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- agents ---\nconst agentsCmd = program\n .command(\"agents\")\n .description(\"Agent management\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { agentsListCommand } = await import(\"./commands/agents.js\");\n await agentsListCommand(opts);\n });\nagentsCmd.command(\"show <agent-id>\").option(\"--json\", \"Output as JSON\").description(\"Show agent detail\")\n .action(async (agentId: string, opts) => {\n const { agentsShowCommand } = await import(\"./commands/agents.js\");\n await agentsShowCommand(agentId, opts);\n });\nagentsCmd.command(\"create\").requiredOption(\"--name <name>\", \"Agent name\")\n .requiredOption(\"--prompt <prompt>\", \"System prompt\").option(\"--model <model>\", \"Model\")\n .description(\"Create a new agent\")\n .action(async (opts) => {\n const { agentsCreateCommand } = await import(\"./commands/agents.js\");\n await agentsCreateCommand(opts);\n });\nagentsCmd.command(\"pause <agent-id>\").description(\"Pause an agent\")\n .action(async (agentId: string) => {\n const { agentsPauseCommand } = await import(\"./commands/agents.js\");\n await agentsPauseCommand(agentId);\n });\nagentsCmd.command(\"resume <agent-id>\").description(\"Resume a paused agent\")\n .action(async (agentId: string) => {\n const { agentsResumeCommand } = await import(\"./commands/agents.js\");\n await agentsResumeCommand(agentId);\n });\nagentsCmd.command(\"delete <agent-id>\").description(\"Delete an agent\")\n .action(async (agentId: string) => {\n const { agentsDeleteCommand } = await import(\"./commands/agents.js\");\n await agentsDeleteCommand(agentId);\n });\nagentsCmd.command(\"message <agent-id>\").requiredOption(\"--body <text>\", \"Message text\")\n .description(\"Send a message to an agent\")\n .action(async (agentId: string, opts) => {\n const { agentsMessageCommand } = await import(\"./commands/agents.js\");\n await agentsMessageCommand(agentId, opts);\n });\nagentsCmd.command(\"executions <agent-id>\").option(\"--json\", \"Output as JSON\")\n .description(\"List agent execution history\")\n .action(async (agentId: string, opts) => {\n const { agentsExecutionsCommand } = await import(\"./commands/agents.js\");\n await agentsExecutionsCommand(agentId, opts);\n });\nagentsCmd.command(\"skill <agent-id>\").requiredOption(\"--name <name>\", \"Skill name\")\n .requiredOption(\"--description <desc>\", \"Skill description\").option(\"--instructions <text>\", \"Instructions\")\n .description(\"Add a skill to an agent\")\n .action(async (agentId: string, opts) => {\n const { agentsSkillCommand } = await import(\"./commands/agents.js\");\n await agentsSkillCommand(agentId, opts);\n });\n\n// --- billing ---\nconst billingCmd = program\n .command(\"billing\")\n .description(\"Billing status, plans, and subscription management\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { billingCommand } = await import(\"./commands/billing.js\");\n await billingCommand(opts);\n });\nbillingCmd.command(\"portal\").description(\"Open Stripe Customer Portal\")\n .action(async () => {\n const { billingPortalCommand } = await import(\"./commands/billing.js\");\n await billingPortalCommand();\n });\nbillingCmd.command(\"upgrade\").option(\"--tier <tier>\", \"Plan to upgrade to\", \"cloud\")\n .description(\"Open Stripe Checkout to upgrade your plan\")\n .action(async (opts) => {\n const { billingUpgradeCommand } = await import(\"./commands/billing.js\");\n await billingUpgradeCommand(opts);\n });\n\n// --- approvals ---\nconst approvalsCmd = program\n .command(\"approvals\")\n .description(\"Pending approvals and responses\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { approvalsListCommand } = await import(\"./commands/approvals.js\");\n await approvalsListCommand(opts);\n });\napprovalsCmd.command(\"approve <approval-id>\").option(\"--message <msg>\", \"Optional message\")\n .description(\"Approve a pending approval\")\n .action(async (approvalId: string, opts) => {\n const { approvalsRespondCommand } = await import(\"./commands/approvals.js\");\n await approvalsRespondCommand(approvalId, \"approve\", opts);\n });\napprovalsCmd.command(\"reject <approval-id>\").option(\"--message <msg>\", \"Optional message\")\n .description(\"Reject a pending approval\")\n .action(async (approvalId: string, opts) => {\n const { approvalsRespondCommand } = await import(\"./commands/approvals.js\");\n await approvalsRespondCommand(approvalId, \"reject\", opts);\n });\n\n// --- form ---\nconst formCmd = program\n .command(\"form\")\n .description(\"Form a new entity with founders and cap table (Cooley-style)\")\n .option(\"--type <type>\", \"Entity type (llc, c_corp)\")\n .option(\"--name <name>\", \"Legal name\")\n .option(\"--jurisdiction <jurisdiction>\", \"Jurisdiction (e.g. US-DE, US-WY)\")\n .option(\"--member <member>\", \"Member as 'name,email,role[,pct]' — role: director|officer|manager|member|chair (repeatable)\", (v: string, a: string[]) => [...a, v], [] as string[])\n .option(\"--address <address>\", \"Company address as 'street,city,state,zip'\")\n .option(\"--fiscal-year-end <date>\", \"Fiscal year end (MM-DD)\", \"12-31\")\n .option(\"--s-corp\", \"Elect S-Corp status\")\n .option(\"--transfer-restrictions\", \"Enable transfer restrictions\")\n .option(\"--rofr\", \"Enable right of first refusal\")\n .action(async (opts) => {\n const { formCommand } = await import(\"./commands/form.js\");\n await formCommand(opts);\n });\nformCmd.command(\"create\")\n .description(\"Create a pending entity (staged flow step 1)\")\n .requiredOption(\"--type <type>\", \"Entity type (llc, c_corp)\")\n .requiredOption(\"--name <name>\", \"Legal name\")\n .option(\"--jurisdiction <jurisdiction>\", \"Jurisdiction (e.g. US-DE, US-WY)\")\n .action(async (opts) => {\n const { formCreateCommand } = await import(\"./commands/form.js\");\n await formCreateCommand(opts);\n });\nformCmd.command(\"add-founder <entity-id>\")\n .description(\"Add a founder to a pending entity (staged flow step 2)\")\n .requiredOption(\"--name <name>\", \"Founder name\")\n .requiredOption(\"--email <email>\", \"Founder email\")\n .requiredOption(\"--role <role>\", \"Role: director|officer|manager|member|chair\")\n .requiredOption(\"--pct <pct>\", \"Ownership percentage\")\n .option(\"--officer-title <title>\", \"Officer title (corporations only)\")\n .option(\"--incorporator\", \"Mark as sole incorporator (corporations only)\")\n .action(async (entityId: string, opts) => {\n const { formAddFounderCommand } = await import(\"./commands/form.js\");\n await formAddFounderCommand(entityId, opts);\n });\nformCmd.command(\"finalize <entity-id>\")\n .description(\"Finalize formation and generate documents + cap table (staged flow step 3)\")\n .action(async (entityId: string) => {\n const { formFinalizeCommand } = await import(\"./commands/form.js\");\n await formFinalizeCommand(entityId);\n });\n\n// --- api-keys ---\nprogram\n .command(\"api-keys\")\n .description(\"List API keys\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { apiKeysCommand } = await import(\"./commands/api-keys.js\");\n await apiKeysCommand(opts);\n });\n\n// --- demo ---\nprogram\n .command(\"demo\")\n .description(\"Seed a fully-populated demo corporation\")\n .requiredOption(\"--name <name>\", \"Corporation name\")\n .action(async (opts) => {\n const { demoCommand } = await import(\"./commands/demo.js\");\n await demoCommand(opts);\n });\n\n// --- serve ---\nprogram\n .command(\"serve\")\n .description(\"Start the API server locally\")\n .option(\"--port <port>\", \"Port to listen on\", \"8000\")\n .option(\"--data-dir <path>\", \"Data directory\", \"./data/repos\")\n .action(async (opts) => {\n const { serveCommand } = await import(\"./commands/serve.js\");\n await serveCommand(opts);\n });\n\nprogram.parse();\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,cAAc,eAAe,WAAsB,kBAAkB;AAC9E,SAAS,YAAY;AACrB,SAAS,eAAe;AAoBxB,SAAS,UAAU,MAA+B,UAAyC;AACzF,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,QAAQ,GAAG;AACnD,QACE,OAAO,QACP,OAAO,KAAK,GAAG,MAAM,YACrB,KAAK,GAAG,MAAM,QACd,CAAC,MAAM,QAAQ,KAAK,GAAG,CAAC,KACxB,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,GACpB;AACA,gBAAU,KAAK,GAAG,GAA8B,KAAgC;AAAA,IAClF,OAAO;AACL,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AACF;AAEO,SAAS,aAAyB;AACvC,QAAM,MAAM,gBAAgB,QAAQ;AACpC,MAAI,WAAW,WAAW,GAAG;AAC3B,UAAM,QAAQ,KAAK,MAAM,aAAa,aAAa,OAAO,CAAC;AAC3D,cAAU,KAA2C,KAAK;AAAA,EAC5D;AACA,SAAO;AACT;AAEO,SAAS,WAAW,KAAuB;AAChD,YAAU,YAAY,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACtD,gBAAc,aAAa,KAAK,UAAU,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,MAAM,IAAM,CAAC;AACjF;AAEO,SAAS,SAAS,KAA8B,SAA0B;AAC/E,QAAM,OAAO,QAAQ,MAAM,GAAG;AAC9B,MAAI,UAAmB;AACvB,aAA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,UAAU,IAAI;AAC5C,CAAC;AACH,QAAQ,QAAQ,sBAAsB,EACnC,YAAY,4EAA4E,EACxF,OAAO,OAAO,aAAqB;AAClC,QAAM,EAAE,qBAAAC,qBAAoB,IAAI,MAAM;AACtC,QAAMA,qBAAoB,QAAQ;AACpC,CAAC;AAGH,QACG,QAAQ,UAAU,EAClB,YAAY,eAAe,EAC3B,OAAO,UAAU,gBAAgB,EACjC,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,gBAAAC,gBAAe,IAAI,MAAM;AACjC,QAAMA,gBAAe,IAAI;AAC3B,CAAC;AAGH,QACG,QAAQ,MAAM,EACd,YAAY,yCAAyC,EACrD,eAAe,iBAAiB,kBAAkB,EAClD,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,aAAAC,aAAY,IAAI,MAAM;AAC9B,QAAMA,aAAY,IAAI;AACxB,CAAC;AAGH,QACG,QAAQ,OAAO,EACf,YAAY,8BAA8B,EAC1C,OAAO,iBAAiB,qBAAqB,MAAM,EACnD,OAAO,qBAAqB,kBAAkB,cAAc,EAC5D,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,cAAAC,cAAa,IAAI,MAAM;AAC/B,QAAMA,cAAa,IAAI;AACzB,CAAC;AAEH,QAAQ,MAAM;","names":["s","init_config","join","homedir","chalk","chalk","chalk","chalk","chalk","Table","input","confirm","chalk","Table","chalk","Table","require","setupCommand","statusCommand","configSetCommand","configGetCommand","configListCommand","obligationsCommand","digestCommand","linkCommand","claimCommand","chatCommand","entitiesCommand","entitiesShowCommand","entitiesConvertCommand","entitiesDissolveCommand","contactsListCommand","contactsShowCommand","contactsAddCommand","contactsEditCommand","capTableCommand","safesCommand","transfersCommand","valuationsCommand","fourOhNineACommand","issueEquityCommand","issueSafeCommand","transferSharesCommand","distributeCommand","startRoundCommand","addSecurityCommand","issueRoundCommand","createValuationCommand","submitValuationCommand","approveValuationCommand","financeInvoiceCommand","financePayrollCommand","financePayCommand","financeOpenAccountCommand","financeClassifyContractorCommand","financeReconcileCommand","governanceListCommand","governanceSeatsCommand","governanceMeetingsCommand","governanceResolutionsCommand","governanceConveneCommand","governanceVoteCommand","sendNoticeCommand","adjournMeetingCommand","cancelMeetingCommand","listAgendaItemsCommand","finalizeAgendaItemCommand","computeResolutionCommand","writtenConsentCommand","documentsListCommand","documentsSigningLinkCommand","documentsGenerateCommand","documentsPreviewPdfCommand","taxFileCommand","taxDeadlineCommand","agentsListCommand","agentsShowCommand","agentsCreateCommand","agentsPauseCommand","agentsResumeCommand","agentsDeleteCommand","agentsMessageCommand","agentsExecutionsCommand","agentsSkillCommand","billingCommand","billingPortalCommand","billingUpgradeCommand","approvalsListCommand","approvalsRespondCommand","formCommand","formCreateCommand","formAddFounderCommand","formFinalizeCommand","apiKeysCommand","demoCommand","serveCommand"]}
1
+ {"version":3,"sources":["../src/config.ts","../src/api-client.ts","../src/output.ts","../src/commands/setup.ts","../src/animation.ts","../src/spinner.ts","../src/commands/status.ts","../src/commands/config.ts","../src/commands/obligations.ts","../src/commands/digest.ts","../src/commands/link.ts","../src/commands/claim.ts","../src/llm.ts","../src/tools.ts","../src/chat.ts","../src/commands/entities.ts","../src/commands/contacts.ts","../src/commands/cap-table.ts","../src/commands/finance.ts","../src/commands/governance.ts","../src/commands/documents.ts","../src/commands/tax.ts","../src/commands/agents.ts","../src/commands/billing.ts","../src/commands/form.ts","../src/commands/api-keys.ts","../src/commands/demo.ts","../src/commands/serve.ts","../src/index.ts"],"sourcesContent":["import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport type { CorpConfig } from \"./types.js\";\n\nconst CONFIG_DIR = process.env.CORP_CONFIG_DIR || join(homedir(), \".corp\");\nconst CONFIG_FILE = join(CONFIG_DIR, \"config.json\");\n\nconst DEFAULTS: CorpConfig = {\n api_url: process.env.CORP_API_URL || \"https://api.thecorporation.ai\",\n api_key: \"\",\n workspace_id: \"\",\n hosting_mode: \"\",\n llm: {\n provider: \"anthropic\",\n api_key: \"\",\n model: \"claude-sonnet-4-6\",\n },\n user: { name: \"\", email: \"\" },\n active_entity_id: \"\",\n};\n\nfunction deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): void {\n for (const [key, value] of Object.entries(override)) {\n if (\n key in base &&\n typeof base[key] === \"object\" &&\n base[key] !== null &&\n !Array.isArray(base[key]) &&\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n ) {\n deepMerge(base[key] as Record<string, unknown>, value as Record<string, unknown>);\n } else {\n base[key] = value;\n }\n }\n}\n\nexport function loadConfig(): CorpConfig {\n const cfg = structuredClone(DEFAULTS);\n if (existsSync(CONFIG_FILE)) {\n const saved = JSON.parse(readFileSync(CONFIG_FILE, \"utf-8\"));\n deepMerge(cfg as unknown as Record<string, unknown>, saved);\n }\n return cfg;\n}\n\nexport function saveConfig(cfg: CorpConfig): void {\n mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });\n writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2) + \"\\n\", { mode: 0o600 });\n}\n\nexport function getValue(cfg: Record<string, unknown>, dotPath: string): unknown {\n const keys = dotPath.split(\".\");\n let current: unknown = cfg;\n for (const key of keys) {\n if (typeof current === \"object\" && current !== null && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n return undefined;\n }\n }\n return current;\n}\n\nexport function setValue(cfg: Record<string, unknown>, dotPath: string, value: string): void {\n const keys = dotPath.split(\".\");\n let current = cfg;\n for (const key of keys.slice(0, -1)) {\n if (!(key in current) || typeof current[key] !== \"object\" || current[key] === null) {\n current[key] = {};\n }\n current = current[key] as Record<string, unknown>;\n }\n current[keys[keys.length - 1]] = value;\n}\n\nexport function requireConfig(...fields: string[]): CorpConfig {\n const cfg = loadConfig();\n const missing = fields.filter((f) => !getValue(cfg as unknown as Record<string, unknown>, f));\n if (missing.length > 0) {\n console.error(`Missing config: ${missing.join(\", \")}`);\n console.error(\"Run 'corp setup' to configure.\");\n process.exit(1);\n }\n return cfg;\n}\n\nexport function maskKey(value: string): string {\n if (!value || value.length < 8) return \"***\";\n return \"***\" + value.slice(-4);\n}\n\nexport function configForDisplay(cfg: CorpConfig): Record<string, unknown> {\n const display = { ...cfg } as Record<string, unknown>;\n if (display.api_key) display.api_key = maskKey(display.api_key as string);\n if (typeof display.llm === \"object\" && display.llm !== null) {\n const llm = { ...(display.llm as Record<string, unknown>) };\n if (llm.api_key) llm.api_key = maskKey(llm.api_key as string);\n display.llm = llm;\n }\n return display;\n}\n\nexport function resolveEntityId(cfg: CorpConfig, explicitId?: string): string {\n const eid = explicitId || cfg.active_entity_id;\n if (!eid) {\n console.error(\n \"No entity specified. Use --entity-id or set active_entity_id via 'corp config set active_entity_id <id>'.\"\n );\n process.exit(1);\n }\n return eid;\n}\n","export { CorpAPIClient, SessionExpiredError, provisionWorkspace } from \"@thecorporation/corp-tools\";\n","import chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport type { ApiRecord } from \"./types.js\";\n\nconst URGENCY_COLORS: Record<string, (s: string) => string> = {\n overdue: chalk.red.bold,\n due_today: chalk.yellow.bold,\n d1: chalk.yellow,\n d7: chalk.cyan,\n d14: chalk.blue,\n d30: chalk.dim,\n upcoming: chalk.dim,\n};\n\nexport function printError(msg: string): void {\n console.error(chalk.red(\"Error:\"), msg);\n}\n\nexport function printSuccess(msg: string): void {\n console.log(chalk.green(msg));\n}\n\nexport function printWarning(msg: string): void {\n console.log(chalk.yellow(msg));\n}\n\nexport function printJson(data: unknown): void {\n console.log(JSON.stringify(data, null, 2));\n}\n\n// --- Status Panel ---\n\nexport function printStatusPanel(data: ApiRecord): void {\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(chalk.blue.bold(\" Corp Status\"));\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(` ${chalk.bold(\"Workspace:\")} ${data.workspace_id ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Entities:\")} ${data.entity_count ?? 0}`);\n\n const urgency = (data.urgency_counts ?? {}) as Record<string, number>;\n if (Object.keys(urgency).length > 0) {\n console.log(`\\n ${chalk.bold(\"Obligations:\")}`);\n for (const [tier, count] of Object.entries(urgency)) {\n const colorFn = URGENCY_COLORS[tier] ?? ((s: string) => s);\n console.log(` ${colorFn(`${tier}:`)} ${count}`);\n }\n }\n\n if (data.next_deadline) {\n console.log(`\\n ${chalk.bold(\"Next deadline:\")} ${data.next_deadline}`);\n }\n console.log(chalk.blue(\"─\".repeat(50)));\n}\n\n// --- Generic table helper ---\n\nfunction makeTable(title: string, columns: string[]): Table.Table {\n console.log(`\\n${chalk.bold(title)}`);\n return new Table({ head: columns.map((c) => chalk.dim(c)) });\n}\n\nfunction s(val: unknown, maxLen?: number): string {\n const str = val == null ? \"\" : String(val);\n if (maxLen && str.length > maxLen) return str.slice(0, maxLen);\n return str;\n}\n\nfunction money(val: unknown): string {\n if (typeof val === \"number\") return `$${val.toLocaleString()}`;\n return String(val ?? \"\");\n}\n\n// --- Domain tables ---\n\nexport function printEntitiesTable(entities: ApiRecord[]): void {\n const table = makeTable(\"Entities\", [\"ID\", \"Name\", \"Type\", \"Jurisdiction\", \"Status\"]);\n for (const e of entities) {\n table.push([s(e.entity_id, 12), s(e.name), s(e.entity_type), s(e.jurisdiction), s(e.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printObligationsTable(obligations: ApiRecord[]): void {\n const table = makeTable(\"Obligations\", [\"ID\", \"Type\", \"Urgency\", \"Due\", \"Status\"]);\n for (const o of obligations) {\n const urg = s(o.urgency) || \"upcoming\";\n const colorFn = URGENCY_COLORS[urg] ?? ((x: string) => x);\n table.push([s(o.obligation_id, 12), s(o.obligation_type), colorFn(urg), s(o.due_at), s(o.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printContactsTable(contacts: ApiRecord[]): void {\n const table = makeTable(\"Contacts\", [\"ID\", \"Name\", \"Email\", \"Category\", \"Entity\"]);\n for (const c of contacts) {\n table.push([\n s(c.contact_id ?? c.id, 12),\n s(c.name),\n s(c.email),\n s(c.category),\n s(c.entity_name ?? c.entity_id),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printCapTable(data: ApiRecord): void {\n const accessLevel = s(data.access_level) || \"admin\";\n const shareClasses = (data.share_classes ?? []) as ApiRecord[];\n if (shareClasses.length > 0) {\n const cols = [\"Class\", \"Authorized\", \"Outstanding\"];\n if (accessLevel !== \"summary\") cols.push(\"Holders\");\n const table = makeTable(\"Cap Table — Share Classes\", cols);\n for (const sc of shareClasses) {\n const row = [s(sc.class_code ?? sc.name), s(sc.authorized), s(sc.outstanding)];\n if (accessLevel !== \"summary\") {\n const holders = (sc.holders ?? []) as ApiRecord[];\n row.push(holders.map((h) => `${h.name ?? \"?\"}(${h.percentage ?? \"?\"}%)`).join(\", \"));\n }\n table.push(row);\n }\n console.log(table.toString());\n }\n\n const ownership = (data.ownership ?? []) as ApiRecord[];\n if (ownership.length > 0 && accessLevel !== \"summary\") {\n const table = makeTable(\"Ownership Breakdown\", [\"Holder\", \"Shares\", \"Percentage\", \"Class\"]);\n for (const o of ownership) {\n table.push([s(o.holder_name ?? o.name), s(o.shares), `${o.percentage ?? \"\"}%`, s(o.share_class)]);\n }\n console.log(table.toString());\n }\n\n const pools = (data.option_pools ?? []) as ApiRecord[];\n if (pools.length > 0) {\n const table = makeTable(\"Option Pools\", [\"Name\", \"Authorized\", \"Granted\", \"Available\"]);\n for (const p of pools) {\n table.push([s(p.name), s(p.authorized), s(p.granted), s(p.available)]);\n }\n console.log(table.toString());\n }\n\n if (data.fully_diluted_shares != null) {\n const fd = data.fully_diluted_shares;\n console.log(`\\n${chalk.bold(\"Fully Diluted Shares:\")} ${typeof fd === \"number\" ? fd.toLocaleString() : fd}`);\n }\n}\n\nexport function printSafesTable(safes: ApiRecord[]): void {\n const table = makeTable(\"SAFE Notes\", [\"ID\", \"Investor\", \"Amount\", \"Cap\", \"Discount\", \"Date\"]);\n for (const s_ of safes) {\n table.push([\n s(s_.safe_id ?? s_.id, 12),\n s(s_.investor_name ?? s_.investor),\n money(s_.investment_amount ?? s_.amount),\n s(s_.valuation_cap ?? s_.cap),\n s(s_.discount_rate ?? s_.discount),\n s(s_.date ?? s_.created_at),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printTransfersTable(transfers: ApiRecord[]): void {\n const table = makeTable(\"Share Transfers\", [\"ID\", \"From\", \"To\", \"Shares\", \"Class\", \"Date\"]);\n for (const t of transfers) {\n table.push([\n s(t.transfer_id ?? t.id, 12),\n s(t.from_holder ?? t.from),\n s(t.to_holder ?? t.to),\n s(t.shares),\n s(t.share_class),\n s(t.date ?? t.transfer_date),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printValuationsTable(valuations: ApiRecord[]): void {\n const table = makeTable(\"Valuations\", [\"Date\", \"Type\", \"Valuation\", \"PPS\"]);\n for (const v of valuations) {\n table.push([\n s(v.valuation_date ?? v.date),\n s(v.valuation_type ?? v.type),\n s(v.enterprise_value ?? v.valuation),\n s(v.price_per_share ?? v.pps ?? v.fmv_per_share),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printGovernanceTable(bodies: ApiRecord[]): void {\n const table = makeTable(\"Governance Bodies\", [\"ID\", \"Body\", \"Type\", \"Seats\", \"Meetings\"]);\n for (const b of bodies) {\n table.push([\n s(b.body_id ?? b.id, 12),\n s(b.name),\n s(b.body_type ?? b.type),\n s(b.seat_count ?? b.seats),\n s(b.meeting_count ?? b.meetings),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printSeatsTable(seats: ApiRecord[]): void {\n const table = makeTable(\"Seats\", [\"Seat\", \"Holder\", \"Role\", \"Status\"]);\n for (const st of seats) {\n table.push([s(st.seat_name ?? st.title), s(st.holder_name ?? st.holder), s(st.role), s(st.status)]);\n }\n console.log(table.toString());\n}\n\nexport function printMeetingsTable(meetings: ApiRecord[]): void {\n const table = makeTable(\"Meetings\", [\"ID\", \"Title\", \"Date\", \"Status\", \"Resolutions\"]);\n for (const m of meetings) {\n table.push([\n s(m.meeting_id ?? m.id, 12),\n s(m.title ?? m.name),\n s(m.meeting_date ?? m.date),\n s(m.status),\n s(m.resolution_count ?? m.resolutions),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printResolutionsTable(resolutions: ApiRecord[]): void {\n const table = makeTable(\"Resolutions\", [\"ID\", \"Title\", \"Type\", \"Status\", \"For\", \"Against\"]);\n for (const r of resolutions) {\n table.push([\n s(r.resolution_id ?? r.id, 12),\n s(r.title),\n s(r.resolution_type ?? r.type),\n s(r.status),\n s(r.votes_for),\n s(r.votes_against),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printDocumentsTable(docs: ApiRecord[]): void {\n const table = makeTable(\"Documents\", [\"ID\", \"Title\", \"Type\", \"Date\", \"Status\", \"Signatures\"]);\n for (const d of docs) {\n const sigs = d.signatures;\n const sigStr = Array.isArray(sigs) ? `${sigs.length} signed` : s(sigs);\n table.push([\n s(d.document_id ?? d.id, 12),\n s(d.title ?? d.name),\n s(d.document_type ?? d.type),\n s(d.date ?? d.created_at),\n s(d.status),\n sigStr,\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printAgentsTable(agents: ApiRecord[]): void {\n const table = makeTable(\"Agents\", [\"ID\", \"Name\", \"Status\", \"Model\"]);\n for (const a of agents) {\n const status = s(a.status);\n const colored =\n status === \"active\" ? chalk.green(status) : status === \"paused\" ? chalk.yellow(status) : status;\n table.push([s(a.agent_id ?? a.id, 12), s(a.name), colored, s(a.model)]);\n }\n console.log(table.toString());\n}\n\nexport function printApprovalsTable(approvals: ApiRecord[]): void {\n const table = makeTable(\"Pending Approvals\", [\"ID\", \"Type\", \"Requested By\", \"Description\", \"Created\"]);\n for (const a of approvals) {\n let desc = s(a.description ?? a.summary);\n if (desc.length > 60) desc = desc.slice(0, 57) + \"...\";\n table.push([\n s(a.approval_id ?? a.id, 12),\n s(a.approval_type ?? a.type),\n s(a.requested_by ?? a.requester),\n desc,\n s(a.created_at),\n ]);\n }\n console.log(table.toString());\n}\n\nexport function printBillingPanel(status: ApiRecord, plans: ApiRecord[]): void {\n const plan = s(status.plan ?? status.tier) || \"free\";\n const subStatus = s(status.status) || \"active\";\n const periodEnd = s(status.current_period_end);\n\n console.log(chalk.green(\"─\".repeat(50)));\n console.log(chalk.green.bold(\" Billing Status\"));\n console.log(chalk.green(\"─\".repeat(50)));\n console.log(` ${chalk.bold(\"Plan:\")} ${plan}`);\n console.log(` ${chalk.bold(\"Status:\")} ${subStatus}`);\n if (periodEnd) console.log(` ${chalk.bold(\"Current Period End:\")} ${periodEnd}`);\n console.log(chalk.dim(\" Manage: corp billing portal\"));\n console.log(chalk.dim(\" Upgrade: corp billing upgrade --plan <plan>\"));\n console.log(chalk.green(\"─\".repeat(50)));\n\n if (plans.length > 0) {\n const table = makeTable(\"Available Plans\", [\"Plan\", \"Price\", \"Features\"]);\n for (const p of plans) {\n const amount = (p.price_cents ?? p.amount ?? 0) as number;\n const interval = s(p.interval);\n let priceStr = \"Free\";\n if (amount > 0) {\n priceStr = interval ? `$${Math.round(amount / 100)}/${interval}` : `$${Math.round(amount / 100)}`;\n }\n const name = s(p.name ?? p.plan_id ?? p.tier);\n const features = Array.isArray(p.features) ? (p.features as string[]).join(\", \") : s(p.description);\n table.push([name, priceStr, features]);\n }\n console.log(table.toString());\n }\n}\n","import { input, confirm } from \"@inquirer/prompts\";\nimport { loadConfig, saveConfig } from \"../config.js\";\nimport { provisionWorkspace } from \"../api-client.js\";\nimport { printSuccess, printError } from \"../output.js\";\n\nconst API_URL = \"https://api.thecorporation.ai\";\n\nexport async function setupCommand(): Promise<void> {\n const cfg = loadConfig();\n console.log(\"Welcome to corp — corporate governance from the terminal.\\n\");\n\n cfg.api_url = API_URL;\n\n console.log(\"--- User Info ---\");\n const user = cfg.user ?? { name: \"\", email: \"\" };\n user.name = await input({ message: \"Your name\", default: user.name || undefined });\n user.email = await input({ message: \"Your email\", default: user.email || undefined });\n cfg.user = user;\n\n if (!cfg.api_key || !cfg.workspace_id) {\n console.log(\"\\nProvisioning workspace...\");\n try {\n const result = await provisionWorkspace(cfg.api_url, `${user.name}'s workspace`);\n cfg.api_key = result.api_key as string;\n cfg.workspace_id = result.workspace_id as string;\n console.log(`Workspace provisioned: ${result.workspace_id}`);\n } catch (err) {\n printError(`Auto-provision failed: ${err}`);\n console.log(\"You can manually set credentials with: corp config set api_key <key>\");\n }\n } else {\n console.log(\"\\nVerifying existing credentials...\");\n let keyValid = false;\n try {\n const resp = await fetch(\n `${cfg.api_url.replace(/\\/+$/, \"\")}/v1/workspaces/${cfg.workspace_id}/status`,\n { headers: { Authorization: `Bearer ${cfg.api_key}` } }\n );\n keyValid = resp.status !== 401;\n } catch {\n // network error — treat as potentially valid\n }\n\n if (keyValid) {\n console.log(\"Credentials OK.\");\n } else {\n console.log(\"API key is no longer valid.\");\n const reprovision = await confirm({\n message: \"Provision a new workspace? (This will replace your current credentials)\",\n default: false,\n });\n if (reprovision) {\n try {\n const result = await provisionWorkspace(cfg.api_url, `${user.name}'s workspace`);\n cfg.api_key = result.api_key as string;\n cfg.workspace_id = result.workspace_id as string;\n console.log(`Workspace provisioned: ${result.workspace_id}`);\n } catch (err) {\n printError(`Provisioning failed: ${err}`);\n }\n } else {\n console.log(\"Keeping existing credentials. You can manually update with: corp config set api_key <key>\");\n }\n }\n }\n\n saveConfig(cfg);\n console.log(\"\\nConfig saved to ~/.corp/config.json\");\n console.log(\"Run 'corp status' to verify your connection.\");\n}\n","/**\n * Rising cityscape boot animation — ported from packages/cli/corp/tui/widgets/mascot.py\n */\n\n// prettier-ignore\nconst BUILDINGS: string[][] = [\n [\n \" ┌┐ \",\n \" ││ \",\n \" ││ \",\n \" ┌┤├┐ \",\n \" │││││\",\n \" │││││\",\n ],\n [\n \" ╔══╗ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n \" ║▪▪║ \",\n ],\n [\n \" /\\\\ \",\n \" / \\\\ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n ],\n [\n \" ┌──┐ \",\n \" │≋≋│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n \" │▪▪│ \",\n ],\n [\n \" ╻ \",\n \" ┃ \",\n \" ┌┤┐ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n [\n \" ┌┐ \",\n \" ├┤ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n [\n \" ╔═══╗\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n \" ║▪ ▪║\",\n ],\n [\n \" ┬─┬ \",\n \" │~│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n \" │▪│ \",\n ],\n];\n\nconst MAX_HEIGHT = Math.max(...BUILDINGS.map((b) => b.length));\nconst TOTAL_FRAMES = MAX_HEIGHT + 4; // 15 frames, ~1.5s at 100ms\n\nconst GOLD = \"\\x1b[38;2;212;160;23m\";\nconst RESET = \"\\x1b[0m\";\n\nexport function renderFrame(frame: number): string {\n const cols: string[][] = [];\n for (let i = 0; i < BUILDINGS.length; i++) {\n const building = BUILDINGS[i];\n const h = building.length;\n const visible = Math.max(0, Math.min(h, frame - i));\n const width = building[0]?.length ?? 6;\n const blank = \" \".repeat(width);\n const col: string[] = Array(MAX_HEIGHT - visible).fill(blank);\n col.push(...building.slice(h - visible));\n cols.push(col);\n }\n\n const lines: string[] = [];\n for (let row = 0; row < MAX_HEIGHT; row++) {\n lines.push(cols.map((col) => col[row]).join(\"\"));\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Run an async function while displaying the rising cityscape animation.\n * No-ops when stdout is not a TTY (piped, CI, etc.).\n */\nexport async function withAnimation<T>(fn: () => Promise<T>): Promise<T> {\n if (!process.stdout.isTTY) {\n return fn();\n }\n\n let frame = 0;\n let animDone = false;\n const spinChars = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n let spinIdx = 0;\n let lastLineCount = 0;\n\n const clearPrev = () => {\n if (lastLineCount > 0) {\n process.stdout.write(`\\x1b[${lastLineCount}A\\x1b[0J`);\n }\n };\n\n const drawFrame = () => {\n clearPrev();\n if (!animDone) {\n const art = renderFrame(frame);\n const output = `${GOLD}${art}${RESET}\\n`;\n process.stdout.write(output);\n lastLineCount = MAX_HEIGHT + 1;\n frame++;\n if (frame >= TOTAL_FRAMES) {\n animDone = true;\n }\n } else {\n // Dot spinner fallback after animation finishes\n const line = `${GOLD}${spinChars[spinIdx % spinChars.length]} Loading...${RESET}\\n`;\n process.stdout.write(line);\n lastLineCount = 1;\n spinIdx++;\n }\n };\n\n drawFrame();\n const timer = setInterval(drawFrame, 100);\n\n try {\n const result = await fn();\n return result;\n } finally {\n clearInterval(timer);\n clearPrev();\n }\n}\n","import { withAnimation } from \"./animation.js\";\n\n/**\n * Run an async function with a loading animation.\n * Silently skipped when `json` is truthy (pure JSON output) or non-TTY.\n */\nexport async function withSpinner<T>(\n _label: string,\n fn: () => Promise<T>,\n json?: boolean,\n): Promise<T> {\n if (json) {\n return fn();\n }\n return withAnimation(fn);\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printStatusPanel } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\n\nexport async function statusCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await withSpinner(\"Loading\", () => client.getStatus());\n printStatusPanel(data);\n } catch (err) {\n printError(`Failed to fetch status: ${err}`);\n process.exit(1);\n }\n}\n","import { configForDisplay, getValue, loadConfig, saveConfig, setValue } from \"../config.js\";\nimport { printError, printJson } from \"../output.js\";\n\nexport function configSetCommand(key: string, value: string): void {\n const cfg = loadConfig();\n setValue(cfg as unknown as Record<string, unknown>, key, value);\n saveConfig(cfg);\n console.log(`${key} = ${value}`);\n}\n\nexport function configGetCommand(key: string): void {\n const cfg = loadConfig();\n const val = getValue(cfg as unknown as Record<string, unknown>, key);\n if (val === undefined) {\n printError(`Key not found: ${key}`);\n process.exit(1);\n }\n if (typeof val === \"object\" && val !== null) {\n printJson(val);\n } else {\n console.log(String(val));\n }\n}\n\nexport function configListCommand(): void {\n const cfg = loadConfig();\n printJson(configForDisplay(cfg));\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printObligationsTable, printError, printJson } from \"../output.js\";\n\nexport async function obligationsCommand(opts: { tier?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getObligations(opts.tier);\n const obligations = (data.obligations ?? []) as Record<string, unknown>[];\n if (opts.json) printJson(obligations);\n else if (obligations.length === 0) console.log(\"No obligations found.\");\n else printObligationsTable(obligations);\n } catch (err) { printError(`Failed to fetch obligations: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function digestCommand(opts: { trigger?: boolean; key?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n if (opts.trigger) {\n const result = await client.triggerDigest();\n printSuccess(\"Digest triggered.\");\n printJson(result);\n } else if (opts.key) {\n const result = await client.getDigest(opts.key);\n printJson(result);\n } else {\n const digests = await client.listDigests();\n if (digests.length === 0) console.log(\"No digest history found.\");\n else printJson(digests);\n }\n } catch (err) { printError(`Failed: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError } from \"../output.js\";\n\nexport async function linkCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.createLink();\n const code = data.code as string;\n const expires = (data.expires_in_seconds ?? 900) as number;\n console.log();\n console.log(` ${code}`);\n console.log();\n console.log(`Run this on the other device (expires in ${Math.floor(expires / 60)} minutes):`);\n console.log(` corp claim ${code}`);\n console.log();\n } catch (err) {\n printError(`${err}`);\n process.exit(1);\n }\n}\n","import { loadConfig, saveConfig } from \"../config.js\";\nimport { printError } from \"../output.js\";\n\nexport async function claimCommand(code: string): Promise<void> {\n const cfg = loadConfig();\n const apiUrl = (cfg.api_url || \"https://api.thecorporation.ai\").replace(/\\/+$/, \"\");\n try {\n const resp = await fetch(`${apiUrl}/v1/workspaces/claim`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ code }),\n });\n if (!resp.ok) {\n let detail = \"\";\n try { const body = await resp.json() as Record<string, string>; detail = body.detail ?? \"\"; } catch { /* ignore */ }\n printError(detail || `${resp.status} ${resp.statusText}`);\n process.exit(1);\n }\n const data = await resp.json() as Record<string, string>;\n cfg.api_key = data.api_key;\n cfg.workspace_id = data.workspace_id;\n saveConfig(cfg);\n console.log(`Workspace joined: ${data.workspace_id}`);\n console.log(\"Credentials saved to ~/.corp/config.json\");\n } catch (err) {\n printError(`${err}`);\n process.exit(1);\n }\n}\n","import type { ToolCall, LLMResponse } from \"./types.js\";\n\nconst PROVIDER_BASE_URLS: Record<string, string> = {\n openrouter: \"https://openrouter.ai/api/v1\",\n};\n\nexport async function chat(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n provider = \"anthropic\",\n apiKey = \"\",\n model = \"\",\n baseUrl?: string,\n): Promise<LLMResponse> {\n if (provider === \"anthropic\") {\n return chatAnthropic(messages, tools, apiKey, model);\n } else if (provider === \"openai\" || provider === \"openrouter\") {\n const effectiveUrl = baseUrl ?? PROVIDER_BASE_URLS[provider];\n return chatOpenAI(messages, tools, apiKey, model, effectiveUrl);\n }\n throw new Error(`Unknown LLM provider: ${provider}`);\n}\n\nasync function chatAnthropic(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n apiKey = \"\",\n model = \"\",\n): Promise<LLMResponse> {\n const { default: Anthropic } = await import(\"@anthropic-ai/sdk\");\n const client = new Anthropic({ apiKey });\n\n let systemText = \"\";\n const convMessages: Record<string, unknown>[] = [];\n\n for (const msg of messages) {\n if (msg.role === \"system\") {\n systemText = msg.content as string;\n } else if (msg.role === \"tool\") {\n convMessages.push({\n role: \"user\",\n content: [{\n type: \"tool_result\",\n tool_use_id: msg.tool_call_id,\n content: msg.content,\n }],\n });\n } else if (msg.role === \"assistant\" && msg.tool_calls) {\n const contentBlocks: Record<string, unknown>[] = [];\n if (msg.content) contentBlocks.push({ type: \"text\", text: msg.content });\n for (const tc of msg.tool_calls as Record<string, unknown>[]) {\n const fn = tc.function as Record<string, unknown>;\n let args = fn.arguments;\n if (typeof args === \"string\") args = JSON.parse(args);\n contentBlocks.push({ type: \"tool_use\", id: tc.id, name: fn.name, input: args });\n }\n convMessages.push({ role: \"assistant\", content: contentBlocks });\n } else {\n convMessages.push({ role: msg.role, content: msg.content ?? \"\" });\n }\n }\n\n let anthropicTools: Record<string, unknown>[] | undefined;\n if (tools?.length) {\n anthropicTools = tools.map((t) => {\n const fn = (t as Record<string, unknown>).function as Record<string, unknown>;\n return {\n name: fn.name,\n description: fn.description ?? \"\",\n input_schema: fn.parameters ?? { type: \"object\", properties: {} },\n };\n });\n }\n\n const kwargs: Record<string, unknown> = {\n model: model || \"claude-sonnet-4-20250514\",\n max_tokens: 4096,\n messages: convMessages,\n };\n if (systemText) kwargs.system = systemText;\n if (anthropicTools) kwargs.tools = anthropicTools;\n\n const response = await client.messages.create(kwargs as Parameters<typeof client.messages.create>[0]);\n\n let content: string | null = null;\n const toolCallsOut: ToolCall[] = [];\n for (const block of response.content) {\n if (block.type === \"text\") {\n content = block.text;\n } else if (block.type === \"tool_use\") {\n toolCallsOut.push({\n id: block.id,\n name: block.name,\n arguments: typeof block.input === \"object\" ? (block.input as Record<string, unknown>) : {},\n });\n }\n }\n\n return {\n content,\n tool_calls: toolCallsOut,\n usage: {\n prompt_tokens: response.usage.input_tokens,\n completion_tokens: response.usage.output_tokens,\n total_tokens: response.usage.input_tokens + response.usage.output_tokens,\n },\n finish_reason: response.stop_reason ?? null,\n };\n}\n\nasync function chatOpenAI(\n messages: Record<string, unknown>[],\n tools?: Record<string, unknown>[],\n apiKey = \"\",\n model = \"\",\n baseUrl?: string,\n): Promise<LLMResponse> {\n const { default: OpenAI } = await import(\"openai\");\n const clientOpts: Record<string, unknown> = { apiKey };\n if (baseUrl) clientOpts.baseURL = baseUrl;\n const client = new OpenAI(clientOpts as ConstructorParameters<typeof OpenAI>[0]);\n\n const kwargs: Record<string, unknown> = {\n model: model || \"gpt-4o\",\n messages,\n max_tokens: 4096,\n };\n if (tools?.length) {\n kwargs.tools = tools;\n kwargs.tool_choice = \"auto\";\n }\n\n const response = await client.chat.completions.create(kwargs as Parameters<typeof client.chat.completions.create>[0]);\n const choice = response.choices[0];\n const message = choice.message;\n\n const toolCallsOut: ToolCall[] = [];\n if (message.tool_calls) {\n for (const tc of message.tool_calls) {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(tc.function.arguments);\n } catch {\n args = { _raw: tc.function.arguments };\n }\n toolCallsOut.push({ id: tc.id, name: tc.function.name, arguments: args });\n }\n }\n\n return {\n content: message.content,\n tool_calls: toolCallsOut,\n usage: {\n prompt_tokens: response.usage?.prompt_tokens ?? 0,\n completion_tokens: response.usage?.completion_tokens ?? 0,\n total_tokens: response.usage?.total_tokens ?? 0,\n },\n finish_reason: choice.finish_reason ?? null,\n };\n}\n","import {\n TOOL_DEFINITIONS as _TOOL_DEFINITIONS,\n isWriteTool as _isWriteTool,\n executeTool as _executeTool,\n} from \"@thecorporation/corp-tools\";\nimport type { CorpAPIClient } from \"@thecorporation/corp-tools\";\nimport { loadConfig, saveConfig } from \"./config.js\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nexport const TOOL_DEFINITIONS = _TOOL_DEFINITIONS;\nexport const isWriteTool: (name: string, args?: Record<string, unknown>) => boolean = _isWriteTool;\n\nexport async function executeTool(\n name: string,\n args: Record<string, unknown>,\n client: CorpAPIClient,\n): Promise<string> {\n return _executeTool(name, args, client, {\n dataDir: join(homedir(), \".corp\"),\n onEntityFormed: (entityId) => {\n try {\n const cfg = loadConfig();\n cfg.active_entity_id = entityId;\n saveConfig(cfg);\n } catch { /* ignore */ }\n },\n });\n}\n","import { createInterface } from \"node:readline\";\nimport chalk from \"chalk\";\nimport { requireConfig, configForDisplay, getValue, setValue, saveConfig } from \"./config.js\";\nimport { CorpAPIClient } from \"./api-client.js\";\nimport { chat as llmChat } from \"./llm.js\";\nimport { TOOL_DEFINITIONS, executeTool, isWriteTool } from \"./tools.js\";\nimport { printError, printStatusPanel, printObligationsTable, printJson } from \"./output.js\";\nimport type { CorpConfig, LLMResponse, ToolCall } from \"./types.js\";\n\nconst SYSTEM_PROMPT = `You are **corp**, an AI assistant for corporate governance.\nYou help users manage their companies — entities, cap tables, compliance, governance, finances, and more.\nYou have tools to read and write corporate data. Use them to fulfill user requests.\nFor write operations, confirm with the user before proceeding.\nMonetary values are in cents (e.g. 100000 = $1,000.00).\nDocuments must be signed by the human — you cannot sign on their behalf.\nAfter completing actions, suggest logical next steps.`;\n\nexport async function chatCommand(): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\", \"llm.api_key\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n const messages: Record<string, unknown>[] = [{ role: \"system\", content: SYSTEM_PROMPT }];\n let totalTokens = 0;\n\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n const prompt = () => new Promise<string>((resolve) => rl.question(chalk.green.bold(\"> \"), resolve));\n\n console.log(chalk.blue.bold(\"corp chat\") + \" — type /help for commands, /quit to exit\\n\");\n\n const slashHandlers: Record<string, (args: string) => void> = {\n \"/status\": async () => {\n try { printStatusPanel(await client.getStatus()); } catch (e) { printError(`Status error: ${e}`); }\n },\n \"/obligations\": async () => {\n try {\n const data = await client.getObligations();\n const obls = (data.obligations ?? []) as Record<string, unknown>[];\n if (obls.length) printObligationsTable(obls);\n else console.log(chalk.dim(\"No obligations found.\"));\n } catch (e) { printError(`Obligations error: ${e}`); }\n },\n \"/digest\": async () => {\n try {\n const digests = await client.listDigests();\n if (digests.length) printJson(digests);\n else console.log(chalk.dim(\"No digest history.\"));\n } catch (e) { printError(`Digest error: ${e}`); }\n },\n \"/config\": () => printJson(configForDisplay(cfg)),\n \"/model\": (args: string) => {\n const model = args.trim();\n if (!model) { console.log(`Current model: ${getValue(cfg as unknown as Record<string, unknown>, \"llm.model\")}`); return; }\n setValue(cfg as unknown as Record<string, unknown>, \"llm.model\", model);\n saveConfig(cfg);\n console.log(`Model switched to: ${model}`);\n },\n \"/cost\": () => console.log(`Session tokens used: ${totalTokens.toLocaleString()}`),\n \"/clear\": () => {\n messages.length = 0;\n messages.push({ role: \"system\", content: SYSTEM_PROMPT });\n totalTokens = 0;\n console.log(chalk.dim(\"Conversation cleared.\"));\n },\n \"/help\": () => {\n console.log(`\n${chalk.bold(\"Chat Slash Commands\")}\n /status Show workspace status\n /obligations List obligations\n /digest Show digest history\n /config Show current config (masked keys)\n /model <name> Switch LLM model\n /cost Show token usage\n /clear Clear conversation\n /help Show this help\n /quit Exit chat`);\n },\n };\n\n try {\n while (true) {\n let userInput: string;\n try {\n userInput = (await prompt()).trim();\n } catch {\n console.log(\"\\n\" + chalk.dim(\"Goodbye.\"));\n break;\n }\n\n if (!userInput) continue;\n\n if (userInput.startsWith(\"/\")) {\n const [cmd, ...rest] = userInput.split(/\\s+/);\n const args = rest.join(\" \");\n if (cmd === \"/quit\" || cmd === \"/exit\") {\n console.log(chalk.dim(\"Goodbye.\"));\n break;\n }\n const handler = slashHandlers[cmd.toLowerCase()];\n if (handler) { await handler(args); continue; }\n printError(`Unknown command: ${cmd}. Type /help for available commands.`);\n continue;\n }\n\n messages.push({ role: \"user\", content: userInput });\n\n const llmCfg = cfg.llm;\n while (true) {\n let response: LLMResponse;\n try {\n response = await llmChat(\n messages, TOOL_DEFINITIONS, llmCfg.provider, llmCfg.api_key, llmCfg.model, llmCfg.base_url,\n );\n } catch (err) {\n printError(`LLM error: ${err}`);\n break;\n }\n\n totalTokens += response.usage.total_tokens;\n\n const assistantMsg: Record<string, unknown> = { role: \"assistant\", content: response.content };\n if (response.tool_calls.length > 0) {\n assistantMsg.tool_calls = response.tool_calls.map((tc) => ({\n id: tc.id, type: \"function\",\n function: { name: tc.name, arguments: JSON.stringify(tc.arguments) },\n }));\n if (!response.content) assistantMsg.content = null;\n }\n messages.push(assistantMsg);\n\n if (response.tool_calls.length === 0) {\n if (response.content) console.log(\"\\n\" + response.content + \"\\n\");\n break;\n }\n\n for (const tc of response.tool_calls) {\n console.log(chalk.dim(` ${isWriteTool(tc.name, tc.arguments) ? \"\\u2699\" : \"\\u2139\"} ${tc.name}(${JSON.stringify(tc.arguments).slice(0, 80)})`));\n const result = await executeTool(tc.name, tc.arguments, client);\n const short = result.length > 200 ? result.slice(0, 197) + \"...\" : result;\n console.log(chalk.dim(` => ${short}`));\n messages.push({ role: \"tool\", tool_call_id: tc.id, content: result });\n }\n }\n }\n } finally {\n rl.close();\n }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printEntitiesTable, printError, printSuccess, printJson } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\nimport chalk from \"chalk\";\n\nexport async function entitiesCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const entities = await withSpinner(\"Loading\", () => client.listEntities(), opts.json);\n if (opts.json) {\n printJson(entities);\n } else if (entities.length === 0) {\n console.log(\"No entities found.\");\n } else {\n printEntitiesTable(entities);\n }\n } catch (err) {\n printError(`Failed to fetch entities: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesShowCommand(entityId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const entities = await client.listEntities();\n const entity = entities.find((e) => e.entity_id === entityId);\n if (!entity) {\n printError(`Entity not found: ${entityId}`);\n process.exit(1);\n }\n if (opts.json) {\n printJson(entity);\n } else {\n console.log(chalk.blue(\"─\".repeat(40)));\n console.log(chalk.blue.bold(\" Entity Detail\"));\n console.log(chalk.blue(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${entity.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Type:\")} ${entity.entity_type ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Jurisdiction:\")} ${entity.jurisdiction ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Status:\")} ${entity.status ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"ID:\")} ${entity.entity_id ?? \"N/A\"}`);\n if (entity.formation_date) console.log(` ${chalk.bold(\"Formation Date:\")} ${entity.formation_date}`);\n if (entity.ein) console.log(` ${chalk.bold(\"EIN:\")} ${entity.ein}`);\n console.log(chalk.blue(\"─\".repeat(40)));\n }\n } catch (err) {\n printError(`Failed to fetch entities: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesConvertCommand(\n entityId: string,\n opts: { to: string; jurisdiction?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: Record<string, string> = { target_type: opts.to };\n if (opts.jurisdiction) data.new_jurisdiction = opts.jurisdiction;\n const result = await client.convertEntity(entityId, data);\n printSuccess(`Entity conversion initiated: ${result.conversion_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to convert entity: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function entitiesDissolveCommand(\n entityId: string,\n opts: { reason: string; effectiveDate?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: Record<string, string> = { reason: opts.reason };\n if (opts.effectiveDate) data.effective_date = opts.effectiveDate;\n const result = await client.dissolveEntity(entityId, data);\n printSuccess(`Dissolution initiated: ${result.dissolution_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to dissolve entity: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printContactsTable, printError, printSuccess, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport type { ApiRecord } from \"../types.js\";\n\nexport async function contactsListCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const contacts = await client.listContacts(eid);\n if (opts.json) printJson(contacts);\n else if (contacts.length === 0) console.log(\"No contacts found.\");\n else printContactsTable(contacts);\n } catch (err) {\n printError(`Failed to fetch contacts: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsShowCommand(contactId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const profile = await client.getContactProfile(contactId);\n if (opts.json) {\n printJson(profile);\n } else {\n const contact = (profile.contact ?? profile) as ApiRecord;\n console.log(chalk.cyan(\"─\".repeat(40)));\n console.log(chalk.cyan.bold(\" Contact Profile\"));\n console.log(chalk.cyan(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${contact.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Email:\")} ${contact.email ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Category:\")} ${contact.category ?? \"N/A\"}`);\n if (contact.phone) console.log(` ${chalk.bold(\"Phone:\")} ${contact.phone}`);\n if (contact.notes) console.log(` ${chalk.bold(\"Notes:\")} ${contact.notes}`);\n const holdings = profile.equity_holdings as ApiRecord[] | undefined;\n if (holdings?.length) {\n console.log(`\\n ${chalk.bold(\"Equity Holdings:\")}`);\n for (const h of holdings) console.log(` ${h.share_class ?? \"?\"}: ${h.shares ?? \"?\"} shares`);\n }\n const obls = profile.obligations as unknown[];\n if (obls?.length) console.log(`\\n ${chalk.bold(\"Obligations:\")} ${obls.length}`);\n console.log(chalk.cyan(\"─\".repeat(40)));\n }\n } catch (err) {\n printError(`Failed to fetch contact: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsAddCommand(opts: {\n entityId?: string;\n name: string;\n email: string;\n type?: string;\n category?: string;\n phone?: string;\n notes?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = {\n entity_id: eid,\n contact_type: opts.type ?? \"individual\",\n name: opts.name,\n email: opts.email,\n category: opts.category ?? \"employee\",\n };\n if (opts.phone) data.phone = opts.phone;\n if (opts.notes) data.notes = opts.notes;\n const result = await client.createContact(data);\n printSuccess(`Contact created: ${result.contact_id ?? result.id ?? \"OK\"}`);\n } catch (err) {\n printError(`Failed to create contact: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function contactsEditCommand(\n contactId: string,\n opts: { name?: string; email?: string; category?: string; phone?: string; notes?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = {};\n if (opts.name != null) data.name = opts.name;\n if (opts.email != null) data.email = opts.email;\n if (opts.category != null) data.category = opts.category;\n if (opts.phone != null) data.phone = opts.phone;\n if (opts.notes != null) data.notes = opts.notes;\n if (Object.keys(data).length === 0) {\n console.log(\"No fields to update.\");\n return;\n }\n await client.updateContact(contactId, data);\n printSuccess(\"Contact updated.\");\n } catch (err) {\n printError(`Failed to update contact: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport {\n printCapTable, printSafesTable, printTransfersTable,\n printValuationsTable, printError, printSuccess, printJson,\n} from \"../output.js\";\nimport chalk from \"chalk\";\n\nexport async function capTableCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getCapTable(eid);\n if (opts.json) { printJson(data); return; }\n if ((data.access_level as string) === \"none\") {\n printError(\"You do not have access to this entity's cap table.\");\n process.exit(1);\n }\n printCapTable(data);\n try {\n const val = await client.getCurrent409a(eid);\n if (val) print409a(val);\n } catch { /* ignore */ }\n } catch (err) {\n printError(`Failed to fetch cap table: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function safesCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const safes = await client.getSafeNotes(eid);\n if (opts.json) printJson(safes);\n else if (safes.length === 0) console.log(\"No SAFE notes found.\");\n else printSafesTable(safes);\n } catch (err) {\n printError(`Failed to fetch SAFE notes: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function transfersCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const transfers = await client.getShareTransfers(eid);\n if (opts.json) printJson(transfers);\n else if (transfers.length === 0) console.log(\"No share transfers found.\");\n else printTransfersTable(transfers);\n } catch (err) {\n printError(`Failed to fetch transfers: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function valuationsCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const valuations = await client.getValuations(eid);\n if (opts.json) printJson(valuations);\n else if (valuations.length === 0) console.log(\"No valuations found.\");\n else printValuationsTable(valuations);\n } catch (err) {\n printError(`Failed to fetch valuations: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function fourOhNineACommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data = await client.getCurrent409a(eid);\n if (opts.json) printJson(data);\n else if (!data || Object.keys(data).length === 0) console.log(\"No 409A valuation found.\");\n else print409a(data);\n } catch (err) {\n printError(`Failed to fetch 409A valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueEquityCommand(opts: {\n entityId?: string;\n grantType: string;\n shares: number;\n recipient: string;\n email?: string;\n instrumentId?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n // Fetch cap table to get issuer and instrument info\n const capTable = await client.getCapTable(eid);\n const issuerLegalEntityId = capTable.issuer_legal_entity_id as string;\n if (!issuerLegalEntityId) {\n printError(\"No issuer legal entity found. Has this entity been formed with a cap table?\");\n process.exit(1);\n }\n\n // Resolve instrument ID — use provided, or match by grant type, or use first common stock\n let instrumentId = opts.instrumentId;\n if (!instrumentId) {\n const instruments = capTable.instruments as Array<{ instrument_id: string; kind: string; symbol: string }>;\n if (!instruments?.length) {\n printError(\"No instruments found on cap table. Create an instrument first.\");\n process.exit(1);\n }\n const grantLower = opts.grantType.toLowerCase();\n const match = instruments.find(\n (i) => i.kind.toLowerCase().includes(grantLower) || i.symbol.toLowerCase().includes(grantLower),\n ) ?? instruments.find((i) => i.kind.toLowerCase().includes(\"common\"));\n if (match) {\n instrumentId = match.instrument_id;\n console.log(`Using instrument: ${match.symbol} (${match.kind})`);\n } else {\n instrumentId = instruments[0].instrument_id;\n console.log(`Using first instrument: ${instruments[0].symbol} (${instruments[0].kind})`);\n }\n }\n\n // 1. Start a staged round\n const round = await client.startEquityRound({\n entity_id: eid,\n name: `${opts.grantType} grant — ${opts.recipient}`,\n issuer_legal_entity_id: issuerLegalEntityId,\n });\n const roundId = (round.round_id ?? round.equity_round_id) as string;\n\n // 2. Add the security\n const securityData: Record<string, unknown> = {\n entity_id: eid,\n instrument_id: instrumentId,\n quantity: opts.shares,\n recipient_name: opts.recipient,\n grant_type: opts.grantType,\n };\n if (opts.email) securityData.email = opts.email;\n await client.addRoundSecurity(roundId, securityData);\n\n // 3. Issue the round\n const result = await client.issueRound(roundId, { entity_id: eid });\n\n printSuccess(`Equity issued: ${opts.shares} shares (${opts.grantType}) to ${opts.recipient}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to issue equity: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueSafeCommand(opts: {\n entityId?: string;\n investor: string;\n amount: number;\n safeType: string;\n valuationCap: number;\n email?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n // Fetch cap table for issuer and SAFE instrument\n const capTable = await client.getCapTable(eid);\n const issuerLegalEntityId = capTable.issuer_legal_entity_id as string;\n if (!issuerLegalEntityId) {\n printError(\"No issuer legal entity found. Has this entity been formed with a cap table?\");\n process.exit(1);\n }\n\n const instruments = capTable.instruments as Array<{ instrument_id: string; kind: string; symbol: string }>;\n const safeInstrument = instruments?.find((i) => i.kind.toLowerCase() === \"safe\");\n if (!safeInstrument) {\n printError(\"No SAFE instrument found on cap table. Create a SAFE instrument first.\");\n process.exit(1);\n }\n\n // Start a staged round for the SAFE\n const round = await client.startEquityRound({\n entity_id: eid,\n name: `SAFE — ${opts.investor}`,\n issuer_legal_entity_id: issuerLegalEntityId,\n });\n const roundId = (round.round_id ?? round.equity_round_id) as string;\n\n // Add the SAFE security — use principal_cents as quantity since quantity must be > 0\n const securityData: Record<string, unknown> = {\n entity_id: eid,\n instrument_id: safeInstrument.instrument_id,\n quantity: opts.amount,\n recipient_name: opts.investor,\n principal_cents: opts.amount,\n grant_type: opts.safeType,\n };\n if (opts.email) securityData.email = opts.email;\n await client.addRoundSecurity(roundId, securityData);\n\n // Issue the round\n const result = await client.issueRound(roundId, { entity_id: eid });\n printSuccess(`SAFE issued: $${(opts.amount / 100).toLocaleString()} to ${opts.investor}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to issue SAFE: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function transferSharesCommand(opts: {\n entityId?: string;\n fromGrant: string;\n to: string;\n shares: number;\n type: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.transferShares({\n entity_id: eid, from_holder_id: opts.fromGrant, to_holder_id: opts.to,\n quantity: opts.shares, transfer_type: opts.type,\n });\n printSuccess(`Transfer workflow created: ${result.workflow_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to create transfer workflow: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function distributeCommand(opts: {\n entityId?: string;\n amount: number;\n type: string;\n description: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.calculateDistribution({\n entity_id: eid, total_amount_cents: opts.amount, distribution_type: opts.type,\n description: opts.description,\n });\n printSuccess(`Distribution calculated: ${result.distribution_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to calculate distribution: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function startRoundCommand(opts: {\n entityId?: string;\n name: string;\n issuerLegalEntityId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.startEquityRound({\n entity_id: eid,\n name: opts.name,\n issuer_legal_entity_id: opts.issuerLegalEntityId,\n });\n printSuccess(`Round started: ${result.round_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to start round: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function addSecurityCommand(opts: {\n entityId?: string;\n roundId: string;\n holderId?: string;\n email?: string;\n instrumentId: string;\n quantity: number;\n recipientName: string;\n principalCents?: number;\n grantType?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const body: Record<string, unknown> = {\n entity_id: eid,\n instrument_id: opts.instrumentId,\n quantity: opts.quantity,\n recipient_name: opts.recipientName,\n };\n if (opts.holderId) body.holder_id = opts.holderId;\n if (opts.email) body.email = opts.email;\n if (opts.principalCents) body.principal_cents = opts.principalCents;\n if (opts.grantType) body.grant_type = opts.grantType;\n const result = await client.addRoundSecurity(opts.roundId, body);\n printSuccess(`Security added for ${opts.recipientName}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to add security: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function issueRoundCommand(opts: {\n entityId?: string;\n roundId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.issueRound(opts.roundId, { entity_id: eid });\n printSuccess(\"Round issued and closed\");\n printJson(result);\n } catch (err) {\n printError(`Failed to issue round: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function createValuationCommand(opts: {\n entityId?: string;\n type: string;\n date: string;\n methodology: string;\n fmv?: number;\n enterpriseValue?: number;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const body: Record<string, unknown> = {\n entity_id: eid,\n valuation_type: opts.type,\n effective_date: opts.date,\n methodology: opts.methodology,\n };\n if (opts.fmv != null) body.fmv_per_share_cents = opts.fmv;\n if (opts.enterpriseValue != null) body.enterprise_value_cents = opts.enterpriseValue;\n const result = await client.createValuation(body);\n printSuccess(`Valuation created: ${result.valuation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to create valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function submitValuationCommand(opts: {\n entityId?: string;\n valuationId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.submitValuationForApproval(opts.valuationId, eid);\n printSuccess(`Valuation submitted for approval: ${result.valuation_id ?? \"OK\"}`);\n if (result.meeting_id) console.log(` Meeting: ${result.meeting_id}`);\n if (result.agenda_item_id) console.log(` Agenda Item: ${result.agenda_item_id}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to submit valuation: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function approveValuationCommand(opts: {\n entityId?: string;\n valuationId: string;\n resolutionId?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.approveValuation(opts.valuationId, eid, opts.resolutionId);\n printSuccess(`Valuation approved: ${result.valuation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) {\n printError(`Failed to approve valuation: ${err}`);\n process.exit(1);\n }\n}\n\nfunction print409a(data: Record<string, unknown>): void {\n console.log(chalk.green(\"─\".repeat(40)));\n console.log(chalk.green.bold(\" 409A Valuation\"));\n console.log(chalk.green(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"FMV/Share:\")} $${data.fmv_per_share ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Enterprise Value:\")} $${data.enterprise_value ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Valuation Date:\")} ${data.valuation_date ?? \"N/A\"}`);\n if (data.provider) console.log(` ${chalk.bold(\"Provider:\")} ${data.provider}`);\n console.log(chalk.green(\"─\".repeat(40)));\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function financeInvoiceCommand(opts: {\n entityId?: string; customer: string; amount: number; dueDate: string; description: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.createInvoice({\n entity_id: eid, customer_name: opts.customer, amount_cents: opts.amount,\n due_date: opts.dueDate, description: opts.description,\n });\n printSuccess(`Invoice created: ${result.invoice_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to create invoice: ${err}`); process.exit(1); }\n}\n\nexport async function financePayrollCommand(opts: {\n entityId?: string; periodStart: string; periodEnd: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.runPayroll({\n entity_id: eid, pay_period_start: opts.periodStart, pay_period_end: opts.periodEnd,\n });\n printSuccess(`Payroll run created: ${result.payroll_run_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to run payroll: ${err}`); process.exit(1); }\n}\n\nexport async function financePayCommand(opts: {\n entityId?: string; amount: number; recipient: string; method: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.submitPayment({\n entity_id: eid, amount_cents: opts.amount, recipient: opts.recipient,\n description: `Payment via ${opts.method}`,\n });\n printSuccess(`Payment submitted: ${result.payment_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to submit payment: ${err}`); process.exit(1); }\n}\n\nexport async function financeOpenAccountCommand(opts: {\n entityId?: string; institution: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.openBankAccount({ entity_id: eid, bank_name: opts.institution });\n printSuccess(`Bank account opened: ${result.account_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to open bank account: ${err}`); process.exit(1); }\n}\n\nexport async function financeClassifyContractorCommand(opts: {\n entityId?: string; name: string; state: string; hours: number;\n exclusive: boolean; duration: number; providesTools: boolean;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.classifyContractor({\n entity_id: eid, contractor_name: opts.name, state: opts.state, hours_per_week: opts.hours,\n exclusive_client: opts.exclusive, duration_months: opts.duration, provides_tools: opts.providesTools,\n });\n printSuccess(`Classification: ${result.risk_level ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to classify contractor: ${err}`); process.exit(1); }\n}\n\nexport async function financeReconcileCommand(opts: {\n entityId?: string; startDate: string; endDate: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.reconcileLedger({\n entity_id: eid, start_date: opts.startDate, end_date: opts.endDate,\n });\n printSuccess(`Ledger reconciled: ${result.reconciliation_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to reconcile ledger: ${err}`); process.exit(1); }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport {\n printGovernanceTable, printSeatsTable, printMeetingsTable,\n printResolutionsTable, printError, printSuccess, printJson,\n} from \"../output.js\";\n\nexport async function governanceCreateBodyCommand(opts: {\n entityId?: string; name: string; bodyType: string; quorum: string; voting: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.createGovernanceBody({\n entity_id: eid,\n body_type: opts.bodyType,\n name: opts.name,\n quorum_rule: opts.quorum,\n voting_method: opts.voting,\n });\n printSuccess(`Governance body created: ${result.body_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to create governance body: ${err}`); process.exit(1); }\n}\n\nexport async function governanceAddSeatCommand(bodyId: string, opts: {\n holder: string; title?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: Record<string, unknown> = { holder_id: opts.holder };\n if (opts.title) data.title = opts.title;\n const result = await client.createGovernanceSeat(bodyId, data);\n printSuccess(`Seat added: ${result.seat_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to add seat: ${err}`); process.exit(1); }\n}\n\nexport async function governanceListCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const bodies = await client.listGovernanceBodies(eid);\n if (opts.json) printJson(bodies);\n else if (bodies.length === 0) console.log(\"No governance bodies found.\");\n else printGovernanceTable(bodies);\n } catch (err) { printError(`Failed to fetch governance bodies: ${err}`); process.exit(1); }\n}\n\nexport async function governanceSeatsCommand(bodyId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const seats = await client.getGovernanceSeats(bodyId);\n if (opts.json) printJson(seats);\n else if (seats.length === 0) console.log(\"No seats found.\");\n else printSeatsTable(seats);\n } catch (err) { printError(`Failed to fetch seats: ${err}`); process.exit(1); }\n}\n\nexport async function governanceMeetingsCommand(bodyId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const meetings = await client.listMeetings(bodyId);\n if (opts.json) printJson(meetings);\n else if (meetings.length === 0) console.log(\"No meetings found.\");\n else printMeetingsTable(meetings);\n } catch (err) { printError(`Failed to fetch meetings: ${err}`); process.exit(1); }\n}\n\nexport async function governanceResolutionsCommand(meetingId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const resolutions = await client.getMeetingResolutions(meetingId);\n if (opts.json) printJson(resolutions);\n else if (resolutions.length === 0) console.log(\"No resolutions found.\");\n else printResolutionsTable(resolutions);\n } catch (err) { printError(`Failed to fetch resolutions: ${err}`); process.exit(1); }\n}\n\nexport async function governanceConveneCommand(opts: {\n entityId?: string; body: string; meetingType: string; title: string; date: string; agenda: string[];\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.scheduleMeeting({\n entity_id: eid, body_id: opts.body, meeting_type: opts.meetingType,\n title: opts.title, scheduled_date: opts.date,\n agenda_item_titles: opts.agenda,\n });\n printSuccess(`Meeting scheduled: ${result.meeting_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to schedule meeting: ${err}`); process.exit(1); }\n}\n\nexport async function governanceVoteCommand(\n meetingId: string,\n itemId: string,\n opts: { voter: string; vote: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, undefined);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.castVote(eid, meetingId, itemId, {\n voter_id: opts.voter, vote_value: opts.vote,\n });\n printSuccess(`Vote cast: ${result.vote_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to cast vote: ${err}`); process.exit(1); }\n}\n\nexport async function sendNoticeCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.sendNotice(meetingId, eid);\n printSuccess(`Notice sent for meeting ${meetingId}`);\n printJson(result);\n } catch (err) { printError(`Failed to send notice: ${err}`); process.exit(1); }\n}\n\nexport async function adjournMeetingCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.adjournMeeting(meetingId, eid);\n printSuccess(`Meeting ${meetingId} adjourned`);\n printJson(result);\n } catch (err) { printError(`Failed to adjourn meeting: ${err}`); process.exit(1); }\n}\n\nexport async function cancelMeetingCommand(meetingId: string, opts: { entityId?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.cancelMeeting(meetingId, eid);\n printSuccess(`Meeting ${meetingId} cancelled`);\n printJson(result);\n } catch (err) { printError(`Failed to cancel meeting: ${err}`); process.exit(1); }\n}\n\nexport async function finalizeAgendaItemCommand(\n meetingId: string, itemId: string, opts: { status: string; entityId?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.finalizeAgendaItem(meetingId, itemId, {\n entity_id: eid, status: opts.status,\n });\n printSuccess(`Agenda item ${itemId} finalized as ${opts.status}`);\n printJson(result);\n } catch (err) { printError(`Failed to finalize agenda item: ${err}`); process.exit(1); }\n}\n\nexport async function computeResolutionCommand(\n meetingId: string, itemId: string, opts: { text: string; entityId?: string }\n): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.computeResolution(meetingId, itemId, eid, {\n resolution_text: opts.text,\n });\n printSuccess(`Resolution computed for agenda item ${itemId}`);\n printJson(result);\n } catch (err) { printError(`Failed to compute resolution: ${err}`); process.exit(1); }\n}\n\nexport async function writtenConsentCommand(opts: {\n body: string; title: string; description: string; entityId?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.writtenConsent({\n entity_id: eid, body_id: opts.body, title: opts.title, description: opts.description,\n });\n printSuccess(`Written consent created: ${result.meeting_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to create written consent: ${err}`); process.exit(1); }\n}\n\nexport async function listAgendaItemsCommand(meetingId: string, opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const items = await client.listAgendaItems(meetingId, eid);\n if (opts.json) printJson(items);\n else if (items.length === 0) console.log(\"No agenda items found.\");\n else printJson(items);\n } catch (err) { printError(`Failed to list agenda items: ${err}`); process.exit(1); }\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printDocumentsTable, printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function documentsListCommand(opts: { entityId?: string; json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const docs = await client.getEntityDocuments(eid);\n if (opts.json) printJson(docs);\n else if (docs.length === 0) console.log(\"No documents found.\");\n else printDocumentsTable(docs);\n } catch (err) { printError(`Failed to fetch documents: ${err}`); process.exit(1); }\n}\n\nexport async function documentsSigningLinkCommand(docId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = client.getSigningLink(docId);\n printSuccess(`Signing link: ${result.signing_url}`);\n console.log(\"Open this link in your browser to sign the document.\");\n } catch (err) { printError(`Failed to get signing link: ${err}`); process.exit(1); }\n}\n\nexport async function documentsGenerateCommand(opts: {\n entityId?: string; template: string; counterparty: string; effectiveDate?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.generateContract({\n entity_id: eid,\n template_type: opts.template,\n counterparty_name: opts.counterparty,\n effective_date: opts.effectiveDate ?? new Date().toISOString().slice(0, 10),\n });\n printSuccess(`Contract generated: ${result.contract_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to generate contract: ${err}`); process.exit(1); }\n}\n\nexport async function documentsPreviewPdfCommand(opts: {\n entityId?: string; documentId: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const apiUrl = cfg.api_url.replace(/\\/+$/, \"\");\n const qs = new URLSearchParams({ entity_id: eid, document_id: opts.documentId }).toString();\n const url = `${apiUrl}/v1/documents/preview/pdf?${qs}`;\n printSuccess(`Preview PDF URL: ${url}`);\n console.log(\"Use your API key to authenticate the download.\");\n}\n","import { requireConfig, resolveEntityId } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\n\nexport async function taxFileCommand(opts: { entityId?: string; type: string; year: number }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.fileTaxDocument({ entity_id: eid, document_type: opts.type, tax_year: opts.year });\n printSuccess(`Tax document filed: ${result.filing_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to file tax document: ${err}`); process.exit(1); }\n}\n\nexport async function taxDeadlineCommand(opts: {\n entityId?: string; type: string; dueDate: string; description: string; recurrence?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const eid = resolveEntityId(cfg, opts.entityId);\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.trackDeadline({\n entity_id: eid, deadline_type: opts.type, due_date: opts.dueDate,\n description: opts.description, recurrence: opts.recurrence ?? \"\",\n });\n printSuccess(`Deadline tracked: ${result.deadline_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to track deadline: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printAgentsTable, printError, printSuccess, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport type { ApiRecord } from \"../types.js\";\n\nexport async function agentsListCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const agents = await client.listAgents();\n if (opts.json) printJson(agents);\n else if (agents.length === 0) console.log(\"No agents found.\");\n else printAgentsTable(agents);\n } catch (err) { printError(`Failed to fetch agents: ${err}`); process.exit(1); }\n}\n\nexport async function agentsShowCommand(agentId: string, opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const agent = await client.getAgent(agentId);\n if (opts.json) { printJson(agent); return; }\n console.log(chalk.magenta(\"─\".repeat(40)));\n console.log(chalk.magenta.bold(\" Agent Detail\"));\n console.log(chalk.magenta(\"─\".repeat(40)));\n console.log(` ${chalk.bold(\"Name:\")} ${agent.name ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Status:\")} ${agent.status ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"Model:\")} ${agent.model ?? \"N/A\"}`);\n console.log(` ${chalk.bold(\"ID:\")} ${agent.agent_id ?? \"N/A\"}`);\n if (agent.system_prompt) {\n let prompt = String(agent.system_prompt);\n if (prompt.length > 100) prompt = prompt.slice(0, 97) + \"...\";\n console.log(` ${chalk.bold(\"Prompt:\")} ${prompt}`);\n }\n if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {\n console.log(` ${chalk.bold(\"Skills:\")} ${(agent.skills as Array<{name?: string}>).map((s) => s.name ?? \"?\").join(\", \")}`);\n }\n console.log(chalk.magenta(\"─\".repeat(40)));\n } catch (err) { printError(`Failed to fetch agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsCreateCommand(opts: { name: string; prompt: string; model?: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const data: ApiRecord = { name: opts.name, system_prompt: opts.prompt };\n if (opts.model) data.model = opts.model;\n const result = await client.createAgent(data);\n printSuccess(`Agent created: ${result.agent_id ?? result.id ?? \"OK\"}`);\n } catch (err) { printError(`Failed to create agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsPauseCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.updateAgent(agentId, { status: \"paused\" });\n printSuccess(`Agent ${agentId} paused.`);\n } catch (err) { printError(`Failed to pause agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsResumeCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.updateAgent(agentId, { status: \"active\" });\n printSuccess(`Agent ${agentId} resumed.`);\n } catch (err) { printError(`Failed to resume agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsDeleteCommand(agentId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n await client.deleteAgent(agentId);\n printSuccess(`Agent ${agentId} deleted.`);\n } catch (err) { printError(`Failed to delete agent: ${err}`); process.exit(1); }\n}\n\nexport async function agentsMessageCommand(agentId: string, opts: { body: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.sendAgentMessage(agentId, opts.body);\n printSuccess(`Message sent. Execution: ${result.execution_id ?? \"OK\"}`);\n } catch (err) { printError(`Failed to send message: ${err}`); process.exit(1); }\n}\n\nexport async function agentsExecutionsCommand(agentId: string, _opts: { json?: boolean }): Promise<void> {\n // No list-executions endpoint exists yet; individual executions can be\n // queried via GET /v1/agents/{agent_id}/executions/{execution_id}.\n printError(\n `Listing executions is not yet supported.\\n` +\n ` To inspect a specific run, use the execution ID returned by \"agents message\":\\n` +\n ` GET /v1/agents/${agentId}/executions/<execution-id>`,\n );\n process.exit(1);\n}\n\nexport async function agentsSkillCommand(agentId: string, opts: {\n name: string; description: string; instructions?: string;\n}): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await client.addAgentSkill(agentId, {\n name: opts.name, description: opts.description, parameters: opts.instructions ? { instructions: opts.instructions } : {},\n });\n printSuccess(`Skill '${opts.name}' added to agent ${agentId}.`);\n printJson(result);\n } catch (err) { printError(`Failed to add skill: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printBillingPanel, printError, printSuccess, printJson } from \"../output.js\";\nimport { execSync } from \"node:child_process\";\n\nfunction makeClient() {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n return new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n}\n\nfunction openUrl(url: string) {\n try {\n const cmd = process.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"start\" : \"xdg-open\";\n execSync(`${cmd} ${JSON.stringify(url)}`, { stdio: \"ignore\" });\n } catch { /* browser open is best-effort */ }\n}\n\nexport async function billingCommand(opts: { json?: boolean }): Promise<void> {\n const client = makeClient();\n try {\n const [status, plans] = await Promise.all([client.getBillingStatus(), client.getBillingPlans()]);\n if (opts.json) printJson({ status, plans });\n else printBillingPanel(status, plans);\n } catch (err) { printError(`Failed to fetch billing info: ${err}`); process.exit(1); }\n}\n\nexport async function billingPortalCommand(): Promise<void> {\n const client = makeClient();\n try {\n const result = await client.createBillingPortal();\n const url = result.portal_url as string;\n if (!url) { printError(\"No portal URL returned. Ensure you have an active subscription.\"); process.exit(1); }\n console.log(`Opening Stripe Customer Portal...\\n${url}`);\n openUrl(url);\n printSuccess(\"Portal opened in your browser.\");\n } catch (err) { printError(`Failed to create portal session: ${err}`); process.exit(1); }\n}\n\nexport async function billingUpgradeCommand(opts: { plan: string }): Promise<void> {\n const client = makeClient();\n try {\n const result = await client.createBillingCheckout(opts.plan);\n const url = result.checkout_url as string;\n if (!url) { printError(\"No checkout URL returned.\"); process.exit(1); }\n console.log(`Opening Stripe Checkout for ${opts.plan}...\\n${url}`);\n openUrl(url);\n printSuccess(\"Checkout opened in your browser.\");\n } catch (err) { printError(`Failed to create checkout session: ${err}`); process.exit(1); }\n}\n","import { input, select, confirm, number } from \"@inquirer/prompts\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\nimport { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess } from \"../output.js\";\nimport type { ApiRecord } from \"../types.js\";\n\n// ── Types ──────────────────────────────────────────────────────\n\ninterface FounderInfo {\n name: string;\n email: string;\n role: string;\n address?: { street: string; city: string; state: string; zip: string };\n officer_title?: string;\n is_incorporator?: boolean;\n shares_purchased?: number;\n ownership_pct?: number;\n vesting?: { total_months: number; cliff_months: number; acceleration?: string };\n ip_description?: string;\n}\n\ninterface FormOptions {\n type?: string;\n name?: string;\n jurisdiction?: string;\n member?: string[];\n fiscalYearEnd?: string;\n sCorp?: boolean;\n transferRestrictions?: boolean;\n rofr?: boolean;\n address?: string;\n}\n\n// ── Helpers ────────────────────────────────────────────────────\n\nfunction isCorp(entityType: string): boolean {\n return entityType === \"c_corp\" || entityType === \"s_corp\" || entityType === \"corporation\";\n}\n\nfunction sectionHeader(title: string): void {\n console.log();\n console.log(chalk.blue(\"─\".repeat(50)));\n console.log(chalk.blue.bold(` ${title}`));\n console.log(chalk.blue(\"─\".repeat(50)));\n}\n\nasync function promptAddress(): Promise<{ street: string; city: string; state: string; zip: string }> {\n const street = await input({ message: \" Street address\" });\n const city = await input({ message: \" City\" });\n const state = await input({ message: \" State (2-letter)\", default: \"DE\" });\n const zip = await input({ message: \" ZIP code\" });\n return { street, city, state, zip };\n}\n\n// ── Phase 1: Entity Details ────────────────────────────────────\n\nasync function phaseEntityDetails(opts: FormOptions, serverCfg: ApiRecord, scripted: boolean) {\n if (!scripted) sectionHeader(\"Phase 1: Entity Details\");\n\n let entityType = opts.type;\n if (!entityType) {\n if (scripted) { entityType = \"llc\"; }\n else {\n entityType = await select({\n message: \"Entity type\",\n choices: [\n { value: \"llc\", name: \"LLC\" },\n { value: \"c_corp\", name: \"C-Corp\" },\n ],\n });\n }\n }\n\n let name = opts.name;\n if (!name) {\n if (scripted) { printError(\"--name is required in scripted mode\"); process.exit(1); }\n name = await input({ message: \"Legal name\" });\n }\n\n let jurisdiction = opts.jurisdiction;\n if (!jurisdiction) {\n const defaultJ = entityType === \"llc\" ? \"US-WY\" : \"US-DE\";\n if (scripted) { jurisdiction = defaultJ; }\n else { jurisdiction = await input({ message: \"Jurisdiction\", default: defaultJ }); }\n }\n\n let companyAddress: { street: string; city: string; state: string; zip: string } | undefined;\n if (opts.address) {\n const parts = opts.address.split(\",\").map((p) => p.trim());\n if (parts.length === 4) {\n companyAddress = { street: parts[0], city: parts[1], state: parts[2], zip: parts[3] };\n }\n }\n if (!companyAddress && !scripted) {\n const wantAddress = await confirm({ message: \"Add company address?\", default: false });\n if (wantAddress) {\n companyAddress = await promptAddress();\n }\n }\n\n const fiscalYearEnd = opts.fiscalYearEnd ?? \"12-31\";\n\n let sCorpElection = opts.sCorp ?? false;\n if (!scripted && isCorp(entityType) && opts.sCorp === undefined) {\n sCorpElection = await confirm({ message: \"S-Corp election?\", default: false });\n }\n\n return { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection };\n}\n\n// ── Phase 2: People ────────────────────────────────────────────\n\nasync function phasePeople(\n opts: FormOptions,\n entityType: string,\n scripted: boolean,\n): Promise<FounderInfo[]> {\n if (!scripted) sectionHeader(\"Phase 2: Founders & Officers\");\n\n const founders: FounderInfo[] = [];\n\n // CLI-provided members (scripted mode)\n if (scripted) {\n for (const m of opts.member!) {\n const parts = m.split(\",\").map((p) => p.trim());\n if (parts.length < 3) {\n printError(`Invalid member format: ${m}. Expected: name,email,role[,pct]`);\n process.exit(1);\n }\n const f: FounderInfo = { name: parts[0], email: parts[1], role: parts[2] };\n if (parts.length >= 4) f.ownership_pct = parseFloat(parts[3]);\n founders.push(f);\n }\n return founders;\n }\n\n // Interactive mode\n const founderCount = (await number({ message: \"Number of founders (1-6)\", default: 1 })) ?? 1;\n\n for (let i = 0; i < founderCount; i++) {\n console.log(chalk.dim(`\\n Founder ${i + 1} of ${founderCount}:`));\n const name = await input({ message: ` Name` });\n const email = await input({ message: ` Email` });\n\n let role = \"member\";\n if (isCorp(entityType)) {\n role = await select({\n message: \" Role\",\n choices: [\n { value: \"director\", name: \"Director\" },\n { value: \"officer\", name: \"Officer\" },\n { value: \"member\", name: \"Shareholder only\" },\n ],\n });\n }\n\n const wantAddress = await confirm({ message: \" Add address?\", default: false });\n const address = wantAddress ? await promptAddress() : undefined;\n\n let officerTitle: string | undefined;\n if (isCorp(entityType)) {\n const wantOfficer = role === \"officer\" || await confirm({ message: \" Assign officer title?\", default: i === 0 });\n if (wantOfficer) {\n officerTitle = await select({\n message: \" Officer title\",\n choices: [\n { value: \"ceo\", name: \"CEO\" },\n { value: \"cfo\", name: \"CFO\" },\n { value: \"secretary\", name: \"Secretary\" },\n { value: \"president\", name: \"President\" },\n { value: \"vp\", name: \"VP\" },\n ],\n });\n }\n }\n\n let isIncorporator = false;\n if (isCorp(entityType) && i === 0 && founderCount === 1) {\n isIncorporator = true;\n } else if (isCorp(entityType)) {\n isIncorporator = await confirm({ message: \" Designate as sole incorporator?\", default: i === 0 });\n }\n\n founders.push({ name, email, role, address, officer_title: officerTitle, is_incorporator: isIncorporator });\n }\n\n return founders;\n}\n\n// ── Phase 3: Stock & Finalize ──────────────────────────────────\n\nasync function phaseStock(\n opts: FormOptions,\n entityType: string,\n founders: FounderInfo[],\n scripted: boolean,\n): Promise<{ founders: FounderInfo[]; transferRestrictions: boolean; rofr: boolean }> {\n if (!scripted) sectionHeader(\"Phase 3: Equity & Finalize\");\n\n const transferRestrictions = opts.transferRestrictions ?? (\n !scripted && isCorp(entityType)\n ? await confirm({ message: \"Transfer restrictions on shares?\", default: true })\n : isCorp(entityType)\n );\n\n const rofr = opts.rofr ?? (\n !scripted && isCorp(entityType)\n ? await confirm({ message: \"Right of first refusal?\", default: true })\n : isCorp(entityType)\n );\n\n if (!scripted) {\n for (const f of founders) {\n console.log(chalk.dim(`\\n Equity for ${f.name}:`));\n\n if (isCorp(entityType)) {\n const shares = await number({ message: ` Shares to purchase`, default: 0 });\n f.shares_purchased = shares ?? 0;\n if (f.shares_purchased === 0) {\n const pct = await number({ message: ` Ownership % (1-100)`, default: founders.length === 1 ? 100 : 0 });\n f.ownership_pct = pct ?? 0;\n }\n } else {\n const pct = await number({\n message: ` Ownership % (1-100)`,\n default: founders.length === 1 ? 100 : 0,\n });\n f.ownership_pct = pct ?? 0;\n }\n\n if (isCorp(entityType)) {\n const wantVesting = await confirm({ message: \" Add vesting schedule?\", default: false });\n if (wantVesting) {\n const totalMonths = (await number({ message: \" Total vesting months\", default: 48 })) ?? 48;\n const cliffMonths = (await number({ message: \" Cliff months\", default: 12 })) ?? 12;\n const acceleration = await select({\n message: \" Acceleration\",\n choices: [\n { value: \"none\", name: \"None\" },\n { value: \"single_trigger\", name: \"Single trigger\" },\n { value: \"double_trigger\", name: \"Double trigger\" },\n ],\n });\n f.vesting = {\n total_months: totalMonths,\n cliff_months: cliffMonths,\n acceleration: acceleration === \"none\" ? undefined : acceleration,\n };\n }\n }\n\n const wantIp = await confirm({ message: \" Contributing IP?\", default: false });\n if (wantIp) {\n f.ip_description = await input({ message: \" Describe IP being contributed\" });\n }\n }\n }\n\n return { founders, transferRestrictions, rofr };\n}\n\n// ── Summary Table ──────────────────────────────────────────────\n\nfunction printSummary(\n entityType: string,\n name: string,\n jurisdiction: string,\n fiscalYearEnd: string,\n sCorpElection: boolean,\n founders: FounderInfo[],\n transferRestrictions: boolean,\n rofr: boolean,\n): void {\n sectionHeader(\"Formation Summary\");\n\n console.log(` ${chalk.bold(\"Entity:\")} ${name}`);\n console.log(` ${chalk.bold(\"Type:\")} ${entityType}`);\n console.log(` ${chalk.bold(\"Jurisdiction:\")} ${jurisdiction}`);\n console.log(` ${chalk.bold(\"Fiscal Year End:\")} ${fiscalYearEnd}`);\n if (isCorp(entityType)) {\n console.log(` ${chalk.bold(\"S-Corp Election:\")} ${sCorpElection ? \"Yes\" : \"No\"}`);\n console.log(` ${chalk.bold(\"Transfer Restrictions:\")} ${transferRestrictions ? \"Yes\" : \"No\"}`);\n console.log(` ${chalk.bold(\"Right of First Refusal:\")} ${rofr ? \"Yes\" : \"No\"}`);\n }\n\n const table = new Table({\n head: [chalk.dim(\"Name\"), chalk.dim(\"Email\"), chalk.dim(\"Role\"), chalk.dim(\"Equity\"), chalk.dim(\"Officer\")],\n });\n for (const f of founders) {\n const equity = f.shares_purchased\n ? `${f.shares_purchased.toLocaleString()} shares`\n : f.ownership_pct\n ? `${f.ownership_pct}%`\n : \"—\";\n table.push([f.name, f.email, f.role, equity, f.officer_title ?? \"—\"]);\n }\n console.log(table.toString());\n}\n\n// ── Main Command ───────────────────────────────────────────────\n\nexport async function formCommand(opts: FormOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n let serverCfg: ApiRecord = {};\n try { serverCfg = await client.getConfig(); } catch { /* ignore */ }\n\n const scripted = !!(opts.member && opts.member.length > 0);\n\n // Phase 1: Entity Details\n const { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection } =\n await phaseEntityDetails(opts, serverCfg, scripted);\n\n // Phase 2: People\n const founders = await phasePeople(opts, entityType, scripted);\n\n // Phase 3: Stock & Finalize\n const { transferRestrictions, rofr } = await phaseStock(opts, entityType, founders, scripted);\n\n // Summary & Confirm\n printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);\n\n const shouldProceed = scripted\n ? true\n : await confirm({ message: \"Proceed with formation?\", default: true });\n\n if (!shouldProceed) {\n console.log(chalk.yellow(\"Formation cancelled.\"));\n return;\n }\n\n // Build members payload\n const members: ApiRecord[] = founders.map((f) => {\n const m: ApiRecord = {\n name: f.name,\n email: f.email,\n role: f.role,\n investor_type: \"natural_person\",\n };\n if (f.ownership_pct) m.ownership_pct = f.ownership_pct;\n if (f.shares_purchased) m.shares_purchased = f.shares_purchased;\n if (f.address) m.address = f.address;\n if (f.officer_title) m.officer_title = f.officer_title;\n if (f.is_incorporator) m.is_incorporator = true;\n if (f.vesting) m.vesting = f.vesting;\n if (f.ip_description) m.ip_description = f.ip_description;\n return m;\n });\n\n const payload: ApiRecord = {\n entity_type: entityType,\n legal_name: name,\n jurisdiction,\n members,\n workspace_id: cfg.workspace_id,\n fiscal_year_end: fiscalYearEnd,\n s_corp_election: sCorpElection,\n transfer_restrictions: transferRestrictions,\n right_of_first_refusal: rofr,\n };\n if (companyAddress) payload.company_address = companyAddress;\n\n const result = await client.createFormationWithCapTable(payload);\n\n // Output results\n printSuccess(`Formation created: ${result.formation_id ?? result.id ?? \"OK\"}`);\n if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);\n if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);\n if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);\n\n const docIds = (result.document_ids ?? []) as string[];\n if (docIds.length > 0) {\n console.log(` Documents: ${docIds.length} generated`);\n }\n\n const holders = (result.holders ?? []) as ApiRecord[];\n if (holders.length > 0) {\n console.log();\n const table = new Table({\n head: [chalk.dim(\"Holder\"), chalk.dim(\"Shares\"), chalk.dim(\"Ownership %\")],\n });\n for (const h of holders) {\n const pct = typeof h.ownership_pct === \"number\" ? `${h.ownership_pct.toFixed(1)}%` : \"—\";\n table.push([String(h.name ?? \"?\"), String(h.shares ?? 0), pct]);\n }\n console.log(chalk.bold(\" Cap Table:\"));\n console.log(table.toString());\n }\n\n if (result.next_action) {\n console.log(chalk.yellow(`\\n Next: ${result.next_action}`));\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes(\"exit\")) throw err;\n printError(`Failed to create formation: ${err}`);\n process.exit(1);\n }\n}\n\n// ── Staged Formation Subcommands ─────────────────────────────\n\ninterface FormCreateOptions {\n type: string;\n name: string;\n jurisdiction?: string;\n}\n\nexport async function formCreateCommand(opts: FormCreateOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const entityType = opts.type === \"corporation\" ? \"c_corp\" : opts.type;\n const payload: ApiRecord = {\n entity_type: entityType,\n legal_name: opts.name,\n };\n if (opts.jurisdiction) payload.jurisdiction = opts.jurisdiction;\n\n const result = await client.createPendingEntity(payload);\n printSuccess(`Pending entity created: ${result.entity_id}`);\n console.log(` Name: ${result.legal_name}`);\n console.log(` Type: ${result.entity_type}`);\n console.log(` Jurisdiction: ${result.jurisdiction}`);\n console.log(` Status: ${result.formation_status}`);\n console.log(chalk.yellow(`\\n Next: corp form add-founder ${result.entity_id} --name \"...\" --email \"...\" --role member --pct 50`));\n } catch (err) {\n printError(`Failed to create pending entity: ${err}`);\n process.exit(1);\n }\n}\n\ninterface FormAddFounderOptions {\n name: string;\n email: string;\n role: string;\n pct: string;\n officerTitle?: string;\n incorporator?: boolean;\n}\n\nexport async function formAddFounderCommand(entityId: string, opts: FormAddFounderOptions): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const payload: ApiRecord = {\n name: opts.name,\n email: opts.email,\n role: opts.role,\n ownership_pct: parseFloat(opts.pct),\n };\n if (opts.officerTitle) payload.officer_title = opts.officerTitle;\n if (opts.incorporator) payload.is_incorporator = true;\n\n const result = await client.addFounder(entityId, payload);\n printSuccess(`Founder added (${result.member_count} total)`);\n const members = (result.members ?? []) as ApiRecord[];\n for (const m of members) {\n const pct = typeof m.ownership_pct === \"number\" ? ` (${m.ownership_pct}%)` : \"\";\n console.log(` - ${m.name} <${m.email ?? \"no email\"}> [${m.role ?? \"member\"}]${pct}`);\n }\n console.log(chalk.yellow(`\\n Next: add more founders or run: corp form finalize ${entityId}`));\n } catch (err) {\n printError(`Failed to add founder: ${err}`);\n process.exit(1);\n }\n}\n\nexport async function formFinalizeCommand(entityId: string): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n\n try {\n const result = await client.finalizeFormation(entityId);\n printSuccess(`Formation finalized: ${result.entity_id}`);\n if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);\n if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);\n\n const docIds = (result.document_ids ?? []) as string[];\n if (docIds.length > 0) {\n console.log(` Documents: ${docIds.length} generated`);\n }\n\n const holders = (result.holders ?? []) as ApiRecord[];\n if (holders.length > 0) {\n console.log();\n const table = new Table({\n head: [chalk.dim(\"Holder\"), chalk.dim(\"Shares\"), chalk.dim(\"Ownership %\")],\n });\n for (const h of holders) {\n const pct = typeof h.ownership_pct === \"number\" ? `${h.ownership_pct.toFixed(1)}%` : \"—\";\n table.push([String(h.name ?? \"?\"), String(h.shares ?? 0), pct]);\n }\n console.log(chalk.bold(\" Cap Table:\"));\n console.log(table.toString());\n }\n\n if (result.next_action) {\n console.log(chalk.yellow(`\\n Next: ${result.next_action}`));\n }\n } catch (err) {\n printError(`Failed to finalize formation: ${err}`);\n process.exit(1);\n }\n}\n","import { requireConfig, maskKey } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printJson } from \"../output.js\";\nimport chalk from \"chalk\";\nimport Table from \"cli-table3\";\n\nexport async function apiKeysCommand(opts: { json?: boolean }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const keys = await client.listApiKeys();\n if (opts.json) { printJson(keys); return; }\n if (keys.length === 0) { console.log(\"No API keys found.\"); return; }\n console.log(`\\n${chalk.bold(\"API Keys\")}`);\n const table = new Table({\n head: [chalk.dim(\"ID\"), chalk.dim(\"Name\"), chalk.dim(\"Key\"), chalk.dim(\"Created\"), chalk.dim(\"Last Used\")],\n });\n for (const k of keys) {\n table.push([\n String(k.id ?? k.api_key_id ?? \"\").slice(0, 12),\n String(k.name ?? \"\"),\n maskKey(String(k.key ?? k.api_key ?? \"\")),\n String(k.created_at ?? \"\"),\n String(k.last_used_at ?? \"\"),\n ]);\n }\n console.log(table.toString());\n } catch (err) { printError(`Failed to fetch API keys: ${err}`); process.exit(1); }\n}\n","import { requireConfig } from \"../config.js\";\nimport { CorpAPIClient } from \"../api-client.js\";\nimport { printError, printSuccess, printJson } from \"../output.js\";\nimport { withSpinner } from \"../spinner.js\";\n\nexport async function demoCommand(opts: { name: string }): Promise<void> {\n const cfg = requireConfig(\"api_url\", \"api_key\", \"workspace_id\");\n const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);\n try {\n const result = await withSpinner(\"Loading\", () => client.seedDemo(opts.name));\n printSuccess(`Demo seeded: ${result.entity_id ?? \"OK\"}`);\n printJson(result);\n } catch (err) { printError(`Failed to seed demo: ${err}`); process.exit(1); }\n}\n","import { readFileSync, writeFileSync, existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { randomBytes } from \"node:crypto\";\nimport type { ChildProcess } from \"node:child_process\";\n\ninterface ServeOptions {\n port: string;\n dataDir: string;\n}\n\nconst ENV_TEMPLATE = `# Corporation API server configuration\n# Generated by: corp serve\n\n# Required — secret for signing JWTs\nJWT_SECRET={{JWT_SECRET}}\n\n# Required — Fernet key for encrypting secrets at rest (base64url, 32 bytes)\nSECRETS_MASTER_KEY={{SECRETS_MASTER_KEY}}\n\n# Required — bearer token for internal worker-to-server auth\nINTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}\n\n# Server port (default: 8000)\n# PORT=8000\n\n# Data directory for git repos (default: ./data/repos)\n# DATA_DIR=./data/repos\n\n# Redis URL for agent job queue (optional)\n# REDIS_URL=redis://localhost:6379/0\n\n# LLM proxy upstream (default: https://openrouter.ai/api/v1)\n# LLM_UPSTREAM_URL=https://openrouter.ai/api/v1\n\n# PEM-encoded Ed25519 key for signing git commits (optional)\n# COMMIT_SIGNING_KEY=\n\n# Max agent queue depth (default: 1000)\n# MAX_QUEUE_DEPTH=1000\n`;\n\nfunction generateFernetKey(): string {\n // Fernet key = url-safe base64 of 32 random bytes\n return randomBytes(32).toString(\"base64url\") + \"=\";\n}\n\nfunction generateSecret(length = 32): string {\n return randomBytes(length).toString(\"hex\");\n}\n\nfunction loadEnvFile(path: string): void {\n if (!existsSync(path)) return;\n\n const content = readFileSync(path, \"utf-8\");\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n\n const eqIdx = trimmed.indexOf(\"=\");\n if (eqIdx === -1) continue;\n\n const key = trimmed.slice(0, eqIdx).trim();\n const value = trimmed.slice(eqIdx + 1).trim().replace(/^[\"']|[\"']$/g, \"\");\n\n // Don't override vars already set in the environment\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n}\n\nfunction ensureEnvFile(envPath: string): void {\n if (existsSync(envPath)) return;\n\n console.log(\"No .env file found. Generating one with dev defaults...\\n\");\n\n const content = ENV_TEMPLATE\n .replace(\"{{JWT_SECRET}}\", generateSecret())\n .replace(\"{{SECRETS_MASTER_KEY}}\", generateFernetKey())\n .replace(\"{{INTERNAL_WORKER_TOKEN}}\", generateSecret());\n\n writeFileSync(envPath, content, \"utf-8\");\n console.log(` Created ${envPath}\\n`);\n}\n\nexport async function serveCommand(opts: ServeOptions): Promise<void> {\n let server: { getBinaryPath: () => string | null; isAvailable: () => boolean; startServer: (options: Record<string, unknown>) => ChildProcess };\n try {\n server = await import(\"@thecorporation/server\");\n } catch {\n console.error(\n \"Error: @thecorporation/server is not installed.\\n\\n\" +\n \"Install it with:\\n\" +\n \" npm install @thecorporation/server\\n\\n\" +\n \"Or run the Rust binary directly:\\n\" +\n \" cd services/api-rs && cargo run\"\n );\n process.exit(1);\n }\n\n if (!server.isAvailable()) {\n console.error(\n \"Error: No server binary available for this platform.\\n\\n\" +\n \"Pre-built binaries are available for:\\n\" +\n \" - linux-x64, linux-arm64\\n\" +\n \" - darwin-x64, darwin-arm64\\n\" +\n \" - win32-x64\\n\\n\" +\n \"You can build from source:\\n\" +\n \" cd services/api-rs && cargo build --release\"\n );\n process.exit(1);\n }\n\n const port = parseInt(opts.port, 10);\n if (isNaN(port) || port > 65535) {\n console.error(`Error: Invalid port \"${opts.port}\"`);\n process.exit(1);\n }\n\n // Load .env file, generating one if it doesn't exist\n const envPath = resolve(process.cwd(), \".env\");\n ensureEnvFile(envPath);\n loadEnvFile(envPath);\n\n // Auto-configure CLI to point at the local server\n const localUrl = `http://localhost:${port}`;\n const { loadConfig, saveConfig } = await import(\"../config.js\");\n const cfg = loadConfig();\n const previousUrl = cfg.api_url;\n if (cfg.api_url !== localUrl) {\n cfg.api_url = localUrl;\n saveConfig(cfg);\n console.log(`CLI configured to use local server: ${localUrl}`);\n console.log(` (previous: ${previousUrl})`);\n console.log(` To revert: corp config set api_url ${previousUrl}\\n`);\n }\n\n console.log(`Starting server on port ${port}...`);\n console.log(`Data directory: ${opts.dataDir}`);\n\n const child = server.startServer({\n port,\n dataDir: opts.dataDir,\n });\n\n const shutdown = () => {\n console.log(\"\\nShutting down server...\");\n // Restore previous API URL\n if (previousUrl !== localUrl) {\n const current = loadConfig();\n current.api_url = previousUrl;\n saveConfig(current);\n console.log(`CLI restored to: ${previousUrl}`);\n }\n child.kill(\"SIGTERM\");\n };\n\n process.on(\"SIGINT\", shutdown);\n process.on(\"SIGTERM\", shutdown);\n\n child.on(\"exit\", (code) => {\n process.exit(code ?? 0);\n });\n}\n","import { Command } from \"commander\";\nimport { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\");\n\nconst program = new Command();\nprogram\n .name(\"corp\")\n .description(\"corp — Corporate governance from the terminal\")\n .version(pkg.version);\n\n// --- setup ---\nprogram\n .command(\"setup\")\n .description(\"Interactive setup wizard\")\n .action(async () => {\n const { setupCommand } = await import(\"./commands/setup.js\");\n await setupCommand();\n });\n\n// --- status ---\nprogram\n .command(\"status\")\n .description(\"Workspace summary\")\n .action(async () => {\n const { statusCommand } = await import(\"./commands/status.js\");\n await statusCommand();\n });\n\n// --- config ---\nconst configCmd = program.command(\"config\").description(\"Manage configuration\");\nconfigCmd\n .command(\"set <key> <value>\")\n .description(\"Set a config value (dot-path)\")\n .action(async (key: string, value: string) => {\n const { configSetCommand } = await import(\"./commands/config.js\");\n configSetCommand(key, value);\n });\nconfigCmd\n .command(\"get <key>\")\n .description(\"Get a config value (dot-path)\")\n .action(async (key: string) => {\n const { configGetCommand } = await import(\"./commands/config.js\");\n configGetCommand(key);\n });\nconfigCmd\n .command(\"list\")\n .description(\"List all config (API keys masked)\")\n .action(async () => {\n const { configListCommand } = await import(\"./commands/config.js\");\n configListCommand();\n });\n\n// --- obligations ---\nprogram\n .command(\"obligations\")\n .description(\"List obligations with urgency tiers\")\n .option(\"--tier <tier>\", \"Filter by urgency tier\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { obligationsCommand } = await import(\"./commands/obligations.js\");\n await obligationsCommand(opts);\n });\n\n// --- digest ---\nprogram\n .command(\"digest\")\n .description(\"View or trigger daily digests\")\n .option(\"--trigger\", \"Trigger digest now\")\n .option(\"--key <key>\", \"Get specific digest by key\")\n .action(async (opts) => {\n const { digestCommand } = await import(\"./commands/digest.js\");\n await digestCommand(opts);\n });\n\n// --- link ---\nprogram\n .command(\"link\")\n .description(\"Generate a claim code to pair another device\")\n .action(async () => {\n const { linkCommand } = await import(\"./commands/link.js\");\n await linkCommand();\n });\n\n// --- claim ---\nprogram\n .command(\"claim <code>\")\n .description(\"Redeem a claim code to join a workspace\")\n .action(async (code: string) => {\n const { claimCommand } = await import(\"./commands/claim.js\");\n await claimCommand(code);\n });\n\n// --- chat ---\nprogram\n .command(\"chat\")\n .description(\"Interactive LLM chat session\")\n .action(async () => {\n const { chatCommand } = await import(\"./chat.js\");\n await chatCommand();\n });\n\n// --- entities ---\nconst entitiesCmd = program\n .command(\"entities\")\n .description(\"List entities, show detail, convert, or dissolve\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { entitiesCommand } = await import(\"./commands/entities.js\");\n await entitiesCommand(opts);\n });\nentitiesCmd\n .command(\"show <entity-id>\")\n .option(\"--json\", \"Output as JSON\")\n .description(\"Show entity detail\")\n .action(async (entityId: string, opts) => {\n const { entitiesShowCommand } = await import(\"./commands/entities.js\");\n await entitiesShowCommand(entityId, opts);\n });\nentitiesCmd\n .command(\"convert <entity-id>\")\n .requiredOption(\"--to <type>\", \"Target entity type (llc, c_corp)\")\n .option(\"--jurisdiction <jurisdiction>\", \"New jurisdiction\")\n .description(\"Convert entity to a different type\")\n .action(async (entityId: string, opts) => {\n const { entitiesConvertCommand } = await import(\"./commands/entities.js\");\n await entitiesConvertCommand(entityId, opts);\n });\nentitiesCmd\n .command(\"dissolve <entity-id>\")\n .requiredOption(\"--reason <reason>\", \"Dissolution reason\")\n .option(\"--effective-date <date>\", \"Effective date (ISO 8601)\")\n .description(\"Dissolve an entity\")\n .action(async (entityId: string, opts) => {\n const { entitiesDissolveCommand } = await import(\"./commands/entities.js\");\n await entitiesDissolveCommand(entityId, opts);\n });\n\n// --- contacts ---\nconst contactsCmd = program\n .command(\"contacts\")\n .description(\"Contact management\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { contactsListCommand } = await import(\"./commands/contacts.js\");\n await contactsListCommand(opts);\n });\ncontactsCmd\n .command(\"show <contact-id>\")\n .option(\"--json\", \"Output as JSON\")\n .description(\"Show contact detail/profile\")\n .action(async (contactId: string, opts) => {\n const { contactsShowCommand } = await import(\"./commands/contacts.js\");\n await contactsShowCommand(contactId, opts);\n });\ncontactsCmd\n .command(\"add\")\n .requiredOption(\"--name <name>\", \"Contact name\")\n .requiredOption(\"--email <email>\", \"Contact email\")\n .option(\"--type <type>\", \"Contact type (individual, organization)\", \"individual\")\n .option(\"--category <category>\", \"Category (employee, contractor, board_member, investor, law_firm, valuation_firm, accounting_firm, officer, advisor)\")\n .option(\"--phone <phone>\", \"Phone number\")\n .option(\"--notes <notes>\", \"Notes\")\n .description(\"Add a new contact\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { contactsAddCommand } = await import(\"./commands/contacts.js\");\n await contactsAddCommand({ ...opts, entityId: parent.entityId });\n });\ncontactsCmd\n .command(\"edit <contact-id>\")\n .option(\"--name <name>\", \"Contact name\")\n .option(\"--email <email>\", \"Contact email\")\n .option(\"--category <category>\", \"Contact category\")\n .option(\"--phone <phone>\", \"Phone number\")\n .option(\"--notes <notes>\", \"Notes\")\n .description(\"Edit an existing contact\")\n .action(async (contactId: string, opts) => {\n const { contactsEditCommand } = await import(\"./commands/contacts.js\");\n await contactsEditCommand(contactId, opts);\n });\n\n// --- cap-table ---\nconst capTableCmd = program\n .command(\"cap-table\")\n .description(\"Cap table, equity grants, SAFEs, transfers, and valuations\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { capTableCommand } = await import(\"./commands/cap-table.js\");\n await capTableCommand(opts);\n });\ncapTableCmd.command(\"safes\").description(\"SAFE notes\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { safesCommand } = await import(\"./commands/cap-table.js\");\n await safesCommand(parent);\n});\ncapTableCmd.command(\"transfers\").description(\"Share transfers\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { transfersCommand } = await import(\"./commands/cap-table.js\");\n await transfersCommand(parent);\n});\ncapTableCmd.command(\"valuations\").description(\"Valuations history\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { valuationsCommand } = await import(\"./commands/cap-table.js\");\n await valuationsCommand(parent);\n});\ncapTableCmd.command(\"409a\").description(\"Current 409A valuation\").action(async (_opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { fourOhNineACommand } = await import(\"./commands/cap-table.js\");\n await fourOhNineACommand(parent);\n});\ncapTableCmd\n .command(\"issue-equity\")\n .requiredOption(\"--grant-type <type>\", \"Grant type (e.g. founder, advisor, employee, investor)\")\n .requiredOption(\"--shares <n>\", \"Number of shares\", parseInt)\n .requiredOption(\"--recipient <name>\", \"Recipient name\")\n .option(\"--email <email>\", \"Recipient email (auto-creates contact if needed)\")\n .option(\"--instrument-id <id>\", \"Instrument ID (auto-detected from cap table if omitted)\")\n .description(\"Issue an equity grant (creates a round, adds security, and issues it)\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueEquityCommand } = await import(\"./commands/cap-table.js\");\n await issueEquityCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"issue-safe\")\n .requiredOption(\"--investor <name>\", \"Investor name\")\n .requiredOption(\"--amount <n>\", \"Principal amount in cents\", parseInt)\n .option(\"--safe-type <type>\", \"SAFE type\", \"post_money\")\n .requiredOption(\"--valuation-cap <n>\", \"Valuation cap in cents\", parseInt)\n .description(\"Issue a SAFE note\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueSafeCommand } = await import(\"./commands/cap-table.js\");\n await issueSafeCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"transfer\")\n .requiredOption(\"--from-grant <id>\", \"Source grant ID\")\n .requiredOption(\"--to <name>\", \"Recipient name\")\n .requiredOption(\"--shares <n>\", \"Number of shares\", parseInt)\n .option(\"--type <type>\", \"Transfer type\", \"sale\")\n .description(\"Transfer shares\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { transferSharesCommand } = await import(\"./commands/cap-table.js\");\n await transferSharesCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"distribute\")\n .requiredOption(\"--amount <n>\", \"Total distribution amount in cents\", parseInt)\n .option(\"--type <type>\", \"Distribution type (dividend, return, liquidation)\", \"dividend\")\n .requiredOption(\"--description <desc>\", \"Distribution description\")\n .description(\"Calculate a distribution\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { distributeCommand } = await import(\"./commands/cap-table.js\");\n await distributeCommand({ ...opts, entityId: parent.entityId });\n });\n\ncapTableCmd\n .command(\"start-round\")\n .requiredOption(\"--name <name>\", \"Round name\")\n .requiredOption(\"--issuer-legal-entity-id <id>\", \"Issuer legal entity ID\")\n .description(\"Start a staged equity round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { startRoundCommand } = await import(\"./commands/cap-table.js\");\n await startRoundCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"add-security\")\n .requiredOption(\"--round-id <id>\", \"Round ID\")\n .requiredOption(\"--instrument-id <id>\", \"Instrument ID\")\n .requiredOption(\"--quantity <n>\", \"Number of shares/units\", parseInt)\n .requiredOption(\"--recipient-name <name>\", \"Recipient display name\")\n .option(\"--holder-id <id>\", \"Existing holder ID\")\n .option(\"--email <email>\", \"Recipient email (to find or create holder)\")\n .option(\"--principal-cents <n>\", \"Principal amount in cents\", parseInt)\n .option(\"--grant-type <type>\", \"Grant type\")\n .description(\"Add a security to a staged equity round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { addSecurityCommand } = await import(\"./commands/cap-table.js\");\n await addSecurityCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"issue-round\")\n .requiredOption(\"--round-id <id>\", \"Round ID\")\n .description(\"Issue all securities and close a staged round\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { issueRoundCommand } = await import(\"./commands/cap-table.js\");\n await issueRoundCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"create-valuation\")\n .requiredOption(\"--type <type>\", \"Valuation type (four_oh_nine_a, fair_market_value, etc.)\")\n .requiredOption(\"--date <date>\", \"Effective date (ISO 8601)\")\n .requiredOption(\"--methodology <method>\", \"Methodology (income, market, asset, backsolve, hybrid)\")\n .option(\"--fmv <cents>\", \"FMV per share in cents\", parseInt)\n .option(\"--enterprise-value <cents>\", \"Enterprise value in cents\", parseInt)\n .description(\"Create a valuation\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { createValuationCommand } = await import(\"./commands/cap-table.js\");\n await createValuationCommand({ ...opts, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"submit-valuation <valuation-id>\")\n .description(\"Submit a valuation for board approval\")\n .action(async (valuationId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { submitValuationCommand } = await import(\"./commands/cap-table.js\");\n await submitValuationCommand({ valuationId, entityId: parent.entityId });\n });\ncapTableCmd\n .command(\"approve-valuation <valuation-id>\")\n .option(\"--resolution-id <id>\", \"Resolution ID from the board vote\")\n .description(\"Approve a valuation\")\n .action(async (valuationId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { approveValuationCommand } = await import(\"./commands/cap-table.js\");\n await approveValuationCommand({ ...opts, valuationId, entityId: parent.entityId });\n });\n\n// --- finance ---\nconst financeCmd = program\n .command(\"finance\")\n .description(\"Invoicing, payroll, payments, banking\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\");\nfinanceCmd\n .command(\"invoice\")\n .requiredOption(\"--customer <name>\", \"Customer name\")\n .requiredOption(\"--amount <n>\", \"Amount in cents\", parseInt)\n .requiredOption(\"--due-date <date>\", \"Due date (ISO 8601)\")\n .option(\"--description <desc>\", \"Description\", \"Services rendered\")\n .description(\"Create an invoice\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeInvoiceCommand } = await import(\"./commands/finance.js\");\n await financeInvoiceCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"payroll\")\n .requiredOption(\"--period-start <date>\", \"Pay period start\")\n .requiredOption(\"--period-end <date>\", \"Pay period end\")\n .description(\"Run payroll\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financePayrollCommand } = await import(\"./commands/finance.js\");\n await financePayrollCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"pay\")\n .requiredOption(\"--amount <n>\", \"Amount in cents\", parseInt)\n .requiredOption(\"--recipient <name>\", \"Recipient name\")\n .option(\"--method <method>\", \"Payment method\", \"ach\")\n .description(\"Submit a payment\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financePayCommand } = await import(\"./commands/finance.js\");\n await financePayCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"open-account\")\n .option(\"--institution <name>\", \"Banking institution\", \"Mercury\")\n .description(\"Open a business bank account\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeOpenAccountCommand } = await import(\"./commands/finance.js\");\n await financeOpenAccountCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"classify-contractor\")\n .requiredOption(\"--name <name>\", \"Contractor name\")\n .requiredOption(\"--state <code>\", \"US state code\")\n .requiredOption(\"--hours <n>\", \"Hours per week\", parseInt)\n .option(\"--exclusive\", \"Exclusive client\", false)\n .requiredOption(\"--duration <n>\", \"Duration in months\", parseInt)\n .option(\"--provides-tools\", \"Company provides tools\", false)\n .description(\"Analyze contractor classification risk\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeClassifyContractorCommand } = await import(\"./commands/finance.js\");\n await financeClassifyContractorCommand({ ...opts, entityId: parent.entityId });\n });\nfinanceCmd\n .command(\"reconcile\")\n .requiredOption(\"--start-date <date>\", \"Period start\")\n .requiredOption(\"--end-date <date>\", \"Period end\")\n .description(\"Reconcile ledger\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { financeReconcileCommand } = await import(\"./commands/finance.js\");\n await financeReconcileCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- governance ---\nconst governanceCmd = program\n .command(\"governance\")\n .description(\"Governance bodies, seats, meetings, resolutions\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { governanceListCommand } = await import(\"./commands/governance.js\");\n await governanceListCommand(opts);\n });\ngovernanceCmd\n .command(\"create-body\")\n .requiredOption(\"--name <name>\", \"Body name (e.g. 'Board of Directors')\")\n .requiredOption(\"--body-type <type>\", \"Body type (board_of_directors, llc_member_vote)\")\n .option(\"--quorum <rule>\", \"Quorum rule (majority, supermajority, unanimous)\", \"majority\")\n .option(\"--voting <method>\", \"Voting method (per_capita, per_unit)\", \"per_capita\")\n .description(\"Create a governance body\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceCreateBodyCommand } = await import(\"./commands/governance.js\");\n await governanceCreateBodyCommand({ ...opts, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"add-seat <body-id>\")\n .requiredOption(\"--holder <contact-id>\", \"Contact ID for the seat holder\")\n .option(\"--title <title>\", \"Seat title (e.g. 'Director', 'Member')\")\n .description(\"Add a seat to a governance body\")\n .action(async (bodyId: string, opts) => {\n const { governanceAddSeatCommand } = await import(\"./commands/governance.js\");\n await governanceAddSeatCommand(bodyId, opts);\n });\ngovernanceCmd\n .command(\"seats <body-id>\")\n .description(\"Seats for a governance body\")\n .action(async (bodyId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceSeatsCommand } = await import(\"./commands/governance.js\");\n await governanceSeatsCommand(bodyId, parent);\n });\ngovernanceCmd\n .command(\"meetings <body-id>\")\n .description(\"Meetings for a governance body\")\n .action(async (bodyId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceMeetingsCommand } = await import(\"./commands/governance.js\");\n await governanceMeetingsCommand(bodyId, parent);\n });\ngovernanceCmd\n .command(\"resolutions <meeting-id>\")\n .description(\"Resolutions for a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceResolutionsCommand } = await import(\"./commands/governance.js\");\n await governanceResolutionsCommand(meetingId, parent);\n });\ngovernanceCmd\n .command(\"convene\")\n .requiredOption(\"--body <id>\", \"Governance body ID\")\n .requiredOption(\"--type <type>\", \"Meeting type\")\n .requiredOption(\"--title <title>\", \"Meeting title\")\n .requiredOption(\"--date <date>\", \"Meeting date (ISO 8601)\")\n .option(\"--agenda <item>\", \"Agenda item (repeatable)\", (v: string, a: string[]) => [...a, v], [] as string[])\n .description(\"Convene a governance meeting\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { governanceConveneCommand } = await import(\"./commands/governance.js\");\n await governanceConveneCommand({ ...opts, meetingType: opts.type, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"vote <meeting-id> <item-id>\")\n .requiredOption(\"--voter <name>\", \"Voter name/ID\")\n .requiredOption(\"--vote <value>\", \"Vote (yea, nay, abstain)\")\n .description(\"Cast a vote on an agenda item\")\n .action(async (meetingId: string, itemId: string, opts) => {\n const { governanceVoteCommand } = await import(\"./commands/governance.js\");\n await governanceVoteCommand(meetingId, itemId, opts);\n });\ngovernanceCmd\n .command(\"notice <meeting-id>\")\n .description(\"Send meeting notice\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { sendNoticeCommand } = await import(\"./commands/governance.js\");\n await sendNoticeCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"adjourn <meeting-id>\")\n .description(\"Adjourn a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { adjournMeetingCommand } = await import(\"./commands/governance.js\");\n await adjournMeetingCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"cancel <meeting-id>\")\n .description(\"Cancel a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { cancelMeetingCommand } = await import(\"./commands/governance.js\");\n await cancelMeetingCommand(meetingId, { entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"agenda-items <meeting-id>\")\n .description(\"List agenda items for a meeting\")\n .action(async (meetingId: string, _opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { listAgendaItemsCommand } = await import(\"./commands/governance.js\");\n await listAgendaItemsCommand(meetingId, { entityId: parent.entityId, json: parent.json });\n });\ngovernanceCmd\n .command(\"finalize-item <meeting-id> <item-id>\")\n .requiredOption(\"--status <status>\", \"Status: Voted, Discussed, Tabled, or Withdrawn\")\n .description(\"Finalize an agenda item\")\n .action(async (meetingId: string, itemId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { finalizeAgendaItemCommand } = await import(\"./commands/governance.js\");\n await finalizeAgendaItemCommand(meetingId, itemId, { ...opts, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"resolve <meeting-id> <item-id>\")\n .requiredOption(\"--text <resolution_text>\", \"Resolution text\")\n .description(\"Compute a resolution for an agenda item\")\n .action(async (meetingId: string, itemId: string, opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { computeResolutionCommand } = await import(\"./commands/governance.js\");\n await computeResolutionCommand(meetingId, itemId, { ...opts, entityId: parent.entityId });\n });\ngovernanceCmd\n .command(\"written-consent\")\n .requiredOption(\"--body <id>\", \"Governance body ID\")\n .requiredOption(\"--title <title>\", \"Title\")\n .requiredOption(\"--description <desc>\", \"Description\")\n .description(\"Create a written consent action\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { writtenConsentCommand } = await import(\"./commands/governance.js\");\n await writtenConsentCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- documents ---\nconst documentsCmd = program\n .command(\"documents\")\n .description(\"Documents and signing\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { documentsListCommand } = await import(\"./commands/documents.js\");\n await documentsListCommand(opts);\n });\ndocumentsCmd\n .command(\"signing-link <doc-id>\")\n .description(\"Get a signing link for a document\")\n .action(async (docId: string) => {\n const { documentsSigningLinkCommand } = await import(\"./commands/documents.js\");\n await documentsSigningLinkCommand(docId);\n });\ndocumentsCmd\n .command(\"generate\")\n .requiredOption(\"--template <type>\", \"Template type (consulting_agreement, employment_offer, contractor_agreement, nda, custom)\")\n .requiredOption(\"--counterparty <name>\", \"Counterparty name\")\n .option(\"--effective-date <date>\", \"Effective date (ISO 8601, defaults to today)\")\n .description(\"Generate a contract from a template\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { documentsGenerateCommand } = await import(\"./commands/documents.js\");\n await documentsGenerateCommand({ ...opts, entityId: parent.entityId });\n });\ndocumentsCmd\n .command(\"preview-pdf\")\n .requiredOption(\"--document-id <id>\", \"AST document definition ID (e.g. 'bylaws')\")\n .description(\"Preview a governance document as PDF\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { documentsPreviewPdfCommand } = await import(\"./commands/documents.js\");\n await documentsPreviewPdfCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- tax ---\nconst taxCmd = program\n .command(\"tax\")\n .description(\"Tax filings and deadline tracking\")\n .option(\"--entity-id <id>\", \"Entity ID (overrides active entity)\");\ntaxCmd\n .command(\"file\")\n .requiredOption(\"--type <type>\", \"Document type\")\n .requiredOption(\"--year <year>\", \"Tax year\", parseInt)\n .description(\"File a tax document\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { taxFileCommand } = await import(\"./commands/tax.js\");\n await taxFileCommand({ ...opts, entityId: parent.entityId });\n });\ntaxCmd\n .command(\"deadline\")\n .requiredOption(\"--type <type>\", \"Deadline type\")\n .requiredOption(\"--due-date <date>\", \"Due date (ISO 8601)\")\n .requiredOption(\"--description <desc>\", \"Description\")\n .option(\"--recurrence <recurrence>\", \"Recurrence\")\n .description(\"Track a compliance deadline\")\n .action(async (opts, cmd) => {\n const parent = cmd.parent!.opts();\n const { taxDeadlineCommand } = await import(\"./commands/tax.js\");\n await taxDeadlineCommand({ ...opts, entityId: parent.entityId });\n });\n\n// --- agents ---\nconst agentsCmd = program\n .command(\"agents\")\n .description(\"Agent management\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { agentsListCommand } = await import(\"./commands/agents.js\");\n await agentsListCommand(opts);\n });\nagentsCmd.command(\"show <agent-id>\").option(\"--json\", \"Output as JSON\").description(\"Show agent detail\")\n .action(async (agentId: string, opts) => {\n const { agentsShowCommand } = await import(\"./commands/agents.js\");\n await agentsShowCommand(agentId, opts);\n });\nagentsCmd.command(\"create\").requiredOption(\"--name <name>\", \"Agent name\")\n .requiredOption(\"--prompt <prompt>\", \"System prompt\").option(\"--model <model>\", \"Model\")\n .description(\"Create a new agent\")\n .action(async (opts) => {\n const { agentsCreateCommand } = await import(\"./commands/agents.js\");\n await agentsCreateCommand(opts);\n });\nagentsCmd.command(\"pause <agent-id>\").description(\"Pause an agent\")\n .action(async (agentId: string) => {\n const { agentsPauseCommand } = await import(\"./commands/agents.js\");\n await agentsPauseCommand(agentId);\n });\nagentsCmd.command(\"resume <agent-id>\").description(\"Resume a paused agent\")\n .action(async (agentId: string) => {\n const { agentsResumeCommand } = await import(\"./commands/agents.js\");\n await agentsResumeCommand(agentId);\n });\nagentsCmd.command(\"delete <agent-id>\").description(\"Delete an agent\")\n .action(async (agentId: string) => {\n const { agentsDeleteCommand } = await import(\"./commands/agents.js\");\n await agentsDeleteCommand(agentId);\n });\nagentsCmd.command(\"message <agent-id>\").requiredOption(\"--body <text>\", \"Message text\")\n .description(\"Send a message to an agent\")\n .action(async (agentId: string, opts) => {\n const { agentsMessageCommand } = await import(\"./commands/agents.js\");\n await agentsMessageCommand(agentId, opts);\n });\nagentsCmd.command(\"executions <agent-id>\").option(\"--json\", \"Output as JSON\")\n .description(\"List agent execution history\")\n .action(async (agentId: string, opts) => {\n const { agentsExecutionsCommand } = await import(\"./commands/agents.js\");\n await agentsExecutionsCommand(agentId, opts);\n });\nagentsCmd.command(\"skill <agent-id>\").requiredOption(\"--name <name>\", \"Skill name\")\n .requiredOption(\"--description <desc>\", \"Skill description\").option(\"--instructions <text>\", \"Instructions\")\n .description(\"Add a skill to an agent\")\n .action(async (agentId: string, opts) => {\n const { agentsSkillCommand } = await import(\"./commands/agents.js\");\n await agentsSkillCommand(agentId, opts);\n });\n\n// --- billing ---\nconst billingCmd = program\n .command(\"billing\")\n .description(\"Billing status, plans, and subscription management\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { billingCommand } = await import(\"./commands/billing.js\");\n await billingCommand(opts);\n });\nbillingCmd.command(\"portal\").description(\"Open Stripe Customer Portal\")\n .action(async () => {\n const { billingPortalCommand } = await import(\"./commands/billing.js\");\n await billingPortalCommand();\n });\nbillingCmd.command(\"upgrade\").option(\"--plan <plan>\", \"Plan ID to upgrade to (free, pro, enterprise)\", \"pro\")\n .description(\"Open Stripe Checkout to upgrade your plan\")\n .action(async (opts) => {\n const { billingUpgradeCommand } = await import(\"./commands/billing.js\");\n await billingUpgradeCommand(opts);\n });\n\n// --- approvals ---\n// The approval system is integrated into governance meetings (vote on agenda items)\n// and execution intents. There is no standalone /v1/approvals endpoint.\nprogram\n .command(\"approvals\")\n .description(\"Approvals are managed through governance meetings and execution intents\")\n .action(async () => {\n const { printError } = await import(\"./output.js\");\n printError(\n \"Approvals are managed through governance meetings.\\n\" +\n \" Use: corp governance convene ... to schedule a board meeting\\n\" +\n \" Use: corp governance vote <meeting-id> <item-id> ... to cast votes\"\n );\n });\n\n// --- form ---\nconst formCmd = program\n .command(\"form\")\n .description(\"Form a new entity with founders and cap table (Cooley-style)\")\n .option(\"--entity-type <type>\", \"Entity type (llc, c_corp)\")\n .option(\"--name <name>\", \"Legal name\")\n .option(\"--jurisdiction <jurisdiction>\", \"Jurisdiction (e.g. US-DE, US-WY)\")\n .option(\"--member <member>\", \"Member as 'name,email,role[,pct]' — role: director|officer|manager|member|chair (repeatable)\", (v: string, a: string[]) => [...a, v], [] as string[])\n .option(\"--address <address>\", \"Company address as 'street,city,state,zip'\")\n .option(\"--fiscal-year-end <date>\", \"Fiscal year end (MM-DD)\", \"12-31\")\n .option(\"--s-corp\", \"Elect S-Corp status\")\n .option(\"--transfer-restrictions\", \"Enable transfer restrictions\")\n .option(\"--rofr\", \"Enable right of first refusal\")\n .action(async (opts) => {\n // Map --entity-type to the internal --type key expected by formCommand\n if (opts.entityType && !opts.type) opts.type = opts.entityType;\n const { formCommand } = await import(\"./commands/form.js\");\n await formCommand(opts);\n });\nformCmd.command(\"create\")\n .description(\"Create a pending entity (staged flow step 1)\")\n .requiredOption(\"--type <type>\", \"Entity type (llc, c_corp)\")\n .requiredOption(\"--name <name>\", \"Legal name\")\n .option(\"--jurisdiction <jurisdiction>\", \"Jurisdiction (e.g. US-DE, US-WY)\")\n .action(async (opts) => {\n const { formCreateCommand } = await import(\"./commands/form.js\");\n await formCreateCommand(opts);\n });\nformCmd.command(\"add-founder <entity-id>\")\n .description(\"Add a founder to a pending entity (staged flow step 2)\")\n .requiredOption(\"--name <name>\", \"Founder name\")\n .requiredOption(\"--email <email>\", \"Founder email\")\n .requiredOption(\"--role <role>\", \"Role: director|officer|manager|member|chair\")\n .requiredOption(\"--pct <pct>\", \"Ownership percentage\")\n .option(\"--officer-title <title>\", \"Officer title (corporations only)\")\n .option(\"--incorporator\", \"Mark as sole incorporator (corporations only)\")\n .action(async (entityId: string, opts) => {\n const { formAddFounderCommand } = await import(\"./commands/form.js\");\n await formAddFounderCommand(entityId, opts);\n });\nformCmd.command(\"finalize <entity-id>\")\n .description(\"Finalize formation and generate documents + cap table (staged flow step 3)\")\n .action(async (entityId: string) => {\n const { formFinalizeCommand } = await import(\"./commands/form.js\");\n await formFinalizeCommand(entityId);\n });\n\n// --- api-keys ---\nprogram\n .command(\"api-keys\")\n .description(\"List API keys\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts) => {\n const { apiKeysCommand } = await import(\"./commands/api-keys.js\");\n await apiKeysCommand(opts);\n });\n\n// --- demo ---\nprogram\n .command(\"demo\")\n .description(\"Seed a fully-populated demo corporation\")\n .requiredOption(\"--name <name>\", \"Corporation name\")\n .action(async (opts) => {\n const { demoCommand } = await import(\"./commands/demo.js\");\n await demoCommand(opts);\n });\n\n// --- serve ---\nprogram\n .command(\"serve\")\n .description(\"Start the API server locally\")\n .option(\"--port <port>\", \"Port to listen on\", \"8000\")\n .option(\"--data-dir <path>\", \"Data directory\", \"./data/repos\")\n .action(async (opts) => {\n const { serveCommand } = await import(\"./commands/serve.js\");\n await serveCommand(opts);\n });\n\nprogram.parse();\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,cAAc,eAAe,WAAsB,kBAAkB;AAC9E,SAAS,YAAY;AACrB,SAAS,eAAe;AAoBxB,SAAS,UAAU,MAA+B,UAAyC;AACzF,aAAW,CAAC,KAAK,KAAK,KA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,YAAY,8BAA8B,EAC1C,OAAO,iBAAiB,qBAAqB,MAAM,EACnD,OAAO,qBAAqB,kBAAkB,cAAc,EAC5D,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,cAAAC,cAAa,IAAI,MAAM;AAC/B,QAAMA,cAAa,IAAI;AACzB,CAAC;AAEH,QAAQ,MAAM;","names":["s","config_exports","init_config","join","homedir","chalk","resolve","chalk","chalk","chalk","chalk","s","input","confirm","chalk","Table","chalk","Table","readFileSync","writeFileSync","existsSync","loadConfig","saveConfig","require","setupCommand","statusCommand","configSetCommand","configGetCommand","configListCommand","obligationsCommand","digestCommand","linkCommand","claimCommand","chatCommand","entitiesCommand","entitiesShowCommand","entitiesConvertCommand","entitiesDissolveCommand","contactsListCommand","contactsShowCommand","contactsAddCommand","contactsEditCommand","capTableCommand","safesCommand","transfersCommand","valuationsCommand","fourOhNineACommand","issueEquityCommand","issueSafeCommand","transferSharesCommand","distributeCommand","startRoundCommand","addSecurityCommand","issueRoundCommand","createValuationCommand","submitValuationCommand","approveValuationCommand","financeInvoiceCommand","financePayrollCommand","financePayCommand","financeOpenAccountCommand","financeClassifyContractorCommand","financeReconcileCommand","governanceListCommand","governanceCreateBodyCommand","governanceAddSeatCommand","governanceSeatsCommand","governanceMeetingsCommand","governanceResolutionsCommand","governanceConveneCommand","governanceVoteCommand","sendNoticeCommand","adjournMeetingCommand","cancelMeetingCommand","listAgendaItemsCommand","finalizeAgendaItemCommand","computeResolutionCommand","writtenConsentCommand","documentsListCommand","documentsSigningLinkCommand","documentsGenerateCommand","documentsPreviewPdfCommand","taxFileCommand","taxDeadlineCommand","agentsListCommand","agentsShowCommand","agentsCreateCommand","agentsPauseCommand","agentsResumeCommand","agentsDeleteCommand","agentsMessageCommand","agentsExecutionsCommand","agentsSkillCommand","billingCommand","billingPortalCommand","billingUpgradeCommand","printError","formCommand","formCreateCommand","formAddFounderCommand","formFinalizeCommand","apiKeysCommand","demoCommand","serveCommand"]}