@thecorporation/cli 26.3.22 → 26.3.23

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 CHANGED
@@ -1371,7 +1371,7 @@ var init_references = __esm({
1371
1371
  // src/output.ts
1372
1372
  import chalk from "chalk";
1373
1373
  import Table from "cli-table3";
1374
- function printError(msg) {
1374
+ function printError2(msg) {
1375
1375
  console.error(chalk.red("Error:"), msg);
1376
1376
  }
1377
1377
  function printSuccess(msg) {
@@ -1390,6 +1390,16 @@ function printDryRun(operation, payload) {
1390
1390
  payload
1391
1391
  });
1392
1392
  }
1393
+ function printQuietId(record, ...idFields) {
1394
+ if (typeof record !== "object" || record === null) return;
1395
+ const rec = record;
1396
+ for (const field of idFields) {
1397
+ if (typeof rec[field] === "string" && rec[field]) {
1398
+ console.log(rec[field]);
1399
+ return;
1400
+ }
1401
+ }
1402
+ }
1393
1403
  function normalizeWriteResultOptions(options) {
1394
1404
  if (typeof options === "boolean") {
1395
1405
  return { jsonOnly: options };
@@ -1419,6 +1429,41 @@ function printWriteResult(result, successMessage, options) {
1419
1429
  printJson(result);
1420
1430
  return;
1421
1431
  }
1432
+ if (normalized.quiet) {
1433
+ const defaultIdFields = [
1434
+ "entity_id",
1435
+ "agent_id",
1436
+ "meeting_id",
1437
+ "body_id",
1438
+ "seat_id",
1439
+ "work_item_id",
1440
+ "document_id",
1441
+ "invoice_id",
1442
+ "payment_id",
1443
+ "safe_note_id",
1444
+ "valuation_id",
1445
+ "round_id",
1446
+ "instrument_id",
1447
+ "transfer_workflow_id",
1448
+ "distribution_id",
1449
+ "deadline_id",
1450
+ "filing_id",
1451
+ "bank_account_id",
1452
+ "classification_id",
1453
+ "resolution_id",
1454
+ "agenda_item_id",
1455
+ "contact_id",
1456
+ "request_id",
1457
+ "service_request_id",
1458
+ "key_id",
1459
+ "formation_id",
1460
+ "execution_id",
1461
+ "incident_id",
1462
+ "id"
1463
+ ];
1464
+ printQuietId(result, ...normalized.idFields ?? defaultIdFields);
1465
+ return;
1466
+ }
1422
1467
  printSuccess(successMessage);
1423
1468
  if (normalized.referenceKind && typeof result === "object" && result !== null && !Array.isArray(result)) {
1424
1469
  printReferenceSummary(normalized.referenceKind, result, {
@@ -1426,7 +1471,6 @@ function printWriteResult(result, successMessage, options) {
1426
1471
  showReuseHint: normalized.showReuseHint
1427
1472
  });
1428
1473
  }
1429
- printJson(result);
1430
1474
  }
1431
1475
  function printStatusPanel(data) {
1432
1476
  console.log(chalk.blue("\u2500".repeat(50)));
@@ -2152,7 +2196,7 @@ async function setupCommand() {
2152
2196
  cfg.workspace_id = result.workspace_id;
2153
2197
  printSuccess(`Local workspace ready: ${result.workspace_id}`);
2154
2198
  } catch (err) {
2155
- printError(`Workspace provisioning failed: ${err}`);
2199
+ printError2(`Workspace provisioning failed: ${err}`);
2156
2200
  console.log("You can retry with 'corp setup'.");
2157
2201
  }
2158
2202
  } else {
@@ -2169,7 +2213,7 @@ async function setupCommand() {
2169
2213
  cfg.workspace_id = result.workspace_id;
2170
2214
  printSuccess(`Authenticated. Workspace: ${result.workspace_id}`);
2171
2215
  } catch (err) {
2172
- printError(`Authentication failed: ${err}`);
2216
+ printError2(`Authentication failed: ${err}`);
2173
2217
  console.log(
2174
2218
  "You can manually set credentials with: corp config set api_key <key>"
2175
2219
  );
@@ -2185,7 +2229,7 @@ async function setupCommand() {
2185
2229
  try {
2186
2230
  cfg.api_url = validateApiUrl(url);
2187
2231
  } catch (err) {
2188
- printError(`Invalid URL: ${err}`);
2232
+ printError2(`Invalid URL: ${err}`);
2189
2233
  process.exit(1);
2190
2234
  }
2191
2235
  cfg.data_dir = "";
@@ -2201,7 +2245,7 @@ async function setupCommand() {
2201
2245
  cfg.workspace_id = result.workspace_id;
2202
2246
  console.log(`Workspace provisioned: ${result.workspace_id}`);
2203
2247
  } catch (err) {
2204
- printError(`Auto-provision failed: ${err}`);
2248
+ printError2(`Auto-provision failed: ${err}`);
2205
2249
  console.log(
2206
2250
  "You can manually set credentials with: corp config set api_key <key>"
2207
2251
  );
@@ -2409,7 +2453,7 @@ async function statusCommand(opts = {}) {
2409
2453
  printStatusPanel(data);
2410
2454
  }
2411
2455
  } catch (err) {
2412
- printError(`Failed to fetch status: ${err}`);
2456
+ printError2(`Failed to fetch status: ${err}`);
2413
2457
  process.exit(1);
2414
2458
  }
2415
2459
  }
@@ -2492,7 +2536,7 @@ async function contextCommand(opts) {
2492
2536
  }
2493
2537
  console.log(chalk2.blue("\u2500".repeat(50)));
2494
2538
  } catch (err) {
2495
- printError(`Failed to fetch context: ${err}`);
2539
+ printError2(`Failed to fetch context: ${err}`);
2496
2540
  process.exit(1);
2497
2541
  }
2498
2542
  }
@@ -2506,6 +2550,36 @@ var init_context = __esm({
2506
2550
  }
2507
2551
  });
2508
2552
 
2553
+ // src/commands/use.ts
2554
+ var use_exports = {};
2555
+ __export(use_exports, {
2556
+ useCommand: () => useCommand
2557
+ });
2558
+ async function useCommand(entityRef) {
2559
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2560
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2561
+ const resolver = new ReferenceResolver(client, cfg);
2562
+ try {
2563
+ const entityId = await resolver.resolveEntity(entityRef);
2564
+ setActiveEntityId(cfg, entityId);
2565
+ saveConfig(cfg);
2566
+ const alias = getReferenceAlias("entity", { entity_id: entityId }) ?? entityId;
2567
+ printSuccess(`Active entity set to ${alias} (${entityId})`);
2568
+ } catch (err) {
2569
+ printError2(`Failed to resolve entity: ${err}`);
2570
+ process.exit(1);
2571
+ }
2572
+ }
2573
+ var init_use = __esm({
2574
+ "src/commands/use.ts"() {
2575
+ "use strict";
2576
+ init_config();
2577
+ init_api_client();
2578
+ init_output();
2579
+ init_references();
2580
+ }
2581
+ });
2582
+
2509
2583
  // src/commands/schema.ts
2510
2584
  var schema_exports = {};
2511
2585
  __export(schema_exports, {
@@ -2592,7 +2666,7 @@ async function configSetCommand(key, value, options = {}) {
2592
2666
  });
2593
2667
  });
2594
2668
  } catch (err) {
2595
- printError(`Failed to update config: ${err}`);
2669
+ printError2(`Failed to update config: ${err}`);
2596
2670
  process.exit(1);
2597
2671
  }
2598
2672
  if (key === "api_key" || key === "llm.api_key") {
@@ -2609,7 +2683,7 @@ function configGetCommand(key) {
2609
2683
  const cfg = loadConfig();
2610
2684
  const val = getValue(cfg, key);
2611
2685
  if (val === void 0) {
2612
- printError(`Key not found: ${key}`);
2686
+ printError2(`Key not found: ${key}`);
2613
2687
  process.exit(1);
2614
2688
  }
2615
2689
  if (typeof val === "object" && val !== null) {
@@ -2640,7 +2714,7 @@ __export(resolve_exports, {
2640
2714
  async function resolveCommand(kind, ref, opts) {
2641
2715
  const normalizedKind = kind.trim().toLowerCase();
2642
2716
  if (!KINDS.has(normalizedKind)) {
2643
- printError(`Unsupported resolve kind: ${kind}`);
2717
+ printError2(`Unsupported resolve kind: ${kind}`);
2644
2718
  process.exit(1);
2645
2719
  }
2646
2720
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -2742,7 +2816,7 @@ async function resolveCommand(kind, ref, opts) {
2742
2816
  ...meetingId ? { meeting_id: meetingId } : {}
2743
2817
  });
2744
2818
  } catch (err) {
2745
- printError(`Failed to resolve reference: ${err}`);
2819
+ printError2(`Failed to resolve reference: ${err}`);
2746
2820
  process.exit(1);
2747
2821
  }
2748
2822
  }
@@ -2831,7 +2905,7 @@ import Table2 from "cli-table3";
2831
2905
  async function findCommand(kind, query, opts) {
2832
2906
  const normalizedKind = kind.trim().toLowerCase();
2833
2907
  if (!KINDS2.has(normalizedKind)) {
2834
- printError(`Unsupported find kind: ${kind}`);
2908
+ printError2(`Unsupported find kind: ${kind}`);
2835
2909
  process.exit(1);
2836
2910
  }
2837
2911
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -2881,7 +2955,7 @@ async function findCommand(kind, query, opts) {
2881
2955
  }
2882
2956
  console.log(table.toString());
2883
2957
  } catch (err) {
2884
- printError(`Failed to find references: ${err}`);
2958
+ printError2(`Failed to find references: ${err}`);
2885
2959
  process.exit(1);
2886
2960
  }
2887
2961
  }
@@ -2963,7 +3037,7 @@ async function obligationsCommand(opts) {
2963
3037
  else if (obligations.length === 0) console.log("No obligations found.");
2964
3038
  else printObligationsTable(obligations);
2965
3039
  } catch (err) {
2966
- printError(`Failed to fetch obligations: ${err}`);
3040
+ printError2(`Failed to fetch obligations: ${err}`);
2967
3041
  process.exit(1);
2968
3042
  }
2969
3043
  }
@@ -3007,7 +3081,7 @@ async function digestCommand(opts) {
3007
3081
  else printJson(digests);
3008
3082
  }
3009
3083
  } catch (err) {
3010
- printError(`Failed: ${err}`);
3084
+ printError2(`Failed: ${err}`);
3011
3085
  process.exit(1);
3012
3086
  }
3013
3087
  }
@@ -3033,7 +3107,7 @@ async function linkCommand(opts) {
3033
3107
  printSuccess(`Workspace linked to ${opts.provider} (external ID: ${opts.externalId})`);
3034
3108
  if (data.workspace_id) console.log(` Workspace: ${data.workspace_id}`);
3035
3109
  } catch (err) {
3036
- printError(`${err}`);
3110
+ printError2(`${err}`);
3037
3111
  process.exit(1);
3038
3112
  }
3039
3113
  }
@@ -3067,7 +3141,7 @@ async function claimCommand(code) {
3067
3141
  detail = body.detail ?? "";
3068
3142
  } catch {
3069
3143
  }
3070
- printError(detail || `${resp.status} ${resp.statusText}`);
3144
+ printError2(detail || `${resp.status} ${resp.statusText}`);
3071
3145
  process.exit(1);
3072
3146
  }
3073
3147
  const data = await resp.json();
@@ -3078,7 +3152,7 @@ async function claimCommand(code) {
3078
3152
  console.log("Credentials saved to ~/.corp/auth.json");
3079
3153
  console.log("Settings remain in ~/.corp/config.json");
3080
3154
  } catch (err) {
3081
- printError(`${err}`);
3155
+ printError2(`${err}`);
3082
3156
  process.exit(1);
3083
3157
  }
3084
3158
  }
@@ -3275,7 +3349,7 @@ async function chatCommand() {
3275
3349
  try {
3276
3350
  printStatusPanel(await client.getStatus());
3277
3351
  } catch (e) {
3278
- printError(`Status error: ${e}`);
3352
+ printError2(`Status error: ${e}`);
3279
3353
  }
3280
3354
  },
3281
3355
  "/obligations": async () => {
@@ -3285,7 +3359,7 @@ async function chatCommand() {
3285
3359
  if (obls.length) printObligationsTable(obls);
3286
3360
  else console.log(chalk4.dim("No obligations found."));
3287
3361
  } catch (e) {
3288
- printError(`Obligations error: ${e}`);
3362
+ printError2(`Obligations error: ${e}`);
3289
3363
  }
3290
3364
  },
3291
3365
  "/digest": async () => {
@@ -3294,7 +3368,7 @@ async function chatCommand() {
3294
3368
  if (digests.length) printJson(digests);
3295
3369
  else console.log(chalk4.dim("No digest history."));
3296
3370
  } catch (e) {
3297
- printError(`Digest error: ${e}`);
3371
+ printError2(`Digest error: ${e}`);
3298
3372
  }
3299
3373
  },
3300
3374
  "/config": () => printJson(configForDisplay(cfg)),
@@ -3351,7 +3425,7 @@ ${chalk4.bold("Chat Slash Commands")}
3351
3425
  await handler(args);
3352
3426
  continue;
3353
3427
  }
3354
- printError(`Unknown command: ${cmd}. Type /help for available commands.`);
3428
+ printError2(`Unknown command: ${cmd}. Type /help for available commands.`);
3355
3429
  continue;
3356
3430
  }
3357
3431
  messages.push({ role: "user", content: userInput });
@@ -3368,7 +3442,7 @@ ${chalk4.bold("Chat Slash Commands")}
3368
3442
  llmCfg.base_url
3369
3443
  );
3370
3444
  } catch (err) {
3371
- printError(`LLM error: ${err}`);
3445
+ printError2(`LLM error: ${err}`);
3372
3446
  break;
3373
3447
  }
3374
3448
  totalTokens += response.usage.total_tokens;
@@ -3426,6 +3500,7 @@ __export(entities_exports, {
3426
3500
  entitiesDissolveCommand: () => entitiesDissolveCommand,
3427
3501
  entitiesShowCommand: () => entitiesShowCommand
3428
3502
  });
3503
+ import { confirm as confirm2 } from "@inquirer/prompts";
3429
3504
  import chalk5 from "chalk";
3430
3505
  async function entitiesCommand(opts) {
3431
3506
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -3443,7 +3518,7 @@ async function entitiesCommand(opts) {
3443
3518
  printEntitiesTable(entities);
3444
3519
  }
3445
3520
  } catch (err) {
3446
- printError(`Failed to fetch entities: ${err}`);
3521
+ printError2(`Failed to fetch entities: ${err}`);
3447
3522
  process.exit(1);
3448
3523
  }
3449
3524
  }
@@ -3457,7 +3532,7 @@ async function entitiesShowCommand(entityId, opts) {
3457
3532
  const entities = await client.listEntities();
3458
3533
  const entity = entities.find((e) => e.entity_id === resolvedEntityId);
3459
3534
  if (!entity) {
3460
- printError(`Entity not found: ${entityId}`);
3535
+ printError2(`Entity not found: ${entityId}`);
3461
3536
  process.exit(1);
3462
3537
  }
3463
3538
  await resolver.stabilizeRecord("entity", entity);
@@ -3478,7 +3553,7 @@ async function entitiesShowCommand(entityId, opts) {
3478
3553
  console.log(chalk5.blue("\u2500".repeat(40)));
3479
3554
  }
3480
3555
  } catch (err) {
3481
- printError(`Failed to fetch entities: ${err}`);
3556
+ printError2(`Failed to fetch entities: ${err}`);
3482
3557
  process.exit(1);
3483
3558
  }
3484
3559
  }
@@ -3494,7 +3569,7 @@ async function entitiesConvertCommand(entityId, opts) {
3494
3569
  printSuccess(`Entity conversion initiated: ${result.conversion_id ?? "OK"}`);
3495
3570
  printJson(result);
3496
3571
  } catch (err) {
3497
- printError(`Failed to convert entity: ${err}`);
3572
+ printError2(`Failed to convert entity: ${err}`);
3498
3573
  process.exit(1);
3499
3574
  }
3500
3575
  }
@@ -3504,6 +3579,16 @@ async function entitiesDissolveCommand(entityId, opts) {
3504
3579
  const resolver = new ReferenceResolver(client, cfg);
3505
3580
  try {
3506
3581
  const resolvedEntityId = await resolver.resolveEntity(entityId);
3582
+ if (!opts.yes) {
3583
+ const ok = await confirm2({
3584
+ message: `Dissolve entity ${entityId}? This cannot be undone.`,
3585
+ default: false
3586
+ });
3587
+ if (!ok) {
3588
+ console.log("Cancelled.");
3589
+ return;
3590
+ }
3591
+ }
3507
3592
  const data = { reason: opts.reason };
3508
3593
  if (opts.effectiveDate) data.effective_date = opts.effectiveDate;
3509
3594
  const result = await client.dissolveEntity(resolvedEntityId, data);
@@ -3512,9 +3597,9 @@ async function entitiesDissolveCommand(entityId, opts) {
3512
3597
  } catch (err) {
3513
3598
  const msg = String(err);
3514
3599
  if (msg.includes("InvalidTransition") || msg.includes("422")) {
3515
- printError(`Cannot dissolve entity: only entities with 'active' status can be dissolved. Check the entity's current status with: corp entities show ${entityId}`);
3600
+ printError2(`Cannot dissolve entity: only entities with 'active' status can be dissolved. Check the entity's current status with: corp entities show ${entityId}`);
3516
3601
  } else {
3517
- printError(`Failed to dissolve entity: ${err}`);
3602
+ printError2(`Failed to dissolve entity: ${err}`);
3518
3603
  }
3519
3604
  process.exit(1);
3520
3605
  }
@@ -3551,7 +3636,7 @@ async function contactsListCommand(opts) {
3551
3636
  else if (contacts.length === 0) console.log("No contacts found.");
3552
3637
  else printContactsTable(contacts);
3553
3638
  } catch (err) {
3554
- printError(`Failed to fetch contacts: ${err}`);
3639
+ printError2(`Failed to fetch contacts: ${err}`);
3555
3640
  process.exit(1);
3556
3641
  }
3557
3642
  }
@@ -3588,7 +3673,7 @@ async function contactsShowCommand(contactId, opts) {
3588
3673
  console.log(chalk6.cyan("\u2500".repeat(40)));
3589
3674
  }
3590
3675
  } catch (err) {
3591
- printError(`Failed to fetch contact: ${err}`);
3676
+ printError2(`Failed to fetch contact: ${err}`);
3592
3677
  process.exit(1);
3593
3678
  }
3594
3679
  }
@@ -3618,7 +3703,7 @@ async function contactsAddCommand(opts) {
3618
3703
  { jsonOnly: opts.json, referenceKind: "contact", showReuseHint: true }
3619
3704
  );
3620
3705
  } catch (err) {
3621
- printError(`Failed to create contact: ${err}`);
3706
+ printError2(`Failed to create contact: ${err}`);
3622
3707
  process.exit(1);
3623
3708
  }
3624
3709
  }
@@ -3667,7 +3752,7 @@ async function contactsEditCommand(contactId, opts) {
3667
3752
  resolver.remember("contact", resolvedContactId, eid);
3668
3753
  printWriteResult(result, "Contact updated.", opts.json);
3669
3754
  } catch (err) {
3670
- printError(`Failed to update contact: ${err}`);
3755
+ printError2(`Failed to update contact: ${err}`);
3671
3756
  process.exit(1);
3672
3757
  }
3673
3758
  }
