@thecorporation/cli 26.3.7 → 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);
@@ -1790,9 +1819,11 @@ function print409a(data) {
1790
1819
  console.log(chalk5.green("\u2500".repeat(40)));
1791
1820
  console.log(chalk5.green.bold(" 409A Valuation"));
1792
1821
  console.log(chalk5.green("\u2500".repeat(40)));
1793
- console.log(` ${chalk5.bold("FMV/Share:")} $${data.fmv_per_share ?? "N/A"}`);
1794
- console.log(` ${chalk5.bold("Enterprise Value:")} $${data.enterprise_value ?? "N/A"}`);
1795
- 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"}`);
1796
1827
  if (data.provider) console.log(` ${chalk5.bold("Provider:")} ${data.provider}`);
1797
1828
  console.log(chalk5.green("\u2500".repeat(40)));
1798
1829
  }
@@ -1860,6 +1891,7 @@ async function financePayCommand(opts) {
1860
1891
  entity_id: eid,
1861
1892
  amount_cents: opts.amount,
1862
1893
  recipient: opts.recipient,
1894
+ payment_method: opts.method,
1863
1895
  description: `Payment via ${opts.method}`
1864
1896
  });
1865
1897
  printSuccess(`Payment submitted: ${result.payment_id ?? "OK"}`);
@@ -1948,6 +1980,7 @@ __export(governance_exports, {
1948
1980
  sendNoticeCommand: () => sendNoticeCommand,
1949
1981
  writtenConsentCommand: () => writtenConsentCommand
1950
1982
  });
1983
+ import chalk6 from "chalk";
1951
1984
  async function governanceCreateBodyCommand(opts) {
1952
1985
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
1953
1986
  const eid = resolveEntityId(cfg, opts.entityId);
@@ -1960,8 +1993,12 @@ async function governanceCreateBodyCommand(opts) {
1960
1993
  quorum_rule: opts.quorum,
1961
1994
  voting_method: opts.voting
1962
1995
  });
1963
- printSuccess(`Governance body created: ${result.body_id ?? "OK"}`);
1996
+ const bodyId = result.body_id ?? "OK";
1997
+ printSuccess(`Governance body created: ${bodyId}`);
1964
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}`));
1965
2002
  } catch (err) {
1966
2003
  printError(`Failed to create governance body: ${err}`);
1967
2004
  process.exit(1);
@@ -2050,8 +2087,12 @@ async function governanceConveneCommand(opts) {
2050
2087
  scheduled_date: opts.date,
2051
2088
  agenda_item_titles: opts.agenda
2052
2089
  });
2053
- printSuccess(`Meeting scheduled: ${result.meeting_id ?? "OK"}`);
2090
+ const meetingId = result.meeting_id ?? "OK";
2091
+ printSuccess(`Meeting scheduled: ${meetingId}`);
2054
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}`));
2055
2096
  } catch (err) {
2056
2097
  printError(`Failed to schedule meeting: ${err}`);
2057
2098
  process.exit(1);
@@ -2154,8 +2195,12 @@ async function writtenConsentCommand(opts) {
2154
2195
  title: opts.title,
2155
2196
  description: opts.description
2156
2197
  });
