@thecorporation/cli 26.3.6 → 26.3.9

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
@@ -154,7 +154,8 @@ __export(output_exports, {
154
154
  printSuccess: () => printSuccess,
155
155
  printTransfersTable: () => printTransfersTable,
156
156
  printValuationsTable: () => printValuationsTable,
157
- printWarning: () => printWarning
157
+ printWarning: () => printWarning,
158
+ printWorkItemsTable: () => printWorkItemsTable
158
159
  });
159
160
  import chalk from "chalk";
160
161
  import Table from "cli-table3";
@@ -201,14 +202,23 @@ function s(val, maxLen) {
201
202
  if (maxLen && str.length > maxLen) return str.slice(0, maxLen);
202
203
  return str;
203
204
  }
204
- function money(val) {
205
- if (typeof val === "number") return `$${val.toLocaleString()}`;
205
+ function money(val, cents = true) {
206
+ if (typeof val === "number") {
207
+ const dollars = cents ? val / 100 : val;
208
+ return `$${dollars.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
209
+ }
206
210
  return String(val ?? "");
207
211
  }
212
+ function date(val) {
213
+ const str = s(val);
214
+ if (!str) return "";
215
+ const parsed = new Date(str);
216
+ return Number.isNaN(parsed.getTime()) ? str : parsed.toISOString().slice(0, 10);
217
+ }
208
218
  function printEntitiesTable(entities) {
209
219
  const table = makeTable("Entities", ["ID", "Name", "Type", "Jurisdiction", "Status"]);
210
220
  for (const e of entities) {
211
- table.push([s(e.entity_id, 12), s(e.name), s(e.entity_type), s(e.jurisdiction), s(e.status)]);
221
+ table.push([s(e.entity_id, 12), s(e.legal_name ?? e.name), s(e.entity_type), s(e.jurisdiction), s(e.formation_status ?? e.status)]);
212
222
  }
213
223
  console.log(table.toString());
214
224
  }
@@ -279,7 +289,7 @@ function printSafesTable(safes) {
279
289
  table.push([
280
290
  s(s_.safe_id ?? s_.id, 12),
281
291
  s(s_.investor_name ?? s_.investor),
282
- money(s_.investment_amount ?? s_.amount),
292
+ money(s_.investment_amount ?? s_.amount, false),
283
293
  s(s_.valuation_cap ?? s_.cap),
284
294
  s(s_.discount_rate ?? s_.discount),
285
295
  s(s_.date ?? s_.created_at)
@@ -305,10 +315,10 @@ function printValuationsTable(valuations) {
305
315
  const table = makeTable("Valuations", ["Date", "Type", "Valuation", "PPS"]);
306
316
  for (const v of valuations) {
307
317
  table.push([
308
- s(v.valuation_date ?? v.date),
318
+ date(v.effective_date ?? v.valuation_date ?? v.date),
309
319
  s(v.valuation_type ?? v.type),
310
- s(v.enterprise_value ?? v.valuation),
311
- s(v.price_per_share ?? v.pps ?? v.fmv_per_share)
320
+ money(v.enterprise_value_cents ?? v.enterprise_value ?? v.valuation),
321
+ money(v.fmv_per_share_cents ?? v.price_per_share ?? v.pps ?? v.fmv_per_share)
312
322
  ]);
313
323
  }
314
324
  console.log(table.toString());
@@ -339,7 +349,7 @@ function printMeetingsTable(meetings) {
339
349
  table.push([
340
350
  s(m.meeting_id ?? m.id, 12),
341
351
  s(m.title ?? m.name),
342
- s(m.meeting_date ?? m.date),
352
+ s(m.scheduled_date ?? m.meeting_date ?? m.date),
343
353
  s(m.status),
344
354
  s(m.resolution_count ?? m.resolutions)
345
355
  ]);
@@ -376,6 +386,22 @@ function printDocumentsTable(docs) {
376
386
  }
377
387
  console.log(table.toString());
378
388
  }
389
+ function printWorkItemsTable(items) {
390
+ const table = makeTable("Work Items", ["ID", "Title", "Category", "Status", "Deadline", "Claimed By"]);
391
+ for (const w of items) {
392
+ const status = s(w.effective_status ?? w.status);
393
+ const colored = status === "completed" ? chalk.green(status) : status === "claimed" ? chalk.yellow(status) : status === "cancelled" ? chalk.dim(status) : status;
394
+ table.push([
395
+ s(w.work_item_id ?? w.id, 12),
396
+ s(w.title),
397
+ s(w.category),
398
+ colored,
399
+ w.asap ? chalk.red.bold("ASAP") : s(w.deadline ?? ""),
400
+ s(w.claimed_by ?? "")
401
+ ]);
402
+ }
403
+ console.log(table.toString());
404
+ }
379
405
  function printAgentsTable(agents) {
380
406
  const table = makeTable("Agents", ["ID", "Name", "Status", "Model"]);
381
407
  for (const a of agents) {
@@ -1253,10 +1279,11 @@ async function entitiesShowCommand(entityId, opts) {
1253
1279
  console.log(chalk3.blue("\u2500".repeat(40)));
1254
1280
  console.log(chalk3.blue.bold(" Entity Detail"));
1255
1281
  console.log(chalk3.blue("\u2500".repeat(40)));
1256
- console.log(` ${chalk3.bold("Name:")} ${entity.name ?? "N/A"}`);
1282
+ console.log(` ${chalk3.bold("Name:")} ${entity.legal_name ?? entity.name ?? "N/A"}`);
1257
1283
  console.log(` ${chalk3.bold("Type:")} ${entity.entity_type ?? "N/A"}`);
1258
1284
  console.log(` ${chalk3.bold("Jurisdiction:")} ${entity.jurisdiction ?? "N/A"}`);
1259
- console.log(` ${chalk3.bold("Status:")} ${entity.status ?? "N/A"}`);
1285
+ console.log(` ${chalk3.bold("Status:")} ${entity.formation_status ?? entity.status ?? "N/A"}`);
1286
+ console.log(` ${chalk3.bold("State:")} ${entity.formation_state ?? "N/A"}`);
1260
1287
  console.log(` ${chalk3.bold("ID:")} ${entity.entity_id ?? "N/A"}`);
1261
1288
  if (entity.formation_date) console.log(` ${chalk3.bold("Formation Date:")} ${entity.formation_date}`);
1262
1289
  if (entity.ein) console.log(` ${chalk3.bold("EIN:")} ${entity.ein}`);
@@ -1380,9 +1407,11 @@ async function contactsAddCommand(opts) {
1380
1407
  category: opts.category ?? "employee"
1381
1408
  };
1382
1409
  if (opts.phone) data.phone = opts.phone;
1383
- if (opts.notes) data.notes = opts.notes;
1384
1410
  const result = await client.createContact(data);
1385
1411
  printSuccess(`Contact created: ${result.contact_id ?? result.id ?? "OK"}`);
1412
+ if (opts.notes) {
1413
+ console.log(chalk4.dim(' Tip: To add notes, use: corp contacts edit <contact-id> --notes "..."'));
1414
+ }
1386
1415
  } catch (err) {
1387
1416
  printError(`Failed to create contact: ${err}`);
1388
1417
  process.exit(1);
@@ -1628,10 +1657,12 @@ async function transferSharesCommand(opts) {
1628
1657
  if (!intentId) {
1629
1658
  const intent = await client.createExecutionIntent({
1630
1659
  entity_id: eid,
1631
- intent_type: "share_transfer",
1660
+ intent_type: "equity.transfer.prepare",
1632
1661
  description: `Transfer ${opts.shares} shares from ${opts.from} to ${opts.to}`
1633
1662
  });
1634
1663
  intentId = intent.intent_id ?? intent.id;
1664
+ await client.evaluateIntent(intentId, eid);
1665
+ await client.authorizeIntent(intentId, eid);
1635
1666
  }
1636
1667
  const body = {
1637
1668
  entity_id: eid,
@@ -1788,9 +1819,11 @@ function print409a(data) {
1788
1819
  console.log(chalk5.green("\u2500".repeat(40)));
1789
1820
  console.log(chalk5.green.bold(" 409A Valuation"));
1790
1821
  console.log(chalk5.green("\u2500".repeat(40)));
1791
- console.log(` ${chalk5.bold("FMV/Share:")} $${data.fmv_per_share ?? "N/A"}`);
1792
- console.log(` ${chalk5.bold("Enterprise Value:")} $${data.enterprise_value ?? "N/A"}`);
1793
- console.log(` ${chalk5.bold("Valuation Date:")} ${data.valuation_date ?? "N/A"}`);
1822
+ const fmv = typeof data.fmv_per_share_cents === "number" ? data.fmv_per_share_cents / 100 : data.fmv_per_share;
1823
+ const enterpriseValue = typeof data.enterprise_value_cents === "number" ? data.enterprise_value_cents / 100 : data.enterprise_value;
1824
+ console.log(` ${chalk5.bold("FMV/Share:")} $${fmv ?? "N/A"}`);
1825
+ console.log(` ${chalk5.bold("Enterprise Value:")} $${enterpriseValue ?? "N/A"}`);
1826
+ console.log(` ${chalk5.bold("Valuation Date:")} ${data.effective_date ?? data.valuation_date ?? "N/A"}`);
1794
1827
  if (data.provider) console.log(` ${chalk5.bold("Provider:")} ${data.provider}`);
1795
1828
  console.log(chalk5.green("\u2500".repeat(40)));
1796
1829
  }
@@ -1858,6 +1891,7 @@ async function financePayCommand(opts) {
1858
1891
  entity_id: eid,
1859
1892
  amount_cents: opts.amount,
1860
1893
  recipient: opts.recipient,
1894
+ payment_method: opts.method,
1861
1895
  description: `Payment via ${opts.method}`
1862
1896
  });
1863
1897
  printSuccess(`Payment submitted: ${result.payment_id ?? "OK"}`);
@@ -1946,6 +1980,7 @@ __export(governance_exports, {
1946
1980
  sendNoticeCommand: () => sendNoticeCommand,
1947
1981
  writtenConsentCommand: () => writtenConsentCommand
1948
1982
  });
1983
+ import chalk6 from "chalk";
1949
1984
  async function governanceCreateBodyCommand(opts) {
1950
1985
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
1951
1986
  const eid = resolveEntityId(cfg, opts.entityId);
@@ -1958,8 +1993,12 @@ async function governanceCreateBodyCommand(opts) {
1958
1993
  quorum_rule: opts.quorum,
1959
1994
  voting_method: opts.voting
1960
1995
  });
1961
- printSuccess(`Governance body created: ${result.body_id ?? "OK"}`);
1996
+ const bodyId = result.body_id ?? "OK";
1997
+ printSuccess(`Governance body created: ${bodyId}`);
1962
1998
  printJson(result);
1999
+ console.log(chalk6.dim("\n Next steps:"));
2000
+ console.log(chalk6.dim(` corp governance add-seat ${bodyId} --holder <contact-id>`));
2001
+ console.log(chalk6.dim(` corp governance seats ${bodyId}`));
1963
2002
  } catch (err) {
1964
2003
  printError(`Failed to create governance body: ${err}`);
1965
2004
  process.exit(1);
@@ -2048,8 +2087,12 @@ async function governanceConveneCommand(opts) {
2048
2087
  scheduled_date: opts.date,
2049
2088
  agenda_item_titles: opts.agenda
2050
2089
  });
2051
- printSuccess(`Meeting scheduled: ${result.meeting_id ?? "OK"}`);
2090
+ const meetingId = result.meeting_id ?? "OK";
2091
+ printSuccess(`Meeting scheduled: ${meetingId}`);
2052
2092
  printJson(result);
2093
+ console.log(chalk6.dim("\n Next steps:"));
2094
+ console.log(chalk6.dim(` corp governance notice ${meetingId}`));
2095
+ console.log(chalk6.dim(` corp governance agenda-items ${meetingId}`));
2053
2096
  } catch (err) {
2054
2097
  printError(`Failed to schedule meeting: ${err}`);
2055
2098
  process.exit(1);
@@ -2152,8 +2195,12 @@ async function writtenConsentCommand(opts) {
2152
2195
  title: opts.title,
2153
2196
  description: opts.description
2154
2197
  });
2155
- printSuccess(`Written consent created: ${result.meeting_id ?? "OK"}`);
2198
+ const meetingId = result.meeting_id ?? "OK";
2199
+ printSuccess(`Written consent created: ${meetingId}`);
2156
2200
  printJson(result);
2201
+ console.log(chalk6.dim("\n Next steps:"));
2202
+ console.log(chalk6.dim(` corp governance agenda-items ${meetingId}`));
2203
+ console.log(chalk6.dim(` corp governance vote ${meetingId} <item-id> --voter <contact-uuid> --vote for`));
2157
2204
  } catch (err) {
2158
2205
  printError(`Failed to create written consent: ${err}`);
2159
2206
  process.exit(1);
@@ -2167,7 +2214,22 @@ async function listAgendaItemsCommand(meetingId, opts) {
2167
2214
  const items = await client.listAgendaItems(meetingId, eid);
2168
2215
  if (opts.json) printJson(items);
2169
2216
  else if (items.length === 0) console.log("No agenda items found.");
2170
- else printJson(items);
2217
+ else {
2218
+ const Table4 = (await import("cli-table3")).default;
2219
+ const chalk11 = (await import("chalk")).default;
2220
+ console.log(`
2221
+ ${chalk11.bold("Agenda Items")}`);
2222
+ const table = new Table4({ head: [chalk11.dim("ID"), chalk11.dim("Title"), chalk11.dim("Status"), chalk11.dim("Type")] });
2223
+ for (const item of items) {
2224
+ table.push([
2225
+ String(item.item_id ?? item.agenda_item_id ?? item.id ?? "").slice(0, 12),
2226
+ String(item.title ?? ""),
2227
+ String(item.status ?? ""),
2228
+ String(item.item_type ?? item.type ?? "")
2229
+ ]);
2230
+ }
2231
+ console.log(table.toString());
2232
+ }
2171
2233
  } catch (err) {
2172
2234
  printError(`Failed to list agenda items: ${err}`);
2173
2235
  process.exit(1);
@@ -2242,11 +2304,16 @@ async function documentsGenerateCommand(opts) {
2242
2304
  async function documentsPreviewPdfCommand(opts) {
2243
2305
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2244
2306
  const eid = resolveEntityId(cfg, opts.entityId);
2245
- const apiUrl = cfg.api_url.replace(/\/+$/, "");
2246
- const qs = new URLSearchParams({ entity_id: eid, document_id: opts.documentId }).toString();
2247
- const url = `${apiUrl}/v1/documents/preview/pdf?${qs}`;
2248
- printSuccess(`Preview PDF URL: ${url}`);
2249
- console.log("Use your API key to authenticate the download.");
2307
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2308
+ try {
2309
+ await client.validatePreviewPdf(eid, opts.documentId);
2310
+ const url = client.getPreviewPdfUrl(eid, opts.documentId);
2311
+ printSuccess(`Preview PDF URL: ${url}`);
2312
+ console.log("The document definition was validated successfully. Use your API key to download the PDF.");
2313
+ } catch (err) {
2314
+ printError(`Failed to validate preview PDF: ${err}`);
2315
+ process.exit(1);
2316
+ }
2250
2317
  }
2251
2318
  var init_documents = __esm({
2252
2319
  "src/commands/documents.ts"() {
@@ -2263,6 +2330,11 @@ __export(tax_exports, {
2263
2330
  taxDeadlineCommand: () => taxDeadlineCommand,
2264
2331
  taxFileCommand: () => taxFileCommand
2265
2332
  });
2333
+ function normalizeRecurrence(recurrence) {
2334
+ if (!recurrence) return void 0;
2335
+ if (recurrence === "yearly") return "annual";
2336
+ return recurrence;
2337
+ }
2266
2338
  async function taxFileCommand(opts) {
2267
2339
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2268
2340
  const eid = resolveEntityId(cfg, opts.entityId);
@@ -2281,13 +2353,15 @@ async function taxDeadlineCommand(opts) {
2281
2353
  const eid = resolveEntityId(cfg, opts.entityId);
2282
2354
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2283
2355
  try {
2284
- const result = await client.trackDeadline({
2356
+ const payload = {
2285
2357
  entity_id: eid,
2286
2358
  deadline_type: opts.type,
2287
2359
  due_date: opts.dueDate,
2288
- description: opts.description,
2289
- recurrence: opts.recurrence ?? ""
2290
- });
2360
+ description: opts.description
2361
+ };
2362
+ const recurrence = normalizeRecurrence(opts.recurrence);
2363
+ if (recurrence) payload.recurrence = recurrence;
2364
+ const result = await client.trackDeadline(payload);
2291
2365
  printSuccess(`Deadline tracked: ${result.deadline_id ?? "OK"}`);
2292
2366
  printJson(result);
2293
2367
  } catch (err) {
@@ -2317,7 +2391,7 @@ __export(agents_exports, {
2317
2391
  agentsShowCommand: () => agentsShowCommand,
2318
2392
  agentsSkillCommand: () => agentsSkillCommand
2319
2393
  });
2320
- import chalk6 from "chalk";
2394
+ import chalk7 from "chalk";
2321
2395
  async function agentsListCommand(opts) {
2322
2396
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2323
2397
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
@@ -2340,22 +2414,22 @@ async function agentsShowCommand(agentId, opts) {
2340
2414
  printJson(agent);
2341
2415
  return;
2342
2416
  }
2343
- console.log(chalk6.magenta("\u2500".repeat(40)));
2344
- console.log(chalk6.magenta.bold(" Agent Detail"));
2345
- console.log(chalk6.magenta("\u2500".repeat(40)));
2346
- console.log(` ${chalk6.bold("Name:")} ${agent.name ?? "N/A"}`);
2347
- console.log(` ${chalk6.bold("Status:")} ${agent.status ?? "N/A"}`);
2348
- console.log(` ${chalk6.bold("Model:")} ${agent.model ?? "N/A"}`);
2349
- console.log(` ${chalk6.bold("ID:")} ${agent.agent_id ?? "N/A"}`);
2417
+ console.log(chalk7.magenta("\u2500".repeat(40)));
2418
+ console.log(chalk7.magenta.bold(" Agent Detail"));
2419
+ console.log(chalk7.magenta("\u2500".repeat(40)));
2420
+ console.log(` ${chalk7.bold("Name:")} ${agent.name ?? "N/A"}`);
2421
+ console.log(` ${chalk7.bold("Status:")} ${agent.status ?? "N/A"}`);
2422
+ console.log(` ${chalk7.bold("Model:")} ${agent.model ?? "N/A"}`);
2423
+ console.log(` ${chalk7.bold("ID:")} ${agent.agent_id ?? "N/A"}`);
2350
2424
  if (agent.system_prompt) {
2351
2425
  let prompt = String(agent.system_prompt);
2352
2426
  if (prompt.length > 100) prompt = prompt.slice(0, 97) + "...";
2353
- console.log(` ${chalk6.bold("Prompt:")} ${prompt}`);
2427
+ console.log(` ${chalk7.bold("Prompt:")} ${prompt}`);
2354
2428
  }
2355
2429
  if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {
2356
- console.log(` ${chalk6.bold("Skills:")} ${agent.skills.map((s2) => s2.name ?? "?").join(", ")}`);
2430
+ console.log(` ${chalk7.bold("Skills:")} ${agent.skills.map((s2) => s2.name ?? "?").join(", ")}`);
2357
2431
  }
2358
- console.log(chalk6.magenta("\u2500".repeat(40)));
2432
+ console.log(chalk7.magenta("\u2500".repeat(40)));
2359
2433
  } catch (err) {
2360
2434
  printError(`Failed to fetch agent: ${err}`);
2361
2435
  process.exit(1);
@@ -2369,6 +2443,7 @@ async function agentsCreateCommand(opts) {
2369
2443
  if (opts.model) data.model = opts.model;
2370
2444
  const result = await client.createAgent(data);
2371
2445
  printSuccess(`Agent created: ${result.agent_id ?? result.id ?? "OK"}`);
2446
+ printJson(result);
2372
2447
  } catch (err) {
2373
2448
  printError(`Failed to create agent: ${err}`);
2374
2449
  process.exit(1);
@@ -2451,6 +2526,146 @@ var init_agents = __esm({
2451
2526
  }
2452
2527
  });
2453
2528
 
2529
+ // src/commands/work-items.ts
2530
+ var work_items_exports = {};
2531
+ __export(work_items_exports, {
2532
+ workItemsCancelCommand: () => workItemsCancelCommand,
2533
+ workItemsClaimCommand: () => workItemsClaimCommand,
2534
+ workItemsCompleteCommand: () => workItemsCompleteCommand,
2535
+ workItemsCreateCommand: () => workItemsCreateCommand,
2536
+ workItemsListCommand: () => workItemsListCommand,
2537
+ workItemsReleaseCommand: () => workItemsReleaseCommand,
2538
+ workItemsShowCommand: () => workItemsShowCommand
2539
+ });
2540
+ import chalk8 from "chalk";
2541
+ async function workItemsListCommand(opts) {
2542
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2543
+ const eid = resolveEntityId(cfg, opts.entityId);
2544
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2545
+ try {
2546
+ const params = {};
2547
+ if (opts.status) params.status = opts.status;
2548
+ if (opts.category) params.category = opts.category;
2549
+ const items = await client.listWorkItems(eid, Object.keys(params).length > 0 ? params : void 0);
2550
+ if (opts.json) printJson(items);
2551
+ else if (items.length === 0) console.log("No work items found.");
2552
+ else printWorkItemsTable(items);
2553
+ } catch (err) {
2554
+ printError(`Failed to fetch work items: ${err}`);
2555
+ process.exit(1);
2556
+ }
2557
+ }
2558
+ async function workItemsShowCommand(workItemId, opts) {
2559
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2560
+ const eid = resolveEntityId(cfg, opts.entityId);
2561
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2562
+ try {
2563
+ const w = await client.getWorkItem(eid, workItemId);
2564
+ if (opts.json) {
2565
+ printJson(w);
2566
+ return;
2567
+ }
2568
+ console.log(chalk8.cyan("\u2500".repeat(40)));
2569
+ console.log(chalk8.cyan.bold(" Work Item Detail"));
2570
+ console.log(chalk8.cyan("\u2500".repeat(40)));
2571
+ console.log(` ${chalk8.bold("Title:")} ${w.title ?? "N/A"}`);
2572
+ console.log(` ${chalk8.bold("Category:")} ${w.category ?? "N/A"}`);
2573
+ console.log(` ${chalk8.bold("Status:")} ${w.effective_status ?? w.status ?? "N/A"}`);
2574
+ if (w.description) console.log(` ${chalk8.bold("Description:")} ${w.description}`);
2575
+ if (w.deadline) console.log(` ${chalk8.bold("Deadline:")} ${w.deadline}`);
2576
+ if (w.asap) console.log(` ${chalk8.bold("Priority:")} ${chalk8.red.bold("ASAP")}`);
2577
+ if (w.claimed_by) console.log(` ${chalk8.bold("Claimed by:")} ${w.claimed_by}`);
2578
+ if (w.claimed_at) console.log(` ${chalk8.bold("Claimed at:")} ${w.claimed_at}`);
2579
+ if (w.claim_ttl_seconds) console.log(` ${chalk8.bold("Claim TTL:")} ${w.claim_ttl_seconds}s`);
2580
+ if (w.completed_by) console.log(` ${chalk8.bold("Completed by:")} ${w.completed_by}`);
2581
+ if (w.completed_at) console.log(` ${chalk8.bold("Completed at:")} ${w.completed_at}`);
2582
+ if (w.result) console.log(` ${chalk8.bold("Result:")} ${w.result}`);
2583
+ if (w.created_by) console.log(` ${chalk8.bold("Created by:")} ${w.created_by}`);
2584
+ console.log(` ${chalk8.bold("Created at:")} ${w.created_at ?? "N/A"}`);
2585
+ console.log(chalk8.cyan("\u2500".repeat(40)));
2586
+ } catch (err) {
2587
+ printError(`Failed to fetch work item: ${err}`);
2588
+ process.exit(1);
2589
+ }
2590
+ }
2591
+ async function workItemsCreateCommand(opts) {
2592
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2593
+ const eid = resolveEntityId(cfg, opts.entityId);
2594
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2595
+ try {
2596
+ const data = { title: opts.title, category: opts.category };
2597
+ if (opts.description) data.description = opts.description;
2598
+ if (opts.deadline) data.deadline = opts.deadline;
2599
+ if (opts.asap) data.asap = true;
2600
+ if (opts.createdBy) data.created_by = opts.createdBy;
2601
+ const result = await client.createWorkItem(eid, data);
2602
+ printSuccess(`Work item created: ${result.work_item_id ?? result.id ?? "OK"}`);
2603
+ } catch (err) {
2604
+ printError(`Failed to create work item: ${err}`);
2605
+ process.exit(1);
2606
+ }
2607
+ }
2608
+ async function workItemsClaimCommand(workItemId, opts) {
2609
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2610
+ const eid = resolveEntityId(cfg, opts.entityId);
2611
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2612
+ try {
2613
+ const data = { claimed_by: opts.claimedBy };
2614
+ if (opts.ttl != null) data.ttl_seconds = opts.ttl;
2615
+ await client.claimWorkItem(eid, workItemId, data);
2616
+ printSuccess(`Work item ${workItemId} claimed by ${opts.claimedBy}.`);
2617
+ } catch (err) {
2618
+ printError(`Failed to claim work item: ${err}`);
2619
+ process.exit(1);
2620
+ }
2621
+ }
2622
+ async function workItemsCompleteCommand(workItemId, opts) {
2623
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2624
+ const eid = resolveEntityId(cfg, opts.entityId);
2625
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2626
+ try {
2627
+ const data = { completed_by: opts.completedBy };
2628
+ if (opts.result) data.result = opts.result;
2629
+ await client.completeWorkItem(eid, workItemId, data);
2630
+ printSuccess(`Work item ${workItemId} completed.`);
2631
+ } catch (err) {
2632
+ printError(`Failed to complete work item: ${err}`);
2633
+ process.exit(1);
2634
+ }
2635
+ }
2636
+ async function workItemsReleaseCommand(workItemId, opts) {
2637
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2638
+ const eid = resolveEntityId(cfg, opts.entityId);
2639
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2640
+ try {
2641
+ await client.releaseWorkItem(eid, workItemId);
2642
+ printSuccess(`Work item ${workItemId} claim released.`);
2643
+ } catch (err) {
2644
+ printError(`Failed to release work item: ${err}`);
2645
+ process.exit(1);
2646
+ }
2647
+ }
2648
+ async function workItemsCancelCommand(workItemId, opts) {
2649
+ const cfg = requireConfig("api_url", "api_key", "workspace_id");
2650
+ const eid = resolveEntityId(cfg, opts.entityId);
2651
+ const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2652
+ try {
2653
+ await client.cancelWorkItem(eid, workItemId);
2654
+ printSuccess(`Work item ${workItemId} cancelled.`);
2655
+ } catch (err) {
2656
+ printError(`Failed to cancel work item: ${err}`);
2657
+ process.exit(1);
2658
+ }
2659
+ }
2660
+ var init_work_items = __esm({
2661
+ "src/commands/work-items.ts"() {
2662
+ "use strict";
2663
+ init_config();
2664
+ init_api_client();
2665
+ init_output();
2666
+ }
2667
+ });
2668
+
2454
2669
  // src/commands/billing.ts
2455
2670
  var billing_exports = {};
2456
2671
  __export(billing_exports, {
@@ -2458,18 +2673,10 @@ __export(billing_exports, {
2458
2673
  billingPortalCommand: () => billingPortalCommand,
2459
2674
  billingUpgradeCommand: () => billingUpgradeCommand
2460
2675
  });
2461
- import { execSync } from "child_process";
2462
2676
  function makeClient() {
2463
2677
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2464
2678
  return new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2465
2679
  }
2466
- function openUrl(url) {
2467
- try {
2468
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
2469
- execSync(`${cmd} ${JSON.stringify(url)}`, { stdio: "ignore" });
2470
- } catch {
2471
- }
2472
- }
2473
2680
  async function billingCommand(opts) {
2474
2681
  const client = makeClient();
2475
2682
  try {
@@ -2490,10 +2697,8 @@ async function billingPortalCommand() {
2490
2697
  printError("No portal URL returned. Ensure you have an active subscription.");
2491
2698
  process.exit(1);
2492
2699
  }
2493
- console.log(`Opening Stripe Customer Portal...
2494
- ${url}`);
2495
- openUrl(url);
2496
- printSuccess("Portal opened in your browser.");
2700
+ printSuccess("Stripe Customer Portal URL:");
2701
+ console.log(url);
2497
2702
  } catch (err) {
2498
2703
  printError(`Failed to create portal session: ${err}`);
2499
2704
  process.exit(1);
@@ -2508,10 +2713,8 @@ async function billingUpgradeCommand(opts) {
2508
2713
  printError("No checkout URL returned.");
2509
2714
  process.exit(1);
2510
2715
  }
2511
- console.log(`Opening Stripe Checkout for ${opts.plan}...
2512
- ${url}`);
2513
- openUrl(url);
2514
- printSuccess("Checkout opened in your browser.");
2716
+ printSuccess(`Stripe Checkout URL for ${opts.plan}:`);
2717
+ console.log(url);
2515
2718
  } catch (err) {
2516
2719
  printError(`Failed to create checkout session: ${err}`);
2517
2720
  process.exit(1);
@@ -2535,16 +2738,17 @@ __export(form_exports, {
2535
2738
  formFinalizeCommand: () => formFinalizeCommand
2536
2739
  });
2537
2740
  import { input as input2, select, confirm as confirm2, number } from "@inquirer/prompts";
2538
- import chalk7 from "chalk";
2741
+ import chalk9 from "chalk";
2539
2742
  import Table2 from "cli-table3";
2743
+ import { OfficerTitle } from "@thecorporation/corp-tools";
2540
2744
  function isCorp(entityType) {
2541
2745
  return entityType === "c_corp" || entityType === "s_corp" || entityType === "corporation";
2542
2746
  }
2543
2747
  function sectionHeader(title) {
2544
2748
  console.log();
2545
- console.log(chalk7.blue("\u2500".repeat(50)));
2546
- console.log(chalk7.blue.bold(` ${title}`));
2547
- console.log(chalk7.blue("\u2500".repeat(50)));
2749
+ console.log(chalk9.blue("\u2500".repeat(50)));
2750
+ console.log(chalk9.blue.bold(` ${title}`));
2751
+ console.log(chalk9.blue("\u2500".repeat(50)));
2548
2752
  }
2549
2753
  async function promptAddress() {
2550
2754
  const street = await input2({ message: " Street address" });
@@ -2624,7 +2828,7 @@ async function phasePeople(opts, entityType, scripted) {
2624
2828
  }
2625
2829
  const founderCount = await number({ message: "Number of founders (1-6)", default: 1 }) ?? 1;
2626
2830
  for (let i = 0; i < founderCount; i++) {
2627
- console.log(chalk7.dim(`
2831
+ console.log(chalk9.dim(`
2628
2832
  Founder ${i + 1} of ${founderCount}:`));
2629
2833
  const name = await input2({ message: ` Name` });
2630
2834
  const email = await input2({ message: ` Email` });
@@ -2647,13 +2851,10 @@ async function phasePeople(opts, entityType, scripted) {
2647
2851
  if (wantOfficer) {
2648
2852
  officerTitle = await select({
2649
2853
  message: " Officer title",
2650
- choices: [
2651
- { value: "ceo", name: "CEO" },
2652
- { value: "cfo", name: "CFO" },
2653
- { value: "secretary", name: "Secretary" },
2654
- { value: "president", name: "President" },
2655
- { value: "vp", name: "VP" }
2656
- ]
2854
+ choices: OfficerTitle.map((t) => ({
2855
+ value: t,
2856
+ name: t === "ceo" ? "CEO" : t === "cfo" ? "CFO" : t === "vp" ? "VP" : t.charAt(0).toUpperCase() + t.slice(1)
2857
+ }))
2657
2858
  });
2658
2859
  }
2659
2860
  }
@@ -2673,7 +2874,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
2673
2874
  const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
2674
2875
  if (!scripted) {
2675
2876
  for (const f of founders) {
2676
- console.log(chalk7.dim(`
2877
+ console.log(chalk9.dim(`
2677
2878
  Equity for ${f.name}:`));
2678
2879
  if (isCorp(entityType)) {
2679
2880
  const shares = await number({ message: ` Shares to purchase`, default: 0 });
@@ -2719,17 +2920,17 @@ async function phaseStock(opts, entityType, founders, scripted) {
2719
2920
  }
2720
2921
  function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr) {
2721
2922
  sectionHeader("Formation Summary");
2722
- console.log(` ${chalk7.bold("Entity:")} ${name}`);
2723
- console.log(` ${chalk7.bold("Type:")} ${entityType}`);
2724
- console.log(` ${chalk7.bold("Jurisdiction:")} ${jurisdiction}`);
2725
- console.log(` ${chalk7.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
2923
+ console.log(` ${chalk9.bold("Entity:")} ${name}`);
2924
+ console.log(` ${chalk9.bold("Type:")} ${entityType}`);
2925
+ console.log(` ${chalk9.bold("Jurisdiction:")} ${jurisdiction}`);
2926
+ console.log(` ${chalk9.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
2726
2927
  if (isCorp(entityType)) {
2727
- console.log(` ${chalk7.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
2728
- console.log(` ${chalk7.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
2729
- console.log(` ${chalk7.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
2928
+ console.log(` ${chalk9.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
2929
+ console.log(` ${chalk9.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
2930
+ console.log(` ${chalk9.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
2730
2931
  }
2731
2932
  const table = new Table2({
2732
- head: [chalk7.dim("Name"), chalk7.dim("Email"), chalk7.dim("Role"), chalk7.dim("Equity"), chalk7.dim("Officer")]
2933
+ head: [chalk9.dim("Name"), chalk9.dim("Email"), chalk9.dim("Role"), chalk9.dim("Equity"), chalk9.dim("Officer")]
2733
2934
  });
2734
2935
  for (const f of founders) {
2735
2936
  const equity = f.shares_purchased ? `${f.shares_purchased.toLocaleString()} shares` : f.ownership_pct ? `${f.ownership_pct}%` : "\u2014";
@@ -2753,7 +2954,7 @@ async function formCommand(opts) {
2753
2954
  printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);
2754
2955
  const shouldProceed = scripted ? true : await confirm2({ message: "Proceed with formation?", default: true });
2755
2956
  if (!shouldProceed) {
2756
- console.log(chalk7.yellow("Formation cancelled."));
2957
+ console.log(chalk9.yellow("Formation cancelled."));
2757
2958
  return;
2758
2959
  }
2759
2960
  const members = founders.map((f) => {
@@ -2785,7 +2986,7 @@ async function formCommand(opts) {
2785
2986
  };
2786
2987
  if (companyAddress) payload.company_address = companyAddress;
2787
2988
  const result = await client.createFormationWithCapTable(payload);
2788
- printSuccess(`Formation created: ${result.formation_id ?? result.id ?? "OK"}`);
2989
+ printSuccess(`Formation created: ${result.formation_id ?? "OK"}`);
2789
2990
  if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);
2790
2991
  if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
2791
2992
  if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);
@@ -2797,17 +2998,17 @@ async function formCommand(opts) {
2797
2998
  if (holders.length > 0) {
2798
2999
  console.log();
2799
3000
  const table = new Table2({
2800
- head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
3001
+ head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
2801
3002
  });
2802
3003
  for (const h of holders) {
2803
3004
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
2804
3005
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
2805
3006
  }
2806
- console.log(chalk7.bold(" Cap Table:"));
3007
+ console.log(chalk9.bold(" Cap Table:"));
2807
3008
  console.log(table.toString());
2808
3009
  }
2809
3010
  if (result.next_action) {
2810
- console.log(chalk7.yellow(`
3011
+ console.log(chalk9.yellow(`
2811
3012
  Next: ${result.next_action}`));
2812
3013
  }
2813
3014
  } catch (err) {
@@ -2832,7 +3033,7 @@ async function formCreateCommand(opts) {
2832
3033
  console.log(` Type: ${result.entity_type}`);
2833
3034
  console.log(` Jurisdiction: ${result.jurisdiction}`);
2834
3035
  console.log(` Status: ${result.formation_status}`);
2835
- console.log(chalk7.yellow(`
3036
+ console.log(chalk9.yellow(`
2836
3037
  Next: corp form add-founder ${result.entity_id} --name "..." --email "..." --role member --pct 50`));
2837
3038
  } catch (err) {
2838
3039
  printError(`Failed to create pending entity: ${err}`);
@@ -2849,7 +3050,7 @@ async function formAddFounderCommand(entityId, opts) {
2849
3050
  role: opts.role,
2850
3051
  ownership_pct: parseFloat(opts.pct)
2851
3052
  };
2852
- if (opts.officerTitle) payload.officer_title = opts.officerTitle;
3053
+ if (opts.officerTitle) payload.officer_title = opts.officerTitle.toLowerCase();
2853
3054
  if (opts.incorporator) payload.is_incorporator = true;
2854
3055
  const result = await client.addFounder(entityId, payload);
2855
3056
  printSuccess(`Founder added (${result.member_count} total)`);
@@ -2858,7 +3059,7 @@ async function formAddFounderCommand(entityId, opts) {
2858
3059
  const pct = typeof m.ownership_pct === "number" ? ` (${m.ownership_pct}%)` : "";
2859
3060
  console.log(` - ${m.name} <${m.email ?? "no email"}> [${m.role ?? "member"}]${pct}`);
2860
3061
  }
2861
- console.log(chalk7.yellow(`
3062
+ console.log(chalk9.yellow(`
2862
3063
  Next: add more founders or run: corp form finalize ${entityId}`));
2863
3064
  } catch (err) {
2864
3065
  printError(`Failed to add founder: ${err}`);
@@ -2881,17 +3082,17 @@ async function formFinalizeCommand(entityId) {
2881
3082
  if (holders.length > 0) {
2882
3083
  console.log();
2883
3084
  const table = new Table2({
2884
- head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
3085
+ head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
2885
3086
  });
2886
3087
  for (const h of holders) {
2887
3088
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
2888
3089
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
2889
3090
  }
2890
- console.log(chalk7.bold(" Cap Table:"));
3091
+ console.log(chalk9.bold(" Cap Table:"));
2891
3092
  console.log(table.toString());
2892
3093
  }
2893
3094
  if (result.next_action) {
2894
- console.log(chalk7.yellow(`
3095
+ console.log(chalk9.yellow(`
2895
3096
  Next: ${result.next_action}`));
2896
3097
  }
2897
3098
  } catch (err) {
@@ -2913,7 +3114,7 @@ var api_keys_exports = {};
2913
3114
  __export(api_keys_exports, {
2914
3115
  apiKeysCommand: () => apiKeysCommand
2915
3116
  });
2916
- import chalk8 from "chalk";
3117
+ import chalk10 from "chalk";
2917
3118
  import Table3 from "cli-table3";
2918
3119
  async function apiKeysCommand(opts) {
2919
3120
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -2921,7 +3122,11 @@ async function apiKeysCommand(opts) {
2921
3122
  try {
2922
3123
  const keys = await client.listApiKeys();
2923
3124
  if (opts.json) {
2924
- printJson(keys);
3125
+ printJson(keys.map((k) => ({
3126
+ ...k,
3127
+ ...k.key != null ? { key: maskKey(String(k.key)) } : {},
3128
+ ...k.api_key != null ? { api_key: maskKey(String(k.api_key)) } : {}
3129
+ })));
2925
3130
  return;
2926
3131
  }
2927
3132
  if (keys.length === 0) {
@@ -2929,17 +3134,16 @@ async function apiKeysCommand(opts) {
2929
3134
  return;
2930
3135
  }
2931
3136
  console.log(`
2932
- ${chalk8.bold("API Keys")}`);
3137
+ ${chalk10.bold("API Keys")}`);
2933
3138
  const table = new Table3({
2934
- head: [chalk8.dim("ID"), chalk8.dim("Name"), chalk8.dim("Key"), chalk8.dim("Created"), chalk8.dim("Last Used")]
3139
+ head: [chalk10.dim("ID"), chalk10.dim("Name"), chalk10.dim("Key"), chalk10.dim("Created")]
2935
3140
  });
2936
3141
  for (const k of keys) {
2937
3142
  table.push([
2938
- String(k.id ?? k.api_key_id ?? "").slice(0, 12),
3143
+ String(k.key_id ?? k.id ?? k.api_key_id ?? "").slice(0, 12),
2939
3144
  String(k.name ?? ""),
2940
3145
  maskKey(String(k.key ?? k.api_key ?? "")),
2941
- String(k.created_at ?? ""),
2942
- String(k.last_used_at ?? "")
3146
+ String(k.created_at ?? "")
2943
3147
  ]);
2944
3148
  }
2945
3149
  console.log(table.toString());
@@ -3117,7 +3321,7 @@ INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
3117
3321
  });
3118
3322
 
3119
3323
  // src/index.ts
3120
- import { Command } from "commander";
3324
+ import { Command, Option } from "commander";
3121
3325
  import { createRequire } from "module";
3122
3326
  var require2 = createRequire(import.meta.url);
3123
3327
  var pkg = require2("../package.json");
@@ -3233,7 +3437,7 @@ capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor
3233
3437
  const { issueSafeCommand: issueSafeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
3234
3438
  await issueSafeCommand2({ ...opts, entityId: parent.entityId });
3235
3439
  });
3236
- capTableCmd.command("transfer").requiredOption("--from <id>", "Source contact ID (from_contact_id)").requiredOption("--to <id>", "Destination contact ID (to_contact_id)").requiredOption("--shares <n>", "Number of shares to transfer", parseInt).requiredOption("--share-class-id <id>", "Share class ID").requiredOption("--governing-doc-type <type>", "Governing document type").requiredOption("--transferee-rights <rights>", "Transferee rights").option("--prepare-intent-id <id>", "Prepare intent ID (auto-created if omitted)").option("--type <type>", "Transfer type", "sale").option("--price-per-share-cents <n>", "Price per share in cents", parseInt).option("--relationship <rel>", "Relationship to holder").description("Create a share transfer workflow").action(async (opts, cmd) => {
3440
+ capTableCmd.command("transfer").requiredOption("--from <id>", "Source contact ID (from_contact_id)").requiredOption("--to <id>", "Destination contact ID (to_contact_id)").requiredOption("--shares <n>", "Number of shares to transfer", parseInt).requiredOption("--share-class-id <id>", "Share class ID").requiredOption("--governing-doc-type <type>", "Governing doc type (bylaws, operating_agreement, shareholder_agreement, other)").requiredOption("--transferee-rights <rights>", "Transferee rights (full_member, economic_only, limited)").option("--prepare-intent-id <id>", "Prepare intent ID (auto-created if omitted)").option("--type <type>", "Transfer type (gift, trust_transfer, secondary_sale, estate, other)", "secondary_sale").option("--price-per-share-cents <n>", "Price per share in cents", parseInt).option("--relationship <rel>", "Relationship to holder").description("Create a share transfer workflow").action(async (opts, cmd) => {
3237
3441
  const parent = cmd.parent.opts();
3238
3442
  const { transferSharesCommand: transferSharesCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
3239
3443
  await transferSharesCommand2({ ...opts, entityId: parent.entityId });
@@ -3338,7 +3542,7 @@ governanceCmd.command("convene").requiredOption("--body <id>", "Governance body
3338
3542
  const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3339
3543
  await governanceConveneCommand2({ ...opts, meetingType: opts.type, entityId: parent.entityId });
3340
3544
  });
3341
- governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").requiredOption("--vote <value>", "Vote (for, against, abstain, recusal)").description("Cast a vote on an agenda item").action(async (meetingId, itemId, opts) => {
3545
+ governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").addOption(new Option("--vote <value>", "Vote (for, against, abstain, recusal)").choices(["for", "against", "abstain", "recusal"]).makeOptionMandatory()).description("Cast a vote on an agenda item").action(async (meetingId, itemId, opts) => {
3342
3546
  const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3343
3547
  await governanceVoteCommand2(meetingId, itemId, opts);
3344
3548
  });
@@ -3362,7 +3566,7 @@ governanceCmd.command("agenda-items <meeting-id>").description("List agenda item
3362
3566
  const { listAgendaItemsCommand: listAgendaItemsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3363
3567
  await listAgendaItemsCommand2(meetingId, { entityId: parent.entityId, json: parent.json });
3364
3568
  });
3365
- governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status: voted, discussed, tabled, or withdrawn").description("Finalize an agenda item").action(async (meetingId, itemId, opts, cmd) => {
3569
+ governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status: voted, discussed, tabled, withdrawn").description("Finalize an agenda item").action(async (meetingId, itemId, opts, cmd) => {
3366
3570
  const parent = cmd.parent.opts();
3367
3571
  const { finalizeAgendaItemCommand: finalizeAgendaItemCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3368
3572
  await finalizeAgendaItemCommand2(meetingId, itemId, { ...opts, entityId: parent.entityId });
@@ -3391,7 +3595,7 @@ documentsCmd.command("generate").requiredOption("--template <type>", "Template t
3391
3595
  const { documentsGenerateCommand: documentsGenerateCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
3392
3596
  await documentsGenerateCommand2({ ...opts, entityId: parent.entityId });
3393
3597
  });
3394
- documentsCmd.command("preview-pdf").requiredOption("--document-id <id>", "AST document definition ID (e.g. 'bylaws')").description("Preview a governance document as PDF").action(async (opts, cmd) => {
3598
+ documentsCmd.command("preview-pdf").requiredOption("--document-id <id>", "AST document definition ID (e.g. 'bylaws')").description("Validate and print the authenticated PDF preview URL for a governance document").action(async (opts, cmd) => {
3395
3599
  const parent = cmd.parent.opts();
3396
3600
  const { documentsPreviewPdfCommand: documentsPreviewPdfCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
3397
3601
  await documentsPreviewPdfCommand2({ ...opts, entityId: parent.entityId });
@@ -3402,7 +3606,7 @@ taxCmd.command("file").requiredOption("--type <type>", "Document type").required
3402
3606
  const { taxFileCommand: taxFileCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
3403
3607
  await taxFileCommand2({ ...opts, entityId: parent.entityId });
3404
3608
  });
3405
- taxCmd.command("deadline").requiredOption("--type <type>", "Deadline type").requiredOption("--due-date <date>", "Due date (ISO 8601)").requiredOption("--description <desc>", "Description").option("--recurrence <recurrence>", "Recurrence").description("Track a compliance deadline").action(async (opts, cmd) => {
3609
+ taxCmd.command("deadline").requiredOption("--type <type>", "Deadline type").requiredOption("--due-date <date>", "Due date (ISO 8601)").requiredOption("--description <desc>", "Description").option("--recurrence <recurrence>", "Recurrence (e.g. annual; 'yearly' is normalized)").description("Track a compliance deadline").action(async (opts, cmd) => {
3406
3610
  const parent = cmd.parent.opts();
3407
3611
  const { taxDeadlineCommand: taxDeadlineCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
3408
3612
  await taxDeadlineCommand2({ ...opts, entityId: parent.entityId });
@@ -3435,14 +3639,44 @@ agentsCmd.command("message <agent-id>").requiredOption("--body <text>", "Message
3435
3639
  const { agentsMessageCommand: agentsMessageCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3436
3640
  await agentsMessageCommand2(agentId, opts);
3437
3641
  });
3438
- agentsCmd.command("executions <agent-id>").option("--json", "Output as JSON").description("List agent execution history").action(async (agentId, opts) => {
3439
- const { agentsExecutionsCommand: agentsExecutionsCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3440
- await agentsExecutionsCommand2(agentId, opts);
3441
- });
3442
3642
  agentsCmd.command("skill <agent-id>").requiredOption("--name <name>", "Skill name").requiredOption("--description <desc>", "Skill description").option("--instructions <text>", "Instructions").description("Add a skill to an agent").action(async (agentId, opts) => {
3443
3643
  const { agentsSkillCommand: agentsSkillCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3444
3644
  await agentsSkillCommand2(agentId, opts);
3445
3645
  });
3646
+ var workItemsCmd = program.command("work-items").description("Long-term work item coordination").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").option("--status <status>", "Filter by status (open, claimed, completed, cancelled)").option("--category <category>", "Filter by category").action(async (opts) => {
3647
+ const { workItemsListCommand: workItemsListCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3648
+ await workItemsListCommand2(opts);
3649
+ });
3650
+ workItemsCmd.command("show <item-id>").option("--json", "Output as JSON").description("Show work item detail").action(async (itemId, opts, cmd) => {
3651
+ const parent = cmd.parent.opts();
3652
+ const { workItemsShowCommand: workItemsShowCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3653
+ await workItemsShowCommand2(itemId, { ...opts, entityId: parent.entityId });
3654
+ });
3655
+ 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").description("Create a new work item").action(async (opts, cmd) => {
3656
+ const parent = cmd.parent.opts();
3657
+ const { workItemsCreateCommand: workItemsCreateCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3658
+ await workItemsCreateCommand2({ ...opts, entityId: parent.entityId });
3659
+ });
3660
+ workItemsCmd.command("claim <item-id>").requiredOption("--by <name>", "Agent or user claiming the item").option("--ttl <seconds>", "Auto-release TTL in seconds", parseInt).description("Claim a work item").action(async (itemId, opts, cmd) => {
3661
+ const parent = cmd.parent.opts();
3662
+ const { workItemsClaimCommand: workItemsClaimCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3663
+ await workItemsClaimCommand2(itemId, { claimedBy: opts.by, ttl: opts.ttl, entityId: parent.entityId });
3664
+ });
3665
+ workItemsCmd.command("complete <item-id>").requiredOption("--by <name>", "Agent or user completing the item").option("--result <text>", "Completion result or notes").description("Mark a work item as completed").action(async (itemId, opts, cmd) => {
3666
+ const parent = cmd.parent.opts();
3667
+ const { workItemsCompleteCommand: workItemsCompleteCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3668
+ await workItemsCompleteCommand2(itemId, { completedBy: opts.by, result: opts.result, entityId: parent.entityId });
3669
+ });
3670
+ workItemsCmd.command("release <item-id>").description("Release a claimed work item").action(async (itemId, _opts, cmd) => {
3671
+ const parent = cmd.parent.opts();
3672
+ const { workItemsReleaseCommand: workItemsReleaseCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3673
+ await workItemsReleaseCommand2(itemId, { entityId: parent.entityId });
3674
+ });
3675
+ workItemsCmd.command("cancel <item-id>").description("Cancel a work item").action(async (itemId, _opts, cmd) => {
3676
+ const parent = cmd.parent.opts();
3677
+ const { workItemsCancelCommand: workItemsCancelCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
3678
+ await workItemsCancelCommand2(itemId, { entityId: parent.entityId });
3679
+ });
3446
3680
  var billingCmd = program.command("billing").description("Billing status, plans, and subscription management").option("--json", "Output as JSON").action(async (opts) => {
3447
3681
  const { billingCommand: billingCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
3448
3682
  await billingCommand2(opts);
@@ -3461,7 +3695,7 @@ program.command("approvals").description("Approvals are managed through governan
3461
3695
  "Approvals are managed through governance meetings.\n Use: corp governance convene ... to schedule a board meeting\n Use: corp governance vote <meeting-id> <item-id> ... to cast votes"
3462
3696
  );
3463
3697
  });
3464
- var formCmd = program.command("form").description("Form a new entity with founders and cap table (Cooley-style)").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>", "Member as 'name,email,role[,pct]' \u2014 role: director|officer|manager|member|chair (repeatable)", (v, a) => [...a, v], []).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").action(async (opts) => {
3698
+ 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>", "Member as 'name,email,role[,pct]' \u2014 role: director|officer|manager|member|chair (repeatable)", (v, a) => [...a, v], []).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").action(async (opts) => {
3465
3699
  if (opts.entityType && !opts.type) opts.type = opts.entityType;
3466
3700
  if (opts.legalName && !opts.name) opts.name = opts.legalName;
3467
3701
  const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));