@@ -3687,14 +3772,18 @@ __export(cap_table_exports, {
3687
3772
  addSecurityCommand: () => addSecurityCommand,
3688
3773
  approveValuationCommand: () => approveValuationCommand,
3689
3774
  capTableCommand: () => capTableCommand,
3775
+ controlMapCommand: () => controlMapCommand,
3690
3776
  createInstrumentCommand: () => createInstrumentCommand,
3691
3777
  createValuationCommand: () => createValuationCommand,
3778
+ dilutionPreviewCommand: () => dilutionPreviewCommand,
3692
3779
  distributeCommand: () => distributeCommand,
3780
+ executeConversionCommand: () => executeConversionCommand,
3693
3781
  fourOhNineACommand: () => fourOhNineACommand,
3694
3782
  instrumentsCommand: () => instrumentsCommand,
3695
3783
  issueEquityCommand: () => issueEquityCommand,
3696
3784
  issueRoundCommand: () => issueRoundCommand,
3697
3785
  issueSafeCommand: () => issueSafeCommand,
3786
+ previewConversionCommand: () => previewConversionCommand,
3698
3787
  roundsCommand: () => roundsCommand,
3699
3788
  safesCommand: () => safesCommand,
3700
3789
  shareClassesCommand: () => shareClassesCommand,
@@ -3823,7 +3912,7 @@ async function capTableCommand(opts) {
3823
3912
  return;
3824
3913
  }
3825
3914
  if (data.access_level === "none") {
3826
- printError("You do not have access to this entity's cap table.");
3915
+ printError2("You do not have access to this entity's cap table.");
3827
3916
  process.exit(1);
3828
3917
  }
3829
3918
  printCapTable(data);
@@ -3833,7 +3922,7 @@ async function capTableCommand(opts) {
3833
3922
  } catch {
3834
3923
  }
3835
3924
  } catch (err) {
3836
- printError(`Failed to fetch cap table: ${err}`);
3925
+ printError2(`Failed to fetch cap table: ${err}`);
3837
3926
  process.exit(1);
3838
3927
  }
3839
3928
  }
@@ -3849,7 +3938,7 @@ async function safesCommand(opts) {
3849
3938
  else if (safes.length === 0) console.log("No SAFE notes found.");
3850
3939
  else printSafesTable(safes);
3851
3940
  } catch (err) {
3852
- printError(`Failed to fetch SAFE notes: ${err}`);
3941
+ printError2(`Failed to fetch SAFE notes: ${err}`);
3853
3942
  process.exit(1);
3854
3943
  }
3855
3944
  }
@@ -3865,7 +3954,7 @@ async function transfersCommand(opts) {
3865
3954
  else if (transfers.length === 0) console.log("No share transfers found.");
3866
3955
  else printTransfersTable(transfers);
3867
3956
  } catch (err) {
3868
- printError(`Failed to fetch transfers: ${err}`);
3957
+ printError2(`Failed to fetch transfers: ${err}`);
3869
3958
  process.exit(1);
3870
3959
  }
3871
3960
  }
@@ -3882,7 +3971,7 @@ async function instrumentsCommand(opts) {
3882
3971
  else if (instruments.length === 0) console.log("No instruments found.");
3883
3972
  else printInstrumentsTable(instruments);
3884
3973
  } catch (err) {
3885
- printError(`Failed to fetch instruments: ${err}`);
3974
+ printError2(`Failed to fetch instruments: ${err}`);
3886
3975
  process.exit(1);
3887
3976
  }
3888
3977
  }
@@ -3899,7 +3988,7 @@ async function shareClassesCommand(opts) {
3899
3988
  else if (shareClasses.length === 0) console.log("No share classes found.");
3900
3989
  else printShareClassesTable(shareClasses);
3901
3990
  } catch (err) {
3902
- printError(`Failed to fetch share classes: ${err}`);
3991
+ printError2(`Failed to fetch share classes: ${err}`);
3903
3992
  process.exit(1);
3904
3993
  }
3905
3994
  }
@@ -3915,7 +4004,7 @@ async function roundsCommand(opts) {
3915
4004
  else if (rounds.length === 0) console.log("No rounds found.");
3916
4005
  else printRoundsTable(rounds);
3917
4006
  } catch (err) {
3918
- printError(`Failed to fetch rounds: ${err}`);
4007
+ printError2(`Failed to fetch rounds: ${err}`);
3919
4008
  process.exit(1);
3920
4009
  }
3921
4010
  }
@@ -3931,7 +4020,7 @@ async function valuationsCommand(opts) {
3931
4020
  else if (valuations.length === 0) console.log("No valuations found.");
3932
4021
  else printValuationsTable(valuations);
3933
4022
  } catch (err) {
3934
- printError(`Failed to fetch valuations: ${err}`);
4023
+ printError2(`Failed to fetch valuations: ${err}`);
3935
4024
  process.exit(1);
3936
4025
  }
3937
4026
  }
@@ -3970,7 +4059,7 @@ async function fourOhNineACommand(opts) {
3970
4059
  );
3971
4060
  }
3972
4061
  } else {
3973
- printError(`Failed to fetch 409A valuation: ${err}`);
4062
+ printError2(`Failed to fetch 409A valuation: ${err}`);
3974
4063
  }
3975
4064
  process.exit(1);
3976
4065
  }
@@ -3997,12 +4086,12 @@ async function issueEquityCommand(opts) {
3997
4086
  const capTable = await client.getCapTable(eid);
3998
4087
  const issuerLegalEntityId = capTable.issuer_legal_entity_id;
3999
4088
  if (!issuerLegalEntityId) {
4000
- printError("No issuer legal entity found. Has this entity been formed with a cap table?");
4089
+ printError2("No issuer legal entity found. Has this entity been formed with a cap table?");
4001
4090
  process.exit(1);
4002
4091
  }
4003
4092
  const instruments = capTable.instruments ?? [];
4004
4093
  if (!instruments.length) {
4005
- printError("No instruments found on cap table. Create one with: corp cap-table create-instrument --kind common_equity --symbol COMMON --authorized-units <shares>");
4094
+ printError2("No instruments found on cap table. Create one with: corp cap-table create-instrument --kind common_equity --symbol COMMON --authorized-units <shares>");
4006
4095
  process.exit(1);
4007
4096
  }
4008
4097
  const explicitInstrumentId = opts.instrumentId ? await resolver.resolveInstrument(eid, opts.instrumentId) : void 0;
@@ -4048,9 +4137,8 @@ async function issueEquityCommand(opts) {
4048
4137
  }
4049
4138
  printSuccess(`Equity issued: ${opts.shares} shares (${opts.grantType}) to ${opts.recipient}`);
4050
4139
  printReferenceSummary("round", round, { label: "Round Ref:", showReuseHint: true });
4051
- printJson(result);
4052
4140
  } catch (err) {
4053
- printError(`Failed to issue equity: ${err}`);
4141
+ printError2(`Failed to issue equity: ${err}`);
4054
4142
  process.exit(1);
4055
4143
  }
4056
4144
  }
@@ -4064,9 +4152,9 @@ async function issueSafeCommand(opts) {
4064
4152
  printDryRun("cap_table.issue_safe", {
4065
4153
  entity_id: eid,
4066
4154
  investor: opts.investor,
4067
- amount: opts.amount,
4155
+ amount_cents: opts.amountCents,
4068
4156
  safe_type: opts.safeType,
4069
- valuation_cap: opts.valuationCap,
4157
+ valuation_cap_cents: opts.valuationCapCents,
4070
4158
  email: opts.email,
4071
4159
  meeting_id: opts.meetingId,
4072
4160
  resolution_id: opts.resolutionId
@@ -4086,8 +4174,8 @@ async function issueSafeCommand(opts) {
4086
4174
  const body = {
4087
4175
  entity_id: eid,
4088
4176
  investor_name: opts.investor,
4089
- principal_amount_cents: opts.amount,
4090
- valuation_cap_cents: opts.valuationCap,
4177
+ principal_amount_cents: opts.amountCents,
4178
+ valuation_cap_cents: opts.valuationCapCents,
4091
4179
  safe_type: opts.safeType
4092
4180
  };
4093
4181
  if (opts.email) body.email = opts.email;
@@ -4100,11 +4188,10 @@ async function issueSafeCommand(opts) {
4100
4188
  printJson(result);
4101
4189
  return;
4102
4190
  }
4103
- printSuccess(`SAFE issued: $${(opts.amount / 100).toLocaleString()} to ${opts.investor}`);
4191
+ printSuccess(`SAFE issued: $${(opts.amountCents / 100).toLocaleString()} to ${opts.investor}`);
4104
4192
  printReferenceSummary("safe_note", result, { showReuseHint: true });
4105
- printJson(result);
4106
4193
  } catch (err) {
4107
- printError(`Failed to issue SAFE: ${err}`);
4194
+ printError2(`Failed to issue SAFE: ${err}`);
4108
4195
  process.exit(1);
4109
4196
  }
4110
4197
  }
@@ -4173,7 +4260,7 @@ async function transferSharesCommand(opts) {
4173
4260
  showReuseHint: true
4174
4261
  });
4175
4262
  } catch (err) {
4176
- printError(`Failed to create transfer workflow: ${err}`);
4263
+ printError2(`Failed to create transfer workflow: ${err}`);
4177
4264
  process.exit(1);
4178
4265
  }
4179
4266
  }
@@ -4185,7 +4272,7 @@ async function distributeCommand(opts) {
4185
4272
  const eid = await resolver.resolveEntity(opts.entityId);
4186
4273
  const payload = {
4187
4274
  entity_id: eid,
4188
- total_amount_cents: opts.amount,
4275
+ total_amount_cents: opts.amountCents,
4189
4276
  distribution_type: opts.type,
4190
4277
  description: opts.description
4191
4278
  };
@@ -4202,7 +4289,7 @@ async function distributeCommand(opts) {
4202
4289
  showReuseHint: true
4203
4290
  });
4204
4291
  } catch (err) {
4205
- printError(`Failed to calculate distribution: ${err}`);
4292
+ printError2(`Failed to calculate distribution: ${err}`);
4206
4293
  process.exit(1);
4207
4294
  }
4208
4295
  }
@@ -4231,7 +4318,7 @@ async function startRoundCommand(opts) {
4231
4318
  showReuseHint: true
4232
4319
  });
4233
4320
  } catch (err) {
4234
- printError(`Failed to start round: ${err}`);
4321
+ printError2(`Failed to start round: ${err}`);
4235
4322
  process.exit(1);
4236
4323
  }
4237
4324
  }
@@ -4273,7 +4360,7 @@ async function createInstrumentCommand(opts) {
4273
4360
  showReuseHint: true
4274
4361
  });
4275
4362
  } catch (err) {
4276
- printError(`Failed to create instrument: ${err}`);
4363
+ printError2(`Failed to create instrument: ${err}`);
4277
4364
  process.exit(1);
4278
4365
  }
4279
4366
  }
@@ -4302,7 +4389,7 @@ async function addSecurityCommand(opts) {
4302
4389
  const result = await client.addRoundSecurity(roundId, body);
4303
4390
  printWriteResult(result, `Security added for ${opts.recipientName}`, opts.json);
4304
4391
  } catch (err) {
4305
- printError(`Failed to add security: ${err}`);
4392
+ printError2(`Failed to add security: ${err}`);
4306
4393
  process.exit(1);
4307
4394
  }
4308
4395
  }
@@ -4343,9 +4430,8 @@ async function issueRoundCommand(opts) {
4343
4430
  if (roundMatch) {
4344
4431
  printReferenceSummary("round", roundMatch.raw, { showReuseHint: true });
4345
4432
  }
4346
- printJson(result);
4347
4433
  } catch (err) {
4348
- printError(`Failed to issue round: ${err}`);
4434
+ printError2(`Failed to issue round: ${err}`);
4349
4435
  process.exit(1);
4350
4436
  }
4351
4437
  }
@@ -4376,7 +4462,7 @@ async function createValuationCommand(opts) {
4376
4462
  showReuseHint: true
4377
4463
  });
4378
4464
  } catch (err) {
4379
- printError(`Failed to create valuation: ${err}`);
4465
+ printError2(`Failed to create valuation: ${err}`);
4380
4466
  process.exit(1);
4381
4467
  }
4382
4468
  }
@@ -4421,13 +4507,12 @@ async function submitValuationCommand(opts) {
4421
4507
  printReferenceSummary("agenda_item", { agenda_item_id: result.agenda_item_id }, { label: "Agenda Ref:" });
4422
4508
  }
4423
4509
  }
4424
- printJson(result);
4425
4510
  } catch (err) {
4426
4511
  const msg = String(err);
4427
4512
  if (msg.includes("404")) {
4428
- printError(`Valuation not found. List valuations with: corp cap-table valuations`);
4513
+ printError2(`Valuation not found. List valuations with: corp cap-table valuations`);
4429
4514
  } else {
4430
- printError(`Failed to submit valuation: ${err}`);
4515
+ printError2(`Failed to submit valuation: ${err}`);
4431
4516
  }
4432
4517
  process.exit(1);
4433
4518
  }
@@ -4457,10 +4542,98 @@ async function approveValuationCommand(opts) {
4457
4542
  } catch (err) {
4458
4543
  const msg = String(err);
4459
4544
  if (msg.includes("400")) {
4460
- printError(`Bad request \u2014 a --resolution-id from a board vote may be required. Submit for approval first: corp cap-table submit-valuation <valuation-ref>`);
4545
+ printError2(`Bad request \u2014 a --resolution-id from a board vote may be required. Submit for approval first: corp cap-table submit-valuation <valuation-ref>`);
4461
4546
  } else {
4462
- printError(`Failed to approve valuation: ${err}`);
4547
+ printError2(`Failed to approve valuation: ${err}`);
4548
+ }
4549
+ process.exit(1);
4550
+ }
4551
+ }
4552
+ async function previewConversionCommand(opts) {
4553
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
4554
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
4555
+ const resolver = new ReferenceResolver(client, cfg);
4556
+ try {
4557
+ const eid = await resolver.resolveEntity(opts.entityId);
4558
+ const safeId = await resolver.resolveSafeNote(eid, opts.safeId);
4559
+ const result = await client.previewRoundConversion({
4560
+ entity_id: eid,
4561
+ safe_note_id: safeId,
4562
+ price_per_share_cents: opts.pricePerShareCents
4563
+ });
4564
+ if (opts.json) {
4565
+ printJson(result);
4566
+ return;
4567
+ }
4568
+ printSuccess("Conversion Preview:");
4569
+ if (result.shares_issued) console.log(` Shares to issue: ${result.shares_issued}`);
4570
+ if (result.ownership_pct) console.log(` Post-conversion ownership: ${result.ownership_pct}%`);
4571
+ printJson(result);
4572
+ } catch (err) {
4573
+ printError2(`Failed to preview conversion: ${err}`);
4574
+ process.exit(1);
4575
+ }
4576
+ }
4577
+ async function executeConversionCommand(opts) {
4578
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
4579
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
4580
+ const resolver = new ReferenceResolver(client, cfg);
4581
+ try {
4582
+ const eid = await resolver.resolveEntity(opts.entityId);
4583
+ const safeId = await resolver.resolveSafeNote(eid, opts.safeId);
4584
+ const payload = {
4585
+ entity_id: eid,
4586
+ safe_note_id: safeId,
4587
+ price_per_share_cents: opts.pricePerShareCents
4588
+ };
4589
+ if (opts.dryRun) {
4590
+ printDryRun("equity.conversion.execute", payload);
4591
+ return;
4592
+ }
4593
+ const result = await client.executeRoundConversion(
4594
+ payload
4595
+ );
4596
+ printWriteResult(result, `Conversion executed for SAFE ${safeId}`, {
4597
+ jsonOnly: opts.json
4598
+ });
4599
+ } catch (err) {
4600
+ printError2(`Failed to execute conversion: ${err}`);
4601
+ process.exit(1);
4602
+ }
4603
+ }
4604
+ async function dilutionPreviewCommand(opts) {
4605
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
4606
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
4607
+ const resolver = new ReferenceResolver(client, cfg);
4608
+ try {
4609
+ const eid = await resolver.resolveEntity(opts.entityId);
4610
+ const roundId = await resolver.resolveRound(eid, opts.roundId);
4611
+ const result = await client.getDilutionPreview(eid, roundId);
4612
+ if (opts.json) {
4613
+ printJson(result);
4614
+ return;
4615
+ }
4616
+ printJson(result);
4617
+ } catch (err) {
4618
+ printError2(`Failed to preview dilution: ${err}`);
4619
+ process.exit(1);
4620
+ }
4621
+ }
4622
+ async function controlMapCommand(opts) {
4623
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
4624
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
4625
+ const resolver = new ReferenceResolver(client, cfg);
4626
+ try {
4627
+ const eid = await resolver.resolveEntity(opts.entityId);
4628
+ const rootEntityId = opts.rootEntityId ? await resolver.resolveEntity(opts.rootEntityId) : eid;
4629
+ const result = await client.getControlMap(eid, rootEntityId);
4630
+ if (opts.json) {
4631
+ printJson(result);
4632
+ return;
4463
4633
  }
4634
+ printJson(result);
4635
+ } catch (err) {
4636
+ printError2(`Failed to fetch control map: ${err}`);
4464
4637
  process.exit(1);
4465
4638
  }
4466
4639
  }
@@ -4489,6 +4662,7 @@ var init_cap_table = __esm({
4489
4662
  // src/commands/finance.ts
4490
4663
  var finance_exports = {};
4491
4664
  __export(finance_exports, {
4665
+ financeActivateAccountCommand: () => financeActivateAccountCommand,
4492
4666
  financeBankAccountsCommand: () => financeBankAccountsCommand,
4493
4667
  financeClassificationsCommand: () => financeClassificationsCommand,
4494
4668
  financeClassifyContractorCommand: () => financeClassifyContractorCommand,
@@ -4502,6 +4676,7 @@ __export(finance_exports, {
4502
4676
  financePayrollRunsCommand: () => financePayrollRunsCommand,
4503
4677
  financeReconcileCommand: () => financeReconcileCommand,
4504
4678
  financeReconciliationsCommand: () => financeReconciliationsCommand,
4679
+ financeStatementsCommand: () => financeStatementsCommand,
4505
4680
  financeSummaryCommand: () => financeSummaryCommand
4506
4681
  });
4507
4682
  function sumAmounts(records, candidates) {
@@ -4603,7 +4778,7 @@ async function financeSummaryCommand(opts) {
4603
4778
  }
4604
4779
  printFinanceSummaryPanel(summary);
4605
4780
  } catch (err) {
4606
- printError(`Failed to fetch finance summary: ${err}`);
4781
+ printError2(`Failed to fetch finance summary: ${err}`);
4607
4782
  process.exit(1);
4608
4783
  }
4609
4784
  }
@@ -4619,7 +4794,7 @@ async function financeInvoicesCommand(opts) {
4619
4794
  else if (invoices.length === 0) console.log("No invoices found.");
4620
4795
  else printInvoicesTable(invoices);
4621
4796
  } catch (err) {
4622
- printError(`Failed to fetch invoices: ${err}`);
4797
+ printError2(`Failed to fetch invoices: ${err}`);
4623
4798
  process.exit(1);
4624
4799
  }
4625
4800
  }
@@ -4635,7 +4810,7 @@ async function financeBankAccountsCommand(opts) {
4635
4810
  else if (accounts.length === 0) console.log("No bank accounts found.");
4636
4811
  else printBankAccountsTable(accounts);
4637
4812
  } catch (err) {
4638
- printError(`Failed to fetch bank accounts: ${err}`);
4813
+ printError2(`Failed to fetch bank accounts: ${err}`);
4639
4814
  process.exit(1);
4640
4815
  }
4641
4816
  }
@@ -4651,7 +4826,7 @@ async function financePaymentsCommand(opts) {
4651
4826
  else if (payments.length === 0) console.log("No payments found.");
4652
4827
  else printPaymentsTable(payments);
4653
4828
  } catch (err) {
4654
- printError(`Failed to fetch payments: ${err}`);
4829
+ printError2(`Failed to fetch payments: ${err}`);
4655
4830
  process.exit(1);
4656
4831
  }
4657
4832
  }