2157
- printSuccess(`Written consent created: ${result.meeting_id ?? "OK"}`);
2198
+ const meetingId = result.meeting_id ?? "OK";
2199
+ printSuccess(`Written consent created: ${meetingId}`);
2158
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`));
2159
2204
  } catch (err) {
2160
2205
  printError(`Failed to create written consent: ${err}`);
2161
2206
  process.exit(1);
@@ -2169,7 +2214,22 @@ async function listAgendaItemsCommand(meetingId, opts) {
2169
2214
  const items = await client.listAgendaItems(meetingId, eid);
2170
2215
  if (opts.json) printJson(items);
2171
2216
  else if (items.length === 0) console.log("No agenda items found.");
2172
- 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
+ }
2173
2233
  } catch (err) {
2174
2234
  printError(`Failed to list agenda items: ${err}`);
2175
2235
  process.exit(1);
@@ -2244,11 +2304,16 @@ async function documentsGenerateCommand(opts) {
2244
2304
  async function documentsPreviewPdfCommand(opts) {
2245
2305
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2246
2306
  const eid = resolveEntityId(cfg, opts.entityId);
2247
- const apiUrl = cfg.api_url.replace(/\/+$/, "");
2248
- const qs = new URLSearchParams({ entity_id: eid, document_id: opts.documentId }).toString();
2249
- const url = `${apiUrl}/v1/documents/preview/pdf?${qs}`;
2250
- printSuccess(`Preview PDF URL: ${url}`);
2251
- 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
+ }
2252
2317
  }
2253
2318
  var init_documents = __esm({
2254
2319
  "src/commands/documents.ts"() {
@@ -2265,6 +2330,11 @@ __export(tax_exports, {
2265
2330
  taxDeadlineCommand: () => taxDeadlineCommand,
2266
2331
  taxFileCommand: () => taxFileCommand
2267
2332
  });
2333
+ function normalizeRecurrence(recurrence) {
2334
+ if (!recurrence) return void 0;
2335
+ if (recurrence === "yearly") return "annual";
2336
+ return recurrence;
2337
+ }
2268
2338
  async function taxFileCommand(opts) {
2269
2339
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2270
2340
  const eid = resolveEntityId(cfg, opts.entityId);
@@ -2283,13 +2353,15 @@ async function taxDeadlineCommand(opts) {
2283
2353
  const eid = resolveEntityId(cfg, opts.entityId);
2284
2354
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2285
2355
  try {
2286
- const result = await client.trackDeadline({
2356
+ const payload = {
2287
2357
  entity_id: eid,
2288
2358
  deadline_type: opts.type,
2289
2359
  due_date: opts.dueDate,
2290
- description: opts.description,
2291
- recurrence: opts.recurrence ?? ""
2292
- });
2360
+ description: opts.description
2361
+ };
2362
+ const recurrence = normalizeRecurrence(opts.recurrence);
2363
+ if (recurrence) payload.recurrence = recurrence;
2364
+ const result = await client.trackDeadline(payload);
2293
2365
  printSuccess(`Deadline tracked: ${result.deadline_id ?? "OK"}`);
2294
2366
  printJson(result);
2295
2367
  } catch (err) {
@@ -2319,7 +2391,7 @@ __export(agents_exports, {
2319
2391
  agentsShowCommand: () => agentsShowCommand,
2320
2392
  agentsSkillCommand: () => agentsSkillCommand
2321
2393
  });
2322
- import chalk6 from "chalk";
2394
+ import chalk7 from "chalk";
2323
2395
  async function agentsListCommand(opts) {
2324
2396
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2325
2397
  const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
@@ -2342,22 +2414,22 @@ async function agentsShowCommand(agentId, opts) {
2342
2414
  printJson(agent);
2343
2415
  return;
2344
2416
  }
2345
- console.log(chalk6.magenta("\u2500".repeat(40)));
2346
- console.log(chalk6.magenta.bold(" Agent Detail"));
2347
- console.log(chalk6.magenta("\u2500".repeat(40)));
2348
- console.log(` ${chalk6.bold("Name:")} ${agent.name ?? "N/A"}`);
2349
- console.log(` ${chalk6.bold("Status:")} ${agent.status ?? "N/A"}`);
2350
- console.log(` ${chalk6.bold("Model:")} ${agent.model ?? "N/A"}`);
2351
- 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"}`);
2352
2424
  if (agent.system_prompt) {
2353
2425
  let prompt = String(agent.system_prompt);
2354
2426
  if (prompt.length > 100) prompt = prompt.slice(0, 97) + "...";
2355
- console.log(` ${chalk6.bold("Prompt:")} ${prompt}`);
2427
+ console.log(` ${chalk7.bold("Prompt:")} ${prompt}`);
2356
2428
  }
