@thecorporation/cli 26.3.14 → 26.3.17
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 +1200 -308
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -141,6 +141,7 @@ __export(output_exports, {
|
|
|
141
141
|
printCapTable: () => printCapTable,
|
|
142
142
|
printContactsTable: () => printContactsTable,
|
|
143
143
|
printDocumentsTable: () => printDocumentsTable,
|
|
144
|
+
printDryRun: () => printDryRun,
|
|
144
145
|
printEntitiesTable: () => printEntitiesTable,
|
|
145
146
|
printError: () => printError,
|
|
146
147
|
printGovernanceTable: () => printGovernanceTable,
|
|
@@ -155,7 +156,8 @@ __export(output_exports, {
|
|
|
155
156
|
printTransfersTable: () => printTransfersTable,
|
|
156
157
|
printValuationsTable: () => printValuationsTable,
|
|
157
158
|
printWarning: () => printWarning,
|
|
158
|
-
printWorkItemsTable: () => printWorkItemsTable
|
|
159
|
+
printWorkItemsTable: () => printWorkItemsTable,
|
|
160
|
+
printWriteResult: () => printWriteResult
|
|
159
161
|
});
|
|
160
162
|
import chalk from "chalk";
|
|
161
163
|
import Table from "cli-table3";
|
|
@@ -171,6 +173,21 @@ function printWarning(msg) {
|
|
|
171
173
|
function printJson(data) {
|
|
172
174
|
console.log(JSON.stringify(data, null, 2));
|
|
173
175
|
}
|
|
176
|
+
function printDryRun(operation, payload) {
|
|
177
|
+
printJson({
|
|
178
|
+
dry_run: true,
|
|
179
|
+
operation,
|
|
180
|
+
payload
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function printWriteResult(result, successMessage, jsonOnly) {
|
|
184
|
+
if (jsonOnly) {
|
|
185
|
+
printJson(result);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
printSuccess(successMessage);
|
|
189
|
+
printJson(result);
|
|
190
|
+
}
|
|
174
191
|
function printStatusPanel(data) {
|
|
175
192
|
console.log(chalk.blue("\u2500".repeat(50)));
|
|
176
193
|
console.log(chalk.blue.bold(" Corp Status"));
|
|
@@ -246,6 +263,38 @@ function printContactsTable(contacts) {
|
|
|
246
263
|
}
|
|
247
264
|
function printCapTable(data) {
|
|
248
265
|
const accessLevel = s(data.access_level) || "admin";
|
|
266
|
+
const instruments = data.instruments ?? [];
|
|
267
|
+
if (instruments.length > 0) {
|
|
268
|
+
const table = makeTable("Cap Table \u2014 Instruments", ["Symbol", "Kind", "Authorized", "Issued", "Diluted"]);
|
|
269
|
+
for (const instrument of instruments) {
|
|
270
|
+
table.push([
|
|
271
|
+
s(instrument.symbol),
|
|
272
|
+
s(instrument.kind),
|
|
273
|
+
s(instrument.authorized_units ?? "unlimited"),
|
|
274
|
+
s(instrument.issued_units),
|
|
275
|
+
s(instrument.diluted_units)
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
console.log(table.toString());
|
|
279
|
+
}
|
|
280
|
+
const holders = data.holders ?? [];
|
|
281
|
+
if (holders.length > 0 && accessLevel !== "summary") {
|
|
282
|
+
const table = makeTable(
|
|
283
|
+
"Ownership Breakdown",
|
|
284
|
+
["Holder", "Outstanding", "As Converted", "Fully Diluted", "Fully Diluted %"]
|
|
285
|
+
);
|
|
286
|
+
for (const holder of holders) {
|
|
287
|
+
const dilutedBps = typeof holder.fully_diluted_bps === "number" ? `${(holder.fully_diluted_bps / 100).toFixed(2)}%` : "";
|
|
288
|
+
table.push([
|
|
289
|
+
s(holder.name),
|
|
290
|
+
s(holder.outstanding_units),
|
|
291
|
+
s(holder.as_converted_units),
|
|
292
|
+
s(holder.fully_diluted_units),
|
|
293
|
+
dilutedBps
|
|
294
|
+
]);
|
|
295
|
+
}
|
|
296
|
+
console.log(table.toString());
|
|
297
|
+
}
|
|
249
298
|
const shareClasses = data.share_classes ?? [];
|
|
250
299
|
if (shareClasses.length > 0) {
|
|
251
300
|
const cols = ["Class", "Authorized", "Outstanding"];
|
|
@@ -254,8 +303,8 @@ function printCapTable(data) {
|
|
|
254
303
|
for (const sc of shareClasses) {
|
|
255
304
|
const row = [s(sc.class_code ?? sc.name), s(sc.authorized), s(sc.outstanding)];
|
|
256
305
|
if (accessLevel !== "summary") {
|
|
257
|
-
const
|
|
258
|
-
row.push(
|
|
306
|
+
const holders2 = sc.holders ?? [];
|
|
307
|
+
row.push(holders2.map((h) => `${h.name ?? "?"}(${h.percentage ?? "?"}%)`).join(", "));
|
|
259
308
|
}
|
|
260
309
|
table.push(row);
|
|
261
310
|
}
|
|
@@ -282,6 +331,11 @@ function printCapTable(data) {
|
|
|
282
331
|
console.log(`
|
|
283
332
|
${chalk.bold("Fully Diluted Shares:")} ${typeof fd === "number" ? fd.toLocaleString() : fd}`);
|
|
284
333
|
}
|
|
334
|
+
if (data.total_units != null) {
|
|
335
|
+
console.log(`
|
|
336
|
+
${chalk.bold("Cap Table Basis:")} ${s(data.basis) || "outstanding"}`);
|
|
337
|
+
console.log(`${chalk.bold("Total Units:")} ${typeof data.total_units === "number" ? data.total_units.toLocaleString() : data.total_units}`);
|
|
338
|
+
}
|
|
285
339
|
}
|
|
286
340
|
function printSafesTable(safes) {
|
|
287
341
|
const table = makeTable("SAFE Notes", ["ID", "Investor", "Amount", "Cap", "Discount", "Date"]);
|
|
@@ -840,6 +894,145 @@ var init_status = __esm({
|
|
|
840
894
|
}
|
|
841
895
|
});
|
|
842
896
|
|
|
897
|
+
// src/commands/context.ts
|
|
898
|
+
var context_exports = {};
|
|
899
|
+
__export(context_exports, {
|
|
900
|
+
contextCommand: () => contextCommand
|
|
901
|
+
});
|
|
902
|
+
import chalk2 from "chalk";
|
|
903
|
+
async function contextCommand(opts) {
|
|
904
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
905
|
+
const rawCfg = loadConfig();
|
|
906
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
907
|
+
try {
|
|
908
|
+
const [status, entities] = await Promise.all([
|
|
909
|
+
client.getStatus(),
|
|
910
|
+
client.listEntities()
|
|
911
|
+
]);
|
|
912
|
+
const activeEntity = rawCfg.active_entity_id ? entities.find((entity) => entity.entity_id === rawCfg.active_entity_id) ?? null : null;
|
|
913
|
+
const [contactsResult, documentsResult, workItemsResult] = activeEntity ? await Promise.allSettled([
|
|
914
|
+
client.listContacts(String(activeEntity.entity_id)),
|
|
915
|
+
client.getEntityDocuments(String(activeEntity.entity_id)),
|
|
916
|
+
client.listWorkItems(String(activeEntity.entity_id))
|
|
917
|
+
]) : [null, null, null];
|
|
918
|
+
const payload = {
|
|
919
|
+
user: {
|
|
920
|
+
name: rawCfg.user?.name ?? "",
|
|
921
|
+
email: rawCfg.user?.email ?? ""
|
|
922
|
+
},
|
|
923
|
+
workspace: {
|
|
924
|
+
workspace_id: rawCfg.workspace_id,
|
|
925
|
+
api_url: rawCfg.api_url,
|
|
926
|
+
status
|
|
927
|
+
},
|
|
928
|
+
active_entity: activeEntity ? {
|
|
929
|
+
entity: activeEntity,
|
|
930
|
+
summary: {
|
|
931
|
+
contact_count: contactsResult && contactsResult.status === "fulfilled" ? contactsResult.value.length : null,
|
|
932
|
+
document_count: documentsResult && documentsResult.status === "fulfilled" ? documentsResult.value.length : null,
|
|
933
|
+
work_item_count: workItemsResult && workItemsResult.status === "fulfilled" ? workItemsResult.value.length : null
|
|
934
|
+
}
|
|
935
|
+
} : null,
|
|
936
|
+
entity_count: entities.length
|
|
937
|
+
};
|
|
938
|
+
if (opts.json) {
|
|
939
|
+
printJson(payload);
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
console.log(chalk2.blue("\u2500".repeat(50)));
|
|
943
|
+
console.log(chalk2.blue.bold(" Corp Context"));
|
|
944
|
+
console.log(chalk2.blue("\u2500".repeat(50)));
|
|
945
|
+
console.log(` ${chalk2.bold("User:")} ${payload.user.name || "N/A"} <${payload.user.email || "N/A"}>`);
|
|
946
|
+
console.log(` ${chalk2.bold("Workspace:")} ${rawCfg.workspace_id}`);
|
|
947
|
+
console.log(` ${chalk2.bold("API URL:")} ${rawCfg.api_url}`);
|
|
948
|
+
console.log(` ${chalk2.bold("Entities:")} ${entities.length}`);
|
|
949
|
+
if (payload.active_entity) {
|
|
950
|
+
console.log(` ${chalk2.bold("Active Entity:")} ${payload.active_entity.entity.legal_name ?? payload.active_entity.entity.entity_id}`);
|
|
951
|
+
console.log(` ${chalk2.bold("Active Entity ID:")} ${payload.active_entity.entity.entity_id}`);
|
|
952
|
+
console.log(` ${chalk2.bold("Contacts:")} ${payload.active_entity.summary.contact_count ?? "N/A"}`);
|
|
953
|
+
console.log(` ${chalk2.bold("Documents:")} ${payload.active_entity.summary.document_count ?? "N/A"}`);
|
|
954
|
+
console.log(` ${chalk2.bold("Work Items:")} ${payload.active_entity.summary.work_item_count ?? "N/A"}`);
|
|
955
|
+
} else {
|
|
956
|
+
console.log(` ${chalk2.bold("Active Entity:")} none`);
|
|
957
|
+
}
|
|
958
|
+
if (status.next_deadline) {
|
|
959
|
+
console.log(` ${chalk2.bold("Next Deadline:")} ${status.next_deadline}`);
|
|
960
|
+
}
|
|
961
|
+
console.log(chalk2.blue("\u2500".repeat(50)));
|
|
962
|
+
} catch (err) {
|
|
963
|
+
printError(`Failed to fetch context: ${err}`);
|
|
964
|
+
process.exit(1);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
var init_context = __esm({
|
|
968
|
+
"src/commands/context.ts"() {
|
|
969
|
+
"use strict";
|
|
970
|
+
init_config();
|
|
971
|
+
init_api_client();
|
|
972
|
+
init_output();
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// src/commands/schema.ts
|
|
977
|
+
var schema_exports = {};
|
|
978
|
+
__export(schema_exports, {
|
|
979
|
+
schemaCommand: () => schemaCommand
|
|
980
|
+
});
|
|
981
|
+
function readChoices(value) {
|
|
982
|
+
if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
|
|
983
|
+
return value;
|
|
984
|
+
}
|
|
985
|
+
return void 0;
|
|
986
|
+
}
|
|
987
|
+
function commandToSchema(command, parentPath = "") {
|
|
988
|
+
const cmd = command;
|
|
989
|
+
const path = parentPath ? `${parentPath} ${command.name()}` : command.name();
|
|
990
|
+
return {
|
|
991
|
+
path,
|
|
992
|
+
name: command.name(),
|
|
993
|
+
description: command.description(),
|
|
994
|
+
aliases: command.aliases(),
|
|
995
|
+
arguments: (cmd.registeredArguments ?? []).map((arg) => ({
|
|
996
|
+
name: arg.name(),
|
|
997
|
+
required: Boolean(arg.required),
|
|
998
|
+
variadic: Boolean(arg.variadic),
|
|
999
|
+
defaultValue: arg.defaultValue,
|
|
1000
|
+
choices: readChoices(arg.argChoices)
|
|
1001
|
+
})),
|
|
1002
|
+
options: command.options.map((option) => ({
|
|
1003
|
+
flags: option.flags,
|
|
1004
|
+
name: option.attributeName(),
|
|
1005
|
+
description: option.description ?? "",
|
|
1006
|
+
required: option.required,
|
|
1007
|
+
mandatory: option.mandatory,
|
|
1008
|
+
variadic: option.variadic,
|
|
1009
|
+
defaultValue: option.defaultValue,
|
|
1010
|
+
choices: readChoices(option.argChoices)
|
|
1011
|
+
})),
|
|
1012
|
+
subcommands: command.commands.map((child) => commandToSchema(child, path))
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
function schemaCommand(program2, opts) {
|
|
1016
|
+
const manifest = {
|
|
1017
|
+
name: program2.name(),
|
|
1018
|
+
version: program2.version(),
|
|
1019
|
+
description: program2.description(),
|
|
1020
|
+
generated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1021
|
+
commands: program2.commands.map((command) => commandToSchema(command, program2.name()))
|
|
1022
|
+
};
|
|
1023
|
+
if (opts.compact) {
|
|
1024
|
+
console.log(JSON.stringify(manifest));
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
printJson(manifest);
|
|
1028
|
+
}
|
|
1029
|
+
var init_schema = __esm({
|
|
1030
|
+
"src/commands/schema.ts"() {
|
|
1031
|
+
"use strict";
|
|
1032
|
+
init_output();
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
|
|
843
1036
|
// src/commands/config.ts
|
|
844
1037
|
var config_exports2 = {};
|
|
845
1038
|
__export(config_exports2, {
|
|
@@ -1188,15 +1381,15 @@ __export(chat_exports, {
|
|
|
1188
1381
|
chatCommand: () => chatCommand
|
|
1189
1382
|
});
|
|
1190
1383
|
import { createInterface } from "readline";
|
|
1191
|
-
import
|
|
1384
|
+
import chalk3 from "chalk";
|
|
1192
1385
|
async function chatCommand() {
|
|
1193
1386
|
const cfg = requireConfig("api_url", "api_key", "workspace_id", "llm.api_key");
|
|
1194
1387
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1195
1388
|
const messages = [{ role: "system", content: SYSTEM_PROMPT }];
|
|
1196
1389
|
let totalTokens = 0;
|
|
1197
1390
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1198
|
-
const prompt = () => new Promise((resolve2) => rl.question(
|
|
1199
|
-
console.log(
|
|
1391
|
+
const prompt = () => new Promise((resolve2) => rl.question(chalk3.green.bold("> "), resolve2));
|
|
1392
|
+
console.log(chalk3.blue.bold("corp chat") + " \u2014 type /help for commands, /quit to exit\n");
|
|
1200
1393
|
const slashHandlers = {
|
|
1201
1394
|
"/status": async () => {
|
|
1202
1395
|
try {
|
|
@@ -1210,7 +1403,7 @@ async function chatCommand() {
|
|
|
1210
1403
|
const data = await client.getObligations();
|
|
1211
1404
|
const obls = data.obligations ?? [];
|
|
1212
1405
|
if (obls.length) printObligationsTable(obls);
|
|
1213
|
-
else console.log(
|
|
1406
|
+
else console.log(chalk3.dim("No obligations found."));
|
|
1214
1407
|
} catch (e) {
|
|
1215
1408
|
printError(`Obligations error: ${e}`);
|
|
1216
1409
|
}
|
|
@@ -1219,7 +1412,7 @@ async function chatCommand() {
|
|
|
1219
1412
|
try {
|
|
1220
1413
|
const digests = await client.listDigests();
|
|
1221
1414
|
if (digests.length) printJson(digests);
|
|
1222
|
-
else console.log(
|
|
1415
|
+
else console.log(chalk3.dim("No digest history."));
|
|
1223
1416
|
} catch (e) {
|
|
1224
1417
|
printError(`Digest error: ${e}`);
|
|
1225
1418
|
}
|
|
@@ -1240,11 +1433,11 @@ async function chatCommand() {
|
|
|
1240
1433
|
messages.length = 0;
|
|
1241
1434
|
messages.push({ role: "system", content: SYSTEM_PROMPT });
|
|
1242
1435
|
totalTokens = 0;
|
|
1243
|
-
console.log(
|
|
1436
|
+
console.log(chalk3.dim("Conversation cleared."));
|
|
1244
1437
|
},
|
|
1245
1438
|
"/help": () => {
|
|
1246
1439
|
console.log(`
|
|
1247
|
-
${
|
|
1440
|
+
${chalk3.bold("Chat Slash Commands")}
|
|
1248
1441
|
/status Show workspace status
|
|
1249
1442
|
/obligations List obligations
|
|
1250
1443
|
/digest Show digest history
|
|
@@ -1262,7 +1455,7 @@ ${chalk2.bold("Chat Slash Commands")}
|
|
|
1262
1455
|
try {
|
|
1263
1456
|
userInput = (await prompt()).trim();
|
|
1264
1457
|
} catch {
|
|
1265
|
-
console.log("\n" +
|
|
1458
|
+
console.log("\n" + chalk3.dim("Goodbye."));
|
|
1266
1459
|
break;
|
|
1267
1460
|
}
|
|
1268
1461
|
if (!userInput) continue;
|
|
@@ -1270,7 +1463,7 @@ ${chalk2.bold("Chat Slash Commands")}
|
|
|
1270
1463
|
const [cmd, ...rest] = userInput.split(/\s+/);
|
|
1271
1464
|
const args = rest.join(" ");
|
|
1272
1465
|
if (cmd === "/quit" || cmd === "/exit") {
|
|
1273
|
-
console.log(
|
|
1466
|
+
console.log(chalk3.dim("Goodbye."));
|
|
1274
1467
|
break;
|
|
1275
1468
|
}
|
|
1276
1469
|
const handler = slashHandlers[cmd.toLowerCase()];
|
|
@@ -1314,10 +1507,10 @@ ${chalk2.bold("Chat Slash Commands")}
|
|
|
1314
1507
|
break;
|
|
1315
1508
|
}
|
|
1316
1509
|
for (const tc of response.tool_calls) {
|
|
1317
|
-
console.log(
|
|
1510
|
+
console.log(chalk3.dim(` ${isWriteTool(tc.name, tc.arguments) ? "\u2699" : "\u2139"} ${tc.name}(${JSON.stringify(tc.arguments).slice(0, 80)})`));
|
|
1318
1511
|
const result = await executeTool(tc.name, tc.arguments, client);
|
|
1319
1512
|
const short = result.length > 200 ? result.slice(0, 197) + "..." : result;
|
|
1320
|
-
console.log(
|
|
1513
|
+
console.log(chalk3.dim(` => ${short}`));
|
|
1321
1514
|
messages.push({ role: "tool", tool_call_id: tc.id, content: result });
|
|
1322
1515
|
}
|
|
1323
1516
|
}
|
|
@@ -1353,7 +1546,7 @@ __export(entities_exports, {
|
|
|
1353
1546
|
entitiesDissolveCommand: () => entitiesDissolveCommand,
|
|
1354
1547
|
entitiesShowCommand: () => entitiesShowCommand
|
|
1355
1548
|
});
|
|
1356
|
-
import
|
|
1549
|
+
import chalk4 from "chalk";
|
|
1357
1550
|
async function entitiesCommand(opts) {
|
|
1358
1551
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1359
1552
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -1386,18 +1579,18 @@ async function entitiesShowCommand(entityId, opts) {
|
|
|
1386
1579
|
if (jsonOutput) {
|
|
1387
1580
|
printJson(entity);
|
|
1388
1581
|
} else {
|
|
1389
|
-
console.log(
|
|
1390
|
-
console.log(
|
|
1391
|
-
console.log(
|
|
1392
|
-
console.log(` ${
|
|
1393
|
-
console.log(` ${
|
|
1394
|
-
console.log(` ${
|
|
1395
|
-
console.log(` ${
|
|
1396
|
-
console.log(` ${
|
|
1397
|
-
console.log(` ${
|
|
1398
|
-
if (entity.formation_date) console.log(` ${
|
|
1399
|
-
if (entity.ein) console.log(` ${
|
|
1400
|
-
console.log(
|
|
1582
|
+
console.log(chalk4.blue("\u2500".repeat(40)));
|
|
1583
|
+
console.log(chalk4.blue.bold(" Entity Detail"));
|
|
1584
|
+
console.log(chalk4.blue("\u2500".repeat(40)));
|
|
1585
|
+
console.log(` ${chalk4.bold("Name:")} ${entity.legal_name ?? entity.name ?? "N/A"}`);
|
|
1586
|
+
console.log(` ${chalk4.bold("Type:")} ${entity.entity_type ?? "N/A"}`);
|
|
1587
|
+
console.log(` ${chalk4.bold("Jurisdiction:")} ${entity.jurisdiction ?? "N/A"}`);
|
|
1588
|
+
console.log(` ${chalk4.bold("Status:")} ${entity.formation_status ?? entity.status ?? "N/A"}`);
|
|
1589
|
+
console.log(` ${chalk4.bold("State:")} ${entity.formation_state ?? "N/A"}`);
|
|
1590
|
+
console.log(` ${chalk4.bold("ID:")} ${entity.entity_id ?? "N/A"}`);
|
|
1591
|
+
if (entity.formation_date) console.log(` ${chalk4.bold("Formation Date:")} ${entity.formation_date}`);
|
|
1592
|
+
if (entity.ein) console.log(` ${chalk4.bold("EIN:")} ${entity.ein}`);
|
|
1593
|
+
console.log(chalk4.blue("\u2500".repeat(40)));
|
|
1401
1594
|
}
|
|
1402
1595
|
} catch (err) {
|
|
1403
1596
|
printError(`Failed to fetch entities: ${err}`);
|
|
@@ -1455,7 +1648,7 @@ __export(contacts_exports, {
|
|
|
1455
1648
|
contactsListCommand: () => contactsListCommand,
|
|
1456
1649
|
contactsShowCommand: () => contactsShowCommand
|
|
1457
1650
|
});
|
|
1458
|
-
import
|
|
1651
|
+
import chalk5 from "chalk";
|
|
1459
1652
|
async function contactsListCommand(opts) {
|
|
1460
1653
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1461
1654
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -1480,24 +1673,24 @@ async function contactsShowCommand(contactId, opts) {
|
|
|
1480
1673
|
printJson(profile);
|
|
1481
1674
|
} else {
|
|
1482
1675
|
const contact = profile.contact ?? profile;
|
|
1483
|
-
console.log(
|
|
1484
|
-
console.log(
|
|
1485
|
-
console.log(
|
|
1486
|
-
console.log(` ${
|
|
1487
|
-
console.log(` ${
|
|
1488
|
-
console.log(` ${
|
|
1489
|
-
if (contact.phone) console.log(` ${
|
|
1490
|
-
if (contact.notes) console.log(` ${
|
|
1676
|
+
console.log(chalk5.cyan("\u2500".repeat(40)));
|
|
1677
|
+
console.log(chalk5.cyan.bold(" Contact Profile"));
|
|
1678
|
+
console.log(chalk5.cyan("\u2500".repeat(40)));
|
|
1679
|
+
console.log(` ${chalk5.bold("Name:")} ${contact.name ?? "N/A"}`);
|
|
1680
|
+
console.log(` ${chalk5.bold("Email:")} ${contact.email ?? "N/A"}`);
|
|
1681
|
+
console.log(` ${chalk5.bold("Category:")} ${contact.category ?? "N/A"}`);
|
|
1682
|
+
if (contact.phone) console.log(` ${chalk5.bold("Phone:")} ${contact.phone}`);
|
|
1683
|
+
if (contact.notes) console.log(` ${chalk5.bold("Notes:")} ${contact.notes}`);
|
|
1491
1684
|
const holdings = profile.equity_holdings;
|
|
1492
1685
|
if (holdings?.length) {
|
|
1493
1686
|
console.log(`
|
|
1494
|
-
${
|
|
1687
|
+
${chalk5.bold("Equity Holdings:")}`);
|
|
1495
1688
|
for (const h of holdings) console.log(` ${h.share_class ?? "?"}: ${h.shares ?? "?"} shares`);
|
|
1496
1689
|
}
|
|
1497
1690
|
const obls = profile.obligations;
|
|
1498
1691
|
if (obls?.length) console.log(`
|
|
1499
|
-
${
|
|
1500
|
-
console.log(
|
|
1692
|
+
${chalk5.bold("Obligations:")} ${obls.length}`);
|
|
1693
|
+
console.log(chalk5.cyan("\u2500".repeat(40)));
|
|
1501
1694
|
}
|
|
1502
1695
|
} catch (err) {
|
|
1503
1696
|
printError(`Failed to fetch contact: ${err}`);
|
|
@@ -1518,8 +1711,13 @@ async function contactsAddCommand(opts) {
|
|
|
1518
1711
|
};
|
|
1519
1712
|
if (opts.phone) data.phone = opts.phone;
|
|
1520
1713
|
if (opts.notes) data.notes = opts.notes;
|
|
1714
|
+
if (opts.mailingAddress ?? opts.address) data.mailing_address = opts.mailingAddress ?? opts.address;
|
|
1521
1715
|
const result = await client.createContact(data);
|
|
1522
|
-
|
|
1716
|
+
printWriteResult(
|
|
1717
|
+
result,
|
|
1718
|
+
`Contact created: ${result.contact_id ?? result.id ?? "OK"}`,
|
|
1719
|
+
opts.json
|
|
1720
|
+
);
|
|
1523
1721
|
} catch (err) {
|
|
1524
1722
|
printError(`Failed to create contact: ${err}`);
|
|
1525
1723
|
process.exit(1);
|
|
@@ -1531,17 +1729,37 @@ async function contactsEditCommand(contactId, opts) {
|
|
|
1531
1729
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1532
1730
|
try {
|
|
1533
1731
|
const data = { entity_id: eid };
|
|
1534
|
-
|
|
1535
|
-
if (opts.
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
if (
|
|
1732
|
+
let hasUpdates = false;
|
|
1733
|
+
if (opts.name != null) {
|
|
1734
|
+
data.name = opts.name;
|
|
1735
|
+
hasUpdates = true;
|
|
1736
|
+
}
|
|
1737
|
+
if (opts.email != null) {
|
|
1738
|
+
data.email = opts.email;
|
|
1739
|
+
hasUpdates = true;
|
|
1740
|
+
}
|
|
1741
|
+
if (opts.category != null) {
|
|
1742
|
+
data.category = opts.category;
|
|
1743
|
+
hasUpdates = true;
|
|
1744
|
+
}
|
|
1745
|
+
if (opts.phone != null) {
|
|
1746
|
+
data.phone = opts.phone;
|
|
1747
|
+
hasUpdates = true;
|
|
1748
|
+
}
|
|
1749
|
+
if (opts.notes != null) {
|
|
1750
|
+
data.notes = opts.notes;
|
|
1751
|
+
hasUpdates = true;
|
|
1752
|
+
}
|
|
1753
|
+
if (opts.mailingAddress != null || opts.address != null) {
|
|
1754
|
+
data.mailing_address = opts.mailingAddress ?? opts.address;
|
|
1755
|
+
hasUpdates = true;
|
|
1756
|
+
}
|
|
1757
|
+
if (!hasUpdates) {
|
|
1540
1758
|
console.log("No fields to update.");
|
|
1541
1759
|
return;
|
|
1542
1760
|
}
|
|
1543
|
-
await client.updateContact(contactId, data);
|
|
1544
|
-
|
|
1761
|
+
const result = await client.updateContact(contactId, data);
|
|
1762
|
+
printWriteResult(result, "Contact updated.", opts.json);
|
|
1545
1763
|
} catch (err) {
|
|
1546
1764
|
printError(`Failed to update contact: ${err}`);
|
|
1547
1765
|
process.exit(1);
|
|
@@ -1575,7 +1793,51 @@ __export(cap_table_exports, {
|
|
|
1575
1793
|
transfersCommand: () => transfersCommand,
|
|
1576
1794
|
valuationsCommand: () => valuationsCommand
|
|
1577
1795
|
});
|
|
1578
|
-
import
|
|
1796
|
+
import { ensureSafeInstrument } from "@thecorporation/corp-tools";
|
|
1797
|
+
import chalk6 from "chalk";
|
|
1798
|
+
function normalizedGrantType(grantType) {
|
|
1799
|
+
return grantType.trim().toLowerCase().replaceAll("-", "_");
|
|
1800
|
+
}
|
|
1801
|
+
function expectedInstrumentKinds(grantType) {
|
|
1802
|
+
switch (normalizedGrantType(grantType)) {
|
|
1803
|
+
case "common":
|
|
1804
|
+
case "common_stock":
|
|
1805
|
+
return ["common_equity"];
|
|
1806
|
+
case "preferred":
|
|
1807
|
+
case "preferred_stock":
|
|
1808
|
+
return ["preferred_equity"];
|
|
1809
|
+
case "membership_unit":
|
|
1810
|
+
return ["membership_unit"];
|
|
1811
|
+
case "stock_option":
|
|
1812
|
+
case "iso":
|
|
1813
|
+
case "nso":
|
|
1814
|
+
return ["option_grant"];
|
|
1815
|
+
case "rsa":
|
|
1816
|
+
return ["common_equity", "preferred_equity"];
|
|
1817
|
+
default:
|
|
1818
|
+
return [];
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function resolveInstrumentForGrant(instruments, grantType, explicitInstrumentId) {
|
|
1822
|
+
if (explicitInstrumentId) {
|
|
1823
|
+
const explicit = instruments.find((instrument) => instrument.instrument_id === explicitInstrumentId);
|
|
1824
|
+
if (!explicit) {
|
|
1825
|
+
throw new Error(`Instrument ${explicitInstrumentId} was not found on the cap table.`);
|
|
1826
|
+
}
|
|
1827
|
+
return explicit;
|
|
1828
|
+
}
|
|
1829
|
+
const expectedKinds = expectedInstrumentKinds(grantType);
|
|
1830
|
+
if (expectedKinds.length === 0) {
|
|
1831
|
+
throw new Error(`No default instrument mapping exists for grant type "${grantType}". Pass --instrument-id explicitly.`);
|
|
1832
|
+
}
|
|
1833
|
+
const match = instruments.find((instrument) => expectedKinds.includes(String(instrument.kind).toLowerCase()));
|
|
1834
|
+
if (!match) {
|
|
1835
|
+
throw new Error(
|
|
1836
|
+
`No instrument found for grant type "${grantType}". Expected one of: ${expectedKinds.join(", ")}.`
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
return match;
|
|
1840
|
+
}
|
|
1579
1841
|
async function capTableCommand(opts) {
|
|
1580
1842
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1581
1843
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -1667,30 +1929,34 @@ async function issueEquityCommand(opts) {
|
|
|
1667
1929
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1668
1930
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1669
1931
|
try {
|
|
1932
|
+
if (opts.dryRun) {
|
|
1933
|
+
printDryRun("cap_table.issue_equity", {
|
|
1934
|
+
entity_id: eid,
|
|
1935
|
+
grant_type: opts.grantType,
|
|
1936
|
+
shares: opts.shares,
|
|
1937
|
+
recipient: opts.recipient,
|
|
1938
|
+
email: opts.email,
|
|
1939
|
+
instrument_id: opts.instrumentId,
|
|
1940
|
+
meeting_id: opts.meetingId,
|
|
1941
|
+
resolution_id: opts.resolutionId
|
|
1942
|
+
});
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1670
1945
|
const capTable = await client.getCapTable(eid);
|
|
1671
1946
|
const issuerLegalEntityId = capTable.issuer_legal_entity_id;
|
|
1672
1947
|
if (!issuerLegalEntityId) {
|
|
1673
1948
|
printError("No issuer legal entity found. Has this entity been formed with a cap table?");
|
|
1674
1949
|
process.exit(1);
|
|
1675
1950
|
}
|
|
1676
|
-
|
|
1677
|
-
if (!
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
(i) => i.kind.toLowerCase().includes(grantLower) || i.symbol.toLowerCase().includes(grantLower)
|
|
1686
|
-
) ?? instruments.find((i) => i.kind.toLowerCase().includes("common"));
|
|
1687
|
-
if (match) {
|
|
1688
|
-
instrumentId = match.instrument_id;
|
|
1689
|
-
console.log(`Using instrument: ${match.symbol} (${match.kind})`);
|
|
1690
|
-
} else {
|
|
1691
|
-
instrumentId = instruments[0].instrument_id;
|
|
1692
|
-
console.log(`Using first instrument: ${instruments[0].symbol} (${instruments[0].kind})`);
|
|
1693
|
-
}
|
|
1951
|
+
const instruments = capTable.instruments ?? [];
|
|
1952
|
+
if (!instruments.length) {
|
|
1953
|
+
printError("No instruments found on cap table. Create an instrument first.");
|
|
1954
|
+
process.exit(1);
|
|
1955
|
+
}
|
|
1956
|
+
const instrument = resolveInstrumentForGrant(instruments, opts.grantType, opts.instrumentId);
|
|
1957
|
+
const instrumentId = instrument.instrument_id;
|
|
1958
|
+
if (!opts.instrumentId) {
|
|
1959
|
+
console.log(`Using instrument: ${instrument.symbol} (${instrument.kind})`);
|
|
1694
1960
|
}
|
|
1695
1961
|
const round = await client.startEquityRound({
|
|
1696
1962
|
entity_id: eid,
|
|
@@ -1707,7 +1973,14 @@ async function issueEquityCommand(opts) {
|
|
|
1707
1973
|
};
|
|
1708
1974
|
if (opts.email) securityData.email = opts.email;
|
|
1709
1975
|
await client.addRoundSecurity(roundId, securityData);
|
|
1710
|
-
const
|
|
1976
|
+
const issuePayload = { entity_id: eid };
|
|
1977
|
+
if (opts.meetingId) issuePayload.meeting_id = opts.meetingId;
|
|
1978
|
+
if (opts.resolutionId) issuePayload.resolution_id = opts.resolutionId;
|
|
1979
|
+
const result = await client.issueRound(roundId, issuePayload);
|
|
1980
|
+
if (opts.json) {
|
|
1981
|
+
printJson(result);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1711
1984
|
printSuccess(`Equity issued: ${opts.shares} shares (${opts.grantType}) to ${opts.recipient}`);
|
|
1712
1985
|
printJson(result);
|
|
1713
1986
|
} catch (err) {
|
|
@@ -1720,18 +1993,26 @@ async function issueSafeCommand(opts) {
|
|
|
1720
1993
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1721
1994
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1722
1995
|
try {
|
|
1996
|
+
if (opts.dryRun) {
|
|
1997
|
+
printDryRun("cap_table.issue_safe", {
|
|
1998
|
+
entity_id: eid,
|
|
1999
|
+
investor: opts.investor,
|
|
2000
|
+
amount: opts.amount,
|
|
2001
|
+
safe_type: opts.safeType,
|
|
2002
|
+
valuation_cap: opts.valuationCap,
|
|
2003
|
+
email: opts.email,
|
|
2004
|
+
meeting_id: opts.meetingId,
|
|
2005
|
+
resolution_id: opts.resolutionId
|
|
2006
|
+
});
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
1723
2009
|
const capTable = await client.getCapTable(eid);
|
|
1724
2010
|
const issuerLegalEntityId = capTable.issuer_legal_entity_id;
|
|
1725
2011
|
if (!issuerLegalEntityId) {
|
|
1726
2012
|
printError("No issuer legal entity found. Has this entity been formed with a cap table?");
|
|
1727
2013
|
process.exit(1);
|
|
1728
2014
|
}
|
|
1729
|
-
const
|
|
1730
|
-
const safeInstrument = instruments?.find((i) => i.kind.toLowerCase() === "safe");
|
|
1731
|
-
if (!safeInstrument) {
|
|
1732
|
-
printError("No SAFE instrument found on cap table. Create a SAFE instrument first.");
|
|
1733
|
-
process.exit(1);
|
|
1734
|
-
}
|
|
2015
|
+
const safeInstrument = await ensureSafeInstrument(client, eid);
|
|
1735
2016
|
const round = await client.startEquityRound({
|
|
1736
2017
|
entity_id: eid,
|
|
1737
2018
|
name: `SAFE \u2014 ${opts.investor}`,
|
|
@@ -1748,7 +2029,14 @@ async function issueSafeCommand(opts) {
|
|
|
1748
2029
|
};
|
|
1749
2030
|
if (opts.email) securityData.email = opts.email;
|
|
1750
2031
|
await client.addRoundSecurity(roundId, securityData);
|
|
1751
|
-
const
|
|
2032
|
+
const issuePayload = { entity_id: eid };
|
|
2033
|
+
if (opts.meetingId) issuePayload.meeting_id = opts.meetingId;
|
|
2034
|
+
if (opts.resolutionId) issuePayload.resolution_id = opts.resolutionId;
|
|
2035
|
+
const result = await client.issueRound(roundId, issuePayload);
|
|
2036
|
+
if (opts.json) {
|
|
2037
|
+
printJson(result);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
1752
2040
|
printSuccess(`SAFE issued: $${(opts.amount / 100).toLocaleString()} to ${opts.investor}`);
|
|
1753
2041
|
printJson(result);
|
|
1754
2042
|
} catch (err) {
|
|
@@ -1761,6 +2049,28 @@ async function transferSharesCommand(opts) {
|
|
|
1761
2049
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1762
2050
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1763
2051
|
try {
|
|
2052
|
+
if (opts.pricePerShareCents != null && opts.pricePerShareCents < 0) {
|
|
2053
|
+
throw new Error("price-per-share-cents cannot be negative");
|
|
2054
|
+
}
|
|
2055
|
+
if (opts.from === opts.to) {
|
|
2056
|
+
throw new Error("--from and --to must be different contacts");
|
|
2057
|
+
}
|
|
2058
|
+
if (opts.dryRun) {
|
|
2059
|
+
printDryRun("cap_table.transfer_shares", {
|
|
2060
|
+
entity_id: eid,
|
|
2061
|
+
from_contact_id: opts.from,
|
|
2062
|
+
to_contact_id: opts.to,
|
|
2063
|
+
share_count: opts.shares,
|
|
2064
|
+
transfer_type: opts.type,
|
|
2065
|
+
share_class_id: opts.shareClassId,
|
|
2066
|
+
governing_doc_type: opts.governingDocType,
|
|
2067
|
+
transferee_rights: opts.transfereeRights,
|
|
2068
|
+
prepare_intent_id: opts.prepareIntentId,
|
|
2069
|
+
price_per_share_cents: opts.pricePerShareCents,
|
|
2070
|
+
relationship_to_holder: opts.relationship
|
|
2071
|
+
});
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
1764
2074
|
let intentId = opts.prepareIntentId;
|
|
1765
2075
|
if (!intentId) {
|
|
1766
2076
|
const intent = await client.createExecutionIntent({
|
|
@@ -1786,8 +2096,7 @@ async function transferSharesCommand(opts) {
|
|
|
1786
2096
|
if (opts.pricePerShareCents != null) body.price_per_share_cents = opts.pricePerShareCents;
|
|
1787
2097
|
if (opts.relationship) body.relationship_to_holder = opts.relationship;
|
|
1788
2098
|
const result = await client.transferShares(body);
|
|
1789
|
-
|
|
1790
|
-
printJson(result);
|
|
2099
|
+
printWriteResult(result, `Transfer workflow created: ${result.workflow_id ?? "OK"}`, opts.json);
|
|
1791
2100
|
} catch (err) {
|
|
1792
2101
|
printError(`Failed to create transfer workflow: ${err}`);
|
|
1793
2102
|
process.exit(1);
|
|
@@ -1798,14 +2107,18 @@ async function distributeCommand(opts) {
|
|
|
1798
2107
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1799
2108
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1800
2109
|
try {
|
|
1801
|
-
const
|
|
2110
|
+
const payload = {
|
|
1802
2111
|
entity_id: eid,
|
|
1803
2112
|
total_amount_cents: opts.amount,
|
|
1804
2113
|
distribution_type: opts.type,
|
|
1805
2114
|
description: opts.description
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
|
|
2115
|
+
};
|
|
2116
|
+
if (opts.dryRun) {
|
|
2117
|
+
printDryRun("cap_table.distribute", payload);
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
const result = await client.calculateDistribution(payload);
|
|
2121
|
+
printWriteResult(result, `Distribution calculated: ${result.distribution_id ?? "OK"}`, opts.json);
|
|
1809
2122
|
} catch (err) {
|
|
1810
2123
|
printError(`Failed to calculate distribution: ${err}`);
|
|
1811
2124
|
process.exit(1);
|
|
@@ -1816,13 +2129,17 @@ async function startRoundCommand(opts) {
|
|
|
1816
2129
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1817
2130
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1818
2131
|
try {
|
|
1819
|
-
const
|
|
2132
|
+
const payload = {
|
|
1820
2133
|
entity_id: eid,
|
|
1821
2134
|
name: opts.name,
|
|
1822
2135
|
issuer_legal_entity_id: opts.issuerLegalEntityId
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
|
|
2136
|
+
};
|
|
2137
|
+
if (opts.dryRun) {
|
|
2138
|
+
printDryRun("cap_table.start_round", payload);
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const result = await client.startEquityRound(payload);
|
|
2142
|
+
printWriteResult(result, `Round started: ${result.round_id ?? "OK"}`, opts.json);
|
|
1826
2143
|
} catch (err) {
|
|
1827
2144
|
printError(`Failed to start round: ${err}`);
|
|
1828
2145
|
process.exit(1);
|
|
@@ -1843,9 +2160,12 @@ async function addSecurityCommand(opts) {
|
|
|
1843
2160
|
if (opts.email) body.email = opts.email;
|
|
1844
2161
|
if (opts.principalCents) body.principal_cents = opts.principalCents;
|
|
1845
2162
|
if (opts.grantType) body.grant_type = opts.grantType;
|
|
2163
|
+
if (opts.dryRun) {
|
|
2164
|
+
printDryRun("cap_table.add_security", { round_id: opts.roundId, ...body });
|
|
2165
|
+
return;
|
|
2166
|
+
}
|
|
1846
2167
|
const result = await client.addRoundSecurity(opts.roundId, body);
|
|
1847
|
-
|
|
1848
|
-
printJson(result);
|
|
2168
|
+
printWriteResult(result, `Security added for ${opts.recipientName}`, opts.json);
|
|
1849
2169
|
} catch (err) {
|
|
1850
2170
|
printError(`Failed to add security: ${err}`);
|
|
1851
2171
|
process.exit(1);
|
|
@@ -1856,9 +2176,12 @@ async function issueRoundCommand(opts) {
|
|
|
1856
2176
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1857
2177
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1858
2178
|
try {
|
|
2179
|
+
if (opts.dryRun) {
|
|
2180
|
+
printDryRun("cap_table.issue_round", { entity_id: eid, round_id: opts.roundId });
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
1859
2183
|
const result = await client.issueRound(opts.roundId, { entity_id: eid });
|
|
1860
|
-
|
|
1861
|
-
printJson(result);
|
|
2184
|
+
printWriteResult(result, "Round issued and closed", opts.json);
|
|
1862
2185
|
} catch (err) {
|
|
1863
2186
|
printError(`Failed to issue round: ${err}`);
|
|
1864
2187
|
process.exit(1);
|
|
@@ -1877,9 +2200,12 @@ async function createValuationCommand(opts) {
|
|
|
1877
2200
|
};
|
|
1878
2201
|
if (opts.fmv != null) body.fmv_per_share_cents = opts.fmv;
|
|
1879
2202
|
if (opts.enterpriseValue != null) body.enterprise_value_cents = opts.enterpriseValue;
|
|
2203
|
+
if (opts.dryRun) {
|
|
2204
|
+
printDryRun("cap_table.create_valuation", body);
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
1880
2207
|
const result = await client.createValuation(body);
|
|
1881
|
-
|
|
1882
|
-
printJson(result);
|
|
2208
|
+
printWriteResult(result, `Valuation created: ${result.valuation_id ?? "OK"}`, opts.json);
|
|
1883
2209
|
} catch (err) {
|
|
1884
2210
|
printError(`Failed to create valuation: ${err}`);
|
|
1885
2211
|
process.exit(1);
|
|
@@ -1890,7 +2216,15 @@ async function submitValuationCommand(opts) {
|
|
|
1890
2216
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1891
2217
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1892
2218
|
try {
|
|
2219
|
+
if (opts.dryRun) {
|
|
2220
|
+
printDryRun("cap_table.submit_valuation", { entity_id: eid, valuation_id: opts.valuationId });
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
1893
2223
|
const result = await client.submitValuationForApproval(opts.valuationId, eid);
|
|
2224
|
+
if (opts.json) {
|
|
2225
|
+
printJson(result);
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
1894
2228
|
printSuccess(`Valuation submitted for approval: ${result.valuation_id ?? "OK"}`);
|
|
1895
2229
|
if (result.meeting_id) console.log(` Meeting: ${result.meeting_id}`);
|
|
1896
2230
|
if (result.agenda_item_id) console.log(` Agenda Item: ${result.agenda_item_id}`);
|
|
@@ -1910,9 +2244,16 @@ async function approveValuationCommand(opts) {
|
|
|
1910
2244
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
1911
2245
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1912
2246
|
try {
|
|
2247
|
+
if (opts.dryRun) {
|
|
2248
|
+
printDryRun("cap_table.approve_valuation", {
|
|
2249
|
+
entity_id: eid,
|
|
2250
|
+
valuation_id: opts.valuationId,
|
|
2251
|
+
resolution_id: opts.resolutionId
|
|
2252
|
+
});
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
1913
2255
|
const result = await client.approveValuation(opts.valuationId, eid, opts.resolutionId);
|
|
1914
|
-
|
|
1915
|
-
printJson(result);
|
|
2256
|
+
printWriteResult(result, `Valuation approved: ${result.valuation_id ?? "OK"}`, opts.json);
|
|
1916
2257
|
} catch (err) {
|
|
1917
2258
|
const msg = String(err);
|
|
1918
2259
|
if (msg.includes("400")) {
|
|
@@ -1924,16 +2265,16 @@ async function approveValuationCommand(opts) {
|
|
|
1924
2265
|
}
|
|
1925
2266
|
}
|
|
1926
2267
|
function print409a(data) {
|
|
1927
|
-
console.log(
|
|
1928
|
-
console.log(
|
|
1929
|
-
console.log(
|
|
2268
|
+
console.log(chalk6.green("\u2500".repeat(40)));
|
|
2269
|
+
console.log(chalk6.green.bold(" 409A Valuation"));
|
|
2270
|
+
console.log(chalk6.green("\u2500".repeat(40)));
|
|
1930
2271
|
const fmv = typeof data.fmv_per_share_cents === "number" ? data.fmv_per_share_cents / 100 : data.fmv_per_share;
|
|
1931
2272
|
const enterpriseValue = typeof data.enterprise_value_cents === "number" ? data.enterprise_value_cents / 100 : data.enterprise_value;
|
|
1932
|
-
console.log(` ${
|
|
1933
|
-
console.log(` ${
|
|
1934
|
-
console.log(` ${
|
|
1935
|
-
if (data.provider) console.log(` ${
|
|
1936
|
-
console.log(
|
|
2273
|
+
console.log(` ${chalk6.bold("FMV/Share:")} $${fmv ?? "N/A"}`);
|
|
2274
|
+
console.log(` ${chalk6.bold("Enterprise Value:")} $${enterpriseValue ?? "N/A"}`);
|
|
2275
|
+
console.log(` ${chalk6.bold("Valuation Date:")} ${data.effective_date ?? data.valuation_date ?? "N/A"}`);
|
|
2276
|
+
if (data.provider) console.log(` ${chalk6.bold("Provider:")} ${data.provider}`);
|
|
2277
|
+
console.log(chalk6.green("\u2500".repeat(40)));
|
|
1937
2278
|
}
|
|
1938
2279
|
var init_cap_table = __esm({
|
|
1939
2280
|
"src/commands/cap-table.ts"() {
|
|
@@ -2081,6 +2422,7 @@ __export(governance_exports, {
|
|
|
2081
2422
|
governanceCreateBodyCommand: () => governanceCreateBodyCommand,
|
|
2082
2423
|
governanceListCommand: () => governanceListCommand,
|
|
2083
2424
|
governanceMeetingsCommand: () => governanceMeetingsCommand,
|
|
2425
|
+
governanceOpenMeetingCommand: () => governanceOpenMeetingCommand,
|
|
2084
2426
|
governanceResolutionsCommand: () => governanceResolutionsCommand,
|
|
2085
2427
|
governanceSeatsCommand: () => governanceSeatsCommand,
|
|
2086
2428
|
governanceVoteCommand: () => governanceVoteCommand,
|
|
@@ -2088,25 +2430,34 @@ __export(governance_exports, {
|
|
|
2088
2430
|
sendNoticeCommand: () => sendNoticeCommand,
|
|
2089
2431
|
writtenConsentCommand: () => writtenConsentCommand
|
|
2090
2432
|
});
|
|
2091
|
-
import
|
|
2433
|
+
import chalk7 from "chalk";
|
|
2092
2434
|
async function governanceCreateBodyCommand(opts) {
|
|
2093
2435
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2094
2436
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2095
2437
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2096
2438
|
try {
|
|
2097
|
-
const
|
|
2439
|
+
const payload = {
|
|
2098
2440
|
entity_id: eid,
|
|
2099
2441
|
body_type: opts.bodyType,
|
|
2100
2442
|
name: opts.name,
|
|
2101
2443
|
quorum_rule: opts.quorum,
|
|
2102
2444
|
voting_method: opts.voting
|
|
2103
|
-
}
|
|
2445
|
+
};
|
|
2446
|
+
if (opts.dryRun) {
|
|
2447
|
+
printDryRun("governance.create_body", payload);
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
const result = await client.createGovernanceBody(payload);
|
|
2104
2451
|
const bodyId = result.body_id ?? "OK";
|
|
2452
|
+
if (opts.json) {
|
|
2453
|
+
printJson(result);
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2105
2456
|
printSuccess(`Governance body created: ${bodyId}`);
|
|
2106
2457
|
printJson(result);
|
|
2107
|
-
console.log(
|
|
2108
|
-
console.log(
|
|
2109
|
-
console.log(
|
|
2458
|
+
console.log(chalk7.dim("\n Next steps:"));
|
|
2459
|
+
console.log(chalk7.dim(` corp governance add-seat ${bodyId} --holder <contact-id>`));
|
|
2460
|
+
console.log(chalk7.dim(` corp governance seats ${bodyId}`));
|
|
2110
2461
|
} catch (err) {
|
|
2111
2462
|
printError(`Failed to create governance body: ${err}`);
|
|
2112
2463
|
process.exit(1);
|
|
@@ -2118,7 +2469,15 @@ async function governanceAddSeatCommand(bodyId, opts) {
|
|
|
2118
2469
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2119
2470
|
try {
|
|
2120
2471
|
const data = { holder_id: opts.holder, role: opts.role ?? "member" };
|
|
2472
|
+
if (opts.dryRun) {
|
|
2473
|
+
printDryRun("governance.add_seat", { entity_id: eid, body_id: bodyId, ...data });
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2121
2476
|
const result = await client.createGovernanceSeat(bodyId, eid, data);
|
|
2477
|
+
if (opts.json) {
|
|
2478
|
+
printJson(result);
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2122
2481
|
printSuccess(`Seat added: ${result.seat_id ?? "OK"}`);
|
|
2123
2482
|
printJson(result);
|
|
2124
2483
|
} catch (err) {
|
|
@@ -2187,38 +2546,87 @@ async function governanceConveneCommand(opts) {
|
|
|
2187
2546
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2188
2547
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2189
2548
|
try {
|
|
2190
|
-
const
|
|
2549
|
+
const payload = {
|
|
2191
2550
|
entity_id: eid,
|
|
2192
2551
|
body_id: opts.body,
|
|
2193
2552
|
meeting_type: opts.meetingType,
|
|
2194
2553
|
title: opts.title,
|
|
2195
|
-
scheduled_date: opts.date,
|
|
2196
2554
|
agenda_item_titles: opts.agenda
|
|
2197
|
-
}
|
|
2555
|
+
};
|
|
2556
|
+
if (opts.date) payload.scheduled_date = opts.date;
|
|
2557
|
+
if (opts.dryRun) {
|
|
2558
|
+
printDryRun("governance.schedule_meeting", payload);
|
|
2559
|
+
return;
|
|
2560
|
+
}
|
|
2561
|
+
const result = await client.scheduleMeeting(payload);
|
|
2198
2562
|
const meetingId = result.meeting_id ?? "OK";
|
|
2563
|
+
if (opts.json) {
|
|
2564
|
+
printJson(result);
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2199
2567
|
printSuccess(`Meeting scheduled: ${meetingId}`);
|
|
2200
2568
|
printJson(result);
|
|
2201
|
-
console.log(
|
|
2202
|
-
console.log(
|
|
2203
|
-
console.log(
|
|
2569
|
+
console.log(chalk7.dim("\n Next steps:"));
|
|
2570
|
+
console.log(chalk7.dim(` corp governance notice ${meetingId}`));
|
|
2571
|
+
console.log(chalk7.dim(` corp governance open ${meetingId} --present-seat <seat-id>`));
|
|
2572
|
+
console.log(chalk7.dim(` corp governance agenda-items ${meetingId}`));
|
|
2204
2573
|
} catch (err) {
|
|
2205
2574
|
printError(`Failed to schedule meeting: ${err}`);
|
|
2206
2575
|
process.exit(1);
|
|
2207
2576
|
}
|
|
2208
2577
|
}
|
|
2578
|
+
async function governanceOpenMeetingCommand(meetingId, opts) {
|
|
2579
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2580
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2581
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2582
|
+
try {
|
|
2583
|
+
const payload = { present_seat_ids: opts.presentSeat };
|
|
2584
|
+
if (opts.dryRun) {
|
|
2585
|
+
printDryRun("governance.open_meeting", { entity_id: eid, meeting_id: meetingId, ...payload });
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
const result = await client.conveneMeeting(meetingId, eid, payload);
|
|
2589
|
+
if (opts.json) {
|
|
2590
|
+
printJson(result);
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
printSuccess(`Meeting opened: ${meetingId}`);
|
|
2594
|
+
printJson(result);
|
|
2595
|
+
} catch (err) {
|
|
2596
|
+
printError(`Failed to open meeting: ${err}`);
|
|
2597
|
+
process.exit(1);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2209
2600
|
async function governanceVoteCommand(meetingId, itemId, opts) {
|
|
2210
2601
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2211
2602
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2212
2603
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2213
2604
|
try {
|
|
2214
|
-
const
|
|
2605
|
+
const payload = {
|
|
2215
2606
|
voter_id: opts.voter,
|
|
2216
2607
|
vote_value: opts.vote
|
|
2217
|
-
}
|
|
2608
|
+
};
|
|
2609
|
+
if (opts.dryRun) {
|
|
2610
|
+
printDryRun("governance.cast_vote", { entity_id: eid, meeting_id: meetingId, agenda_item_id: itemId, ...payload });
|
|
2611
|
+
return;
|
|
2612
|
+
}
|
|
2613
|
+
const result = await client.castVote(eid, meetingId, itemId, payload);
|
|
2614
|
+
if (opts.json) {
|
|
2615
|
+
printJson(result);
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2218
2618
|
printSuccess(`Vote cast: ${result.vote_id ?? "OK"}`);
|
|
2219
2619
|
printJson(result);
|
|
2220
2620
|
} catch (err) {
|
|
2221
|
-
|
|
2621
|
+
const message = String(err);
|
|
2622
|
+
if (message.includes("voting session is not open")) {
|
|
2623
|
+
printError(
|
|
2624
|
+
`Failed to cast vote: ${err}
|
|
2625
|
+
Open the meeting first: corp governance open ${meetingId} --present-seat <seat-id>`
|
|
2626
|
+
);
|
|
2627
|
+
} else {
|
|
2628
|
+
printError(`Failed to cast vote: ${err}`);
|
|
2629
|
+
}
|
|
2222
2630
|
process.exit(1);
|
|
2223
2631
|
}
|
|
2224
2632
|
}
|
|
@@ -2227,7 +2635,15 @@ async function sendNoticeCommand(meetingId, opts) {
|
|
|
2227
2635
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2228
2636
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2229
2637
|
try {
|
|
2638
|
+
if (opts.dryRun) {
|
|
2639
|
+
printDryRun("governance.send_notice", { entity_id: eid, meeting_id: meetingId });
|
|
2640
|
+
return;
|
|
2641
|
+
}
|
|
2230
2642
|
const result = await client.sendNotice(meetingId, eid);
|
|
2643
|
+
if (opts.json) {
|
|
2644
|
+
printJson(result);
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2231
2647
|
printSuccess(`Notice sent for meeting ${meetingId}`);
|
|
2232
2648
|
printJson(result);
|
|
2233
2649
|
} catch (err) {
|
|
@@ -2240,7 +2656,15 @@ async function adjournMeetingCommand(meetingId, opts) {
|
|
|
2240
2656
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2241
2657
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2242
2658
|
try {
|
|
2659
|
+
if (opts.dryRun) {
|
|
2660
|
+
printDryRun("governance.adjourn_meeting", { entity_id: eid, meeting_id: meetingId });
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2243
2663
|
const result = await client.adjournMeeting(meetingId, eid);
|
|
2664
|
+
if (opts.json) {
|
|
2665
|
+
printJson(result);
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2244
2668
|
printSuccess(`Meeting ${meetingId} adjourned`);
|
|
2245
2669
|
printJson(result);
|
|
2246
2670
|
} catch (err) {
|
|
@@ -2253,7 +2677,15 @@ async function cancelMeetingCommand(meetingId, opts) {
|
|
|
2253
2677
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2254
2678
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2255
2679
|
try {
|
|
2680
|
+
if (opts.dryRun) {
|
|
2681
|
+
printDryRun("governance.cancel_meeting", { entity_id: eid, meeting_id: meetingId });
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2256
2684
|
const result = await client.cancelMeeting(meetingId, eid);
|
|
2685
|
+
if (opts.json) {
|
|
2686
|
+
printJson(result);
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2257
2689
|
printSuccess(`Meeting ${meetingId} cancelled`);
|
|
2258
2690
|
printJson(result);
|
|
2259
2691
|
} catch (err) {
|
|
@@ -2266,10 +2698,19 @@ async function finalizeAgendaItemCommand(meetingId, itemId, opts) {
|
|
|
2266
2698
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2267
2699
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2268
2700
|
try {
|
|
2269
|
-
const
|
|
2701
|
+
const payload = {
|
|
2270
2702
|
entity_id: eid,
|
|
2271
2703
|
status: opts.status
|
|
2272
|
-
}
|
|
2704
|
+
};
|
|
2705
|
+
if (opts.dryRun) {
|
|
2706
|
+
printDryRun("governance.finalize_agenda_item", { meeting_id: meetingId, agenda_item_id: itemId, ...payload });
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
const result = await client.finalizeAgendaItem(meetingId, itemId, payload);
|
|
2710
|
+
if (opts.json) {
|
|
2711
|
+
printJson(result);
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2273
2714
|
printSuccess(`Agenda item ${itemId} finalized as ${opts.status}`);
|
|
2274
2715
|
printJson(result);
|
|
2275
2716
|
} catch (err) {
|
|
@@ -2282,9 +2723,23 @@ async function computeResolutionCommand(meetingId, itemId, opts) {
|
|
|
2282
2723
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2283
2724
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2284
2725
|
try {
|
|
2285
|
-
const
|
|
2726
|
+
const payload = {
|
|
2286
2727
|
resolution_text: opts.text
|
|
2287
|
-
}
|
|
2728
|
+
};
|
|
2729
|
+
if (opts.dryRun) {
|
|
2730
|
+
printDryRun("governance.compute_resolution", {
|
|
2731
|
+
entity_id: eid,
|
|
2732
|
+
meeting_id: meetingId,
|
|
2733
|
+
agenda_item_id: itemId,
|
|
2734
|
+
...payload
|
|
2735
|
+
});
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2738
|
+
const result = await client.computeResolution(meetingId, itemId, eid, payload);
|
|
2739
|
+
if (opts.json) {
|
|
2740
|
+
printJson(result);
|
|
2741
|
+
return;
|
|
2742
|
+
}
|
|
2288
2743
|
printSuccess(`Resolution computed for agenda item ${itemId}`);
|
|
2289
2744
|
printJson(result);
|
|
2290
2745
|
} catch (err) {
|
|
@@ -2297,18 +2752,27 @@ async function writtenConsentCommand(opts) {
|
|
|
2297
2752
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2298
2753
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2299
2754
|
try {
|
|
2300
|
-
const
|
|
2755
|
+
const payload = {
|
|
2301
2756
|
entity_id: eid,
|
|
2302
2757
|
body_id: opts.body,
|
|
2303
2758
|
title: opts.title,
|
|
2304
2759
|
description: opts.description
|
|
2305
|
-
}
|
|
2760
|
+
};
|
|
2761
|
+
if (opts.dryRun) {
|
|
2762
|
+
printDryRun("governance.written_consent", payload);
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
const result = await client.writtenConsent(payload);
|
|
2306
2766
|
const meetingId = result.meeting_id ?? "OK";
|
|
2767
|
+
if (opts.json) {
|
|
2768
|
+
printJson(result);
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2307
2771
|
printSuccess(`Written consent created: ${meetingId}`);
|
|
2308
2772
|
printJson(result);
|
|
2309
|
-
console.log(
|
|
2310
|
-
console.log(
|
|
2311
|
-
console.log(
|
|
2773
|
+
console.log(chalk7.dim("\n Next steps:"));
|
|
2774
|
+
console.log(chalk7.dim(` corp governance agenda-items ${meetingId}`));
|
|
2775
|
+
console.log(chalk7.dim(` corp governance vote ${meetingId} <item-id> --voter <contact-uuid> --vote for`));
|
|
2312
2776
|
} catch (err) {
|
|
2313
2777
|
printError(`Failed to create written consent: ${err}`);
|
|
2314
2778
|
process.exit(1);
|
|
@@ -2324,10 +2788,10 @@ async function listAgendaItemsCommand(meetingId, opts) {
|
|
|
2324
2788
|
else if (items.length === 0) console.log("No agenda items found.");
|
|
2325
2789
|
else {
|
|
2326
2790
|
const Table4 = (await import("cli-table3")).default;
|
|
2327
|
-
const
|
|
2791
|
+
const chalk13 = (await import("chalk")).default;
|
|
2328
2792
|
console.log(`
|
|
2329
|
-
${
|
|
2330
|
-
const table = new Table4({ head: [
|
|
2793
|
+
${chalk13.bold("Agenda Items")}`);
|
|
2794
|
+
const table = new Table4({ head: [chalk13.dim("ID"), chalk13.dim("Title"), chalk13.dim("Status"), chalk13.dim("Type")] });
|
|
2331
2795
|
for (const item of items) {
|
|
2332
2796
|
table.push([
|
|
2333
2797
|
String(item.item_id ?? item.agenda_item_id ?? item.id ?? "").slice(0, 12),
|
|
@@ -2408,19 +2872,48 @@ async function documentsGenerateCommand(opts) {
|
|
|
2408
2872
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2409
2873
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2410
2874
|
try {
|
|
2875
|
+
const parameters = {};
|
|
2876
|
+
if (opts.baseSalary) {
|
|
2877
|
+
parameters.base_salary = opts.baseSalary;
|
|
2878
|
+
}
|
|
2879
|
+
for (const raw of opts.param ?? []) {
|
|
2880
|
+
const idx = raw.indexOf("=");
|
|
2881
|
+
if (idx <= 0) {
|
|
2882
|
+
throw new Error(`Invalid --param value: ${raw}. Expected key=value.`);
|
|
2883
|
+
}
|
|
2884
|
+
const key = raw.slice(0, idx).trim();
|
|
2885
|
+
const value = raw.slice(idx + 1).trim();
|
|
2886
|
+
if (!key) {
|
|
2887
|
+
throw new Error(`Invalid --param value: ${raw}. Expected key=value.`);
|
|
2888
|
+
}
|
|
2889
|
+
parameters[key] = coerceParamValue(value);
|
|
2890
|
+
}
|
|
2411
2891
|
const result = await client.generateContract({
|
|
2412
2892
|
entity_id: eid,
|
|
2413
2893
|
template_type: opts.template,
|
|
2414
2894
|
counterparty_name: opts.counterparty,
|
|
2415
|
-
effective_date: opts.effectiveDate ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
2895
|
+
effective_date: opts.effectiveDate ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
2896
|
+
parameters
|
|
2416
2897
|
});
|
|
2417
|
-
|
|
2418
|
-
printJson(result);
|
|
2898
|
+
printWriteResult(result, `Contract generated: ${result.contract_id ?? "OK"}`, opts.json);
|
|
2419
2899
|
} catch (err) {
|
|
2420
2900
|
printError(`Failed to generate contract: ${err}`);
|
|
2421
2901
|
process.exit(1);
|
|
2422
2902
|
}
|
|
2423
2903
|
}
|
|
2904
|
+
function coerceParamValue(raw) {
|
|
2905
|
+
if (raw === "true") return true;
|
|
2906
|
+
if (raw === "false") return false;
|
|
2907
|
+
if (/^-?\d+(\.\d+)?$/.test(raw)) return Number(raw);
|
|
2908
|
+
if (raw.startsWith("{") && raw.endsWith("}") || raw.startsWith("[") && raw.endsWith("]")) {
|
|
2909
|
+
try {
|
|
2910
|
+
return JSON.parse(raw);
|
|
2911
|
+
} catch {
|
|
2912
|
+
return raw;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
return raw;
|
|
2916
|
+
}
|
|
2424
2917
|
async function documentsPreviewPdfCommand(opts) {
|
|
2425
2918
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2426
2919
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -2463,8 +2956,7 @@ async function taxFileCommand(opts) {
|
|
|
2463
2956
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2464
2957
|
try {
|
|
2465
2958
|
const result = await client.fileTaxDocument({ entity_id: eid, document_type: opts.type, tax_year: opts.year });
|
|
2466
|
-
|
|
2467
|
-
printJson(result);
|
|
2959
|
+
printWriteResult(result, `Tax document filed: ${result.filing_id ?? "OK"}`, opts.json);
|
|
2468
2960
|
} catch (err) {
|
|
2469
2961
|
printError(`Failed to file tax document: ${err}`);
|
|
2470
2962
|
process.exit(1);
|
|
@@ -2484,8 +2976,7 @@ async function taxDeadlineCommand(opts) {
|
|
|
2484
2976
|
const recurrence = normalizeRecurrence(opts.recurrence);
|
|
2485
2977
|
if (recurrence) payload.recurrence = recurrence;
|
|
2486
2978
|
const result = await client.trackDeadline(payload);
|
|
2487
|
-
|
|
2488
|
-
printJson(result);
|
|
2979
|
+
printWriteResult(result, `Deadline tracked: ${result.deadline_id ?? "OK"}`, opts.json);
|
|
2489
2980
|
} catch (err) {
|
|
2490
2981
|
printError(`Failed to track deadline: ${err}`);
|
|
2491
2982
|
process.exit(1);
|
|
@@ -2513,7 +3004,8 @@ __export(agents_exports, {
|
|
|
2513
3004
|
agentsShowCommand: () => agentsShowCommand,
|
|
2514
3005
|
agentsSkillCommand: () => agentsSkillCommand
|
|
2515
3006
|
});
|
|
2516
|
-
import
|
|
3007
|
+
import chalk8 from "chalk";
|
|
3008
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
2517
3009
|
async function agentsListCommand(opts) {
|
|
2518
3010
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2519
3011
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
@@ -2536,22 +3028,22 @@ async function agentsShowCommand(agentId, opts) {
|
|
|
2536
3028
|
printJson(agent);
|
|
2537
3029
|
return;
|
|
2538
3030
|
}
|
|
2539
|
-
console.log(
|
|
2540
|
-
console.log(
|
|
2541
|
-
console.log(
|
|
2542
|
-
console.log(` ${
|
|
2543
|
-
console.log(` ${
|
|
2544
|
-
console.log(` ${
|
|
2545
|
-
console.log(` ${
|
|
3031
|
+
console.log(chalk8.magenta("\u2500".repeat(40)));
|
|
3032
|
+
console.log(chalk8.magenta.bold(" Agent Detail"));
|
|
3033
|
+
console.log(chalk8.magenta("\u2500".repeat(40)));
|
|
3034
|
+
console.log(` ${chalk8.bold("Name:")} ${agent.name ?? "N/A"}`);
|
|
3035
|
+
console.log(` ${chalk8.bold("Status:")} ${agent.status ?? "N/A"}`);
|
|
3036
|
+
console.log(` ${chalk8.bold("Model:")} ${agent.model ?? "N/A"}`);
|
|
3037
|
+
console.log(` ${chalk8.bold("ID:")} ${agent.agent_id ?? "N/A"}`);
|
|
2546
3038
|
if (agent.system_prompt) {
|
|
2547
3039
|
let prompt = String(agent.system_prompt);
|
|
2548
3040
|
if (prompt.length > 100) prompt = prompt.slice(0, 97) + "...";
|
|
2549
|
-
console.log(` ${
|
|
3041
|
+
console.log(` ${chalk8.bold("Prompt:")} ${prompt}`);
|
|
2550
3042
|
}
|
|
2551
3043
|
if (agent.skills && Array.isArray(agent.skills) && agent.skills.length > 0) {
|
|
2552
|
-
console.log(` ${
|
|
3044
|
+
console.log(` ${chalk8.bold("Skills:")} ${agent.skills.map((s2) => s2.name ?? "?").join(", ")}`);
|
|
2553
3045
|
}
|
|
2554
|
-
console.log(
|
|
3046
|
+
console.log(chalk8.magenta("\u2500".repeat(40)));
|
|
2555
3047
|
} catch (err) {
|
|
2556
3048
|
printError(`Failed to fetch agent: ${err}`);
|
|
2557
3049
|
process.exit(1);
|
|
@@ -2564,52 +3056,67 @@ async function agentsCreateCommand(opts) {
|
|
|
2564
3056
|
const data = { name: opts.name, system_prompt: opts.prompt };
|
|
2565
3057
|
if (opts.model) data.model = opts.model;
|
|
2566
3058
|
const result = await client.createAgent(data);
|
|
2567
|
-
|
|
2568
|
-
printJson(result);
|
|
3059
|
+
printWriteResult(result, `Agent created: ${result.agent_id ?? result.id ?? "OK"}`, opts.json);
|
|
2569
3060
|
} catch (err) {
|
|
2570
3061
|
printError(`Failed to create agent: ${err}`);
|
|
2571
3062
|
process.exit(1);
|
|
2572
3063
|
}
|
|
2573
3064
|
}
|
|
2574
|
-
async function agentsPauseCommand(agentId) {
|
|
3065
|
+
async function agentsPauseCommand(agentId, opts) {
|
|
2575
3066
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2576
3067
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2577
3068
|
try {
|
|
2578
|
-
await client.updateAgent(agentId, { status: "paused" });
|
|
2579
|
-
|
|
3069
|
+
const result = await client.updateAgent(agentId, { status: "paused" });
|
|
3070
|
+
printWriteResult(result, `Agent ${agentId} paused.`, opts.json);
|
|
2580
3071
|
} catch (err) {
|
|
2581
3072
|
printError(`Failed to pause agent: ${err}`);
|
|
2582
3073
|
process.exit(1);
|
|
2583
3074
|
}
|
|
2584
3075
|
}
|
|
2585
|
-
async function agentsResumeCommand(agentId) {
|
|
3076
|
+
async function agentsResumeCommand(agentId, opts) {
|
|
2586
3077
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2587
3078
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2588
3079
|
try {
|
|
2589
|
-
await client.updateAgent(agentId, { status: "active" });
|
|
2590
|
-
|
|
3080
|
+
const result = await client.updateAgent(agentId, { status: "active" });
|
|
3081
|
+
printWriteResult(result, `Agent ${agentId} resumed.`, opts.json);
|
|
2591
3082
|
} catch (err) {
|
|
2592
3083
|
printError(`Failed to resume agent: ${err}`);
|
|
2593
3084
|
process.exit(1);
|
|
2594
3085
|
}
|
|
2595
3086
|
}
|
|
2596
|
-
async function agentsDeleteCommand(agentId) {
|
|
3087
|
+
async function agentsDeleteCommand(agentId, opts) {
|
|
2597
3088
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2598
3089
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2599
3090
|
try {
|
|
2600
|
-
await client.deleteAgent(agentId);
|
|
2601
|
-
|
|
3091
|
+
const result = await client.deleteAgent(agentId);
|
|
3092
|
+
printWriteResult(result, `Agent ${agentId} deleted.`, opts.json);
|
|
2602
3093
|
} catch (err) {
|
|
2603
3094
|
printError(`Failed to delete agent: ${err}`);
|
|
2604
3095
|
process.exit(1);
|
|
2605
3096
|
}
|
|
2606
3097
|
}
|
|
3098
|
+
function resolveTextInput(inlineText, filePath, label, required = false) {
|
|
3099
|
+
if (inlineText && filePath) {
|
|
3100
|
+
throw new Error(`Pass either --${label} or --${label}-file, not both.`);
|
|
3101
|
+
}
|
|
3102
|
+
if (filePath) {
|
|
3103
|
+
return readFileSync2(filePath, "utf8");
|
|
3104
|
+
}
|
|
3105
|
+
if (inlineText) {
|
|
3106
|
+
return inlineText;
|
|
3107
|
+
}
|
|
3108
|
+
if (required) {
|
|
3109
|
+
throw new Error(`Provide --${label} or --${label}-file.`);
|
|
3110
|
+
}
|
|
3111
|
+
return void 0;
|
|
3112
|
+
}
|
|
2607
3113
|
async function agentsMessageCommand(agentId, opts) {
|
|
2608
3114
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2609
3115
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2610
3116
|
try {
|
|
2611
|
-
const
|
|
2612
|
-
|
|
3117
|
+
const body = resolveTextInput(opts.body, opts.bodyFile, "body", true);
|
|
3118
|
+
const result = await client.sendAgentMessage(agentId, body);
|
|
3119
|
+
printWriteResult(result, `Message sent. Execution: ${result.execution_id ?? "OK"}`, opts.json);
|
|
2613
3120
|
} catch (err) {
|
|
2614
3121
|
printError(`Failed to send message: ${err}`);
|
|
2615
3122
|
process.exit(1);
|
|
@@ -2627,13 +3134,17 @@ async function agentsSkillCommand(agentId, opts) {
|
|
|
2627
3134
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2628
3135
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2629
3136
|
try {
|
|
3137
|
+
const instructions = resolveTextInput(
|
|
3138
|
+
opts.instructions,
|
|
3139
|
+
opts.instructionsFile,
|
|
3140
|
+
"instructions"
|
|
3141
|
+
);
|
|
2630
3142
|
const result = await client.addAgentSkill(agentId, {
|
|
2631
3143
|
name: opts.name,
|
|
2632
3144
|
description: opts.description,
|
|
2633
|
-
parameters:
|
|
3145
|
+
parameters: instructions ? { instructions } : {}
|
|
2634
3146
|
});
|
|
2635
|
-
|
|
2636
|
-
printJson(result);
|
|
3147
|
+
printWriteResult(result, `Skill '${opts.name}' added to agent ${agentId}.`, opts.json);
|
|
2637
3148
|
} catch (err) {
|
|
2638
3149
|
printError(`Failed to add skill: ${err}`);
|
|
2639
3150
|
process.exit(1);
|
|
@@ -2659,7 +3170,7 @@ __export(work_items_exports, {
|
|
|
2659
3170
|
workItemsReleaseCommand: () => workItemsReleaseCommand,
|
|
2660
3171
|
workItemsShowCommand: () => workItemsShowCommand
|
|
2661
3172
|
});
|
|
2662
|
-
import
|
|
3173
|
+
import chalk9 from "chalk";
|
|
2663
3174
|
async function workItemsListCommand(opts) {
|
|
2664
3175
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2665
3176
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -2687,24 +3198,24 @@ async function workItemsShowCommand(workItemId, opts) {
|
|
|
2687
3198
|
printJson(w);
|
|
2688
3199
|
return;
|
|
2689
3200
|
}
|
|
2690
|
-
console.log(
|
|
2691
|
-
console.log(
|
|
2692
|
-
console.log(
|
|
2693
|
-
console.log(` ${
|
|
2694
|
-
console.log(` ${
|
|
2695
|
-
console.log(` ${
|
|
2696
|
-
if (w.description) console.log(` ${
|
|
2697
|
-
if (w.deadline) console.log(` ${
|
|
2698
|
-
if (w.asap) console.log(` ${
|
|
2699
|
-
if (w.claimed_by) console.log(` ${
|
|
2700
|
-
if (w.claimed_at) console.log(` ${
|
|
2701
|
-
if (w.claim_ttl_seconds) console.log(` ${
|
|
2702
|
-
if (w.completed_by) console.log(` ${
|
|
2703
|
-
if (w.completed_at) console.log(` ${
|
|
2704
|
-
if (w.result) console.log(` ${
|
|
2705
|
-
if (w.created_by) console.log(` ${
|
|
2706
|
-
console.log(` ${
|
|
2707
|
-
console.log(
|
|
3201
|
+
console.log(chalk9.cyan("\u2500".repeat(40)));
|
|
3202
|
+
console.log(chalk9.cyan.bold(" Work Item Detail"));
|
|
3203
|
+
console.log(chalk9.cyan("\u2500".repeat(40)));
|
|
3204
|
+
console.log(` ${chalk9.bold("Title:")} ${w.title ?? "N/A"}`);
|
|
3205
|
+
console.log(` ${chalk9.bold("Category:")} ${w.category ?? "N/A"}`);
|
|
3206
|
+
console.log(` ${chalk9.bold("Status:")} ${w.effective_status ?? w.status ?? "N/A"}`);
|
|
3207
|
+
if (w.description) console.log(` ${chalk9.bold("Description:")} ${w.description}`);
|
|
3208
|
+
if (w.deadline) console.log(` ${chalk9.bold("Deadline:")} ${w.deadline}`);
|
|
3209
|
+
if (w.asap) console.log(` ${chalk9.bold("Priority:")} ${chalk9.red.bold("ASAP")}`);
|
|
3210
|
+
if (w.claimed_by) console.log(` ${chalk9.bold("Claimed by:")} ${w.claimed_by}`);
|
|
3211
|
+
if (w.claimed_at) console.log(` ${chalk9.bold("Claimed at:")} ${w.claimed_at}`);
|
|
3212
|
+
if (w.claim_ttl_seconds) console.log(` ${chalk9.bold("Claim TTL:")} ${w.claim_ttl_seconds}s`);
|
|
3213
|
+
if (w.completed_by) console.log(` ${chalk9.bold("Completed by:")} ${w.completed_by}`);
|
|
3214
|
+
if (w.completed_at) console.log(` ${chalk9.bold("Completed at:")} ${w.completed_at}`);
|
|
3215
|
+
if (w.result) console.log(` ${chalk9.bold("Result:")} ${w.result}`);
|
|
3216
|
+
if (w.created_by) console.log(` ${chalk9.bold("Created by:")} ${w.created_by}`);
|
|
3217
|
+
console.log(` ${chalk9.bold("Created at:")} ${w.created_at ?? "N/A"}`);
|
|
3218
|
+
console.log(chalk9.cyan("\u2500".repeat(40)));
|
|
2708
3219
|
} catch (err) {
|
|
2709
3220
|
printError(`Failed to fetch work item: ${err}`);
|
|
2710
3221
|
process.exit(1);
|
|
@@ -2725,7 +3236,11 @@ async function workItemsCreateCommand(opts) {
|
|
|
2725
3236
|
if (opts.asap) data.asap = true;
|
|
2726
3237
|
if (opts.createdBy) data.created_by = opts.createdBy;
|
|
2727
3238
|
const result = await client.createWorkItem(eid, data);
|
|
2728
|
-
|
|
3239
|
+
printWriteResult(
|
|
3240
|
+
result,
|
|
3241
|
+
`Work item created: ${result.work_item_id ?? result.id ?? "OK"}`,
|
|
3242
|
+
opts.json
|
|
3243
|
+
);
|
|
2729
3244
|
} catch (err) {
|
|
2730
3245
|
printError(`Failed to create work item: ${err}`);
|
|
2731
3246
|
process.exit(1);
|
|
@@ -2738,8 +3253,8 @@ async function workItemsClaimCommand(workItemId, opts) {
|
|
|
2738
3253
|
try {
|
|
2739
3254
|
const data = { claimed_by: opts.claimedBy };
|
|
2740
3255
|
if (opts.ttl != null) data.ttl_seconds = opts.ttl;
|
|
2741
|
-
await client.claimWorkItem(eid, workItemId, data);
|
|
2742
|
-
|
|
3256
|
+
const result = await client.claimWorkItem(eid, workItemId, data);
|
|
3257
|
+
printWriteResult(result, `Work item ${workItemId} claimed by ${opts.claimedBy}.`, opts.json);
|
|
2743
3258
|
} catch (err) {
|
|
2744
3259
|
printError(`Failed to claim work item: ${err}`);
|
|
2745
3260
|
process.exit(1);
|
|
@@ -2752,8 +3267,8 @@ async function workItemsCompleteCommand(workItemId, opts) {
|
|
|
2752
3267
|
try {
|
|
2753
3268
|
const data = { completed_by: opts.completedBy };
|
|
2754
3269
|
if (opts.result) data.result = opts.result;
|
|
2755
|
-
await client.completeWorkItem(eid, workItemId, data);
|
|
2756
|
-
|
|
3270
|
+
const result = await client.completeWorkItem(eid, workItemId, data);
|
|
3271
|
+
printWriteResult(result, `Work item ${workItemId} completed.`, opts.json);
|
|
2757
3272
|
} catch (err) {
|
|
2758
3273
|
printError(`Failed to complete work item: ${err}`);
|
|
2759
3274
|
process.exit(1);
|
|
@@ -2764,8 +3279,8 @@ async function workItemsReleaseCommand(workItemId, opts) {
|
|
|
2764
3279
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2765
3280
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2766
3281
|
try {
|
|
2767
|
-
await client.releaseWorkItem(eid, workItemId);
|
|
2768
|
-
|
|
3282
|
+
const result = await client.releaseWorkItem(eid, workItemId);
|
|
3283
|
+
printWriteResult(result, `Work item ${workItemId} claim released.`, opts.json);
|
|
2769
3284
|
} catch (err) {
|
|
2770
3285
|
printError(`Failed to release work item: ${err}`);
|
|
2771
3286
|
process.exit(1);
|
|
@@ -2776,8 +3291,8 @@ async function workItemsCancelCommand(workItemId, opts) {
|
|
|
2776
3291
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2777
3292
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2778
3293
|
try {
|
|
2779
|
-
await client.cancelWorkItem(eid, workItemId);
|
|
2780
|
-
|
|
3294
|
+
const result = await client.cancelWorkItem(eid, workItemId);
|
|
3295
|
+
printWriteResult(result, `Work item ${workItemId} cancelled.`, opts.json);
|
|
2781
3296
|
} catch (err) {
|
|
2782
3297
|
printError(`Failed to cancel work item: ${err}`);
|
|
2783
3298
|
process.exit(1);
|
|
@@ -2877,17 +3392,140 @@ __export(form_exports, {
|
|
|
2877
3392
|
formFinalizeCommand: () => formFinalizeCommand
|
|
2878
3393
|
});
|
|
2879
3394
|
import { input as input2, select, confirm as confirm2, number } from "@inquirer/prompts";
|
|
2880
|
-
import
|
|
3395
|
+
import chalk10 from "chalk";
|
|
2881
3396
|
import Table2 from "cli-table3";
|
|
3397
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
2882
3398
|
import { OfficerTitle } from "@thecorporation/corp-tools";
|
|
2883
3399
|
function isCorp(entityType) {
|
|
2884
3400
|
return entityType === "c_corp" || entityType === "s_corp" || entityType === "corporation";
|
|
2885
3401
|
}
|
|
2886
3402
|
function sectionHeader(title) {
|
|
2887
3403
|
console.log();
|
|
2888
|
-
console.log(
|
|
2889
|
-
console.log(
|
|
2890
|
-
console.log(
|
|
3404
|
+
console.log(chalk10.blue("\u2500".repeat(50)));
|
|
3405
|
+
console.log(chalk10.blue.bold(` ${title}`));
|
|
3406
|
+
console.log(chalk10.blue("\u2500".repeat(50)));
|
|
3407
|
+
}
|
|
3408
|
+
function officerTitleLabel(title) {
|
|
3409
|
+
switch (title) {
|
|
3410
|
+
case "ceo":
|
|
3411
|
+
return "CEO";
|
|
3412
|
+
case "cfo":
|
|
3413
|
+
return "CFO";
|
|
3414
|
+
case "cto":
|
|
3415
|
+
return "CTO";
|
|
3416
|
+
case "coo":
|
|
3417
|
+
return "COO";
|
|
3418
|
+
case "vp":
|
|
3419
|
+
return "VP";
|
|
3420
|
+
default:
|
|
3421
|
+
return title.charAt(0).toUpperCase() + title.slice(1);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
function parseBoolean(value) {
|
|
3425
|
+
if (typeof value === "boolean") return value;
|
|
3426
|
+
if (typeof value !== "string") return void 0;
|
|
3427
|
+
if (value === "true") return true;
|
|
3428
|
+
if (value === "false") return false;
|
|
3429
|
+
return void 0;
|
|
3430
|
+
}
|
|
3431
|
+
function parseAddressValue(raw) {
|
|
3432
|
+
if (!raw) return void 0;
|
|
3433
|
+
if (typeof raw === "string") {
|
|
3434
|
+
const parts = raw.split("|").map((part) => part.trim());
|
|
3435
|
+
if (parts.length === 4) {
|
|
3436
|
+
return { street: parts[0], city: parts[1], state: parts[2], zip: parts[3] };
|
|
3437
|
+
}
|
|
3438
|
+
throw new Error(`Invalid founder address: ${raw}. Expected street|city|state|zip.`);
|
|
3439
|
+
}
|
|
3440
|
+
if (typeof raw === "object" && raw !== null) {
|
|
3441
|
+
const value = raw;
|
|
3442
|
+
if (typeof value.street === "string" && typeof value.city === "string" && typeof value.state === "string" && typeof value.zip === "string") {
|
|
3443
|
+
return {
|
|
3444
|
+
street: value.street,
|
|
3445
|
+
street2: typeof value.street2 === "string" ? value.street2 : void 0,
|
|
3446
|
+
city: value.city,
|
|
3447
|
+
state: value.state,
|
|
3448
|
+
zip: value.zip
|
|
3449
|
+
};
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
throw new Error("Founder address must be an object or street|city|state|zip string.");
|
|
3453
|
+
}
|
|
3454
|
+
function normalizeFounderInfo(input3) {
|
|
3455
|
+
const name = typeof input3.name === "string" ? input3.name.trim() : "";
|
|
3456
|
+
const email = typeof input3.email === "string" ? input3.email.trim() : "";
|
|
3457
|
+
const role = typeof input3.role === "string" ? input3.role.trim() : "";
|
|
3458
|
+
if (!name || !email || !role) {
|
|
3459
|
+
throw new Error("Founder JSON requires non-empty name, email, and role.");
|
|
3460
|
+
}
|
|
3461
|
+
const founder = { name, email, role };
|
|
3462
|
+
const ownershipPct = input3.ownership_pct ?? input3.pct;
|
|
3463
|
+
if (ownershipPct != null) founder.ownership_pct = Number(ownershipPct);
|
|
3464
|
+
const sharesPurchased = input3.shares_purchased ?? input3.shares;
|
|
3465
|
+
if (sharesPurchased != null) founder.shares_purchased = Number(sharesPurchased);
|
|
3466
|
+
if (typeof input3.officer_title === "string") founder.officer_title = input3.officer_title;
|
|
3467
|
+
const incorporator = parseBoolean(input3.is_incorporator ?? input3.incorporator);
|
|
3468
|
+
if (incorporator !== void 0) founder.is_incorporator = incorporator;
|
|
3469
|
+
if (input3.address != null) founder.address = parseAddressValue(input3.address);
|
|
3470
|
+
if (typeof input3.ip_description === "string") founder.ip_description = input3.ip_description;
|
|
3471
|
+
if (input3.vesting && typeof input3.vesting === "object") {
|
|
3472
|
+
const vesting = input3.vesting;
|
|
3473
|
+
if (vesting.total_months != null && vesting.cliff_months != null) {
|
|
3474
|
+
founder.vesting = {
|
|
3475
|
+
total_months: Number(vesting.total_months),
|
|
3476
|
+
cliff_months: Number(vesting.cliff_months),
|
|
3477
|
+
acceleration: typeof vesting.acceleration === "string" ? vesting.acceleration : void 0
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
return founder;
|
|
3482
|
+
}
|
|
3483
|
+
function parseLegacyMemberSpec(raw) {
|
|
3484
|
+
const parts = raw.split(",").map((p) => p.trim());
|
|
3485
|
+
if (parts.length < 3) {
|
|
3486
|
+
throw new Error(`Invalid member format: ${raw}. Expected: name,email,role[,pct]`);
|
|
3487
|
+
}
|
|
3488
|
+
const founder = { name: parts[0], email: parts[1], role: parts[2] };
|
|
3489
|
+
if (parts.length >= 4) founder.ownership_pct = parseFloat(parts[3]);
|
|
3490
|
+
return founder;
|
|
3491
|
+
}
|
|
3492
|
+
function parseKeyValueMemberSpec(raw) {
|
|
3493
|
+
const parsed = {};
|
|
3494
|
+
for (const segment of raw.split(",")) {
|
|
3495
|
+
const [key, ...rest] = segment.split("=");
|
|
3496
|
+
if (!key || rest.length === 0) {
|
|
3497
|
+
throw new Error(`Invalid member format: ${raw}. Expected key=value pairs.`);
|
|
3498
|
+
}
|
|
3499
|
+
parsed[key.trim()] = rest.join("=").trim();
|
|
3500
|
+
}
|
|
3501
|
+
return normalizeFounderInfo(parsed);
|
|
3502
|
+
}
|
|
3503
|
+
function parseScriptedFounders(opts) {
|
|
3504
|
+
const founders = [];
|
|
3505
|
+
for (const raw of opts.member ?? []) {
|
|
3506
|
+
founders.push(raw.includes("=") ? parseKeyValueMemberSpec(raw) : parseLegacyMemberSpec(raw));
|
|
3507
|
+
}
|
|
3508
|
+
for (const raw of opts.memberJson ?? []) {
|
|
3509
|
+
founders.push(normalizeFounderInfo(JSON.parse(raw)));
|
|
3510
|
+
}
|
|
3511
|
+
if (opts.membersFile) {
|
|
3512
|
+
const parsed = JSON.parse(readFileSync3(opts.membersFile, "utf8"));
|
|
3513
|
+
let entries;
|
|
3514
|
+
if (Array.isArray(parsed)) {
|
|
3515
|
+
entries = parsed;
|
|
3516
|
+
} else if (typeof parsed === "object" && parsed !== null && "members" in parsed && Array.isArray(parsed.members)) {
|
|
3517
|
+
entries = parsed.members;
|
|
3518
|
+
} else {
|
|
3519
|
+
throw new Error('members file must be a JSON array or {"members": [...]}');
|
|
3520
|
+
}
|
|
3521
|
+
for (const entry of entries) {
|
|
3522
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
3523
|
+
throw new Error("each founder entry must be a JSON object");
|
|
3524
|
+
}
|
|
3525
|
+
founders.push(normalizeFounderInfo(entry));
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return founders;
|
|
2891
3529
|
}
|
|
2892
3530
|
async function promptAddress() {
|
|
2893
3531
|
const street = await input2({ message: " Street address" });
|
|
@@ -2953,21 +3591,16 @@ async function phasePeople(opts, entityType, scripted) {
|
|
|
2953
3591
|
if (!scripted) sectionHeader("Phase 2: Founders & Officers");
|
|
2954
3592
|
const founders = [];
|
|
2955
3593
|
if (scripted) {
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
}
|
|
2962
|
-
const f = { name: parts[0], email: parts[1], role: parts[2] };
|
|
2963
|
-
if (parts.length >= 4) f.ownership_pct = parseFloat(parts[3]);
|
|
2964
|
-
founders.push(f);
|
|
3594
|
+
try {
|
|
3595
|
+
return parseScriptedFounders(opts);
|
|
3596
|
+
} catch (err) {
|
|
3597
|
+
printError(String(err));
|
|
3598
|
+
process.exit(1);
|
|
2965
3599
|
}
|
|
2966
|
-
return founders;
|
|
2967
3600
|
}
|
|
2968
3601
|
const founderCount = await number({ message: "Number of founders (1-6)", default: 1 }) ?? 1;
|
|
2969
3602
|
for (let i = 0; i < founderCount; i++) {
|
|
2970
|
-
console.log(
|
|
3603
|
+
console.log(chalk10.dim(`
|
|
2971
3604
|
Founder ${i + 1} of ${founderCount}:`));
|
|
2972
3605
|
const name = await input2({ message: ` Name` });
|
|
2973
3606
|
const email = await input2({ message: ` Email` });
|
|
@@ -2992,7 +3625,7 @@ async function phasePeople(opts, entityType, scripted) {
|
|
|
2992
3625
|
message: " Officer title",
|
|
2993
3626
|
choices: OfficerTitle.map((t) => ({
|
|
2994
3627
|
value: t,
|
|
2995
|
-
name:
|
|
3628
|
+
name: officerTitleLabel(t)
|
|
2996
3629
|
}))
|
|
2997
3630
|
});
|
|
2998
3631
|
}
|
|
@@ -3013,7 +3646,7 @@ async function phaseStock(opts, entityType, founders, scripted) {
|
|
|
3013
3646
|
const rofr = opts.rofr ?? (!scripted && isCorp(entityType) ? await confirm2({ message: "Right of first refusal?", default: true }) : isCorp(entityType));
|
|
3014
3647
|
if (!scripted) {
|
|
3015
3648
|
for (const f of founders) {
|
|
3016
|
-
console.log(
|
|
3649
|
+
console.log(chalk10.dim(`
|
|
3017
3650
|
Equity for ${f.name}:`));
|
|
3018
3651
|
if (isCorp(entityType)) {
|
|
3019
3652
|
const shares = await number({ message: ` Shares to purchase`, default: 0 });
|
|
@@ -3059,17 +3692,17 @@ async function phaseStock(opts, entityType, founders, scripted) {
|
|
|
3059
3692
|
}
|
|
3060
3693
|
function printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr) {
|
|
3061
3694
|
sectionHeader("Formation Summary");
|
|
3062
|
-
console.log(` ${
|
|
3063
|
-
console.log(` ${
|
|
3064
|
-
console.log(` ${
|
|
3065
|
-
console.log(` ${
|
|
3695
|
+
console.log(` ${chalk10.bold("Entity:")} ${name}`);
|
|
3696
|
+
console.log(` ${chalk10.bold("Type:")} ${entityType}`);
|
|
3697
|
+
console.log(` ${chalk10.bold("Jurisdiction:")} ${jurisdiction}`);
|
|
3698
|
+
console.log(` ${chalk10.bold("Fiscal Year End:")} ${fiscalYearEnd}`);
|
|
3066
3699
|
if (isCorp(entityType)) {
|
|
3067
|
-
console.log(` ${
|
|
3068
|
-
console.log(` ${
|
|
3069
|
-
console.log(` ${
|
|
3700
|
+
console.log(` ${chalk10.bold("S-Corp Election:")} ${sCorpElection ? "Yes" : "No"}`);
|
|
3701
|
+
console.log(` ${chalk10.bold("Transfer Restrictions:")} ${transferRestrictions ? "Yes" : "No"}`);
|
|
3702
|
+
console.log(` ${chalk10.bold("Right of First Refusal:")} ${rofr ? "Yes" : "No"}`);
|
|
3070
3703
|
}
|
|
3071
3704
|
const table = new Table2({
|
|
3072
|
-
head: [
|
|
3705
|
+
head: [chalk10.dim("Name"), chalk10.dim("Email"), chalk10.dim("Role"), chalk10.dim("Equity"), chalk10.dim("Officer")]
|
|
3073
3706
|
});
|
|
3074
3707
|
for (const f of founders) {
|
|
3075
3708
|
const equity = f.shares_purchased ? `${f.shares_purchased.toLocaleString()} shares` : f.ownership_pct ? `${f.ownership_pct}%` : "\u2014";
|
|
@@ -3086,14 +3719,16 @@ async function formCommand(opts) {
|
|
|
3086
3719
|
serverCfg = await client.getConfig();
|
|
3087
3720
|
} catch {
|
|
3088
3721
|
}
|
|
3089
|
-
const scripted =
|
|
3722
|
+
const scripted = Boolean(
|
|
3723
|
+
opts.member && opts.member.length > 0 || opts.memberJson && opts.memberJson.length > 0 || opts.membersFile
|
|
3724
|
+
);
|
|
3090
3725
|
const { entityType, name, jurisdiction, companyAddress, fiscalYearEnd, sCorpElection } = await phaseEntityDetails(opts, serverCfg, scripted);
|
|
3091
3726
|
const founders = await phasePeople(opts, entityType, scripted);
|
|
3092
3727
|
const { transferRestrictions, rofr } = await phaseStock(opts, entityType, founders, scripted);
|
|
3093
3728
|
printSummary(entityType, name, jurisdiction, fiscalYearEnd, sCorpElection, founders, transferRestrictions, rofr);
|
|
3094
3729
|
const shouldProceed = scripted ? true : await confirm2({ message: "Proceed with formation?", default: true });
|
|
3095
3730
|
if (!shouldProceed) {
|
|
3096
|
-
console.log(
|
|
3731
|
+
console.log(chalk10.yellow("Formation cancelled."));
|
|
3097
3732
|
return;
|
|
3098
3733
|
}
|
|
3099
3734
|
const members = founders.map((f) => {
|
|
@@ -3124,7 +3759,15 @@ async function formCommand(opts) {
|
|
|
3124
3759
|
right_of_first_refusal: rofr
|
|
3125
3760
|
};
|
|
3126
3761
|
if (companyAddress) payload.company_address = companyAddress;
|
|
3762
|
+
if (opts.dryRun) {
|
|
3763
|
+
printDryRun("formation.create_with_cap_table", payload);
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3127
3766
|
const result = await client.createFormationWithCapTable(payload);
|
|
3767
|
+
if (opts.json) {
|
|
3768
|
+
printJson(result);
|
|
3769
|
+
return;
|
|
3770
|
+
}
|
|
3128
3771
|
printSuccess(`Formation created: ${result.formation_id ?? "OK"}`);
|
|
3129
3772
|
if (result.entity_id) console.log(` Entity ID: ${result.entity_id}`);
|
|
3130
3773
|
if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
|
|
@@ -3137,17 +3780,17 @@ async function formCommand(opts) {
|
|
|
3137
3780
|
if (holders.length > 0) {
|
|
3138
3781
|
console.log();
|
|
3139
3782
|
const table = new Table2({
|
|
3140
|
-
head: [
|
|
3783
|
+
head: [chalk10.dim("Holder"), chalk10.dim("Shares"), chalk10.dim("Ownership %")]
|
|
3141
3784
|
});
|
|
3142
3785
|
for (const h of holders) {
|
|
3143
3786
|
const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
|
|
3144
3787
|
table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
|
|
3145
3788
|
}
|
|
3146
|
-
console.log(
|
|
3789
|
+
console.log(chalk10.bold(" Cap Table:"));
|
|
3147
3790
|
console.log(table.toString());
|
|
3148
3791
|
}
|
|
3149
3792
|
if (result.next_action) {
|
|
3150
|
-
console.log(
|
|
3793
|
+
console.log(chalk10.yellow(`
|
|
3151
3794
|
Next: ${result.next_action}`));
|
|
3152
3795
|
}
|
|
3153
3796
|
} catch (err) {
|
|
@@ -3183,13 +3826,21 @@ async function formCreateCommand(opts) {
|
|
|
3183
3826
|
if (opts.rofr !== void 0) payload.right_of_first_refusal = opts.rofr;
|
|
3184
3827
|
const companyAddress = parseCsvAddress(opts.companyAddress);
|
|
3185
3828
|
if (companyAddress) payload.company_address = companyAddress;
|
|
3829
|
+
if (opts.dryRun) {
|
|
3830
|
+
printDryRun("formation.create_pending", payload);
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3186
3833
|
const result = await client.createPendingEntity(payload);
|
|
3834
|
+
if (opts.json) {
|
|
3835
|
+
printJson(result);
|
|
3836
|
+
return;
|
|
3837
|
+
}
|
|
3187
3838
|
printSuccess(`Pending entity created: ${result.entity_id}`);
|
|
3188
3839
|
console.log(` Name: ${result.legal_name}`);
|
|
3189
3840
|
console.log(` Type: ${result.entity_type}`);
|
|
3190
3841
|
console.log(` Jurisdiction: ${result.jurisdiction}`);
|
|
3191
3842
|
console.log(` Status: ${result.formation_status}`);
|
|
3192
|
-
console.log(
|
|
3843
|
+
console.log(chalk10.yellow(`
|
|
3193
3844
|
Next: corp form add-founder ${result.entity_id} --name "..." --email "..." --role member --pct 50`));
|
|
3194
3845
|
} catch (err) {
|
|
3195
3846
|
printError(`Failed to create pending entity: ${err}`);
|
|
@@ -3210,14 +3861,22 @@ async function formAddFounderCommand(entityId, opts) {
|
|
|
3210
3861
|
if (opts.incorporator) payload.is_incorporator = true;
|
|
3211
3862
|
const address = parseCsvAddress(opts.address);
|
|
3212
3863
|
if (address) payload.address = address;
|
|
3864
|
+
if (opts.dryRun) {
|
|
3865
|
+
printDryRun("formation.add_founder", { entity_id: entityId, ...payload });
|
|
3866
|
+
return;
|
|
3867
|
+
}
|
|
3213
3868
|
const result = await client.addFounder(entityId, payload);
|
|
3869
|
+
if (opts.json) {
|
|
3870
|
+
printJson(result);
|
|
3871
|
+
return;
|
|
3872
|
+
}
|
|
3214
3873
|
printSuccess(`Founder added (${result.member_count} total)`);
|
|
3215
3874
|
const members = result.members ?? [];
|
|
3216
3875
|
for (const m of members) {
|
|
3217
3876
|
const pct = typeof m.ownership_pct === "number" ? ` (${m.ownership_pct}%)` : "";
|
|
3218
3877
|
console.log(` - ${m.name} <${m.email ?? "no email"}> [${m.role ?? "member"}]${pct}`);
|
|
3219
3878
|
}
|
|
3220
|
-
console.log(
|
|
3879
|
+
console.log(chalk10.yellow(`
|
|
3221
3880
|
Next: add more founders or run: corp form finalize ${entityId}`));
|
|
3222
3881
|
} catch (err) {
|
|
3223
3882
|
printError(`Failed to add founder: ${err}`);
|
|
@@ -3246,7 +3905,17 @@ async function formFinalizeCommand(entityId, opts) {
|
|
|
3246
3905
|
if (opts.rofr !== void 0) payload.right_of_first_refusal = opts.rofr;
|
|
3247
3906
|
const companyAddress = parseCsvAddress(opts.companyAddress);
|
|
3248
3907
|
if (companyAddress) payload.company_address = companyAddress;
|
|
3908
|
+
if (opts.incorporatorName) payload.incorporator_name = opts.incorporatorName;
|
|
3909
|
+
if (opts.incorporatorAddress) payload.incorporator_address = opts.incorporatorAddress;
|
|
3910
|
+
if (opts.dryRun) {
|
|
3911
|
+
printDryRun("formation.finalize", { entity_id: entityId, ...payload });
|
|
3912
|
+
return;
|
|
3913
|
+
}
|
|
3249
3914
|
const result = await client.finalizeFormation(entityId, payload);
|
|
3915
|
+
if (opts.json) {
|
|
3916
|
+
printJson(result);
|
|
3917
|
+
return;
|
|
3918
|
+
}
|
|
3250
3919
|
printSuccess(`Formation finalized: ${result.entity_id}`);
|
|
3251
3920
|
if (result.legal_entity_id) console.log(` Legal Entity ID: ${result.legal_entity_id}`);
|
|
3252
3921
|
if (result.instrument_id) console.log(` Instrument ID: ${result.instrument_id}`);
|
|
@@ -3258,17 +3927,17 @@ async function formFinalizeCommand(entityId, opts) {
|
|
|
3258
3927
|
if (holders.length > 0) {
|
|
3259
3928
|
console.log();
|
|
3260
3929
|
const table = new Table2({
|
|
3261
|
-
head: [
|
|
3930
|
+
head: [chalk10.dim("Holder"), chalk10.dim("Shares"), chalk10.dim("Ownership %")]
|
|
3262
3931
|
});
|
|
3263
3932
|
for (const h of holders) {
|
|
3264
3933
|
const pct = typeof h.ownership_pct === "number" ? `${h.ownership_pct.toFixed(1)}%` : "\u2014";
|
|
3265
3934
|
table.push([String(h.name ?? "?"), String(h.shares ?? 0), pct]);
|
|
3266
3935
|
}
|
|
3267
|
-
console.log(
|
|
3936
|
+
console.log(chalk10.bold(" Cap Table:"));
|
|
3268
3937
|
console.log(table.toString());
|
|
3269
3938
|
}
|
|
3270
3939
|
if (result.next_action) {
|
|
3271
|
-
console.log(
|
|
3940
|
+
console.log(chalk10.yellow(`
|
|
3272
3941
|
Next: ${result.next_action}`));
|
|
3273
3942
|
}
|
|
3274
3943
|
} catch (err) {
|
|
@@ -3290,7 +3959,7 @@ var api_keys_exports = {};
|
|
|
3290
3959
|
__export(api_keys_exports, {
|
|
3291
3960
|
apiKeysCommand: () => apiKeysCommand
|
|
3292
3961
|
});
|
|
3293
|
-
import
|
|
3962
|
+
import chalk11 from "chalk";
|
|
3294
3963
|
import Table3 from "cli-table3";
|
|
3295
3964
|
async function apiKeysCommand(opts) {
|
|
3296
3965
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
@@ -3310,9 +3979,9 @@ async function apiKeysCommand(opts) {
|
|
|
3310
3979
|
return;
|
|
3311
3980
|
}
|
|
3312
3981
|
console.log(`
|
|
3313
|
-
${
|
|
3982
|
+
${chalk11.bold("API Keys")}`);
|
|
3314
3983
|
const table = new Table3({
|
|
3315
|
-
head: [
|
|
3984
|
+
head: [chalk11.dim("ID"), chalk11.dim("Name"), chalk11.dim("Key"), chalk11.dim("Created")]
|
|
3316
3985
|
});
|
|
3317
3986
|
for (const k of keys) {
|
|
3318
3987
|
table.push([
|
|
@@ -3364,12 +4033,43 @@ var init_demo = __esm({
|
|
|
3364
4033
|
}
|
|
3365
4034
|
});
|
|
3366
4035
|
|
|
4036
|
+
// src/commands/feedback.ts
|
|
4037
|
+
var feedback_exports = {};
|
|
4038
|
+
__export(feedback_exports, {
|
|
4039
|
+
feedbackCommand: () => feedbackCommand
|
|
4040
|
+
});
|
|
4041
|
+
import chalk12 from "chalk";
|
|
4042
|
+
async function feedbackCommand(message, opts) {
|
|
4043
|
+
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
4044
|
+
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
4045
|
+
try {
|
|
4046
|
+
const result = await client.submitFeedback(message, opts.category, opts.email);
|
|
4047
|
+
if (opts.json) {
|
|
4048
|
+
printJson(result);
|
|
4049
|
+
return;
|
|
4050
|
+
}
|
|
4051
|
+
console.log(`
|
|
4052
|
+
${chalk12.green("\u2713")} Feedback submitted (${chalk12.dim(result.feedback_id)})`);
|
|
4053
|
+
} catch (err) {
|
|
4054
|
+
printError("Failed to submit feedback", err);
|
|
4055
|
+
process.exit(1);
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
var init_feedback = __esm({
|
|
4059
|
+
"src/commands/feedback.ts"() {
|
|
4060
|
+
"use strict";
|
|
4061
|
+
init_config();
|
|
4062
|
+
init_api_client();
|
|
4063
|
+
init_output();
|
|
4064
|
+
}
|
|
4065
|
+
});
|
|
4066
|
+
|
|
3367
4067
|
// src/commands/serve.ts
|
|
3368
4068
|
var serve_exports = {};
|
|
3369
4069
|
__export(serve_exports, {
|
|
3370
4070
|
serveCommand: () => serveCommand
|
|
3371
4071
|
});
|
|
3372
|
-
import { readFileSync as
|
|
4072
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync2 } from "fs";
|
|
3373
4073
|
import { resolve } from "path";
|
|
3374
4074
|
import { randomBytes } from "crypto";
|
|
3375
4075
|
function generateFernetKey() {
|
|
@@ -3380,7 +4080,7 @@ function generateSecret(length = 32) {
|
|
|
3380
4080
|
}
|
|
3381
4081
|
function loadEnvFile(path) {
|
|
3382
4082
|
if (!existsSync2(path)) return;
|
|
3383
|
-
const content =
|
|
4083
|
+
const content = readFileSync4(path, "utf-8");
|
|
3384
4084
|
for (const line of content.split("\n")) {
|
|
3385
4085
|
const trimmed = line.trim();
|
|
3386
4086
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -3508,6 +4208,25 @@ function inheritOption(localValue, parentValue) {
|
|
|
3508
4208
|
// src/index.ts
|
|
3509
4209
|
var require2 = createRequire(import.meta.url);
|
|
3510
4210
|
var pkg = require2("../package.json");
|
|
4211
|
+
var TAX_DOCUMENT_TYPE_CHOICES = [
|
|
4212
|
+
"1120",
|
|
4213
|
+
"1120s",
|
|
4214
|
+
"1065",
|
|
4215
|
+
"franchise_tax",
|
|
4216
|
+
"annual_report",
|
|
4217
|
+
"83b",
|
|
4218
|
+
"form_1120",
|
|
4219
|
+
"form_1120s",
|
|
4220
|
+
"form_1065",
|
|
4221
|
+
"1099_nec",
|
|
4222
|
+
"form_1099_nec",
|
|
4223
|
+
"k1",
|
|
4224
|
+
"form_k1",
|
|
4225
|
+
"941",
|
|
4226
|
+
"form_941",
|
|
4227
|
+
"w2",
|
|
4228
|
+
"form_w2"
|
|
4229
|
+
];
|
|
3511
4230
|
var program = new Command();
|
|
3512
4231
|
program.name("corp").description("corp \u2014 Corporate governance from the terminal").version(pkg.version);
|
|
3513
4232
|
program.command("setup").description("Interactive setup wizard").action(async () => {
|
|
@@ -3518,6 +4237,14 @@ program.command("status").description("Workspace summary").action(async () => {
|
|
|
3518
4237
|
const { statusCommand: statusCommand2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
3519
4238
|
await statusCommand2();
|
|
3520
4239
|
});
|
|
4240
|
+
program.command("context").alias("whoami").description("Show the active workspace, user, and entity context").option("--json", "Output as JSON").action(async (opts) => {
|
|
4241
|
+
const { contextCommand: contextCommand2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
4242
|
+
await contextCommand2(opts);
|
|
4243
|
+
});
|
|
4244
|
+
program.command("schema").description("Dump the CLI command catalog as JSON").option("--compact", "Emit compact JSON").action(async (opts) => {
|
|
4245
|
+
const { schemaCommand: schemaCommand2 } = await Promise.resolve().then(() => (init_schema(), schema_exports));
|
|
4246
|
+
schemaCommand2(program, opts);
|
|
4247
|
+
});
|
|
3521
4248
|
var configCmd = program.command("config").description("Manage configuration");
|
|
3522
4249
|
configCmd.command("set <key> <value>").description("Set a config value (dot-path)").action(async (key, value) => {
|
|
3523
4250
|
const { configSetCommand: configSetCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
|
|
@@ -3584,15 +4311,23 @@ contactsCmd.command("show <contact-id>").option("--json", "Output as JSON").desc
|
|
|
3584
4311
|
json: inheritOption(opts.json, parent.json)
|
|
3585
4312
|
});
|
|
3586
4313
|
});
|
|
3587
|
-
contactsCmd.command("add").requiredOption("--name <name>", "Contact name").requiredOption("--email <email>", "Contact email").option("--type <type>", "Contact type (individual, organization)", "individual").option("--category <category>", "Category (employee, contractor, board_member, investor, law_firm, valuation_firm, accounting_firm, officer, founder, member, other)").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").description("Add a new contact").action(async (opts, cmd) => {
|
|
4314
|
+
contactsCmd.command("add").requiredOption("--name <name>", "Contact name").requiredOption("--email <email>", "Contact email").option("--type <type>", "Contact type (individual, organization)", "individual").option("--category <category>", "Category (employee, contractor, board_member, investor, law_firm, valuation_firm, accounting_firm, officer, founder, member, other)").option("--address <address>", "Mailing address").option("--mailing-address <address>", "Alias for --address").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").option("--json", "Output as JSON").description("Add a new contact").action(async (opts, cmd) => {
|
|
3588
4315
|
const parent = cmd.parent.opts();
|
|
3589
4316
|
const { contactsAddCommand: contactsAddCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3590
|
-
await contactsAddCommand2({
|
|
4317
|
+
await contactsAddCommand2({
|
|
4318
|
+
...opts,
|
|
4319
|
+
entityId: parent.entityId,
|
|
4320
|
+
json: inheritOption(opts.json, parent.json)
|
|
4321
|
+
});
|
|
3591
4322
|
});
|
|
3592
|
-
contactsCmd.command("edit <contact-id>").option("--name <name>", "Contact name").option("--email <email>", "Contact email").option("--category <category>", "Contact category").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").description("Edit an existing contact").action(async (contactId, opts, cmd) => {
|
|
4323
|
+
contactsCmd.command("edit <contact-id>").option("--name <name>", "Contact name").option("--email <email>", "Contact email").option("--category <category>", "Contact category").option("--address <address>", "Mailing address").option("--mailing-address <address>", "Alias for --address").option("--phone <phone>", "Phone number").option("--notes <notes>", "Notes").option("--json", "Output as JSON").description("Edit an existing contact").action(async (contactId, opts, cmd) => {
|
|
3593
4324
|
const parent = cmd.parent.opts();
|
|
3594
4325
|
const { contactsEditCommand: contactsEditCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3595
|
-
await contactsEditCommand2(contactId, {
|
|
4326
|
+
await contactsEditCommand2(contactId, {
|
|
4327
|
+
...opts,
|
|
4328
|
+
entityId: parent.entityId,
|
|
4329
|
+
json: inheritOption(opts.json, parent.json)
|
|
4330
|
+
});
|
|
3596
4331
|
});
|
|
3597
4332
|
var capTableCmd = program.command("cap-table").description("Cap table, equity grants, SAFEs, transfers, and valuations").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
|
|
3598
4333
|
const { capTableCommand: capTableCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
@@ -3618,55 +4353,97 @@ capTableCmd.command("409a").description("Current 409A valuation").action(async (
|
|
|
3618
4353
|
const { fourOhNineACommand: fourOhNineACommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3619
4354
|
await fourOhNineACommand2(parent);
|
|
3620
4355
|
});
|
|
3621
|
-
capTableCmd.command("issue-equity").requiredOption("--grant-type <type>", "Grant type (common, preferred, membership_unit, stock_option, iso, nso, rsa)").requiredOption("--shares <n>", "Number of shares", parseInt).requiredOption("--recipient <name>", "Recipient name").option("--email <email>", "Recipient email (auto-creates contact if needed)").option("--instrument-id <id>", "Instrument ID (auto-detected from cap table if omitted)").description("Issue an equity grant (creates a round, adds security, and issues it)").action(async (opts, cmd) => {
|
|
4356
|
+
capTableCmd.command("issue-equity").requiredOption("--grant-type <type>", "Grant type (common, preferred, membership_unit, stock_option, iso, nso, rsa)").requiredOption("--shares <n>", "Number of shares", parseInt).requiredOption("--recipient <name>", "Recipient name").option("--email <email>", "Recipient email (auto-creates contact if needed)").option("--instrument-id <id>", "Instrument ID (auto-detected from cap table if omitted)").option("--meeting-id <id>", "Board meeting ID required when a board approval already exists or is being recorded").option("--resolution-id <id>", "Board resolution ID required when issuing under a board-governed entity").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the round").description("Issue an equity grant (creates a round, adds security, and issues it)").action(async (opts, cmd) => {
|
|
3622
4357
|
const parent = cmd.parent.opts();
|
|
3623
4358
|
const { issueEquityCommand: issueEquityCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3624
|
-
await issueEquityCommand2({
|
|
4359
|
+
await issueEquityCommand2({
|
|
4360
|
+
...opts,
|
|
4361
|
+
entityId: parent.entityId,
|
|
4362
|
+
json: inheritOption(opts.json, parent.json)
|
|
4363
|
+
});
|
|
3625
4364
|
});
|
|
3626
|
-
capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor name").requiredOption("--amount <n>", "Principal amount in cents", parseInt).option("--safe-type <type>", "SAFE type", "post_money").requiredOption("--valuation-cap <n>", "Valuation cap in cents", parseInt).description("Issue a SAFE note").action(async (opts, cmd) => {
|
|
4365
|
+
capTableCmd.command("issue-safe").requiredOption("--investor <name>", "Investor name").requiredOption("--amount <n>", "Principal amount in cents", parseInt).option("--safe-type <type>", "SAFE type", "post_money").requiredOption("--valuation-cap <n>", "Valuation cap in cents", parseInt).option("--meeting-id <id>", "Board meeting ID required when issuing under a board-governed entity").option("--resolution-id <id>", "Board resolution ID required when issuing under a board-governed entity").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the round").description("Issue a SAFE note").action(async (opts, cmd) => {
|
|
3627
4366
|
const parent = cmd.parent.opts();
|
|
3628
4367
|
const { issueSafeCommand: issueSafeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3629
|
-
await issueSafeCommand2({
|
|
4368
|
+
await issueSafeCommand2({
|
|
4369
|
+
...opts,
|
|
4370
|
+
entityId: parent.entityId,
|
|
4371
|
+
json: inheritOption(opts.json, parent.json)
|
|
4372
|
+
});
|
|
3630
4373
|
});
|
|
3631
|
-
capTableCmd.command("transfer").requiredOption("--from <id>", "Source contact ID (from_contact_id)").requiredOption("--to <id>", "Destination contact ID (to_contact_id)").requiredOption("--shares <n>", "Number of shares to transfer", parseInt).requiredOption("--share-class-id <id>", "Share class ID").requiredOption("--governing-doc-type <type>", "Governing doc type (bylaws, operating_agreement, shareholder_agreement, other)").requiredOption("--transferee-rights <rights>", "Transferee rights (full_member, economic_only, limited)").option("--prepare-intent-id <id>", "Prepare intent ID (auto-created if omitted)").option("--type <type>", "Transfer type (gift, trust_transfer, secondary_sale, estate, other)", "secondary_sale").option("--price-per-share-cents <n>", "Price per share in cents", parseInt).option("--relationship <rel>", "Relationship to holder").description("Create a share transfer workflow").action(async (opts, cmd) => {
|
|
4374
|
+
capTableCmd.command("transfer").requiredOption("--from <id>", "Source contact ID (from_contact_id)").requiredOption("--to <id>", "Destination contact ID (to_contact_id)").requiredOption("--shares <n>", "Number of shares to transfer", parseInt).requiredOption("--share-class-id <id>", "Share class ID").requiredOption("--governing-doc-type <type>", "Governing doc type (bylaws, operating_agreement, shareholder_agreement, other)").requiredOption("--transferee-rights <rights>", "Transferee rights (full_member, economic_only, limited)").option("--prepare-intent-id <id>", "Prepare intent ID (auto-created if omitted)").option("--type <type>", "Transfer type (gift, trust_transfer, secondary_sale, estate, other)", "secondary_sale").option("--price-per-share-cents <n>", "Price per share in cents", parseInt).option("--relationship <rel>", "Relationship to holder").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the workflow").description("Create a share transfer workflow").action(async (opts, cmd) => {
|
|
3632
4375
|
const parent = cmd.parent.opts();
|
|
3633
4376
|
const { transferSharesCommand: transferSharesCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3634
|
-
await transferSharesCommand2({
|
|
4377
|
+
await transferSharesCommand2({
|
|
4378
|
+
...opts,
|
|
4379
|
+
entityId: parent.entityId,
|
|
4380
|
+
json: inheritOption(opts.json, parent.json)
|
|
4381
|
+
});
|
|
3635
4382
|
});
|
|
3636
|
-
capTableCmd.command("distribute").requiredOption("--amount <n>", "Total distribution amount in cents", parseInt).option("--type <type>", "Distribution type (dividend, return, liquidation)", "dividend").requiredOption("--description <desc>", "Distribution description").description("Calculate a distribution").action(async (opts, cmd) => {
|
|
4383
|
+
capTableCmd.command("distribute").requiredOption("--amount <n>", "Total distribution amount in cents", parseInt).option("--type <type>", "Distribution type (dividend, return, liquidation)", "dividend").requiredOption("--description <desc>", "Distribution description").option("--json", "Output as JSON").option("--dry-run", "Show the request without calculating the distribution").description("Calculate a distribution").action(async (opts, cmd) => {
|
|
3637
4384
|
const parent = cmd.parent.opts();
|
|
3638
4385
|
const { distributeCommand: distributeCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3639
|
-
await distributeCommand2({
|
|
4386
|
+
await distributeCommand2({
|
|
4387
|
+
...opts,
|
|
4388
|
+
entityId: parent.entityId,
|
|
4389
|
+
json: inheritOption(opts.json, parent.json)
|
|
4390
|
+
});
|
|
3640
4391
|
});
|
|
3641
|
-
capTableCmd.command("start-round").requiredOption("--name <name>", "Round name").requiredOption("--issuer-legal-entity-id <id>", "Issuer legal entity ID").description("Start a staged equity round").action(async (opts, cmd) => {
|
|
4392
|
+
capTableCmd.command("start-round").requiredOption("--name <name>", "Round name").requiredOption("--issuer-legal-entity-id <id>", "Issuer legal entity ID").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the round").description("Start a staged equity round").action(async (opts, cmd) => {
|
|
3642
4393
|
const parent = cmd.parent.opts();
|
|
3643
4394
|
const { startRoundCommand: startRoundCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3644
|
-
await startRoundCommand2({
|
|
4395
|
+
await startRoundCommand2({
|
|
4396
|
+
...opts,
|
|
4397
|
+
entityId: parent.entityId,
|
|
4398
|
+
json: inheritOption(opts.json, parent.json)
|
|
4399
|
+
});
|
|
3645
4400
|
});
|
|
3646
|
-
capTableCmd.command("add-security").requiredOption("--round-id <id>", "Round ID").requiredOption("--instrument-id <id>", "Instrument ID").requiredOption("--quantity <n>", "Number of shares/units", parseInt).requiredOption("--recipient-name <name>", "Recipient display name").option("--holder-id <id>", "Existing holder ID").option("--email <email>", "Recipient email (to find or create holder)").option("--principal-cents <n>", "Principal amount in cents", parseInt).option("--grant-type <type>", "Grant type").description("Add a security to a staged equity round").action(async (opts, cmd) => {
|
|
4401
|
+
capTableCmd.command("add-security").requiredOption("--round-id <id>", "Round ID").requiredOption("--instrument-id <id>", "Instrument ID").requiredOption("--quantity <n>", "Number of shares/units", parseInt).requiredOption("--recipient-name <name>", "Recipient display name").option("--holder-id <id>", "Existing holder ID").option("--email <email>", "Recipient email (to find or create holder)").option("--principal-cents <n>", "Principal amount in cents", parseInt).option("--grant-type <type>", "Grant type").option("--json", "Output as JSON").option("--dry-run", "Show the request without adding the security").description("Add a security to a staged equity round").action(async (opts, cmd) => {
|
|
3647
4402
|
const parent = cmd.parent.opts();
|
|
3648
4403
|
const { addSecurityCommand: addSecurityCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3649
|
-
await addSecurityCommand2({
|
|
4404
|
+
await addSecurityCommand2({
|
|
4405
|
+
...opts,
|
|
4406
|
+
entityId: parent.entityId,
|
|
4407
|
+
json: inheritOption(opts.json, parent.json)
|
|
4408
|
+
});
|
|
3650
4409
|
});
|
|
3651
|
-
capTableCmd.command("issue-round").requiredOption("--round-id <id>", "Round ID").description("Issue all securities and close a staged round").action(async (opts, cmd) => {
|
|
4410
|
+
capTableCmd.command("issue-round").option("--json", "Output as JSON").option("--dry-run", "Show the request without issuing the round").requiredOption("--round-id <id>", "Round ID").description("Issue all securities and close a staged round").action(async (opts, cmd) => {
|
|
3652
4411
|
const parent = cmd.parent.opts();
|
|
3653
4412
|
const { issueRoundCommand: issueRoundCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3654
|
-
await issueRoundCommand2({
|
|
4413
|
+
await issueRoundCommand2({
|
|
4414
|
+
...opts,
|
|
4415
|
+
entityId: parent.entityId,
|
|
4416
|
+
json: inheritOption(opts.json, parent.json)
|
|
4417
|
+
});
|
|
3655
4418
|
});
|
|
3656
|
-
capTableCmd.command("create-valuation").requiredOption("--type <type>", "Valuation type (four_oh_nine_a, fair_market_value, etc.)").requiredOption("--date <date>", "Effective date (ISO 8601)").requiredOption("--methodology <method>", "Methodology (income, market, asset, backsolve, hybrid)").option("--fmv <cents>", "FMV per share in cents", parseInt).option("--enterprise-value <cents>", "Enterprise value in cents", parseInt).description("Create a valuation").action(async (opts, cmd) => {
|
|
4419
|
+
capTableCmd.command("create-valuation").requiredOption("--type <type>", "Valuation type (four_oh_nine_a, fair_market_value, etc.)").requiredOption("--date <date>", "Effective date (ISO 8601)").requiredOption("--methodology <method>", "Methodology (income, market, asset, backsolve, hybrid)").option("--fmv <cents>", "FMV per share in cents", parseInt).option("--enterprise-value <cents>", "Enterprise value in cents", parseInt).option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the valuation").description("Create a valuation").action(async (opts, cmd) => {
|
|
3657
4420
|
const parent = cmd.parent.opts();
|
|
3658
4421
|
const { createValuationCommand: createValuationCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3659
|
-
await createValuationCommand2({
|
|
4422
|
+
await createValuationCommand2({
|
|
4423
|
+
...opts,
|
|
4424
|
+
entityId: parent.entityId,
|
|
4425
|
+
json: inheritOption(opts.json, parent.json)
|
|
4426
|
+
});
|
|
3660
4427
|
});
|
|
3661
|
-
capTableCmd.command("submit-valuation <valuation-id>").description("Submit a valuation for board approval").action(async (valuationId,
|
|
4428
|
+
capTableCmd.command("submit-valuation <valuation-id>").option("--json", "Output as JSON").option("--dry-run", "Show the request without submitting the valuation").description("Submit a valuation for board approval").action(async (valuationId, opts, cmd) => {
|
|
3662
4429
|
const parent = cmd.parent.opts();
|
|
3663
4430
|
const { submitValuationCommand: submitValuationCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3664
|
-
await submitValuationCommand2({
|
|
4431
|
+
await submitValuationCommand2({
|
|
4432
|
+
...opts,
|
|
4433
|
+
valuationId,
|
|
4434
|
+
entityId: parent.entityId,
|
|
4435
|
+
json: inheritOption(opts.json, parent.json)
|
|
4436
|
+
});
|
|
3665
4437
|
});
|
|
3666
|
-
capTableCmd.command("approve-valuation <valuation-id>").option("--resolution-id <id>", "Resolution ID from the board vote").description("Approve a valuation").action(async (valuationId, opts, cmd) => {
|
|
4438
|
+
capTableCmd.command("approve-valuation <valuation-id>").option("--resolution-id <id>", "Resolution ID from the board vote").option("--json", "Output as JSON").option("--dry-run", "Show the request without approving the valuation").description("Approve a valuation").action(async (valuationId, opts, cmd) => {
|
|
3667
4439
|
const parent = cmd.parent.opts();
|
|
3668
4440
|
const { approveValuationCommand: approveValuationCommand2 } = await Promise.resolve().then(() => (init_cap_table(), cap_table_exports));
|
|
3669
|
-
await approveValuationCommand2({
|
|
4441
|
+
await approveValuationCommand2({
|
|
4442
|
+
...opts,
|
|
4443
|
+
valuationId,
|
|
4444
|
+
entityId: parent.entityId,
|
|
4445
|
+
json: inheritOption(opts.json, parent.json)
|
|
4446
|
+
});
|
|
3670
4447
|
});
|
|
3671
4448
|
var financeCmd = program.command("finance").description("Invoicing, payroll, payments, banking").option("--entity-id <id>", "Entity ID (overrides active entity)");
|
|
3672
4449
|
financeCmd.command("invoice").requiredOption("--customer <name>", "Customer name").requiredOption("--amount <n>", "Amount in cents", parseInt).requiredOption("--due-date <date>", "Due date (ISO 8601)").option("--description <desc>", "Description", "Services rendered").description("Create an invoice").action(async (opts, cmd) => {
|
|
@@ -3703,15 +4480,23 @@ var governanceCmd = program.command("governance").description("Governance bodies
|
|
|
3703
4480
|
const { governanceListCommand: governanceListCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3704
4481
|
await governanceListCommand2(opts);
|
|
3705
4482
|
});
|
|
3706
|
-
governanceCmd.command("create-body").requiredOption("--name <name>", "Body name (e.g. 'Board of Directors')").requiredOption("--body-type <type>", "Body type (board_of_directors, llc_member_vote)").option("--quorum <rule>", "Quorum rule (majority, supermajority, unanimous)", "majority").option("--voting <method>", "Voting method (per_capita, per_unit)", "per_capita").description("Create a governance body").action(async (opts, cmd) => {
|
|
4483
|
+
governanceCmd.command("create-body").requiredOption("--name <name>", "Body name (e.g. 'Board of Directors')").requiredOption("--body-type <type>", "Body type (board_of_directors, llc_member_vote)").option("--quorum <rule>", "Quorum rule (majority, supermajority, unanimous)", "majority").option("--voting <method>", "Voting method (per_capita, per_unit)", "per_capita").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the governance body").description("Create a governance body").action(async (opts, cmd) => {
|
|
3707
4484
|
const parent = cmd.parent.opts();
|
|
3708
4485
|
const { governanceCreateBodyCommand: governanceCreateBodyCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3709
|
-
await governanceCreateBodyCommand2({
|
|
4486
|
+
await governanceCreateBodyCommand2({
|
|
4487
|
+
...opts,
|
|
4488
|
+
entityId: parent.entityId,
|
|
4489
|
+
json: inheritOption(opts.json, parent.json)
|
|
4490
|
+
});
|
|
3710
4491
|
});
|
|
3711
|
-
governanceCmd.command("add-seat <body-id>").requiredOption("--holder <contact-id>", "Contact ID for the seat holder").option("--role <role>", "Seat role (chair, member, officer, observer)", "member").description("Add a seat to a governance body").action(async (bodyId, opts, cmd) => {
|
|
4492
|
+
governanceCmd.command("add-seat <body-id>").requiredOption("--holder <contact-id>", "Contact ID for the seat holder").option("--role <role>", "Seat role (chair, member, officer, observer)", "member").option("--json", "Output as JSON").option("--dry-run", "Show the request without adding the seat").description("Add a seat to a governance body").action(async (bodyId, opts, cmd) => {
|
|
3712
4493
|
const parent = cmd.parent.opts();
|
|
3713
4494
|
const { governanceAddSeatCommand: governanceAddSeatCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3714
|
-
await governanceAddSeatCommand2(bodyId, {
|
|
4495
|
+
await governanceAddSeatCommand2(bodyId, {
|
|
4496
|
+
...opts,
|
|
4497
|
+
entityId: parent.entityId,
|
|
4498
|
+
json: inheritOption(opts.json, parent.json)
|
|
4499
|
+
});
|
|
3715
4500
|
});
|
|
3716
4501
|
governanceCmd.command("seats <body-id>").description("Seats for a governance body").action(async (bodyId, _opts, cmd) => {
|
|
3717
4502
|
const parent = cmd.parent.opts();
|
|
@@ -3728,53 +4513,92 @@ governanceCmd.command("resolutions <meeting-id>").description("Resolutions for a
|
|
|
3728
4513
|
const { governanceResolutionsCommand: governanceResolutionsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3729
4514
|
await governanceResolutionsCommand2(meetingId, parent);
|
|
3730
4515
|
});
|
|
3731
|
-
governanceCmd.command("convene").requiredOption("--body <id>", "Governance body ID").requiredOption("--type <type>", "Meeting type (board_meeting, shareholder_meeting, member_meeting, written_consent)").requiredOption("--title <title>", "Meeting title").
|
|
4516
|
+
governanceCmd.command("convene").requiredOption("--body <id>", "Governance body ID").requiredOption("--type <type>", "Meeting type (board_meeting, shareholder_meeting, member_meeting, written_consent)").requiredOption("--title <title>", "Meeting title").option("--date <date>", "Meeting date (ISO 8601)").option("--agenda <item>", "Agenda item (repeatable)", (v, a) => [...a, v], []).option("--json", "Output as JSON").option("--dry-run", "Show the request without scheduling the meeting").description("Convene a governance meeting").action(async (opts, cmd) => {
|
|
3732
4517
|
const parent = cmd.parent.opts();
|
|
3733
4518
|
const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3734
|
-
await governanceConveneCommand2({
|
|
4519
|
+
await governanceConveneCommand2({
|
|
4520
|
+
...opts,
|
|
4521
|
+
meetingType: opts.type,
|
|
4522
|
+
entityId: parent.entityId,
|
|
4523
|
+
json: inheritOption(opts.json, parent.json)
|
|
4524
|
+
});
|
|
3735
4525
|
});
|
|
3736
|
-
governanceCmd.command("
|
|
4526
|
+
governanceCmd.command("open <meeting-id>").requiredOption("--present-seat <id>", "Seat ID present at the meeting (repeatable)", (v, a) => [...a ?? [], v]).option("--json", "Output as JSON").option("--dry-run", "Show the request without opening the meeting").description("Open a scheduled meeting for voting").action(async (meetingId, opts, cmd) => {
|
|
4527
|
+
const parent = cmd.parent.opts();
|
|
4528
|
+
const { governanceOpenMeetingCommand: governanceOpenMeetingCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
4529
|
+
await governanceOpenMeetingCommand2(meetingId, {
|
|
4530
|
+
...opts,
|
|
4531
|
+
entityId: parent.entityId,
|
|
4532
|
+
json: inheritOption(opts.json, parent.json)
|
|
4533
|
+
});
|
|
4534
|
+
});
|
|
4535
|
+
governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").addOption(new Option("--vote <value>", "Vote (for, against, abstain, recusal)").choices(["for", "against", "abstain", "recusal"]).makeOptionMandatory()).option("--json", "Output as JSON").option("--dry-run", "Show the request without casting the vote").description("Cast a vote on an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
3737
4536
|
const parent = cmd.parent.opts();
|
|
3738
4537
|
const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3739
4538
|
await governanceVoteCommand2(meetingId, itemId, {
|
|
3740
4539
|
...opts,
|
|
3741
|
-
entityId: parent.entityId
|
|
4540
|
+
entityId: parent.entityId,
|
|
4541
|
+
json: inheritOption(opts.json, parent.json)
|
|
3742
4542
|
});
|
|
3743
4543
|
});
|
|
3744
|
-
governanceCmd.command("notice <meeting-id>").description("Send meeting notice").action(async (meetingId,
|
|
4544
|
+
governanceCmd.command("notice <meeting-id>").option("--json", "Output as JSON").option("--dry-run", "Show the request without sending notices").description("Send meeting notice").action(async (meetingId, opts, cmd) => {
|
|
3745
4545
|
const parent = cmd.parent.opts();
|
|
3746
4546
|
const { sendNoticeCommand: sendNoticeCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3747
|
-
await sendNoticeCommand2(meetingId, {
|
|
4547
|
+
await sendNoticeCommand2(meetingId, {
|
|
4548
|
+
...opts,
|
|
4549
|
+
entityId: parent.entityId,
|
|
4550
|
+
json: inheritOption(opts.json, parent.json)
|
|
4551
|
+
});
|
|
3748
4552
|
});
|
|
3749
|
-
governanceCmd.command("adjourn <meeting-id>").description("Adjourn a meeting").action(async (meetingId,
|
|
4553
|
+
governanceCmd.command("adjourn <meeting-id>").option("--json", "Output as JSON").option("--dry-run", "Show the request without adjourning the meeting").description("Adjourn a meeting").action(async (meetingId, opts, cmd) => {
|
|
3750
4554
|
const parent = cmd.parent.opts();
|
|
3751
4555
|
const { adjournMeetingCommand: adjournMeetingCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3752
|
-
await adjournMeetingCommand2(meetingId, {
|
|
4556
|
+
await adjournMeetingCommand2(meetingId, {
|
|
4557
|
+
...opts,
|
|
4558
|
+
entityId: parent.entityId,
|
|
4559
|
+
json: inheritOption(opts.json, parent.json)
|
|
4560
|
+
});
|
|
3753
4561
|
});
|
|
3754
|
-
governanceCmd.command("cancel <meeting-id>").description("Cancel a meeting").action(async (meetingId,
|
|
4562
|
+
governanceCmd.command("cancel <meeting-id>").option("--json", "Output as JSON").option("--dry-run", "Show the request without cancelling the meeting").description("Cancel a meeting").action(async (meetingId, opts, cmd) => {
|
|
3755
4563
|
const parent = cmd.parent.opts();
|
|
3756
4564
|
const { cancelMeetingCommand: cancelMeetingCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3757
|
-
await cancelMeetingCommand2(meetingId, {
|
|
4565
|
+
await cancelMeetingCommand2(meetingId, {
|
|
4566
|
+
...opts,
|
|
4567
|
+
entityId: parent.entityId,
|
|
4568
|
+
json: inheritOption(opts.json, parent.json)
|
|
4569
|
+
});
|
|
3758
4570
|
});
|
|
3759
4571
|
governanceCmd.command("agenda-items <meeting-id>").description("List agenda items for a meeting").action(async (meetingId, _opts, cmd) => {
|
|
3760
4572
|
const parent = cmd.parent.opts();
|
|
3761
4573
|
const { listAgendaItemsCommand: listAgendaItemsCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3762
4574
|
await listAgendaItemsCommand2(meetingId, { entityId: parent.entityId, json: parent.json });
|
|
3763
4575
|
});
|
|
3764
|
-
governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status: voted, discussed, tabled, withdrawn").description("Finalize an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
4576
|
+
governanceCmd.command("finalize-item <meeting-id> <item-id>").requiredOption("--status <status>", "Status: voted, discussed, tabled, withdrawn").option("--json", "Output as JSON").option("--dry-run", "Show the request without finalizing the item").description("Finalize an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
3765
4577
|
const parent = cmd.parent.opts();
|
|
3766
4578
|
const { finalizeAgendaItemCommand: finalizeAgendaItemCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3767
|
-
await finalizeAgendaItemCommand2(meetingId, itemId, {
|
|
4579
|
+
await finalizeAgendaItemCommand2(meetingId, itemId, {
|
|
4580
|
+
...opts,
|
|
4581
|
+
entityId: parent.entityId,
|
|
4582
|
+
json: inheritOption(opts.json, parent.json)
|
|
4583
|
+
});
|
|
3768
4584
|
});
|
|
3769
|
-
governanceCmd.command("resolve <meeting-id> <item-id>").requiredOption("--text <resolution_text>", "Resolution text").description("Compute a resolution for an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
4585
|
+
governanceCmd.command("resolve <meeting-id> <item-id>").requiredOption("--text <resolution_text>", "Resolution text").option("--json", "Output as JSON").option("--dry-run", "Show the request without computing the resolution").description("Compute a resolution for an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
3770
4586
|
const parent = cmd.parent.opts();
|
|
3771
4587
|
const { computeResolutionCommand: computeResolutionCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3772
|
-
await computeResolutionCommand2(meetingId, itemId, {
|
|
4588
|
+
await computeResolutionCommand2(meetingId, itemId, {
|
|
4589
|
+
...opts,
|
|
4590
|
+
entityId: parent.entityId,
|
|
4591
|
+
json: inheritOption(opts.json, parent.json)
|
|
4592
|
+
});
|
|
3773
4593
|
});
|
|
3774
|
-
governanceCmd.command("written-consent").requiredOption("--body <id>", "Governance body ID").requiredOption("--title <title>", "Title").requiredOption("--description <desc>", "Description").description("Create a written consent action").action(async (opts, cmd) => {
|
|
4594
|
+
governanceCmd.command("written-consent").requiredOption("--body <id>", "Governance body ID").requiredOption("--title <title>", "Title").requiredOption("--description <desc>", "Description").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the written consent").description("Create a written consent action").action(async (opts, cmd) => {
|
|
3775
4595
|
const parent = cmd.parent.opts();
|
|
3776
4596
|
const { writtenConsentCommand: writtenConsentCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3777
|
-
await writtenConsentCommand2({
|
|
4597
|
+
await writtenConsentCommand2({
|
|
4598
|
+
...opts,
|
|
4599
|
+
entityId: parent.entityId,
|
|
4600
|
+
json: inheritOption(opts.json, parent.json)
|
|
4601
|
+
});
|
|
3778
4602
|
});
|
|
3779
4603
|
var documentsCmd = program.command("documents").description("Documents and signing").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").action(async (opts) => {
|
|
3780
4604
|
const { documentsListCommand: documentsListCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
@@ -3785,26 +4609,42 @@ documentsCmd.command("signing-link <doc-id>").option("--entity-id <id>", "Entity
|
|
|
3785
4609
|
const { documentsSigningLinkCommand: documentsSigningLinkCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3786
4610
|
await documentsSigningLinkCommand2(docId, { entityId: opts.entityId ?? parent.entityId });
|
|
3787
4611
|
});
|
|
3788
|
-
documentsCmd.command("generate").requiredOption("--template <type>", "Template type (consulting_agreement, employment_offer, contractor_agreement, nda, custom)").requiredOption("--counterparty <name>", "Counterparty name").option("--effective-date <date>", "Effective date (ISO 8601, defaults to today)").description("Generate a contract from a template").action(async (opts, cmd) => {
|
|
4612
|
+
documentsCmd.command("generate").requiredOption("--template <type>", "Template type (consulting_agreement, employment_offer, contractor_agreement, nda, custom)").requiredOption("--counterparty <name>", "Counterparty name").option("--effective-date <date>", "Effective date (ISO 8601, defaults to today)").option("--base-salary <amount>", "Employment offer base salary (for employment_offer)").option("--param <key=value>", "Additional template parameter (repeatable)", (value, values) => [...values, value], []).option("--json", "Output as JSON").description("Generate a contract from a template").action(async (opts, cmd) => {
|
|
3789
4613
|
const parent = cmd.parent.opts();
|
|
3790
4614
|
const { documentsGenerateCommand: documentsGenerateCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3791
|
-
await documentsGenerateCommand2({
|
|
4615
|
+
await documentsGenerateCommand2({
|
|
4616
|
+
...opts,
|
|
4617
|
+
entityId: parent.entityId,
|
|
4618
|
+
json: inheritOption(opts.json, parent.json)
|
|
4619
|
+
});
|
|
3792
4620
|
});
|
|
3793
|
-
documentsCmd.command("preview-pdf").requiredOption("--
|
|
4621
|
+
documentsCmd.command("preview-pdf").requiredOption("--definition-id <id>", "AST document definition ID (e.g. 'bylaws')").option("--document-id <id>", "Deprecated alias for --definition-id").description("Validate and print the authenticated PDF preview URL for a governance document").action(async (opts, cmd) => {
|
|
3794
4622
|
const parent = cmd.parent.opts();
|
|
3795
4623
|
const { documentsPreviewPdfCommand: documentsPreviewPdfCommand2 } = await Promise.resolve().then(() => (init_documents(), documents_exports));
|
|
3796
|
-
await documentsPreviewPdfCommand2({
|
|
4624
|
+
await documentsPreviewPdfCommand2({
|
|
4625
|
+
...opts,
|
|
4626
|
+
documentId: opts.definitionId ?? opts.documentId,
|
|
4627
|
+
entityId: parent.entityId
|
|
4628
|
+
});
|
|
3797
4629
|
});
|
|
3798
4630
|
var taxCmd = program.command("tax").description("Tax filings and deadline tracking").option("--entity-id <id>", "Entity ID (overrides active entity)");
|
|
3799
|
-
taxCmd.command("file").
|
|
4631
|
+
taxCmd.command("file").addOption(new Option("--type <type>", `Document type (${TAX_DOCUMENT_TYPE_CHOICES.join(", ")})`).choices([...TAX_DOCUMENT_TYPE_CHOICES]).makeOptionMandatory()).requiredOption("--year <year>", "Tax year", parseInt).option("--json", "Output as JSON").description("File a tax document").action(async (opts, cmd) => {
|
|
3800
4632
|
const parent = cmd.parent.opts();
|
|
3801
4633
|
const { taxFileCommand: taxFileCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
|
|
3802
|
-
await taxFileCommand2({
|
|
4634
|
+
await taxFileCommand2({
|
|
4635
|
+
...opts,
|
|
4636
|
+
entityId: parent.entityId,
|
|
4637
|
+
json: inheritOption(opts.json, parent.json)
|
|
4638
|
+
});
|
|
3803
4639
|
});
|
|
3804
|
-
taxCmd.command("deadline").requiredOption("--type <type>", "Deadline type").requiredOption("--due-date <date>", "Due date (ISO 8601)").requiredOption("--description <desc>", "Description").option("--recurrence <recurrence>", "Recurrence (e.g. annual; 'yearly' is normalized)").description("Track a compliance deadline").action(async (opts, cmd) => {
|
|
4640
|
+
taxCmd.command("deadline").requiredOption("--type <type>", "Deadline type").requiredOption("--due-date <date>", "Due date (ISO 8601)").requiredOption("--description <desc>", "Description").option("--recurrence <recurrence>", "Recurrence (e.g. annual; 'yearly' is normalized)").option("--json", "Output as JSON").description("Track a compliance deadline").action(async (opts, cmd) => {
|
|
3805
4641
|
const parent = cmd.parent.opts();
|
|
3806
4642
|
const { taxDeadlineCommand: taxDeadlineCommand2 } = await Promise.resolve().then(() => (init_tax(), tax_exports));
|
|
3807
|
-
await taxDeadlineCommand2({
|
|
4643
|
+
await taxDeadlineCommand2({
|
|
4644
|
+
...opts,
|
|
4645
|
+
entityId: parent.entityId,
|
|
4646
|
+
json: inheritOption(opts.json, parent.json)
|
|
4647
|
+
});
|
|
3808
4648
|
});
|
|
3809
4649
|
var agentsCmd = program.command("agents").description("Agent management").option("--json", "Output as JSON").action(async (opts) => {
|
|
3810
4650
|
const { agentsListCommand: agentsListCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
@@ -3818,29 +4658,50 @@ agentsCmd.command("show <agent-id>").option("--json", "Output as JSON").descript
|
|
|
3818
4658
|
json: inheritOption(opts.json, parent.json)
|
|
3819
4659
|
});
|
|
3820
4660
|
});
|
|
3821
|
-
agentsCmd.command("create").requiredOption("--name <name>", "Agent name").requiredOption("--prompt <prompt>", "System prompt").option("--model <model>", "Model").description("Create a new agent").action(async (opts) => {
|
|
4661
|
+
agentsCmd.command("create").requiredOption("--name <name>", "Agent name").requiredOption("--prompt <prompt>", "System prompt").option("--model <model>", "Model").option("--json", "Output as JSON").description("Create a new agent").action(async (opts, cmd) => {
|
|
4662
|
+
const parent = cmd.parent.opts();
|
|
3822
4663
|
const { agentsCreateCommand: agentsCreateCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3823
|
-
await agentsCreateCommand2(
|
|
4664
|
+
await agentsCreateCommand2({
|
|
4665
|
+
...opts,
|
|
4666
|
+
json: inheritOption(opts.json, parent.json)
|
|
4667
|
+
});
|
|
3824
4668
|
});
|
|
3825
|
-
agentsCmd.command("pause <agent-id>").description("Pause an agent").action(async (agentId) => {
|
|
4669
|
+
agentsCmd.command("pause <agent-id>").option("--json", "Output as JSON").description("Pause an agent").action(async (agentId, opts, cmd) => {
|
|
4670
|
+
const parent = cmd.parent.opts();
|
|
3826
4671
|
const { agentsPauseCommand: agentsPauseCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3827
|
-
await agentsPauseCommand2(agentId
|
|
4672
|
+
await agentsPauseCommand2(agentId, {
|
|
4673
|
+
json: inheritOption(opts.json, parent.json)
|
|
4674
|
+
});
|
|
3828
4675
|
});
|
|
3829
|
-
agentsCmd.command("resume <agent-id>").description("Resume a paused agent").action(async (agentId) => {
|
|
4676
|
+
agentsCmd.command("resume <agent-id>").option("--json", "Output as JSON").description("Resume a paused agent").action(async (agentId, opts, cmd) => {
|
|
4677
|
+
const parent = cmd.parent.opts();
|
|
3830
4678
|
const { agentsResumeCommand: agentsResumeCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3831
|
-
await agentsResumeCommand2(agentId
|
|
4679
|
+
await agentsResumeCommand2(agentId, {
|
|
4680
|
+
json: inheritOption(opts.json, parent.json)
|
|
4681
|
+
});
|
|
3832
4682
|
});
|
|
3833
|
-
agentsCmd.command("delete <agent-id>").description("Delete an agent").action(async (agentId) => {
|
|
4683
|
+
agentsCmd.command("delete <agent-id>").option("--json", "Output as JSON").description("Delete an agent").action(async (agentId, opts, cmd) => {
|
|
4684
|
+
const parent = cmd.parent.opts();
|
|
3834
4685
|
const { agentsDeleteCommand: agentsDeleteCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3835
|
-
await agentsDeleteCommand2(agentId
|
|
4686
|
+
await agentsDeleteCommand2(agentId, {
|
|
4687
|
+
json: inheritOption(opts.json, parent.json)
|
|
4688
|
+
});
|
|
3836
4689
|
});
|
|
3837
|
-
agentsCmd.command("message <agent-id>").
|
|
4690
|
+
agentsCmd.command("message <agent-id>").option("--body <text>", "Message text").option("--body-file <path>", "Read the message body from a file").option("--json", "Output as JSON").description("Send a message to an agent").action(async (agentId, opts, cmd) => {
|
|
4691
|
+
const parent = cmd.parent.opts();
|
|
3838
4692
|
const { agentsMessageCommand: agentsMessageCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3839
|
-
await agentsMessageCommand2(agentId,
|
|
4693
|
+
await agentsMessageCommand2(agentId, {
|
|
4694
|
+
...opts,
|
|
4695
|
+
json: inheritOption(opts.json, parent.json)
|
|
4696
|
+
});
|
|
3840
4697
|
});
|
|
3841
|
-
agentsCmd.command("skill <agent-id>").requiredOption("--name <name>", "Skill name").requiredOption("--description <desc>", "Skill description").option("--instructions <text>", "Instructions").description("Add a skill to an agent").action(async (agentId, opts) => {
|
|
4698
|
+
agentsCmd.command("skill <agent-id>").requiredOption("--name <name>", "Skill name").requiredOption("--description <desc>", "Skill description").option("--instructions <text>", "Instructions").option("--instructions-file <path>", "Read skill instructions from a file").option("--json", "Output as JSON").description("Add a skill to an agent").action(async (agentId, opts, cmd) => {
|
|
4699
|
+
const parent = cmd.parent.opts();
|
|
3842
4700
|
const { agentsSkillCommand: agentsSkillCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3843
|
-
await agentsSkillCommand2(agentId,
|
|
4701
|
+
await agentsSkillCommand2(agentId, {
|
|
4702
|
+
...opts,
|
|
4703
|
+
json: inheritOption(opts.json, parent.json)
|
|
4704
|
+
});
|
|
3844
4705
|
});
|
|
3845
4706
|
var workItemsCmd = program.command("work-items").description("Long-term work item coordination").option("--entity-id <id>", "Entity ID (overrides active entity)").option("--json", "Output as JSON").option("--status <status>", "Filter by status (open, claimed, completed, cancelled)").option("--category <category>", "Filter by category").action(async (opts) => {
|
|
3846
4707
|
const { workItemsListCommand: workItemsListCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
@@ -3855,34 +4716,61 @@ workItemsCmd.command("show <item-id>").option("--json", "Output as JSON").descri
|
|
|
3855
4716
|
json: inheritOption(opts.json, parent.json)
|
|
3856
4717
|
});
|
|
3857
4718
|
});
|
|
3858
|
-
workItemsCmd.command("create").requiredOption("--title <title>", "Work item title").option("--category <category>", "Work item category").option("--description <desc>", "Description").option("--deadline <date>", "Deadline (YYYY-MM-DD)").option("--asap", "Mark as ASAP priority").option("--created-by <name>", "Creator identifier").description("Create a new work item").action(async (opts, cmd) => {
|
|
4719
|
+
workItemsCmd.command("create").requiredOption("--title <title>", "Work item title").option("--category <category>", "Work item category").option("--description <desc>", "Description").option("--deadline <date>", "Deadline (YYYY-MM-DD)").option("--asap", "Mark as ASAP priority").option("--created-by <name>", "Creator identifier").option("--json", "Output as JSON").description("Create a new work item").action(async (opts, cmd) => {
|
|
3859
4720
|
const parent = cmd.parent.opts();
|
|
3860
4721
|
const { workItemsCreateCommand: workItemsCreateCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3861
4722
|
await workItemsCreateCommand2({
|
|
3862
4723
|
...opts,
|
|
3863
4724
|
category: inheritOption(opts.category, parent.category),
|
|
3864
|
-
entityId: parent.entityId
|
|
4725
|
+
entityId: parent.entityId,
|
|
4726
|
+
json: inheritOption(opts.json, parent.json)
|
|
3865
4727
|
});
|
|
3866
4728
|
});
|
|
3867
|
-
workItemsCmd.command("claim <item-id>").
|
|
4729
|
+
workItemsCmd.command("claim <item-id>").option("--by <name>", "Agent or user claiming the item").option("--claimer <name>", "Alias for --by").option("--ttl <seconds>", "Auto-release TTL in seconds", parseInt).option("--json", "Output as JSON").description("Claim a work item").action(async (itemId, opts, cmd) => {
|
|
3868
4730
|
const parent = cmd.parent.opts();
|
|
3869
4731
|
const { workItemsClaimCommand: workItemsClaimCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3870
|
-
|
|
4732
|
+
const claimedBy = opts.by ?? opts.claimer;
|
|
4733
|
+
if (!claimedBy) {
|
|
4734
|
+
cmd.error("required option '--by <name>' not specified");
|
|
4735
|
+
return;
|
|
4736
|
+
}
|
|
4737
|
+
await workItemsClaimCommand2(itemId, {
|
|
4738
|
+
claimedBy,
|
|
4739
|
+
ttl: opts.ttl,
|
|
4740
|
+
entityId: parent.entityId,
|
|
4741
|
+
json: inheritOption(opts.json, parent.json)
|
|
4742
|
+
});
|
|
3871
4743
|
});
|
|
3872
|
-
workItemsCmd.command("complete <item-id>").
|
|
4744
|
+
workItemsCmd.command("complete <item-id>").option("--by <name>", "Agent or user completing the item").option("--completed-by <name>", "Alias for --by").option("--result <text>", "Completion result or notes").option("--notes <text>", "Alias for --result").option("--json", "Output as JSON").description("Mark a work item as completed").action(async (itemId, opts, cmd) => {
|
|
3873
4745
|
const parent = cmd.parent.opts();
|
|
3874
4746
|
const { workItemsCompleteCommand: workItemsCompleteCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3875
|
-
|
|
4747
|
+
const completedBy = opts.by ?? opts.completedBy;
|
|
4748
|
+
if (!completedBy) {
|
|
4749
|
+
cmd.error("required option '--by <name>' not specified");
|
|
4750
|
+
return;
|
|
4751
|
+
}
|
|
4752
|
+
await workItemsCompleteCommand2(itemId, {
|
|
4753
|
+
completedBy,
|
|
4754
|
+
result: opts.result ?? opts.notes,
|
|
4755
|
+
entityId: parent.entityId,
|
|
4756
|
+
json: inheritOption(opts.json, parent.json)
|
|
4757
|
+
});
|
|
3876
4758
|
});
|
|
3877
|
-
workItemsCmd.command("release <item-id>").description("Release a claimed work item").action(async (itemId,
|
|
4759
|
+
workItemsCmd.command("release <item-id>").option("--json", "Output as JSON").description("Release a claimed work item").action(async (itemId, opts, cmd) => {
|
|
3878
4760
|
const parent = cmd.parent.opts();
|
|
3879
4761
|
const { workItemsReleaseCommand: workItemsReleaseCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3880
|
-
await workItemsReleaseCommand2(itemId, {
|
|
4762
|
+
await workItemsReleaseCommand2(itemId, {
|
|
4763
|
+
entityId: parent.entityId,
|
|
4764
|
+
json: inheritOption(opts.json, parent.json)
|
|
4765
|
+
});
|
|
3881
4766
|
});
|
|
3882
|
-
workItemsCmd.command("cancel <item-id>").description("Cancel a work item").action(async (itemId,
|
|
4767
|
+
workItemsCmd.command("cancel <item-id>").option("--json", "Output as JSON").description("Cancel a work item").action(async (itemId, opts, cmd) => {
|
|
3883
4768
|
const parent = cmd.parent.opts();
|
|
3884
4769
|
const { workItemsCancelCommand: workItemsCancelCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3885
|
-
await workItemsCancelCommand2(itemId, {
|
|
4770
|
+
await workItemsCancelCommand2(itemId, {
|
|
4771
|
+
entityId: parent.entityId,
|
|
4772
|
+
json: inheritOption(opts.json, parent.json)
|
|
4773
|
+
});
|
|
3886
4774
|
});
|
|
3887
4775
|
var billingCmd = program.command("billing").description("Billing status, plans, and subscription management").option("--json", "Output as JSON").action(async (opts) => {
|
|
3888
4776
|
const { billingCommand: billingCommand2 } = await Promise.resolve().then(() => (init_billing(), billing_exports));
|
|
@@ -3902,21 +4790,21 @@ program.command("approvals").description("Approvals are managed through governan
|
|
|
3902
4790
|
"Approvals are managed through governance meetings.\n Use: corp governance convene ... to schedule a board meeting\n Use: corp governance vote <meeting-id> <item-id> ... to cast votes"
|
|
3903
4791
|
);
|
|
3904
4792
|
});
|
|
3905
|
-
var formCmd = program.command("form").description("Form a new entity with founders and cap table").option("--entity-type <type>", "Entity type (llc, c_corp)").option("--legal-name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--member <member>", "
|
|
4793
|
+
var formCmd = program.command("form").description("Form a new entity with founders and cap table").option("--entity-type <type>", "Entity type (llc, c_corp)").option("--legal-name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--member <member>", "Founder as 'name,email,role[,pct]' or key=value pairs like 'name=...,email=...,role=...,officer_title=cto,is_incorporator=true,address=street|city|state|zip' (repeatable)", (v, a) => [...a, v], []).option("--member-json <json>", "Founder JSON object (repeatable)", (v, a) => [...a, v], []).option("--members-file <path>", 'Path to a JSON array of founders or {"members": [...]}').option("--address <address>", "Company address as 'street,city,state,zip'").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)", "12-31").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the entity").action(async (opts) => {
|
|
3906
4794
|
if (opts.entityType && !opts.type) opts.type = opts.entityType;
|
|
3907
4795
|
if (opts.legalName && !opts.name) opts.name = opts.legalName;
|
|
3908
4796
|
const { formCommand: formCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3909
4797
|
await formCommand2(opts);
|
|
3910
4798
|
});
|
|
3911
|
-
formCmd.command("create").description("Create a pending entity (staged flow step 1)").requiredOption("--type <type>", "Entity type (llc, c_corp)").requiredOption("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").action(async (opts) => {
|
|
4799
|
+
formCmd.command("create").description("Create a pending entity (staged flow step 1)").requiredOption("--type <type>", "Entity type (llc, c_corp)").requiredOption("--name <name>", "Legal name").option("--jurisdiction <jurisdiction>", "Jurisdiction (e.g. US-DE, US-WY)").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").option("--json", "Output as JSON").option("--dry-run", "Show the request without creating the pending entity").action(async (opts) => {
|
|
3912
4800
|
const { formCreateCommand: formCreateCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3913
4801
|
await formCreateCommand2(opts);
|
|
3914
4802
|
});
|
|
3915
|
-
formCmd.command("add-founder <entity-id>").description("Add a founder to a pending entity (staged flow step 2)").requiredOption("--name <name>", "Founder name").requiredOption("--email <email>", "Founder email").requiredOption("--role <role>", "Role: director|officer|manager|member|chair").requiredOption("--pct <pct>", "Ownership percentage").
|
|
4803
|
+
formCmd.command("add-founder <entity-id>").description("Add a founder to a pending entity (staged flow step 2)").requiredOption("--name <name>", "Founder name").requiredOption("--email <email>", "Founder email").requiredOption("--role <role>", "Role: director|officer|manager|member|chair").requiredOption("--pct <pct>", "Ownership percentage").addOption(new Option("--officer-title <title>", "Officer title (corporations only)").choices(["ceo", "cfo", "cto", "coo", "secretary", "treasurer", "president", "vp", "other"])).option("--incorporator", "Mark as sole incorporator (corporations only)").option("--address <address>", "Founder address as 'street,city,state,zip'").option("--json", "Output as JSON").option("--dry-run", "Show the request without adding the founder").action(async (entityId, opts) => {
|
|
3916
4804
|
const { formAddFounderCommand: formAddFounderCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3917
4805
|
await formAddFounderCommand2(entityId, opts);
|
|
3918
4806
|
});
|
|
3919
|
-
formCmd.command("finalize <entity-id>").description("Finalize formation and generate documents + cap table (staged flow step 3)").option("--authorized-shares <count>", "Authorized shares for corporations").option("--par-value <value>", "Par value per share, e.g. 0.0001").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").action(async (entityId, opts) => {
|
|
4807
|
+
formCmd.command("finalize <entity-id>").description("Finalize formation and generate documents + cap table (staged flow step 3)").option("--authorized-shares <count>", "Authorized shares for corporations").option("--par-value <value>", "Par value per share, e.g. 0.0001").option("--registered-agent-name <name>", "Registered agent legal name").option("--registered-agent-address <address>", "Registered agent address line").option("--formation-date <date>", "Formation date (RFC3339 or YYYY-MM-DD)").option("--fiscal-year-end <date>", "Fiscal year end (MM-DD)").option("--s-corp", "Elect S-Corp status").option("--transfer-restrictions", "Enable transfer restrictions").option("--rofr", "Enable right of first refusal").option("--company-address <address>", "Company address as 'street,city,state,zip'").option("--incorporator-name <name>", "Incorporator legal name (overrides founder)").option("--incorporator-address <address>", "Incorporator mailing address (overrides founder)").option("--json", "Output as JSON").option("--dry-run", "Show the request without finalizing formation").action(async (entityId, opts) => {
|
|
3920
4808
|
const { formFinalizeCommand: formFinalizeCommand2 } = await Promise.resolve().then(() => (init_form(), form_exports));
|
|
3921
4809
|
await formFinalizeCommand2(entityId, opts);
|
|
3922
4810
|
});
|
|
@@ -3928,6 +4816,10 @@ program.command("demo").description("Seed a fully-populated demo corporation").r
|
|
|
3928
4816
|
const { demoCommand: demoCommand2 } = await Promise.resolve().then(() => (init_demo(), demo_exports));
|
|
3929
4817
|
await demoCommand2(opts);
|
|
3930
4818
|
});
|
|
4819
|
+
program.command("feedback").description("Submit feedback to TheCorporation").argument("<message>", "Feedback message").option("--category <category>", "Category (e.g. bug, feature, general)", "general").option("--email <email>", "Your email address (to receive a copy)").action(async (message, opts) => {
|
|
4820
|
+
const { feedbackCommand: feedbackCommand2 } = await Promise.resolve().then(() => (init_feedback(), feedback_exports));
|
|
4821
|
+
await feedbackCommand2(message, opts);
|
|
4822
|
+
});
|
|
3931
4823
|
program.command("serve").description("Start the API server locally").option("--port <port>", "Port to listen on", "8000").option("--data-dir <path>", "Data directory", "./data/repos").action(async (opts) => {
|
|
3932
4824
|
const { serveCommand: serveCommand2 } = await Promise.resolve().then(() => (init_serve(), serve_exports));
|
|
3933
4825
|
await serveCommand2(opts);
|