@@ -4667,7 +4842,7 @@ async function financePayrollRunsCommand(opts) {
4667
4842
  else if (runs.length === 0) console.log("No payroll runs found.");
4668
4843
  else printPayrollRunsTable(runs);
4669
4844
  } catch (err) {
4670
- printError(`Failed to fetch payroll runs: ${err}`);
4845
+ printError2(`Failed to fetch payroll runs: ${err}`);
4671
4846
  process.exit(1);
4672
4847
  }
4673
4848
  }
@@ -4683,7 +4858,7 @@ async function financeDistributionsCommand(opts) {
4683
4858
  else if (distributions.length === 0) console.log("No distributions found.");
4684
4859
  else printDistributionsTable(distributions);
4685
4860
  } catch (err) {
4686
- printError(`Failed to fetch distributions: ${err}`);
4861
+ printError2(`Failed to fetch distributions: ${err}`);
4687
4862
  process.exit(1);
4688
4863
  }
4689
4864
  }
@@ -4699,7 +4874,7 @@ async function financeReconciliationsCommand(opts) {
4699
4874
  else if (reconciliations.length === 0) console.log("No reconciliations found.");
4700
4875
  else printReconciliationsTable(reconciliations);
4701
4876
  } catch (err) {
4702
- printError(`Failed to fetch reconciliations: ${err}`);
4877
+ printError2(`Failed to fetch reconciliations: ${err}`);
4703
4878
  process.exit(1);
4704
4879
  }
4705
4880
  }
@@ -4715,7 +4890,7 @@ async function financeClassificationsCommand(opts) {
4715
4890
  else if (classifications.length === 0) console.log("No contractor classifications found.");
4716
4891
  else printClassificationsTable(classifications);
4717
4892
  } catch (err) {
4718
- printError(`Failed to fetch contractor classifications: ${err}`);
4893
+ printError2(`Failed to fetch contractor classifications: ${err}`);
4719
4894
  process.exit(1);
4720
4895
  }
4721
4896
  }
@@ -4728,7 +4903,7 @@ async function financeInvoiceCommand(opts) {
4728
4903
  const result = await client.createInvoice({
4729
4904
  entity_id: eid,
4730
4905
  customer_name: opts.customer,
4731
- amount_cents: opts.amount,
4906
+ amount_cents: opts.amountCents,
4732
4907
  due_date: opts.dueDate,
4733
4908
  description: opts.description
4734
4909
  });
@@ -4740,7 +4915,7 @@ async function financeInvoiceCommand(opts) {
4740
4915
  showReuseHint: true
4741
4916
  });
4742
4917
  } catch (err) {
4743
- printError(`Failed to create invoice: ${err}`);
4918
+ printError2(`Failed to create invoice: ${err}`);
4744
4919
  process.exit(1);
4745
4920
  }
4746
4921
  }
@@ -4763,7 +4938,7 @@ async function financePayrollCommand(opts) {
4763
4938
  showReuseHint: true
4764
4939
  });
4765
4940
  } catch (err) {
4766
- printError(`Failed to run payroll: ${err}`);
4941
+ printError2(`Failed to run payroll: ${err}`);
4767
4942
  process.exit(1);
4768
4943
  }
4769
4944
  }
@@ -4775,7 +4950,7 @@ async function financePayCommand(opts) {
4775
4950
  const eid = await resolver.resolveEntity(opts.entityId);
4776
4951
  const result = await client.submitPayment({
4777
4952
  entity_id: eid,
4778
- amount_cents: opts.amount,
4953
+ amount_cents: opts.amountCents,
4779
4954
  recipient: opts.recipient,
4780
4955
  payment_method: opts.method,
4781
4956
  description: `Payment via ${opts.method}`
@@ -4788,7 +4963,7 @@ async function financePayCommand(opts) {
4788
4963
  showReuseHint: true
4789
4964
  });
4790
4965
  } catch (err) {
4791
- printError(`Failed to submit payment: ${err}`);
4966
+ printError2(`Failed to submit payment: ${err}`);
4792
4967
  process.exit(1);
4793
4968
  }
4794
4969
  }
@@ -4807,7 +4982,27 @@ async function financeOpenAccountCommand(opts) {
4807
4982
  showReuseHint: true
4808
4983
  });
4809
4984
  } catch (err) {
4810
- printError(`Failed to open bank account: ${err}`);
4985
+ printError2(`Failed to open bank account: ${err}`);
4986
+ process.exit(1);
4987
+ }
4988
+ }
4989
+ async function financeActivateAccountCommand(accountRef, opts) {
4990
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
4991
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
4992
+ const resolver = new ReferenceResolver(client, cfg);
4993
+ try {
4994
+ const eid = await resolver.resolveEntity(opts.entityId);
4995
+ const resolvedId = await resolver.resolveBankAccount(eid, accountRef);
4996
+ const result = await client.activateBankAccount(resolvedId, eid);
4997
+ await resolver.stabilizeRecord("bank_account", result, eid);
4998
+ resolver.rememberFromRecord("bank_account", result, eid);
4999
+ printWriteResult(result, `Bank account activated: ${resolvedId}`, {
5000
+ jsonOnly: opts.json,
5001
+ referenceKind: "bank_account",
5002
+ showReuseHint: true
5003
+ });
5004
+ } catch (err) {
5005
+ printError2(`Failed to activate bank account: ${err}`);
4811
5006
  process.exit(1);
4812
5007
  }
4813
5008
  }
@@ -4834,7 +5029,26 @@ async function financeClassifyContractorCommand(opts) {
4834
5029
  showReuseHint: true
4835
5030
  });
4836
5031
  } catch (err) {
4837
- printError(`Failed to classify contractor: ${err}`);
5032
+ printError2(`Failed to classify contractor: ${err}`);
5033
+ process.exit(1);
5034
+ }
5035
+ }
5036
+ async function financeStatementsCommand(opts) {
5037
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
5038
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5039
+ const resolver = new ReferenceResolver(client, cfg);
5040
+ try {
5041
+ const eid = await resolver.resolveEntity(opts.entityId);
5042
+ const params = {};
5043
+ if (opts.period) params.period = opts.period;
5044
+ const result = await client.getFinancialStatements(eid, params);
5045
+ if (opts.json) {
5046
+ printJson(result);
5047
+ return;
5048
+ }
5049
+ printJson(result);
5050
+ } catch (err) {
5051
+ printError2(`Failed to fetch financial statements: ${err}`);
4838
5052
  process.exit(1);
4839
5053
  }
4840
5054
  }
@@ -4857,7 +5071,7 @@ async function financeReconcileCommand(opts) {
4857
5071
  showReuseHint: true
4858
5072
  });
4859
5073
  } catch (err) {
4860
- printError(`Failed to reconcile ledger: ${err}`);
5074
+ printError2(`Failed to reconcile ledger: ${err}`);
4861
5075
  process.exit(1);
4862
5076
  }
4863
5077
  }
@@ -4881,9 +5095,13 @@ __export(governance_exports, {
4881
5095
  governanceAddSeatCommand: () => governanceAddSeatCommand,
4882
5096
  governanceConveneCommand: () => governanceConveneCommand,
4883
5097
  governanceCreateBodyCommand: () => governanceCreateBodyCommand,
5098
+ governanceIncidentsCommand: () => governanceIncidentsCommand,
4884
5099
  governanceListCommand: () => governanceListCommand,
4885
5100
  governanceMeetingsCommand: () => governanceMeetingsCommand,
5101
+ governanceModeCommand: () => governanceModeCommand,
4886
5102
  governanceOpenMeetingCommand: () => governanceOpenMeetingCommand,
5103
+ governanceProfileCommand: () => governanceProfileCommand,
5104
+ governanceResignCommand: () => governanceResignCommand,
4887
5105
  governanceResolutionsCommand: () => governanceResolutionsCommand,
4888
5106
  governanceSeatsCommand: () => governanceSeatsCommand,
4889
5107
  governanceVoteCommand: () => governanceVoteCommand,
@@ -4892,6 +5110,7 @@ __export(governance_exports, {
4892
5110
  sendNoticeCommand: () => sendNoticeCommand,
4893
5111
  writtenConsentCommand: () => writtenConsentCommand
4894
5112
  });
5113
+ import { confirm as confirm3 } from "@inquirer/prompts";
4895
5114
  import chalk8 from "chalk";
4896
5115
  async function governanceCreateBodyCommand(opts) {
4897
5116
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -4920,12 +5139,11 @@ async function governanceCreateBodyCommand(opts) {
4920
5139
  }
4921
5140
  printSuccess(`Governance body created: ${bodyId}`);
4922
5141
  printReferenceSummary("body", result, { showReuseHint: true });
4923
- printJson(result);
4924
5142
  console.log(chalk8.dim("\n Next steps:"));
4925
5143
  console.log(chalk8.dim(` corp governance add-seat @last:body --holder <contact-ref>`));
4926
5144
  console.log(chalk8.dim(` corp governance seats @last:body`));
4927
5145
  } catch (err) {
4928
- printError(`Failed to create governance body: ${err}`);
5146
+ printError2(`Failed to create governance body: ${err}`);
4929
5147
  process.exit(1);
4930
5148
  }
4931
5149
  }
@@ -4951,9 +5169,8 @@ async function governanceAddSeatCommand(bodyId, opts) {
4951
5169
  }
4952
5170
  printSuccess(`Seat added: ${result.seat_id ?? "OK"}`);
4953
5171
  printReferenceSummary("seat", result, { showReuseHint: true });
4954
- printJson(result);
4955
5172
  } catch (err) {
4956
- printError(`Failed to add seat: ${err}`);
5173
+ printError2(`Failed to add seat: ${err}`);
4957
5174
  process.exit(1);
4958
5175
  }
4959
5176
  }
@@ -4969,7 +5186,7 @@ async function governanceListCommand(opts) {
4969
5186
  else if (bodies.length === 0) console.log("No governance bodies found.");
4970
5187
  else printGovernanceTable(bodies);
4971
5188
  } catch (err) {
4972
- printError(`Failed to fetch governance bodies: ${err}`);
5189
+ printError2(`Failed to fetch governance bodies: ${err}`);
4973
5190
  process.exit(1);
4974
5191
  }
4975
5192
  }
@@ -4986,7 +5203,7 @@ async function governanceSeatsCommand(bodyId, opts) {
4986
5203
  else if (seats.length === 0) console.log("No seats found.");
4987
5204
  else printSeatsTable(seats);
4988
5205
  } catch (err) {
4989
- printError(`Failed to fetch seats: ${err}`);
5206
+ printError2(`Failed to fetch seats: ${err}`);
4990
5207
  process.exit(1);
4991
5208
  }
4992
5209
  }
@@ -5003,7 +5220,7 @@ async function governanceMeetingsCommand(bodyId, opts) {
5003
5220
  else if (meetings.length === 0) console.log("No meetings found.");
5004
5221
  else printMeetingsTable(meetings);
5005
5222
  } catch (err) {
5006
- printError(`Failed to fetch meetings: ${err}`);
5223
+ printError2(`Failed to fetch meetings: ${err}`);
5007
5224
  process.exit(1);
5008
5225
  }
5009
5226
  }
@@ -5020,7 +5237,7 @@ async function governanceResolutionsCommand(meetingId, opts) {
5020
5237
  else if (resolutions.length === 0) console.log("No resolutions found.");
5021
5238
  else printResolutionsTable(resolutions);
5022
5239
  } catch (err) {
5023
- printError(`Failed to fetch resolutions: ${err}`);
5240
+ printError2(`Failed to fetch resolutions: ${err}`);
5024
5241
  process.exit(1);
5025
5242
  }
5026
5243
  }
@@ -5053,13 +5270,12 @@ async function governanceConveneCommand(opts) {
5053
5270
  }
5054
5271
  printSuccess(`Meeting scheduled: ${meetingId}`);
5055
5272
  printReferenceSummary("meeting", result, { showReuseHint: true });
5056
- printJson(result);
5057
5273
  console.log(chalk8.dim("\n Next steps:"));
5058
5274
  console.log(chalk8.dim(` corp governance notice @last:meeting`));
5059
5275
  console.log(chalk8.dim(` corp governance open @last:meeting --present-seat <seat-ref>`));
5060
5276
  console.log(chalk8.dim(` corp governance agenda-items @last:meeting`));
5061
5277
  } catch (err) {
5062
- printError(`Failed to schedule meeting: ${err}`);
5278
+ printError2(`Failed to schedule meeting: ${err}`);
5063
5279
  process.exit(1);
5064
5280
  }
5065
5281
  }
@@ -5084,9 +5300,8 @@ async function governanceOpenMeetingCommand(meetingId, opts) {
5084
5300
  return;
5085
5301
  }
5086
5302
  printSuccess(`Meeting opened: ${resolvedMeetingId}`);
5087
- printJson(result);
5088
5303
  } catch (err) {
5089
- printError(`Failed to open meeting: ${err}`);
5304
+ printError2(`Failed to open meeting: ${err}`);
5090
5305
  process.exit(1);
5091
5306
  }
5092
5307
  }
@@ -5114,16 +5329,15 @@ async function governanceVoteCommand(meetingId, itemId, opts) {
5114
5329
  return;
5115
5330
  }
5116
5331
  printSuccess(`Vote cast: ${result.vote_id ?? "OK"}`);
5117
- printJson(result);
5118
5332
  } catch (err) {
5119
5333
  const message = String(err);
5120
5334
  if (message.includes("voting session is not open")) {
5121
- printError(
5335
+ printError2(
5122
5336
  `Failed to cast vote: ${err}
5123
5337
  Open the meeting first: corp governance open ${meetingId} --present-seat <seat-ref>`
5124
5338
  );
5125
5339
  } else {
5126
- printError(`Failed to cast vote: ${err}`);
5340
+ printError2(`Failed to cast vote: ${err}`);
5127
5341
  }
5128
5342
  process.exit(1);
5129
5343
  }
@@ -5145,9 +5359,8 @@ async function sendNoticeCommand(meetingId, opts) {
5145
5359
  return;
5146
5360
  }
5147
5361
  printSuccess(`Notice sent for meeting ${resolvedMeetingId}`);
5148
- printJson(result);
5149
5362
  } catch (err) {
5150
- printError(`Failed to send notice: ${err}`);
5363
+ printError2(`Failed to send notice: ${err}`);
5151
5364
  process.exit(1);
5152
5365
  }
5153
5366
  }
@@ -5168,9 +5381,8 @@ async function adjournMeetingCommand(meetingId, opts) {
5168
5381
  return;
5169
5382
  }
5170
5383
  printSuccess(`Meeting ${resolvedMeetingId} adjourned`);
5171
- printJson(result);
5172
5384
  } catch (err) {
5173
- printError(`Failed to adjourn meeting: ${err}`);
5385
+ printError2(`Failed to adjourn meeting: ${err}`);
5174
5386
  process.exit(1);
5175
5387
  }
5176
5388
  }
@@ -5185,15 +5397,24 @@ async function cancelMeetingCommand(meetingId, opts) {
5185
5397
  printDryRun("governance.cancel_meeting", { entity_id: eid, meeting_id: resolvedMeetingId });
5186
5398
  return;
5187
5399
  }
5400
+ if (!opts.yes) {
5401
+ const ok = await confirm3({
5402
+ message: `Cancel meeting ${resolvedMeetingId}?`,
5403
+ default: false
5404
+ });
5405
+ if (!ok) {
5406
+ console.log("Cancelled.");
5407
+ return;
5408
+ }
5409
+ }
5188
5410
  const result = await client.cancelMeeting(resolvedMeetingId, eid);
5189
5411
  if (opts.json) {
5190
5412
  printJson(result);
5191
5413
  return;
5192
5414
  }
5193
5415
  printSuccess(`Meeting ${resolvedMeetingId} cancelled`);
5194
- printJson(result);
5195
5416
  } catch (err) {
5196
- printError(`Failed to cancel meeting: ${err}`);
5417
+ printError2(`Failed to cancel meeting: ${err}`);
5197
5418
  process.exit(1);
5198
5419
  }
5199
5420
  }
@@ -5214,9 +5435,8 @@ async function reopenMeetingCommand(meetingId, opts) {
5214
5435
  return;
5215
5436
  }
5216
5437
  printSuccess(`Meeting ${resolvedMeetingId} re-opened`);
5217
- printJson(result);
5218
5438
  } catch (err) {
5219
- printError(`Failed to re-open meeting: ${err}`);
5439
+ printError2(`Failed to re-open meeting: ${err}`);
5220
5440
  process.exit(1);
5221
5441
  }
5222
5442
  }
@@ -5242,9 +5462,8 @@ async function finalizeAgendaItemCommand(meetingId, itemId, opts) {
5242
5462
  return;
5243
5463
  }
5244
5464
  printSuccess(`Agenda item ${resolvedItemId} finalized as ${opts.status}`);
5245
- printJson(result);
5246
5465
  } catch (err) {
5247
- printError(`Failed to finalize agenda item: ${err}`);
5466
+ printError2(`Failed to finalize agenda item: ${err}`);
5248
5467
  process.exit(1);
5249
5468
  }
5250
5469
  }
@@ -5277,9 +5496,8 @@ async function computeResolutionCommand(meetingId, itemId, opts) {
5277
5496
  }
5278
5497
  printSuccess(`Resolution computed for agenda item ${itemId}`);
5279
5498
  printReferenceSummary("resolution", result, { showReuseHint: true });
5280
- printJson(result);
5281
5499
  } catch (err) {
5282
- printError(`Failed to compute resolution: ${err}`);
5500
+ printError2(`Failed to compute resolution: ${err}`);
5283
5501
  process.exit(1);
5284
5502
  }
5285
5503
  }
@@ -5310,12 +5528,106 @@ async function writtenConsentCommand(opts) {
5310
5528
  }
5311
5529
  printSuccess(`Written consent created: ${meetingId}`);
5312
5530
  printReferenceSummary("meeting", result, { showReuseHint: true });
5313
- printJson(result);
5314
5531
  console.log(chalk8.dim("\n Next steps:"));
5315
5532
  console.log(chalk8.dim(` corp governance agenda-items @last:meeting`));
5316
5533
  console.log(chalk8.dim(` corp governance vote @last:meeting <item-ref> --voter <contact-ref> --vote for`));