2357
2429
  if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {
2358
- 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(", ")}`);
2359
2431
  }
2360
- console.log(chalk6.magenta("\u2500".repeat(40)));
2432
+ console.log(chalk7.magenta("\u2500".repeat(40)));
2361
2433
  } catch (err) {
2362
2434
  printError(`Failed to fetch agent: ${err}`);
2363
2435
  process.exit(1);
@@ -2371,6 +2443,7 @@ async function agentsCreateCommand(opts) {
2371
2443
  if (opts.model) data.model = opts.model;
2372
2444
  const result = await client.createAgent(data);
2373
2445
  printSuccess(`Agent created: ${result.agent_id ?? result.id ?? "OK"}`);
2446
+ printJson(result);
2374
2447
  } catch (err) {
2375
2448
  printError(`Failed to create agent: ${err}`);
2376
2449
  process.exit(1);
@@ -2453,6 +2526,146 @@ var init_agents = __esm({
2453
2526
  }
2454
2527
  });
2455
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
+
2456
2669
  // src/commands/billing.ts
2457
2670
  var billing_exports = {};
2458
2671
  __export(billing_exports, {
@@ -2460,18 +2673,10 @@ __export(billing_exports, {
2460
2673
  billingPortalCommand: () => billingPortalCommand,
2461
2674
  billingUpgradeCommand: () => billingUpgradeCommand
2462
2675
  });
2463
- import { execSync } from "child_process";
2464
2676
  function makeClient() {
2465
2677
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
2466
2678
  return new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
2467
2679
  }
2468
- function openUrl(url) {
2469
- try {
2470
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
2471
- execSync(`${cmd} ${JSON.stringify(url)}`, { stdio: "ignore" });
2472
- } catch {
2473
- }
2474
- }
2475
2680
  async function billingCommand(opts) {
2476
2681
  const client = makeClient();
2477
2682
  try {
@@ -2492,10 +2697,8 @@ async function billingPortalCommand() {
2492
2697
  printError("No portal URL returned. Ensure you have an active subscription.");
2493
2698
  process.exit(1);
2494
2699
  }
2495
- console.log(`Opening Stripe Customer Portal...
2496
- ${url}`);
2497
- openUrl(url);
2498
- printSuccess("Portal opened in your browser.");
2700
+ printSuccess("Stripe Customer Portal URL:");
2701
+ console.log(url);
2499
2702
  } catch (err) {
2500
2703
  printError(`Failed to create portal session: ${err}`);
2501
2704
  process.exit(1);
@@ -2510,10 +2713,8 @@ async function billingUpgradeCommand(opts) {
2510
2713
  printError("No checkout URL returned.");
2511
2714
  process.exit(1);
2512
2715
  }
2513
- console.log(`Opening Stripe Checkout for ${opts.plan}...
2514
- ${url}`);
2515
- openUrl(url);
2516
- printSuccess("Checkout opened in your browser.");
2716
+ printSuccess(`Stripe Checkout URL for ${opts.plan}:`);
2717
+ console.log(url);
2517
2718
  } catch (err) {
2518
2719
  printError(`Failed to create checkout session: ${err}`);
2519
2720
  process.exit(1);
@@ -2537,16 +2738,17 @@ __export(form_exports, {
2537
2738
  formFinalizeCommand: () => formFinalizeCommand
2538
2739
  });
2539
2740
  import { input as input2, select, confirm as confirm2, number } from "@inquirer/prompts";
2540
- import chalk7 from "chalk";
2741
+ import chalk9 from "chalk";
2541
2742
  import Table2 from "cli-table3";
2743
+ import { OfficerTitle } from "@thecorporation/corp-tools";
2542
2744
  function isCorp(entityType) {
2543
2745
  return entityType === "c_corp" || entityType === "s_corp" || entityType === "corporation";
2544
2746
  }
2545
2747
  function sectionHeader(title) {
2546
2748
  console.log();
2547
- console.log(chalk7.blue("\u2500".repeat(50)));
2548
- console.log(chalk7.blue.bold(` ${title}`));
2549
- 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)));
2550
2752
  }
2551
2753
  async function promptAddress() {
2552
2754
  const street = await input2({ message: " Street address" });
@@ -2626,7 +2828,7 @@ async function phasePeople(opts, entityType, scripted) {
2626
2828
  }
2627
2829
  const founderCount = await number({ message: "Number of founders (1-6)", default: 1 }) ?? 1;
2628
2830
  for (let i = 0; i < founderCount; i++) {
2629
- console.log(chalk7.dim(`
2831
+ console.log(chalk9.dim(`
2630
2832
  Founder ${i + 1} of ${founderCount}:`));
