@thecorporation/cli 26.3.2 → 26.3.4
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 +387 -202
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10,6 +10,17 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// src/config.ts
|
|
13
|
+
var config_exports = {};
|
|
14
|
+
__export(config_exports, {
|
|
15
|
+
configForDisplay: () => configForDisplay,
|
|
16
|
+
getValue: () => getValue,
|
|
17
|
+
loadConfig: () => loadConfig,
|
|
18
|
+
maskKey: () => maskKey,
|
|
19
|
+
requireConfig: () => requireConfig,
|
|
20
|
+
resolveEntityId: () => resolveEntityId,
|
|
21
|
+
saveConfig: () => saveConfig,
|
|
22
|
+
setValue: () => setValue
|
|
23
|
+
});
|
|
13
24
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
14
25
|
import { join } from "path";
|
|
15
26
|
import { homedir } from "os";
|
|
@@ -122,6 +133,29 @@ var init_api_client = __esm({
|
|
|
122
133
|
});
|
|
123
134
|
|
|
124
135
|
// src/output.ts
|
|
136
|
+
var output_exports = {};
|
|
137
|
+
__export(output_exports, {
|
|
138
|
+
printAgentsTable: () => printAgentsTable,
|
|
139
|
+
printApprovalsTable: () => printApprovalsTable,
|
|
140
|
+
printBillingPanel: () => printBillingPanel,
|
|
141
|
+
printCapTable: () => printCapTable,
|
|
142
|
+
printContactsTable: () => printContactsTable,
|
|
143
|
+
printDocumentsTable: () => printDocumentsTable,
|
|
144
|
+
printEntitiesTable: () => printEntitiesTable,
|
|
145
|
+
printError: () => printError,
|
|
146
|
+
printGovernanceTable: () => printGovernanceTable,
|
|
147
|
+
printJson: () => printJson,
|
|
148
|
+
printMeetingsTable: () => printMeetingsTable,
|
|
149
|
+
printObligationsTable: () => printObligationsTable,
|
|
150
|
+
printResolutionsTable: () => printResolutionsTable,
|
|
151
|
+
printSafesTable: () => printSafesTable,
|
|
152
|
+
printSeatsTable: () => printSeatsTable,
|
|
153
|
+
printStatusPanel: () => printStatusPanel,
|
|
154
|
+
printSuccess: () => printSuccess,
|
|
155
|
+
printTransfersTable: () => printTransfersTable,
|
|
156
|
+
printValuationsTable: () => printValuationsTable,
|
|
157
|
+
printWarning: () => printWarning
|
|
158
|
+
});
|
|
125
159
|
import chalk from "chalk";
|
|
126
160
|
import Table from "cli-table3";
|
|
127
161
|
function printError(msg) {
|
|
@@ -130,6 +164,9 @@ function printError(msg) {
|
|
|
130
164
|
function printSuccess(msg) {
|
|
131
165
|
console.log(chalk.green(msg));
|
|
132
166
|
}
|
|
167
|
+
function printWarning(msg) {
|
|
168
|
+
console.log(chalk.yellow(msg));
|
|
169
|
+
}
|
|
133
170
|
function printJson(data) {
|
|
134
171
|
console.log(JSON.stringify(data, null, 2));
|
|
135
172
|
}
|
|
@@ -364,35 +401,30 @@ function printApprovalsTable(approvals) {
|
|
|
364
401
|
console.log(table.toString());
|
|
365
402
|
}
|
|
366
403
|
function printBillingPanel(status, plans) {
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
const
|
|
404
|
+
const plan = s(status.plan ?? status.tier) || "free";
|
|
405
|
+
const subStatus = s(status.status) || "active";
|
|
406
|
+
const periodEnd = s(status.current_period_end);
|
|
370
407
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
371
408
|
console.log(chalk.green.bold(" Billing Status"));
|
|
372
409
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
373
|
-
console.log(` ${chalk.bold("
|
|
374
|
-
console.log(` ${chalk.bold("
|
|
375
|
-
|
|
376
|
-
console.log(` - ${sub.tier ?? "N/A"} (${sub.status ?? "N/A"})`);
|
|
377
|
-
}
|
|
378
|
-
console.log(` ${chalk.bold("Tool Calls:")} ${usageCount}`);
|
|
410
|
+
console.log(` ${chalk.bold("Plan:")} ${plan}`);
|
|
411
|
+
console.log(` ${chalk.bold("Status:")} ${subStatus}`);
|
|
412
|
+
if (periodEnd) console.log(` ${chalk.bold("Current Period End:")} ${periodEnd}`);
|
|
379
413
|
console.log(chalk.dim(" Manage: corp billing portal"));
|
|
380
|
-
console.log(chalk.dim(" Upgrade: corp billing upgrade"));
|
|
414
|
+
console.log(chalk.dim(" Upgrade: corp billing upgrade --plan <plan>"));
|
|
381
415
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
382
416
|
if (plans.length > 0) {
|
|
383
|
-
const table = makeTable("Available Plans", ["
|
|
417
|
+
const table = makeTable("Available Plans", ["Plan", "Price", "Features"]);
|
|
384
418
|
for (const p of plans) {
|
|
385
|
-
const amount = p.amount ?? 0;
|
|
419
|
+
const amount = p.price_cents ?? p.amount ?? 0;
|
|
386
420
|
const interval = s(p.interval);
|
|
387
421
|
let priceStr = "Free";
|
|
388
422
|
if (amount > 0) {
|
|
389
|
-
priceStr = interval ? `$${Math.round(amount / 100)}/${interval
|
|
423
|
+
priceStr = interval ? `$${Math.round(amount / 100)}/${interval}` : `$${Math.round(amount / 100)}`;
|
|
390
424
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (desc.length > 60) desc = desc.slice(0, 57) + "...";
|
|
395
|
-
table.push([name, priceStr, s(p.type), desc]);
|
|
425
|
+
const name = s(p.name ?? p.plan_id ?? p.tier);
|
|
426
|
+
const features = Array.isArray(p.features) ? p.features.join(", ") : s(p.description);
|
|
427
|
+
table.push([name, priceStr, features]);
|
|
396
428
|
}
|
|
397
429
|
console.log(table.toString());
|
|
398
430
|
}
|
|
@@ -682,8 +714,8 @@ var init_status = __esm({
|
|
|
682
714
|
});
|
|
683
715
|
|
|
684
716
|
// src/commands/config.ts
|
|
685
|
-
var
|
|
686
|
-
__export(
|
|
717
|
+
var config_exports2 = {};
|
|
718
|
+
__export(config_exports2, {
|
|
687
719
|
configGetCommand: () => configGetCommand,
|
|
688
720
|
configListCommand: () => configListCommand,
|
|
689
721
|
configSetCommand: () => configSetCommand
|
|
@@ -787,19 +819,13 @@ var link_exports = {};
|
|
|
787
819
|
__export(link_exports, {
|
|
788
820
|
linkCommand: () => linkCommand
|
|
789
821
|
});
|
|
790
|
-
async function linkCommand() {
|
|
822
|
+
async function linkCommand(opts) {
|
|
791
823
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
792
824
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
793
825
|
try {
|
|
794
|
-
const data = await client.createLink();
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
console.log();
|
|
798
|
-
console.log(` ${code}`);
|
|
799
|
-
console.log();
|
|
800
|
-
console.log(`Run this on the other device (expires in ${Math.floor(expires / 60)} minutes):`);
|
|
801
|
-
console.log(` corp claim ${code}`);
|
|
802
|
-
console.log();
|
|
826
|
+
const data = await client.createLink(opts.externalId, opts.provider);
|
|
827
|
+
printSuccess(`Workspace linked to ${opts.provider} (external ID: ${opts.externalId})`);
|
|
828
|
+
if (data.workspace_id) console.log(` Workspace: ${data.workspace_id}`);
|
|
803
829
|
} catch (err) {
|
|
804
830
|
printError(`${err}`);
|
|
805
831
|
process.exit(1);
|
|
@@ -1035,7 +1061,7 @@ async function chatCommand() {
|
|
|
1035
1061
|
const messages = [{ role: "system", content: SYSTEM_PROMPT }];
|
|
1036
1062
|
let totalTokens = 0;
|
|
1037
1063
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1038
|
-
const prompt = () => new Promise((
|
|
1064
|
+
const prompt = () => new Promise((resolve2) => rl.question(chalk2.green.bold("> "), resolve2));
|
|
1039
1065
|
console.log(chalk2.blue.bold("corp chat") + " \u2014 type /help for commands, /quit to exit\n");
|
|
1040
1066
|
const slashHandlers = {
|
|
1041
1067
|
"/status": async () => {
|
|
@@ -1245,7 +1271,7 @@ async function entitiesConvertCommand(entityId, opts) {
|
|
|
1245
1271
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1246
1272
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1247
1273
|
try {
|
|
1248
|
-
const data = {
|
|
1274
|
+
const data = { target_type: opts.to };
|
|
1249
1275
|
if (opts.jurisdiction) data.new_jurisdiction = opts.jurisdiction;
|
|
1250
1276
|
const result = await client.convertEntity(entityId, data);
|
|
1251
1277
|
printSuccess(`Entity conversion initiated: ${result.conversion_id ?? "OK"}`);
|
|
@@ -1265,7 +1291,12 @@ async function entitiesDissolveCommand(entityId, opts) {
|
|
|
1265
1291
|
printSuccess(`Dissolution initiated: ${result.dissolution_id ?? "OK"}`);
|
|
1266
1292
|
printJson(result);
|
|
1267
1293
|
} catch (err) {
|
|
1268
|
-
|
|
1294
|
+
const msg = String(err);
|
|
1295
|
+
if (msg.includes("InvalidTransition") || msg.includes("422")) {
|
|
1296
|
+
printError(`Cannot dissolve entity: only entities with 'active' status can be dissolved. Check the entity's current status with: corp entities show ${entityId}`);
|
|
1297
|
+
} else {
|
|
1298
|
+
printError(`Failed to dissolve entity: ${err}`);
|
|
1299
|
+
}
|
|
1269
1300
|
process.exit(1);
|
|
1270
1301
|
}
|
|
1271
1302
|
}
|
|
@@ -1290,9 +1321,10 @@ __export(contacts_exports, {
|
|
|
1290
1321
|
import chalk4 from "chalk";
|
|
1291
1322
|
async function contactsListCommand(opts) {
|
|
1292
1323
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1324
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1293
1325
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1294
1326
|
try {
|
|
1295
|
-
const contacts = await client.listContacts();
|
|
1327
|
+
const contacts = await client.listContacts(eid);
|
|
1296
1328
|
if (opts.json) printJson(contacts);
|
|
1297
1329
|
else if (contacts.length === 0) console.log("No contacts found.");
|
|
1298
1330
|
else printContactsTable(contacts);
|
|
@@ -1303,9 +1335,10 @@ async function contactsListCommand(opts) {
|
|
|
1303
1335
|
}
|
|
1304
1336
|
async function contactsShowCommand(contactId, opts) {
|
|
1305
1337
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1338
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1306
1339
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1307
1340
|
try {
|
|
1308
|
-
const profile = await client.getContactProfile(contactId);
|
|
1341
|
+
const profile = await client.getContactProfile(contactId, eid);
|
|
1309
1342
|
if (opts.json) {
|
|
1310
1343
|
printJson(profile);
|
|
1311
1344
|
} else {
|
|
@@ -1336,10 +1369,16 @@ async function contactsShowCommand(contactId, opts) {
|
|
|
1336
1369
|
}
|
|
1337
1370
|
async function contactsAddCommand(opts) {
|
|
1338
1371
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1372
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1339
1373
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1340
1374
|
try {
|
|
1341
|
-
const data = {
|
|
1342
|
-
|
|
1375
|
+
const data = {
|
|
1376
|
+
entity_id: eid,
|
|
1377
|
+
contact_type: opts.type ?? "individual",
|
|
1378
|
+
name: opts.name,
|
|
1379
|
+
email: opts.email,
|
|
1380
|
+
category: opts.category ?? "employee"
|
|
1381
|
+
};
|
|
1343
1382
|
if (opts.phone) data.phone = opts.phone;
|
|
1344
1383
|
if (opts.notes) data.notes = opts.notes;
|
|
1345
1384
|
const result = await client.createContact(data);
|
|
@@ -1351,9 +1390,10 @@ async function contactsAddCommand(opts) {
|
|
|
1351
1390
|
}
|
|
1352
1391
|
async function contactsEditCommand(contactId, opts) {
|
|
1353
1392
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1393
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1354
1394
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1355
1395
|
try {
|
|
1356
|
-
const data = {};
|
|
1396
|
+
const data = { entity_id: eid };
|
|
1357
1397
|
if (opts.name != null) data.name = opts.name;
|
|
1358
1398
|
if (opts.email != null) data.email = opts.email;
|
|
1359
1399
|
if (opts.category != null) data.category = opts.category;
|
|
@@ -1476,7 +1516,12 @@ async function fourOhNineACommand(opts) {
|
|
|
1476
1516
|
else if (!data || Object.keys(data).length === 0) console.log("No 409A valuation found.");
|
|
1477
1517
|
else print409a(data);
|
|
1478
1518
|
} catch (err) {
|
|
1479
|
-
|
|
1519
|
+
const msg = String(err);
|
|
1520
|
+
if (msg.includes("404")) {
|
|
1521
|
+
console.log("No 409A valuation found for this entity. Create one with:\n corp cap-table create-valuation --type four_oh_nine_a --date YYYY-MM-DD --methodology <method>");
|
|
1522
|
+
} else {
|
|
1523
|
+
printError(`Failed to fetch 409A valuation: ${err}`);
|
|
1524
|
+
}
|
|
1480
1525
|
process.exit(1);
|
|
1481
1526
|
}
|
|
1482
1527
|
}
|
|
@@ -1485,13 +1530,48 @@ async function issueEquityCommand(opts) {
|
|
|
1485
1530
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1486
1531
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1487
1532
|
try {
|
|
1488
|
-
const
|
|
1533
|
+
const capTable = await client.getCapTable(eid);
|
|
1534
|
+
const issuerLegalEntityId = capTable.issuer_legal_entity_id;
|
|
1535
|
+
if (!issuerLegalEntityId) {
|
|
1536
|
+
printError("No issuer legal entity found. Has this entity been formed with a cap table?");
|
|
1537
|
+
process.exit(1);
|
|
1538
|
+
}
|
|
1539
|
+
let instrumentId = opts.instrumentId;
|
|
1540
|
+
if (!instrumentId) {
|
|
1541
|
+
const instruments = capTable.instruments;
|
|
1542
|
+
if (!instruments?.length) {
|
|
1543
|
+
printError("No instruments found on cap table. Create an instrument first.");
|
|
1544
|
+
process.exit(1);
|
|
1545
|
+
}
|
|
1546
|
+
const grantLower = opts.grantType.toLowerCase();
|
|
1547
|
+
const match = instruments.find(
|
|
1548
|
+
(i) => i.kind.toLowerCase().includes(grantLower) || i.symbol.toLowerCase().includes(grantLower)
|
|
1549
|
+
) ?? instruments.find((i) => i.kind.toLowerCase().includes("common"));
|
|
1550
|
+
if (match) {
|
|
1551
|
+
instrumentId = match.instrument_id;
|
|
1552
|
+
console.log(`Using instrument: ${match.symbol} (${match.kind})`);
|
|
1553
|
+
} else {
|
|
1554
|
+
instrumentId = instruments[0].instrument_id;
|
|
1555
|
+
console.log(`Using first instrument: ${instruments[0].symbol} (${instruments[0].kind})`);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
const round = await client.startEquityRound({
|
|
1489
1559
|
entity_id: eid,
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
recipient_name: opts.recipient
|
|
1560
|
+
name: `${opts.grantType} grant \u2014 ${opts.recipient}`,
|
|
1561
|
+
issuer_legal_entity_id: issuerLegalEntityId
|
|
1493
1562
|
});
|
|
1494
|
-
|
|
1563
|
+
const roundId = round.round_id ?? round.equity_round_id;
|
|
1564
|
+
const securityData = {
|
|
1565
|
+
entity_id: eid,
|
|
1566
|
+
instrument_id: instrumentId,
|
|
1567
|
+
quantity: opts.shares,
|
|
1568
|
+
recipient_name: opts.recipient,
|
|
1569
|
+
grant_type: opts.grantType
|
|
1570
|
+
};
|
|
1571
|
+
if (opts.email) securityData.email = opts.email;
|
|
1572
|
+
await client.addRoundSecurity(roundId, securityData);
|
|
1573
|
+
const result = await client.issueRound(roundId, { entity_id: eid });
|
|
1574
|
+
printSuccess(`Equity issued: ${opts.shares} shares (${opts.grantType}) to ${opts.recipient}`);
|
|
1495
1575
|
printJson(result);
|
|
1496
1576
|
} catch (err) {
|
|
1497
1577
|
printError(`Failed to issue equity: ${err}`);
|
|
@@ -1503,14 +1583,36 @@ async function issueSafeCommand(opts) {
|
|
|
1503
1583
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1504
1584
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1505
1585
|
try {
|
|
1506
|
-
const
|
|
1586
|
+
const capTable = await client.getCapTable(eid);
|
|
1587
|
+
const issuerLegalEntityId = capTable.issuer_legal_entity_id;
|
|
1588
|
+
if (!issuerLegalEntityId) {
|
|
1589
|
+
printError("No issuer legal entity found. Has this entity been formed with a cap table?");
|
|
1590
|
+
process.exit(1);
|
|
1591
|
+
}
|
|
1592
|
+
const instruments = capTable.instruments;
|
|
1593
|
+
const safeInstrument = instruments?.find((i) => i.kind.toLowerCase() === "safe");
|
|
1594
|
+
if (!safeInstrument) {
|
|
1595
|
+
printError("No SAFE instrument found on cap table. Create a SAFE instrument first.");
|
|
1596
|
+
process.exit(1);
|
|
1597
|
+
}
|
|
1598
|
+
const round = await client.startEquityRound({
|
|
1507
1599
|
entity_id: eid,
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
safe_type: opts.safeType,
|
|
1511
|
-
valuation_cap_cents: opts.valuationCap
|
|
1600
|
+
name: `SAFE \u2014 ${opts.investor}`,
|
|
1601
|
+
issuer_legal_entity_id: issuerLegalEntityId
|
|
1512
1602
|
});
|
|
1513
|
-
|
|
1603
|
+
const roundId = round.round_id ?? round.equity_round_id;
|
|
1604
|
+
const securityData = {
|
|
1605
|
+
entity_id: eid,
|
|
1606
|
+
instrument_id: safeInstrument.instrument_id,
|
|
1607
|
+
quantity: opts.amount,
|
|
1608
|
+
recipient_name: opts.investor,
|
|
1609
|
+
principal_cents: opts.amount,
|
|
1610
|
+
grant_type: opts.safeType
|
|
1611
|
+
};
|
|
1612
|
+
if (opts.email) securityData.email = opts.email;
|
|
1613
|
+
await client.addRoundSecurity(roundId, securityData);
|
|
1614
|
+
const result = await client.issueRound(roundId, { entity_id: eid });
|
|
1615
|
+
printSuccess(`SAFE issued: $${(opts.amount / 100).toLocaleString()} to ${opts.investor}`);
|
|
1514
1616
|
printJson(result);
|
|
1515
1617
|
} catch (err) {
|
|
1516
1618
|
printError(`Failed to issue SAFE: ${err}`);
|
|
@@ -1522,17 +1624,24 @@ async function transferSharesCommand(opts) {
|
|
|
1522
1624
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1523
1625
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1524
1626
|
try {
|
|
1525
|
-
const
|
|
1627
|
+
const body = {
|
|
1526
1628
|
entity_id: eid,
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
transfer_type: opts.type
|
|
1531
|
-
|
|
1532
|
-
|
|
1629
|
+
share_class_id: opts.shareClassId,
|
|
1630
|
+
from_contact_id: opts.from,
|
|
1631
|
+
to_contact_id: opts.to,
|
|
1632
|
+
transfer_type: opts.type,
|
|
1633
|
+
share_count: opts.shares,
|
|
1634
|
+
governing_doc_type: opts.governingDocType,
|
|
1635
|
+
transferee_rights: opts.transfereeRights,
|
|
1636
|
+
prepare_intent_id: opts.prepareIntentId
|
|
1637
|
+
};
|
|
1638
|
+
if (opts.pricePerShareCents != null) body.price_per_share_cents = opts.pricePerShareCents;
|
|
1639
|
+
if (opts.relationship) body.relationship_to_holder = opts.relationship;
|
|
1640
|
+
const result = await client.transferShares(body);
|
|
1641
|
+
printSuccess(`Transfer workflow created: ${result.workflow_id ?? "OK"}`);
|
|
1533
1642
|
printJson(result);
|
|
1534
1643
|
} catch (err) {
|
|
1535
|
-
printError(`Failed to transfer
|
|
1644
|
+
printError(`Failed to create transfer workflow: ${err}`);
|
|
1536
1645
|
process.exit(1);
|
|
1537
1646
|
}
|
|
1538
1647
|
}
|
|
@@ -1544,7 +1653,8 @@ async function distributeCommand(opts) {
|
|
|
1544
1653
|
const result = await client.calculateDistribution({
|
|
1545
1654
|
entity_id: eid,
|
|
1546
1655
|
total_amount_cents: opts.amount,
|
|
1547
|
-
distribution_type: opts.type
|
|
1656
|
+
distribution_type: opts.type,
|
|
1657
|
+
description: opts.description
|
|
1548
1658
|
});
|
|
1549
1659
|
printSuccess(`Distribution calculated: ${result.distribution_id ?? "OK"}`);
|
|
1550
1660
|
printJson(result);
|
|
@@ -1638,7 +1748,12 @@ async function submitValuationCommand(opts) {
|
|
|
1638
1748
|
if (result.agenda_item_id) console.log(` Agenda Item: ${result.agenda_item_id}`);
|
|
1639
1749
|
printJson(result);
|
|
1640
1750
|
} catch (err) {
|
|
1641
|
-
|
|
1751
|
+
const msg = String(err);
|
|
1752
|
+
if (msg.includes("404")) {
|
|
1753
|
+
printError(`Valuation not found. List valuations with: corp cap-table valuations`);
|
|
1754
|
+
} else {
|
|
1755
|
+
printError(`Failed to submit valuation: ${err}`);
|
|
1756
|
+
}
|
|
1642
1757
|
process.exit(1);
|
|
1643
1758
|
}
|
|
1644
1759
|
}
|
|
@@ -1651,7 +1766,12 @@ async function approveValuationCommand(opts) {
|
|
|
1651
1766
|
printSuccess(`Valuation approved: ${result.valuation_id ?? "OK"}`);
|
|
1652
1767
|
printJson(result);
|
|
1653
1768
|
} catch (err) {
|
|
1654
|
-
|
|
1769
|
+
const msg = String(err);
|
|
1770
|
+
if (msg.includes("400")) {
|
|
1771
|
+
printError(`Bad request \u2014 a --resolution-id from a board vote may be required. Submit for approval first: corp cap-table submit-valuation <id>`);
|
|
1772
|
+
} else {
|
|
1773
|
+
printError(`Failed to approve valuation: ${err}`);
|
|
1774
|
+
}
|
|
1655
1775
|
process.exit(1);
|
|
1656
1776
|
}
|
|
1657
1777
|
}
|
|
@@ -1743,7 +1863,7 @@ async function financeOpenAccountCommand(opts) {
|
|
|
1743
1863
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1744
1864
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1745
1865
|
try {
|
|
1746
|
-
const result = await client.openBankAccount({ entity_id: eid,
|
|
1866
|
+
const result = await client.openBankAccount({ entity_id: eid, bank_name: opts.institution });
|
|
1747
1867
|
printSuccess(`Bank account opened: ${result.account_id ?? "OK"}`);
|
|
1748
1868
|
printJson(result);
|
|
1749
1869
|
} catch (err) {
|
|
@@ -1805,7 +1925,9 @@ __export(governance_exports, {
|
|
|
1805
1925
|
cancelMeetingCommand: () => cancelMeetingCommand,
|
|
1806
1926
|
computeResolutionCommand: () => computeResolutionCommand,
|
|
1807
1927
|
finalizeAgendaItemCommand: () => finalizeAgendaItemCommand,
|
|
1928
|
+
governanceAddSeatCommand: () => governanceAddSeatCommand,
|
|
1808
1929
|
governanceConveneCommand: () => governanceConveneCommand,
|
|
1930
|
+
governanceCreateBodyCommand: () => governanceCreateBodyCommand,
|
|
1809
1931
|
governanceListCommand: () => governanceListCommand,
|
|
1810
1932
|
governanceMeetingsCommand: () => governanceMeetingsCommand,
|
|
1811
1933
|
governanceResolutionsCommand: () => governanceResolutionsCommand,
|
|
@@ -1815,6 +1937,39 @@ __export(governance_exports, {
|
|
|
1815
1937
|
sendNoticeCommand: () => sendNoticeCommand,
|
|
1816
1938
|
writtenConsentCommand: () => writtenConsentCommand
|
|
1817
1939
|
});
|
|
1940
|
+
async function governanceCreateBodyCommand(opts) {
|
|
1941
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1942
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1943
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1944
|
+
try {
|
|
1945
|
+
const result = await client.createGovernanceBody({
|
|
1946
|
+
entity_id: eid,
|
|
1947
|
+
body_type: opts.bodyType,
|
|
1948
|
+
name: opts.name,
|
|
1949
|
+
quorum_rule: opts.quorum,
|
|
1950
|
+
voting_method: opts.voting
|
|
1951
|
+
});
|
|
1952
|
+
printSuccess(`Governance body created: ${result.body_id ?? "OK"}`);
|
|
1953
|
+
printJson(result);
|
|
1954
|
+
} catch (err) {
|
|
1955
|
+
printError(`Failed to create governance body: ${err}`);
|
|
1956
|
+
process.exit(1);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
async function governanceAddSeatCommand(bodyId, opts) {
|
|
1960
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1961
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1962
|
+
try {
|
|
1963
|
+
const data = { holder_id: opts.holder };
|
|
1964
|
+
if (opts.title) data.title = opts.title;
|
|
1965
|
+
const result = await client.createGovernanceSeat(bodyId, data);
|
|
1966
|
+
printSuccess(`Seat added: ${result.seat_id ?? "OK"}`);
|
|
1967
|
+
printJson(result);
|
|
1968
|
+
} catch (err) {
|
|
1969
|
+
printError(`Failed to add seat: ${err}`);
|
|
1970
|
+
process.exit(1);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1818
1973
|
async function governanceListCommand(opts) {
|
|
1819
1974
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1820
1975
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -1831,9 +1986,10 @@ async function governanceListCommand(opts) {
|
|
|
1831
1986
|
}
|
|
1832
1987
|
async function governanceSeatsCommand(bodyId, opts) {
|
|
1833
1988
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1989
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1834
1990
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1835
1991
|
try {
|
|
1836
|
-
const seats = await client.getGovernanceSeats(bodyId);
|
|
1992
|
+
const seats = await client.getGovernanceSeats(bodyId, eid);
|
|
1837
1993
|
if (opts.json) printJson(seats);
|
|
1838
1994
|
else if (seats.length === 0) console.log("No seats found.");
|
|
1839
1995
|
else printSeatsTable(seats);
|
|
@@ -1844,9 +2000,10 @@ async function governanceSeatsCommand(bodyId, opts) {
|
|
|
1844
2000
|
}
|
|
1845
2001
|
async function governanceMeetingsCommand(bodyId, opts) {
|
|
1846
2002
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2003
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1847
2004
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1848
2005
|
try {
|
|
1849
|
-
const meetings = await client.listMeetings(bodyId);
|
|
2006
|
+
const meetings = await client.listMeetings(bodyId, eid);
|
|
1850
2007
|
if (opts.json) printJson(meetings);
|
|
1851
2008
|
else if (meetings.length === 0) console.log("No meetings found.");
|
|
1852
2009
|
else printMeetingsTable(meetings);
|
|
@@ -1857,9 +2014,10 @@ async function governanceMeetingsCommand(bodyId, opts) {
|
|
|
1857
2014
|
}
|
|
1858
2015
|
async function governanceResolutionsCommand(meetingId, opts) {
|
|
1859
2016
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2017
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1860
2018
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1861
2019
|
try {
|
|
1862
|
-
const resolutions = await client.getMeetingResolutions(meetingId);
|
|
2020
|
+
const resolutions = await client.getMeetingResolutions(meetingId, eid);
|
|
1863
2021
|
if (opts.json) printJson(resolutions);
|
|
1864
2022
|
else if (resolutions.length === 0) console.log("No resolutions found.");
|
|
1865
2023
|
else printResolutionsTable(resolutions);
|
|
@@ -2037,13 +2195,18 @@ async function documentsListCommand(opts) {
|
|
|
2037
2195
|
process.exit(1);
|
|
2038
2196
|
}
|
|
2039
2197
|
}
|
|
2040
|
-
async function documentsSigningLinkCommand(docId) {
|
|
2198
|
+
async function documentsSigningLinkCommand(docId, opts) {
|
|
2041
2199
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2200
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2042
2201
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2043
2202
|
try {
|
|
2044
|
-
const result = client.getSigningLink(docId);
|
|
2203
|
+
const result = await client.getSigningLink(docId, eid);
|
|
2045
2204
|
printSuccess(`Signing link: ${result.signing_url}`);
|
|
2046
|
-
|
|
2205
|
+
if (result.token) {
|
|
2206
|
+
console.log(` Token: ${result.token}`);
|
|
2207
|
+
console.log(` Share this URL with the signer:`);
|
|
2208
|
+
console.log(` https://humans.thecorporation.ai/sign/${docId}?token=${result.token}`);
|
|
2209
|
+
}
|
|
2047
2210
|
} catch (err) {
|
|
2048
2211
|
printError(`Failed to get signing link: ${err}`);
|
|
2049
2212
|
process.exit(1);
|
|
@@ -2057,7 +2220,8 @@ async function documentsGenerateCommand(opts) {
|
|
|
2057
2220
|
const result = await client.generateContract({
|
|
2058
2221
|
entity_id: eid,
|
|
2059
2222
|
template_type: opts.template,
|
|
2060
|
-
|
|
2223
|
+
counterparty_name: opts.counterparty,
|
|
2224
|
+
effective_date: opts.effectiveDate ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
2061
2225
|
});
|
|
2062
2226
|
printSuccess(`Contract generated: ${result.contract_id ?? "OK"}`);
|
|
2063
2227
|
printJson(result);
|
|
@@ -2145,7 +2309,6 @@ __export(agents_exports, {
|
|
|
2145
2309
|
agentsSkillCommand: () => agentsSkillCommand
|
|
2146
2310
|
});
|
|
2147
2311
|
import chalk6 from "chalk";
|
|
2148
|
-
import Table2 from "cli-table3";
|
|
2149
2312
|
async function agentsListCommand(opts) {
|
|
2150
2313
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2151
2314
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -2164,13 +2327,8 @@ async function agentsShowCommand(agentId, opts) {
|
|
|
2164
2327
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2165
2328
|
try {
|
|
2166
2329
|
const agent = await client.getAgent(agentId);
|
|
2167
|
-
let usage = {};
|
|
2168
|
-
try {
|
|
2169
|
-
usage = await client.getAgentUsage(agentId);
|
|
2170
|
-
} catch {
|
|
2171
|
-
}
|
|
2172
2330
|
if (opts.json) {
|
|
2173
|
-
printJson(
|
|
2331
|
+
printJson(agent);
|
|
2174
2332
|
return;
|
|
2175
2333
|
}
|
|
2176
2334
|
console.log(chalk6.magenta("\u2500".repeat(40)));
|
|
@@ -2185,12 +2343,8 @@ async function agentsShowCommand(agentId, opts) {
|
|
|
2185
2343
|
if (prompt.length > 100) prompt = prompt.slice(0, 97) + "...";
|
|
2186
2344
|
console.log(` ${chalk6.bold("Prompt:")} ${prompt}`);
|
|
2187
2345
|
}
|
|
2188
|
-
if (
|
|
2189
|
-
console.log(`
|
|
2190
|
-
${chalk6.bold("Usage:")}`);
|
|
2191
|
-
for (const [k, v] of Object.entries(usage)) {
|
|
2192
|
-
if (k !== "agent_id") console.log(` ${k}: ${v}`);
|
|
2193
|
-
}
|
|
2346
|
+
if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {
|
|
2347
|
+
console.log(` ${chalk6.bold("Skills:")} ${agent.skills.map((s2) => s2.name ?? "?").join(", ")}`);
|
|
2194
2348
|
}
|
|
2195
2349
|
console.log(chalk6.magenta("\u2500".repeat(40)));
|
|
2196
2350
|
} catch (err) {
|
|
@@ -2255,44 +2409,22 @@ async function agentsMessageCommand(agentId, opts) {
|
|
|
2255
2409
|
process.exit(1);
|
|
2256
2410
|
}
|
|
2257
2411
|
}
|
|
2258
|
-
async function agentsExecutionsCommand(agentId,
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
return;
|
|
2266
|
-
}
|
|
2267
|
-
if (executions.length === 0) {
|
|
2268
|
-
console.log("No executions found.");
|
|
2269
|
-
return;
|
|
2270
|
-
}
|
|
2271
|
-
console.log(`
|
|
2272
|
-
${chalk6.bold("Agent Executions")}`);
|
|
2273
|
-
const table = new Table2({ head: [chalk6.dim("ID"), chalk6.dim("Status"), chalk6.dim("Started"), chalk6.dim("Duration")] });
|
|
2274
|
-
for (const ex of executions) {
|
|
2275
|
-
table.push([
|
|
2276
|
-
String(ex.execution_id ?? "").slice(0, 12),
|
|
2277
|
-
String(ex.status ?? ""),
|
|
2278
|
-
String(ex.started_at ?? ""),
|
|
2279
|
-
String(ex.duration ?? "")
|
|
2280
|
-
]);
|
|
2281
|
-
}
|
|
2282
|
-
console.log(table.toString());
|
|
2283
|
-
} catch (err) {
|
|
2284
|
-
printError(`Failed to fetch executions: ${err}`);
|
|
2285
|
-
process.exit(1);
|
|
2286
|
-
}
|
|
2412
|
+
async function agentsExecutionsCommand(agentId, _opts) {
|
|
2413
|
+
printError(
|
|
2414
|
+
`Listing executions is not yet supported.
|
|
2415
|
+
To inspect a specific run, use the execution ID returned by "agents message":
|
|
2416
|
+
GET /v1/agents/${agentId}/executions/<execution-id>`
|
|
2417
|
+
);
|
|
2418
|
+
process.exit(1);
|
|
2287
2419
|
}
|
|
2288
2420
|
async function agentsSkillCommand(agentId, opts) {
|
|
2289
2421
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2290
2422
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2291
2423
|
try {
|
|
2292
2424
|
const result = await client.addAgentSkill(agentId, {
|
|
2293
|
-
|
|
2425
|
+
name: opts.name,
|
|
2294
2426
|
description: opts.description,
|
|
2295
|
-
instructions: opts.instructions
|
|
2427
|
+
parameters: opts.instructions ? { instructions: opts.instructions } : {}
|
|
2296
2428
|
});
|
|
2297
2429
|
printSuccess(`Skill '${opts.name}' added to agent ${agentId}.`);
|
|
2298
2430
|
printJson(result);
|
|
@@ -2361,13 +2493,13 @@ ${url}`);
|
|
|
2361
2493
|
async function billingUpgradeCommand(opts) {
|
|
2362
2494
|
const client = makeClient();
|
|
2363
2495
|
try {
|
|
2364
|
-
const result = await client.createBillingCheckout(opts.
|
|
2496
|
+
const result = await client.createBillingCheckout(opts.plan);
|
|
2365
2497
|
const url = result.checkout_url;
|
|
2366
2498
|
if (!url) {
|
|
2367
2499
|
printError("No checkout URL returned.");
|
|
2368
2500
|
process.exit(1);
|
|
2369
2501
|
}
|
|
2370
|
-
console.log(`Opening Stripe Checkout for ${opts.
|
|
2502
|
+
console.log(`Opening Stripe Checkout for ${opts.plan}...
|
|
2371
2503
|
${url}`);
|
|
2372
2504
|
openUrl(url);
|
|
2373
2505
|
printSuccess("Checkout opened in your browser.");
|
|
@@ -2385,45 +2517,6 @@ var init_billing = __esm({
|
|
|
2385
2517
|
}
|
|
2386
2518
|
});
|
|
2387
2519
|
|
|
2388
|
-
// src/commands/approvals.ts
|
|
2389
|
-
var approvals_exports = {};
|
|
2390
|
-
__export(approvals_exports, {
|
|
2391
|
-
approvalsListCommand: () => approvalsListCommand,
|
|
2392
|
-
approvalsRespondCommand: () => approvalsRespondCommand
|
|
2393
|
-
});
|
|
2394
|
-
async function approvalsListCommand(opts) {
|
|
2395
|
-
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2396
|
-
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2397
|
-
try {
|
|
2398
|
-
const approvals = await client.listPendingApprovals();
|
|
2399
|
-
if (opts.json) printJson(approvals);
|
|
2400
|
-
else if (approvals.length === 0) console.log("No pending approvals.");
|
|
2401
|
-
else printApprovalsTable(approvals);
|
|
2402
|
-
} catch (err) {
|
|
2403
|
-
printError(`Failed to fetch approvals: ${err}`);
|
|
2404
|
-
process.exit(1);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
async function approvalsRespondCommand(approvalId, decision, opts) {
|
|
2408
|
-
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2409
|
-
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2410
|
-
try {
|
|
2411
|
-
await client.respondApproval(approvalId, decision, opts.message);
|
|
2412
|
-
printSuccess(`Approval ${approvalId} ${decision}d.`);
|
|
2413
|
-
} catch (err) {
|
|
2414
|
-
printError(`Failed to respond to approval: ${err}`);
|
|
2415
|
-
process.exit(1);
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
var init_approvals = __esm({
|
|
2419
|
-
"src/commands/approvals.ts"() {
|
|
2420
|
-
"use strict";
|
|
2421
|
-
init_config();
|
|
2422
|
-
init_api_client();
|
|
2423
|
-
init_output();
|
|
2424
|
-
}
|
|
2425
|
-
});
|
|
2426
|
-
|
|
2427
2520
|
// src/commands/form.ts
|
|
2428
2521
|
var form_exports = {};
|
|
2429
2522
|
__export(form_exports, {
|
|
@@ -2434,7 +2527,7 @@ __export(form_exports, {
|
|
|
2434
2527
|
});
|
|
2435
2528
|
import { input as input2, select, confirm as confirm2, number } from "@inquirer/prompts";
|
|
2436
2529
|
import chalk7 from "chalk";
|
|
2437
|
-
import
|
|
2530
|
+
import Table2 from "cli-table3";
|
|
2438
2531
|
function isCorp(entityType) {
|
|
2439
2532
|
return entityType === "c_corp" || entityType === "s_corp" || entityType === "corporation";
|
|
2440
2533
|
}
|
|
@@ -2458,13 +2551,12 @@ async function phaseEntityDetails(opts, serverCfg, scripted) {
|
|
|
2458
2551
|
if (scripted) {
|
|
2459
2552
|
entityType = "llc";
|
|
2460
2553
|
} else {
|
|
2461
|
-
const types = serverCfg.entity_types ?? ["llc", "c_corp"];
|
|
2462
2554
|
entityType = await select({
|
|
2463
2555
|
message: "Entity type",
|
|
2464
|
-
choices:
|
|
2465
|
-
value:
|
|
2466
|
-
|
|
2467
|
-
|
|
2556
|
+
choices: [
|
|
2557
|
+
{ value: "llc", name: "LLC" },
|
|
2558
|
+
{ value: "c_corp", name: "C-Corp" }
|
|
2559
|
+
]
|
|
2468
2560
|
});
|
|
2469
2561
|
}
|
|
2470
2562
|
}
|
|
@@ -2627,7 +2719,7 @@ function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElecti
|
|
|
2627
2719
|
console.log(` ${chalk7.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
|
|
2628
2720
|
console.log(` ${chalk7.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
|
|
2629
2721
|
}
|
|
2630
|
-
const table = new
|
|
2722
|
+
const table = new Table2({
|
|
2631
2723
|
head: [chalk7.dim("Name"), chalk7.dim("Email"), chalk7.dim("Role"), chalk7.dim("Equity"), chalk7.dim("Officer")]
|
|
2632
2724
|
});
|
|
2633
2725
|
for (const f of founders) {
|
|
@@ -2695,7 +2787,7 @@ async function formCommand(opts) {
|
|
|
2695
2787
|
const holders = result.holders ?? [];
|
|
2696
2788
|
if (holders.length > 0) {
|
|
2697
2789
|
console.log();
|
|
2698
|
-
const table = new
|
|
2790
|
+
const table = new Table2({
|
|
2699
2791
|
head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
|
|
2700
2792
|
});
|
|
2701
2793
|
for (const h of holders) {
|
|
@@ -2719,7 +2811,7 @@ async function formCreateCommand(opts) {
|
|
|
2719
2811
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2720
2812
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2721
2813
|
try {
|
|
2722
|
-
const entityType = opts.type === "
|
|
2814
|
+
const entityType = opts.type === "corporation" ? "c_corp" : opts.type;
|
|
2723
2815
|
const payload = {
|
|
2724
2816
|
entity_type: entityType,
|
|
2725
2817
|
legal_name: opts.name
|
|
@@ -2779,7 +2871,7 @@ async function formFinalizeCommand(entityId) {
|
|
|
2779
2871
|
const holders = result.holders ?? [];
|
|
2780
2872
|
if (holders.length > 0) {
|
|
2781
2873
|
console.log();
|
|
2782
|
-
const table = new
|
|
2874
|
+
const table = new Table2({
|
|
2783
2875
|
head: [chalk7.dim("Holder"), chalk7.dim("Shares"), chalk7.dim("Ownership %")]
|
|
2784
2876
|
});
|
|
2785
2877
|
for (const h of holders) {
|
|
@@ -2813,7 +2905,7 @@ __export(api_keys_exports, {
|
|
|
2813
2905
|
apiKeysCommand: () => apiKeysCommand
|
|
2814
2906
|
});
|
|
2815
2907
|
import chalk8 from "chalk";
|
|
2816
|
-
import
|
|
2908
|
+
import Table3 from "cli-table3";
|
|
2817
2909
|
async function apiKeysCommand(opts) {
|
|
2818
2910
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2819
2911
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -2829,7 +2921,7 @@ async function apiKeysCommand(opts) {
|
|
|
2829
2921
|
}
|
|
2830
2922
|
console.log(`
|
|
2831
2923
|
${chalk8.bold("API Keys")}`);
|
|
2832
|
-
const table = new
|
|
2924
|
+
const table = new Table3({
|
|
2833
2925
|
head: [chalk8.dim("ID"), chalk8.dim("Name"), chalk8.dim("Key"), chalk8.dim("Created"), chalk8.dim("Last Used")]
|
|
2834
2926
|
});
|
|
2835
2927
|
for (const k of keys) {
|
|
@@ -2888,6 +2980,38 @@ var serve_exports = {};
|
|
|
2888
2980
|
__export(serve_exports, {
|
|
2889
2981
|
serveCommand: () => serveCommand
|
|
2890
2982
|
});
|
|
2983
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2 } from "fs";
|
|
2984
|
+
import { resolve } from "path";
|
|
2985
|
+
import { randomBytes } from "crypto";
|
|
2986
|
+
function generateFernetKey() {
|
|
2987
|
+
return randomBytes(32).toString("base64url") + "=";
|
|
2988
|
+
}
|
|
2989
|
+
function generateSecret(length = 32) {
|
|
2990
|
+
return randomBytes(length).toString("hex");
|
|
2991
|
+
}
|
|
2992
|
+
function loadEnvFile(path) {
|
|
2993
|
+
if (!existsSync2(path)) return;
|
|
2994
|
+
const content = readFileSync2(path, "utf-8");
|
|
2995
|
+
for (const line of content.split("\n")) {
|
|
2996
|
+
const trimmed = line.trim();
|
|
2997
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
2998
|
+
const eqIdx = trimmed.indexOf("=");
|
|
2999
|
+
if (eqIdx === -1) continue;
|
|
3000
|
+
const key = trimmed.slice(0, eqIdx).trim();
|
|
3001
|
+
const value = trimmed.slice(eqIdx + 1).trim().replace(/^["']|["']$/g, "");
|
|
3002
|
+
if (!process.env[key]) {
|
|
3003
|
+
process.env[key] = value;
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
function ensureEnvFile(envPath) {
|
|
3008
|
+
if (existsSync2(envPath)) return;
|
|
3009
|
+
console.log("No .env file found. Generating one with dev defaults...\n");
|
|
3010
|
+
const content = ENV_TEMPLATE.replace("{{JWT_SECRET}}", generateSecret()).replace("{{SECRETS_MASTER_KEY}}", generateFernetKey()).replace("{{INTERNAL_WORKER_TOKEN}}", generateSecret());
|
|
3011
|
+
writeFileSync2(envPath, content, "utf-8");
|
|
3012
|
+
console.log(` Created ${envPath}
|
|
3013
|
+
`);
|
|
3014
|
+
}
|
|
2891
3015
|
async function serveCommand(opts) {
|
|
2892
3016
|
let server;
|
|
2893
3017
|
try {
|
|
@@ -2905,10 +3029,25 @@ async function serveCommand(opts) {
|
|
|
2905
3029
|
process.exit(1);
|
|
2906
3030
|
}
|
|
2907
3031
|
const port = parseInt(opts.port, 10);
|
|
2908
|
-
if (isNaN(port) || port
|
|
3032
|
+
if (isNaN(port) || port > 65535) {
|
|
2909
3033
|
console.error(`Error: Invalid port "${opts.port}"`);
|
|
2910
3034
|
process.exit(1);
|
|
2911
3035
|
}
|
|
3036
|
+
const envPath = resolve(process.cwd(), ".env");
|
|
3037
|
+
ensureEnvFile(envPath);
|
|
3038
|
+
loadEnvFile(envPath);
|
|
3039
|
+
const localUrl = `http://localhost:${port}`;
|
|
3040
|
+
const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
3041
|
+
const cfg = loadConfig2();
|
|
3042
|
+
const previousUrl = cfg.api_url;
|
|
3043
|
+
if (cfg.api_url !== localUrl) {
|
|
3044
|
+
cfg.api_url = localUrl;
|
|
3045
|
+
saveConfig2(cfg);
|
|
3046
|
+
console.log(`CLI configured to use local server: ${localUrl}`);
|
|
3047
|
+
console.log(` (previous: ${previousUrl})`);
|
|
3048
|
+
console.log(` To revert: corp config set api_url ${previousUrl}
|
|
3049
|
+
`);
|
|
3050
|
+
}
|
|
2912
3051
|
console.log(`Starting server on port ${port}...`);
|
|
2913
3052
|
console.log(`Data directory: ${opts.dataDir}`);
|
|
2914
3053
|
const child = server.startServer({
|
|
@@ -2917,6 +3056,12 @@ async function serveCommand(opts) {
|
|
|
2917
3056
|
});
|
|
2918
3057
|
const shutdown = () => {
|
|
2919
3058
|
console.log("\nShutting down server...");
|
|
3059
|
+
if (previousUrl !== localUrl) {
|
|
3060
|
+
const current = loadConfig2();
|
|
3061
|
+
current.api_url = previousUrl;
|
|
3062
|
+
saveConfig2(current);
|
|
3063
|
+
console.log(`CLI restored to: ${previousUrl}`);
|
|
3064
|
+
}
|
|
2920
3065
|
child.kill("SIGTERM");
|
|
2921
3066
|
};
|
|
2922
3067
|
process.on("SIGINT", shutdown);
|
|
@@ -2925,9 +3070,40 @@ async function serveCommand(opts) {
|
|
|
2925
3070
|
process.exit(code ?? 0);
|
|
2926
3071
|
});
|
|
2927
3072
|
}
|
|
3073
|
+
var ENV_TEMPLATE;
|
|
2928
3074
|
var init_serve = __esm({
|
|
2929
3075
|
"src/commands/serve.ts"() {
|
|
2930
3076
|
"use strict";
|
|
3077
|
+
ENV_TEMPLATE = `# Corporation API server configuration
|
|
3078
|
+
# Generated by: corp serve
|
|
3079
|
+
|
|
3080
|
+
# Required \u2014 secret for signing JWTs
|
|
3081
|
+
JWT_SECRET={{JWT_SECRET}}
|
|
3082
|
+
|
|
3083
|
+
# Required \u2014 Fernet key for encrypting secrets at rest (base64url, 32 bytes)
|
|
3084
|
+
SECRETS_MASTER_KEY={{SECRETS_MASTER_KEY}}
|
|
3085
|
+
|
|
3086
|
+
# Required \u2014 bearer token for internal worker-to-server auth
|
|
3087
|
+
INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
|
|
3088
|
+
|
|
3089
|
+
# Server port (default: 8000)
|
|
3090
|
+
# PORT=8000
|
|
3091
|
+
|
|
3092
|
+
# Data directory for git repos (default: ./data/repos)
|
|
3093
|
+
# DATA_DIR=./data/repos
|
|
3094
|
+
|
|
3095
|
+
# Redis URL for agent job queue (optional)
|
|
3096
|
+
# REDIS_URL=redis://localhost:6379/0
|
|
3097
|
+
|
|
3098
|
+
# LLM proxy upstream (default: https://openrouter.ai/api/v1)
|
|
3099
|
+
# LLM_UPSTREAM_URL=https://openrouter.ai/api/v1
|
|
3100
|
+
|
|
3101
|
+
# PEM-encoded Ed25519 key for signing git commits (optional)
|
|
3102
|
+
# COMMIT_SIGNING_KEY=
|
|
3103
|
+
|
|
3104
|
+
# Max agent queue depth (default: 1000)
|
|
3105
|
+
# MAX_QUEUE_DEPTH=1000
|
|
3106
|
+
`;
|
|
2931
3107
|
}
|
|
2932
3108
|
});
|
|
2933
3109
|
|
|
@@ -2948,15 +3124,15 @@ program.command("status").description("Workspace summary").action(async () => {
|
|
|
2948
3124
|
});
|
|
2949
3125
|
var configCmd = program.command("config").description("Manage configuration");
|
|
2950
3126
|
configCmd.command("set <key> <value>").description("Set a config value (dot-path)").action(async (key, value) => {
|
|
2951
|
-
const { configSetCommand: configSetCommand2 } = await Promise.resolve().then(() => (init_config2(),
|
|
3127
|
+
const { configSetCommand: configSetCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
|
|
2952
3128
|
configSetCommand2(key, value);
|
|
2953
3129
|
});
|
|
2954
3130
|
configCmd.command("get <key>").description("Get a config value (dot-path)").action(async (key) => {
|
|
2955
|
-
const { configGetCommand: configGetCommand2 } = await Promise.resolve().then(() => (init_config2(),
|
|
3131
|
+
const { configGetCommand: configGetCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
|
|
2956
3132
|
configGetCommand2(key);
|
|
2957
3133
|
});
|
|
2958
3134
|
configCmd.command("list").description("List all config (API keys masked)").action(async () => {
|
|
2959
|
-
const { configListCommand: configListCommand2 } = await Promise.resolve().then(() => (init_config2(),
|
|
3135
|
+
const { configListCommand: configListCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
|
|
2960
3136
|
configListCommand2();
|
|
2961
3137
|
});
|
|
2962
3138
|
program.command("obligations").description("List obligations with urgency tiers").option("--tier <tier>", "Filter by urgency tier").option("--json", "Output as JSON").action(async (opts) => {
|
|
@@ -2967,9 +3143,9 @@ program.command("digest").description("View or trigger daily digests").option("-
|
|
|
2967
3143
|
const { digestCommand: digestCommand2 } = await Promise.resolve().then(() => (init_digest(), digest_exports));
|
|
2968
3144
|
await digestCommand2(opts);
|
|
2969
3145
|
});
|
|
2970
|
-
program.command("link").description("
|
|
3146
|
+
program.command("link").description("Link workspace to an external provider").requiredOption("--external-id <id>", "External ID to link").requiredOption("--provider <provider>", "Provider name (e.g. stripe, github)").action(async (opts) => {
|
|
2971
3147
|
const { linkCommand: linkCommand2 } = await Promise.resolve().then(() => (init_link(), link_exports));
|
|
2972
|
-
await linkCommand2();
|
|
3148
|
+
await linkCommand2(opts);
|
|
2973
3149
|
});
|
|
2974
3150
|
program.command("claim <code>").description("Redeem a claim code to join a workspace").action(async (code) => {
|
|
2975
3151
|
const { claimCommand: claimCommand2 } = await Promise.resolve().then(() => (init_claim(), claim_exports));
|
|
@@ -2987,7 +3163,7 @@ entitiesCmd.command("show <entity-id>").option("--json", "Output as JSON").descr
|
|
|
2987
3163
|
const { entitiesShowCommand: entitiesShowCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
2988
3164
|
await entitiesShowCommand2(entityId, opts);
|
|
2989
3165
|
});
|
|
2990
|
-
entitiesCmd.command("convert <entity-id>").requiredOption("--to <type>", "Target entity type (llc,
|
|
3166
|
+
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) => {
|
|
2991
3167
|
const { entitiesConvertCommand: entitiesConvertCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
2992
3168
|
await entitiesConvertCommand2(entityId, opts);
|
|
2993
3169
|
});
|
|
@@ -2995,23 +3171,26 @@ entitiesCmd.command("dissolve <entity-id>").requiredOption("--reason <reason>",
|
|
|
2995
3171
|
const { entitiesDissolveCommand: entitiesDissolveCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
2996
3172
|
await entitiesDissolveCommand2(entityId, opts);
|
|
2997
3173
|
});
|
|
2998
|
-
var contactsCmd = program.command("contacts").description("Contact management").option("--json", "Output as JSON").action(async (opts) => {
|
|
3174
|
+
var contactsCmd = program.command("contacts").description("Contact management").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
|
|
2999
3175
|
const { contactsListCommand: contactsListCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3000
3176
|
await contactsListCommand2(opts);
|
|
3001
3177
|
});
|
|
3002
|
-
contactsCmd.command("show <contact-id>").option("--json", "Output as JSON").description("Show contact detail/profile").action(async (contactId, opts) => {
|
|
3178
|
+
contactsCmd.command("show <contact-id>").option("--json", "Output as JSON").description("Show contact detail/profile").action(async (contactId, opts, cmd) => {
|
|
3179
|
+
const parent = cmd.parent.opts();
|
|
3003
3180
|
const { contactsShowCommand: contactsShowCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3004
|
-
await contactsShowCommand2(contactId, opts);
|
|
3181
|
+
await contactsShowCommand2(contactId, { ...opts, entityId: parent.entityId });
|
|
3005
3182
|
});
|
|
3006
|
-
contactsCmd.command("add").requiredOption("--name <name>", "Contact name").requiredOption("--email <email>", "Contact email").option("--
|
|
3183
|
+
contactsCmd.command("add").requiredOption("--name <name>", "Contact name").requiredOption("--email <email>", "Contact email").option("--type <type>", "Contact type (individual, organization)", "individual").option("--category <category>", "Category (employee, contractor, board_member, investor, law_firm, valuation_firm, accounting_firm, officer, advisor)").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").description("Add a new contact").action(async (opts, cmd) => {
|
|
3184
|
+
const parent = cmd.parent.opts();
|
|
3007
3185
|
const { contactsAddCommand: contactsAddCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3008
|
-
await contactsAddCommand2(opts);
|
|
3186
|
+
await contactsAddCommand2({ ...opts, entityId: parent.entityId });
|
|
3009
3187
|
});
|
|
3010
|
-
contactsCmd.command("edit <contact-id>").option("--name <name>", "Contact name").option("--email <email>", "Contact email").option("--category <category>", "Contact category").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").description("Edit an existing contact").action(async (contactId, opts) => {
|
|
3188
|
+
contactsCmd.command("edit <contact-id>").option("--name <name>", "Contact name").option("--email <email>", "Contact email").option("--category <category>", "Contact category").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").description("Edit an existing contact").action(async (contactId, opts, cmd) => {
|
|
3189
|
+
const parent = cmd.parent.opts();
|
|
3011
3190
|
const { contactsEditCommand: contactsEditCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3012
|
-
await contactsEditCommand2(contactId, opts);
|
|
3191
|
+
await contactsEditCommand2(contactId, { ...opts, entityId: parent.entityId });
|
|
3013
3192
|
});
|
|
3014
|
-
var capTableCmd = program.command("cap-table").description("Cap table, SAFEs, transfers, valuations").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
|
|
3193
|
+
var capTableCmd = program.command("cap-table").description("Cap table, equity grants, SAFEs, transfers, and valuations").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
|
|
3015
3194
|
const { capTableCommand: capTableCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3016
3195
|
await capTableCommand2(opts);
|
|
3017
3196
|
});
|
|
@@ -3035,7 +3214,7 @@ capTableCmd.command("409a").description("Current 409A valuation").action(async (
|
|
|
3035
3214
|
const { fourOhNineACommand: fourOhNineACommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3036
3215
|
await fourOhNineACommand2(parent);
|
|
3037
3216
|
});
|
|
3038
|
-
capTableCmd.command("issue-equity").requiredOption("--grant-type <type>", "Grant type").requiredOption("--shares <n>", "Number of shares", parseInt).requiredOption("--recipient <name>", "Recipient name").description("Issue an equity grant").action(async (opts, cmd) => {
|
|
3217
|
+
capTableCmd.command("issue-equity").requiredOption("--grant-type <type>", "Grant type (e.g. founder, advisor, employee, investor)").requiredOption("--shares <n>", "Number of shares", parseInt).requiredOption("--recipient <name>", "Recipient name").option("--email <email>", "Recipient email (auto-creates contact if needed)").option("--instrument-id <id>", "Instrument ID (auto-detected from cap table if omitted)").description("Issue an equity grant (creates a round, adds security, and issues it)").action(async (opts, cmd) => {
|
|
3039
3218
|
const parent = cmd.parent.opts();
|
|
3040
3219
|
const { issueEquityCommand: issueEquityCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3041
3220
|
await issueEquityCommand2({ ...opts, entityId: parent.entityId });
|
|
@@ -3045,12 +3224,12 @@ capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor
|
|
|
3045
3224
|
const { issueSafeCommand: issueSafeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3046
3225
|
await issueSafeCommand2({ ...opts, entityId: parent.entityId });
|
|
3047
3226
|
});
|
|
3048
|
-
capTableCmd.command("transfer").requiredOption("--from
|
|
3227
|
+
capTableCmd.command("transfer").requiredOption("--from <id>", "Source contact ID (from_contact_id)").requiredOption("--to <id>", "Destination contact ID (to_contact_id)").requiredOption("--shares <n>", "Number of shares to transfer", parseInt).requiredOption("--share-class-id <id>", "Share class ID").requiredOption("--governing-doc-type <type>", "Governing document type").requiredOption("--transferee-rights <rights>", "Transferee rights").requiredOption("--prepare-intent-id <id>", "Prepare intent ID").option("--type <type>", "Transfer type", "sale").option("--price-per-share-cents <n>", "Price per share in cents", parseInt).option("--relationship <rel>", "Relationship to holder").description("Create a share transfer workflow").action(async (opts, cmd) => {
|
|
3049
3228
|
const parent = cmd.parent.opts();
|
|
3050
3229
|
const { transferSharesCommand: transferSharesCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3051
3230
|
await transferSharesCommand2({ ...opts, entityId: parent.entityId });
|
|
3052
3231
|
});
|
|
3053
|
-
capTableCmd.command("distribute").requiredOption("--amount <n>", "Total distribution amount in cents", parseInt).option("--type <type>", "Distribution type", "
|
|
3232
|
+
capTableCmd.command("distribute").requiredOption("--amount <n>", "Total distribution amount in cents", parseInt).option("--type <type>", "Distribution type (dividend, return, liquidation)", "dividend").requiredOption("--description <desc>", "Distribution description").description("Calculate a distribution").action(async (opts, cmd) => {
|
|
3054
3233
|
const parent = cmd.parent.opts();
|
|
3055
3234
|
const { distributeCommand: distributeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3056
3235
|
await distributeCommand2({ ...opts, entityId: parent.entityId });
|
|
@@ -3120,6 +3299,15 @@ var governanceCmd = program.command("governance").description("Governance bodies
|
|
|
3120
3299
|
const { governanceListCommand: governanceListCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3121
3300
|
await governanceListCommand2(opts);
|
|
3122
3301
|
});
|
|
3302
|
+
governanceCmd.command("create-body").requiredOption("--name <name>", "Body name (e.g. 'Board of Directors')").requiredOption("--body-type <type>", "Body type (board_of_directors, llc_member_vote)").option("--quorum <rule>", "Quorum rule (majority, supermajority, unanimous)", "majority").option("--voting <method>", "Voting method (per_capita, per_unit)", "per_capita").description("Create a governance body").action(async (opts, cmd) => {
|
|
3303
|
+
const parent = cmd.parent.opts();
|
|
3304
|
+
const { governanceCreateBodyCommand: governanceCreateBodyCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3305
|
+
await governanceCreateBodyCommand2({ ...opts, entityId: parent.entityId });
|
|
3306
|
+
});
|
|
3307
|
+
governanceCmd.command("add-seat <body-id>").requiredOption("--holder <contact-id>", "Contact ID for the seat holder").option("--title <title>", "Seat title (e.g. 'Director', 'Member')").description("Add a seat to a governance body").action(async (bodyId, opts) => {
|
|
3308
|
+
const { governanceAddSeatCommand: governanceAddSeatCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3309
|
+
await governanceAddSeatCommand2(bodyId, opts);
|
|
3310
|
+
});
|
|
3123
3311
|
governanceCmd.command("seats <body-id>").description("Seats for a governance body").action(async (bodyId, _opts, cmd) => {
|
|
3124
3312
|
const parent = cmd.parent.opts();
|
|
3125
3313
|
const { governanceSeatsCommand: governanceSeatsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
@@ -3140,7 +3328,7 @@ governanceCmd.command("convene").requiredOption("--body <id>", "Governance body
|
|
|
3140
3328
|
const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3141
3329
|
await governanceConveneCommand2({ ...opts, meetingType: opts.type, entityId: parent.entityId });
|
|
3142
3330
|
});
|
|
3143
|
-
governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <
|
|
3331
|
+
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) => {
|
|
3144
3332
|
const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3145
3333
|
await governanceVoteCommand2(meetingId, itemId, opts);
|
|
3146
3334
|
});
|
|
@@ -3164,7 +3352,7 @@ governanceCmd.command("agenda-items <meeting-id>").description("List agenda item
|
|
|
3164
3352
|
const { listAgendaItemsCommand: listAgendaItemsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3165
3353
|
await listAgendaItemsCommand2(meetingId, { entityId: parent.entityId, json: parent.json });
|
|
3166
3354
|
});
|
|
3167
|
-
governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status:
|
|
3355
|
+
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) => {
|
|
3168
3356
|
const parent = cmd.parent.opts();
|
|
3169
3357
|
const { finalizeAgendaItemCommand: finalizeAgendaItemCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3170
3358
|
await finalizeAgendaItemCommand2(meetingId, itemId, { ...opts, entityId: parent.entityId });
|
|
@@ -3183,11 +3371,12 @@ var documentsCmd = program.command("documents").description("Documents and signi
|
|
|
3183
3371
|
const { documentsListCommand: documentsListCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3184
3372
|
await documentsListCommand2(opts);
|
|
3185
3373
|
});
|
|
3186
|
-
documentsCmd.command("signing-link <doc-id>").description("Get a signing link for a document").action(async (docId) => {
|
|
3374
|
+
documentsCmd.command("signing-link <doc-id>").description("Get a signing link for a document").action(async (docId, _opts, cmd) => {
|
|
3375
|
+
const parent = cmd.parent.opts();
|
|
3187
3376
|
const { documentsSigningLinkCommand: documentsSigningLinkCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3188
|
-
await documentsSigningLinkCommand2(docId);
|
|
3377
|
+
await documentsSigningLinkCommand2(docId, { entityId: parent.entityId });
|
|
3189
3378
|
});
|
|
3190
|
-
documentsCmd.command("generate").requiredOption("--template <type>", "Template type").requiredOption("--counterparty <name>", "Counterparty name").option("--effective-date <date>", "Effective date (ISO 8601)").description("Generate a contract from a template").action(async (opts, cmd) => {
|
|
3379
|
+
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) => {
|
|
3191
3380
|
const parent = cmd.parent.opts();
|
|
3192
3381
|
const { documentsGenerateCommand: documentsGenerateCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3193
3382
|
await documentsGenerateCommand2({ ...opts, entityId: parent.entityId });
|
|
@@ -3252,23 +3441,19 @@ billingCmd.command("portal").description("Open Stripe Customer Portal").action(a
|
|
|
3252
3441
|
const { billingPortalCommand: billingPortalCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
|
|
3253
3442
|
await billingPortalCommand2();
|
|
3254
3443
|
});
|
|
3255
|
-
billingCmd.command("upgrade").option("--
|
|
3444
|
+
billingCmd.command("upgrade").option("--plan <plan>", "Plan ID to upgrade to (free, pro, enterprise)", "pro").description("Open Stripe Checkout to upgrade your plan").action(async (opts) => {
|
|
3256
3445
|
const { billingUpgradeCommand: billingUpgradeCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
|
|
3257
3446
|
await billingUpgradeCommand2(opts);
|
|
3258
3447
|
});
|
|
3259
|
-
|
|
3260
|
-
const {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
const { approvalsRespondCommand: approvalsRespondCommand2 } = await Promise.resolve().then(() => (init_approvals(), approvals_exports));
|
|
3265
|
-
await approvalsRespondCommand2(approvalId, "approve", opts);
|
|
3266
|
-
});
|
|
3267
|
-
approvalsCmd.command("reject <approval-id>").option("--message <msg>", "Optional message").description("Reject a pending approval").action(async (approvalId, opts) => {
|
|
3268
|
-
const { approvalsRespondCommand: approvalsRespondCommand2 } = await Promise.resolve().then(() => (init_approvals(), approvals_exports));
|
|
3269
|
-
await approvalsRespondCommand2(approvalId, "reject", opts);
|
|
3448
|
+
program.command("approvals").description("Approvals are managed through governance meetings and execution intents").action(async () => {
|
|
3449
|
+
const { printError: printError2 } = await Promise.resolve().then(() => (init_output(), output_exports));
|
|
3450
|
+
printError2(
|
|
3451
|
+
"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"
|
|
3452
|
+
);
|
|
3270
3453
|
});
|
|
3271
|
-
var formCmd = program.command("form").description("Form a new entity with founders and cap table (Cooley-style)").option("--type <type>", "Entity type (llc, c_corp)").option("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--member <member>", "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) => {
|
|
3454
|
+
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) => {
|
|
3455
|
+
if (opts.entityType && !opts.type) opts.type = opts.entityType;
|
|
3456
|
+
if (opts.legalName && !opts.name) opts.name = opts.legalName;
|
|
3272
3457
|
const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3273
3458
|
await formCommand2(opts);
|
|
3274
3459
|
});
|