5317
5534
  } catch (err) {
5318
- printError(`Failed to create written consent: ${err}`);
5535
+ printError2(`Failed to create written consent: ${err}`);
5536
+ process.exit(1);
5537
+ }
5538
+ }
5539
+ async function governanceModeCommand(opts) {
5540
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
5541
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5542
+ const resolver = new ReferenceResolver(client, cfg);
5543
+ try {
5544
+ const eid = await resolver.resolveEntity(opts.entityId);
5545
+ if (opts.set) {
5546
+ const result = await client.setGovernanceMode({ entity_id: eid, mode: opts.set });
5547
+ if (opts.json) {
5548
+ printJson(result);
5549
+ return;
5550
+ }
5551
+ printSuccess(`Governance mode set to: ${opts.set}`);
5552
+ } else {
5553
+ const result = await client.getGovernanceMode(eid);
5554
+ if (opts.json) {
5555
+ printJson(result);
5556
+ return;
5557
+ }
5558
+ console.log(` ${chalk8.bold("Governance Mode:")} ${result.mode ?? "N/A"}`);
5559
+ if (result.reason) console.log(` ${chalk8.bold("Reason:")} ${result.reason}`);
5560
+ }
5561
+ } catch (err) {
5562
+ printError2(`Failed: ${err}`);
5563
+ process.exit(1);
5564
+ }
5565
+ }
5566
+ async function governanceResignCommand(seatRef, opts) {
5567
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
5568
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5569
+ const resolver = new ReferenceResolver(client, cfg);
5570
+ try {
5571
+ const eid = await resolver.resolveEntity(opts.entityId);
5572
+ const seatId = await resolver.resolveSeat(eid, seatRef, opts.bodyId);
5573
+ const result = await client.resignSeat(seatId, eid);
5574
+ if (opts.json) {
5575
+ printJson(result);
5576
+ return;
5577
+ }
5578
+ printSuccess(`Seat ${seatId} resigned.`);
5579
+ } catch (err) {
5580
+ printError2(`Failed to resign seat: ${err}`);
5581
+ process.exit(1);
5582
+ }
5583
+ }
5584
+ async function governanceIncidentsCommand(opts) {
5585
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
5586
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5587
+ const resolver = new ReferenceResolver(client, cfg);
5588
+ try {
5589
+ const eid = await resolver.resolveEntity(opts.entityId);
5590
+ const incidents = await client.listGovernanceIncidents(eid);
5591
+ if (opts.json) {
5592
+ printJson(incidents);
5593
+ return;
5594
+ }
5595
+ if (incidents.length === 0) {
5596
+ console.log("No governance incidents found.");
5597
+ return;
5598
+ }
5599
+ for (const inc of incidents) {
5600
+ const status = String(inc.status ?? "open");
5601
+ const colored = status === "resolved" ? chalk8.green(status) : chalk8.red(status);
5602
+ console.log(` [${colored}] ${inc.incident_type ?? "unknown"}: ${inc.description ?? inc.id}`);
5603
+ }
5604
+ } catch (err) {
5605
+ printError2(`Failed to list incidents: ${err}`);
5606
+ process.exit(1);
5607
+ }
5608
+ }
5609
+ async function governanceProfileCommand(opts) {
5610
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
5611
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5612
+ const resolver = new ReferenceResolver(client, cfg);
5613
+ try {
5614
+ const eid = await resolver.resolveEntity(opts.entityId);
5615
+ const profile = await client.getGovernanceProfile(eid);
5616
+ if (opts.json) {
5617
+ printJson(profile);
5618
+ return;
5619
+ }
5620
+ console.log(chalk8.blue("\u2500".repeat(40)));
5621
+ console.log(chalk8.blue.bold(" Governance Profile"));
5622
+ console.log(chalk8.blue("\u2500".repeat(40)));
5623
+ for (const [key, value] of Object.entries(profile)) {
5624
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
5625
+ console.log(` ${chalk8.bold(key.replaceAll("_", " ") + ":")} ${value}`);
5626
+ }
5627
+ }
5628
+ console.log(chalk8.blue("\u2500".repeat(40)));
5629
+ } catch (err) {
5630
+ printError2(`Failed to get governance profile: ${err}`);
5319
5631
  process.exit(1);
5320
5632
  }
5321
5633
  }
@@ -5332,7 +5644,7 @@ async function listAgendaItemsCommand(meetingId, opts) {
5332
5644
  else if (items.length === 0) console.log("No agenda items found.");
5333
5645
  else printAgendaItemsTable(items);
5334
5646
  } catch (err) {
5335
- printError(`Failed to list agenda items: ${err}`);
5647
+ printError2(`Failed to list agenda items: ${err}`);
5336
5648
  process.exit(1);
5337
5649
  }
5338
5650
  }
@@ -5573,7 +5885,7 @@ async function documentsListCommand(opts) {
5573
5885
  else if (docs.length === 0) console.log("No documents found.");
5574
5886
  else printDocumentsTable(docs);
5575
5887
  } catch (err) {
5576
- printError(`Failed to fetch documents: ${err}`);
5888
+ printError2(`Failed to fetch documents: ${err}`);
5577
5889
  process.exit(1);
5578
5890
  }
5579
5891
  }
@@ -5593,7 +5905,7 @@ async function documentsSigningLinkCommand(docId, opts) {
5593
5905
  }
5594
5906
  console.log(shareUrl);
5595
5907
  } catch (err) {
5596
- printError(`Failed to get signing link: ${err}`);
5908
+ printError2(`Failed to get signing link: ${err}`);
5597
5909
  process.exit(1);
5598
5910
  }
5599
5911
  }
@@ -5634,7 +5946,7 @@ async function documentsGenerateCommand(opts) {
5634
5946
  showReuseHint: true
5635
5947
  });
5636
5948
  } catch (err) {
5637
- printError(`Failed to generate contract: ${err}`);
5949
+ printError2(`Failed to generate contract: ${err}`);
5638
5950
  process.exit(1);
5639
5951
  }
5640
5952
  }
@@ -5689,7 +6001,7 @@ async function documentsSignCommand(docId, opts) {
5689
6001
  printReferenceSummary("document", result.document, { showReuseHint: true });
5690
6002
  printJson(result.document);
5691
6003
  } catch (err) {
5692
- printError(`Failed to sign document: ${err}`);
6004
+ printError2(`Failed to sign document: ${err}`);
5693
6005
  process.exit(1);
5694
6006
  }
5695
6007
  }
@@ -5714,13 +6026,13 @@ async function documentsSignAllCommand(opts) {
5714
6026
  signatures: Array.isArray(document.signatures) ? document.signatures.length : document.signatures
5715
6027
  })));
5716
6028
  } catch (err) {
5717
- printError(`Failed to sign formation documents: ${err}`);
6029
+ printError2(`Failed to sign formation documents: ${err}`);
5718
6030
  process.exit(1);
5719
6031
  }
5720
6032
  }
5721
6033
  async function documentsPreviewPdfCommand(opts) {
5722
6034
  if (!opts.documentId || opts.documentId.trim().length === 0) {
5723
- printError("preview-pdf requires --definition-id (or deprecated alias --document-id)");
6035
+ printError2("preview-pdf requires --definition-id (or deprecated alias --document-id)");
5724
6036
  process.exit(1);
5725
6037
  }
5726
6038
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -5733,7 +6045,7 @@ async function documentsPreviewPdfCommand(opts) {
5733
6045
  printSuccess(`Preview PDF URL: ${url}`);
5734
6046
  console.log("The document definition was validated successfully. Use your API key to download the PDF.");
5735
6047
  } catch (err) {
5736
- printError(`Failed to validate preview PDF: ${err}`);
6048
+ printError2(`Failed to validate preview PDF: ${err}`);
5737
6049
  process.exit(1);
5738
6050
  }
5739
6051
  }
@@ -5756,8 +6068,34 @@ __export(tax_exports, {
5756
6068
  taxDeadlineCommand: () => taxDeadlineCommand,
5757
6069
  taxDeadlinesCommand: () => taxDeadlinesCommand,
5758
6070
  taxFileCommand: () => taxFileCommand,
5759
- taxFilingsCommand: () => taxFilingsCommand
6071
+ taxFilingsCommand: () => taxFilingsCommand,
6072
+ taxSummaryCommand: () => taxSummaryCommand
5760
6073
  });
6074
+ async function taxSummaryCommand(opts) {
6075
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
6076
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
6077
+ const resolver = new ReferenceResolver(client, cfg);
6078
+ try {
6079
+ const eid = await resolver.resolveEntity(opts.entityId);
6080
+ const [filings, deadlines] = await Promise.all([
6081
+ client.listTaxFilings(eid),
6082
+ client.listDeadlines(eid)
6083
+ ]);
6084
+ if (opts.json) {
6085
+ printJson({ filings, deadlines });
6086
+ return;
6087
+ }
6088
+ if (filings.length === 0 && deadlines.length === 0) {
6089
+ console.log("No tax filings or deadlines found.");
6090
+ return;
6091
+ }
6092
+ if (filings.length > 0) printTaxFilingsTable(filings);
6093
+ if (deadlines.length > 0) printDeadlinesTable(deadlines);
6094
+ } catch (err) {
6095
+ printError2(`Failed to fetch tax summary: ${err}`);
6096
+ process.exit(1);
6097
+ }
6098
+ }
5761
6099
  function normalizeRecurrence(recurrence) {
5762
6100
  if (!recurrence) return void 0;
5763
6101
  if (recurrence === "yearly") return "annual";
@@ -5775,7 +6113,7 @@ async function taxFilingsCommand(opts) {
5775
6113
  else if (filings.length === 0) console.log("No tax filings found.");
5776
6114
  else printTaxFilingsTable(filings);
5777
6115
  } catch (err) {
5778
- printError(`Failed to fetch tax filings: ${err}`);
6116
+ printError2(`Failed to fetch tax filings: ${err}`);
5779
6117
  process.exit(1);
5780
6118
  }
5781
6119
  }
@@ -5791,7 +6129,7 @@ async function taxDeadlinesCommand(opts) {
5791
6129
  else if (deadlines.length === 0) console.log("No deadlines found.");
5792
6130
  else printDeadlinesTable(deadlines);
5793
6131
  } catch (err) {
5794
- printError(`Failed to fetch deadlines: ${err}`);
6132
+ printError2(`Failed to fetch deadlines: ${err}`);
5795
6133
  process.exit(1);
5796
6134
  }
5797
6135
  }
@@ -5800,8 +6138,9 @@ async function taxFileCommand(opts) {
5800
6138
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
5801
6139
  const resolver = new ReferenceResolver(client, cfg);
5802
6140
  try {
6141
+ const docType = TAX_TYPE_ALIASES[opts.type] ?? opts.type;
5803
6142
  const eid = await resolver.resolveEntity(opts.entityId);
5804
- const result = await client.fileTaxDocument({ entity_id: eid, document_type: opts.type, tax_year: opts.year });
6143
+ const result = await client.fileTaxDocument({ entity_id: eid, document_type: docType, tax_year: opts.year });
5805
6144
  await resolver.stabilizeRecord("tax_filing", result, eid);
5806
6145
  resolver.rememberFromRecord("tax_filing", result, eid);
5807
6146
  printWriteResult(result, `Tax document filed: ${result.filing_id ?? "OK"}`, {
@@ -5810,7 +6149,7 @@ async function taxFileCommand(opts) {
5810
6149
  showReuseHint: true
5811
6150
  });
5812
6151
  } catch (err) {
5813
- printError(`Failed to file tax document: ${err}`);
6152
+ printError2(`Failed to file tax document: ${err}`);
5814
6153
  process.exit(1);
5815
6154
  }
5816
6155
  }
@@ -5837,10 +6176,11 @@ async function taxDeadlineCommand(opts) {
5837
6176
  showReuseHint: true
5838
6177
  });
5839
6178
  } catch (err) {
5840
- printError(`Failed to track deadline: ${err}`);
6179
+ printError2(`Failed to track deadline: ${err}`);
5841
6180
  process.exit(1);
5842
6181
  }
5843
6182
  }
6183
+ var TAX_TYPE_ALIASES;
5844
6184
  var init_tax = __esm({
5845
6185
  "src/commands/tax.ts"() {
5846
6186
  "use strict";
@@ -5848,6 +6188,15 @@ var init_tax = __esm({
5848
6188
  init_api_client();
5849
6189
  init_output();
5850
6190
  init_references();
6191
+ TAX_TYPE_ALIASES = {
6192
+ form_1120: "1120",
6193
+ form_1120s: "1120s",
6194
+ form_1065: "1065",
6195
+ form_1099_nec: "1099_nec",
6196
+ form_k1: "k1",
6197
+ form_941: "941",
6198
+ form_w2: "w2"
6199
+ };
5851
6200
  }
5852
6201
  });
5853
6202
 
@@ -5856,7 +6205,9 @@ var agents_exports = {};
5856
6205
  __export(agents_exports, {
5857
6206
  agentsCreateCommand: () => agentsCreateCommand,
5858
6207
  agentsDeleteCommand: () => agentsDeleteCommand,
5859
- agentsExecutionsCommand: () => agentsExecutionsCommand,
6208
+ agentsExecutionCommand: () => agentsExecutionCommand,
6209
+ agentsExecutionResultCommand: () => agentsExecutionResultCommand,
6210
+ agentsKillCommand: () => agentsKillCommand,
5860
6211
  agentsListCommand: () => agentsListCommand,
5861
6212
  agentsMessageCommand: () => agentsMessageCommand,
5862
6213
  agentsPauseCommand: () => agentsPauseCommand,
@@ -5864,6 +6215,7 @@ __export(agents_exports, {
5864
6215
  agentsShowCommand: () => agentsShowCommand,
5865
6216
  agentsSkillCommand: () => agentsSkillCommand
5866
6217
  });
6218
+ import { confirm as confirm4 } from "@inquirer/prompts";
5867
6219
  import chalk9 from "chalk";
5868
6220
  import { readFileSync as readFileSync2, realpathSync } from "fs";
5869
6221
  import { relative, resolve } from "path";
@@ -5878,7 +6230,7 @@ async function agentsListCommand(opts) {
5878
6230
  else if (agents.length === 0) console.log("No agents found.");
5879
6231
  else printAgentsTable(agents);
5880
6232
  } catch (err) {
5881
- printError(`Failed to fetch agents: ${err}`);
6233
+ printError2(`Failed to fetch agents: ${err}`);
5882
6234
  process.exit(1);
5883
6235
  }
5884
6236
  }
@@ -5911,7 +6263,7 @@ async function agentsShowCommand(agentId, opts) {
5911
6263
  }
5912
6264
  console.log(chalk9.magenta("\u2500".repeat(40)));
5913
6265
  } catch (err) {
5914
- printError(`Failed to fetch agent: ${err}`);
6266
+ printError2(`Failed to fetch agent: ${err}`);
5915
6267
  process.exit(1);
5916
6268
  }
5917
6269
  }
@@ -5931,7 +6283,7 @@ async function agentsCreateCommand(opts) {
5931
6283
  showReuseHint: true
5932
6284
  });
5933
6285
  } catch (err) {
5934
- printError(`Failed to create agent: ${err}`);
6286
+ printError2(`Failed to create agent: ${err}`);
5935
6287
  process.exit(1);
5936
6288
  }
5937
6289
  }
@@ -5944,7 +6296,7 @@ async function agentsPauseCommand(agentId, opts) {
5944
6296
  const result = await client.updateAgent(resolvedAgentId, { status: "paused" });
5945
6297
  printWriteResult(result, `Agent ${resolvedAgentId} paused.`, opts.json);
5946
6298
  } catch (err) {
5947
- printError(`Failed to pause agent: ${err}`);
6299
+ printError2(`Failed to pause agent: ${err}`);
5948
6300
  process.exit(1);
5949
6301
  }
5950
6302
  }
@@ -5957,7 +6309,7 @@ async function agentsResumeCommand(agentId, opts) {
5957
6309
  const result = await client.updateAgent(resolvedAgentId, { status: "active" });
5958
6310
  printWriteResult(result, `Agent ${resolvedAgentId} resumed.`, opts.json);
5959
6311
  } catch (err) {
5960
- printError(`Failed to resume agent: ${err}`);
6312
+ printError2(`Failed to resume agent: ${err}`);
5961
6313
  process.exit(1);
5962
6314
  }
5963
6315
  }
@@ -5967,10 +6319,20 @@ async function agentsDeleteCommand(agentId, opts) {
5967
6319
  const resolver = new ReferenceResolver(client, cfg);
5968
6320
  try {
5969
6321
  const resolvedAgentId = await resolver.resolveAgent(agentId);
6322
+ if (!opts.yes) {
6323
+ const ok = await confirm4({
6324
+ message: `Delete agent ${resolvedAgentId}? This cannot be undone.`,
6325
+ default: false
6326
+ });
6327
+ if (!ok) {
6328
+ console.log("Cancelled.");
6329
+ return;
6330
+ }
6331
+ }
5970
6332
  const result = await client.deleteAgent(resolvedAgentId);
5971
6333
  printWriteResult(result, `Agent ${resolvedAgentId} deleted.`, opts.json);
5972
6334
  } catch (err) {
5973
- printError(`Failed to delete agent: ${err}`);
6335
+ printError2(`Failed to delete agent: ${err}`);
5974
6336
  process.exit(1);
5975
6337
  }
5976
6338
  }
@@ -6010,21 +6372,72 @@ async function agentsMessageCommand(agentId, opts) {
6010
6372
  const result = await client.sendAgentMessage(resolvedAgentId, body);
6011
6373
  printWriteResult(result, `Message sent. Execution: ${result.execution_id ?? "OK"}`, opts.json);
6012
6374
  } catch (err) {
6013
- printError(`Failed to send message: ${err}`);
6375
+ printError2(`Failed to send message: ${err}`);
6014
6376
  process.exit(1);
6015
6377
  }
6016
6378
  }
6017
- async function agentsExecutionsCommand(agentId, _opts) {
6379
+ async function agentsExecutionCommand(agentId, executionId, opts) {
6018
6380
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
6019
6381
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
6020
6382
  const resolver = new ReferenceResolver(client, cfg);
6021
- const resolvedAgentId = await resolver.resolveAgent(agentId);
6022
- printError(
6023
- `Listing executions is not yet supported.
6024
- To inspect a specific run, use the execution ID returned by "agents message":
6025
- GET /v1/agents/${resolvedAgentId}/executions/<execution-id>`
6026
- );
6027
- process.exit(1);
6383
+ try {
6384
+ const resolvedAgentId = await resolver.resolveAgent(agentId);
6385
+ const result = await client.getAgentExecution(resolvedAgentId, executionId);
6386
+ if (opts.json) {
6387
+ printJson(result);
6388
+ return;
6389
+ }
6390
+ console.log(chalk9.magenta("\u2500".repeat(40)));
6391
+ console.log(chalk9.magenta.bold(" Execution Status"));
6392
+ console.log(chalk9.magenta("\u2500".repeat(40)));
6393
+ console.log(` ${chalk9.bold("Execution:")} ${executionId}`);
6394
+ console.log(` ${chalk9.bold("Agent:")} ${resolvedAgentId}`);
6395
+ console.log(` ${chalk9.bold("Status:")} ${result.status ?? "N/A"}`);
6396
+ if (result.started_at) console.log(` ${chalk9.bold("Started:")} ${result.started_at}`);
6397
+ if (result.completed_at) console.log(` ${chalk9.bold("Completed:")} ${result.completed_at}`);
6398
+ console.log(chalk9.magenta("\u2500".repeat(40)));
6399
+ } catch (err) {
6400
+ printError2(`Failed to get execution: ${err}`);
6401
+ process.exit(1);
6402
+ }
6403
+ }
6404
+ async function agentsExecutionResultCommand(agentId, executionId, opts) {
6405
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
6406
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
6407
+ const resolver = new ReferenceResolver(client, cfg);
6408
+ try {
6409
+ const resolvedAgentId = await resolver.resolveAgent(agentId);
6410
+ const result = await client.getAgentExecutionResult(resolvedAgentId, executionId);
6411
+ if (opts.json) {
6412
+ printJson(result);
6413
+ return;
6414
+ }
6415
+ printSuccess(`Result for execution ${executionId}:`);
6416
+ printJson(result);
6417
+ } catch (err) {
6418
+ printError2(`Failed to get execution result: ${err}`);
6419
+ process.exit(1);
6420
+ }
6421
+ }
6422
+ async function agentsKillCommand(agentId, executionId, opts) {
6423
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
6424
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
6425
+ const resolver = new ReferenceResolver(client, cfg);
6426
+ try {
6427
+ const resolvedAgentId = await resolver.resolveAgent(agentId);
6428
+ if (!opts.yes) {
6429
+ const ok = await confirm4({ message: `Kill execution ${executionId}?`, default: false });
6430
+ if (!ok) {
6431
+ console.log("Cancelled.");
6432
+ return;
6433
+ }
6434
+ }
6435
+ const result = await client.killAgentExecution(resolvedAgentId, executionId);
6436
+ printWriteResult(result, `Execution ${executionId} killed.`, opts.json);
6437
+ } catch (err) {
6438
+ printError2(`Failed to kill execution: ${err}`);
6439
+ process.exit(1);
6440
+ }
6028
6441
  }
6029
6442
  async function agentsSkillCommand(agentId, opts) {
6030
6443
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -6044,7 +6457,7 @@ async function agentsSkillCommand(agentId, opts) {
6044
6457
  });
6045
6458
  printWriteResult(result, `Skill '${opts.name}' added to agent ${resolvedAgentId}.`, opts.json);
6046
6459
  } catch (err) {
6047
- printError(`Failed to add skill: ${err}`);
6460
+ printError2(`Failed to add skill: ${err}`);
6048
6461
  process.exit(1);
6049
6462
  }