2631
2833
  const name = await input2({ message: ` Name` });
2632
2834
  const email = await input2({ message: ` Email` });
@@ -2649,13 +2851,10 @@ async function phasePeople(opts, entityType, scripted) {
2649
2851
  if (wantOfficer) {
2650
2852
  officerTitle = await select({
2651
2853
  message: " Officer title",
2652
- choices: [
2653
- { value: "ceo", name: "CEO" },
2654
- { value: "cfo", name: "CFO" },
2655
- { value: "secretary", name: "Secretary" },
2656
- { value: "president", name: "President" },
2657
- { value: "vp", name: "VP" }
2658
- ]
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
+ }))
2659
2858
  });
2660
2859
  }
2661
2860
  }
@@ -2675,7 +2874,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
2675
2874
  const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
2676
2875
  if (!scripted) {
2677
2876
  for (const f of founders) {
2678
- console.log(chalk7.dim(`
2877
+ console.log(chalk9.dim(`
2679
2878
  Equity for ${f.name}:`));
2680
2879
  if (isCorp(entityType)) {
2681
2880
  const shares = await number({ message: ` Shares to purchase`, default: 0 });
@@ -2721,17 +2920,17 @@ async function phaseStock(opts, entityType, founders, scripted) {
2721
2920
  }
2722
2921
  function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr) {
2723
2922
  sectionHeader("Formation Summary");
2724
- console.log(` ${chalk7.bold("Entity:")} ${name}`);
2725
- console.log(` ${chalk7.bold("Type:")} ${entityType}`);
2726
- console.log(` ${chalk7.bold("Jurisdiction:")} ${jurisdiction}`);
2727
- 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}`);
2728
2927
  if (isCorp(entityType)) {
2729
- console.log(` ${chalk7.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
2730
- console.log(` ${chalk7.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
2731
- 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"}`);
2732
2931
  }
2733
2932
  const table = new Table2({
2734
- 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")]
2735
2934
  });
2736
2935
  for (const f of founders) {
2737
2936
  const equity = f.shares_purchased ? `${f.shares_purchased.toLocaleString()} shares` : f.ownership_pct ? `${f.ownership_pct}%` : "\u2014";
@@ -2755,7 +2954,7 @@ async function formCommand(opts) {
2755
2954
  printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);
2756
2955
  const shouldProceed = scripted ? true : await confirm2({ message: "Proceed with formation?", default: true });
2757
2956
  if (!shouldProceed) {
2758
- console.log(chalk7.yellow("Formation cancelled."));
2957
+ console.log(chalk9.yellow("Formation cancelled."));
2759
2958
  return;
2760
2959
  }
2761
2960
  const members = founders.map((f) => {
@@ -2787,7 +2986,7 @@ async function formCommand(opts) {
2787
2986
  };
2788
2987
  if (companyAddress) payload.company_address = companyAddress;
2789
2988
  const result = await client.createFormationWithCapTable(payload);
2790
- printSuccess(`Formation created: ${result.formation_id ?? result.id ?? "OK"}`);
2989
+ printSuccess(`Formation created: ${result.formation_id ?? "OK"}`);
2791
2990
  if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);
2792
2991
  if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
2793
2992
  if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);
@@ -2799,17 +2998,17 @@ async function formCommand(opts) {
2799
2998
  if (holders.length > 0) {
2800
2999
  console.log();
2801
3000
  const table = new Table2({
2802
- head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
3001
+ head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
2803
3002
  });
2804
3003
  for (const h of holders) {
2805
3004
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
2806
3005
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
2807
3006
  }
2808
- console.log(chalk7.bold(" Cap Table:"));
3007
+ console.log(chalk9.bold(" Cap Table:"));
2809
3008
  console.log(table.toString());
2810
3009
  }
2811
3010
  if (result.next_action) {
2812
- console.log(chalk7.yellow(`
3011
+ console.log(chalk9.yellow(`
2813
3012
  Next: ${result.next_action}`));
2814
3013
  }
2815
3014
  } catch (err) {
@@ -2834,7 +3033,7 @@ async function formCreateCommand(opts) {
2834
3033
  console.log(` Type: ${result.entity_type}`);
2835
3034
  console.log(` Jurisdiction: ${result.jurisdiction}`);
2836
3035
  console.log(` Status: ${result.formation_status}`);
2837
- console.log(chalk7.yellow(`
3036
+ console.log(chalk9.yellow(`
2838
3037
  Next: corp form add-founder ${result.entity_id} --name "..." --email "..." --role member --pct 50`));
2839
3038
  } catch (err) {
2840
3039
  printError(`Failed to create pending entity: ${err}`);
@@ -2851,7 +3050,7 @@ async function formAddFounderCommand(entityId, opts) {
2851
3050
  role: opts.role,
2852
3051
  ownership_pct: parseFloat(opts.pct)
2853
3052
  };
2854
- if (opts.officerTitle) payload.officer_title = opts.officerTitle;
3053
+ if (opts.officerTitle) payload.officer_title = opts.officerTitle.toLowerCase();
2855
3054
  if (opts.incorporator) payload.is_incorporator = true;
2856
3055
  const result = await client.addFounder(entityId, payload);
2857
3056
  printSuccess(`Founder added (${result.member_count} total)`);
@@ -2860,7 +3059,7 @@ async function formAddFounderCommand(entityId, opts) {
2860
3059
  const pct = typeof m.ownership_pct === "number" ? ` (${m.ownership_pct}%)` : "";
2861
3060
  console.log(` - ${m.name} <${m.email ?? "no email"}> [${m.role ?? "member"}]${pct}`);
2862
3061
  }
2863
- console.log(chalk7.yellow(`
3062
+ console.log(chalk9.yellow(`
2864
3063
  Next: add more founders or run: corp form finalize ${entityId}`));
2865
3064
  } catch (err) {
2866
3065
  printError(`Failed to add founder: ${err}`);
@@ -2883,17 +3082,17 @@ async function formFinalizeCommand(entityId) {
2883
3082
  if (holders.length > 0) {
2884
3083
  console.log();
2885
3084
  const table = new Table2({
2886
- head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
3085
+ head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
2887
3086
  });
2888
3087
  for (const h of holders) {
2889
3088
  const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
2890
3089
  table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
2891
3090
  }
2892
- console.log(chalk7.bold(" Cap Table:"));
3091
+ console.log(chalk9.bold(" Cap Table:"));
2893
3092
  console.log(table.toString());
2894
3093
  }
2895
3094
  if (result.next_action) {
2896
- console.log(chalk7.yellow(`
3095
+ console.log(chalk9.yellow(`
2897
3096
  Next: ${result.next_action}`));
2898
3097
  }
2899
3098
  } catch (err) {
@@ -2915,7 +3114,7 @@ var api_keys_exports = {};
2915
3114
  __export(api_keys_exports, {
2916
3115
  apiKeysCommand: () => apiKeysCommand
2917
3116
  });
2918
- import chalk8 from "chalk";
3117
+ import chalk10 from "chalk";
2919
3118
  import Table3 from "cli-table3";
2920
3119
  async function apiKeysCommand(opts) {
2921
3120
  const cfg = requireConfig("api_url", "api_key", "workspace_id");
@@ -2923,7 +3122,11 @@ async function apiKeysCommand(opts) {
2923
3122
  try {
2924
3123
  const keys = await client.listApiKeys();
2925
3124
  if (opts.json) {
2926
- 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
+ })));
2927
3130
  return;
2928
3131
  }
2929
3132
  if (keys.length === 0) {
@@ -2931,17 +3134,16 @@ async function apiKeysCommand(opts) {
2931
3134
  return;
2932
3135
  }
2933
3136
  console.log(`
2934
- ${chalk8.bold("API Keys")}`);
3137
+ ${chalk10.bold("API Keys")}`);
2935
3138
  const table = new Table3({
2936
- 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")]
2937
3140
  });
2938
3141
  for (const k of keys) {
2939
3142
  table.push([
2940
- String(k.id ?? k.api_key_id ?? "").slice(0, 12),
3143
+ String(k.key_id ?? k.id ?? k.api_key_id ?? "").slice(0, 12),
2941
3144
  String(k.name ?? ""),
2942
3145
  maskKey(String(k.key ?? k.api_key ?? "")),
2943
- String(k.created_at ?? ""),
2944
- String(k.last_used_at ?? "")
3146
+ String(k.created_at ?? "")
2945
3147
  ]);
2946
3148
  }
2947
3149
  console.log(table.toString());
@@ -3119,7 +3321,7 @@ INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
3119
3321
  });
3120
3322
 
3121
3323
  // src/index.ts
3122
- import { Command } from "commander";
3324
+ import { Command, Option } from "commander";
3123
3325
  import { createRequire } from "module";
3124
3326
  var require2 = createRequire(import.meta.url);
3125
3327
  var pkg = require2("../package.json");
@@ -3340,7 +3542,7 @@ governanceCmd.command("convene").requiredOption("--body <id>", "Governance body
3340
3542
  const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3341
3543
  await governanceConveneCommand2({ ...opts, meetingType: opts.type, entityId: parent.entityId });
3342
3544
  });
3343
- 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) => {
3344
3546
  const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3345
3547
  await governanceVoteCommand2(meetingId, itemId, opts);
3346
3548
  });
@@ -3364,7 +3566,7 @@ governanceCmd.command("agenda-items <meeting-id>").description("List agenda item
3364
3566
  const { listAgendaItemsCommand: listAgendaItemsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3365
3567
  await listAgendaItemsCommand2(meetingId, { entityId: parent.entityId, json: parent.json });
3366
3568
  });
3367
- 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) => {
3368
3570
  const parent = cmd.parent.opts();
3369
3571
  const { finalizeAgendaItemCommand: finalizeAgendaItemCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
3370
3572
  await finalizeAgendaItemCommand2(meetingId, itemId, { ...opts, entityId: parent.entityId });
@@ -3393,7 +3595,7 @@ documentsCmd.command("generate").requiredOption("--template <type>", "Template t
3393
3595
  const { documentsGenerateCommand: documentsGenerateCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
3394
3596
  await documentsGenerateCommand2({ ...opts, entityId: parent.entityId });
3395
3597
  });
3396
- 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) => {
3397
3599
  const parent = cmd.parent.opts();
3398
3600
  const { documentsPreviewPdfCommand: documentsPreviewPdfCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
3399
3601
  await documentsPreviewPdfCommand2({ ...opts, entityId: parent.entityId });
@@ -3404,7 +3606,7 @@ taxCmd.command("file").requiredOption("--type <type>", "Document type").required
3404
3606
  const { taxFileCommand: taxFileCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
3405
3607
  await taxFileCommand2({ ...opts, entityId: parent.entityId });
3406
3608
  });
3407
- 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) => {
3408
3610
  const parent = cmd.parent.opts();
3409
3611
  const { taxDeadlineCommand: taxDeadlineCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
3410
3612
  await taxDeadlineCommand2({ ...opts, entityId: parent.entityId });
@@ -3437,14 +3639,44 @@ agentsCmd.command("message <agent-id>").requiredOption("--body <text>", "Message
3437
3639
  const { agentsMessageCommand: agentsMessageCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3438
3640
  await agentsMessageCommand2(agentId, opts);
3439
3641
  });
3440
- agentsCmd.command("executions <agent-id>").option("--json", "Output as JSON").description("List agent execution history").action(async (agentId, opts) => {
3441
- const { agentsExecutionsCommand: agentsExecutionsCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3442
- await agentsExecutionsCommand2(agentId, opts);
3443
- });
3444
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) => {
3445
3643
  const { agentsSkillCommand: agentsSkillCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
3446
3644
  await agentsSkillCommand2(agentId, opts);
3447
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
+ });
3448
3680
  var billingCmd = program.command("billing").description("Billing status, plans, and subscription management").option("--json", "Output as JSON").action(async (opts) => {
3449
3681
  const { billingCommand: billingCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
3450
3682
  await billingCommand2(opts);
@@ -3463,7 +3695,7 @@ program.command("approvals").description("Approvals are managed through governan
3463
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"
3464
3696
  );
3465
3697
  });
3466
- 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) => {
3467
3699
  if (opts.entityType && !opts.type) opts.type = opts.entityType;
3468
3700
  if (opts.legalName && !opts.name) opts.name = opts.legalName;
3469
3701
  const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));