@thecorporation/cli 26.3.7 → 26.3.10
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 +422 -123
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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")
|
|
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
|
-
|
|
318
|
+
date(v.effective_date ?? v.valuation_date ?? v.date),
|
|
309
319
|
s(v.valuation_type ?? v.type),
|
|
310
|
-
|
|
311
|
-
|
|
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) {
|
|
@@ -404,12 +430,14 @@ function printBillingPanel(status, plans) {
|
|
|
404
430
|
const plan = s(status.plan ?? status.tier) || "free";
|
|
405
431
|
const subStatus = s(status.status) || "active";
|
|
406
432
|
const periodEnd = s(status.current_period_end);
|
|
433
|
+
const explanation = s(status.status_explanation);
|
|
407
434
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
408
435
|
console.log(chalk.green.bold(" Billing Status"));
|
|
409
436
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
410
437
|
console.log(` ${chalk.bold("Plan:")} ${plan}`);
|
|
411
438
|
console.log(` ${chalk.bold("Status:")} ${subStatus}`);
|
|
412
439
|
if (periodEnd) console.log(` ${chalk.bold("Current Period End:")} ${periodEnd}`);
|
|
440
|
+
if (explanation) console.log(` ${chalk.bold("Explanation:")} ${explanation}`);
|
|
413
441
|
console.log(chalk.dim(" Manage: corp billing portal"));
|
|
414
442
|
console.log(chalk.dim(" Upgrade: corp billing upgrade --plan <plan>"));
|
|
415
443
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
@@ -790,7 +818,14 @@ async function digestCommand(opts) {
|
|
|
790
818
|
try {
|
|
791
819
|
if (opts.trigger) {
|
|
792
820
|
const result = await client.triggerDigest();
|
|
793
|
-
|
|
821
|
+
const message = (() => {
|
|
822
|
+
const value = result.message;
|
|
823
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
824
|
+
})();
|
|
825
|
+
printSuccess(result.digest_count > 0 ? "Digest triggered." : "Digest trigger accepted.");
|
|
826
|
+
if (message) {
|
|
827
|
+
printWarning(message);
|
|
828
|
+
}
|
|
794
829
|
printJson(result);
|
|
795
830
|
} else if (opts.key) {
|
|
796
831
|
const result = await client.getDigest(opts.key);
|
|
@@ -1220,12 +1255,24 @@ __export(entities_exports, {
|
|
|
1220
1255
|
entitiesShowCommand: () => entitiesShowCommand
|
|
1221
1256
|
});
|
|
1222
1257
|
import chalk3 from "chalk";
|
|
1258
|
+
function wantsJsonOutput(opts) {
|
|
1259
|
+
if (opts && typeof opts === "object") {
|
|
1260
|
+
const json = opts.json;
|
|
1261
|
+
if (typeof json === "boolean") return json;
|
|
1262
|
+
const commandOpts = opts.opts;
|
|
1263
|
+
if (typeof commandOpts === "function") {
|
|
1264
|
+
return Boolean(commandOpts().json);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
return false;
|
|
1268
|
+
}
|
|
1223
1269
|
async function entitiesCommand(opts) {
|
|
1224
1270
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1225
1271
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1272
|
+
const jsonOutput = wantsJsonOutput(opts);
|
|
1226
1273
|
try {
|
|
1227
|
-
const entities = await withSpinner("Loading", () => client.listEntities(),
|
|
1228
|
-
if (
|
|
1274
|
+
const entities = await withSpinner("Loading", () => client.listEntities(), jsonOutput);
|
|
1275
|
+
if (jsonOutput) {
|
|
1229
1276
|
printJson(entities);
|
|
1230
1277
|
} else if (entities.length === 0) {
|
|
1231
1278
|
console.log("No entities found.");
|
|
@@ -1240,6 +1287,7 @@ async function entitiesCommand(opts) {
|
|
|
1240
1287
|
async function entitiesShowCommand(entityId, opts) {
|
|
1241
1288
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1242
1289
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1290
|
+
const jsonOutput = wantsJsonOutput(opts);
|
|
1243
1291
|
try {
|
|
1244
1292
|
const entities = await client.listEntities();
|
|
1245
1293
|
const entity = entities.find((e) => e.entity_id === entityId);
|
|
@@ -1247,16 +1295,17 @@ async function entitiesShowCommand(entityId, opts) {
|
|
|
1247
1295
|
printError(`Entity not found: ${entityId}`);
|
|
1248
1296
|
process.exit(1);
|
|
1249
1297
|
}
|
|
1250
|
-
if (
|
|
1298
|
+
if (jsonOutput) {
|
|
1251
1299
|
printJson(entity);
|
|
1252
1300
|
} else {
|
|
1253
1301
|
console.log(chalk3.blue("\u2500".repeat(40)));
|
|
1254
1302
|
console.log(chalk3.blue.bold(" Entity Detail"));
|
|
1255
1303
|
console.log(chalk3.blue("\u2500".repeat(40)));
|
|
1256
|
-
console.log(` ${chalk3.bold("Name:")} ${entity.name ?? "N/A"}`);
|
|
1304
|
+
console.log(` ${chalk3.bold("Name:")} ${entity.legal_name ?? entity.name ?? "N/A"}`);
|
|
1257
1305
|
console.log(` ${chalk3.bold("Type:")} ${entity.entity_type ?? "N/A"}`);
|
|
1258
1306
|
console.log(` ${chalk3.bold("Jurisdiction:")} ${entity.jurisdiction ?? "N/A"}`);
|
|
1259
|
-
console.log(` ${chalk3.bold("Status:")} ${entity.status ?? "N/A"}`);
|
|
1307
|
+
console.log(` ${chalk3.bold("Status:")} ${entity.formation_status ?? entity.status ?? "N/A"}`);
|
|
1308
|
+
console.log(` ${chalk3.bold("State:")} ${entity.formation_state ?? "N/A"}`);
|
|
1260
1309
|
console.log(` ${chalk3.bold("ID:")} ${entity.entity_id ?? "N/A"}`);
|
|
1261
1310
|
if (entity.formation_date) console.log(` ${chalk3.bold("Formation Date:")} ${entity.formation_date}`);
|
|
1262
1311
|
if (entity.ein) console.log(` ${chalk3.bold("EIN:")} ${entity.ein}`);
|
|
@@ -1790,9 +1839,11 @@ function print409a(data) {
|
|
|
1790
1839
|
console.log(chalk5.green("\u2500".repeat(40)));
|
|
1791
1840
|
console.log(chalk5.green.bold(" 409A Valuation"));
|
|
1792
1841
|
console.log(chalk5.green("\u2500".repeat(40)));
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
console.log(` ${chalk5.bold("
|
|
1842
|
+
const fmv = typeof data.fmv_per_share_cents === "number" ? data.fmv_per_share_cents / 100 : data.fmv_per_share;
|
|
1843
|
+
const enterpriseValue = typeof data.enterprise_value_cents === "number" ? data.enterprise_value_cents / 100 : data.enterprise_value;
|
|
1844
|
+
console.log(` ${chalk5.bold("FMV/Share:")} $${fmv ?? "N/A"}`);
|
|
1845
|
+
console.log(` ${chalk5.bold("Enterprise Value:")} $${enterpriseValue ?? "N/A"}`);
|
|
1846
|
+
console.log(` ${chalk5.bold("Valuation Date:")} ${data.effective_date ?? data.valuation_date ?? "N/A"}`);
|
|
1796
1847
|
if (data.provider) console.log(` ${chalk5.bold("Provider:")} ${data.provider}`);
|
|
1797
1848
|
console.log(chalk5.green("\u2500".repeat(40)));
|
|
1798
1849
|
}
|
|
@@ -1860,6 +1911,7 @@ async function financePayCommand(opts) {
|
|
|
1860
1911
|
entity_id: eid,
|
|
1861
1912
|
amount_cents: opts.amount,
|
|
1862
1913
|
recipient: opts.recipient,
|
|
1914
|
+
payment_method: opts.method,
|
|
1863
1915
|
description: `Payment via ${opts.method}`
|
|
1864
1916
|
});
|
|
1865
1917
|
printSuccess(`Payment submitted: ${result.payment_id ?? "OK"}`);
|
|
@@ -1948,6 +2000,7 @@ __export(governance_exports, {
|
|
|
1948
2000
|
sendNoticeCommand: () => sendNoticeCommand,
|
|
1949
2001
|
writtenConsentCommand: () => writtenConsentCommand
|
|
1950
2002
|
});
|
|
2003
|
+
import chalk6 from "chalk";
|
|
1951
2004
|
async function governanceCreateBodyCommand(opts) {
|
|
1952
2005
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1953
2006
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -1960,8 +2013,12 @@ async function governanceCreateBodyCommand(opts) {
|
|
|
1960
2013
|
quorum_rule: opts.quorum,
|
|
1961
2014
|
voting_method: opts.voting
|
|
1962
2015
|
});
|
|
1963
|
-
|
|
2016
|
+
const bodyId = result.body_id ?? "OK";
|
|
2017
|
+
printSuccess(`Governance body created: ${bodyId}`);
|
|
1964
2018
|
printJson(result);
|
|
2019
|
+
console.log(chalk6.dim("\n Next steps:"));
|
|
2020
|
+
console.log(chalk6.dim(` corp governance add-seat ${bodyId} --holder <contact-id>`));
|
|
2021
|
+
console.log(chalk6.dim(` corp governance seats ${bodyId}`));
|
|
1965
2022
|
} catch (err) {
|
|
1966
2023
|
printError(`Failed to create governance body: ${err}`);
|
|
1967
2024
|
process.exit(1);
|
|
@@ -2050,8 +2107,12 @@ async function governanceConveneCommand(opts) {
|
|
|
2050
2107
|
scheduled_date: opts.date,
|
|
2051
2108
|
agenda_item_titles: opts.agenda
|
|
2052
2109
|
});
|
|
2053
|
-
|
|
2110
|
+
const meetingId = result.meeting_id ?? "OK";
|
|
2111
|
+
printSuccess(`Meeting scheduled: ${meetingId}`);
|
|
2054
2112
|
printJson(result);
|
|
2113
|
+
console.log(chalk6.dim("\n Next steps:"));
|
|
2114
|
+
console.log(chalk6.dim(` corp governance notice ${meetingId}`));
|
|
2115
|
+
console.log(chalk6.dim(` corp governance agenda-items ${meetingId}`));
|
|
2055
2116
|
} catch (err) {
|
|
2056
2117
|
printError(`Failed to schedule meeting: ${err}`);
|
|
2057
2118
|
process.exit(1);
|
|
@@ -2154,8 +2215,12 @@ async function writtenConsentCommand(opts) {
|
|
|
2154
2215
|
title: opts.title,
|
|
2155
2216
|
description: opts.description
|
|
2156
2217
|
});
|
|
2157
|
-
|
|
2218
|
+
const meetingId = result.meeting_id ?? "OK";
|
|
2219
|
+
printSuccess(`Written consent created: ${meetingId}`);
|
|
2158
2220
|
printJson(result);
|
|
2221
|
+
console.log(chalk6.dim("\n Next steps:"));
|
|
2222
|
+
console.log(chalk6.dim(` corp governance agenda-items ${meetingId}`));
|
|
2223
|
+
console.log(chalk6.dim(` corp governance vote ${meetingId} <item-id> --voter <contact-uuid> --vote for`));
|
|
2159
2224
|
} catch (err) {
|
|
2160
2225
|
printError(`Failed to create written consent: ${err}`);
|
|
2161
2226
|
process.exit(1);
|
|
@@ -2169,7 +2234,22 @@ async function listAgendaItemsCommand(meetingId, opts) {
|
|
|
2169
2234
|
const items = await client.listAgendaItems(meetingId, eid);
|
|
2170
2235
|
if (opts.json) printJson(items);
|
|
2171
2236
|
else if (items.length === 0) console.log("No agenda items found.");
|
|
2172
|
-
else
|
|
2237
|
+
else {
|
|
2238
|
+
const Table4 = (await import("cli-table3")).default;
|
|
2239
|
+
const chalk11 = (await import("chalk")).default;
|
|
2240
|
+
console.log(`
|
|
2241
|
+
${chalk11.bold("Agenda Items")}`);
|
|
2242
|
+
const table = new Table4({ head: [chalk11.dim("ID"), chalk11.dim("Title"), chalk11.dim("Status"), chalk11.dim("Type")] });
|
|
2243
|
+
for (const item of items) {
|
|
2244
|
+
table.push([
|
|
2245
|
+
String(item.item_id ?? item.agenda_item_id ?? item.id ?? "").slice(0, 12),
|
|
2246
|
+
String(item.title ?? ""),
|
|
2247
|
+
String(item.status ?? ""),
|
|
2248
|
+
String(item.item_type ?? item.type ?? "")
|
|
2249
|
+
]);
|
|
2250
|
+
}
|
|
2251
|
+
console.log(table.toString());
|
|
2252
|
+
}
|
|
2173
2253
|
} catch (err) {
|
|
2174
2254
|
printError(`Failed to list agenda items: ${err}`);
|
|
2175
2255
|
process.exit(1);
|
|
@@ -2212,12 +2292,9 @@ async function documentsSigningLinkCommand(docId, opts) {
|
|
|
2212
2292
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2213
2293
|
try {
|
|
2214
2294
|
const result = await client.getSigningLink(docId, eid);
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
console.log(` Share this URL with the signer:`);
|
|
2219
|
-
console.log(` https://humans.thecorporation.ai/sign/${docId}?token=${result.token}`);
|
|
2220
|
-
}
|
|
2295
|
+
const shareUrl = result.token ? `https://humans.thecorporation.ai/sign/${docId}?token=${result.token}` : result.signing_url ?? `https://humans.thecorporation.ai/sign/${docId}`;
|
|
2296
|
+
printSuccess("Signing link generated.");
|
|
2297
|
+
console.log(shareUrl);
|
|
2221
2298
|
} catch (err) {
|
|
2222
2299
|
printError(`Failed to get signing link: ${err}`);
|
|
2223
2300
|
process.exit(1);
|
|
@@ -2244,11 +2321,16 @@ async function documentsGenerateCommand(opts) {
|
|
|
2244
2321
|
async function documentsPreviewPdfCommand(opts) {
|
|
2245
2322
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2246
2323
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2324
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2325
|
+
try {
|
|
2326
|
+
await client.validatePreviewPdf(eid, opts.documentId);
|
|
2327
|
+
const url = client.getPreviewPdfUrl(eid, opts.documentId);
|
|
2328
|
+
printSuccess(`Preview PDF URL: ${url}`);
|
|
2329
|
+
console.log("The document definition was validated successfully. Use your API key to download the PDF.");
|
|
2330
|
+
} catch (err) {
|
|
2331
|
+
printError(`Failed to validate preview PDF: ${err}`);
|
|
2332
|
+
process.exit(1);
|
|
2333
|
+
}
|
|
2252
2334
|
}
|
|
2253
2335
|
var init_documents = __esm({
|
|
2254
2336
|
"src/commands/documents.ts"() {
|
|
@@ -2265,6 +2347,11 @@ __export(tax_exports, {
|
|
|
2265
2347
|
taxDeadlineCommand: () => taxDeadlineCommand,
|
|
2266
2348
|
taxFileCommand: () => taxFileCommand
|
|
2267
2349
|
});
|
|
2350
|
+
function normalizeRecurrence(recurrence) {
|
|
2351
|
+
if (!recurrence) return void 0;
|
|
2352
|
+
if (recurrence === "yearly") return "annual";
|
|
2353
|
+
return recurrence;
|
|
2354
|
+
}
|
|
2268
2355
|
async function taxFileCommand(opts) {
|
|
2269
2356
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2270
2357
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -2283,13 +2370,15 @@ async function taxDeadlineCommand(opts) {
|
|
|
2283
2370
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2284
2371
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2285
2372
|
try {
|
|
2286
|
-
const
|
|
2373
|
+
const payload = {
|
|
2287
2374
|
entity_id: eid,
|
|
2288
2375
|
deadline_type: opts.type,
|
|
2289
2376
|
due_date: opts.dueDate,
|
|
2290
|
-
description: opts.description
|
|
2291
|
-
|
|
2292
|
-
|
|
2377
|
+
description: opts.description
|
|
2378
|
+
};
|
|
2379
|
+
const recurrence = normalizeRecurrence(opts.recurrence);
|
|
2380
|
+
if (recurrence) payload.recurrence = recurrence;
|
|
2381
|
+
const result = await client.trackDeadline(payload);
|
|
2293
2382
|
printSuccess(`Deadline tracked: ${result.deadline_id ?? "OK"}`);
|
|
2294
2383
|
printJson(result);
|
|
2295
2384
|
} catch (err) {
|
|
@@ -2319,7 +2408,7 @@ __export(agents_exports, {
|
|
|
2319
2408
|
agentsShowCommand: () => agentsShowCommand,
|
|
2320
2409
|
agentsSkillCommand: () => agentsSkillCommand
|
|
2321
2410
|
});
|
|
2322
|
-
import
|
|
2411
|
+
import chalk7 from "chalk";
|
|
2323
2412
|
async function agentsListCommand(opts) {
|
|
2324
2413
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2325
2414
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -2342,22 +2431,22 @@ async function agentsShowCommand(agentId, opts) {
|
|
|
2342
2431
|
printJson(agent);
|
|
2343
2432
|
return;
|
|
2344
2433
|
}
|
|
2345
|
-
console.log(
|
|
2346
|
-
console.log(
|
|
2347
|
-
console.log(
|
|
2348
|
-
console.log(` ${
|
|
2349
|
-
console.log(` ${
|
|
2350
|
-
console.log(` ${
|
|
2351
|
-
console.log(` ${
|
|
2434
|
+
console.log(chalk7.magenta("\u2500".repeat(40)));
|
|
2435
|
+
console.log(chalk7.magenta.bold(" Agent Detail"));
|
|
2436
|
+
console.log(chalk7.magenta("\u2500".repeat(40)));
|
|
2437
|
+
console.log(` ${chalk7.bold("Name:")} ${agent.name ?? "N/A"}`);
|
|
2438
|
+
console.log(` ${chalk7.bold("Status:")} ${agent.status ?? "N/A"}`);
|
|
2439
|
+
console.log(` ${chalk7.bold("Model:")} ${agent.model ?? "N/A"}`);
|
|
2440
|
+
console.log(` ${chalk7.bold("ID:")} ${agent.agent_id ?? "N/A"}`);
|
|
2352
2441
|
if (agent.system_prompt) {
|
|
2353
2442
|
let prompt = String(agent.system_prompt);
|
|
2354
2443
|
if (prompt.length > 100) prompt = prompt.slice(0, 97) + "...";
|
|
2355
|
-
console.log(` ${
|
|
2444
|
+
console.log(` ${chalk7.bold("Prompt:")} ${prompt}`);
|
|
2356
2445
|
}
|
|
2357
2446
|
if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {
|
|
2358
|
-
console.log(` ${
|
|
2447
|
+
console.log(` ${chalk7.bold("Skills:")} ${agent.skills.map((s2) => s2.name ?? "?").join(", ")}`);
|
|
2359
2448
|
}
|
|
2360
|
-
console.log(
|
|
2449
|
+
console.log(chalk7.magenta("\u2500".repeat(40)));
|
|
2361
2450
|
} catch (err) {
|
|
2362
2451
|
printError(`Failed to fetch agent: ${err}`);
|
|
2363
2452
|
process.exit(1);
|
|
@@ -2371,6 +2460,7 @@ async function agentsCreateCommand(opts) {
|
|
|
2371
2460
|
if (opts.model) data.model = opts.model;
|
|
2372
2461
|
const result = await client.createAgent(data);
|
|
2373
2462
|
printSuccess(`Agent created: ${result.agent_id ?? result.id ?? "OK"}`);
|
|
2463
|
+
printJson(result);
|
|
2374
2464
|
} catch (err) {
|
|
2375
2465
|
printError(`Failed to create agent: ${err}`);
|
|
2376
2466
|
process.exit(1);
|
|
@@ -2453,6 +2543,146 @@ var init_agents = __esm({
|
|
|
2453
2543
|
}
|
|
2454
2544
|
});
|
|
2455
2545
|
|
|
2546
|
+
// src/commands/work-items.ts
|
|
2547
|
+
var work_items_exports = {};
|
|
2548
|
+
__export(work_items_exports, {
|
|
2549
|
+
workItemsCancelCommand: () => workItemsCancelCommand,
|
|
2550
|
+
workItemsClaimCommand: () => workItemsClaimCommand,
|
|
2551
|
+
workItemsCompleteCommand: () => workItemsCompleteCommand,
|
|
2552
|
+
workItemsCreateCommand: () => workItemsCreateCommand,
|
|
2553
|
+
workItemsListCommand: () => workItemsListCommand,
|
|
2554
|
+
workItemsReleaseCommand: () => workItemsReleaseCommand,
|
|
2555
|
+
workItemsShowCommand: () => workItemsShowCommand
|
|
2556
|
+
});
|
|
2557
|
+
import chalk8 from "chalk";
|
|
2558
|
+
async function workItemsListCommand(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 params = {};
|
|
2564
|
+
if (opts.status) params.status = opts.status;
|
|
2565
|
+
if (opts.category) params.category = opts.category;
|
|
2566
|
+
const items = await client.listWorkItems(eid, Object.keys(params).length > 0 ? params : void 0);
|
|
2567
|
+
if (opts.json) printJson(items);
|
|
2568
|
+
else if (items.length === 0) console.log("No work items found.");
|
|
2569
|
+
else printWorkItemsTable(items);
|
|
2570
|
+
} catch (err) {
|
|
2571
|
+
printError(`Failed to fetch work items: ${err}`);
|
|
2572
|
+
process.exit(1);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
async function workItemsShowCommand(workItemId, opts) {
|
|
2576
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2577
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2578
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2579
|
+
try {
|
|
2580
|
+
const w = await client.getWorkItem(eid, workItemId);
|
|
2581
|
+
if (opts.json) {
|
|
2582
|
+
printJson(w);
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
console.log(chalk8.cyan("\u2500".repeat(40)));
|
|
2586
|
+
console.log(chalk8.cyan.bold(" Work Item Detail"));
|
|
2587
|
+
console.log(chalk8.cyan("\u2500".repeat(40)));
|
|
2588
|
+
console.log(` ${chalk8.bold("Title:")} ${w.title ?? "N/A"}`);
|
|
2589
|
+
console.log(` ${chalk8.bold("Category:")} ${w.category ?? "N/A"}`);
|
|
2590
|
+
console.log(` ${chalk8.bold("Status:")} ${w.effective_status ?? w.status ?? "N/A"}`);
|
|
2591
|
+
if (w.description) console.log(` ${chalk8.bold("Description:")} ${w.description}`);
|
|
2592
|
+
if (w.deadline) console.log(` ${chalk8.bold("Deadline:")} ${w.deadline}`);
|
|
2593
|
+
if (w.asap) console.log(` ${chalk8.bold("Priority:")} ${chalk8.red.bold("ASAP")}`);
|
|
2594
|
+
if (w.claimed_by) console.log(` ${chalk8.bold("Claimed by:")} ${w.claimed_by}`);
|
|
2595
|
+
if (w.claimed_at) console.log(` ${chalk8.bold("Claimed at:")} ${w.claimed_at}`);
|
|
2596
|
+
if (w.claim_ttl_seconds) console.log(` ${chalk8.bold("Claim TTL:")} ${w.claim_ttl_seconds}s`);
|
|
2597
|
+
if (w.completed_by) console.log(` ${chalk8.bold("Completed by:")} ${w.completed_by}`);
|
|
2598
|
+
if (w.completed_at) console.log(` ${chalk8.bold("Completed at:")} ${w.completed_at}`);
|
|
2599
|
+
if (w.result) console.log(` ${chalk8.bold("Result:")} ${w.result}`);
|
|
2600
|
+
if (w.created_by) console.log(` ${chalk8.bold("Created by:")} ${w.created_by}`);
|
|
2601
|
+
console.log(` ${chalk8.bold("Created at:")} ${w.created_at ?? "N/A"}`);
|
|
2602
|
+
console.log(chalk8.cyan("\u2500".repeat(40)));
|
|
2603
|
+
} catch (err) {
|
|
2604
|
+
printError(`Failed to fetch work item: ${err}`);
|
|
2605
|
+
process.exit(1);
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
async function workItemsCreateCommand(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 = { title: opts.title, category: opts.category };
|
|
2614
|
+
if (opts.description) data.description = opts.description;
|
|
2615
|
+
if (opts.deadline) data.deadline = opts.deadline;
|
|
2616
|
+
if (opts.asap) data.asap = true;
|
|
2617
|
+
if (opts.createdBy) data.created_by = opts.createdBy;
|
|
2618
|
+
const result = await client.createWorkItem(eid, data);
|
|
2619
|
+
printSuccess(`Work item created: ${result.work_item_id ?? result.id ?? "OK"}`);
|
|
2620
|
+
} catch (err) {
|
|
2621
|
+
printError(`Failed to create work item: ${err}`);
|
|
2622
|
+
process.exit(1);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
async function workItemsClaimCommand(workItemId, opts) {
|
|
2626
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2627
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2628
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2629
|
+
try {
|
|
2630
|
+
const data = { claimed_by: opts.claimedBy };
|
|
2631
|
+
if (opts.ttl != null) data.ttl_seconds = opts.ttl;
|
|
2632
|
+
await client.claimWorkItem(eid, workItemId, data);
|
|
2633
|
+
printSuccess(`Work item ${workItemId} claimed by ${opts.claimedBy}.`);
|
|
2634
|
+
} catch (err) {
|
|
2635
|
+
printError(`Failed to claim work item: ${err}`);
|
|
2636
|
+
process.exit(1);
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
async function workItemsCompleteCommand(workItemId, opts) {
|
|
2640
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2641
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2642
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2643
|
+
try {
|
|
2644
|
+
const data = { completed_by: opts.completedBy };
|
|
2645
|
+
if (opts.result) data.result = opts.result;
|
|
2646
|
+
await client.completeWorkItem(eid, workItemId, data);
|
|
2647
|
+
printSuccess(`Work item ${workItemId} completed.`);
|
|
2648
|
+
} catch (err) {
|
|
2649
|
+
printError(`Failed to complete work item: ${err}`);
|
|
2650
|
+
process.exit(1);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
async function workItemsReleaseCommand(workItemId, opts) {
|
|
2654
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2655
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2656
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2657
|
+
try {
|
|
2658
|
+
await client.releaseWorkItem(eid, workItemId);
|
|
2659
|
+
printSuccess(`Work item ${workItemId} claim released.`);
|
|
2660
|
+
} catch (err) {
|
|
2661
|
+
printError(`Failed to release work item: ${err}`);
|
|
2662
|
+
process.exit(1);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
async function workItemsCancelCommand(workItemId, opts) {
|
|
2666
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2667
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2668
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2669
|
+
try {
|
|
2670
|
+
await client.cancelWorkItem(eid, workItemId);
|
|
2671
|
+
printSuccess(`Work item ${workItemId} cancelled.`);
|
|
2672
|
+
} catch (err) {
|
|
2673
|
+
printError(`Failed to cancel work item: ${err}`);
|
|
2674
|
+
process.exit(1);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
var init_work_items = __esm({
|
|
2678
|
+
"src/commands/work-items.ts"() {
|
|
2679
|
+
"use strict";
|
|
2680
|
+
init_config();
|
|
2681
|
+
init_api_client();
|
|
2682
|
+
init_output();
|
|
2683
|
+
}
|
|
2684
|
+
});
|
|
2685
|
+
|
|
2456
2686
|
// src/commands/billing.ts
|
|
2457
2687
|
var billing_exports = {};
|
|
2458
2688
|
__export(billing_exports, {
|
|
@@ -2460,24 +2690,29 @@ __export(billing_exports, {
|
|
|
2460
2690
|
billingPortalCommand: () => billingPortalCommand,
|
|
2461
2691
|
billingUpgradeCommand: () => billingUpgradeCommand
|
|
2462
2692
|
});
|
|
2463
|
-
import { execSync } from "child_process";
|
|
2464
2693
|
function makeClient() {
|
|
2465
2694
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2466
2695
|
return new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2467
2696
|
}
|
|
2468
|
-
function
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2697
|
+
function enrichBillingStatus(status) {
|
|
2698
|
+
if (typeof status.status_explanation === "string" && status.status_explanation.trim()) {
|
|
2699
|
+
return status;
|
|
2700
|
+
}
|
|
2701
|
+
const plan = String(status.plan ?? status.tier ?? "").trim();
|
|
2702
|
+
const subStatus = String(status.status ?? "").trim();
|
|
2703
|
+
if (subStatus !== "pending_checkout") {
|
|
2704
|
+
return status;
|
|
2473
2705
|
}
|
|
2706
|
+
const statusExplanation = plan ? `Checkout for the ${plan} plan has started, but billing will not become active until Stripe checkout is completed.` : "Checkout has started, but billing will not become active until Stripe checkout is completed.";
|
|
2707
|
+
return { ...status, status_explanation: statusExplanation };
|
|
2474
2708
|
}
|
|
2475
2709
|
async function billingCommand(opts) {
|
|
2476
2710
|
const client = makeClient();
|
|
2477
2711
|
try {
|
|
2478
2712
|
const [status, plans] = await Promise.all([client.getBillingStatus(), client.getBillingPlans()]);
|
|
2479
|
-
|
|
2480
|
-
|
|
2713
|
+
const enrichedStatus = enrichBillingStatus(status);
|
|
2714
|
+
if (opts.json) printJson({ status: enrichedStatus, plans });
|
|
2715
|
+
else printBillingPanel(enrichedStatus, plans);
|
|
2481
2716
|
} catch (err) {
|
|
2482
2717
|
printError(`Failed to fetch billing info: ${err}`);
|
|
2483
2718
|
process.exit(1);
|
|
@@ -2492,10 +2727,8 @@ async function billingPortalCommand() {
|
|
|
2492
2727
|
printError("No portal URL returned. Ensure you have an active subscription.");
|
|
2493
2728
|
process.exit(1);
|
|
2494
2729
|
}
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
openUrl(url);
|
|
2498
|
-
printSuccess("Portal opened in your browser.");
|
|
2730
|
+
printSuccess("Stripe Customer Portal URL:");
|
|
2731
|
+
console.log(url);
|
|
2499
2732
|
} catch (err) {
|
|
2500
2733
|
printError(`Failed to create portal session: ${err}`);
|
|
2501
2734
|
process.exit(1);
|
|
@@ -2510,10 +2743,8 @@ async function billingUpgradeCommand(opts) {
|
|
|
2510
2743
|
printError("No checkout URL returned.");
|
|
2511
2744
|
process.exit(1);
|
|
2512
2745
|
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
openUrl(url);
|
|
2516
|
-
printSuccess("Checkout opened in your browser.");
|
|
2746
|
+
printSuccess(`Stripe Checkout URL for ${opts.plan}:`);
|
|
2747
|
+
console.log(url);
|
|
2517
2748
|
} catch (err) {
|
|
2518
2749
|
printError(`Failed to create checkout session: ${err}`);
|
|
2519
2750
|
process.exit(1);
|
|
@@ -2537,16 +2768,17 @@ __export(form_exports, {
|
|
|
2537
2768
|
formFinalizeCommand: () => formFinalizeCommand
|
|
2538
2769
|
});
|
|
2539
2770
|
import { input as input2, select, confirm as confirm2, number } from "@inquirer/prompts";
|
|
2540
|
-
import
|
|
2771
|
+
import chalk9 from "chalk";
|
|
2541
2772
|
import Table2 from "cli-table3";
|
|
2773
|
+
import { OfficerTitle } from "@thecorporation/corp-tools";
|
|
2542
2774
|
function isCorp(entityType) {
|
|
2543
2775
|
return entityType === "c_corp" || entityType === "s_corp" || entityType === "corporation";
|
|
2544
2776
|
}
|
|
2545
2777
|
function sectionHeader(title) {
|
|
2546
2778
|
console.log();
|
|
2547
|
-
console.log(
|
|
2548
|
-
console.log(
|
|
2549
|
-
console.log(
|
|
2779
|
+
console.log(chalk9.blue("\u2500".repeat(50)));
|
|
2780
|
+
console.log(chalk9.blue.bold(` ${title}`));
|
|
2781
|
+
console.log(chalk9.blue("\u2500".repeat(50)));
|
|
2550
2782
|
}
|
|
2551
2783
|
async function promptAddress() {
|
|
2552
2784
|
const street = await input2({ message: " Street address" });
|
|
@@ -2626,7 +2858,7 @@ async function phasePeople(opts, entityType, scripted) {
|
|
|
2626
2858
|
}
|
|
2627
2859
|
const founderCount = await number({ message: "Number of founders (1-6)", default: 1 }) ?? 1;
|
|
2628
2860
|
for (let i = 0; i < founderCount; i++) {
|
|
2629
|
-
console.log(
|
|
2861
|
+
console.log(chalk9.dim(`
|
|
2630
2862
|
Founder ${i + 1} of ${founderCount}:`));
|
|
2631
2863
|
const name = await input2({ message: ` Name` });
|
|
2632
2864
|
const email = await input2({ message: ` Email` });
|
|
@@ -2649,13 +2881,10 @@ async function phasePeople(opts, entityType, scripted) {
|
|
|
2649
2881
|
if (wantOfficer) {
|
|
2650
2882
|
officerTitle = await select({
|
|
2651
2883
|
message: " Officer title",
|
|
2652
|
-
choices:
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
{ value: "president", name: "President" },
|
|
2657
|
-
{ value: "vp", name: "VP" }
|
|
2658
|
-
]
|
|
2884
|
+
choices: OfficerTitle.map((t) => ({
|
|
2885
|
+
value: t,
|
|
2886
|
+
name: t === "ceo" ? "CEO" : t === "cfo" ? "CFO" : t === "vp" ? "VP" : t.charAt(0).toUpperCase() + t.slice(1)
|
|
2887
|
+
}))
|
|
2659
2888
|
});
|
|
2660
2889
|
}
|
|
2661
2890
|
}
|
|
@@ -2675,7 +2904,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
|
|
|
2675
2904
|
const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
|
|
2676
2905
|
if (!scripted) {
|
|
2677
2906
|
for (const f of founders) {
|
|
2678
|
-
console.log(
|
|
2907
|
+
console.log(chalk9.dim(`
|
|
2679
2908
|
Equity for ${f.name}:`));
|
|
2680
2909
|
if (isCorp(entityType)) {
|
|
2681
2910
|
const shares = await number({ message: ` Shares to purchase`, default: 0 });
|
|
@@ -2721,17 +2950,17 @@ async function phaseStock(opts, entityType, founders, scripted) {
|
|
|
2721
2950
|
}
|
|
2722
2951
|
function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr) {
|
|
2723
2952
|
sectionHeader("Formation Summary");
|
|
2724
|
-
console.log(` ${
|
|
2725
|
-
console.log(` ${
|
|
2726
|
-
console.log(` ${
|
|
2727
|
-
console.log(` ${
|
|
2953
|
+
console.log(` ${chalk9.bold("Entity:")} ${name}`);
|
|
2954
|
+
console.log(` ${chalk9.bold("Type:")} ${entityType}`);
|
|
2955
|
+
console.log(` ${chalk9.bold("Jurisdiction:")} ${jurisdiction}`);
|
|
2956
|
+
console.log(` ${chalk9.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
|
|
2728
2957
|
if (isCorp(entityType)) {
|
|
2729
|
-
console.log(` ${
|
|
2730
|
-
console.log(` ${
|
|
2731
|
-
console.log(` ${
|
|
2958
|
+
console.log(` ${chalk9.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
|
|
2959
|
+
console.log(` ${chalk9.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
|
|
2960
|
+
console.log(` ${chalk9.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
|
|
2732
2961
|
}
|
|
2733
2962
|
const table = new Table2({
|
|
2734
|
-
head: [
|
|
2963
|
+
head: [chalk9.dim("Name"), chalk9.dim("Email"), chalk9.dim("Role"), chalk9.dim("Equity"), chalk9.dim("Officer")]
|
|
2735
2964
|
});
|
|
2736
2965
|
for (const f of founders) {
|
|
2737
2966
|
const equity = f.shares_purchased ? `${f.shares_purchased.toLocaleString()} shares` : f.ownership_pct ? `${f.ownership_pct}%` : "\u2014";
|
|
@@ -2755,7 +2984,7 @@ async function formCommand(opts) {
|
|
|
2755
2984
|
printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);
|
|
2756
2985
|
const shouldProceed = scripted ? true : await confirm2({ message: "Proceed with formation?", default: true });
|
|
2757
2986
|
if (!shouldProceed) {
|
|
2758
|
-
console.log(
|
|
2987
|
+
console.log(chalk9.yellow("Formation cancelled."));
|
|
2759
2988
|
return;
|
|
2760
2989
|
}
|
|
2761
2990
|
const members = founders.map((f) => {
|
|
@@ -2787,7 +3016,7 @@ async function formCommand(opts) {
|
|
|
2787
3016
|
};
|
|
2788
3017
|
if (companyAddress) payload.company_address = companyAddress;
|
|
2789
3018
|
const result = await client.createFormationWithCapTable(payload);
|
|
2790
|
-
printSuccess(`Formation created: ${result.formation_id ??
|
|
3019
|
+
printSuccess(`Formation created: ${result.formation_id ?? "OK"}`);
|
|
2791
3020
|
if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);
|
|
2792
3021
|
if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
|
|
2793
3022
|
if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);
|
|
@@ -2799,17 +3028,17 @@ async function formCommand(opts) {
|
|
|
2799
3028
|
if (holders.length > 0) {
|
|
2800
3029
|
console.log();
|
|
2801
3030
|
const table = new Table2({
|
|
2802
|
-
head: [
|
|
3031
|
+
head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
|
|
2803
3032
|
});
|
|
2804
3033
|
for (const h of holders) {
|
|
2805
3034
|
const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
|
|
2806
3035
|
table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
|
|
2807
3036
|
}
|
|
2808
|
-
console.log(
|
|
3037
|
+
console.log(chalk9.bold(" Cap Table:"));
|
|
2809
3038
|
console.log(table.toString());
|
|
2810
3039
|
}
|
|
2811
3040
|
if (result.next_action) {
|
|
2812
|
-
console.log(
|
|
3041
|
+
console.log(chalk9.yellow(`
|
|
2813
3042
|
Next: ${result.next_action}`));
|
|
2814
3043
|
}
|
|
2815
3044
|
} catch (err) {
|
|
@@ -2818,6 +3047,14 @@ async function formCommand(opts) {
|
|
|
2818
3047
|
process.exit(1);
|
|
2819
3048
|
}
|
|
2820
3049
|
}
|
|
3050
|
+
function parseCsvAddress(raw) {
|
|
3051
|
+
if (!raw) return void 0;
|
|
3052
|
+
const parts = raw.split(",").map((p) => p.trim()).filter(Boolean);
|
|
3053
|
+
if (parts.length !== 4) {
|
|
3054
|
+
throw new Error(`Invalid address format: ${raw}. Expected 'street,city,state,zip'`);
|
|
3055
|
+
}
|
|
3056
|
+
return { street: parts[0], city: parts[1], state: parts[2], zip: parts[3] };
|
|
3057
|
+
}
|
|
2821
3058
|
async function formCreateCommand(opts) {
|
|
2822
3059
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2823
3060
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -2828,13 +3065,22 @@ async function formCreateCommand(opts) {
|
|
|
2828
3065
|
legal_name: opts.name
|
|
2829
3066
|
};
|
|
2830
3067
|
if (opts.jurisdiction) payload.jurisdiction = opts.jurisdiction;
|
|
3068
|
+
if (opts.registeredAgentName) payload.registered_agent_name = opts.registeredAgentName;
|
|
3069
|
+
if (opts.registeredAgentAddress) payload.registered_agent_address = opts.registeredAgentAddress;
|
|
3070
|
+
if (opts.formationDate) payload.formation_date = opts.formationDate;
|
|
3071
|
+
if (opts.fiscalYearEnd) payload.fiscal_year_end = opts.fiscalYearEnd;
|
|
3072
|
+
if (opts.sCorp !== void 0) payload.s_corp_election = opts.sCorp;
|
|
3073
|
+
if (opts.transferRestrictions !== void 0) payload.transfer_restrictions = opts.transferRestrictions;
|
|
3074
|
+
if (opts.rofr !== void 0) payload.right_of_first_refusal = opts.rofr;
|
|
3075
|
+
const companyAddress = parseCsvAddress(opts.companyAddress);
|
|
3076
|
+
if (companyAddress) payload.company_address = companyAddress;
|
|
2831
3077
|
const result = await client.createPendingEntity(payload);
|
|
2832
3078
|
printSuccess(`Pending entity created: ${result.entity_id}`);
|
|
2833
3079
|
console.log(` Name: ${result.legal_name}`);
|
|
2834
3080
|
console.log(` Type: ${result.entity_type}`);
|
|
2835
3081
|
console.log(` Jurisdiction: ${result.jurisdiction}`);
|
|
2836
3082
|
console.log(` Status: ${result.formation_status}`);
|
|
2837
|
-
console.log(
|
|
3083
|
+
console.log(chalk9.yellow(`
|
|
2838
3084
|
Next: corp form add-founder ${result.entity_id} --name "..." --email "..." --role member --pct 50`));
|
|
2839
3085
|
} catch (err) {
|
|
2840
3086
|
printError(`Failed to create pending entity: ${err}`);
|
|
@@ -2851,8 +3097,10 @@ async function formAddFounderCommand(entityId, opts) {
|
|
|
2851
3097
|
role: opts.role,
|
|
2852
3098
|
ownership_pct: parseFloat(opts.pct)
|
|
2853
3099
|
};
|
|
2854
|
-
if (opts.officerTitle) payload.officer_title = opts.officerTitle;
|
|
3100
|
+
if (opts.officerTitle) payload.officer_title = opts.officerTitle.toLowerCase();
|
|
2855
3101
|
if (opts.incorporator) payload.is_incorporator = true;
|
|
3102
|
+
const address = parseCsvAddress(opts.address);
|
|
3103
|
+
if (address) payload.address = address;
|
|
2856
3104
|
const result = await client.addFounder(entityId, payload);
|
|
2857
3105
|
printSuccess(`Founder added (${result.member_count} total)`);
|
|
2858
3106
|
const members = result.members ?? [];
|
|
@@ -2860,18 +3108,36 @@ async function formAddFounderCommand(entityId, opts) {
|
|
|
2860
3108
|
const pct = typeof m.ownership_pct === "number" ? ` (${m.ownership_pct}%)` : "";
|
|
2861
3109
|
console.log(` - ${m.name} <${m.email ?? "no email"}> [${m.role ?? "member"}]${pct}`);
|
|
2862
3110
|
}
|
|
2863
|
-
console.log(
|
|
3111
|
+
console.log(chalk9.yellow(`
|
|
2864
3112
|
Next: add more founders or run: corp form finalize ${entityId}`));
|
|
2865
3113
|
} catch (err) {
|
|
2866
3114
|
printError(`Failed to add founder: ${err}`);
|
|
2867
3115
|
process.exit(1);
|
|
2868
3116
|
}
|
|
2869
3117
|
}
|
|
2870
|
-
async function formFinalizeCommand(entityId) {
|
|
3118
|
+
async function formFinalizeCommand(entityId, opts) {
|
|
2871
3119
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2872
3120
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2873
3121
|
try {
|
|
2874
|
-
const
|
|
3122
|
+
const payload = {};
|
|
3123
|
+
if (opts.authorizedShares) {
|
|
3124
|
+
const authorizedShares = parseInt(opts.authorizedShares, 10);
|
|
3125
|
+
if (!Number.isFinite(authorizedShares)) {
|
|
3126
|
+
throw new Error(`Invalid authorized shares: ${opts.authorizedShares}`);
|
|
3127
|
+
}
|
|
3128
|
+
payload.authorized_shares = authorizedShares;
|
|
3129
|
+
}
|
|
3130
|
+
if (opts.parValue) payload.par_value = opts.parValue;
|
|
3131
|
+
if (opts.registeredAgentName) payload.registered_agent_name = opts.registeredAgentName;
|
|
3132
|
+
if (opts.registeredAgentAddress) payload.registered_agent_address = opts.registeredAgentAddress;
|
|
3133
|
+
if (opts.formationDate) payload.formation_date = opts.formationDate;
|
|
3134
|
+
if (opts.fiscalYearEnd) payload.fiscal_year_end = opts.fiscalYearEnd;
|
|
3135
|
+
if (opts.sCorp !== void 0) payload.s_corp_election = opts.sCorp;
|
|
3136
|
+
if (opts.transferRestrictions !== void 0) payload.transfer_restrictions = opts.transferRestrictions;
|
|
3137
|
+
if (opts.rofr !== void 0) payload.right_of_first_refusal = opts.rofr;
|
|
3138
|
+
const companyAddress = parseCsvAddress(opts.companyAddress);
|
|
3139
|
+
if (companyAddress) payload.company_address = companyAddress;
|
|
3140
|
+
const result = await client.finalizeFormation(entityId, payload);
|
|
2875
3141
|
printSuccess(`Formation finalized: ${result.entity_id}`);
|
|
2876
3142
|
if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
|
|
2877
3143
|
if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);
|
|
@@ -2883,17 +3149,17 @@ async function formFinalizeCommand(entityId) {
|
|
|
2883
3149
|
if (holders.length > 0) {
|
|
2884
3150
|
console.log();
|
|
2885
3151
|
const table = new Table2({
|
|
2886
|
-
head: [
|
|
3152
|
+
head: [chalk9.dim("Holder"), chalk9.dim("Shares"), chalk9.dim("Ownership %")]
|
|
2887
3153
|
});
|
|
2888
3154
|
for (const h of holders) {
|
|
2889
3155
|
const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
|
|
2890
3156
|
table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
|
|
2891
3157
|
}
|
|
2892
|
-
console.log(
|
|
3158
|
+
console.log(chalk9.bold(" Cap Table:"));
|
|
2893
3159
|
console.log(table.toString());
|
|
2894
3160
|
}
|
|
2895
3161
|
if (result.next_action) {
|
|
2896
|
-
console.log(
|
|
3162
|
+
console.log(chalk9.yellow(`
|
|
2897
3163
|
Next: ${result.next_action}`));
|
|
2898
3164
|
}
|
|
2899
3165
|
} catch (err) {
|
|
@@ -2915,7 +3181,7 @@ var api_keys_exports = {};
|
|
|
2915
3181
|
__export(api_keys_exports, {
|
|
2916
3182
|
apiKeysCommand: () => apiKeysCommand
|
|
2917
3183
|
});
|
|
2918
|
-
import
|
|
3184
|
+
import chalk10 from "chalk";
|
|
2919
3185
|
import Table3 from "cli-table3";
|
|
2920
3186
|
async function apiKeysCommand(opts) {
|
|
2921
3187
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
@@ -2923,7 +3189,11 @@ async function apiKeysCommand(opts) {
|
|
|
2923
3189
|
try {
|
|
2924
3190
|
const keys = await client.listApiKeys();
|
|
2925
3191
|
if (opts.json) {
|
|
2926
|
-
printJson(keys)
|
|
3192
|
+
printJson(keys.map((k) => ({
|
|
3193
|
+
...k,
|
|
3194
|
+
...k.key != null ? { key: maskKey(String(k.key)) } : {},
|
|
3195
|
+
...k.api_key != null ? { api_key: maskKey(String(k.api_key)) } : {}
|
|
3196
|
+
})));
|
|
2927
3197
|
return;
|
|
2928
3198
|
}
|
|
2929
3199
|
if (keys.length === 0) {
|
|
@@ -2931,17 +3201,16 @@ async function apiKeysCommand(opts) {
|
|
|
2931
3201
|
return;
|
|
2932
3202
|
}
|
|
2933
3203
|
console.log(`
|
|
2934
|
-
${
|
|
3204
|
+
${chalk10.bold("API Keys")}`);
|
|
2935
3205
|
const table = new Table3({
|
|
2936
|
-
head: [
|
|
3206
|
+
head: [chalk10.dim("ID"), chalk10.dim("Name"), chalk10.dim("Key"), chalk10.dim("Created")]
|
|
2937
3207
|
});
|
|
2938
3208
|
for (const k of keys) {
|
|
2939
3209
|
table.push([
|
|
2940
|
-
String(k.id ?? k.api_key_id ?? "").slice(0, 12),
|
|
3210
|
+
String(k.key_id ?? k.id ?? k.api_key_id ?? "").slice(0, 12),
|
|
2941
3211
|
String(k.name ?? ""),
|
|
2942
3212
|
maskKey(String(k.key ?? k.api_key ?? "")),
|
|
2943
|
-
String(k.created_at ?? "")
|
|
2944
|
-
String(k.last_used_at ?? "")
|
|
3213
|
+
String(k.created_at ?? "")
|
|
2945
3214
|
]);
|
|
2946
3215
|
}
|
|
2947
3216
|
console.log(table.toString());
|
|
@@ -3119,7 +3388,7 @@ INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
|
|
|
3119
3388
|
});
|
|
3120
3389
|
|
|
3121
3390
|
// src/index.ts
|
|
3122
|
-
import { Command } from "commander";
|
|
3391
|
+
import { Command, Option } from "commander";
|
|
3123
3392
|
import { createRequire } from "module";
|
|
3124
3393
|
var require2 = createRequire(import.meta.url);
|
|
3125
3394
|
var pkg = require2("../package.json");
|
|
@@ -3170,9 +3439,9 @@ var entitiesCmd = program.command("entities").description("List entities, show d
|
|
|
3170
3439
|
const { entitiesCommand: entitiesCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
3171
3440
|
await entitiesCommand2(opts);
|
|
3172
3441
|
});
|
|
3173
|
-
entitiesCmd.command("show <entity-id>").option("--json", "Output as JSON").description("Show entity detail").action(async (entityId, opts) => {
|
|
3442
|
+
entitiesCmd.command("show <entity-id>").option("--json", "Output as JSON").description("Show entity detail").action(async (entityId, opts, cmd) => {
|
|
3174
3443
|
const { entitiesShowCommand: entitiesShowCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
3175
|
-
await entitiesShowCommand2(entityId, opts);
|
|
3444
|
+
await entitiesShowCommand2(entityId, { ...cmd.opts(), ...opts });
|
|
3176
3445
|
});
|
|
3177
3446
|
entitiesCmd.command("convert <entity-id>").requiredOption("--to <type>", "Target entity type (llc, c_corp)").option("--jurisdiction <jurisdiction>", "New jurisdiction").description("Convert entity to a different type").action(async (entityId, opts) => {
|
|
3178
3447
|
const { entitiesConvertCommand: entitiesConvertCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
@@ -3340,7 +3609,7 @@ governanceCmd.command("convene").requiredOption("--body <id>", "Governance body
|
|
|
3340
3609
|
const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3341
3610
|
await governanceConveneCommand2({ ...opts, meetingType: opts.type, entityId: parent.entityId });
|
|
3342
3611
|
});
|
|
3343
|
-
governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").
|
|
3612
|
+
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
3613
|
const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3345
3614
|
await governanceVoteCommand2(meetingId, itemId, opts);
|
|
3346
3615
|
});
|
|
@@ -3364,7 +3633,7 @@ governanceCmd.command("agenda-items <meeting-id>").description("List agenda item
|
|
|
3364
3633
|
const { listAgendaItemsCommand: listAgendaItemsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3365
3634
|
await listAgendaItemsCommand2(meetingId, { entityId: parent.entityId, json: parent.json });
|
|
3366
3635
|
});
|
|
3367
|
-
governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status: voted, discussed, tabled,
|
|
3636
|
+
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
3637
|
const parent = cmd.parent.opts();
|
|
3369
3638
|
const { finalizeAgendaItemCommand: finalizeAgendaItemCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3370
3639
|
await finalizeAgendaItemCommand2(meetingId, itemId, { ...opts, entityId: parent.entityId });
|
|
@@ -3383,17 +3652,17 @@ var documentsCmd = program.command("documents").description("Documents and signi
|
|
|
3383
3652
|
const { documentsListCommand: documentsListCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3384
3653
|
await documentsListCommand2(opts);
|
|
3385
3654
|
});
|
|
3386
|
-
documentsCmd.command("signing-link <doc-id>").description("Get a signing link for a document").action(async (docId,
|
|
3655
|
+
documentsCmd.command("signing-link <doc-id>").option("--entity-id <id>", "Entity ID (overrides active entity and parent command)").description("Get a signing link for a document").action(async (docId, opts, cmd) => {
|
|
3387
3656
|
const parent = cmd.parent.opts();
|
|
3388
3657
|
const { documentsSigningLinkCommand: documentsSigningLinkCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3389
|
-
await documentsSigningLinkCommand2(docId, { entityId: parent.entityId });
|
|
3658
|
+
await documentsSigningLinkCommand2(docId, { entityId: opts.entityId ?? parent.entityId });
|
|
3390
3659
|
});
|
|
3391
3660
|
documentsCmd.command("generate").requiredOption("--template <type>", "Template type (consulting_agreement, employment_offer, contractor_agreement, nda, custom)").requiredOption("--counterparty <name>", "Counterparty name").option("--effective-date <date>", "Effective date (ISO 8601, defaults to today)").description("Generate a contract from a template").action(async (opts, cmd) => {
|
|
3392
3661
|
const parent = cmd.parent.opts();
|
|
3393
3662
|
const { documentsGenerateCommand: documentsGenerateCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3394
3663
|
await documentsGenerateCommand2({ ...opts, entityId: parent.entityId });
|
|
3395
3664
|
});
|
|
3396
|
-
documentsCmd.command("preview-pdf").requiredOption("--document-id <id>", "AST document definition ID (e.g. 'bylaws')").description("
|
|
3665
|
+
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
3666
|
const parent = cmd.parent.opts();
|
|
3398
3667
|
const { documentsPreviewPdfCommand: documentsPreviewPdfCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3399
3668
|
await documentsPreviewPdfCommand2({ ...opts, entityId: parent.entityId });
|
|
@@ -3404,7 +3673,7 @@ taxCmd.command("file").requiredOption("--type <type>", "Document type").required
|
|
|
3404
3673
|
const { taxFileCommand: taxFileCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
|
|
3405
3674
|
await taxFileCommand2({ ...opts, entityId: parent.entityId });
|
|
3406
3675
|
});
|
|
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) => {
|
|
3676
|
+
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
3677
|
const parent = cmd.parent.opts();
|
|
3409
3678
|
const { taxDeadlineCommand: taxDeadlineCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
|
|
3410
3679
|
await taxDeadlineCommand2({ ...opts, entityId: parent.entityId });
|
|
@@ -3437,14 +3706,44 @@ agentsCmd.command("message <agent-id>").requiredOption("--body <text>", "Message
|
|
|
3437
3706
|
const { agentsMessageCommand: agentsMessageCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3438
3707
|
await agentsMessageCommand2(agentId, opts);
|
|
3439
3708
|
});
|
|
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
3709
|
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
3710
|
const { agentsSkillCommand: agentsSkillCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3446
3711
|
await agentsSkillCommand2(agentId, opts);
|
|
3447
3712
|
});
|
|
3713
|
+
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) => {
|
|
3714
|
+
const { workItemsListCommand: workItemsListCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3715
|
+
await workItemsListCommand2(opts);
|
|
3716
|
+
});
|
|
3717
|
+
workItemsCmd.command("show <item-id>").option("--json", "Output as JSON").description("Show work item detail").action(async (itemId, opts, cmd) => {
|
|
3718
|
+
const parent = cmd.parent.opts();
|
|
3719
|
+
const { workItemsShowCommand: workItemsShowCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3720
|
+
await workItemsShowCommand2(itemId, { ...opts, entityId: parent.entityId });
|
|
3721
|
+
});
|
|
3722
|
+
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) => {
|
|
3723
|
+
const parent = cmd.parent.opts();
|
|
3724
|
+
const { workItemsCreateCommand: workItemsCreateCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3725
|
+
await workItemsCreateCommand2({ ...opts, entityId: parent.entityId });
|
|
3726
|
+
});
|
|
3727
|
+
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) => {
|
|
3728
|
+
const parent = cmd.parent.opts();
|
|
3729
|
+
const { workItemsClaimCommand: workItemsClaimCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3730
|
+
await workItemsClaimCommand2(itemId, { claimedBy: opts.by, ttl: opts.ttl, entityId: parent.entityId });
|
|
3731
|
+
});
|
|
3732
|
+
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) => {
|
|
3733
|
+
const parent = cmd.parent.opts();
|
|
3734
|
+
const { workItemsCompleteCommand: workItemsCompleteCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3735
|
+
await workItemsCompleteCommand2(itemId, { completedBy: opts.by, result: opts.result, entityId: parent.entityId });
|
|
3736
|
+
});
|
|
3737
|
+
workItemsCmd.command("release <item-id>").description("Release a claimed work item").action(async (itemId, _opts, cmd) => {
|
|
3738
|
+
const parent = cmd.parent.opts();
|
|
3739
|
+
const { workItemsReleaseCommand: workItemsReleaseCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3740
|
+
await workItemsReleaseCommand2(itemId, { entityId: parent.entityId });
|
|
3741
|
+
});
|
|
3742
|
+
workItemsCmd.command("cancel <item-id>").description("Cancel a work item").action(async (itemId, _opts, cmd) => {
|
|
3743
|
+
const parent = cmd.parent.opts();
|
|
3744
|
+
const { workItemsCancelCommand: workItemsCancelCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3745
|
+
await workItemsCancelCommand2(itemId, { entityId: parent.entityId });
|
|
3746
|
+
});
|
|
3448
3747
|
var billingCmd = program.command("billing").description("Billing status, plans, and subscription management").option("--json", "Output as JSON").action(async (opts) => {
|
|
3449
3748
|
const { billingCommand: billingCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
|
|
3450
3749
|
await billingCommand2(opts);
|
|
@@ -3463,23 +3762,23 @@ program.command("approvals").description("Approvals are managed through governan
|
|
|
3463
3762
|
"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
3763
|
);
|
|
3465
3764
|
});
|
|
3466
|
-
var formCmd = program.command("form").description("Form a new entity with founders and cap table
|
|
3765
|
+
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
3766
|
if (opts.entityType && !opts.type) opts.type = opts.entityType;
|
|
3468
3767
|
if (opts.legalName && !opts.name) opts.name = opts.legalName;
|
|
3469
3768
|
const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3470
3769
|
await formCommand2(opts);
|
|
3471
3770
|
});
|
|
3472
|
-
formCmd.command("create").description("Create a pending entity (staged flow step 1)").requiredOption("--type <type>", "Entity type (llc, c_corp)").requiredOption("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").action(async (opts) => {
|
|
3771
|
+
formCmd.command("create").description("Create a pending entity (staged flow step 1)").requiredOption("--type <type>", "Entity type (llc, c_corp)").requiredOption("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").action(async (opts) => {
|
|
3473
3772
|
const { formCreateCommand: formCreateCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3474
3773
|
await formCreateCommand2(opts);
|
|
3475
3774
|
});
|
|
3476
|
-
formCmd.command("add-founder <entity-id>").description("Add a founder to a pending entity (staged flow step 2)").requiredOption("--name <name>", "Founder name").requiredOption("--email <email>", "Founder email").requiredOption("--role <role>", "Role: director|officer|manager|member|chair").requiredOption("--pct <pct>", "Ownership percentage").option("--officer-title <title>", "Officer title (corporations only)").option("--incorporator", "Mark as sole incorporator (corporations only)").action(async (entityId, opts) => {
|
|
3775
|
+
formCmd.command("add-founder <entity-id>").description("Add a founder to a pending entity (staged flow step 2)").requiredOption("--name <name>", "Founder name").requiredOption("--email <email>", "Founder email").requiredOption("--role <role>", "Role: director|officer|manager|member|chair").requiredOption("--pct <pct>", "Ownership percentage").option("--officer-title <title>", "Officer title (corporations only)").option("--incorporator", "Mark as sole incorporator (corporations only)").option("--address <address>", "Founder address as 'street,city,state,zip'").action(async (entityId, opts) => {
|
|
3477
3776
|
const { formAddFounderCommand: formAddFounderCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3478
3777
|
await formAddFounderCommand2(entityId, opts);
|
|
3479
3778
|
});
|
|
3480
|
-
formCmd.command("finalize <entity-id>").description("Finalize formation and generate documents + cap table (staged flow step 3)").action(async (entityId) => {
|
|
3779
|
+
formCmd.command("finalize <entity-id>").description("Finalize formation and generate documents + cap table (staged flow step 3)").option("--authorized-shares <count>", "Authorized shares for corporations").option("--par-value <value>", "Par value per share, e.g. 0.0001").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").action(async (entityId, opts) => {
|
|
3481
3780
|
const { formFinalizeCommand: formFinalizeCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3482
|
-
await formFinalizeCommand2(entityId);
|
|
3781
|
+
await formFinalizeCommand2(entityId, opts);
|
|
3483
3782
|
});
|
|
3484
3783
|
program.command("api-keys").description("List API keys").option("--json", "Output as JSON").action(async (opts) => {
|
|
3485
3784
|
const { apiKeysCommand: apiKeysCommand2 } = await Promise.resolve().then(() => (init_api_keys(), api_keys_exports));
|