6050
6463
  }
@@ -6069,6 +6482,7 @@ __export(work_items_exports, {
6069
6482
  workItemsReleaseCommand: () => workItemsReleaseCommand,
6070
6483
  workItemsShowCommand: () => workItemsShowCommand
6071
6484
  });
6485
+ import { confirm as confirm5 } from "@inquirer/prompts";
6072
6486
  import chalk10 from "chalk";
6073
6487
  function actorLabel2(record, key) {
6074
6488
  const actor = record[`${key}_actor`];
@@ -6097,7 +6511,7 @@ async function workItemsListCommand(opts) {
6097
6511
  else if (items.length === 0) console.log("No work items found.");
6098
6512
  else printWorkItemsTable(items);
6099
6513
  } catch (err) {
6100
- printError(`Failed to fetch work items: ${err}`);
6514
+ printError2(`Failed to fetch work items: ${err}`);
6101
6515
  process.exit(1);
6102
6516
  }
6103
6517
  }
@@ -6137,7 +6551,7 @@ async function workItemsShowCommand(workItemId, opts) {
6137
6551
  console.log(` ${chalk10.bold("Created at:")} ${w.created_at ?? "N/A"}`);
6138
6552
  console.log(chalk10.cyan("\u2500".repeat(40)));
6139
6553
  } catch (err) {
6140
- printError(`Failed to fetch work item: ${err}`);
6554
+ printError2(`Failed to fetch work item: ${err}`);
6141
6555
  process.exit(1);
6142
6556
  }
6143
6557
  }
@@ -6147,10 +6561,6 @@ async function workItemsCreateCommand(opts) {
6147
6561
  const resolver = new ReferenceResolver(client, cfg);
6148
6562
  try {
6149
6563
  const eid = await resolver.resolveEntity(opts.entityId);
6150
- if (!opts.category) {
6151
- printError("Missing required option: --category <category>");
6152
- process.exit(1);
6153
- }
6154
6564
  const data = { title: opts.title, category: opts.category };
6155
6565
  if (opts.description) data.description = opts.description;
6156
6566
  if (opts.deadline) data.deadline = opts.deadline;
@@ -6165,7 +6575,7 @@ async function workItemsCreateCommand(opts) {
6165
6575
  { jsonOnly: opts.json, referenceKind: "work_item", showReuseHint: true }
6166
6576
  );
6167
6577
  } catch (err) {
6168
- printError(`Failed to create work item: ${err}`);
6578
+ printError2(`Failed to create work item: ${err}`);
6169
6579
  process.exit(1);
6170
6580
  }
6171
6581
  }
@@ -6183,7 +6593,7 @@ async function workItemsClaimCommand(workItemId, opts) {
6183
6593
  const result = await client.claimWorkItem(eid, resolvedWorkItemId, data);
6184
6594
  printWriteResult(result, `Work item ${resolvedWorkItemId} claimed by ${opts.claimedBy}.`, opts.json);
6185
6595
  } catch (err) {
6186
- printError(`Failed to claim work item: ${err}`);
6596
+ printError2(`Failed to claim work item: ${err}`);
6187
6597
  process.exit(1);
6188
6598
  }
6189
6599
  }
@@ -6201,7 +6611,7 @@ async function workItemsCompleteCommand(workItemId, opts) {
6201
6611
  const result = await client.completeWorkItem(eid, resolvedWorkItemId, data);
6202
6612
  printWriteResult(result, `Work item ${resolvedWorkItemId} completed.`, opts.json);
6203
6613
  } catch (err) {
6204
- printError(`Failed to complete work item: ${err}`);
6614
+ printError2(`Failed to complete work item: ${err}`);
6205
6615
  process.exit(1);
6206
6616
  }
6207
6617
  }
@@ -6215,7 +6625,7 @@ async function workItemsReleaseCommand(workItemId, opts) {
6215
6625
  const result = await client.releaseWorkItem(eid, resolvedWorkItemId);
6216
6626
  printWriteResult(result, `Work item ${resolvedWorkItemId} claim released.`, opts.json);
6217
6627
  } catch (err) {
6218
- printError(`Failed to release work item: ${err}`);
6628
+ printError2(`Failed to release work item: ${err}`);
6219
6629
  process.exit(1);
6220
6630
  }
6221
6631
  }
@@ -6226,10 +6636,20 @@ async function workItemsCancelCommand(workItemId, opts) {
6226
6636
  try {
6227
6637
  const eid = await resolver.resolveEntity(opts.entityId);
6228
6638
  const resolvedWorkItemId = await resolver.resolveWorkItem(eid, workItemId);
6639
+ if (!opts.yes) {
6640
+ const ok = await confirm5({
6641
+ message: `Cancel work item ${resolvedWorkItemId}?`,
6642
+ default: false
6643
+ });
6644
+ if (!ok) {
6645
+ console.log("Cancelled.");
6646
+ return;
6647
+ }
6648
+ }
6229
6649
  const result = await client.cancelWorkItem(eid, resolvedWorkItemId);
6230
6650
  printWriteResult(result, `Work item ${resolvedWorkItemId} cancelled.`, opts.json);
6231
6651
  } catch (err) {
6232
- printError(`Failed to cancel work item: ${err}`);
6652
+ printError2(`Failed to cancel work item: ${err}`);
6233
6653
  process.exit(1);
6234
6654
  }
6235
6655
  }
@@ -6265,7 +6685,7 @@ async function servicesCatalogCommand(opts) {
6265
6685
  }
6266
6686
  printServiceCatalogTable(items);
6267
6687
  } catch (err) {
6268
- printError(`Failed to list service catalog: ${err}`);
6688
+ printError2(`Failed to list service catalog: ${err}`);
6269
6689
  process.exit(1);
6270
6690
  }
6271
6691
  }
@@ -6306,7 +6726,7 @@ async function servicesBuyCommand(slug, opts) {
6306
6726
  });
6307
6727
  }
6308
6728
  } catch (err) {
6309
- printError(`Failed to create service request: ${err}`);
6729
+ printError2(`Failed to create service request: ${err}`);
6310
6730
  process.exit(1);
6311
6731
  }
6312
6732
  }
@@ -6324,7 +6744,7 @@ async function servicesListCommand(opts) {
6324
6744
  }
6325
6745
  printServiceRequestsTable(stable);
6326
6746
  } catch (err) {
6327
- printError(`Failed to list service requests: ${err}`);
6747
+ printError2(`Failed to list service requests: ${err}`);
6328
6748
  process.exit(1);
6329
6749
  }
6330
6750
  }
@@ -6345,7 +6765,7 @@ async function servicesShowCommand(ref_, opts) {
6345
6765
  printReferenceSummary("service_request", result);
6346
6766
  printJson(result);
6347
6767
  } catch (err) {
6348
- printError(`Failed to show service request: ${err}`);
6768
+ printError2(`Failed to show service request: ${err}`);
6349
6769
  process.exit(1);
6350
6770
  }
6351
6771
  }
@@ -6370,7 +6790,7 @@ async function servicesFulfillCommand(ref_, opts) {
6370
6790
  printReferenceSummary("service_request", result, { showReuseHint: true });
6371
6791
  printJson(result);
6372
6792
  } catch (err) {
6373
- printError(`Failed to fulfill service request: ${err}`);
6793
+ printError2(`Failed to fulfill service request: ${err}`);
6374
6794
  process.exit(1);
6375
6795
  }
6376
6796
  }
@@ -6394,7 +6814,7 @@ async function servicesCancelCommand(ref_, opts) {
6394
6814
  printReferenceSummary("service_request", result, { showReuseHint: true });
6395
6815
  printJson(result);
6396
6816
  } catch (err) {
6397
- printError(`Failed to cancel service request: ${err}`);
6817
+ printError2(`Failed to cancel service request: ${err}`);
6398
6818
  process.exit(1);
6399
6819
  }
6400
6820
  }
@@ -6439,7 +6859,7 @@ async function billingCommand(opts) {
6439
6859
  if (opts.json) printJson({ status: enrichedStatus, plans });
6440
6860
  else printBillingPanel(enrichedStatus, plans);
6441
6861
  } catch (err) {
6442
- printError(`Failed to fetch billing info: ${err}`);
6862
+ printError2(`Failed to fetch billing info: ${err}`);
6443
6863
  process.exit(1);
6444
6864
  }
6445
6865
  }
@@ -6449,13 +6869,13 @@ async function billingPortalCommand() {
6449
6869
  const result = await client.createBillingPortal();
6450
6870
  const url = result.portal_url;
6451
6871
  if (!url) {
6452
- printError("No portal URL returned. Ensure you have an active subscription.");
6872
+ printError2("No portal URL returned. Ensure you have an active subscription.");
6453
6873
  process.exit(1);
6454
6874
  }
6455
6875
  printSuccess("Stripe Customer Portal URL:");
6456
6876
  console.log(url);
6457
6877
  } catch (err) {
6458
- printError(`Failed to create portal session: ${err}`);
6878
+ printError2(`Failed to create portal session: ${err}`);
6459
6879
  process.exit(1);
6460
6880
  }
6461
6881
  }
@@ -6465,13 +6885,13 @@ async function billingUpgradeCommand(opts) {
6465
6885
  const result = await client.createBillingCheckout(opts.plan);
6466
6886
  const url = result.checkout_url;
6467
6887
  if (!url) {
6468
- printError("No checkout URL returned.");
6888
+ printError2("No checkout URL returned.");
6469
6889
  process.exit(1);
6470
6890
  }
6471
6891
  printSuccess(`Stripe Checkout URL for ${opts.plan}:`);
6472
6892
  console.log(url);
6473
6893
  } catch (err) {
6474
- printError(`Failed to create checkout session: ${err}`);
6894
+ printError2(`Failed to create checkout session: ${err}`);
6475
6895
  process.exit(1);
6476
6896
  }
6477
6897
  }
@@ -6490,11 +6910,24 @@ __export(approvals_exports, {
6490
6910
  approvalsListCommand: () => approvalsListCommand,
6491
6911
  approvalsRespondCommand: () => approvalsRespondCommand
6492
6912
  });
6913
+ import chalk12 from "chalk";
6493
6914
  async function approvalsListCommand(_opts) {
6494
- printError(
6495
- "Approvals are managed through governance meetings.\n Use: corp governance convene ... to schedule a board meeting\n Use: corp governance vote <meeting-ref> <item-ref> ... to cast votes"
6496
- );
6497
- process.exit(1);
6915
+ console.log(chalk12.bold("Approvals in TheCorporation"));
6916
+ console.log();
6917
+ console.log("Approvals are handled through governance meetings and execution intents.");
6918
+ console.log("Use these commands to manage approvals:");
6919
+ console.log();
6920
+ console.log(chalk12.dim(" Board approval via meeting vote:"));
6921
+ console.log(` corp governance convene --body <body> --type board_meeting --title "Approve X"`);
6922
+ console.log(` corp governance vote <meeting> <item> --voter <contact> --vote for`);
6923
+ console.log();
6924
+ console.log(chalk12.dim(" Written consent (no meeting needed):"));
6925
+ console.log(` corp governance written-consent --body <body> --title "Approve X" --description "..."`);
6926
+ console.log();
6927
+ console.log(chalk12.dim(" View pending items:"));
6928
+ console.log(` corp governance meetings <body> # see scheduled meetings`);
6929
+ console.log(` corp governance agenda-items <meeting> # see items awaiting votes`);
6930
+ console.log(` corp cap-table valuations # see pending valuations`);
6498
6931
  }
