@thecorporation/cli 26.3.47 → 26.3.48

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
@@ -4315,7 +4315,11 @@ var init_formation = __esm({
4315
4315
  { flags: "--incorporator-address <address>", description: "Incorporator mailing address (overrides founder)" }
4316
4316
  ],
4317
4317
  handler: formFinalizeHandler,
4318
- examples: ["corp form finalize"]
4318
+ examples: [
4319
+ "corp form finalize @last:entity",
4320
+ "corp form finalize @last:entity --authorized-shares 10000000 --par-value 0.0001",
4321
+ 'corp form finalize @last:entity --company-address "123 Main St,Wilmington,DE,19801" --incorporator-name "Alice Smith"'
4322
+ ]
4319
4323
  },
4320
4324
  {
4321
4325
  name: "form activate",
@@ -4330,7 +4334,11 @@ var init_formation = __esm({
4330
4334
  { flags: "--ein <ein>", description: "EIN to confirm (defaults to a deterministic simulated EIN)" }
4331
4335
  ],
4332
4336
  handler: formActivateHandler,
4333
- examples: ["corp form activate"]
4337
+ examples: [
4338
+ "corp form activate @last:entity",
4339
+ "corp form activate @last:entity --ein 84-1234567",
4340
+ "corp form activate @last:entity --filing-id DE-2026-0042 --receipt-reference RECEIPT-001"
4341
+ ]
4334
4342
  },
4335
4343
  // ── Auto-generated from OpenAPI ──────────────────────────────
4336
4344
  {
@@ -8455,7 +8463,10 @@ var init_compliance = __esm({
8455
8463
  },
8456
8464
  produces: { kind: "tax_filing" },
8457
8465
  successTemplate: "Tax filing created",
8458
- examples: ["corp tax file --type 1120 --year 'year'"]
8466
+ examples: [
8467
+ "corp tax file --type 1120 --year 2025",
8468
+ "corp tax file --type 83b --year 2025 --filer-contact-id @last:contact"
8469
+ ]
8459
8470
  },
8460
8471
  // --- tax deadlines ---
8461
8472
  {
@@ -8519,14 +8530,20 @@ var init_compliance = __esm({
8519
8530
  },
8520
8531
  produces: { kind: "deadline" },
8521
8532
  successTemplate: "Deadline tracked",
8522
- examples: ["corp tax deadline --type 'type' --due-date 'date' --description 'desc'", "corp tax deadline --json"]
8533
+ examples: [
8534
+ 'corp tax deadline --type annual_report --due-date 2026-03-31 --description "Delaware annual report due"',
8535
+ 'corp tax deadline --type annual_report --due-date 2026-03-31 --description "Delaware annual report" --recurrence annual'
8536
+ ]
8523
8537
  },
8524
8538
  // ── Auto-generated from OpenAPI ──────────────────────────────
8525
8539
  {
8526
8540
  name: "compliance escalations-scan",
8527
8541
  description: "Scan for compliance issues and create escalations",
8528
8542
  route: { method: "POST", path: "/v1/compliance/escalations/scan" },
8529
- examples: ["corp compliance escalations-scan"],
8543
+ examples: [
8544
+ "corp compliance escalations-scan",
8545
+ "corp compliance escalations-scan --json"
8546
+ ],
8530
8547
  successTemplate: "Escalation scan complete"
8531
8548
  },
8532
8549
  {
@@ -8542,7 +8559,10 @@ var init_compliance = __esm({
8542
8559
  { flags: "--resolve-incident", description: "Resolve Incident" },
8543
8560
  { flags: "--resolve-obligation", description: "Resolve Obligation" }
8544
8561
  ],
8545
- examples: ["corp compliance escalations-resolve-with-evidence <escalation-id>", "corp compliance escalations-resolve-with-evidence --json"],
8562
+ examples: [
8563
+ "corp compliance escalations-resolve-with-evidence esc_01hx9k3n2p4q7r8s9t0uvwxyz --evidence-type filing --filing-reference DE-2026-0042",
8564
+ 'corp compliance escalations-resolve-with-evidence esc_01hx9k3n2p4q7r8s9t0uvwxyz --resolve-incident --notes "Filed on time"'
8565
+ ],
8546
8566
  successTemplate: "Escalations Resolve With Evidence created"
8547
8567
  },
8548
8568
  {
@@ -8559,7 +8579,10 @@ var init_compliance = __esm({
8559
8579
  { flags: "--provides-tools <provides-tools>", description: "Provides Tools" },
8560
8580
  { flags: "--state <state>", description: "State" }
8561
8581
  ],
8562
- examples: ["corp contractors classify --contractor-name 'contractor-name'", "corp contractors classify --json"],
8582
+ examples: [
8583
+ 'corp contractors classify --contractor-name "Jane Doe" --state CA --hours-per-week 20',
8584
+ 'corp contractors classify --contractor-name "Acme Services LLC" --duration-months 6 --exclusive-client false'
8585
+ ],
8563
8586
  successTemplate: "Classify created"
8564
8587
  },
8565
8588
  {
@@ -8573,7 +8596,10 @@ var init_compliance = __esm({
8573
8596
  { flags: "--recurrence <recurrence>", description: "Recurrence pattern for a deadline.", choices: ["one_time", "monthly", "quarterly", "annual"] },
8574
8597
  { flags: "--severity <severity>", description: "Risk severity of missing a deadline.", choices: ["low", "medium", "high", "critical"] }
8575
8598
  ],
8576
- examples: ["corp deadlines --deadline-type 'deadline-type' --description 'description' --due-date one_time", "corp deadlines --json"],
8599
+ examples: [
8600
+ 'corp deadlines --deadline-type annual_report --description "Delaware annual report" --due-date 2026-03-31 --recurrence annual',
8601
+ 'corp deadlines --deadline-type tax_filing --description "Q1 estimated taxes" --due-date 2026-04-15 --severity high'
8602
+ ],
8577
8603
  successTemplate: "Deadlines created"
8578
8604
  },
8579
8605
  {
@@ -8593,7 +8619,10 @@ var init_compliance = __esm({
8593
8619
  { flags: "--document-type <document-type>", description: "Type of document required", required: true },
8594
8620
  { flags: "--tax-year <tax-year>", description: "Tax Year", required: true, type: "int" }
8595
8621
  ],
8596
- examples: ["corp tax create-filing --document-type 'document-type' --tax-year 'tax-year'"],
8622
+ examples: [
8623
+ "corp tax create-filing --document-type 1120 --tax-year 2025",
8624
+ "corp tax create-filing --document-type 1065 --tax-year 2025 --json"
8625
+ ],
8597
8626
  successTemplate: "Filings created"
8598
8627
  }
8599
8628
  ];
@@ -8697,7 +8726,10 @@ var init_agents = __esm({
8697
8726
  }
8698
8727
  console.log(chalk9.magenta("\u2500".repeat(40)));
8699
8728
  },
8700
- examples: ["corp agents show"]
8729
+ examples: [
8730
+ "corp agents show @last:agent",
8731
+ "corp agents show agt_01hx9k3n2p4q7r8s9t0uvwxyz"
8732
+ ]
8701
8733
  },
8702
8734
  // --- agents create ---
8703
8735
  {
@@ -8738,7 +8770,10 @@ var init_agents = __esm({
8738
8770
  },
8739
8771
  produces: { kind: "agent" },
8740
8772
  successTemplate: "Agent created: {name}",
8741
- examples: ["corp agents create --name 'name' --prompt 'prompt'", "corp agents create --json"]
8773
+ examples: [
8774
+ 'corp agents create --name "bookkeeper" --prompt "You manage accounts payable for the company"',
8775
+ 'corp agents create --name "compliance-monitor" --prompt "You monitor regulatory deadlines" --model gpt-4o'
8776
+ ]
8742
8777
  },
8743
8778
  // --- agents pause <agent-ref> ---
8744
8779
  {
@@ -8752,7 +8787,10 @@ var init_agents = __esm({
8752
8787
  const result = await ctx.client.updateAgent(resolvedAgentId, { status: "paused" });
8753
8788
  ctx.writer.writeResult(result, `Agent ${resolvedAgentId} paused.`, { jsonOnly: ctx.opts.json });
8754
8789
  },
8755
- examples: ["corp agents pause <agent-ref>"]
8790
+ examples: [
8791
+ "corp agents pause @last:agent",
8792
+ "corp agents pause agt_01hx9k3n2p4q7r8s9t0uvwxyz"
8793
+ ]
8756
8794
  },
8757
8795
  // --- agents resume <agent-ref> ---
8758
8796
  {
@@ -8779,7 +8817,10 @@ var init_agents = __esm({
8779
8817
  }
8780
8818
  }
8781
8819
  },
8782
- examples: ["corp agents resume <agent-ref>"]
8820
+ examples: [
8821
+ "corp agents resume @last:agent",
8822
+ "corp agents resume agt_01hx9k3n2p4q7r8s9t0uvwxyz"
8823
+ ]
8783
8824
  },
8784
8825
  // --- agents delete <agent-ref> ---
8785
8826
  {
@@ -8806,7 +8847,10 @@ var init_agents = __esm({
8806
8847
  const result = await ctx.client.deleteAgent(resolvedAgentId);
8807
8848
  ctx.writer.writeResult(result, `Agent ${resolvedAgentId} deleted.`, { jsonOnly: ctx.opts.json });
8808
8849
  },
8809
- examples: ["corp agents delete <agent-ref>", "corp agents delete --json"]
8850
+ examples: [
8851
+ "corp agents delete @last:agent",
8852
+ "corp agents delete agt_01hx9k3n2p4q7r8s9t0uvwxyz --yes"
8853
+ ]
8810
8854
  },
8811
8855
  // --- agents message <agent-ref> ---
8812
8856
  {
@@ -8837,7 +8881,10 @@ var init_agents = __esm({
8837
8881
  }
8838
8882
  }
8839
8883
  },
8840
- examples: ["corp agents message <agent-ref>", "corp agents message --json"]
8884
+ examples: [
8885
+ `corp agents message @last:agent --body "Process this month's invoices"`,
8886
+ "corp agents message agt_01hx9k3n2p4q7r8s9t0uvwxyz --body-file ./task.txt"
8887
+ ]
8841
8888
  },
8842
8889
  // --- agents skill <agent-ref> ---
8843
8890
  {
@@ -8866,7 +8913,10 @@ var init_agents = __esm({
8866
8913
  });
8867
8914
  ctx.writer.writeResult(result, `Skill '${ctx.opts.name}' added to agent ${resolvedAgentId}.`, { jsonOnly: ctx.opts.json });
8868
8915
  },
8869
- examples: ["corp agents skill <agent-ref> --name 'name' --description 'desc'", "corp agents skill --json"]
8916
+ examples: [
8917
+ 'corp agents skill @last:agent --name invoice-processing --description "Process AP invoices from email"',
8918
+ 'corp agents skill agt_01hx9k3n2p4q7r8s9t0uvwxyz --name bookkeeping --description "Reconcile ledger entries" --instructions-file ./skills/bookkeeping.txt'
8919
+ ]
8870
8920
  },
8871
8921
  // --- agents execution <agent-ref> <execution-id> ---
8872
8922
  {
@@ -8897,7 +8947,10 @@ var init_agents = __esm({
8897
8947
  if (result.completed_at) console.log(` ${chalk9.bold("Completed:")} ${result.completed_at}`);
8898
8948
  console.log(chalk9.magenta("\u2500".repeat(40)));
8899
8949
  },
8900
- examples: ["corp agents execution"]
8950
+ examples: [
8951
+ "corp agents execution @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz",
8952
+ "corp agents execution agt_01hx9k3n2p4q7r8s9t0uvwxyz exc_01hx9k3n2p4q7r8s9t0uvwxyz"
8953
+ ]
8901
8954
  },
8902
8955
  // --- agents execution-result <agent-ref> <execution-id> ---
8903
8956
  {
@@ -8921,7 +8974,10 @@ var init_agents = __esm({
8921
8974
  ctx.writer.success(`Result for execution ${executionId}:`);
8922
8975
  printJson(result);
8923
8976
  },
8924
- examples: ["corp agents execution-result"]
8977
+ examples: [
8978
+ "corp agents execution-result @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz",
8979
+ "corp agents execution-result @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz --json"
8980
+ ]
8925
8981
  },
8926
8982
  // --- agents kill <agent-ref> <execution-id> ---
8927
8983
  {
@@ -8949,7 +9005,10 @@ var init_agents = __esm({
8949
9005
  const result = await ctx.client.killAgentExecution(resolvedAgentId, executionId);
8950
9006
  ctx.writer.writeResult(result, `Execution ${executionId} killed.`, { jsonOnly: ctx.opts.json });
8951
9007
  },
8952
- examples: ["corp agents kill <agent-ref> <execution-id>", "corp agents kill --json"]
9008
+ examples: [
9009
+ "corp agents kill @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz",
9010
+ "corp agents kill @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz --yes"
9011
+ ]
8953
9012
  },
8954
9013
  // ── Auto-generated from OpenAPI ──────────────────────────────
8955
9014
  {
@@ -8958,7 +9017,10 @@ var init_agents = __esm({
8958
9017
  route: { method: "GET", path: "/v1/agents/{pos}/executions/{pos2}/logs" },
8959
9018
  args: [{ name: "agent-id", required: true, description: "Agent ID", posKind: "agent" }, { name: "execution-id", required: true, description: "Agent execution ID" }],
8960
9019
  display: { title: "Execution Logs", cols: ["@timestamp>Time", "level>Level", "message>Message"] },
8961
- examples: ["corp agents executions-logs"]
9020
+ examples: [
9021
+ "corp agents executions-logs @last:agent exc_01hx9k3n2p4q7r8s9t0uvwxyz",
9022
+ "corp agents executions-logs agt_01hx9k3n2p4q7r8s9t0uvwxyz exc_01hx9k3n2p4q7r8s9t0uvwxyz --json"
9023
+ ]
8962
9024
  },
8963
9025
  // ── Auto-generated from OpenAPI ──────────────────────────────
8964
9026
  {
@@ -8967,7 +9029,10 @@ var init_agents = __esm({
8967
9029
  route: { method: "GET", path: "/v1/agents/{pos}/messages/{pos2}" },
8968
9030
  args: [{ name: "agent-id", required: true, description: "Agent ID", posKind: "agent" }, { name: "message-id", required: true, description: "Message Id" }],
8969
9031
  display: { title: "Agent Message" },
8970
- examples: ["corp agents messages"]
9032
+ examples: [
9033
+ "corp agents messages @last:agent msg_01hx9k3n2p4q7r8s9t0uvwxyz",
9034
+ "corp agents messages @last:agent msg_01hx9k3n2p4q7r8s9t0uvwxyz --json"
9035
+ ]
8971
9036
  }
8972
9037
  ];
8973
9038
  }
@@ -11475,7 +11540,10 @@ var init_execution = __esm({
11475
11540
  { flags: "--max-amount-cents <max-amount-cents>", description: "Maximum authorized amount in cents" },
11476
11541
  { flags: "--scope <scope>", description: "Authorization scope", required: true }
11477
11542
  ],
11478
- examples: ["corp execution approval-artifacts --approver-identity 'approver-identity' --channel 'channel' --intent-type 'intent-type' --scope 'scope'", "corp execution approval-artifacts --json"],
11543
+ examples: [
11544
+ 'corp execution approval-artifacts --approver-identity "alice@acme.com" --channel board_vote --intent-type equity_grant --scope entity',
11545
+ 'corp execution approval-artifacts --approver-identity "alice@acme.com" --channel written_consent --intent-type equity_grant --scope entity --approved-at 2026-03-01T00:00:00Z'
11546
+ ],
11479
11547
  successTemplate: "Approval Artifacts created"
11480
11548
  },
11481
11549
  {
@@ -11489,7 +11557,10 @@ var init_execution = __esm({
11489
11557
  { flags: "--intent-type <intent-type>", description: "Type of intent", required: true },
11490
11558
  { flags: "--metadata <metadata>", description: "Additional metadata (JSON)" }
11491
11559
  ],
11492
- examples: ["corp execution intents --description 'description' --intent-type 'intent-type'", "corp execution intents --json"],
11560
+ examples: [
11561
+ 'corp execution intents --description "Issue 10,000 options to Alice" --intent-type equity_grant --authority-tier tier_2',
11562
+ 'corp execution intents --description "Wire $50,000 to vendor" --intent-type payment --authority-tier tier_1'
11563
+ ],
11493
11564
  successTemplate: "Intents created"
11494
11565
  },
11495
11566
  {
@@ -11505,7 +11576,10 @@ var init_execution = __esm({
11505
11576
  { flags: "--intent-id <intent-id>", description: "Execution intent ID" },
11506
11577
  { flags: "--obligation-type <obligation-type>", description: "Type of obligation", required: true }
11507
11578
  ],
11508
- examples: ["corp execution obligations --assignee-type internal --description 'description' --obligation-type 'obligation-type'", "corp execution obligations --json"],
11579
+ examples: [
11580
+ 'corp execution obligations --assignee-type human --description "Sign equity grant agreement" --obligation-type signature',
11581
+ 'corp execution obligations --assignee-type internal --description "File 83(b) election" --obligation-type document --due-date 2026-04-15'
11582
+ ],
11509
11583
  successTemplate: "Obligations created"
11510
11584
  },
11511
11585
  {
@@ -11515,7 +11589,10 @@ var init_execution = __esm({
11515
11589
  entity: true,
11516
11590
  args: [{ name: "packet-id", required: true, description: "Document packet ID" }],
11517
11591
  display: { title: "Execution Packets", cols: ["finalized_at>Finalized At", "items>Items", "manifest_hash>Manifest Hash", "required_signers>Required Signers", "@created_at>Created At", "#entity_id>ID"] },
11518
- examples: ["corp execution packets", "corp execution packets --json"]
11592
+ examples: [
11593
+ "corp execution packets pkt_01hx9k3n2p4q7r8s9t0uvwxyz",
11594
+ "corp execution packets pkt_01hx9k3n2p4q7r8s9t0uvwxyz --json"
11595
+ ]
11519
11596
  },
11520
11597
  {
11521
11598
  name: "intents authorize",
@@ -11534,7 +11611,9 @@ var init_execution = __esm({
11534
11611
  options: [
11535
11612
  { flags: "--approval-artifact-id <approval-artifact-id>", description: "Approval artifact ID to bind", required: true }
11536
11613
  ],
11537
- examples: ["corp intents bind-approval-artifact <intent-id> --approval-artifact-id 'approval-artifact-id'"],
11614
+ examples: [
11615
+ "corp intents bind-approval-artifact @last:intent --approval-artifact-id art_01hx9k3n2p4q7r8s9t0uvwxyz"
11616
+ ],
11538
11617
  successTemplate: "Bind Approval Artifact created"
11539
11618
  },
11540
11619
  {
@@ -11545,7 +11624,9 @@ var init_execution = __esm({
11545
11624
  options: [
11546
11625
  { flags: "--request-id <request-id>", description: "Document request ID", required: true }
11547
11626
  ],
11548
- examples: ["corp intents bind-document-request <intent-id> --request-id 'request-id'"],
11627
+ examples: [
11628
+ "corp intents bind-document-request @last:intent --request-id req_01hx9k3n2p4q7r8s9t0uvwxyz"
11629
+ ],
11549
11630
  successTemplate: "Bind Document Request created"
11550
11631
  },
11551
11632
  {
@@ -11582,7 +11663,10 @@ var init_execution = __esm({
11582
11663
  entity: true,
11583
11664
  args: [{ name: "intent-id", required: true, description: "Execution intent ID" }],
11584
11665
  display: { title: "Intents Receipts", cols: ["executed_at>Executed At", "idempotency_key>Idempotency Key", "request_hash>Request Hash", "response_hash>Response Hash", "@created_at>Created At", "#intent_id>ID"] },
11585
- examples: ["corp intents receipts", "corp intents receipts --json"]
11666
+ examples: [
11667
+ "corp intents receipts int_01hx9k3n2p4q7r8s9t0uvwxyz",
11668
+ "corp intents receipts @last:intent --json"
11669
+ ]
11586
11670
  },
11587
11671
  {
11588
11672
  name: "obligations assign",
@@ -11593,7 +11677,9 @@ var init_execution = __esm({
11593
11677
  options: [
11594
11678
  { flags: "--assignee-id <assignee-id>", description: "ID of the party to assign to", required: true }
11595
11679
  ],
11596
- examples: ["corp obligations assign <obligation-id> --assignee-id 'assignee-id'"],
11680
+ examples: [
11681
+ "corp obligations assign obl_01hx9k3n2p4q7r8s9t0uvwxyz --assignee-id usr_01hx9k3n2p4q7r8s9t0uvwxyz"
11682
+ ],
11597
11683
  successTemplate: "Assign created"
11598
11684
  },
11599
11685
  {
@@ -11603,7 +11689,10 @@ var init_execution = __esm({
11603
11689
  entity: true,
11604
11690
  args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
11605
11691
  display: { title: "Obligations Document Requests", cols: ["description>Description", "document_type>Document Type", "fulfilled_at>Fulfilled At", "not_applicable_at>Not Applicable At", "@created_at>Created At", "#entity_id>ID"] },
11606
- examples: ["corp obligations document-requests", "corp obligations document-requests --json"]
11692
+ examples: [
11693
+ "corp obligations document-requests obl_01hx9k3n2p4q7r8s9t0uvwxyz",
11694
+ "corp obligations document-requests obl_01hx9k3n2p4q7r8s9t0uvwxyz --json"
11695
+ ]
11607
11696
  },
11608
11697
  {
11609
11698
  name: "obligations create-document-request",
@@ -11615,7 +11704,9 @@ var init_execution = __esm({
11615
11704
  { flags: "--description <description>", description: "Description text", required: true },
11616
11705
  { flags: "--document-type <document-type>", description: "Type of document required", required: true }
11617
11706
  ],
11618
- examples: ["corp obligations document-requests <obligation-id> --description 'description' --document-type 'document-type'"],
11707
+ examples: [
11708
+ 'corp obligations create-document-request obl_01hx9k3n2p4q7r8s9t0uvwxyz --description "Signed equity grant agreement" --document-type equity_grant'
11709
+ ],
11619
11710
  successTemplate: "Document Requests created"
11620
11711
  },
11621
11712
  {
@@ -11652,7 +11743,10 @@ var init_execution = __esm({
11652
11743
  entity: true,
11653
11744
  args: [{ name: "receipt-id", required: true, description: "Execution receipt ID" }],
11654
11745
  display: { title: "Receipts", cols: ["executed_at>Executed At", "idempotency_key>Idempotency Key", "request_hash>Request Hash", "response_hash>Response Hash", "@created_at>Created At", "#intent_id>ID"] },
11655
- examples: ["corp receipts", "corp receipts --json"]
11746
+ examples: [
11747
+ "corp receipts rcp_01hx9k3n2p4q7r8s9t0uvwxyz",
11748
+ "corp receipts rcp_01hx9k3n2p4q7r8s9t0uvwxyz --json"
11749
+ ]
11656
11750
  },
11657
11751
  // ── Human obligations ───────────────────────────────────────────────
11658
11752
  {
@@ -12123,6 +12217,275 @@ var init_branches = __esm({
12123
12217
  }
12124
12218
  });
12125
12219
 
12220
+ // src/registry/completions.ts
12221
+ function buildTree(commands) {
12222
+ const topLevelMap = /* @__PURE__ */ new Map();
12223
+ const topLevel = [];
12224
+ for (const cmd of commands) {
12225
+ if (cmd.hidden) continue;
12226
+ const parts = cmd.name.split(" ");
12227
+ const opts = ["--json"];
12228
+ if (cmd.entity) opts.push("--entity-id");
12229
+ if (cmd.dryRun) opts.push("--dry-run");
12230
+ for (const o of cmd.options ?? []) {
12231
+ if (o.hidden) continue;
12232
+ const longFlag = o.flags.split(/\s+/).find((f) => f.startsWith("--"));
12233
+ if (longFlag) {
12234
+ opts.push(longFlag.replace(/<[^>]*>|\[[^\]]*\]/, "").trim());
12235
+ }
12236
+ }
12237
+ const node = {
12238
+ name: parts[parts.length - 1],
12239
+ description: cmd.description,
12240
+ options: opts,
12241
+ subcmds: []
12242
+ };
12243
+ if (parts.length === 1) {
12244
+ topLevelMap.set(parts[0], node);
12245
+ topLevel.push(node);
12246
+ } else {
12247
+ const parentName = parts[0];
12248
+ let parent = topLevelMap.get(parentName);
12249
+ if (!parent) {
12250
+ parent = { name: parentName, description: "", options: [], subcmds: [] };
12251
+ topLevelMap.set(parentName, parent);
12252
+ topLevel.push(parent);
12253
+ }
12254
+ parent.subcmds.push(node);
12255
+ }
12256
+ }
12257
+ return topLevel;
12258
+ }
12259
+ function generateBash(commands) {
12260
+ const tree = buildTree(commands);
12261
+ const lines = [
12262
+ "# corp bash completion",
12263
+ "# Source this file or add to ~/.bash_completion.d/",
12264
+ "# source <(corp completions --shell bash)",
12265
+ "",
12266
+ "_corp_completions() {",
12267
+ " local cur prev words cword",
12268
+ " _init_completion 2>/dev/null || {",
12269
+ " COMPREPLY=()",
12270
+ ' cur="${COMP_WORDS[COMP_CWORD]}"',
12271
+ ' prev="${COMP_WORDS[COMP_CWORD-1]}"',
12272
+ ' words=("${COMP_WORDS[@]}")',
12273
+ " cword=$COMP_CWORD",
12274
+ " }",
12275
+ "",
12276
+ ' local subcommand=""',
12277
+ ' local subsubcommand=""',
12278
+ ' if [[ ${#words[@]} -ge 2 ]]; then subcommand="${words[1]}"; fi',
12279
+ ' if [[ ${#words[@]} -ge 3 ]]; then subsubcommand="${words[2]}"; fi',
12280
+ ""
12281
+ ];
12282
+ const topNames = tree.map((n) => n.name).join(" ");
12283
+ lines.push(` local top_commands="${topNames}"`);
12284
+ lines.push("");
12285
+ lines.push(' case "$subcommand" in');
12286
+ for (const parent of tree) {
12287
+ if (parent.subcmds.length > 0) {
12288
+ const subNames = parent.subcmds.map((s3) => s3.name).join(" ");
12289
+ lines.push(` ${parent.name})`);
12290
+ lines.push(` local ${parent.name}_subcmds="${subNames}"`);
12291
+ lines.push(` case "$subsubcommand" in`);
12292
+ for (const child of parent.subcmds) {
12293
+ const childFlags = child.options.join(" ");
12294
+ lines.push(` ${child.name})`);
12295
+ lines.push(` COMPREPLY=( $(compgen -W "${childFlags}" -- "$cur") )`);
12296
+ lines.push(" return 0 ;;");
12297
+ }
12298
+ const parentFlags = parent.options.join(" ");
12299
+ lines.push(" *)");
12300
+ if (parent.options.length > 0) {
12301
+ lines.push(` COMPREPLY=( $(compgen -W "${parent.subcmds.map((s3) => s3.name).join(" ")} ${parentFlags}" -- "$cur") )`);
12302
+ } else {
12303
+ lines.push(` COMPREPLY=( $(compgen -W "$${parent.name}_subcmds" -- "$cur") )`);
12304
+ }
12305
+ lines.push(" return 0 ;;");
12306
+ lines.push(" esac ;;");
12307
+ } else {
12308
+ const flags = parent.options.join(" ");
12309
+ lines.push(` ${parent.name})`);
12310
+ lines.push(` COMPREPLY=( $(compgen -W "${flags}" -- "$cur") )`);
12311
+ lines.push(" return 0 ;;");
12312
+ }
12313
+ }
12314
+ lines.push(" *)");
12315
+ lines.push(' COMPREPLY=( $(compgen -W "$top_commands" -- "$cur") )');
12316
+ lines.push(" return 0 ;;");
12317
+ lines.push(" esac");
12318
+ lines.push("}");
12319
+ lines.push("");
12320
+ lines.push("complete -F _corp_completions corp");
12321
+ lines.push("complete -F _corp_completions npx corp");
12322
+ return lines.join("\n");
12323
+ }
12324
+ function escapeZshDesc(s3) {
12325
+ return s3.replace(/'/g, "'\\''").replace(/:/g, "\\:");
12326
+ }
12327
+ function generateZsh(commands) {
12328
+ const tree = buildTree(commands);
12329
+ const lines = [
12330
+ "#compdef corp",
12331
+ "# corp zsh completion",
12332
+ "# Add to your fpath and run: compdef _corp corp",
12333
+ '# eval "$(corp completions --shell zsh)"',
12334
+ "",
12335
+ "_corp() {",
12336
+ " local state",
12337
+ " local -a top_commands",
12338
+ ""
12339
+ ];
12340
+ lines.push(" top_commands=(");
12341
+ for (const node of tree) {
12342
+ lines.push(` '${node.name}:${escapeZshDesc(node.description)}'`);
12343
+ }
12344
+ lines.push(" )");
12345
+ lines.push("");
12346
+ lines.push(" _arguments -C \\");
12347
+ lines.push(" '(-h --help)'{-h,--help}'[Show help]' \\");
12348
+ lines.push(" '(-V --version)'{-V,--version}'[Show version]' \\");
12349
+ lines.push(" '(-q --quiet)'{-q,--quiet}'[Quiet output]' \\");
12350
+ lines.push(" '1: :->cmd' \\");
12351
+ lines.push(" '*: :->args'");
12352
+ lines.push("");
12353
+ lines.push(" case $state in");
12354
+ lines.push(" cmd)");
12355
+ lines.push(" _describe 'command' top_commands ;;");
12356
+ lines.push(" args)");
12357
+ lines.push(" case $words[2] in");
12358
+ for (const parent of tree) {
12359
+ lines.push(` ${parent.name})`);
12360
+ if (parent.subcmds.length > 0) {
12361
+ lines.push(" local -a subcmds");
12362
+ lines.push(" subcmds=(");
12363
+ for (const child of parent.subcmds) {
12364
+ lines.push(` '${child.name}:${escapeZshDesc(child.description)}'`);
12365
+ }
12366
+ lines.push(" )");
12367
+ lines.push(" if (( CURRENT == 3 )); then");
12368
+ lines.push(" _describe 'subcommand' subcmds");
12369
+ lines.push(" else");
12370
+ lines.push(" case $words[3] in");
12371
+ for (const child of parent.subcmds) {
12372
+ const argSpec = child.options.map((f) => `'${f}[option]'`).join(" \\\n ");
12373
+ lines.push(` ${child.name})`);
12374
+ lines.push(` _arguments ${argSpec} ;;`);
12375
+ }
12376
+ lines.push(" esac");
12377
+ lines.push(" fi ;;");
12378
+ } else {
12379
+ const argSpec = parent.options.map((f) => `'${f}[option]'`).join(" \\\n ");
12380
+ if (argSpec) {
12381
+ lines.push(` _arguments ${argSpec} ;;`);
12382
+ } else {
12383
+ lines.push(" ;; # no options");
12384
+ }
12385
+ }
12386
+ }
12387
+ lines.push(" esac ;;");
12388
+ lines.push(" esac");
12389
+ lines.push("}");
12390
+ lines.push("");
12391
+ lines.push("_corp");
12392
+ return lines.join("\n");
12393
+ }
12394
+ function generateFish(commands) {
12395
+ const tree = buildTree(commands);
12396
+ const lines = [
12397
+ "# corp fish completion",
12398
+ "# Save to ~/.config/fish/completions/corp.fish",
12399
+ "# corp completions --shell fish > ~/.config/fish/completions/corp.fish",
12400
+ ""
12401
+ ];
12402
+ lines.push("complete -c corp -f");
12403
+ lines.push("");
12404
+ for (const node of tree) {
12405
+ const desc = node.description.replace(/'/g, "\\'");
12406
+ lines.push(`complete -c corp -n '__fish_use_subcommand' -a '${node.name}' -d '${desc}'`);
12407
+ }
12408
+ lines.push("");
12409
+ for (const parent of tree) {
12410
+ const parentName = parent.name;
12411
+ if (parent.subcmds.length > 0) {
12412
+ for (const child of parent.subcmds) {
12413
+ const desc = child.description.replace(/'/g, "\\'");
12414
+ lines.push(
12415
+ `complete -c corp -n "__fish_seen_subcommand_from ${parentName}; and not __fish_seen_subcommand_from ${parent.subcmds.map((s3) => s3.name).join(" ")}" -a '${child.name}' -d '${desc}'`
12416
+ );
12417
+ }
12418
+ lines.push("");
12419
+ for (const child of parent.subcmds) {
12420
+ for (const flag of child.options) {
12421
+ const long = flag.replace(/^--/, "");
12422
+ lines.push(
12423
+ `complete -c corp -n "__fish_seen_subcommand_from ${parentName}; and __fish_seen_subcommand_from ${child.name}" -l '${long}'`
12424
+ );
12425
+ }
12426
+ if (child.options.length > 0) lines.push("");
12427
+ }
12428
+ } else {
12429
+ for (const flag of parent.options) {
12430
+ const long = flag.replace(/^--/, "");
12431
+ lines.push(
12432
+ `complete -c corp -n "__fish_seen_subcommand_from ${parentName}" -l '${long}'`
12433
+ );
12434
+ }
12435
+ if (parent.options.length > 0) lines.push("");
12436
+ }
12437
+ }
12438
+ return lines.join("\n");
12439
+ }
12440
+ function makeCompletionsCommand(allCommands) {
12441
+ return {
12442
+ name: "completions",
12443
+ description: "Generate shell completion scripts",
12444
+ local: true,
12445
+ options: [
12446
+ {
12447
+ flags: "--shell <shell>",
12448
+ description: "Shell type (bash, zsh, fish)",
12449
+ choices: ["bash", "zsh", "fish"],
12450
+ required: true
12451
+ }
12452
+ ],
12453
+ examples: [
12454
+ "corp completions --shell bash",
12455
+ "corp completions --shell zsh",
12456
+ "corp completions --shell fish",
12457
+ "source <(corp completions --shell bash)",
12458
+ 'eval "$(corp completions --shell zsh)"',
12459
+ "corp completions --shell fish > ~/.config/fish/completions/corp.fish"
12460
+ ],
12461
+ handler: async (ctx) => {
12462
+ const shell = ctx.opts.shell;
12463
+ const cmds = allCommands.filter((c) => c.name !== "completions");
12464
+ let script;
12465
+ switch (shell) {
12466
+ case "bash":
12467
+ script = generateBash(cmds);
12468
+ break;
12469
+ case "zsh":
12470
+ script = generateZsh(cmds);
12471
+ break;
12472
+ case "fish":
12473
+ script = generateFish(cmds);
12474
+ break;
12475
+ default:
12476
+ ctx.writer.error(`Unknown shell: ${shell}. Choose bash, zsh, or fish.`);
12477
+ process.exit(1);
12478
+ }
12479
+ process.stdout.write(script + "\n");
12480
+ }
12481
+ };
12482
+ }
12483
+ var init_completions = __esm({
12484
+ "src/registry/completions.ts"() {
12485
+ "use strict";
12486
+ }
12487
+ });
12488
+
12126
12489
  // src/registry/index.ts
12127
12490
  var registry_exports = {};
12128
12491
  __export(registry_exports, {
@@ -12254,7 +12617,7 @@ function generateSchema(commands, programName, version) {
12254
12617
  commands: topLevel
12255
12618
  };
12256
12619
  }
12257
- var registry;
12620
+ var baseRegistry, registry;
12258
12621
  var init_registry = __esm({
12259
12622
  "src/registry/index.ts"() {
12260
12623
  "use strict";
@@ -12274,7 +12637,8 @@ var init_registry = __esm({
12274
12637
  init_secret_proxies();
12275
12638
  init_treasury();
12276
12639
  init_branches();
12277
- registry = [
12640
+ init_completions();
12641
+ baseRegistry = [
12278
12642
  ...workspaceCommands,
12279
12643
  ...entityCommands,
12280
12644
  ...formationCommands,
@@ -12292,6 +12656,10 @@ var init_registry = __esm({
12292
12656
  ...treasuryCommands,
12293
12657
  ...branchCommands
12294
12658
  ];
12659
+ registry = [
12660
+ ...baseRegistry,
12661
+ makeCompletionsCommand(baseRegistry)
12662
+ ];
12295
12663
  }
12296
12664
  });
12297
12665
 
@@ -12617,7 +12985,9 @@ init_api_client();
12617
12985
  init_references();
12618
12986
  function buildCLI(commands, version) {
12619
12987
  const program2 = new Command();
12620
- program2.name("corp").description("corp \u2014 Corporate governance from the terminal").version(version).enablePositionalOptions();
12988
+ program2.name("corp").description(
12989
+ 'The Corporation CLI \u2014 form entities, manage cap tables, govern, and operate.\n\nQuick start:\n corp form --type llc --name "My LLC" --member "Alice,a@co.com,member,100"\n corp cap-table\n corp next\n\nDocs: https://docs.thecorporation.ai'
12990
+ ).version(version).enablePositionalOptions();
12621
12991
  program2.option("-q, --quiet", "Only output the resource ID (for scripting)");
12622
12992
  program2.action(() => {
12623
12993
  program2.outputHelp();
@@ -12638,6 +13008,61 @@ function buildCLI(commands, version) {
12638
13008
  children.get(parent).push(def);
12639
13009
  }
12640
13010
  }
13011
+ const commandGroupOrder = {
13012
+ // Core workflow — formation & entity management
13013
+ form: 0,
13014
+ entities: 1,
13015
+ contacts: 2,
13016
+ // Cap table
13017
+ "cap-table": 10,
13018
+ "safe-notes": 11,
13019
+ "share-transfers": 12,
13020
+ valuations: 13,
13021
+ // Governance
13022
+ governance: 20,
13023
+ // Finance
13024
+ finance: 30,
13025
+ // Compliance & tax
13026
+ tax: 40,
13027
+ deadlines: 41,
13028
+ // Status / context / actions
13029
+ status: 50,
13030
+ context: 51,
13031
+ use: 52,
13032
+ next: 53,
13033
+ obligations: 54,
13034
+ "human-obligations": 55,
13035
+ digest: 56,
13036
+ // Services & work items
13037
+ services: 60,
13038
+ "work-items": 61,
13039
+ contracts: 62,
13040
+ // Agents
13041
+ agents: 70,
13042
+ // Admin / config / setup (last)
13043
+ billing: 80,
13044
+ "api-keys": 81,
13045
+ link: 82,
13046
+ claim: 83,
13047
+ feedback: 84,
13048
+ resolve: 85,
13049
+ find: 86,
13050
+ approvals: 87,
13051
+ receipts: 88,
13052
+ config: 90,
13053
+ setup: 91,
13054
+ schema: 92,
13055
+ serve: 93,
13056
+ demo: 94,
13057
+ chat: 95,
13058
+ completions: 96
13059
+ };
13060
+ topLevel.sort((a, b) => {
13061
+ const ga = commandGroupOrder[a.name] ?? 75;
13062
+ const gb = commandGroupOrder[b.name] ?? 75;
13063
+ if (ga !== gb) return ga - gb;
13064
+ return a.name.localeCompare(b.name);
13065
+ });
12641
13066
  const parentCmds = /* @__PURE__ */ new Map();
12642
13067
  for (const def of topLevel) {
12643
13068
  const cmd = wireCommand(program2, def);