@thecorporation/cli 26.3.46 → 26.3.47
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 +494 -614
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9,174 +9,6 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
// src/animation.ts
|
|
13
|
-
function renderFrame(frame) {
|
|
14
|
-
const cols = [];
|
|
15
|
-
for (let i = 0; i < BUILDINGS.length; i++) {
|
|
16
|
-
const building = BUILDINGS[i];
|
|
17
|
-
const h = building.length;
|
|
18
|
-
const visible = Math.max(0, Math.min(h, frame - i));
|
|
19
|
-
const width = building[0]?.length ?? 6;
|
|
20
|
-
const blank = " ".repeat(width);
|
|
21
|
-
const col = Array(MAX_HEIGHT - visible).fill(blank);
|
|
22
|
-
col.push(...building.slice(h - visible));
|
|
23
|
-
cols.push(col);
|
|
24
|
-
}
|
|
25
|
-
const lines = [];
|
|
26
|
-
for (let row = 0; row < MAX_HEIGHT; row++) {
|
|
27
|
-
lines.push(cols.map((col) => col[row]).join(""));
|
|
28
|
-
}
|
|
29
|
-
return lines.join("\n");
|
|
30
|
-
}
|
|
31
|
-
async function withAnimation(fn) {
|
|
32
|
-
if (!process.stdout.isTTY) {
|
|
33
|
-
return fn();
|
|
34
|
-
}
|
|
35
|
-
let frame = 0;
|
|
36
|
-
let animDone = false;
|
|
37
|
-
const spinChars = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
38
|
-
let spinIdx = 0;
|
|
39
|
-
let lastLineCount = 0;
|
|
40
|
-
const clearPrev = () => {
|
|
41
|
-
if (lastLineCount > 0) {
|
|
42
|
-
process.stdout.write(`\x1B[${lastLineCount}A\x1B[0J`);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const drawFrame = () => {
|
|
46
|
-
clearPrev();
|
|
47
|
-
if (!animDone) {
|
|
48
|
-
const art = renderFrame(frame);
|
|
49
|
-
const output = `${GOLD}${art}${RESET}
|
|
50
|
-
`;
|
|
51
|
-
process.stdout.write(output);
|
|
52
|
-
lastLineCount = MAX_HEIGHT + 1;
|
|
53
|
-
frame++;
|
|
54
|
-
if (frame >= TOTAL_FRAMES) {
|
|
55
|
-
animDone = true;
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
const line = `${GOLD}${spinChars[spinIdx % spinChars.length]} Loading...${RESET}
|
|
59
|
-
`;
|
|
60
|
-
process.stdout.write(line);
|
|
61
|
-
lastLineCount = 1;
|
|
62
|
-
spinIdx++;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
drawFrame();
|
|
66
|
-
const timer = setInterval(drawFrame, 100);
|
|
67
|
-
try {
|
|
68
|
-
const result = await fn();
|
|
69
|
-
return result;
|
|
70
|
-
} finally {
|
|
71
|
-
clearInterval(timer);
|
|
72
|
-
clearPrev();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
var BUILDINGS, MAX_HEIGHT, TOTAL_FRAMES, GOLD, RESET;
|
|
76
|
-
var init_animation = __esm({
|
|
77
|
-
"src/animation.ts"() {
|
|
78
|
-
"use strict";
|
|
79
|
-
BUILDINGS = [
|
|
80
|
-
[
|
|
81
|
-
" \u250C\u2510 ",
|
|
82
|
-
" \u2502\u2502 ",
|
|
83
|
-
" \u2502\u2502 ",
|
|
84
|
-
" \u250C\u2524\u251C\u2510 ",
|
|
85
|
-
" \u2502\u2502\u2502\u2502\u2502",
|
|
86
|
-
" \u2502\u2502\u2502\u2502\u2502"
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
" \u2554\u2550\u2550\u2557 ",
|
|
90
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
91
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
92
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
93
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
94
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
95
|
-
" \u2551\u25AA\u25AA\u2551 ",
|
|
96
|
-
" \u2551\u25AA\u25AA\u2551 "
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
" /\\ ",
|
|
100
|
-
" / \\ ",
|
|
101
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
102
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
103
|
-
" \u2502\u25AA\u25AA\u2502 "
|
|
104
|
-
],
|
|
105
|
-
[
|
|
106
|
-
" \u250C\u2500\u2500\u2510 ",
|
|
107
|
-
" \u2502\u224B\u224B\u2502 ",
|
|
108
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
109
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
110
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
111
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
112
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
113
|
-
" \u2502\u25AA\u25AA\u2502 ",
|
|
114
|
-
" \u2502\u25AA\u25AA\u2502 "
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
" \u257B ",
|
|
118
|
-
" \u2503 ",
|
|
119
|
-
" \u250C\u2524\u2510 ",
|
|
120
|
-
" \u2502\u25AA\u2502 ",
|
|
121
|
-
" \u2502\u25AA\u2502 ",
|
|
122
|
-
" \u2502\u25AA\u2502 ",
|
|
123
|
-
" \u2502\u25AA\u2502 ",
|
|
124
|
-
" \u2502\u25AA\u2502 ",
|
|
125
|
-
" \u2502\u25AA\u2502 ",
|
|
126
|
-
" \u2502\u25AA\u2502 ",
|
|
127
|
-
" \u2502\u25AA\u2502 "
|
|
128
|
-
],
|
|
129
|
-
[
|
|
130
|
-
" \u250C\u2510 ",
|
|
131
|
-
" \u251C\u2524 ",
|
|
132
|
-
" \u2502\u25AA\u2502 ",
|
|
133
|
-
" \u2502\u25AA\u2502 ",
|
|
134
|
-
" \u2502\u25AA\u2502 ",
|
|
135
|
-
" \u2502\u25AA\u2502 "
|
|
136
|
-
],
|
|
137
|
-
[
|
|
138
|
-
" \u2554\u2550\u2550\u2550\u2557",
|
|
139
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
140
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
141
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
142
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
143
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
144
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
145
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
146
|
-
" \u2551\u25AA \u25AA\u2551",
|
|
147
|
-
" \u2551\u25AA \u25AA\u2551"
|
|
148
|
-
],
|
|
149
|
-
[
|
|
150
|
-
" \u252C\u2500\u252C ",
|
|
151
|
-
" \u2502~\u2502 ",
|
|
152
|
-
" \u2502\u25AA\u2502 ",
|
|
153
|
-
" \u2502\u25AA\u2502 ",
|
|
154
|
-
" \u2502\u25AA\u2502 ",
|
|
155
|
-
" \u2502\u25AA\u2502 ",
|
|
156
|
-
" \u2502\u25AA\u2502 "
|
|
157
|
-
]
|
|
158
|
-
];
|
|
159
|
-
MAX_HEIGHT = Math.max(...BUILDINGS.map((b) => b.length));
|
|
160
|
-
TOTAL_FRAMES = MAX_HEIGHT + 4;
|
|
161
|
-
GOLD = "\x1B[38;2;212;160;23m";
|
|
162
|
-
RESET = "\x1B[0m";
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// src/spinner.ts
|
|
167
|
-
async function withSpinner(_label, fn, json) {
|
|
168
|
-
if (json) {
|
|
169
|
-
return fn();
|
|
170
|
-
}
|
|
171
|
-
return withAnimation(fn);
|
|
172
|
-
}
|
|
173
|
-
var init_spinner = __esm({
|
|
174
|
-
"src/spinner.ts"() {
|
|
175
|
-
"use strict";
|
|
176
|
-
init_animation();
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
12
|
// src/config.ts
|
|
181
13
|
import {
|
|
182
14
|
chmodSync,
|
|
@@ -717,7 +549,7 @@ var init_config = __esm({
|
|
|
717
549
|
|
|
718
550
|
// src/references.ts
|
|
719
551
|
import {
|
|
720
|
-
shortId
|
|
552
|
+
shortId,
|
|
721
553
|
slugify,
|
|
722
554
|
describeReferenceRecord,
|
|
723
555
|
getReferenceId,
|
|
@@ -727,7 +559,7 @@ import {
|
|
|
727
559
|
} from "@thecorporation/corp-tools";
|
|
728
560
|
import {
|
|
729
561
|
ReferenceTracker,
|
|
730
|
-
shortId as
|
|
562
|
+
shortId as shortId2,
|
|
731
563
|
normalize,
|
|
732
564
|
validateReferenceInput,
|
|
733
565
|
describeReferenceRecord as describeReferenceRecord2,
|
|
@@ -1010,7 +842,7 @@ var init_references = __esm({
|
|
|
1010
842
|
);
|
|
1011
843
|
}
|
|
1012
844
|
ambiguousMessage(kind, ref, matches) {
|
|
1013
|
-
const previews = matches.slice(0, 5).map((match) => `${match.label} [${
|
|
845
|
+
const previews = matches.slice(0, 5).map((match) => `${match.label} [${shortId2(match.id)}]`).join(", ");
|
|
1014
846
|
return `Ambiguous ${kindLabel(kind)} reference "${ref}". Matches: ${previews}. Try: corp find ${kind} ${JSON.stringify(ref)}`;
|
|
1015
847
|
}
|
|
1016
848
|
async listRecords(kind, scope) {
|
|
@@ -1391,13 +1223,13 @@ function formatReferenceCell(kind, record) {
|
|
|
1391
1223
|
const id = getReferenceId(kind, record);
|
|
1392
1224
|
if (!id) return "";
|
|
1393
1225
|
const alias = getReferenceAlias(kind, record);
|
|
1394
|
-
return alias ? `${alias} [${
|
|
1226
|
+
return alias ? `${alias} [${shortId(id)}]` : shortId(id);
|
|
1395
1227
|
}
|
|
1396
1228
|
function printReferenceSummary(kind, record, opts = {}) {
|
|
1397
1229
|
const id = getReferenceId(kind, record);
|
|
1398
1230
|
if (!id) return;
|
|
1399
1231
|
const alias = getReferenceAlias(kind, record);
|
|
1400
|
-
const token = alias ? `${alias} [${
|
|
1232
|
+
const token = alias ? `${alias} [${shortId(id)}]` : shortId(id);
|
|
1401
1233
|
console.log(` ${chalk.bold(opts.label ?? "Ref:")} ${token}`);
|
|
1402
1234
|
console.log(` ${chalk.bold("ID:")} ${id}`);
|
|
1403
1235
|
if (opts.showReuseHint) {
|
|
@@ -1485,17 +1317,17 @@ function printFinanceSummaryPanel(data) {
|
|
|
1485
1317
|
console.log(chalk.green("\u2500".repeat(54)));
|
|
1486
1318
|
console.log(chalk.green.bold(" Finance Summary"));
|
|
1487
1319
|
console.log(chalk.green("\u2500".repeat(54)));
|
|
1488
|
-
console.log(` ${chalk.bold("Entity:")} ${
|
|
1489
|
-
console.log(` ${chalk.bold("Invoices:")} ${
|
|
1320
|
+
console.log(` ${chalk.bold("Entity:")} ${s(data.entity_id) || "N/A"}`);
|
|
1321
|
+
console.log(` ${chalk.bold("Invoices:")} ${s(invoices.count)} total, ${s(invoices.open_count)} open, ${money(invoices.total_amount_cents)}`);
|
|
1490
1322
|
if (invoices.latest_due_date) {
|
|
1491
1323
|
console.log(` ${chalk.bold("Invoice Horizon:")} next due ${date(invoices.latest_due_date)}`);
|
|
1492
1324
|
}
|
|
1493
|
-
console.log(` ${chalk.bold("Bank Accounts:")} ${
|
|
1494
|
-
console.log(` ${chalk.bold("Payments:")} ${
|
|
1495
|
-
console.log(` ${chalk.bold("Payroll Runs:")} ${
|
|
1496
|
-
console.log(` ${chalk.bold("Distributions:")} ${
|
|
1497
|
-
console.log(` ${chalk.bold("Reconciliations:")} ${
|
|
1498
|
-
console.log(` ${chalk.bold("Contractors:")} ${
|
|
1325
|
+
console.log(` ${chalk.bold("Bank Accounts:")} ${s(bankAccounts.active_count)}/${s(bankAccounts.count)} active`);
|
|
1326
|
+
console.log(` ${chalk.bold("Payments:")} ${s(payments.count)} total, ${s(payments.pending_count)} pending, ${money(payments.total_amount_cents)}`);
|
|
1327
|
+
console.log(` ${chalk.bold("Payroll Runs:")} ${s(payrollRuns.count)} total${payrollRuns.latest_period_end ? `, latest ${date(payrollRuns.latest_period_end)}` : ""}`);
|
|
1328
|
+
console.log(` ${chalk.bold("Distributions:")} ${s(distributions.count)} total, ${money(distributions.total_amount_cents)}`);
|
|
1329
|
+
console.log(` ${chalk.bold("Reconciliations:")} ${s(reconciliations.balanced_count)}/${s(reconciliations.count)} balanced`);
|
|
1330
|
+
console.log(` ${chalk.bold("Contractors:")} ${s(classifications.count)} classifications, ${s(classifications.high_risk_count)} high risk`);
|
|
1499
1331
|
console.log(chalk.green("\u2500".repeat(54)));
|
|
1500
1332
|
}
|
|
1501
1333
|
function printNextSteps(data) {
|
|
@@ -1550,12 +1382,12 @@ function makeTable(title, columns) {
|
|
|
1550
1382
|
${chalk.bold(title)}`);
|
|
1551
1383
|
return new Table({ head: columns.map((c) => chalk.dim(c)) });
|
|
1552
1384
|
}
|
|
1553
|
-
function
|
|
1385
|
+
function s(val, maxLen) {
|
|
1554
1386
|
const str = val == null ? "" : String(val);
|
|
1555
1387
|
if (maxLen && str.length > maxLen) return str.slice(0, maxLen);
|
|
1556
1388
|
return str;
|
|
1557
1389
|
}
|
|
1558
|
-
function
|
|
1390
|
+
function money(val, cents = true) {
|
|
1559
1391
|
if (typeof val === "number") {
|
|
1560
1392
|
const dollars = cents ? val / 100 : val;
|
|
1561
1393
|
return `$${dollars.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
@@ -1563,7 +1395,7 @@ function money2(val, cents = true) {
|
|
|
1563
1395
|
return String(val ?? "");
|
|
1564
1396
|
}
|
|
1565
1397
|
function date(val) {
|
|
1566
|
-
const str =
|
|
1398
|
+
const str = s(val);
|
|
1567
1399
|
if (!str) return "";
|
|
1568
1400
|
const parsed = new Date(str);
|
|
1569
1401
|
return Number.isNaN(parsed.getTime()) ? str : parsed.toISOString().slice(0, 10);
|
|
@@ -1571,23 +1403,23 @@ function date(val) {
|
|
|
1571
1403
|
function actorLabel(record, field) {
|
|
1572
1404
|
const actor = record[`${field}_actor`];
|
|
1573
1405
|
if (actor && typeof actor === "object" && !Array.isArray(actor)) {
|
|
1574
|
-
const label =
|
|
1575
|
-
const actorType =
|
|
1406
|
+
const label = s(actor.label);
|
|
1407
|
+
const actorType = s(actor.actor_type);
|
|
1576
1408
|
if (label) {
|
|
1577
1409
|
return actorType ? `${label} (${actorType})` : label;
|
|
1578
1410
|
}
|
|
1579
1411
|
}
|
|
1580
|
-
return
|
|
1412
|
+
return s(record[field]);
|
|
1581
1413
|
}
|
|
1582
1414
|
function printEntitiesTable(entities) {
|
|
1583
1415
|
const table = makeTable("Entities", ["Ref", "Name", "Type", "Jurisdiction", "Status"]);
|
|
1584
1416
|
for (const e of entities) {
|
|
1585
1417
|
table.push([
|
|
1586
1418
|
formatReferenceCell("entity", e),
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1419
|
+
s(e.legal_name ?? e.name),
|
|
1420
|
+
s(e.entity_type),
|
|
1421
|
+
s(e.jurisdiction),
|
|
1422
|
+
s(e.formation_status ?? e.status)
|
|
1591
1423
|
]);
|
|
1592
1424
|
}
|
|
1593
1425
|
console.log(table.toString());
|
|
@@ -1595,9 +1427,9 @@ function printEntitiesTable(entities) {
|
|
|
1595
1427
|
function printObligationsTable(obligations) {
|
|
1596
1428
|
const table = makeTable("Obligations", ["ID", "Type", "Urgency", "Due", "Status"]);
|
|
1597
1429
|
for (const o of obligations) {
|
|
1598
|
-
const urg =
|
|
1430
|
+
const urg = s(o.urgency) || "upcoming";
|
|
1599
1431
|
const colorFn = URGENCY_COLORS[urg] ?? ((x) => x);
|
|
1600
|
-
table.push([
|
|
1432
|
+
table.push([s(o.obligation_id, 12), s(o.obligation_type), colorFn(urg), s(o.due_at), s(o.status)]);
|
|
1601
1433
|
}
|
|
1602
1434
|
console.log(table.toString());
|
|
1603
1435
|
}
|
|
@@ -1606,27 +1438,27 @@ function printContactsTable(contacts) {
|
|
|
1606
1438
|
for (const c of contacts) {
|
|
1607
1439
|
table.push([
|
|
1608
1440
|
formatReferenceCell("contact", c),
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1441
|
+
s(c.name),
|
|
1442
|
+
s(c.email),
|
|
1443
|
+
s(c.category),
|
|
1444
|
+
s(c.entity_name ?? c.entity_id)
|
|
1613
1445
|
]);
|
|
1614
1446
|
}
|
|
1615
1447
|
console.log(table.toString());
|
|
1616
1448
|
}
|
|
1617
1449
|
function printCapTable(data) {
|
|
1618
|
-
const accessLevel =
|
|
1450
|
+
const accessLevel = s(data.access_level) || "admin";
|
|
1619
1451
|
const instruments = data.instruments ?? [];
|
|
1620
1452
|
if (instruments.length > 0) {
|
|
1621
1453
|
const table = makeTable("Cap Table \u2014 Instruments", ["Ref", "Symbol", "Kind", "Authorized", "Issued", "Diluted"]);
|
|
1622
1454
|
for (const instrument of instruments) {
|
|
1623
1455
|
table.push([
|
|
1624
1456
|
formatReferenceCell("instrument", instrument),
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1457
|
+
s(instrument.symbol),
|
|
1458
|
+
s(instrument.kind),
|
|
1459
|
+
s(instrument.authorized_units ?? "unlimited"),
|
|
1460
|
+
s(instrument.issued_units),
|
|
1461
|
+
s(instrument.diluted_units)
|
|
1630
1462
|
]);
|
|
1631
1463
|
}
|
|
1632
1464
|
console.log(table.toString());
|
|
@@ -1640,10 +1472,10 @@ function printCapTable(data) {
|
|
|
1640
1472
|
for (const holder of holders) {
|
|
1641
1473
|
const dilutedBps = typeof holder.fully_diluted_bps === "number" ? `${(holder.fully_diluted_bps / 100).toFixed(2)}%` : "";
|
|
1642
1474
|
table.push([
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1475
|
+
s(holder.name),
|
|
1476
|
+
s(holder.outstanding_units),
|
|
1477
|
+
s(holder.as_converted_units),
|
|
1478
|
+
s(holder.fully_diluted_units),
|
|
1647
1479
|
dilutedBps
|
|
1648
1480
|
]);
|
|
1649
1481
|
}
|
|
@@ -1657,9 +1489,9 @@ function printCapTable(data) {
|
|
|
1657
1489
|
for (const sc of shareClasses) {
|
|
1658
1490
|
const row = [
|
|
1659
1491
|
formatReferenceCell("share_class", sc),
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1492
|
+
s(sc.class_code ?? sc.name),
|
|
1493
|
+
s(sc.authorized),
|
|
1494
|
+
s(sc.outstanding)
|
|
1663
1495
|
];
|
|
1664
1496
|
if (accessLevel !== "summary") {
|
|
1665
1497
|
const holders2 = sc.holders ?? [];
|
|
@@ -1673,7 +1505,7 @@ function printCapTable(data) {
|
|
|
1673
1505
|
if (ownership.length > 0 && accessLevel !== "summary") {
|
|
1674
1506
|
const table = makeTable("Ownership Breakdown", ["Holder", "Shares", "Percentage", "Class"]);
|
|
1675
1507
|
for (const o of ownership) {
|
|
1676
|
-
table.push([
|
|
1508
|
+
table.push([s(o.holder_name ?? o.name), s(o.shares), `${o.percentage ?? ""}%`, s(o.share_class)]);
|
|
1677
1509
|
}
|
|
1678
1510
|
console.log(table.toString());
|
|
1679
1511
|
}
|
|
@@ -1681,7 +1513,7 @@ function printCapTable(data) {
|
|
|
1681
1513
|
if (pools.length > 0) {
|
|
1682
1514
|
const table = makeTable("Option Pools", ["Name", "Authorized", "Granted", "Available"]);
|
|
1683
1515
|
for (const p of pools) {
|
|
1684
|
-
table.push([
|
|
1516
|
+
table.push([s(p.name), s(p.authorized), s(p.granted), s(p.available)]);
|
|
1685
1517
|
}
|
|
1686
1518
|
console.log(table.toString());
|
|
1687
1519
|
}
|
|
@@ -1692,7 +1524,7 @@ ${chalk.bold("Fully Diluted Shares:")} ${typeof fd === "number" ? fd.toLocaleStr
|
|
|
1692
1524
|
}
|
|
1693
1525
|
if (data.total_units != null) {
|
|
1694
1526
|
console.log(`
|
|
1695
|
-
${chalk.bold("Cap Table Basis:")} ${
|
|
1527
|
+
${chalk.bold("Cap Table Basis:")} ${s(data.basis) || "outstanding"}`);
|
|
1696
1528
|
console.log(`${chalk.bold("Total Units:")} ${typeof data.total_units === "number" ? data.total_units.toLocaleString() : data.total_units}`);
|
|
1697
1529
|
}
|
|
1698
1530
|
}
|
|
@@ -1701,11 +1533,11 @@ function printSafesTable(safes) {
|
|
|
1701
1533
|
for (const s_ of safes) {
|
|
1702
1534
|
table.push([
|
|
1703
1535
|
formatReferenceCell("safe_note", s_),
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1536
|
+
s(s_.investor_name ?? s_.investor),
|
|
1537
|
+
money(s_.principal_amount_cents ?? s_.investment_amount ?? s_.amount),
|
|
1538
|
+
money(s_.valuation_cap_cents ?? s_.valuation_cap ?? s_.cap),
|
|
1539
|
+
s(s_.discount_rate ?? s_.discount),
|
|
1540
|
+
s(s_.issued_at ?? s_.date ?? s_.created_at)
|
|
1709
1541
|
]);
|
|
1710
1542
|
}
|
|
1711
1543
|
console.log(table.toString());
|
|
@@ -1715,11 +1547,11 @@ function printTransfersTable(transfers) {
|
|
|
1715
1547
|
for (const t of transfers) {
|
|
1716
1548
|
table.push([
|
|
1717
1549
|
formatReferenceCell("share_transfer", t),
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1550
|
+
s(t.from_holder ?? t.from),
|
|
1551
|
+
s(t.to_holder ?? t.to),
|
|
1552
|
+
s(t.shares ?? t.share_count),
|
|
1553
|
+
s(t.transfer_type),
|
|
1554
|
+
s(t.status)
|
|
1723
1555
|
]);
|
|
1724
1556
|
}
|
|
1725
1557
|
console.log(table.toString());
|
|
@@ -1729,11 +1561,11 @@ function printInstrumentsTable(instruments) {
|
|
|
1729
1561
|
for (const instrument of instruments) {
|
|
1730
1562
|
table.push([
|
|
1731
1563
|
formatReferenceCell("instrument", instrument),
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1564
|
+
s(instrument.symbol),
|
|
1565
|
+
s(instrument.kind),
|
|
1566
|
+
s(instrument.authorized_units ?? "unlimited"),
|
|
1567
|
+
s(instrument.issued_units),
|
|
1568
|
+
s(instrument.status)
|
|
1737
1569
|
]);
|
|
1738
1570
|
}
|
|
1739
1571
|
console.log(table.toString());
|
|
@@ -1743,9 +1575,9 @@ function printShareClassesTable(shareClasses) {
|
|
|
1743
1575
|
for (const shareClass of shareClasses) {
|
|
1744
1576
|
table.push([
|
|
1745
1577
|
formatReferenceCell("share_class", shareClass),
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1578
|
+
s(shareClass.class_code ?? shareClass.name ?? shareClass.share_class),
|
|
1579
|
+
s(shareClass.authorized),
|
|
1580
|
+
s(shareClass.outstanding)
|
|
1749
1581
|
]);
|
|
1750
1582
|
}
|
|
1751
1583
|
console.log(table.toString());
|
|
@@ -1755,9 +1587,9 @@ function printRoundsTable(rounds) {
|
|
|
1755
1587
|
for (const round of rounds) {
|
|
1756
1588
|
table.push([
|
|
1757
1589
|
formatReferenceCell("round", round),
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1590
|
+
s(round.name),
|
|
1591
|
+
s(round.status),
|
|
1592
|
+
s(round.issuer_legal_entity_id),
|
|
1761
1593
|
date(round.created_at)
|
|
1762
1594
|
]);
|
|
1763
1595
|
}
|
|
@@ -1768,10 +1600,10 @@ function printInvoicesTable(invoices) {
|
|
|
1768
1600
|
for (const invoice of invoices) {
|
|
1769
1601
|
table.push([
|
|
1770
1602
|
formatReferenceCell("invoice", invoice),
|
|
1771
|
-
|
|
1772
|
-
|
|
1603
|
+
s(invoice.customer_name),
|
|
1604
|
+
money(invoice.amount_cents),
|
|
1773
1605
|
date(invoice.due_date),
|
|
1774
|
-
|
|
1606
|
+
s(invoice.status)
|
|
1775
1607
|
]);
|
|
1776
1608
|
}
|
|
1777
1609
|
console.log(table.toString());
|
|
@@ -1781,9 +1613,9 @@ function printBankAccountsTable(accounts) {
|
|
|
1781
1613
|
for (const account of accounts) {
|
|
1782
1614
|
table.push([
|
|
1783
1615
|
formatReferenceCell("bank_account", account),
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1616
|
+
s(account.bank_name),
|
|
1617
|
+
s(account.account_type),
|
|
1618
|
+
s(account.status),
|
|
1787
1619
|
date(account.created_at)
|
|
1788
1620
|
]);
|
|
1789
1621
|
}
|
|
@@ -1794,10 +1626,10 @@ function printPaymentsTable(payments) {
|
|
|
1794
1626
|
for (const payment of payments) {
|
|
1795
1627
|
table.push([
|
|
1796
1628
|
formatReferenceCell("payment", payment),
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1629
|
+
s(payment.recipient),
|
|
1630
|
+
money(payment.amount_cents),
|
|
1631
|
+
s(payment.payment_method),
|
|
1632
|
+
s(payment.status)
|
|
1801
1633
|
]);
|
|
1802
1634
|
}
|
|
1803
1635
|
console.log(table.toString());
|
|
@@ -1809,7 +1641,7 @@ function printPayrollRunsTable(runs) {
|
|
|
1809
1641
|
formatReferenceCell("payroll_run", run),
|
|
1810
1642
|
date(run.pay_period_start),
|
|
1811
1643
|
date(run.pay_period_end),
|
|
1812
|
-
|
|
1644
|
+
s(run.status),
|
|
1813
1645
|
date(run.created_at)
|
|
1814
1646
|
]);
|
|
1815
1647
|
}
|
|
@@ -1820,10 +1652,10 @@ function printDistributionsTable(distributions) {
|
|
|
1820
1652
|
for (const distribution of distributions) {
|
|
1821
1653
|
table.push([
|
|
1822
1654
|
formatReferenceCell("distribution", distribution),
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1655
|
+
s(distribution.distribution_type),
|
|
1656
|
+
money(distribution.total_amount_cents),
|
|
1657
|
+
s(distribution.status),
|
|
1658
|
+
s(distribution.description)
|
|
1827
1659
|
]);
|
|
1828
1660
|
}
|
|
1829
1661
|
console.log(table.toString());
|
|
@@ -1834,9 +1666,9 @@ function printReconciliationsTable(reconciliations) {
|
|
|
1834
1666
|
table.push([
|
|
1835
1667
|
formatReferenceCell("reconciliation", reconciliation),
|
|
1836
1668
|
date(reconciliation.as_of_date),
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1669
|
+
money(reconciliation.total_debits_cents),
|
|
1670
|
+
money(reconciliation.total_credits_cents),
|
|
1671
|
+
s(reconciliation.status)
|
|
1840
1672
|
]);
|
|
1841
1673
|
}
|
|
1842
1674
|
console.log(table.toString());
|
|
@@ -1847,9 +1679,9 @@ function printValuationsTable(valuations) {
|
|
|
1847
1679
|
table.push([
|
|
1848
1680
|
formatReferenceCell("valuation", v),
|
|
1849
1681
|
date(v.effective_date ?? v.valuation_date ?? v.date),
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1682
|
+
s(v.valuation_type ?? v.type),
|
|
1683
|
+
money(v.enterprise_value_cents ?? v.enterprise_value ?? v.valuation),
|
|
1684
|
+
money(v.fmv_per_share_cents ?? v.price_per_share ?? v.pps ?? v.fmv_per_share)
|
|
1853
1685
|
]);
|
|
1854
1686
|
}
|
|
1855
1687
|
console.log(table.toString());
|
|
@@ -1859,10 +1691,10 @@ function printTaxFilingsTable(filings) {
|
|
|
1859
1691
|
for (const filing of filings) {
|
|
1860
1692
|
table.push([
|
|
1861
1693
|
formatReferenceCell("tax_filing", filing),
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1694
|
+
s(filing.document_type),
|
|
1695
|
+
s(filing.tax_year),
|
|
1696
|
+
s(filing.status),
|
|
1697
|
+
s(filing.document_id, 12)
|
|
1866
1698
|
]);
|
|
1867
1699
|
}
|
|
1868
1700
|
console.log(table.toString());
|
|
@@ -1872,10 +1704,10 @@ function printDeadlinesTable(deadlines) {
|
|
|
1872
1704
|
for (const deadline of deadlines) {
|
|
1873
1705
|
table.push([
|
|
1874
1706
|
formatReferenceCell("deadline", deadline),
|
|
1875
|
-
|
|
1707
|
+
s(deadline.deadline_type),
|
|
1876
1708
|
date(deadline.due_date),
|
|
1877
|
-
|
|
1878
|
-
|
|
1709
|
+
s(deadline.status),
|
|
1710
|
+
s(deadline.description)
|
|
1879
1711
|
]);
|
|
1880
1712
|
}
|
|
1881
1713
|
console.log(table.toString());
|
|
@@ -1885,10 +1717,10 @@ function printClassificationsTable(classifications) {
|
|
|
1885
1717
|
for (const classification of classifications) {
|
|
1886
1718
|
table.push([
|
|
1887
1719
|
formatReferenceCell("classification", classification),
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1720
|
+
s(classification.contractor_name),
|
|
1721
|
+
s(classification.state),
|
|
1722
|
+
s(classification.risk_level),
|
|
1723
|
+
s(classification.classification)
|
|
1892
1724
|
]);
|
|
1893
1725
|
}
|
|
1894
1726
|
console.log(table.toString());
|
|
@@ -1898,10 +1730,10 @@ function printGovernanceTable(bodies) {
|
|
|
1898
1730
|
for (const b of bodies) {
|
|
1899
1731
|
table.push([
|
|
1900
1732
|
formatReferenceCell("body", b),
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1733
|
+
s(b.name),
|
|
1734
|
+
s(b.body_type ?? b.type),
|
|
1735
|
+
s(b.seat_count ?? b.seats),
|
|
1736
|
+
s(b.meeting_count ?? b.meetings)
|
|
1905
1737
|
]);
|
|
1906
1738
|
}
|
|
1907
1739
|
console.log(table.toString());
|
|
@@ -1911,9 +1743,9 @@ function printSeatsTable(seats) {
|
|
|
1911
1743
|
for (const st of seats) {
|
|
1912
1744
|
table.push([
|
|
1913
1745
|
formatReferenceCell("seat", st),
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1746
|
+
s(st.holder_name ?? st.holder ?? st.holder_id),
|
|
1747
|
+
s(st.role),
|
|
1748
|
+
s(st.status)
|
|
1917
1749
|
]);
|
|
1918
1750
|
}
|
|
1919
1751
|
console.log(table.toString());
|
|
@@ -1923,10 +1755,10 @@ function printMeetingsTable(meetings) {
|
|
|
1923
1755
|
for (const m of meetings) {
|
|
1924
1756
|
table.push([
|
|
1925
1757
|
formatReferenceCell("meeting", m),
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1758
|
+
s(m.title ?? m.name),
|
|
1759
|
+
s(m.scheduled_date ?? m.meeting_date ?? m.date),
|
|
1760
|
+
s(m.status),
|
|
1761
|
+
s(m.resolution_count ?? m.resolutions)
|
|
1930
1762
|
]);
|
|
1931
1763
|
}
|
|
1932
1764
|
console.log(table.toString());
|
|
@@ -1936,11 +1768,11 @@ function printResolutionsTable(resolutions) {
|
|
|
1936
1768
|
for (const r of resolutions) {
|
|
1937
1769
|
table.push([
|
|
1938
1770
|
formatReferenceCell("resolution", r),
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1771
|
+
s(r.title),
|
|
1772
|
+
s(r.resolution_type ?? r.type),
|
|
1773
|
+
s(r.status),
|
|
1774
|
+
s(r.votes_for),
|
|
1775
|
+
s(r.votes_against)
|
|
1944
1776
|
]);
|
|
1945
1777
|
}
|
|
1946
1778
|
console.log(table.toString());
|
|
@@ -1950,9 +1782,9 @@ function printAgendaItemsTable(items) {
|
|
|
1950
1782
|
for (const item of items) {
|
|
1951
1783
|
table.push([
|
|
1952
1784
|
formatReferenceCell("agenda_item", item),
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1785
|
+
s(item.title),
|
|
1786
|
+
s(item.status),
|
|
1787
|
+
s(item.item_type ?? item.type)
|
|
1956
1788
|
]);
|
|
1957
1789
|
}
|
|
1958
1790
|
console.log(table.toString());
|
|
@@ -1961,13 +1793,13 @@ function printDocumentsTable(docs) {
|
|
|
1961
1793
|
const table = makeTable("Documents", ["Ref", "Title", "Type", "Date", "Status", "Signatures"]);
|
|
1962
1794
|
for (const d of docs) {
|
|
1963
1795
|
const sigs = d.signatures;
|
|
1964
|
-
const sigStr = Array.isArray(sigs) ? `${sigs.length} signed` :
|
|
1796
|
+
const sigStr = Array.isArray(sigs) ? `${sigs.length} signed` : s(sigs);
|
|
1965
1797
|
table.push([
|
|
1966
1798
|
formatReferenceCell("document", d),
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1799
|
+
s(d.title ?? d.name),
|
|
1800
|
+
s(d.document_type ?? d.type),
|
|
1801
|
+
s(d.date ?? d.created_at),
|
|
1802
|
+
s(d.status),
|
|
1971
1803
|
sigStr
|
|
1972
1804
|
]);
|
|
1973
1805
|
}
|
|
@@ -1976,14 +1808,14 @@ function printDocumentsTable(docs) {
|
|
|
1976
1808
|
function printWorkItemsTable(items) {
|
|
1977
1809
|
const table = makeTable("Work Items", ["Ref", "Title", "Category", "Status", "Deadline", "Claimed By"]);
|
|
1978
1810
|
for (const w of items) {
|
|
1979
|
-
const status =
|
|
1811
|
+
const status = s(w.effective_status ?? w.status);
|
|
1980
1812
|
const colored = status === "completed" ? chalk.green(status) : status === "claimed" ? chalk.yellow(status) : status === "cancelled" ? chalk.dim(status) : status;
|
|
1981
1813
|
table.push([
|
|
1982
1814
|
formatReferenceCell("work_item", w),
|
|
1983
|
-
|
|
1984
|
-
|
|
1815
|
+
s(w.title),
|
|
1816
|
+
s(w.category),
|
|
1985
1817
|
colored,
|
|
1986
|
-
w.asap ? chalk.red.bold("ASAP") :
|
|
1818
|
+
w.asap ? chalk.red.bold("ASAP") : s(w.deadline ?? ""),
|
|
1987
1819
|
actorLabel(w, "claimed_by")
|
|
1988
1820
|
]);
|
|
1989
1821
|
}
|
|
@@ -1992,9 +1824,9 @@ function printWorkItemsTable(items) {
|
|
|
1992
1824
|
function printAgentsTable(agents) {
|
|
1993
1825
|
const table = makeTable("Agents", ["Ref", "Name", "Status", "Model"]);
|
|
1994
1826
|
for (const a of agents) {
|
|
1995
|
-
const status =
|
|
1827
|
+
const status = s(a.status);
|
|
1996
1828
|
const colored = status === "active" ? chalk.green(status) : status === "paused" ? chalk.yellow(status) : status;
|
|
1997
|
-
table.push([formatReferenceCell("agent", a),
|
|
1829
|
+
table.push([formatReferenceCell("agent", a), s(a.name), colored, s(a.model)]);
|
|
1998
1830
|
}
|
|
1999
1831
|
console.log(table.toString());
|
|
2000
1832
|
}
|
|
@@ -2002,10 +1834,10 @@ function printServiceCatalogTable(items) {
|
|
|
2002
1834
|
const table = makeTable("Service Catalog", ["Slug", "Name", "Price", "Type"]);
|
|
2003
1835
|
for (const item of items) {
|
|
2004
1836
|
table.push([
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
1837
|
+
s(item.slug),
|
|
1838
|
+
s(item.name),
|
|
1839
|
+
money(item.amount_cents),
|
|
1840
|
+
s(item.price_type)
|
|
2009
1841
|
]);
|
|
2010
1842
|
}
|
|
2011
1843
|
console.log(table.toString());
|
|
@@ -2013,12 +1845,12 @@ function printServiceCatalogTable(items) {
|
|
|
2013
1845
|
function printServiceRequestsTable(requests) {
|
|
2014
1846
|
const table = makeTable("Service Requests", ["Ref", "Service", "Amount", "Status", "Created"]);
|
|
2015
1847
|
for (const r of requests) {
|
|
2016
|
-
const status =
|
|
1848
|
+
const status = s(r.status);
|
|
2017
1849
|
const colored = status === "fulfilled" ? chalk.green(status) : status === "paid" ? chalk.cyan(status) : status === "checkout" ? chalk.yellow(status) : status === "failed" ? chalk.dim(status) : status;
|
|
2018
1850
|
table.push([
|
|
2019
1851
|
formatReferenceCell("service_request", r),
|
|
2020
|
-
|
|
2021
|
-
|
|
1852
|
+
s(r.service_slug),
|
|
1853
|
+
money(r.amount_cents),
|
|
2022
1854
|
colored,
|
|
2023
1855
|
date(r.created_at)
|
|
2024
1856
|
]);
|
|
@@ -2026,10 +1858,10 @@ function printServiceRequestsTable(requests) {
|
|
|
2026
1858
|
console.log(table.toString());
|
|
2027
1859
|
}
|
|
2028
1860
|
function printBillingPanel(status, plans) {
|
|
2029
|
-
const plan =
|
|
2030
|
-
const subStatus =
|
|
2031
|
-
const periodEnd =
|
|
2032
|
-
const explanation =
|
|
1861
|
+
const plan = s(status.plan ?? status.tier) || "free";
|
|
1862
|
+
const subStatus = s(status.status) || "active";
|
|
1863
|
+
const periodEnd = s(status.current_period_end);
|
|
1864
|
+
const explanation = s(status.status_explanation);
|
|
2033
1865
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
2034
1866
|
console.log(chalk.green.bold(" Billing Status"));
|
|
2035
1867
|
console.log(chalk.green("\u2500".repeat(50)));
|
|
@@ -2044,13 +1876,13 @@ function printBillingPanel(status, plans) {
|
|
|
2044
1876
|
const table = makeTable("Available Plans", ["Plan", "Price", "Features"]);
|
|
2045
1877
|
for (const p of plans) {
|
|
2046
1878
|
const amount = p.price_cents ?? p.amount ?? 0;
|
|
2047
|
-
const interval =
|
|
1879
|
+
const interval = s(p.interval);
|
|
2048
1880
|
let priceStr = "Free";
|
|
2049
1881
|
if (amount > 0) {
|
|
2050
1882
|
priceStr = interval ? `$${Math.round(amount / 100)}/${interval}` : `$${Math.round(amount / 100)}`;
|
|
2051
1883
|
}
|
|
2052
|
-
const name =
|
|
2053
|
-
const features = Array.isArray(p.features) ? p.features.join(", ") :
|
|
1884
|
+
const name = s(p.name ?? p.plan_id ?? p.tier);
|
|
1885
|
+
const features = Array.isArray(p.features) ? p.features.join(", ") : s(p.description);
|
|
2054
1886
|
table.push([name, priceStr, features]);
|
|
2055
1887
|
}
|
|
2056
1888
|
console.log(table.toString());
|
|
@@ -2089,6 +1921,174 @@ var init_output = __esm({
|
|
|
2089
1921
|
}
|
|
2090
1922
|
});
|
|
2091
1923
|
|
|
1924
|
+
// src/animation.ts
|
|
1925
|
+
function renderFrame(frame) {
|
|
1926
|
+
const cols = [];
|
|
1927
|
+
for (let i = 0; i < BUILDINGS.length; i++) {
|
|
1928
|
+
const building = BUILDINGS[i];
|
|
1929
|
+
const h = building.length;
|
|
1930
|
+
const visible = Math.max(0, Math.min(h, frame - i));
|
|
1931
|
+
const width = building[0]?.length ?? 6;
|
|
1932
|
+
const blank = " ".repeat(width);
|
|
1933
|
+
const col = Array(MAX_HEIGHT - visible).fill(blank);
|
|
1934
|
+
col.push(...building.slice(h - visible));
|
|
1935
|
+
cols.push(col);
|
|
1936
|
+
}
|
|
1937
|
+
const lines = [];
|
|
1938
|
+
for (let row = 0; row < MAX_HEIGHT; row++) {
|
|
1939
|
+
lines.push(cols.map((col) => col[row]).join(""));
|
|
1940
|
+
}
|
|
1941
|
+
return lines.join("\n");
|
|
1942
|
+
}
|
|
1943
|
+
async function withAnimation(fn) {
|
|
1944
|
+
if (!process.stdout.isTTY) {
|
|
1945
|
+
return fn();
|
|
1946
|
+
}
|
|
1947
|
+
let frame = 0;
|
|
1948
|
+
let animDone = false;
|
|
1949
|
+
const spinChars = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
1950
|
+
let spinIdx = 0;
|
|
1951
|
+
let lastLineCount = 0;
|
|
1952
|
+
const clearPrev = () => {
|
|
1953
|
+
if (lastLineCount > 0) {
|
|
1954
|
+
process.stdout.write(`\x1B[${lastLineCount}A\x1B[0J`);
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
const drawFrame = () => {
|
|
1958
|
+
clearPrev();
|
|
1959
|
+
if (!animDone) {
|
|
1960
|
+
const art = renderFrame(frame);
|
|
1961
|
+
const output = `${GOLD}${art}${RESET}
|
|
1962
|
+
`;
|
|
1963
|
+
process.stdout.write(output);
|
|
1964
|
+
lastLineCount = MAX_HEIGHT + 1;
|
|
1965
|
+
frame++;
|
|
1966
|
+
if (frame >= TOTAL_FRAMES) {
|
|
1967
|
+
animDone = true;
|
|
1968
|
+
}
|
|
1969
|
+
} else {
|
|
1970
|
+
const line = `${GOLD}${spinChars[spinIdx % spinChars.length]} Loading...${RESET}
|
|
1971
|
+
`;
|
|
1972
|
+
process.stdout.write(line);
|
|
1973
|
+
lastLineCount = 1;
|
|
1974
|
+
spinIdx++;
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
drawFrame();
|
|
1978
|
+
const timer = setInterval(drawFrame, 100);
|
|
1979
|
+
try {
|
|
1980
|
+
const result = await fn();
|
|
1981
|
+
return result;
|
|
1982
|
+
} finally {
|
|
1983
|
+
clearInterval(timer);
|
|
1984
|
+
clearPrev();
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
var BUILDINGS, MAX_HEIGHT, TOTAL_FRAMES, GOLD, RESET;
|
|
1988
|
+
var init_animation = __esm({
|
|
1989
|
+
"src/animation.ts"() {
|
|
1990
|
+
"use strict";
|
|
1991
|
+
BUILDINGS = [
|
|
1992
|
+
[
|
|
1993
|
+
" \u250C\u2510 ",
|
|
1994
|
+
" \u2502\u2502 ",
|
|
1995
|
+
" \u2502\u2502 ",
|
|
1996
|
+
" \u250C\u2524\u251C\u2510 ",
|
|
1997
|
+
" \u2502\u2502\u2502\u2502\u2502",
|
|
1998
|
+
" \u2502\u2502\u2502\u2502\u2502"
|
|
1999
|
+
],
|
|
2000
|
+
[
|
|
2001
|
+
" \u2554\u2550\u2550\u2557 ",
|
|
2002
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2003
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2004
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2005
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2006
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2007
|
+
" \u2551\u25AA\u25AA\u2551 ",
|
|
2008
|
+
" \u2551\u25AA\u25AA\u2551 "
|
|
2009
|
+
],
|
|
2010
|
+
[
|
|
2011
|
+
" /\\ ",
|
|
2012
|
+
" / \\ ",
|
|
2013
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2014
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2015
|
+
" \u2502\u25AA\u25AA\u2502 "
|
|
2016
|
+
],
|
|
2017
|
+
[
|
|
2018
|
+
" \u250C\u2500\u2500\u2510 ",
|
|
2019
|
+
" \u2502\u224B\u224B\u2502 ",
|
|
2020
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2021
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2022
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2023
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2024
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2025
|
+
" \u2502\u25AA\u25AA\u2502 ",
|
|
2026
|
+
" \u2502\u25AA\u25AA\u2502 "
|
|
2027
|
+
],
|
|
2028
|
+
[
|
|
2029
|
+
" \u257B ",
|
|
2030
|
+
" \u2503 ",
|
|
2031
|
+
" \u250C\u2524\u2510 ",
|
|
2032
|
+
" \u2502\u25AA\u2502 ",
|
|
2033
|
+
" \u2502\u25AA\u2502 ",
|
|
2034
|
+
" \u2502\u25AA\u2502 ",
|
|
2035
|
+
" \u2502\u25AA\u2502 ",
|
|
2036
|
+
" \u2502\u25AA\u2502 ",
|
|
2037
|
+
" \u2502\u25AA\u2502 ",
|
|
2038
|
+
" \u2502\u25AA\u2502 ",
|
|
2039
|
+
" \u2502\u25AA\u2502 "
|
|
2040
|
+
],
|
|
2041
|
+
[
|
|
2042
|
+
" \u250C\u2510 ",
|
|
2043
|
+
" \u251C\u2524 ",
|
|
2044
|
+
" \u2502\u25AA\u2502 ",
|
|
2045
|
+
" \u2502\u25AA\u2502 ",
|
|
2046
|
+
" \u2502\u25AA\u2502 ",
|
|
2047
|
+
" \u2502\u25AA\u2502 "
|
|
2048
|
+
],
|
|
2049
|
+
[
|
|
2050
|
+
" \u2554\u2550\u2550\u2550\u2557",
|
|
2051
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2052
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2053
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2054
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2055
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2056
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2057
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2058
|
+
" \u2551\u25AA \u25AA\u2551",
|
|
2059
|
+
" \u2551\u25AA \u25AA\u2551"
|
|
2060
|
+
],
|
|
2061
|
+
[
|
|
2062
|
+
" \u252C\u2500\u252C ",
|
|
2063
|
+
" \u2502~\u2502 ",
|
|
2064
|
+
" \u2502\u25AA\u2502 ",
|
|
2065
|
+
" \u2502\u25AA\u2502 ",
|
|
2066
|
+
" \u2502\u25AA\u2502 ",
|
|
2067
|
+
" \u2502\u25AA\u2502 ",
|
|
2068
|
+
" \u2502\u25AA\u2502 "
|
|
2069
|
+
]
|
|
2070
|
+
];
|
|
2071
|
+
MAX_HEIGHT = Math.max(...BUILDINGS.map((b) => b.length));
|
|
2072
|
+
TOTAL_FRAMES = MAX_HEIGHT + 4;
|
|
2073
|
+
GOLD = "\x1B[38;2;212;160;23m";
|
|
2074
|
+
RESET = "\x1B[0m";
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
|
|
2078
|
+
// src/spinner.ts
|
|
2079
|
+
async function withSpinner(_label, fn, json) {
|
|
2080
|
+
if (json) {
|
|
2081
|
+
return fn();
|
|
2082
|
+
}
|
|
2083
|
+
return withAnimation(fn);
|
|
2084
|
+
}
|
|
2085
|
+
var init_spinner = __esm({
|
|
2086
|
+
"src/spinner.ts"() {
|
|
2087
|
+
"use strict";
|
|
2088
|
+
init_animation();
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
|
|
2092
2092
|
// src/api-client.ts
|
|
2093
2093
|
import { CorpAPIClient, SessionExpiredError, provisionWorkspace } from "@thecorporation/corp-tools";
|
|
2094
2094
|
var init_api_client = __esm({
|
|
@@ -2182,8 +2182,7 @@ var init_workspace = __esm({
|
|
|
2182
2182
|
printStatusPanel(data);
|
|
2183
2183
|
}
|
|
2184
2184
|
} catch (err) {
|
|
2185
|
-
|
|
2186
|
-
process.exit(1);
|
|
2185
|
+
throw new Error(`Failed to fetch status: ${err}`);
|
|
2187
2186
|
}
|
|
2188
2187
|
},
|
|
2189
2188
|
examples: ["corp status"]
|
|
@@ -2255,8 +2254,7 @@ var init_workspace = __esm({
|
|
|
2255
2254
|
}
|
|
2256
2255
|
console.log(chalk3.blue("\u2500".repeat(50)));
|
|
2257
2256
|
} catch (err) {
|
|
2258
|
-
|
|
2259
|
-
process.exit(1);
|
|
2257
|
+
throw new Error(`Failed to fetch context: ${err}`);
|
|
2260
2258
|
}
|
|
2261
2259
|
},
|
|
2262
2260
|
examples: ["corp context", "corp context --json"]
|
|
@@ -2278,8 +2276,7 @@ var init_workspace = __esm({
|
|
|
2278
2276
|
const alias = getReferenceAlias("entity", { entity_id: entityId }) ?? entityId;
|
|
2279
2277
|
ctx.writer.success(`Active entity set to ${alias} (${entityId})`);
|
|
2280
2278
|
} catch (err) {
|
|
2281
|
-
|
|
2282
|
-
process.exit(1);
|
|
2279
|
+
throw new Error(`Failed to resolve entity: ${err}`);
|
|
2283
2280
|
}
|
|
2284
2281
|
},
|
|
2285
2282
|
examples: ["corp use", "corp use --json"]
|
|
@@ -2301,8 +2298,7 @@ var init_workspace = __esm({
|
|
|
2301
2298
|
handler: async (ctx) => {
|
|
2302
2299
|
const opts = ctx.opts;
|
|
2303
2300
|
if (opts.entityId && opts.workspace) {
|
|
2304
|
-
|
|
2305
|
-
process.exit(1);
|
|
2301
|
+
throw new Error("--entity-id and --workspace are mutually exclusive");
|
|
2306
2302
|
}
|
|
2307
2303
|
const localItems = localChecks();
|
|
2308
2304
|
const hasCriticalLocal = localItems.some((i) => i.urgency === "critical");
|
|
@@ -2372,8 +2368,7 @@ var init_workspace = __esm({
|
|
|
2372
2368
|
console.log(" corp form finalize @last");
|
|
2373
2369
|
}
|
|
2374
2370
|
} else {
|
|
2375
|
-
|
|
2376
|
-
process.exit(1);
|
|
2371
|
+
throw new Error(`Failed to fetch next steps: ${err}`);
|
|
2377
2372
|
}
|
|
2378
2373
|
}
|
|
2379
2374
|
}
|
|
@@ -2441,8 +2436,7 @@ var init_workspace = __esm({
|
|
|
2441
2436
|
}
|
|
2442
2437
|
}
|
|
2443
2438
|
} catch (err) {
|
|
2444
|
-
|
|
2445
|
-
process.exit(1);
|
|
2439
|
+
throw new Error(`Failed: ${err}`);
|
|
2446
2440
|
}
|
|
2447
2441
|
},
|
|
2448
2442
|
examples: ["corp digest"]
|
|
@@ -2465,8 +2459,7 @@ var init_workspace = __esm({
|
|
|
2465
2459
|
printBillingPanel(enrichedStatus, plans);
|
|
2466
2460
|
}
|
|
2467
2461
|
} catch (err) {
|
|
2468
|
-
|
|
2469
|
-
process.exit(1);
|
|
2462
|
+
throw new Error(`Failed to fetch billing info: ${err}`);
|
|
2470
2463
|
}
|
|
2471
2464
|
},
|
|
2472
2465
|
examples: ["corp billing"]
|
|
@@ -2481,14 +2474,12 @@ var init_workspace = __esm({
|
|
|
2481
2474
|
const result = await ctx.client.createBillingPortal();
|
|
2482
2475
|
const url = result.portal_url;
|
|
2483
2476
|
if (!url) {
|
|
2484
|
-
|
|
2485
|
-
process.exit(1);
|
|
2477
|
+
throw new Error("No portal URL returned. Ensure you have an active subscription.");
|
|
2486
2478
|
}
|
|
2487
2479
|
ctx.writer.success("Stripe Customer Portal URL:");
|
|
2488
2480
|
ctx.writer.writeln(url);
|
|
2489
2481
|
} catch (err) {
|
|
2490
|
-
|
|
2491
|
-
process.exit(1);
|
|
2482
|
+
throw new Error(`Failed to create portal session: ${err}`);
|
|
2492
2483
|
}
|
|
2493
2484
|
},
|
|
2494
2485
|
examples: ["corp billing portal"]
|
|
@@ -2512,14 +2503,12 @@ var init_workspace = __esm({
|
|
|
2512
2503
|
const result = await ctx.client.createBillingCheckout(opts.plan);
|
|
2513
2504
|
const url = result.checkout_url;
|
|
2514
2505
|
if (!url) {
|
|
2515
|
-
|
|
2516
|
-
process.exit(1);
|
|
2506
|
+
throw new Error("No checkout URL returned.");
|
|
2517
2507
|
}
|
|
2518
2508
|
ctx.writer.success(`Stripe Checkout URL for ${opts.plan}:`);
|
|
2519
2509
|
ctx.writer.writeln(url);
|
|
2520
2510
|
} catch (err) {
|
|
2521
|
-
|
|
2522
|
-
process.exit(1);
|
|
2511
|
+
throw new Error(`Failed to create checkout session: ${err}`);
|
|
2523
2512
|
}
|
|
2524
2513
|
},
|
|
2525
2514
|
examples: ["corp billing upgrade"]
|
|
@@ -2560,8 +2549,7 @@ async function entitiesHandler(ctx) {
|
|
|
2560
2549
|
printEntitiesTable(entities);
|
|
2561
2550
|
}
|
|
2562
2551
|
} catch (err) {
|
|
2563
|
-
|
|
2564
|
-
process.exit(1);
|
|
2552
|
+
throw new Error(`Failed to fetch entities: ${err}`);
|
|
2565
2553
|
}
|
|
2566
2554
|
}
|
|
2567
2555
|
async function entitiesShowHandler(ctx) {
|
|
@@ -2573,8 +2561,7 @@ async function entitiesShowHandler(ctx) {
|
|
|
2573
2561
|
const entities = await ctx.client.listEntities();
|
|
2574
2562
|
const entity = entities.find((e) => e.entity_id === resolvedEntityId);
|
|
2575
2563
|
if (!entity) {
|
|
2576
|
-
|
|
2577
|
-
process.exit(1);
|
|
2564
|
+
throw new Error(`Entity not found: ${entityRef}`);
|
|
2578
2565
|
}
|
|
2579
2566
|
await ctx.resolver.stabilizeRecord("entity", entity);
|
|
2580
2567
|
if (quiet) {
|
|
@@ -2598,8 +2585,7 @@ async function entitiesShowHandler(ctx) {
|
|
|
2598
2585
|
console.log(chalk4.blue("\u2500".repeat(40)));
|
|
2599
2586
|
}
|
|
2600
2587
|
} catch (err) {
|
|
2601
|
-
|
|
2602
|
-
process.exit(1);
|
|
2588
|
+
throw new Error(`Failed to fetch entities: ${err}`);
|
|
2603
2589
|
}
|
|
2604
2590
|
}
|
|
2605
2591
|
async function entitiesConvertHandler(ctx) {
|
|
@@ -2612,8 +2598,7 @@ async function entitiesConvertHandler(ctx) {
|
|
|
2612
2598
|
printSuccess(`Entity conversion initiated: ${result.conversion_id ?? "OK"}`);
|
|
2613
2599
|
printJson(result);
|
|
2614
2600
|
} catch (err) {
|
|
2615
|
-
|
|
2616
|
-
process.exit(1);
|
|
2601
|
+
throw new Error(`Failed to convert entity: ${err}`);
|
|
2617
2602
|
}
|
|
2618
2603
|
}
|
|
2619
2604
|
async function entitiesDissolveHandler(ctx) {
|
|
@@ -2638,11 +2623,10 @@ async function entitiesDissolveHandler(ctx) {
|
|
|
2638
2623
|
} catch (err) {
|
|
2639
2624
|
const msg = String(err);
|
|
2640
2625
|
if (msg.includes("InvalidTransition") || msg.includes("422")) {
|
|
2641
|
-
|
|
2626
|
+
throw new Error(`Cannot dissolve entity: only entities with 'active' status can be dissolved. Check the entity's current status with: corp entities show ${entityRef}`);
|
|
2642
2627
|
} else {
|
|
2643
|
-
|
|
2628
|
+
throw new Error(`Failed to dissolve entity: ${err}`);
|
|
2644
2629
|
}
|
|
2645
|
-
process.exit(1);
|
|
2646
2630
|
}
|
|
2647
2631
|
}
|
|
2648
2632
|
async function contactsHandler(ctx) {
|
|
@@ -2655,8 +2639,7 @@ async function contactsHandler(ctx) {
|
|
|
2655
2639
|
else if (contacts.length === 0) console.log("No contacts found.");
|
|
2656
2640
|
else printContactsTable(contacts);
|
|
2657
2641
|
} catch (err) {
|
|
2658
|
-
|
|
2659
|
-
process.exit(1);
|
|
2642
|
+
throw new Error(`Failed to fetch contacts: ${err}`);
|
|
2660
2643
|
}
|
|
2661
2644
|
}
|
|
2662
2645
|
async function contactsShowHandler(ctx) {
|
|
@@ -2691,8 +2674,7 @@ async function contactsShowHandler(ctx) {
|
|
|
2691
2674
|
console.log(chalk4.cyan("\u2500".repeat(40)));
|
|
2692
2675
|
}
|
|
2693
2676
|
} catch (err) {
|
|
2694
|
-
|
|
2695
|
-
process.exit(1);
|
|
2677
|
+
throw new Error(`Failed to fetch contact: ${err}`);
|
|
2696
2678
|
}
|
|
2697
2679
|
}
|
|
2698
2680
|
async function contactsAddHandler(ctx) {
|
|
@@ -2719,8 +2701,7 @@ async function contactsAddHandler(ctx) {
|
|
|
2719
2701
|
{ jsonOnly: jsonOutput, referenceKind: "contact", showReuseHint: true }
|
|
2720
2702
|
);
|
|
2721
2703
|
} catch (err) {
|
|
2722
|
-
|
|
2723
|
-
process.exit(1);
|
|
2704
|
+
throw new Error(`Failed to create contact: ${err}`);
|
|
2724
2705
|
}
|
|
2725
2706
|
}
|
|
2726
2707
|
async function contactsEditHandler(ctx) {
|
|
@@ -2767,8 +2748,7 @@ async function contactsEditHandler(ctx) {
|
|
|
2767
2748
|
ctx.resolver.remember("contact", resolvedContactId, eid);
|
|
2768
2749
|
printWriteResult(result, "Contact updated.", jsonOutput);
|
|
2769
2750
|
} catch (err) {
|
|
2770
|
-
|
|
2771
|
-
process.exit(1);
|
|
2751
|
+
throw new Error(`Failed to update contact: ${err}`);
|
|
2772
2752
|
}
|
|
2773
2753
|
}
|
|
2774
2754
|
var entityCommands;
|
|
@@ -2812,7 +2792,7 @@ var init_entities = __esm({
|
|
|
2812
2792
|
options: [
|
|
2813
2793
|
{ flags: "--reason <reason>", description: "Dissolution reason", required: true },
|
|
2814
2794
|
{ flags: "--effective-date <date>", description: "Effective date (ISO 8601)" },
|
|
2815
|
-
{ flags: "--yes
|
|
2795
|
+
{ flags: "--yes -y", description: "Skip confirmation prompt" }
|
|
2816
2796
|
],
|
|
2817
2797
|
handler: entitiesDissolveHandler,
|
|
2818
2798
|
examples: ["corp entities dissolve <entity-ref> --reason 'reason'", "corp entities dissolve --json"]
|
|
@@ -2899,7 +2879,7 @@ var init_entities = __esm({
|
|
|
2899
2879
|
{ flags: "--sms-enabled <sms-enabled>", description: "Sms Enabled" },
|
|
2900
2880
|
{ flags: "--webhook-enabled <webhook-enabled>", description: "Webhook Enabled" }
|
|
2901
2881
|
],
|
|
2902
|
-
examples: ["corp contacts notification-prefs <contact-id>", "corp contacts notification-prefs --json"],
|
|
2882
|
+
examples: ["corp contacts update-notification-prefs <contact-id>", "corp contacts update-notification-prefs --json"],
|
|
2903
2883
|
successTemplate: "Notification Prefs updated"
|
|
2904
2884
|
}
|
|
2905
2885
|
];
|
|
@@ -3953,28 +3933,23 @@ async function resolveEntityRefForFormCommand2(resolver, entityRef, dryRun) {
|
|
|
3953
3933
|
async function formCreateHandler(ctx) {
|
|
3954
3934
|
const opts = ctx.opts;
|
|
3955
3935
|
if (opts.shares || opts.authorizedShares) {
|
|
3956
|
-
|
|
3936
|
+
throw new Error(
|
|
3957
3937
|
"--shares / --authorized-shares is not accepted on form create.\n Set authorized shares during finalize:\n corp form finalize @last:entity --authorized-shares 10000000"
|
|
3958
3938
|
);
|
|
3959
|
-
process.exit(1);
|
|
3960
3939
|
}
|
|
3961
3940
|
const resolvedType = opts.type;
|
|
3962
3941
|
const resolvedName = opts.name;
|
|
3963
3942
|
if (!resolvedType) {
|
|
3964
|
-
|
|
3965
|
-
process.exit(1);
|
|
3943
|
+
throw new Error("required option '--type <type>' not specified");
|
|
3966
3944
|
}
|
|
3967
3945
|
if (!SUPPORTED_ENTITY_TYPES2.includes(resolvedType)) {
|
|
3968
|
-
|
|
3969
|
-
process.exit(1);
|
|
3946
|
+
throw new Error(`unsupported entity type '${resolvedType}'. Supported types: ${SUPPORTED_ENTITY_TYPES2.join(", ")}`);
|
|
3970
3947
|
}
|
|
3971
3948
|
if (!resolvedName) {
|
|
3972
|
-
|
|
3973
|
-
process.exit(1);
|
|
3949
|
+
throw new Error("required option '--name <name>' not specified");
|
|
3974
3950
|
}
|
|
3975
3951
|
if (!resolvedName.trim()) {
|
|
3976
|
-
|
|
3977
|
-
process.exit(1);
|
|
3952
|
+
throw new Error("--name cannot be empty or whitespace");
|
|
3978
3953
|
}
|
|
3979
3954
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
3980
3955
|
try {
|
|
@@ -4026,8 +4001,7 @@ async function formCreateHandler(ctx) {
|
|
|
4026
4001
|
console.log(chalk6.yellow(`
|
|
4027
4002
|
Next: corp form add-founder @last:entity --name "..." --email "..." --role member --pct 50`));
|
|
4028
4003
|
} catch (err) {
|
|
4029
|
-
|
|
4030
|
-
process.exit(1);
|
|
4004
|
+
throw new Error(`Failed to create pending entity: ${err}`);
|
|
4031
4005
|
}
|
|
4032
4006
|
}
|
|
4033
4007
|
async function formAddFounderHandler(ctx) {
|
|
@@ -4037,13 +4011,11 @@ async function formAddFounderHandler(ctx) {
|
|
|
4037
4011
|
const resolvedEntityId = await resolveEntityRefForFormCommand2(ctx.resolver, entityRef, ctx.dryRun);
|
|
4038
4012
|
const rawPct = opts.ownershipPct ?? opts.pct;
|
|
4039
4013
|
if (!rawPct) {
|
|
4040
|
-
|
|
4041
|
-
process.exit(1);
|
|
4014
|
+
throw new Error("required option '--ownership-pct <percent>' not specified");
|
|
4042
4015
|
}
|
|
4043
4016
|
const pctValue = parseFloat(rawPct);
|
|
4044
4017
|
if (isNaN(pctValue) || pctValue <= 0 || pctValue > 100) {
|
|
4045
|
-
|
|
4046
|
-
process.exit(1);
|
|
4018
|
+
throw new Error(`--ownership-pct must be between 0 and 100 (e.g. 60 for 60%), got: ${rawPct}`);
|
|
4047
4019
|
}
|
|
4048
4020
|
const payload = {
|
|
4049
4021
|
name: opts.name,
|
|
@@ -4073,8 +4045,7 @@ async function formAddFounderHandler(ctx) {
|
|
|
4073
4045
|
console.log(chalk6.yellow(`
|
|
4074
4046
|
Next: add more founders or run: corp form finalize @last:entity`));
|
|
4075
4047
|
} catch (err) {
|
|
4076
|
-
|
|
4077
|
-
process.exit(1);
|
|
4048
|
+
throw new Error(`Failed to add founder: ${err}`);
|
|
4078
4049
|
}
|
|
4079
4050
|
}
|
|
4080
4051
|
async function formFinalizeHandler(ctx) {
|
|
@@ -4165,7 +4136,7 @@ async function formFinalizeHandler(ctx) {
|
|
|
4165
4136
|
hints.push('--incorporator-name "Incorporator Name"');
|
|
4166
4137
|
}
|
|
4167
4138
|
if (hints.length > 0) {
|
|
4168
|
-
|
|
4139
|
+
throw new Error(
|
|
4169
4140
|
`Finalization failed: ${msg}
|
|
4170
4141
|
|
|
4171
4142
|
To fix, re-run finalize with the missing fields:
|
|
@@ -4175,9 +4146,8 @@ async function formFinalizeHandler(ctx) {
|
|
|
4175
4146
|
corp form finalize @last ${hints.filter((h) => h.startsWith("--")).join(" ")}`
|
|
4176
4147
|
);
|
|
4177
4148
|
} else {
|
|
4178
|
-
|
|
4149
|
+
throw new Error(`Failed to finalize formation: ${err}`);
|
|
4179
4150
|
}
|
|
4180
|
-
process.exit(1);
|
|
4181
4151
|
}
|
|
4182
4152
|
}
|
|
4183
4153
|
async function formActivateHandler(ctx) {
|
|
@@ -4228,8 +4198,7 @@ async function formActivateHandler(ctx) {
|
|
|
4228
4198
|
console.log(chalk6.yellow(" corp next See all recommended actions"));
|
|
4229
4199
|
}
|
|
4230
4200
|
} catch (err) {
|
|
4231
|
-
|
|
4232
|
-
process.exit(1);
|
|
4201
|
+
throw new Error(`Failed to activate formation: ${err}`);
|
|
4233
4202
|
}
|
|
4234
4203
|
}
|
|
4235
4204
|
var SUPPORTED_ENTITY_TYPES2, formationCommands;
|
|
@@ -4462,7 +4431,7 @@ var init_formation = __esm({
|
|
|
4462
4431
|
},
|
|
4463
4432
|
{
|
|
4464
4433
|
name: "formations pending",
|
|
4465
|
-
description: "
|
|
4434
|
+
description: "Create a pending formation",
|
|
4466
4435
|
route: { method: "POST", path: "/v1/formations/pending" },
|
|
4467
4436
|
options: [
|
|
4468
4437
|
{ flags: "--company-address <company-address>", description: "Company mailing address" },
|
|
@@ -4478,7 +4447,7 @@ var init_formation = __esm({
|
|
|
4478
4447
|
{ flags: "--transfer-restrictions <transfer-restrictions>", description: "Transfer Restrictions" }
|
|
4479
4448
|
],
|
|
4480
4449
|
examples: ["corp formations pending --entity-type c_corp --legal-name 'legal-name'", "corp formations pending --json"],
|
|
4481
|
-
successTemplate: "Pending created"
|
|
4450
|
+
successTemplate: "Pending formation created"
|
|
4482
4451
|
},
|
|
4483
4452
|
{
|
|
4484
4453
|
name: "formations with-cap-table",
|
|
@@ -4723,8 +4692,7 @@ var init_cap_table = __esm({
|
|
|
4723
4692
|
return;
|
|
4724
4693
|
}
|
|
4725
4694
|
if (data.access_level === "none") {
|
|
4726
|
-
|
|
4727
|
-
process.exit(1);
|
|
4695
|
+
throw new Error("You do not have access to this entity's cap table.");
|
|
4728
4696
|
}
|
|
4729
4697
|
printCapTable(data);
|
|
4730
4698
|
try {
|
|
@@ -4944,10 +4912,10 @@ var init_cap_table = __esm({
|
|
|
4944
4912
|
"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>"
|
|
4945
4913
|
);
|
|
4946
4914
|
}
|
|
4915
|
+
return;
|
|
4947
4916
|
} else {
|
|
4948
|
-
|
|
4917
|
+
throw new Error(`Failed to fetch 409A valuation: ${err}`);
|
|
4949
4918
|
}
|
|
4950
|
-
process.exit(1);
|
|
4951
4919
|
}
|
|
4952
4920
|
},
|
|
4953
4921
|
examples: ["corp cap-table 409a", "corp cap-table 409a --json"]
|
|
@@ -5520,7 +5488,7 @@ var init_cap_table = __esm({
|
|
|
5520
5488
|
if (resolutionId) body.resolution_id = resolutionId;
|
|
5521
5489
|
const result = await ctx.client.issueRound(roundId, body);
|
|
5522
5490
|
ctx.resolver.remember("round", roundId, eid);
|
|
5523
|
-
const roundMatch = (await ctx.resolver.find("round",
|
|
5491
|
+
const roundMatch = (await ctx.resolver.find("round", shortId(roundId), { entityId: eid })).find((match) => match.id === roundId);
|
|
5524
5492
|
if (ctx.opts.json) {
|
|
5525
5493
|
ctx.writer.json(result);
|
|
5526
5494
|
return;
|
|
@@ -5623,7 +5591,7 @@ var init_cap_table = __esm({
|
|
|
5623
5591
|
ctx.writer.success(`Valuation submitted for approval: ${result.valuation_id ?? valuationId ?? "OK"}`);
|
|
5624
5592
|
printReferenceSummary("valuation", result, { showReuseHint: true });
|
|
5625
5593
|
if (result.meeting_id) {
|
|
5626
|
-
const meetingMatch = (await ctx.resolver.find("meeting",
|
|
5594
|
+
const meetingMatch = (await ctx.resolver.find("meeting", shortId(String(result.meeting_id)), { entityId: eid })).find((match) => match.id === String(result.meeting_id));
|
|
5627
5595
|
if (meetingMatch) {
|
|
5628
5596
|
printReferenceSummary("meeting", meetingMatch.raw, { label: "Meeting Ref:" });
|
|
5629
5597
|
} else {
|
|
@@ -5631,7 +5599,7 @@ var init_cap_table = __esm({
|
|
|
5631
5599
|
}
|
|
5632
5600
|
}
|
|
5633
5601
|
if (result.agenda_item_id) {
|
|
5634
|
-
const agendaMatch = (await ctx.resolver.find("agenda_item",
|
|
5602
|
+
const agendaMatch = (await ctx.resolver.find("agenda_item", shortId(String(result.agenda_item_id)), {
|
|
5635
5603
|
entityId: eid,
|
|
5636
5604
|
meetingId: result.meeting_id ? String(result.meeting_id) : void 0
|
|
5637
5605
|
})).find((match) => match.id === String(result.agenda_item_id));
|
|
@@ -5644,11 +5612,10 @@ var init_cap_table = __esm({
|
|
|
5644
5612
|
} catch (err) {
|
|
5645
5613
|
const msg = String(err);
|
|
5646
5614
|
if (msg.includes("404") || msg.includes("Not found") || msg.includes("not found")) {
|
|
5647
|
-
|
|
5615
|
+
throw new Error(`Valuation not found. List valuations with: corp cap-table valuations`);
|
|
5648
5616
|
} else {
|
|
5649
|
-
|
|
5617
|
+
throw new Error(`Failed to submit valuation: ${err}`);
|
|
5650
5618
|
}
|
|
5651
|
-
process.exit(1);
|
|
5652
5619
|
}
|
|
5653
5620
|
},
|
|
5654
5621
|
examples: ["corp cap-table submit-valuation <valuation-ref>"]
|
|
@@ -5689,11 +5656,10 @@ var init_cap_table = __esm({
|
|
|
5689
5656
|
} catch (err) {
|
|
5690
5657
|
const msg = String(err);
|
|
5691
5658
|
if (msg.includes("400")) {
|
|
5692
|
-
|
|
5659
|
+
throw new Error(`Bad request \u2014 a --resolution-id from a board vote may be required. Submit for approval first: corp cap-table submit-valuation <valuation-ref>`);
|
|
5693
5660
|
} else {
|
|
5694
|
-
|
|
5661
|
+
throw new Error(`Failed to approve valuation: ${err}`);
|
|
5695
5662
|
}
|
|
5696
|
-
process.exit(1);
|
|
5697
5663
|
}
|
|
5698
5664
|
},
|
|
5699
5665
|
examples: ["corp cap-table approve-valuation <valuation-ref>", "corp cap-table approve-valuation --json"]
|
|
@@ -6537,13 +6503,11 @@ var init_finance = __esm({
|
|
|
6537
6503
|
handler: async (ctx) => {
|
|
6538
6504
|
const eid = await ctx.resolver.resolveEntity(ctx.opts.entityId);
|
|
6539
6505
|
if (ctx.opts.amountCents != null && ctx.opts.amountDollars != null) {
|
|
6540
|
-
|
|
6541
|
-
process.exit(1);
|
|
6506
|
+
throw new Error("--amount-cents and --amount-dollars are mutually exclusive. Use one or the other.");
|
|
6542
6507
|
}
|
|
6543
6508
|
const amountCents = ctx.opts.amountCents ?? (ctx.opts.amountDollars != null ? ctx.opts.amountDollars * 100 : void 0);
|
|
6544
6509
|
if (amountCents == null) {
|
|
6545
|
-
|
|
6546
|
-
process.exit(1);
|
|
6510
|
+
throw new Error("required: --amount-cents <n> or --amount-dollars <n>");
|
|
6547
6511
|
}
|
|
6548
6512
|
const result = await ctx.client.createInvoice({
|
|
6549
6513
|
entity_id: eid,
|
|
@@ -6605,13 +6569,11 @@ var init_finance = __esm({
|
|
|
6605
6569
|
handler: async (ctx) => {
|
|
6606
6570
|
const eid = await ctx.resolver.resolveEntity(ctx.opts.entityId);
|
|
6607
6571
|
if (ctx.opts.amountCents != null && ctx.opts.amountDollars != null) {
|
|
6608
|
-
|
|
6609
|
-
process.exit(1);
|
|
6572
|
+
throw new Error("--amount-cents and --amount-dollars are mutually exclusive. Use one or the other.");
|
|
6610
6573
|
}
|
|
6611
6574
|
const amountCents = ctx.opts.amountCents ?? (ctx.opts.amountDollars != null ? ctx.opts.amountDollars * 100 : void 0);
|
|
6612
6575
|
if (amountCents == null) {
|
|
6613
|
-
|
|
6614
|
-
process.exit(1);
|
|
6576
|
+
throw new Error("required: --amount-cents <n> or --amount-dollars <n>");
|
|
6615
6577
|
}
|
|
6616
6578
|
const method = ctx.opts.method;
|
|
6617
6579
|
const result = await ctx.client.submitPayment({
|
|
@@ -6923,7 +6885,17 @@ var init_finance = __esm({
|
|
|
6923
6885
|
ctx.writer.json(result);
|
|
6924
6886
|
return;
|
|
6925
6887
|
}
|
|
6926
|
-
|
|
6888
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
6889
|
+
const rec = result;
|
|
6890
|
+
const lines = Object.entries(rec).map(([key, val]) => {
|
|
6891
|
+
const label = key.replace(/_/g, " ").replace(/\b\w/g, (ch) => ch.toUpperCase());
|
|
6892
|
+
const formatted = typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
6893
|
+
return `${label}: ${formatted}`;
|
|
6894
|
+
});
|
|
6895
|
+
ctx.writer.panel("Financial Statements", "green", lines);
|
|
6896
|
+
} else {
|
|
6897
|
+
ctx.writer.json(result);
|
|
6898
|
+
}
|
|
6927
6899
|
},
|
|
6928
6900
|
examples: ["corp finance statements", "corp finance statements --json"]
|
|
6929
6901
|
}
|
|
@@ -7427,7 +7399,7 @@ var init_governance = __esm({
|
|
|
7427
7399
|
}
|
|
7428
7400
|
}
|
|
7429
7401
|
},
|
|
7430
|
-
examples: ["corp governance vote <meeting-ref> <item-ref> --voter
|
|
7402
|
+
examples: ["corp governance vote <meeting-ref> <item-ref> --voter <contact-ref> --vote for"]
|
|
7431
7403
|
},
|
|
7432
7404
|
// --- governance notice <meeting-ref> ---
|
|
7433
7405
|
{
|
|
@@ -7513,7 +7485,7 @@ var init_governance = __esm({
|
|
|
7513
7485
|
dryRun: true,
|
|
7514
7486
|
args: [{ name: "meeting-ref", required: true, description: "Meeting reference" }],
|
|
7515
7487
|
options: [
|
|
7516
|
-
{ flags: "--yes
|
|
7488
|
+
{ flags: "--yes -y", description: "Skip confirmation prompt" }
|
|
7517
7489
|
],
|
|
7518
7490
|
handler: async (ctx) => {
|
|
7519
7491
|
const meetingRef = ctx.positional[0];
|
|
@@ -7886,7 +7858,7 @@ var init_governance = __esm({
|
|
|
7886
7858
|
},
|
|
7887
7859
|
{
|
|
7888
7860
|
name: "governance-bodies create",
|
|
7889
|
-
description: "
|
|
7861
|
+
description: "Create a governance body",
|
|
7890
7862
|
route: { method: "POST", path: "/v1/governance-bodies" },
|
|
7891
7863
|
options: [
|
|
7892
7864
|
{ flags: "--body-type <body-type>", description: "The type of governance body.", required: true, choices: ["board_of_directors", "llc_member_vote"] },
|
|
@@ -7895,7 +7867,7 @@ var init_governance = __esm({
|
|
|
7895
7867
|
{ flags: "--voting-method <voting-method>", description: "How votes are counted.", required: true, choices: ["per_capita", "per_unit"] }
|
|
7896
7868
|
],
|
|
7897
7869
|
examples: ["corp governance-bodies --body-type board_of_directors --name majority --quorum-rule majority --voting-method per_capita"],
|
|
7898
|
-
successTemplate: "Governance
|
|
7870
|
+
successTemplate: "Governance body created"
|
|
7899
7871
|
},
|
|
7900
7872
|
{
|
|
7901
7873
|
name: "governance-seats scan-expired",
|
|
@@ -7903,7 +7875,7 @@ var init_governance = __esm({
|
|
|
7903
7875
|
route: { method: "POST", path: "/v1/governance-seats/scan-expired" },
|
|
7904
7876
|
entity: true,
|
|
7905
7877
|
examples: ["corp governance-seats scan-expired"],
|
|
7906
|
-
successTemplate: "
|
|
7878
|
+
successTemplate: "Expired seats scanned"
|
|
7907
7879
|
},
|
|
7908
7880
|
{
|
|
7909
7881
|
name: "governance-seats resign",
|
|
@@ -7912,7 +7884,7 @@ var init_governance = __esm({
|
|
|
7912
7884
|
entity: true,
|
|
7913
7885
|
args: [{ name: "seat-id", required: true, description: "Governance seat ID" }],
|
|
7914
7886
|
examples: ["corp governance-seats resign <seat-id>"],
|
|
7915
|
-
successTemplate: "
|
|
7887
|
+
successTemplate: "Seat resigned"
|
|
7916
7888
|
},
|
|
7917
7889
|
{
|
|
7918
7890
|
name: "governance audit-checkpoints",
|
|
@@ -8003,7 +7975,7 @@ var init_governance = __esm({
|
|
|
8003
7975
|
{ flags: "--metadata <metadata>", description: "Additional metadata (JSON)" }
|
|
8004
7976
|
],
|
|
8005
7977
|
examples: ["corp governance evaluate --intent-type 'intent-type'", "corp governance evaluate --json"],
|
|
8006
|
-
successTemplate: "
|
|
7978
|
+
successTemplate: "Governance evaluated"
|
|
8007
7979
|
},
|
|
8008
7980
|
{
|
|
8009
7981
|
name: "governance report-incident",
|
|
@@ -8155,12 +8127,10 @@ var init_documents = __esm({
|
|
|
8155
8127
|
try {
|
|
8156
8128
|
resolvedDocumentId = await ctx.resolver.resolveDocument(eid, docRef);
|
|
8157
8129
|
} catch {
|
|
8158
|
-
|
|
8130
|
+
throw new Error(
|
|
8159
8131
|
`Could not resolve '${docRef}' as a document. If you just generated a contract, use the document_id from the generate output, not @last (which may reference the contract_id).
|
|
8160
8132
|
List documents with: corp documents`
|
|
8161
8133
|
);
|
|
8162
|
-
process.exit(1);
|
|
8163
|
-
return;
|
|
8164
8134
|
}
|
|
8165
8135
|
const result = await ctx.client.getSigningLink(resolvedDocumentId, eid);
|
|
8166
8136
|
const shareUrl = formatSigningLink(resolvedDocumentId, result);
|
|
@@ -8307,7 +8277,7 @@ var init_documents = __esm({
|
|
|
8307
8277
|
} catch (err) {
|
|
8308
8278
|
const msg = String(err);
|
|
8309
8279
|
if (template === "employment_offer" && (msg.includes("base_salary") || msg.includes("required"))) {
|
|
8310
|
-
|
|
8280
|
+
throw new Error(
|
|
8311
8281
|
`Failed to generate employment_offer: ${msg}
|
|
8312
8282
|
Hint: employment_offer requires base_salary. Use:
|
|
8313
8283
|
--base-salary 150000
|
|
@@ -8316,16 +8286,15 @@ var init_documents = __esm({
|
|
|
8316
8286
|
bonus_terms, equity_terms, benefits_summary, governing_law`
|
|
8317
8287
|
);
|
|
8318
8288
|
} else if (template === "safe_agreement" && (msg.includes("purchase_amount") || msg.includes("investment_amount") || msg.includes("valuation_cap") || msg.includes("investor_notice") || msg.includes("required"))) {
|
|
8319
|
-
|
|
8289
|
+
throw new Error(
|
|
8320
8290
|
`Failed to generate safe_agreement: ${msg}
|
|
8321
8291
|
Hint: safe_agreement requires purchase_amount, valuation_cap, and investor_notice_address. Use:
|
|
8322
8292
|
--param purchase_amount=50000000 --param valuation_cap=10000000
|
|
8323
8293
|
--param investor_notice_address="123 Main St, City, ST 12345"`
|
|
8324
8294
|
);
|
|
8325
8295
|
} else {
|
|
8326
|
-
|
|
8296
|
+
throw new Error(`Failed to generate contract: ${err}`);
|
|
8327
8297
|
}
|
|
8328
|
-
process.exit(1);
|
|
8329
8298
|
}
|
|
8330
8299
|
},
|
|
8331
8300
|
produces: { kind: "document" },
|
|
@@ -8345,8 +8314,7 @@ var init_documents = __esm({
|
|
|
8345
8314
|
handler: async (ctx) => {
|
|
8346
8315
|
const documentId = ctx.opts.definitionId ?? ctx.opts.documentId;
|
|
8347
8316
|
if (!documentId || documentId.trim().length === 0) {
|
|
8348
|
-
|
|
8349
|
-
process.exit(1);
|
|
8317
|
+
throw new Error("preview-pdf requires --definition-id (or deprecated alias --document-id)");
|
|
8350
8318
|
}
|
|
8351
8319
|
const eid = await ctx.resolver.resolveEntity(ctx.opts.entityId);
|
|
8352
8320
|
await ctx.client.validatePreviewPdf(eid, documentId);
|
|
@@ -8426,7 +8394,7 @@ var init_compliance = __esm({
|
|
|
8426
8394
|
// --- tax filings ---
|
|
8427
8395
|
{
|
|
8428
8396
|
name: "tax filings",
|
|
8429
|
-
description: "
|
|
8397
|
+
description: "List tax filing records",
|
|
8430
8398
|
route: { method: "GET", path: "/v1/entities/{eid}/tax-filings" },
|
|
8431
8399
|
entity: true,
|
|
8432
8400
|
display: {
|
|
@@ -8487,7 +8455,7 @@ var init_compliance = __esm({
|
|
|
8487
8455
|
},
|
|
8488
8456
|
produces: { kind: "tax_filing" },
|
|
8489
8457
|
successTemplate: "Tax filing created",
|
|
8490
|
-
examples: ["corp tax file --year 'year'"]
|
|
8458
|
+
examples: ["corp tax file --type 1120 --year 'year'"]
|
|
8491
8459
|
},
|
|
8492
8460
|
// --- tax deadlines ---
|
|
8493
8461
|
{
|
|
@@ -8559,7 +8527,7 @@ var init_compliance = __esm({
|
|
|
8559
8527
|
description: "Scan for compliance issues and create escalations",
|
|
8560
8528
|
route: { method: "POST", path: "/v1/compliance/escalations/scan" },
|
|
8561
8529
|
examples: ["corp compliance escalations-scan"],
|
|
8562
|
-
successTemplate: "
|
|
8530
|
+
successTemplate: "Escalation scan complete"
|
|
8563
8531
|
},
|
|
8564
8532
|
{
|
|
8565
8533
|
name: "compliance escalations-resolve-with-evidence",
|
|
@@ -8625,7 +8593,7 @@ var init_compliance = __esm({
|
|
|
8625
8593
|
{ flags: "--document-type <document-type>", description: "Type of document required", required: true },
|
|
8626
8594
|
{ flags: "--tax-year <tax-year>", description: "Tax Year", required: true, type: "int" }
|
|
8627
8595
|
],
|
|
8628
|
-
examples: ["corp tax
|
|
8596
|
+
examples: ["corp tax create-filing --document-type 'document-type' --tax-year 'tax-year'"],
|
|
8629
8597
|
successTemplate: "Filings created"
|
|
8630
8598
|
}
|
|
8631
8599
|
];
|
|
@@ -8759,14 +8727,13 @@ var init_agents = __esm({
|
|
|
8759
8727
|
} catch (err) {
|
|
8760
8728
|
const msg = String(err);
|
|
8761
8729
|
if (msg.includes("409") || msg.includes("conflict") || msg.includes("already exists")) {
|
|
8762
|
-
|
|
8730
|
+
throw new Error(
|
|
8763
8731
|
`Agent name '${ctx.opts.name}' is already in use (deleted agents still reserve their name).
|
|
8764
8732
|
Choose a different name, e.g.: corp agents create --name '...-v2' --prompt '...'`
|
|
8765
8733
|
);
|
|
8766
8734
|
} else {
|
|
8767
|
-
|
|
8735
|
+
throw new Error(`Failed to create agent: ${err}`);
|
|
8768
8736
|
}
|
|
8769
|
-
process.exit(1);
|
|
8770
8737
|
}
|
|
8771
8738
|
},
|
|
8772
8739
|
produces: { kind: "agent" },
|
|
@@ -8802,15 +8769,14 @@ var init_agents = __esm({
|
|
|
8802
8769
|
} catch (err) {
|
|
8803
8770
|
const msg = String(err);
|
|
8804
8771
|
if (msg.includes("409") || msg.includes("disabled") || msg.includes("deleted")) {
|
|
8805
|
-
|
|
8772
|
+
throw new Error(
|
|
8806
8773
|
`Cannot resume agent ${agentRef}: the agent may be disabled or deleted.
|
|
8807
8774
|
Disabled/deleted agents cannot be resumed. Create a new agent instead:
|
|
8808
8775
|
corp agents create --name '...' --prompt '...'`
|
|
8809
8776
|
);
|
|
8810
8777
|
} else {
|
|
8811
|
-
|
|
8778
|
+
throw new Error(`Failed to resume agent: ${err}`);
|
|
8812
8779
|
}
|
|
8813
|
-
process.exit(1);
|
|
8814
8780
|
}
|
|
8815
8781
|
},
|
|
8816
8782
|
examples: ["corp agents resume <agent-ref>"]
|
|
@@ -8822,7 +8788,7 @@ var init_agents = __esm({
|
|
|
8822
8788
|
route: { method: "DELETE", path: "/v1/agents/{pos}" },
|
|
8823
8789
|
args: [{ name: "agent-ref", required: true, description: "Agent reference" }],
|
|
8824
8790
|
options: [
|
|
8825
|
-
{ flags: "--yes
|
|
8791
|
+
{ flags: "--yes -y", description: "Skip confirmation prompt" }
|
|
8826
8792
|
],
|
|
8827
8793
|
handler: async (ctx) => {
|
|
8828
8794
|
const agentRef = ctx.positional[0];
|
|
@@ -8862,14 +8828,13 @@ var init_agents = __esm({
|
|
|
8862
8828
|
} catch (err) {
|
|
8863
8829
|
const msg = String(err);
|
|
8864
8830
|
if (msg.includes("409")) {
|
|
8865
|
-
|
|
8831
|
+
throw new Error(
|
|
8866
8832
|
`Cannot message agent: the agent must be active or paused (not disabled/deleted).
|
|
8867
8833
|
Check agent status: corp agents show ` + agentRef + "\n Resume a paused agent: corp agents resume " + agentRef
|
|
8868
8834
|
);
|
|
8869
8835
|
} else {
|
|
8870
|
-
|
|
8836
|
+
throw new Error(`Failed to send message: ${err}`);
|
|
8871
8837
|
}
|
|
8872
|
-
process.exit(1);
|
|
8873
8838
|
}
|
|
8874
8839
|
},
|
|
8875
8840
|
examples: ["corp agents message <agent-ref>", "corp agents message --json"]
|
|
@@ -9129,8 +9094,7 @@ var init_work_items = __esm({
|
|
|
9129
9094
|
const eid = await ctx.resolver.resolveEntity(ctx.opts.entityId);
|
|
9130
9095
|
const category = ctx.opts.category;
|
|
9131
9096
|
if (!category) {
|
|
9132
|
-
|
|
9133
|
-
process.exit(1);
|
|
9097
|
+
throw new Error("required option '--category <category>' not specified");
|
|
9134
9098
|
}
|
|
9135
9099
|
const data = { title: ctx.opts.title, category };
|
|
9136
9100
|
if (ctx.opts.description) data.description = ctx.opts.description;
|
|
@@ -9168,8 +9132,7 @@ var init_work_items = __esm({
|
|
|
9168
9132
|
const resolvedWorkItemId = await ctx.resolver.resolveWorkItem(eid, itemRef);
|
|
9169
9133
|
const claimedBy = ctx.opts.by ?? ctx.opts.claimer;
|
|
9170
9134
|
if (!claimedBy) {
|
|
9171
|
-
|
|
9172
|
-
process.exit(1);
|
|
9135
|
+
throw new Error("required option '--by <name>' not specified");
|
|
9173
9136
|
}
|
|
9174
9137
|
const data = {
|
|
9175
9138
|
claimed_by_actor: await ctx.resolver.resolveWorkItemActor(eid, claimedBy)
|
|
@@ -9199,8 +9162,7 @@ var init_work_items = __esm({
|
|
|
9199
9162
|
const resolvedWorkItemId = await ctx.resolver.resolveWorkItem(eid, itemRef);
|
|
9200
9163
|
const completedBy = ctx.opts.by ?? ctx.opts.completedBy;
|
|
9201
9164
|
if (!completedBy) {
|
|
9202
|
-
|
|
9203
|
-
process.exit(1);
|
|
9165
|
+
throw new Error("required option '--by <name>' not specified");
|
|
9204
9166
|
}
|
|
9205
9167
|
const data = {
|
|
9206
9168
|
completed_by_actor: await ctx.resolver.resolveWorkItemActor(eid, completedBy)
|
|
@@ -9236,7 +9198,7 @@ var init_work_items = __esm({
|
|
|
9236
9198
|
entity: true,
|
|
9237
9199
|
args: [{ name: "item-ref", required: true, description: "Work item reference" }],
|
|
9238
9200
|
options: [
|
|
9239
|
-
{ flags: "--yes
|
|
9201
|
+
{ flags: "--yes -y", description: "Skip confirmation prompt" }
|
|
9240
9202
|
],
|
|
9241
9203
|
handler: async (ctx) => {
|
|
9242
9204
|
const itemRef = ctx.positional[0];
|
|
@@ -9289,25 +9251,6 @@ var init_services = __esm({
|
|
|
9289
9251
|
},
|
|
9290
9252
|
examples: ["corp services", "corp services --json"]
|
|
9291
9253
|
},
|
|
9292
|
-
// --- services catalog ---
|
|
9293
|
-
{
|
|
9294
|
-
name: "services catalog",
|
|
9295
|
-
description: "List the service catalog",
|
|
9296
|
-
route: { method: "GET", path: "/v1/services/catalog" },
|
|
9297
|
-
display: {
|
|
9298
|
-
title: "Service Catalog",
|
|
9299
|
-
cols: ["name>Name", "slug>Slug", "$price_cents>Price", "#service_id|id>ID"]
|
|
9300
|
-
},
|
|
9301
|
-
handler: async (ctx) => {
|
|
9302
|
-
const items = await ctx.client.listServiceCatalog();
|
|
9303
|
-
if (ctx.opts.json) {
|
|
9304
|
-
ctx.writer.json(items);
|
|
9305
|
-
return;
|
|
9306
|
-
}
|
|
9307
|
-
printServiceCatalogTable(items);
|
|
9308
|
-
},
|
|
9309
|
-
examples: ["corp services catalog"]
|
|
9310
|
-
},
|
|
9311
9254
|
// --- services list ---
|
|
9312
9255
|
{
|
|
9313
9256
|
name: "services list",
|
|
@@ -9470,7 +9413,7 @@ var init_services = __esm({
|
|
|
9470
9413
|
},
|
|
9471
9414
|
{
|
|
9472
9415
|
name: "services requests",
|
|
9473
|
-
description: "
|
|
9416
|
+
description: "View a service request by ID",
|
|
9474
9417
|
route: { method: "GET", path: "/v1/services/requests/{pos}" },
|
|
9475
9418
|
entity: true,
|
|
9476
9419
|
args: [{ name: "request-id", required: true, description: "Document request ID", posKind: "service_request" }],
|
|
@@ -9483,7 +9426,7 @@ var init_services = __esm({
|
|
|
9483
9426
|
route: { method: "POST", path: "/v1/services/requests/{pos}/cancel" },
|
|
9484
9427
|
args: [{ name: "request-id", required: true, description: "Document request ID", posKind: "service_request" }],
|
|
9485
9428
|
examples: ["corp services requests-cancel <request-id>"],
|
|
9486
|
-
successTemplate: "
|
|
9429
|
+
successTemplate: "Request cancelled"
|
|
9487
9430
|
},
|
|
9488
9431
|
{
|
|
9489
9432
|
name: "services requests-checkout",
|
|
@@ -9491,7 +9434,7 @@ var init_services = __esm({
|
|
|
9491
9434
|
route: { method: "POST", path: "/v1/services/requests/{pos}/checkout" },
|
|
9492
9435
|
args: [{ name: "request-id", required: true, description: "Document request ID", posKind: "service_request" }],
|
|
9493
9436
|
examples: ["corp services requests-checkout <request-id>"],
|
|
9494
|
-
successTemplate: "
|
|
9437
|
+
successTemplate: "Checkout started"
|
|
9495
9438
|
},
|
|
9496
9439
|
{
|
|
9497
9440
|
name: "services requests-fulfill",
|
|
@@ -9822,7 +9765,7 @@ async function serveCommand(opts) {
|
|
|
9822
9765
|
process.exit(1);
|
|
9823
9766
|
}
|
|
9824
9767
|
const port = parseInt(opts.port, 10);
|
|
9825
|
-
if (isNaN(port) || port > 65535) {
|
|
9768
|
+
if (isNaN(port) || port < 1 || port > 65535) {
|
|
9826
9769
|
console.error(`Error: Invalid port "${opts.port}"`);
|
|
9827
9770
|
process.exit(1);
|
|
9828
9771
|
}
|
|
@@ -10096,7 +10039,7 @@ async function demoCommand(opts) {
|
|
|
10096
10039
|
entity_id: entityId,
|
|
10097
10040
|
template_type: "nda",
|
|
10098
10041
|
counterparty_name: "Example Counterparty",
|
|
10099
|
-
effective_date:
|
|
10042
|
+
effective_date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
10100
10043
|
parameters: {}
|
|
10101
10044
|
});
|
|
10102
10045
|
await resolver.stabilizeRecord("document", contract, entityId);
|
|
@@ -10615,6 +10558,66 @@ var init_feedback = __esm({
|
|
|
10615
10558
|
}
|
|
10616
10559
|
});
|
|
10617
10560
|
|
|
10561
|
+
// src/resource-kinds.ts
|
|
10562
|
+
var KINDS, ENTITY_SCOPED_KINDS;
|
|
10563
|
+
var init_resource_kinds = __esm({
|
|
10564
|
+
"src/resource-kinds.ts"() {
|
|
10565
|
+
"use strict";
|
|
10566
|
+
KINDS = /* @__PURE__ */ new Set([
|
|
10567
|
+
"entity",
|
|
10568
|
+
"contact",
|
|
10569
|
+
"share_transfer",
|
|
10570
|
+
"invoice",
|
|
10571
|
+
"bank_account",
|
|
10572
|
+
"payment",
|
|
10573
|
+
"payroll_run",
|
|
10574
|
+
"distribution",
|
|
10575
|
+
"reconciliation",
|
|
10576
|
+
"tax_filing",
|
|
10577
|
+
"deadline",
|
|
10578
|
+
"classification",
|
|
10579
|
+
"body",
|
|
10580
|
+
"meeting",
|
|
10581
|
+
"seat",
|
|
10582
|
+
"agenda_item",
|
|
10583
|
+
"resolution",
|
|
10584
|
+
"document",
|
|
10585
|
+
"work_item",
|
|
10586
|
+
"agent",
|
|
10587
|
+
"valuation",
|
|
10588
|
+
"safe_note",
|
|
10589
|
+
"instrument",
|
|
10590
|
+
"share_class",
|
|
10591
|
+
"round"
|
|
10592
|
+
]);
|
|
10593
|
+
ENTITY_SCOPED_KINDS = /* @__PURE__ */ new Set([
|
|
10594
|
+
"contact",
|
|
10595
|
+
"share_transfer",
|
|
10596
|
+
"invoice",
|
|
10597
|
+
"bank_account",
|
|
10598
|
+
"payment",
|
|
10599
|
+
"payroll_run",
|
|
10600
|
+
"distribution",
|
|
10601
|
+
"reconciliation",
|
|
10602
|
+
"tax_filing",
|
|
10603
|
+
"deadline",
|
|
10604
|
+
"classification",
|
|
10605
|
+
"body",
|
|
10606
|
+
"meeting",
|
|
10607
|
+
"seat",
|
|
10608
|
+
"agenda_item",
|
|
10609
|
+
"resolution",
|
|
10610
|
+
"document",
|
|
10611
|
+
"work_item",
|
|
10612
|
+
"valuation",
|
|
10613
|
+
"safe_note",
|
|
10614
|
+
"instrument",
|
|
10615
|
+
"share_class",
|
|
10616
|
+
"round"
|
|
10617
|
+
]);
|
|
10618
|
+
}
|
|
10619
|
+
});
|
|
10620
|
+
|
|
10618
10621
|
// src/commands/resolve.ts
|
|
10619
10622
|
var resolve_exports = {};
|
|
10620
10623
|
__export(resolve_exports, {
|
|
@@ -10721,7 +10724,7 @@ async function resolveCommand(kind, ref, opts) {
|
|
|
10721
10724
|
kind: normalizedKind,
|
|
10722
10725
|
input: ref,
|
|
10723
10726
|
resolved_id: resolvedId,
|
|
10724
|
-
short_id:
|
|
10727
|
+
short_id: shortId(resolvedId),
|
|
10725
10728
|
...entityId ? { entity_id: entityId } : {},
|
|
10726
10729
|
...bodyId ? { body_id: bodyId } : {},
|
|
10727
10730
|
...meetingId ? { meeting_id: meetingId } : {}
|
|
@@ -10743,7 +10746,6 @@ function requiredMeeting(meetingId, kind) {
|
|
|
10743
10746
|
}
|
|
10744
10747
|
return meetingId;
|
|
10745
10748
|
}
|
|
10746
|
-
var KINDS, ENTITY_SCOPED_KINDS;
|
|
10747
10749
|
var init_resolve = __esm({
|
|
10748
10750
|
"src/commands/resolve.ts"() {
|
|
10749
10751
|
"use strict";
|
|
@@ -10751,58 +10753,7 @@ var init_resolve = __esm({
|
|
|
10751
10753
|
init_api_client();
|
|
10752
10754
|
init_output();
|
|
10753
10755
|
init_references();
|
|
10754
|
-
|
|
10755
|
-
"entity",
|
|
10756
|
-
"contact",
|
|
10757
|
-
"share_transfer",
|
|
10758
|
-
"invoice",
|
|
10759
|
-
"bank_account",
|
|
10760
|
-
"payment",
|
|
10761
|
-
"payroll_run",
|
|
10762
|
-
"distribution",
|
|
10763
|
-
"reconciliation",
|
|
10764
|
-
"tax_filing",
|
|
10765
|
-
"deadline",
|
|
10766
|
-
"classification",
|
|
10767
|
-
"body",
|
|
10768
|
-
"meeting",
|
|
10769
|
-
"seat",
|
|
10770
|
-
"agenda_item",
|
|
10771
|
-
"resolution",
|
|
10772
|
-
"document",
|
|
10773
|
-
"work_item",
|
|
10774
|
-
"agent",
|
|
10775
|
-
"valuation",
|
|
10776
|
-
"safe_note",
|
|
10777
|
-
"instrument",
|
|
10778
|
-
"share_class",
|
|
10779
|
-
"round"
|
|
10780
|
-
]);
|
|
10781
|
-
ENTITY_SCOPED_KINDS = /* @__PURE__ */ new Set([
|
|
10782
|
-
"contact",
|
|
10783
|
-
"share_transfer",
|
|
10784
|
-
"invoice",
|
|
10785
|
-
"bank_account",
|
|
10786
|
-
"payment",
|
|
10787
|
-
"payroll_run",
|
|
10788
|
-
"distribution",
|
|
10789
|
-
"reconciliation",
|
|
10790
|
-
"tax_filing",
|
|
10791
|
-
"deadline",
|
|
10792
|
-
"classification",
|
|
10793
|
-
"body",
|
|
10794
|
-
"meeting",
|
|
10795
|
-
"seat",
|
|
10796
|
-
"agenda_item",
|
|
10797
|
-
"resolution",
|
|
10798
|
-
"document",
|
|
10799
|
-
"work_item",
|
|
10800
|
-
"valuation",
|
|
10801
|
-
"safe_note",
|
|
10802
|
-
"instrument",
|
|
10803
|
-
"share_class",
|
|
10804
|
-
"round"
|
|
10805
|
-
]);
|
|
10756
|
+
init_resource_kinds();
|
|
10806
10757
|
}
|
|
10807
10758
|
});
|
|
10808
10759
|
|
|
@@ -10815,7 +10766,7 @@ import chalk14 from "chalk";
|
|
|
10815
10766
|
import Table5 from "cli-table3";
|
|
10816
10767
|
async function findCommand(kind, query, opts) {
|
|
10817
10768
|
const normalizedKind = kind.trim().toLowerCase();
|
|
10818
|
-
if (!
|
|
10769
|
+
if (!KINDS.has(normalizedKind)) {
|
|
10819
10770
|
printError(`Unsupported find kind: ${kind}`);
|
|
10820
10771
|
process.exit(1);
|
|
10821
10772
|
}
|
|
@@ -10823,7 +10774,7 @@ async function findCommand(kind, query, opts) {
|
|
|
10823
10774
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
10824
10775
|
const resolver = new ReferenceResolver(client, cfg);
|
|
10825
10776
|
try {
|
|
10826
|
-
const entityId =
|
|
10777
|
+
const entityId = ENTITY_SCOPED_KINDS.has(normalizedKind) || opts.entityId || opts.bodyId || opts.meetingId ? await resolver.resolveEntity(opts.entityId) : void 0;
|
|
10827
10778
|
const bodyId = entityId && opts.bodyId ? await resolver.resolveBody(entityId, opts.bodyId) : void 0;
|
|
10828
10779
|
const meetingId = entityId && opts.meetingId ? await resolver.resolveMeeting(entityId, opts.meetingId, bodyId) : void 0;
|
|
10829
10780
|
const matches = await resolver.find(normalizedKind, query, { entityId, bodyId, meetingId });
|
|
@@ -10870,7 +10821,6 @@ async function findCommand(kind, query, opts) {
|
|
|
10870
10821
|
process.exit(1);
|
|
10871
10822
|
}
|
|
10872
10823
|
}
|
|
10873
|
-
var KINDS2, ENTITY_SCOPED_KINDS2;
|
|
10874
10824
|
var init_find = __esm({
|
|
10875
10825
|
"src/commands/find.ts"() {
|
|
10876
10826
|
"use strict";
|
|
@@ -10878,58 +10828,7 @@ var init_find = __esm({
|
|
|
10878
10828
|
init_api_client();
|
|
10879
10829
|
init_output();
|
|
10880
10830
|
init_references();
|
|
10881
|
-
|
|
10882
|
-
"entity",
|
|
10883
|
-
"contact",
|
|
10884
|
-
"share_transfer",
|
|
10885
|
-
"invoice",
|
|
10886
|
-
"bank_account",
|
|
10887
|
-
"payment",
|
|
10888
|
-
"payroll_run",
|
|
10889
|
-
"distribution",
|
|
10890
|
-
"reconciliation",
|
|
10891
|
-
"tax_filing",
|
|
10892
|
-
"deadline",
|
|
10893
|
-
"classification",
|
|
10894
|
-
"body",
|
|
10895
|
-
"meeting",
|
|
10896
|
-
"seat",
|
|
10897
|
-
"agenda_item",
|
|
10898
|
-
"resolution",
|
|
10899
|
-
"document",
|
|
10900
|
-
"work_item",
|
|
10901
|
-
"agent",
|
|
10902
|
-
"valuation",
|
|
10903
|
-
"safe_note",
|
|
10904
|
-
"instrument",
|
|
10905
|
-
"share_class",
|
|
10906
|
-
"round"
|
|
10907
|
-
]);
|
|
10908
|
-
ENTITY_SCOPED_KINDS2 = /* @__PURE__ */ new Set([
|
|
10909
|
-
"contact",
|
|
10910
|
-
"share_transfer",
|
|
10911
|
-
"invoice",
|
|
10912
|
-
"bank_account",
|
|
10913
|
-
"payment",
|
|
10914
|
-
"payroll_run",
|
|
10915
|
-
"distribution",
|
|
10916
|
-
"reconciliation",
|
|
10917
|
-
"tax_filing",
|
|
10918
|
-
"deadline",
|
|
10919
|
-
"classification",
|
|
10920
|
-
"body",
|
|
10921
|
-
"meeting",
|
|
10922
|
-
"seat",
|
|
10923
|
-
"agenda_item",
|
|
10924
|
-
"resolution",
|
|
10925
|
-
"document",
|
|
10926
|
-
"work_item",
|
|
10927
|
-
"valuation",
|
|
10928
|
-
"safe_note",
|
|
10929
|
-
"instrument",
|
|
10930
|
-
"share_class",
|
|
10931
|
-
"round"
|
|
10932
|
-
]);
|
|
10831
|
+
init_resource_kinds();
|
|
10933
10832
|
}
|
|
10934
10833
|
});
|
|
10935
10834
|
|
|
@@ -11273,7 +11172,7 @@ var init_admin = __esm({
|
|
|
11273
11172
|
process.stderr.write(
|
|
11274
11173
|
'Approvals are managed through governance meetings and execution intents.\nUse these commands to manage approvals:\n\n Board approval via meeting vote:\n corp governance convene --body <body> --type board_meeting --title "Approve X"\n corp governance vote <meeting> <item> --voter <contact> --vote for\n\n Written consent (no meeting needed):\n corp governance written-consent --body <body> --title "Approve X" --description "..."\n\n View pending items:\n corp governance meetings <body> # see scheduled meetings\n corp governance agenda-items <meeting> # see items awaiting votes\n corp cap-table valuations # see pending valuations\n'
|
|
11275
11174
|
);
|
|
11276
|
-
process.exit(
|
|
11175
|
+
process.exit(0);
|
|
11277
11176
|
},
|
|
11278
11177
|
examples: ["corp approvals"]
|
|
11279
11178
|
},
|
|
@@ -11401,7 +11300,7 @@ var init_admin = __esm({
|
|
|
11401
11300
|
{ flags: "--ttl-seconds <ttl-seconds>", description: "Token TTL in seconds (60-86400)", type: "int" }
|
|
11402
11301
|
],
|
|
11403
11302
|
examples: ["corp auth token-exchange --api-key 'api-key'", "corp auth token-exchange --json"],
|
|
11404
|
-
successTemplate: "Token
|
|
11303
|
+
successTemplate: "Token exchanged"
|
|
11405
11304
|
},
|
|
11406
11305
|
{
|
|
11407
11306
|
name: "ssh-keys",
|
|
@@ -11453,7 +11352,7 @@ var init_admin = __esm({
|
|
|
11453
11352
|
{ flags: "--kind <kind>", description: "Resource kind", required: true, choices: ["entity", "contact", "share_transfer", "invoice", "bank_account", "payment", "payroll_run", "distribution", "reconciliation", "tax_filing", "deadline", "classification", "body", "meeting", "seat", "agenda_item", "resolution", "document", "work_item", "agent", "valuation", "safe_note", "instrument", "share_class", "round"] }
|
|
11454
11353
|
],
|
|
11455
11354
|
examples: ["corp references sync --items 'items' --kind 'kind'"],
|
|
11456
|
-
successTemplate: "
|
|
11355
|
+
successTemplate: "References synced"
|
|
11457
11356
|
},
|
|
11458
11357
|
// ── Auto-generated from OpenAPI ──────────────────────────────
|
|
11459
11358
|
{
|
|
@@ -11625,7 +11524,7 @@ var init_execution = __esm({
|
|
|
11625
11524
|
entity: true,
|
|
11626
11525
|
args: [{ name: "intent-id", required: true, description: "Execution intent ID" }],
|
|
11627
11526
|
examples: ["corp intents authorize <intent-id>"],
|
|
11628
|
-
successTemplate: "
|
|
11527
|
+
successTemplate: "Intent authorized"
|
|
11629
11528
|
},
|
|
11630
11529
|
{
|
|
11631
11530
|
name: "intents bind-approval-artifact",
|
|
@@ -11656,7 +11555,7 @@ var init_execution = __esm({
|
|
|
11656
11555
|
entity: true,
|
|
11657
11556
|
args: [{ name: "intent-id", required: true, description: "Execution intent ID" }],
|
|
11658
11557
|
examples: ["corp intents cancel <intent-id>"],
|
|
11659
|
-
successTemplate: "
|
|
11558
|
+
successTemplate: "Intent cancelled"
|
|
11660
11559
|
},
|
|
11661
11560
|
{
|
|
11662
11561
|
name: "intents evaluate",
|
|
@@ -11665,7 +11564,7 @@ var init_execution = __esm({
|
|
|
11665
11564
|
entity: true,
|
|
11666
11565
|
args: [{ name: "intent-id", required: true, description: "Execution intent ID" }],
|
|
11667
11566
|
examples: ["corp intents evaluate <intent-id>"],
|
|
11668
|
-
successTemplate: "
|
|
11567
|
+
successTemplate: "Intent evaluated"
|
|
11669
11568
|
},
|
|
11670
11569
|
{
|
|
11671
11570
|
name: "intents execute",
|
|
@@ -11674,7 +11573,7 @@ var init_execution = __esm({
|
|
|
11674
11573
|
entity: true,
|
|
11675
11574
|
args: [{ name: "intent-id", required: true, description: "Execution intent ID" }],
|
|
11676
11575
|
examples: ["corp intents execute <intent-id>"],
|
|
11677
|
-
successTemplate: "
|
|
11576
|
+
successTemplate: "Intent executed"
|
|
11678
11577
|
},
|
|
11679
11578
|
{
|
|
11680
11579
|
name: "intents receipts",
|
|
@@ -11699,7 +11598,7 @@ var init_execution = __esm({
|
|
|
11699
11598
|
},
|
|
11700
11599
|
{
|
|
11701
11600
|
name: "obligations document-requests",
|
|
11702
|
-
description: "List
|
|
11601
|
+
description: "List document requests for an obligation",
|
|
11703
11602
|
route: { method: "GET", path: "/v1/obligations/{pos}/document-requests" },
|
|
11704
11603
|
entity: true,
|
|
11705
11604
|
args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
|
|
@@ -11708,7 +11607,7 @@ var init_execution = __esm({
|
|
|
11708
11607
|
},
|
|
11709
11608
|
{
|
|
11710
11609
|
name: "obligations create-document-request",
|
|
11711
|
-
description: "
|
|
11610
|
+
description: "Create a document request for an obligation",
|
|
11712
11611
|
route: { method: "POST", path: "/v1/obligations/{pos}/document-requests" },
|
|
11713
11612
|
entity: true,
|
|
11714
11613
|
args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
|
|
@@ -11726,7 +11625,7 @@ var init_execution = __esm({
|
|
|
11726
11625
|
entity: true,
|
|
11727
11626
|
args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
|
|
11728
11627
|
examples: ["corp obligations expire <obligation-id>"],
|
|
11729
|
-
successTemplate: "
|
|
11628
|
+
successTemplate: "Obligation expired"
|
|
11730
11629
|
},
|
|
11731
11630
|
{
|
|
11732
11631
|
name: "obligations fulfill",
|
|
@@ -11735,7 +11634,7 @@ var init_execution = __esm({
|
|
|
11735
11634
|
entity: true,
|
|
11736
11635
|
args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
|
|
11737
11636
|
examples: ["corp obligations fulfill <obligation-id>"],
|
|
11738
|
-
successTemplate: "
|
|
11637
|
+
successTemplate: "Obligation fulfilled"
|
|
11739
11638
|
},
|
|
11740
11639
|
{
|
|
11741
11640
|
name: "obligations waive",
|
|
@@ -11744,7 +11643,7 @@ var init_execution = __esm({
|
|
|
11744
11643
|
entity: true,
|
|
11745
11644
|
args: [{ name: "obligation-id", required: true, description: "Obligation ID" }],
|
|
11746
11645
|
examples: ["corp obligations waive <obligation-id>"],
|
|
11747
|
-
successTemplate: "
|
|
11646
|
+
successTemplate: "Obligation waived"
|
|
11748
11647
|
},
|
|
11749
11648
|
{
|
|
11750
11649
|
name: "receipts",
|
|
@@ -11864,7 +11763,7 @@ var init_treasury = __esm({
|
|
|
11864
11763
|
entity: true,
|
|
11865
11764
|
args: [{ name: "bank-account-id", required: true, description: "Bank account ID", posKind: "bank_account" }],
|
|
11866
11765
|
examples: ["corp bank-accounts close <bank-account-id>"],
|
|
11867
|
-
successTemplate: "
|
|
11766
|
+
successTemplate: "Account closed"
|
|
11868
11767
|
},
|
|
11869
11768
|
{
|
|
11870
11769
|
name: "distributions",
|
|
@@ -11926,7 +11825,7 @@ var init_treasury = __esm({
|
|
|
11926
11825
|
},
|
|
11927
11826
|
{
|
|
11928
11827
|
name: "invoices",
|
|
11929
|
-
description: "
|
|
11828
|
+
description: "View an invoice by ID",
|
|
11930
11829
|
route: { method: "GET", path: "/v1/invoices/{pos}" },
|
|
11931
11830
|
entity: true,
|
|
11932
11831
|
args: [{ name: "invoice-id", required: true, description: "Invoice ID", posKind: "invoice" }],
|
|
@@ -11940,7 +11839,7 @@ var init_treasury = __esm({
|
|
|
11940
11839
|
entity: true,
|
|
11941
11840
|
args: [{ name: "invoice-id", required: true, description: "Invoice ID", posKind: "invoice" }],
|
|
11942
11841
|
examples: ["corp invoices mark-paid <invoice-id>"],
|
|
11943
|
-
successTemplate: "
|
|
11842
|
+
successTemplate: "Invoice marked as paid"
|
|
11944
11843
|
},
|
|
11945
11844
|
{
|
|
11946
11845
|
name: "invoices pay-instructions",
|
|
@@ -11958,7 +11857,7 @@ var init_treasury = __esm({
|
|
|
11958
11857
|
entity: true,
|
|
11959
11858
|
args: [{ name: "invoice-id", required: true, description: "Invoice ID", posKind: "invoice" }],
|
|
11960
11859
|
examples: ["corp invoices send <invoice-id>"],
|
|
11961
|
-
successTemplate: "
|
|
11860
|
+
successTemplate: "Invoice sent"
|
|
11962
11861
|
},
|
|
11963
11862
|
{
|
|
11964
11863
|
name: "invoices status",
|
|
@@ -11976,7 +11875,7 @@ var init_treasury = __esm({
|
|
|
11976
11875
|
entity: true,
|
|
11977
11876
|
args: [{ name: "entry-id", required: true, description: "Journal entry ID" }],
|
|
11978
11877
|
examples: ["corp journal-entries post <entry-id>"],
|
|
11979
|
-
successTemplate: "
|
|
11878
|
+
successTemplate: "Journal entry posted"
|
|
11980
11879
|
},
|
|
11981
11880
|
{
|
|
11982
11881
|
name: "journal-entries void",
|
|
@@ -11985,7 +11884,7 @@ var init_treasury = __esm({
|
|
|
11985
11884
|
entity: true,
|
|
11986
11885
|
args: [{ name: "entry-id", required: true, description: "Journal entry ID" }],
|
|
11987
11886
|
examples: ["corp journal-entries void <entry-id>"],
|
|
11988
|
-
successTemplate: "
|
|
11887
|
+
successTemplate: "Journal entry voided"
|
|
11989
11888
|
},
|
|
11990
11889
|
{
|
|
11991
11890
|
name: "ledger reconcile",
|
|
@@ -12026,7 +11925,7 @@ var init_treasury = __esm({
|
|
|
12026
11925
|
{ flags: "--recipient <recipient>", description: "Recipient", required: true }
|
|
12027
11926
|
],
|
|
12028
11927
|
examples: ["corp payments execute --amount-cents 'amount-cents' --description bank_transfer --recipient 'recipient'", "corp payments execute --json"],
|
|
12029
|
-
successTemplate: "
|
|
11928
|
+
successTemplate: "Payment executed"
|
|
12030
11929
|
},
|
|
12031
11930
|
{
|
|
12032
11931
|
name: "payroll runs",
|
|
@@ -12038,7 +11937,7 @@ var init_treasury = __esm({
|
|
|
12038
11937
|
{ flags: "--pay-period-start <pay-period-start>", description: "Pay Period Start", required: true }
|
|
12039
11938
|
],
|
|
12040
11939
|
examples: ["corp payroll runs --pay-period-end 'pay-period-end' --pay-period-start 'pay-period-start'"],
|
|
12041
|
-
successTemplate: "
|
|
11940
|
+
successTemplate: "Payroll run created"
|
|
12042
11941
|
},
|
|
12043
11942
|
{
|
|
12044
11943
|
name: "spending-limits",
|
|
@@ -12143,7 +12042,7 @@ var init_treasury = __esm({
|
|
|
12143
12042
|
route: { method: "POST", path: "/v1/treasury/seed-chart-of-accounts" },
|
|
12144
12043
|
entity: true,
|
|
12145
12044
|
options: [
|
|
12146
|
-
{ flags: "--template <template>", description: "
|
|
12045
|
+
{ flags: "--template <template>", description: "Chart of accounts template name to seed from" }
|
|
12147
12046
|
],
|
|
12148
12047
|
examples: ["corp treasury seed-chart-of-accounts", "corp treasury seed-chart-of-accounts --json"],
|
|
12149
12048
|
successTemplate: "Seed Chart Of Accounts created"
|
|
@@ -12403,28 +12302,9 @@ import { createRequire } from "module";
|
|
|
12403
12302
|
import { Command, Option } from "commander";
|
|
12404
12303
|
|
|
12405
12304
|
// src/generic-executor.ts
|
|
12305
|
+
init_references();
|
|
12306
|
+
init_output();
|
|
12406
12307
|
init_spinner();
|
|
12407
|
-
function s(val, maxLen) {
|
|
12408
|
-
const str = val == null ? "" : String(val);
|
|
12409
|
-
if (maxLen && str.length > maxLen) return str.slice(0, maxLen);
|
|
12410
|
-
return str;
|
|
12411
|
-
}
|
|
12412
|
-
function money(val) {
|
|
12413
|
-
if (typeof val === "number") {
|
|
12414
|
-
const dollars = val / 100;
|
|
12415
|
-
return `$${dollars.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
12416
|
-
}
|
|
12417
|
-
return s(val);
|
|
12418
|
-
}
|
|
12419
|
-
function fmtDate(val) {
|
|
12420
|
-
const str = s(val);
|
|
12421
|
-
if (!str) return "";
|
|
12422
|
-
const parsed = new Date(str);
|
|
12423
|
-
return Number.isNaN(parsed.getTime()) ? str : parsed.toISOString().slice(0, 10);
|
|
12424
|
-
}
|
|
12425
|
-
function shortId(val) {
|
|
12426
|
-
return val.length > 8 ? val.slice(0, 8) + "\u2026" : val;
|
|
12427
|
-
}
|
|
12428
12308
|
function parseCol(spec) {
|
|
12429
12309
|
let fmt = null;
|
|
12430
12310
|
let rest = spec;
|
|
@@ -12450,7 +12330,7 @@ function getField(obj, keys) {
|
|
|
12450
12330
|
function fmtField(val, fmt) {
|
|
12451
12331
|
if (val == null) return "";
|
|
12452
12332
|
if (fmt === "money") return money(val);
|
|
12453
|
-
if (fmt === "date") return
|
|
12333
|
+
if (fmt === "date") return date(val);
|
|
12454
12334
|
if (fmt === "id") return shortId(String(val));
|
|
12455
12335
|
return String(val);
|
|
12456
12336
|
}
|
|
@@ -12505,7 +12385,7 @@ function displayPanel(data, title, ctx) {
|
|
|
12505
12385
|
const label = k.replace(/_/g, " ").replace(/\b\w/g, (ch) => ch.toUpperCase());
|
|
12506
12386
|
let formatted;
|
|
12507
12387
|
if (k.endsWith("_cents") && typeof v === "number") formatted = money(v);
|
|
12508
|
-
else if ((k.includes("date") || k.endsWith("_at")) && v) formatted =
|
|
12388
|
+
else if ((k.includes("date") || k.endsWith("_at")) && v) formatted = date(v);
|
|
12509
12389
|
else if (k.endsWith("_id")) formatted = shortId(String(v));
|
|
12510
12390
|
else formatted = String(v);
|
|
12511
12391
|
return `${label}: ${formatted}`;
|