6499
6932
  async function approvalsRespondCommand(_approvalId, _decision, _opts) {
6500
6933
  printError(
@@ -6505,7 +6938,6 @@ async function approvalsRespondCommand(_approvalId, _decision, _opts) {
6505
6938
  var init_approvals = __esm({
6506
6939
  "src/commands/approvals.ts"() {
6507
6940
  "use strict";
6508
- init_output();
6509
6941
  }
6510
6942
  });
6511
6943
 
@@ -6518,8 +6950,8 @@ __export(form_exports, {
6518
6950
  formCreateCommand: () => formCreateCommand,
6519
6951
  formFinalizeCommand: () => formFinalizeCommand
6520
6952
  });
6521
- import { input as input2, select as select2, confirm as confirm2, number } from "@inquirer/prompts";
6522
- import chalk12 from "chalk";
6953
+ import { input as input2, select as select2, confirm as confirm6, number } from "@inquirer/prompts";
6954
+ import chalk13 from "chalk";
6523
6955
  import Table3 from "cli-table3";
6524
6956
  import { readFileSync as readFileSync3, realpathSync as realpathSync2 } from "fs";
6525
6957
  import { relative as relative2, resolve as resolve2 } from "path";
@@ -6529,9 +6961,9 @@ function isCorp(entityType) {
6529
6961
  }
6530
6962
  function sectionHeader(title) {
6531
6963
  console.log();
6532
- console.log(chalk12.blue("\u2500".repeat(50)));
6533
- console.log(chalk12.blue.bold(` ${title}`));
6534
- console.log(chalk12.blue("\u2500".repeat(50)));
6964
+ console.log(chalk13.blue("\u2500".repeat(50)));
6965
+ console.log(chalk13.blue.bold(` ${title}`));
6966
+ console.log(chalk13.blue("\u2500".repeat(50)));
6535
6967
  }
6536
6968
  function officerTitleLabel(title) {
6537
6969
  switch (title) {
@@ -6587,7 +7019,7 @@ function normalizeFounderInfo(input3) {
6587
7019
  throw new Error("Founder JSON requires non-empty name, email, and role.");
6588
7020
  }
6589
7021
  const founder = { name, email, role };
6590
- const ownershipPct = input3.ownership_pct ?? input3.pct;
7022
+ const ownershipPct = input3.ownership_pct ?? input3.membership_pct ?? input3.pct;
6591
7023
  if (ownershipPct != null) founder.ownership_pct = Number(ownershipPct);
6592
7024
  const sharesPurchased = input3.shares_purchased ?? input3.shares;
6593
7025
  if (sharesPurchased != null) founder.shares_purchased = Number(sharesPurchased);
@@ -6703,7 +7135,7 @@ async function phaseEntityDetails(opts, serverCfg, scripted) {
6703
7135
  let name = opts.name;
6704
7136
  if (!name) {
6705
7137
  if (scripted) {
6706
- printError("--name is required in scripted mode");
7138
+ printError2("--name is required in scripted mode");
6707
7139
  process.exit(1);
6708
7140
  }
6709
7141
  name = await input2({ message: "Legal name" });
@@ -6725,7 +7157,7 @@ async function phaseEntityDetails(opts, serverCfg, scripted) {
6725
7157
  }
6726
7158
  }
6727
7159
  if (!companyAddress && !scripted) {
6728
- const wantAddress = await confirm2({ message: "Add company address?", default: false });
7160
+ const wantAddress = await confirm6({ message: "Add company address?", default: false });
6729
7161
  if (wantAddress) {
6730
7162
  companyAddress = await promptAddress();
6731
7163
  }
@@ -6733,7 +7165,7 @@ async function phaseEntityDetails(opts, serverCfg, scripted) {
6733
7165
  const fiscalYearEnd = opts.fiscalYearEnd ?? "12-31";
6734
7166
  let sCorpElection = opts.sCorp ?? false;
6735
7167
  if (!scripted && isCorp(entityType) && opts.sCorp === void 0) {
6736
- sCorpElection = await confirm2({ message: "S-Corp election?", default: false });
7168
+ sCorpElection = await confirm6({ message: "S-Corp election?", default: false });
6737
7169
  }
6738
7170
  return { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection };
6739
7171
  }
@@ -6744,13 +7176,13 @@ async function phasePeople(opts, entityType, scripted) {
6744
7176
  try {
6745
7177
  return parseScriptedFounders(opts);
6746
7178
  } catch (err) {
6747
- printError(String(err));
7179
+ printError2(String(err));
6748
7180
  process.exit(1);
6749
7181
  }
6750
7182
  }
6751
7183
  const founderCount = await number({ message: "Number of founders (1-6)", default: 1 }) ?? 1;
6752
7184
  for (let i = 0; i < founderCount; i++) {
6753
- console.log(chalk12.dim(`
7185
+ console.log(chalk13.dim(`
6754
7186
  Founder ${i + 1} of ${founderCount}:`));
6755
7187
  const name = await input2({ message: ` Name` });
6756
7188
  const email = await input2({ message: ` Email` });
@@ -6765,11 +7197,11 @@ async function phasePeople(opts, entityType, scripted) {
6765
7197
  ]
6766
7198
  });
6767
7199
  }
6768
- const wantAddress = await confirm2({ message: " Add address?", default: false });
7200
+ const wantAddress = await confirm6({ message: " Add address?", default: false });
6769
7201
  const address = wantAddress ? await promptAddress() : void 0;
6770
7202
  let officerTitle;
6771
7203
  if (isCorp(entityType)) {
6772
- const wantOfficer = role === "officer" || await confirm2({ message: " Assign officer title?", default: i === 0 });
7204
+ const wantOfficer = role === "officer" || await confirm6({ message: " Assign officer title?", default: i === 0 });
6773
7205
  if (wantOfficer) {
6774
7206
  officerTitle = await select2({
6775
7207
  message: " Officer title",
@@ -6784,7 +7216,7 @@ async function phasePeople(opts, entityType, scripted) {
6784
7216
  if (isCorp(entityType) && i === 0 && founderCount === 1) {
6785
7217
  isIncorporator = true;
6786
7218
  } else if (isCorp(entityType)) {
6787
- isIncorporator = await confirm2({ message: " Designate as sole incorporator?", default: i === 0 });
7219
+ isIncorporator = await confirm6({ message: " Designate as sole incorporator?", default: i === 0 });
6788
7220
  }
6789
7221
  founders.push({ name, email, role, address, officer_title: officerTitle, is_incorporator: isIncorporator });
6790
7222
  }
@@ -6792,11 +7224,11 @@ async function phasePeople(opts, entityType, scripted) {
6792
7224
  }
6793
7225
  async function phaseStock(opts, entityType, founders, scripted) {
6794
7226
  if (!scripted) sectionHeader("Phase 3: Equity & Finalize");
6795
- const transferRestrictions = opts.transferRestrictions ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Transfer restrictions on shares?", default: true }) : isCorp(entityType));
6796
- const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
7227
+ const transferRestrictions = opts.transferRestrictions ?? (!scripted && isCorp(entityType) ? await confirm6({ message: "Transfer restrictions on shares?", default: true }) : isCorp(entityType));
7228
+ const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm6({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
6797
7229
  if (!scripted) {
6798
7230
  for (const f of founders) {
6799
- console.log(chalk12.dim(`
7231
+ console.log(chalk13.dim(`
6800
7232
  Equity for ${f.name}:`));
6801
7233
  if (isCorp(entityType)) {
6802
7234
  const shares = await number({ message: ` Shares to purchase`, default: 0 });
@@ -6813,7 +7245,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
6813
7245
  f.ownership_pct = pct ?? 0;
6814
7246
  }
6815
7247
  if (isCorp(entityType)) {
6816
- const wantVesting = await confirm2({ message: " Add vesting schedule?", default: false });
7248
+ const wantVesting = await confirm6({ message: " Add vesting schedule?", default: false });
6817
7249
  if (wantVesting) {
6818
7250
  const totalMonths = await number({ message: " Total vesting months", default: 48 }) ?? 48;
6819
7251
  const cliffMonths = await number({ message: " Cliff months", default: 12 }) ?? 12;
@@ -6832,7 +7264,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
6832
7264
  };
6833
7265
  }
6834
7266
  }
6835
- const wantIp = await confirm2({ message: " Contributing IP?", default: false });
7267
+ const wantIp = await confirm6({ message: " Contributing IP?", default: false });
6836
7268
  if (wantIp) {
6837
7269
  f.ip_description = await input2({ message: " Describe IP being contributed" });
6838
7270
  }
@@ -6842,17 +7274,17 @@ async function phaseStock(opts, entityType, founders, scripted) {
6842
7274
  }
6843
7275
  function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr) {
6844
7276
  sectionHeader("Formation Summary");
6845
- console.log(` ${chalk12.bold("Entity:")} ${name}`);
6846
- console.log(` ${chalk12.bold("Type:")} ${entityType}`);
6847
- console.log(` ${chalk12.bold("Jurisdiction:")} ${jurisdiction}`);
6848
- console.log(` ${chalk12.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
7277
+ console.log(` ${chalk13.bold("Entity:")} ${name}`);
7278
+ console.log(` ${chalk13.bold("Type:")} ${entityType}`);
7279
+ console.log(` ${chalk13.bold("Jurisdiction:")} ${jurisdiction}`);
7280
+ console.log(` ${chalk13.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
6849
7281
  if (isCorp(entityType)) {
6850
- console.log(` ${chalk12.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
6851
- console.log(` ${chalk12.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
6852
- console.log(` ${chalk12.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
7282
+ console.log(` ${chalk13.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
7283
+ console.log(` ${chalk13.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
7284
+ console.log(` ${chalk13.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
6853
7285
  }
6854
7286
  const table = new Table3({
6855
- head: [chalk12.dim("Name"), chalk12.dim("Email"), chalk12.dim("Role"), chalk12.dim("Equity"), chalk12.dim("Officer")]
7287
+ head: [chalk13.dim("Name"), chalk13.dim("Email"), chalk13.dim("Role"), chalk13.dim("Equity"), chalk13.dim("Officer")]
6856
7288
  });
6857
7289
  for (const f of founders) {
6858
7290
  const equity = f.shares_purchased ? `${f.shares_purchased.toLocaleString()} shares` : f.ownership_pct ? `${f.ownership_pct}%` : "\u2014";
@@ -6877,9 +7309,9 @@ async function formCommand(opts) {
6877
7309
  const founders = await phasePeople(opts, entityType, scripted);
6878
7310
  const { transferRestrictions, rofr } = await phaseStock(opts, entityType, founders, scripted);
6879
7311
  printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);
6880
- const shouldProceed = scripted ? true : await confirm2({ message: "Proceed with formation?", default: true });
7312
+ const shouldProceed = scripted ? true : await confirm6({ message: "Proceed with formation?", default: true });
6881
7313
  if (!shouldProceed) {
6882
- console.log(chalk12.yellow("Formation cancelled."));
7314
+ console.log(chalk13.yellow("Formation cancelled."));
6883
7315
  return;
6884
7316
  }
6885
7317
  const members = founders.map((f) => {
@@ -6917,6 +7349,11 @@ async function formCommand(opts) {
6917
7349
  const result = await client.createFormationWithCapTable(payload);
6918
7350
  await resolver.stabilizeRecord("entity", result);
6919
7351
  resolver.rememberFromRecord("entity", result);
7352
+ if (result.entity_id) {
7353
+ setActiveEntityId(cfg, String(result.entity_id));
7354
+ saveConfig(cfg);
7355
+ console.log(chalk13.dim(` Active entity set to ${result.entity_id}`));
7356
+ }
6920
7357
  if (opts.json) {
6921
7358
  printJson(result);
6922
7359
  return;
@@ -6935,22 +7372,22 @@ async function formCommand(opts) {
6935
7372
  if (holders.length > 0) {
6936
7373
  console.log();
6937
7374
  const table = new Table3({
6938
- head: [chalk12.dim("Holder"), chalk12.dim("Shares"), chalk12.dim("Ownership %")]
7375
+ head: [chalk13.dim("Holder"), chalk13.dim("Shares"), chalk13.dim("Ownership %")]
6939
7376
  });
6940
7377
  for (const h of holders) {
6941
7378
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
6942
7379
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
6943
7380
  }
6944
- console.log(chalk12.bold(" Cap Table:"));
7381
+ console.log(chalk13.bold(" Cap Table:"));
6945
7382
  console.log(table.toString());
6946
7383
  }
6947
7384
  if (result.next_action) {
6948
- console.log(chalk12.yellow(`
7385
+ console.log(chalk13.yellow(`
6949
7386
  Next: ${result.next_action}`));
6950
7387
  }
6951
7388
  } catch (err) {
6952
7389
  if (err instanceof Error && err.message.includes("exit")) throw err;
6953
- printError(`Failed to create formation: ${err}`);
7390
+ printError2(`Failed to create formation: ${err}`);
6954
7391
  process.exit(1);
6955
7392
  }
6956
7393
  }
@@ -7006,6 +7443,10 @@ async function formCreateCommand(opts) {
7006
7443
  const result = await client.createPendingEntity(payload);
7007
7444
  await resolver.stabilizeRecord("entity", result);
7008
7445
  resolver.rememberFromRecord("entity", result);
7446
+ if (result.entity_id) {
7447
+ setActiveEntityId(cfg, String(result.entity_id));
7448
+ saveConfig(cfg);
7449
+ }
7009
7450
  if (opts.json) {
7010
7451
  printJson(result);
7011
7452
  return;
@@ -7016,10 +7457,10 @@ async function formCreateCommand(opts) {
7016
7457
  console.log(` Type: ${result.entity_type}`);
7017
7458
  console.log(` Jurisdiction: ${result.jurisdiction}`);
7018
7459
  console.log(` Status: ${result.formation_status}`);
7019
- console.log(chalk12.yellow(`
7460
+ console.log(chalk13.yellow(`
7020
7461
  Next: corp form add-founder @last:entity --name "..." --email "..." --role member --pct 50`));
7021
7462
  } catch (err) {
7022
- printError(`Failed to create pending entity: ${err}`);
7463
+ printError2(`Failed to create pending entity: ${err}`);
7023
7464
  process.exit(1);
7024
7465
  }
7025
7466
  }
@@ -7054,10 +7495,10 @@ async function formAddFounderCommand(entityId, opts) {
7054
7495
  const pct = typeof m.ownership_pct === "number" ? ` (${m.ownership_pct}%)` : "";
7055
7496
  console.log(` - ${m.name} <${m.email ?? "no email"}> [${m.role ?? "member"}]${pct}`);
7056
7497
  }
7057
- console.log(chalk12.yellow(`
7498
+ console.log(chalk13.yellow(`
7058
7499
  Next: add more founders or run: corp form finalize @last:entity`));
7059
7500
  } catch (err) {
7060
- printError(`Failed to add founder: ${err}`);
7501
+ printError2(`Failed to add founder: ${err}`);
7061
7502
  process.exit(1);
7062
7503
  }
7063
7504
  }
@@ -7118,21 +7559,21 @@ async function formFinalizeCommand(entityId, opts) {
7118
7559
  if (holders.length > 0) {
7119
7560
  console.log();
7120
7561
  const table = new Table3({
7121
- head: [chalk12.dim("Holder"), chalk12.dim("Shares"), chalk12.dim("Ownership %")]
7562
+ head: [chalk13.dim("Holder"), chalk13.dim("Shares"), chalk13.dim("Ownership %")]
7122
7563
  });
7123
7564
  for (const h of holders) {
7124
7565
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
7125
7566
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
7126
7567
  }
7127
- console.log(chalk12.bold(" Cap Table:"));
7568
+ console.log(chalk13.bold(" Cap Table:"));
7128
7569
  console.log(table.toString());
7129
7570
  }
7130
7571
  if (result.next_action) {
7131
- console.log(chalk12.yellow(`
7572
+ console.log(chalk13.yellow(`
7132
7573
  Next: ${result.next_action}`));
7133
7574
  }
7134
7575
  } catch (err) {
7135
- printError(`Failed to finalize formation: ${err}`);
7576
+ printError2(`Failed to finalize formation: ${err}`);
7136
7577
  process.exit(1);
7137
7578
  }
7138
7579
  }
@@ -7179,9 +7620,8 @@ async function formActivateCommand(entityId, opts) {
7179
7620
  }
7180
7621
  console.log(` Signatures added: ${result.signatures_added}`);
7181
7622
  console.log(` Documents updated: ${result.documents_signed}`);
7182
- printJson(formation);
7183
7623
  } catch (err) {
7184
- printError(`Failed to activate formation: ${err}`);
7624
+ printError2(`Failed to activate formation: ${err}`);
7185
7625
  process.exit(1);
7186
7626
  }
7187
7627
  }
@@ -7199,43 +7639,87 @@ var init_form = __esm({
7199
7639
  // src/commands/api-keys.ts
7200
7640
  var api_keys_exports = {};
7201
7641
  __export(api_keys_exports, {
7202
- apiKeysCommand: () => apiKeysCommand
7642
+ apiKeysCreateCommand: () => apiKeysCreateCommand,
7643
+ apiKeysListCommand: () => apiKeysListCommand,
7644
+ apiKeysRevokeCommand: () => apiKeysRevokeCommand,
7645
+ apiKeysRotateCommand: () => apiKeysRotateCommand
7203
7646
  });
7204
- import chalk13 from "chalk";
7205
- import Table4 from "cli-table3";
7206
- async function apiKeysCommand(opts) {
7647
+ import { confirm as confirm7 } from "@inquirer/prompts";
7648
+ async function apiKeysListCommand(opts) {
7207
7649
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
7208
7650
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
7209
7651
  try {
7210
7652
  const keys = await client.listApiKeys();
7211
7653
  if (opts.json) {
7212
- printJson(keys.map((k) => ({
7213
- ...k,
7214
- ...k.key != null ? { key: maskKey(String(k.key)) } : {},
7215
- ...k.api_key != null ? { api_key: maskKey(String(k.api_key)) } : {}
7216
- })));
7654
+ printJson(keys);
7217
7655
  return;
7218
7656
  }
7219
7657
  if (keys.length === 0) {
7220
7658
  console.log("No API keys found.");
7221
7659
  return;
7222
7660
  }
7223
- console.log(`
7224
- ${chalk13.bold("API Keys")}`);
7225
- const table = new Table4({
7226
- head: [chalk13.dim("ID"), chalk13.dim("Name"), chalk13.dim("Key"), chalk13.dim("Created")]
7227
- });
7228
7661
  for (const k of keys) {
7229
- table.push([
7230
- String(k.key_id ?? k.id ?? k.api_key_id ?? "").slice(0, 12),
7231
- String(k.name ?? ""),
7232
- maskKey(String(k.key ?? k.api_key ?? "")),
7233
- String(k.created_at ?? "")
7234
- ]);
7662
+ const name = k.name ?? k.label ?? "unnamed";
7663
+ const id = k.key_id ?? k.id;
7664
+ const scopes = Array.isArray(k.scopes) ? k.scopes.join(", ") : "all";
7665
+ console.log(` ${name} [${id}] scopes: ${scopes}`);
7666
+ }
7667
+ } catch (err) {
7668
+ printError2(`Failed to list API keys: ${err}`);
7669
+ process.exit(1);
7670
+ }
7671
+ }
7672
+ async function apiKeysCreateCommand(opts) {
7673
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
7674
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
7675
+ try {
7676
+ const data = { name: opts.name };
7677
+ if (opts.scopes) data.scopes = opts.scopes.split(",").map((s2) => s2.trim());
7678
+ const result = await client.createApiKey(data);
7679
+ printWriteResult(result, `API key created: ${result.key_id ?? "OK"}`, opts.json);
7680
+ if (!opts.json && result.api_key) {
7681
+ printSuccess(`Key: ${result.api_key}`);
7682
+ console.log(" Save this key \u2014 it will not be shown again.");
7235
7683
  }
7236
- console.log(table.toString());
7237
7684
  } catch (err) {
7238
- printError(`Failed to fetch API keys: ${err}`);
7685
+ printError2(`Failed to create API key: ${err}`);
7686
+ process.exit(1);
7687
+ }
7688
+ }
7689
+ async function apiKeysRevokeCommand(keyId, opts) {
7690
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
7691
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
7692
+ try {
7693
+ if (!opts.yes) {
7694
+ const ok = await confirm7({ message: `Revoke API key ${keyId}? This cannot be undone.`, default: false });
7695
+ if (!ok) {
7696
+ console.log("Cancelled.");
7697
+ return;
7698
+ }
7699
+ }
7700
+ await client.revokeApiKey(keyId);
7701
+ if (opts.json) {
7702
+ printJson({ revoked: true, key_id: keyId });
7703
+ return;
7704
+ }
7705
+ printSuccess(`API key ${keyId} revoked.`);
7706
+ } catch (err) {
7707
+ printError2(`Failed to revoke API key: ${err}`);
7708
+ process.exit(1);
7709
+ }
7710
+ }
7711
+ async function apiKeysRotateCommand(keyId, opts) {
7712
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
7713
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
7714
+ try {
7715
+ const result = await client.rotateApiKey(keyId);
7716
+ printWriteResult(result, `API key ${keyId} rotated.`, opts.json);
7717
+ if (!opts.json && result.api_key) {
7718
+ printSuccess(`New key: ${result.api_key}`);
7719
+ console.log(" Save this key \u2014 it will not be shown again.");
7720
+ }
7721
+ } catch (err) {
7722
+ printError2(`Failed to rotate API key: ${err}`);
7239
7723
  process.exit(1);
7240
7724
  }
7241
7725
  }
@@ -7484,7 +7968,7 @@ async function demoCommand(opts) {
7484
7968
  printReferenceSummary("bank_account", bankAccount, { showReuseHint: true });
7485
7969
  printJson(result);
7486
7970
  } catch (err) {
7487
- printError(`Failed to seed demo: ${err}`);
7971
+ printError2(`Failed to seed demo: ${err}`);
7488
7972
  process.exit(1);
7489
7973
  }
7490
7974
  }
@@ -7508,11 +7992,11 @@ __export(feedback_exports, {
7508
7992
  import chalk14 from "chalk";
7509
7993
  async function feedbackCommand(message, opts) {
7510
7994
  if (!message || message.trim().length === 0) {
7511
- printError("Feedback message cannot be empty");
7995
+ printError2("Feedback message cannot be empty");
7512
7996
  process.exit(1);
7513
7997
  }
7514
7998
  if (message.length > MAX_FEEDBACK_LENGTH) {
7515
- printError(`Feedback message must be at most ${MAX_FEEDBACK_LENGTH} characters (got ${message.length})`);
7999
+ printError2(`Feedback message must be at most ${MAX_FEEDBACK_LENGTH} characters (got ${message.length})`);
7516
8000
  process.exit(1);
7517
8001
  }
7518
8002
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -7528,12 +8012,12 @@ ${chalk14.green("\u2713")} Feedback submitted (${chalk14.dim(result.feedback_id)
7528
8012
  } catch (err) {
7529
8013
  const detail = String(err);
7530
8014
  if (detail.includes("404")) {
7531
- printError(
8015
+ printError2(
7532
8016
  `Failed to submit feedback: ${detail}
7533
8017
  This server does not expose /v1/feedback. Local api-rs dev servers currently do not support feedback submission.`
7534
8018
  );
7535
8019
  } else {
7536
- printError(`Failed to submit feedback: ${detail}`);
8020
+ printError2(`Failed to submit feedback: ${detail}`);
7537
8021
  }
7538
8022
  process.exit(1);
7539
8023
  }
@@ -7618,24 +8102,30 @@ function inheritOption(localValue, parentValue) {
7618
8102
  // src/index.ts
7619
8103
  var require2 = createRequire(import.meta.url);
7620
8104
  var pkg = require2("../package.json");
7621
- var TAX_DOCUMENT_TYPE_CHOICES = [
8105
+ var TAX_DOCUMENT_TYPE_DISPLAY = [
7622
8106
  "1120",
7623
8107
  "1120s",
7624
8108
  "1065",
7625
8109
  "franchise_tax",
7626
8110
  "annual_report",
7627
8111
  "83b",
7628
- "form_1120",
7629
- "form_1120s",
7630
- "form_1065",
7631
8112
  "1099_nec",
7632
- "form_1099_nec",
7633
8113
  "k1",
7634
- "form_k1",
7635
8114
  "941",
7636
- "form_941",
7637
- "w2",
7638
- "form_w2"
8115
+ "w2"
8116
+ ];
8117
+ var TAX_DOCUMENT_TYPE_ALIASES = {
8118
+ form_1120: "1120",
8119
+ form_1120s: "1120s",
8120
+ form_1065: "1065",
8121
+ form_1099_nec: "1099_nec",
8122
+ form_k1: "k1",
8123
+ form_941: "941",
8124
+ form_w2: "w2"
8125
+ };
8126
+ var TAX_DOCUMENT_TYPE_CHOICES = [
8127
+ ...TAX_DOCUMENT_TYPE_DISPLAY,
8128
+ ...Object.keys(TAX_DOCUMENT_TYPE_ALIASES)
7639
8129
  ];
7640
8130
  var FINALIZE_ITEM_STATUS_CHOICES = [
7641
8131
  "discussed",
@@ -7645,6 +8135,7 @@ var FINALIZE_ITEM_STATUS_CHOICES = [
7645
8135
  ];
7646
8136
  var program = new Command();
7647
8137
  program.name("corp").description("corp \u2014 Corporate governance from the terminal").version(pkg.version);
8138
+ program.option("-q, --quiet", "Only output the resource ID (for scripting)");
7648
8139
  program.command("setup").description("Interactive setup wizard").action(async () => {
7649
8140
  const { setupCommand: setupCommand2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
7650
8141
  await setupCommand2();
@@ -7657,6 +8148,10 @@ program.command("context").alias("whoami").description("Show the active workspac
7657
8148
  const { contextCommand: contextCommand2 } = await Promise.resolve().then(() => (init_context(), context_exports));
7658
8149
  await contextCommand2(opts);
7659
8150
  });
8151
+ program.command("use <entity-ref>").description("Set the active entity by name, short ID, or reference").action(async (entityRef) => {
8152
+ const { useCommand: useCommand2 } = await Promise.resolve().then(() => (init_use(), use_exports));
8153
+ await useCommand2(entityRef);
8154
+ });
7660
8155
  program.command("schema").description("Dump the CLI command catalog as JSON").option("--compact", "Emit compact JSON").action(async (opts) => {
7661
8156
  const { schemaCommand: schemaCommand2 } = await Promise.resolve().then(() => (init_schema(), schema_exports));
7662
8157
  schemaCommand2(program, opts);
@@ -7718,7 +8213,7 @@ entitiesCmd.command("convert <entity-ref>").requiredOption("--to <type>", "Targe
7718
8213
  const { entitiesConvertCommand: entitiesConvertCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
7719
8214
  await entitiesConvertCommand2(entityId, opts);
7720
8215
  });
7721
- entitiesCmd.command("dissolve <entity-ref>").requiredOption("--reason <reason>", "Dissolution reason").option("--effective-date <date>", "Effective date (ISO 8601)").description("Dissolve an entity").action(async (entityId, opts) => {
8216
+ entitiesCmd.command("dissolve <entity-ref>").requiredOption("--reason <reason>", "Dissolution reason").option("--effective-date <date>", "Effective date (ISO 8601)").option("--yes, -y", "Skip confirmation prompt").description("Dissolve an entity").action(async (entityId, opts) => {
7722
8217
  const { entitiesDissolveCommand: entitiesDissolveCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
7723
8218
  await entitiesDissolveCommand2(entityId, opts);
7724
8219
  });
@@ -7757,40 +8252,61 @@ var capTableCmd = program.command("cap-table").description("Cap table, equity gr
7757
8252
  const { capTableCommand: capTableCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7758
8253
  await capTableCommand2(opts);
7759
8254
  });
7760
- capTableCmd.command("safes").description("SAFE notes").action(async (_opts, cmd) => {
8255
+ capTableCmd.command("safes").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("SAFE notes").action(async (opts, cmd) => {
7761
8256
  const parent = cmd.parent.opts();
7762
8257
  const { safesCommand: safesCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7763
- await safesCommand2(parent);
8258
+ await safesCommand2({
8259
+ entityId: opts.entityId ?? parent.entityId,
8260
+ json: inheritOption(opts.json, parent.json)
8261
+ });
7764
8262
  });
7765
- capTableCmd.command("transfers").description("Share transfers").action(async (_opts, cmd) => {
8263
+ capTableCmd.command("transfers").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Share transfers").action(async (opts, cmd) => {
7766
8264
  const parent = cmd.parent.opts();
7767
8265
  const { transfersCommand: transfersCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7768
- await transfersCommand2(parent);
8266
+ await transfersCommand2({
8267
+ entityId: opts.entityId ?? parent.entityId,
8268
+ json: inheritOption(opts.json, parent.json)
8269
+ });
7769
8270
  });
7770
- capTableCmd.command("instruments").description("Cap table instruments").action(async (_opts, cmd) => {
8271
+ capTableCmd.command("instruments").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Cap table instruments").action(async (opts, cmd) => {
7771
8272
  const parent = cmd.parent.opts();
7772
8273
  const { instrumentsCommand: instrumentsCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7773
- await instrumentsCommand2(parent);
8274
+ await instrumentsCommand2({
8275
+ entityId: opts.entityId ?? parent.entityId,
8276
+ json: inheritOption(opts.json, parent.json)
8277
+ });
7774
8278
  });
7775
- capTableCmd.command("share-classes").description("Share classes").action(async (_opts, cmd) => {
8279
+ capTableCmd.command("share-classes").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Share classes").action(async (opts, cmd) => {
7776
8280
  const parent = cmd.parent.opts();
7777
8281
  const { shareClassesCommand: shareClassesCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7778
- await shareClassesCommand2(parent);
8282
+ await shareClassesCommand2({
8283
+ entityId: opts.entityId ?? parent.entityId,
8284
+ json: inheritOption(opts.json, parent.json)
8285
+ });
7779
8286
  });
7780
- capTableCmd.command("rounds").description("Staged equity rounds").action(async (_opts, cmd) => {
8287
+ capTableCmd.command("rounds").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Staged equity rounds").action(async (opts, cmd) => {
7781
8288
  const parent = cmd.parent.opts();
7782
8289
  const { roundsCommand: roundsCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7783
- await roundsCommand2(parent);
8290
+ await roundsCommand2({
8291
+ entityId: opts.entityId ?? parent.entityId,
8292
+ json: inheritOption(opts.json, parent.json)
8293
+ });
7784
8294
  });
7785
- capTableCmd.command("valuations").description("Valuations history").action(async (_opts, cmd) => {
8295
+ capTableCmd.command("valuations").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Valuations history").action(async (opts, cmd) => {
7786
8296
  const parent = cmd.parent.opts();
7787
8297
  const { valuationsCommand: valuationsCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7788
- await valuationsCommand2(parent);
8298
+ await valuationsCommand2({
8299
+ entityId: opts.entityId ?? parent.entityId,
8300
+ json: inheritOption(opts.json, parent.json)
8301
+ });
7789
8302
  });
7790
- capTableCmd.command("409a").description("Current 409A valuation").action(async (_opts, cmd) => {
8303
+ capTableCmd.command("409a").option("--entity-id <ref>", "Entity reference").option("--json", "Output as JSON").description("Current 409A valuation").action(async (opts, cmd) => {
7791
8304
  const parent = cmd.parent.opts();
7792
8305
  const { fourOhNineACommand: fourOhNineACommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7793
- await fourOhNineACommand2(parent);
8306
+ await fourOhNineACommand2({
8307
+ entityId: opts.entityId ?? parent.entityId,
8308
+ json: inheritOption(opts.json, parent.json)
8309
+ });
7794
8310
  });
7795
8311
  capTableCmd.command("create-instrument").requiredOption("--kind <kind>", "Instrument kind (common_equity, preferred_equity, membership_unit, option_grant, safe)").requiredOption("--symbol <symbol>", "Instrument symbol").option("--issuer-legal-entity-id <ref>", "Issuer legal entity reference (ID, short ID, @last, or unique name)").option("--authorized-units <n>", "Authorized units", parseInt).option("--issue-price-cents <n>", "Issue price in cents", parseInt).option("--terms-json <json>", "JSON object of instrument terms").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the instrument").description("Create a cap table instrument").action(async (opts, cmd) => {
7796
8312
  const parent = cmd.parent.opts();
@@ -7810,11 +8326,13 @@ capTableCmd.command("issue-equity").requiredOption("--grant-type <type>", "Grant
7810
8326
  json: inheritOption(opts.json, parent.json)
7811
8327
  });
7812
8328
  });
7813
- capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor name").requiredOption("--amount <n>", "Principal amount in cents", parseInt).option("--safe-type <type>", "SAFE type", "post_money").requiredOption("--valuation-cap <n>", "Valuation cap in cents", parseInt).option("--meeting-id <ref>", "Board meeting reference required when issuing under a board-governed entity").option("--resolution-id <ref>", "Board resolution reference required when issuing under a board-governed entity").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the round").description("Issue a SAFE note").action(async (opts, cmd) => {
8329
+ capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor name").requiredOption("--amount-cents <n>", "Principal amount in cents (e.g. 5000000000 = $50M)", parseInt).option("--amount <n>", "", parseInt).option("--safe-type <type>", "SAFE type", "post_money").requiredOption("--valuation-cap-cents <n>", "Valuation cap in cents (e.g. 1000000000 = $10M)", parseInt).option("--valuation-cap <n>", "", parseInt).option("--meeting-id <ref>", "Board meeting reference required when issuing under a board-governed entity").option("--resolution-id <ref>", "Board resolution reference required when issuing under a board-governed entity").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the round").description("Issue a SAFE note").action(async (opts, cmd) => {
7814
8330
  const parent = cmd.parent.opts();
7815
8331
  const { issueSafeCommand: issueSafeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7816
8332
  await issueSafeCommand2({
7817
8333
  ...opts,
8334
+ amountCents: opts.amountCents ?? opts.amount,
8335
+ valuationCapCents: opts.valuationCapCents ?? opts.valuationCap,
7818
8336
  entityId: parent.entityId,
7819
8337
  json: inheritOption(opts.json, parent.json)
7820
8338
  });
@@ -7828,11 +8346,12 @@ capTableCmd.command("transfer").requiredOption("--from <ref>", "Source contact r
7828
8346
  json: inheritOption(opts.json, parent.json)
7829
8347
  });
7830
8348
  });
7831
- capTableCmd.command("distribute").requiredOption("--amount <n>", "Total distribution amount in cents", parseInt).option("--type <type>", "Distribution type (dividend, return, liquidation)", "dividend").requiredOption("--description <desc>", "Distribution description").option("--json", "Output as JSON").option("--dry-run", "Show the request without calculating the distribution").description("Calculate a distribution").action(async (opts, cmd) => {
8349
+ capTableCmd.command("distribute").requiredOption("--amount-cents <n>", "Total distribution amount in cents (e.g. 100000 = $1,000.00)", parseInt).option("--amount <n>", "", parseInt).option("--type <type>", "Distribution type (dividend, return, liquidation)", "dividend").requiredOption("--description <desc>", "Distribution description").option("--json", "Output as JSON").option("--dry-run", "Show the request without calculating the distribution").description("Calculate a distribution").action(async (opts, cmd) => {
7832
8350
  const parent = cmd.parent.opts();
7833
8351
  const { distributeCommand: distributeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
7834
8352
  await distributeCommand2({
7835
8353
  ...opts,
8354
+ amountCents: opts.amountCents ?? opts.amount,
7836
8355
  entityId: parent.entityId,
7837
8356
  json: inheritOption(opts.json, parent.json)
7838
8357
  });
@@ -7893,6 +8412,50 @@ capTableCmd.command("approve-valuation <valuation-ref>").option("--resolution-id
7893
8412
  json: inheritOption(opts.json, parent.json)
7894
8413
  });
7895
8414
  });
8415
+ capTableCmd.command("preview-conversion").requiredOption("--safe-id <ref>", "SAFE note reference to convert").requiredOption("--price-per-share-cents <n>", "Conversion price per share in cents", parseInt).option("--json", "Output as JSON").description("Preview SAFE-to-equity conversion").action(async (opts, cmd) => {
8416
+ const parent = cmd.parent.opts();
8417
+ const { previewConversionCommand: previewConversionCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
8418
+ await previewConversionCommand2({
8419
+ ...opts,
8420
+ entityId: parent.entityId,
8421
+ json: inheritOption(opts.json, parent.json)
8422
+ });
8423
+ });
8424
+ capTableCmd.command("convert").requiredOption("--safe-id <ref>", "SAFE note reference to convert").requiredOption("--price-per-share-cents <n>", "Conversion price per share in cents", parseInt).option("--json", "Output as JSON").option("--dry-run", "Show the request without executing").description("Execute SAFE-to-equity conversion").action(async (opts, cmd) => {
8425
+ const parent = cmd.parent.opts();
8426
+ const { executeConversionCommand: executeConversionCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
8427
+ await executeConversionCommand2({
8428
+ ...opts,
8429
+ entityId: parent.entityId,
8430
+ json: inheritOption(opts.json, parent.json)
8431
+ });
8432
+ });
8433
+ capTableCmd.command("dilution").requiredOption("--round-id <ref>", "Round reference to model dilution for").option("--json", "Output as JSON").description("Preview dilution impact of a round").action(async (opts, cmd) => {
8434
+ const parent = cmd.parent.opts();
8435
+ const { dilutionPreviewCommand: dilutionPreviewCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
8436
+ await dilutionPreviewCommand2({
8437
+ ...opts,
8438
+ entityId: parent.entityId,
8439
+ json: inheritOption(opts.json, parent.json)
8440
+ });
8441
+ });
8442
+ capTableCmd.command("control-map").option("--root-entity-id <ref>", "Root entity for ownership tree (defaults to active entity)").option("--json", "Output as JSON").description("View entity control/ownership map").action(async (opts, cmd) => {
8443
+ const parent = cmd.parent.opts();
8444
+ const { controlMapCommand: controlMapCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
8445
+ await controlMapCommand2({
8446
+ ...opts,
8447
+ entityId: parent.entityId,
8448
+ json: inheritOption(opts.json, parent.json)
8449
+ });
8450
+ });
8451
+ capTableCmd.addHelpText("after", `
8452
+ Examples:
8453
+ $ corp cap-table # view full cap table
8454
+ $ corp cap-table issue-equity --grant-type common --shares 1000000 --recipient "Alice Smith"
8455
+ $ corp cap-table issue-safe --investor "Seed Fund" --amount-cents 50000000 --valuation-cap-cents 1000000000
8456
+ $ corp cap-table create-valuation --type four_oh_nine_a --date 2026-01-01 --methodology market
8457
+ $ corp cap-table transfer --from alice --to bob --shares 1000 --share-class-id COMMON --governing-doc-type bylaws --transferee-rights full_member
8458
+ `);
7896
8459
  var financeCmd = program.command("finance").description("Invoicing, payroll, payments, banking").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON").action(async (opts) => {
7897
8460
  const { financeSummaryCommand: financeSummaryCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
7898
8461
  await financeSummaryCommand2(opts);
@@ -7906,11 +8469,12 @@ financeCmd.command("invoices").option("--json", "Output as JSON").description("L
7906
8469
  json: inheritOption(opts.json, parent.json)
7907
8470
  });
7908
8471
  });
7909
- financeCmd.command("invoice").requiredOption("--customer <name>", "Customer name").requiredOption("--amount <n>", "Amount in cents", parseInt).requiredOption("--due-date <date>", "Due date (ISO 8601)").option("--description <desc>", "Description", "Services rendered").option("--json", "Output as JSON").description("Create an invoice").action(async (opts, cmd) => {
8472
+ financeCmd.command("invoice").requiredOption("--customer <name>", "Customer name").requiredOption("--amount-cents <n>", "Amount in cents (e.g. 500000 = $5,000.00)", parseInt).option("--amount <n>", "", parseInt).requiredOption("--due-date <date>", "Due date (ISO 8601)").option("--description <desc>", "Description", "Services rendered").option("--json", "Output as JSON").description("Create an invoice").action(async (opts, cmd) => {
7910
8473
  const parent = cmd.parent.opts();
7911
8474
  const { financeInvoiceCommand: financeInvoiceCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
7912
8475
  await financeInvoiceCommand2({
7913
8476
  ...opts,
8477
+ amountCents: opts.amountCents ?? opts.amount,
7914
8478
  entityId: parent.entityId,
7915
8479
  json: inheritOption(opts.json, parent.json)
7916
8480
  });
@@ -7942,11 +8506,12 @@ financeCmd.command("payments").option("--json", "Output as JSON").description("L
7942
8506
  json: inheritOption(opts.json, parent.json)
7943
8507
  });
7944
8508
  });
7945
- financeCmd.command("pay").requiredOption("--amount <n>", "Amount in cents", parseInt).requiredOption("--recipient <name>", "Recipient name").option("--method <method>", "Payment method", "ach").option("--json", "Output as JSON").description("Submit a payment").action(async (opts, cmd) => {
8509
+ financeCmd.command("pay").requiredOption("--amount-cents <n>", "Amount in cents (e.g. 500000 = $5,000.00)", parseInt).option("--amount <n>", "", parseInt).requiredOption("--recipient <name>", "Recipient name").option("--method <method>", "Payment method", "ach").option("--json", "Output as JSON").description("Submit a payment").action(async (opts, cmd) => {
7946
8510
  const parent = cmd.parent.opts();
7947
8511
  const { financePayCommand: financePayCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
7948
8512
  await financePayCommand2({
7949
8513
  ...opts,
8514
+ amountCents: opts.amountCents ?? opts.amount,
7950
8515
  entityId: parent.entityId,
7951
8516
  json: inheritOption(opts.json, parent.json)
7952
8517
  });
@@ -7969,6 +8534,15 @@ financeCmd.command("open-account").option("--institution <name>", "Banking insti
7969
8534
  json: inheritOption(opts.json, parent.json)
7970
8535
  });
7971
8536
  });
8537
+ financeCmd.command("activate-account <account-ref>").option("--json", "Output as JSON").description("Activate a bank account (transitions from pending_review to active)").action(async (accountRef, opts, cmd) => {
8538
+ const parent = cmd.parent.opts();
8539
+ const { financeActivateAccountCommand: financeActivateAccountCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
8540
+ await financeActivateAccountCommand2(accountRef, {
8541
+ ...opts,
8542
+ entityId: parent.entityId,
8543
+ json: inheritOption(opts.json, parent.json)
8544
+ });
8545
+ });
7972
8546
  financeCmd.command("classifications").option("--json", "Output as JSON").description("List contractor classifications").action(async (opts, cmd) => {
7973
8547
  const parent = cmd.parent.opts();
7974
8548
  const { financeClassificationsCommand: financeClassificationsCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
@@ -8014,6 +8588,24 @@ financeCmd.command("distributions").option("--json", "Output as JSON").descripti
8014
8588
  json: inheritOption(opts.json, parent.json)
8015
8589
  });
8016
8590
  });
8591
+ financeCmd.command("statements").option("--period <period>", "Period (e.g. 2026-Q1, 2025)").option("--json", "Output as JSON").description("View financial statements (P&L, balance sheet)").action(async (opts, cmd) => {
8592
+ const parent = cmd.parent.opts();
8593
+ const { financeStatementsCommand: financeStatementsCommand2 } = await Promise.resolve().then(() => (init_finance(), finance_exports));
8594
+ await financeStatementsCommand2({
8595
+ ...opts,
8596
+ entityId: parent.entityId,
8597
+ json: inheritOption(opts.json, parent.json)
8598
+ });
8599
+ });
8600
+ financeCmd.addHelpText("after", `
8601
+ Examples:
8602
+ $ corp finance # financial summary
8603
+ $ corp finance invoice --customer "Client Co" --amount-cents 500000 --due-date 2026-04-01
8604
+ $ corp finance pay --amount-cents 250000 --recipient "Vendor" --method ach
8605
+ $ corp finance payroll --period-start 2026-03-01 --period-end 2026-03-15
8606
+ $ corp finance open-account --institution Mercury
8607
+ $ corp finance statements --period 2026-Q1
8608
+ `);
8017
8609
  var governanceCmd = program.command("governance").description("Governance bodies, seats, meetings, resolutions").option("--entity-id <ref>", "Entity reference (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
8018
8610
  const { governanceListCommand: governanceListCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8019
8611
  await governanceListCommand2(opts);
@@ -8106,7 +8698,7 @@ governanceCmd.command("reopen <meeting-ref>").option("--json", "Output as JSON")
8106
8698
  json: inheritOption(opts.json, parent.json)
8107
8699
  });
8108
8700
  });
8109
- governanceCmd.command("cancel <meeting-ref>").option("--json", "Output as JSON").option("--dry-run", "Show the request without cancelling the meeting").description("Cancel a meeting").action(async (meetingId, opts, cmd) => {
8701
+ governanceCmd.command("cancel <meeting-ref>").option("--json", "Output as JSON").option("--dry-run", "Show the request without cancelling the meeting").option("--yes, -y", "Skip confirmation prompt").description("Cancel a meeting").action(async (meetingId, opts, cmd) => {
8110
8702
  const parent = cmd.parent.opts();
8111
8703
  const { cancelMeetingCommand: cancelMeetingCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8112
8704
  await cancelMeetingCommand2(meetingId, {
@@ -8152,6 +8744,56 @@ governanceCmd.command("written-consent").requiredOption("--body <ref>", "Governa
8152
8744
  json: inheritOption(opts.json, parent.json)
8153
8745
  });
8154
8746
  });
8747
+ governanceCmd.command("mode").addOption(new Option("--set <mode>", "Set governance mode").choices(["founder", "board", "executive", "normal", "incident_lockdown"])).option("--json", "Output as JSON").description("View or set governance mode").action(async (opts, cmd) => {
8748
+ const parent = cmd.parent.opts();
8749
+ const { governanceModeCommand: governanceModeCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8750
+ await governanceModeCommand2({
8751
+ ...opts,
8752
+ entityId: parent.entityId,
8753
+ json: inheritOption(opts.json, parent.json)
8754
+ });
8755
+ });
8756
+ governanceCmd.command("resign <seat-ref>").option("--body-id <ref>", "Governance body reference").option("--json", "Output as JSON").description("Resign from a governance seat").action(async (seatRef, opts, cmd) => {
8757
+ const parent = cmd.parent.opts();
8758
+ const { governanceResignCommand: governanceResignCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8759
+ await governanceResignCommand2(seatRef, {
8760
+ ...opts,
8761
+ entityId: parent.entityId,
8762
+ json: inheritOption(opts.json, parent.json)
8763
+ });
8764
+ });
8765
+ governanceCmd.command("incidents").option("--json", "Output as JSON").description("List governance incidents").action(async (opts, cmd) => {
8766
+ const parent = cmd.parent.opts();
8767
+ const { governanceIncidentsCommand: governanceIncidentsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8768
+ await governanceIncidentsCommand2({
8769
+ ...opts,
8770
+ entityId: parent.entityId,
8771
+ json: inheritOption(opts.json, parent.json)
8772
+ });
8773
+ });
8774
+ governanceCmd.command("profile").option("--json", "Output as JSON").description("View governance profile and configuration").action(async (opts, cmd) => {
8775
+ const parent = cmd.parent.opts();
8776
+ const { governanceProfileCommand: governanceProfileCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
8777
+ await governanceProfileCommand2({
8778
+ ...opts,
8779
+ entityId: parent.entityId,
8780
+ json: inheritOption(opts.json, parent.json)
8781
+ });
8782
+ });
8783
+ governanceCmd.addHelpText("after", `
8784
+ Examples:
8785
+ $ corp governance create-body --name "Board of Directors" --body-type board_of_directors
8786
+ $ corp governance add-seat @last:body --holder "alice"
8787
+ $ corp governance convene --body board --type board_meeting --title "Q1 Review" --agenda "Approve budget"
8788
+ $ corp governance open @last:meeting --present-seat alice-seat
8789
+ $ corp governance vote @last:meeting <item-ref> --voter alice --vote for
8790
+ $ corp governance written-consent --body board --title "Approve Option Plan" --description "Board approves 2026 option plan"
8791
+ $ corp governance mode
8792
+ $ corp governance mode --set board
8793
+ $ corp governance resign <seat-ref>
8794
+ $ corp governance incidents
8795
+ $ corp governance profile
8796
+ `);
8155
8797
  var documentsCmd = program.command("documents").description("Documents and signing").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON").action(async (opts) => {
8156
8798
  const { documentsListCommand: documentsListCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
8157
8799
  await documentsListCommand2(opts);
@@ -8197,7 +8839,10 @@ documentsCmd.command("preview-pdf").option("--definition-id <id>", "AST document
8197
8839
  entityId: parent.entityId
8198
8840
  });
8199
8841
  });
8200
- var taxCmd = program.command("tax").description("Tax filings and deadline tracking").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON");
8842
+ var taxCmd = program.command("tax").description("Tax filings and deadline tracking").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON").action(async (opts) => {
8843
+ const { taxSummaryCommand: taxSummaryCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
8844
+ await taxSummaryCommand2(opts);
8845
+ });
8201
8846
  taxCmd.command("filings").option("--json", "Output as JSON").description("List tax filings").action(async (opts, cmd) => {
8202
8847
  const parent = cmd.parent.opts();
8203
8848
  const { taxFilingsCommand: taxFilingsCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
@@ -8207,7 +8852,9 @@ taxCmd.command("filings").option("--json", "Output as JSON").description("List t
8207
8852
  json: inheritOption(opts.json, parent.json)
8208
8853
  });
8209
8854
  });
8210
- taxCmd.command("file").addOption(new Option("--type <type>", `Document type (${TAX_DOCUMENT_TYPE_CHOICES.join(", ")})`).choices([...TAX_DOCUMENT_TYPE_CHOICES]).makeOptionMandatory()).requiredOption("--year <year>", "Tax year", parseInt).option("--json", "Output as JSON").description("File a tax document").action(async (opts, cmd) => {
8855
+ taxCmd.command("file").addOption(
8856
+ new Option("--type <type>", `Document type (${TAX_DOCUMENT_TYPE_DISPLAY.join(", ")})`).choices([...TAX_DOCUMENT_TYPE_CHOICES]).makeOptionMandatory()
8857
+ ).requiredOption("--year <year>", "Tax year", parseInt).option("--json", "Output as JSON").description("File a tax document").action(async (opts, cmd) => {
8211
8858
  const parent = cmd.parent.opts();
8212
8859
  const { taxFileCommand: taxFileCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
8213
8860
  await taxFileCommand2({
@@ -8268,11 +8915,12 @@ agentsCmd.command("resume <agent-ref>").option("--json", "Output as JSON").descr
8268
8915
  json: inheritOption(opts.json, parent.json)
8269
8916
  });
8270
8917
  });
8271
- agentsCmd.command("delete <agent-ref>").option("--json", "Output as JSON").description("Delete an agent").action(async (agentId, opts, cmd) => {
8918
+ agentsCmd.command("delete <agent-ref>").option("--json", "Output as JSON").option("--yes, -y", "Skip confirmation prompt").description("Delete an agent").action(async (agentId, opts, cmd) => {
8272
8919
  const parent = cmd.parent.opts();
8273
8920
  const { agentsDeleteCommand: agentsDeleteCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
8274
8921
  await agentsDeleteCommand2(agentId, {
8275
- json: inheritOption(opts.json, parent.json)
8922
+ json: inheritOption(opts.json, parent.json),
8923
+ yes: opts.yes
8276
8924
  });
8277
8925
  });
8278
8926
  agentsCmd.command("message <agent-ref>").option("--body <text>", "Message text").option("--body-file <path>", "Read the message body from a file").option("--json", "Output as JSON").description("Send a message to an agent").action(async (agentId, opts, cmd) => {
@@ -8291,6 +8939,37 @@ agentsCmd.command("skill <agent-ref>").requiredOption("--name <name>", "Skill na
8291
8939
  json: inheritOption(opts.json, parent.json)
8292
8940
  });
8293
8941
  });
8942
+ agentsCmd.command("execution <agent-ref> <execution-id>").option("--json", "Output as JSON").description("Check execution status").action(async (agentId, executionId, opts, cmd) => {
8943
+ const parent = cmd.parent.opts();
8944
+ const { agentsExecutionCommand: agentsExecutionCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
8945
+ await agentsExecutionCommand2(agentId, executionId, {
8946
+ json: opts.json ?? parent.json
8947
+ });
8948
+ });
8949
+ agentsCmd.command("execution-result <agent-ref> <execution-id>").option("--json", "Output as JSON").description("Get execution result").action(async (agentId, executionId, opts, cmd) => {
8950
+ const parent = cmd.parent.opts();
8951
+ const { agentsExecutionResultCommand: agentsExecutionResultCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
8952
+ await agentsExecutionResultCommand2(agentId, executionId, {
8953
+ json: opts.json ?? parent.json
8954
+ });
8955
+ });
8956
+ agentsCmd.command("kill <agent-ref> <execution-id>").option("--yes", "Skip confirmation").option("--json", "Output as JSON").description("Kill a running execution").action(async (agentId, executionId, opts, cmd) => {
8957
+ const parent = cmd.parent.opts();
8958
+ const { agentsKillCommand: agentsKillCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
8959
+ await agentsKillCommand2(agentId, executionId, {
8960
+ ...opts,
8961
+ json: opts.json ?? parent.json
8962
+ });
8963
+ });
8964
+ agentsCmd.addHelpText("after", `
8965
+ Examples:
8966
+ $ corp agents # list all agents
8967
+ $ corp agents create --name "bookkeeper" --prompt "You manage accounts payable"
8968
+ $ corp agents message @last:agent --body "Process this month's invoices"
8969
+ $ corp agents skill @last:agent --name invoice-processing --description "Process AP invoices"
8970
+ $ corp agents execution @last:agent <execution-id> # check execution status
8971
+ $ corp agents kill @last:agent <execution-id> # kill a running execution
8972
+ `);
8294
8973
  var workItemsCmd = program.command("work-items").description("Long-term work item coordination").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON").option("--status <status>", "Filter by status (open, claimed, completed, cancelled)").option("--category <category>", "Filter by category").action(async (opts) => {
8295
8974
  const { workItemsListCommand: workItemsListCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
8296
8975
  await workItemsListCommand2(opts);
@@ -8304,7 +8983,7 @@ workItemsCmd.command("show <item-ref>").option("--json", "Output as JSON").descr
8304
8983
  json: inheritOption(opts.json, parent.json)
8305
8984
  });
8306
8985
  });
8307
- workItemsCmd.command("create").requiredOption("--title <title>", "Work item title").option("--category <category>", "Work item category").option("--description <desc>", "Description").option("--deadline <date>", "Deadline (YYYY-MM-DD)").option("--asap", "Mark as ASAP priority").option("--created-by <name>", "Creator identifier").option("--json", "Output as JSON").description("Create a new work item").action(async (opts, cmd) => {
8986
+ workItemsCmd.command("create").requiredOption("--title <title>", "Work item title").requiredOption("--category <category>", "Work item category").option("--description <desc>", "Description").option("--deadline <date>", "Deadline (YYYY-MM-DD)").option("--asap", "Mark as ASAP priority").option("--created-by <name>", "Creator identifier").option("--json", "Output as JSON").description("Create a new work item").action(async (opts, cmd) => {
8308
8987
  const parent = cmd.parent.opts();
8309
8988
  const { workItemsCreateCommand: workItemsCreateCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
8310
8989
  await workItemsCreateCommand2({
@@ -8314,7 +8993,7 @@ workItemsCmd.command("create").requiredOption("--title <title>", "Work item titl
8314
8993
  json: inheritOption(opts.json, parent.json)
8315
8994
  });
8316
8995
  });
8317
- workItemsCmd.command("claim <item-ref>").option("--by <name>", "Agent or user claiming the item").option("--claimer <name>", "Alias for --by").option("--ttl <seconds>", "Auto-release TTL in seconds", parseInt).option("--json", "Output as JSON").description("Claim a work item").action(async (itemId, opts, cmd) => {
8996
+ workItemsCmd.command("claim <item-ref>").option("--by <name>", "Agent or user claiming the item (required)").option("--claimer <name>", "Alias for --by").option("--ttl <seconds>", "Auto-release TTL in seconds", parseInt).option("--json", "Output as JSON").description("Claim a work item").action(async (itemId, opts, cmd) => {
8318
8997
  const parent = cmd.parent.opts();
8319
8998
  const { workItemsClaimCommand: workItemsClaimCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
8320
8999
  const claimedBy = opts.by ?? opts.claimer;
@@ -8329,7 +9008,7 @@ workItemsCmd.command("claim <item-ref>").option("--by <name>", "Agent or user cl
8329
9008
  json: inheritOption(opts.json, parent.json)
8330
9009
  });
8331
9010
  });
8332
- workItemsCmd.command("complete <item-ref>").option("--by <name>", "Agent or user completing the item").option("--completed-by <name>", "Alias for --by").option("--result <text>", "Completion result or notes").option("--notes <text>", "Alias for --result").option("--json", "Output as JSON").description("Mark a work item as completed").action(async (itemId, opts, cmd) => {
9011
+ workItemsCmd.command("complete <item-ref>").option("--by <name>", "Agent or user completing the item (required)").option("--completed-by <name>", "Alias for --by").option("--result <text>", "Completion result or notes").option("--notes <text>", "Alias for --result").option("--json", "Output as JSON").description("Mark a work item as completed").action(async (itemId, opts, cmd) => {
8333
9012
  const parent = cmd.parent.opts();
8334
9013
  const { workItemsCompleteCommand: workItemsCompleteCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
8335
9014
  const completedBy = opts.by ?? opts.completedBy;
@@ -8352,15 +9031,26 @@ workItemsCmd.command("release <item-ref>").option("--json", "Output as JSON").de
8352
9031
  json: inheritOption(opts.json, parent.json)
8353
9032
  });
8354
9033
  });
8355
- workItemsCmd.command("cancel <item-ref>").option("--json", "Output as JSON").description("Cancel a work item").action(async (itemId, opts, cmd) => {
9034
+ workItemsCmd.command("cancel <item-ref>").option("--json", "Output as JSON").option("--yes, -y", "Skip confirmation prompt").description("Cancel a work item").action(async (itemId, opts, cmd) => {
8356
9035
  const parent = cmd.parent.opts();
8357
9036
  const { workItemsCancelCommand: workItemsCancelCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
8358
9037
  await workItemsCancelCommand2(itemId, {
8359
9038
  entityId: parent.entityId,
8360
- json: inheritOption(opts.json, parent.json)
9039
+ json: inheritOption(opts.json, parent.json),
9040
+ yes: opts.yes
8361
9041
  });
8362
9042
  });
8363
- var servicesCmd = program.command("services").description("Service catalog and fulfillment").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON");
9043
+ workItemsCmd.addHelpText("after", `
9044
+ Examples:
9045
+ $ corp work-items # list open work items
9046
+ $ corp work-items create --title "File Q1 taxes" --category compliance --deadline 2026-04-15
9047
+ $ corp work-items claim @last:work_item --by bookkeeper-agent
9048
+ $ corp work-items complete @last:work_item --by bookkeeper-agent --result "Filed 1120 for Q1"
9049
+ `);
9050
+ var servicesCmd = program.command("services").description("Service catalog and fulfillment").option("--entity-id <ref>", "Entity reference (ID, short ID, @last, or unique name)").option("--json", "Output as JSON").action(async (opts) => {
9051
+ const { servicesCatalogCommand: servicesCatalogCommand2 } = await Promise.resolve().then(() => (init_services(), services_exports));
9052
+ await servicesCatalogCommand2({ json: opts.json });
9053
+ });
8364
9054
  servicesCmd.command("catalog").option("--json", "Output as JSON").description("List the service catalog").action(async (opts, cmd) => {
8365
9055
  const parent = cmd.parent.opts();
8366
9056
  const { servicesCatalogCommand: servicesCatalogCommand2 } = await Promise.resolve().then(() => (init_services(), services_exports));
@@ -8429,9 +9119,7 @@ program.command("approvals").description("Approvals are managed through governan
8429
9119
  const { approvalsListCommand: approvalsListCommand2 } = await Promise.resolve().then(() => (init_approvals(), approvals_exports));
8430
9120
  await approvalsListCommand2({});
8431
9121
  });
8432
- var formCmd = program.command("form").description("Form a new entity with founders and cap table").option("--entity-type <type>", "Entity type (llc, c_corp)").option("--legal-name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--member <member>", "Founder as 'name,email,role[,pct[,address[,officer_title[,is_incorporator]]]]' with address as street|city|state|zip, or key=value pairs like 'name=...,email=...,role=...,officer_title=cto,is_incorporator=true,address=street|city|state|zip' (repeatable)", (v, a) => [...a, v], []).option("--member-json <json>", "Founder JSON object (repeatable)", (v, a) => [...a, v], []).option("--members-file <path>", 'Path to a JSON array of founders or {"members": [...]}').option("--address <address>", "Company address as 'street,city,state,zip'").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)", "12-31").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the entity").action(async (opts) => {
8433
- if (opts.entityType && !opts.type) opts.type = opts.entityType;
8434
- if (opts.legalName && !opts.name) opts.name = opts.legalName;
9122
+ var formCmd = program.command("form").description("Form a new entity with founders and cap table").option("--type <type>", "Entity type (llc, c_corp)").option("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--member <member>", "Founder as 'name,email,role[,pct[,address[,officer_title[,is_incorporator]]]]' with address as street|city|state|zip, or key=value pairs like 'name=...,email=...,role=...,officer_title=cto,is_incorporator=true,address=street|city|state|zip' (repeatable)", (v, a) => [...a, v], []).option("--member-json <json>", "Founder JSON object (repeatable)", (v, a) => [...a, v], []).option("--members-file <path>", 'Path to a JSON array of founders or {"members": [...]}').option("--address <address>", "Company address as 'street,city,state,zip'").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)", "12-31").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the entity").action(async (opts) => {
8435
9123
  const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
8436
9124
  await formCommand2(opts);
8437
9125
  });
@@ -8441,6 +9129,10 @@ formCmd.command("create").description("Create a pending entity (staged flow step
8441
9129
  await formCreateCommand2({
8442
9130
  ...opts,
8443
9131
  jurisdiction: inheritOption(opts.jurisdiction, parent.jurisdiction),
9132
+ fiscalYearEnd: inheritOption(opts.fiscalYearEnd, parent.fiscalYearEnd),
9133
+ sCorp: inheritOption(opts.sCorp, parent.sCorp),
9134
+ transferRestrictions: inheritOption(opts.transferRestrictions, parent.transferRestrictions),
9135
+ rofr: inheritOption(opts.rofr, parent.rofr),
8444
9136
  json: inheritOption(opts.json, parent.json),
8445
9137
  dryRun: inheritOption(opts.dryRun, parent.dryRun)
8446
9138
  });
@@ -8469,9 +9161,30 @@ formCmd.command("activate <entity-ref>").description("Programmatically sign form
8469
9161
  dryRun: inheritOption(opts.dryRun, cmd.parent.opts().dryRun)
8470
9162
  });
8471
9163
  });
8472
- program.command("api-keys").description("List API keys").option("--json", "Output as JSON").action(async (opts) => {
8473
- const { apiKeysCommand: apiKeysCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
8474
- await apiKeysCommand2(opts);
9164
+ formCmd.addHelpText("after", `
9165
+ Examples:
9166
+ $ corp form --type llc --name "My LLC" --member "Alice,alice@co.com,member,100"
9167
+ $ corp form --type c_corp --name "Acme Inc" --jurisdiction US-DE --member-json '{"name":"Bob","email":"bob@acme.com","role":"director","pct":100}'
9168
+ $ corp form create --type llc --name "My LLC"
9169
+ $ corp form add-founder @last:entity --name "Alice" --email "alice@co.com" --role member --pct 100
9170
+ $ corp form finalize @last:entity
9171
+ $ corp form activate @last:entity
9172
+ `);
9173
+ var apiKeysCmd = program.command("api-keys").description("API key management").option("--json", "Output as JSON").action(async (opts) => {
9174
+ const { apiKeysListCommand: apiKeysListCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
9175
+ await apiKeysListCommand2(opts);
9176
+ });
9177
+ apiKeysCmd.command("create").requiredOption("--name <name>", "Key name/label").option("--scopes <scopes>", "Comma-separated scopes").option("--json", "Output as JSON").description("Create a new API key").action(async (opts) => {
9178
+ const { apiKeysCreateCommand: apiKeysCreateCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
9179
+ await apiKeysCreateCommand2(opts);
9180
+ });
9181
+ apiKeysCmd.command("revoke <key-id>").option("--yes", "Skip confirmation").option("--json", "Output as JSON").description("Revoke an API key").action(async (keyId, opts) => {
9182
+ const { apiKeysRevokeCommand: apiKeysRevokeCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
9183
+ await apiKeysRevokeCommand2(keyId, opts);
9184
+ });
9185
+ apiKeysCmd.command("rotate <key-id>").option("--json", "Output as JSON").description("Rotate an API key (returns new key)").action(async (keyId, opts) => {
9186
+ const { apiKeysRotateCommand: apiKeysRotateCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
9187
+ await apiKeysRotateCommand2(keyId, opts);
8475
9188
  });
8476
9189
  program.command("demo").description("Create a usable demo workspace environment").requiredOption("--name <name>", "Corporation name").option("--scenario <scenario>", "Scenario to create (startup, llc, restaurant)", "startup").option("--minimal", "Use the minimal server-side demo seed instead of the full CLI workflow").option("--json", "Output as JSON").action(async (opts) => {
8477
9190
  const { demoCommand: demoCommand2 } = await Promise.resolve().then(() => (init_demo(), demo_exports));