@thecorporation/cli 26.3.11 → 26.3.13
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 +66 -25
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1354,21 +1354,10 @@ __export(entities_exports, {
|
|
|
1354
1354
|
entitiesShowCommand: () => entitiesShowCommand
|
|
1355
1355
|
});
|
|
1356
1356
|
import chalk3 from "chalk";
|
|
1357
|
-
function wantsJsonOutput(opts) {
|
|
1358
|
-
if (opts && typeof opts === "object") {
|
|
1359
|
-
const json = opts.json;
|
|
1360
|
-
if (typeof json === "boolean") return json;
|
|
1361
|
-
const commandOpts = opts.opts;
|
|
1362
|
-
if (typeof commandOpts === "function") {
|
|
1363
|
-
return Boolean(commandOpts().json);
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
return false;
|
|
1367
|
-
}
|
|
1368
1357
|
async function entitiesCommand(opts) {
|
|
1369
1358
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1370
1359
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1371
|
-
const jsonOutput =
|
|
1360
|
+
const jsonOutput = Boolean(opts.json);
|
|
1372
1361
|
try {
|
|
1373
1362
|
const entities = await withSpinner("Loading", () => client.listEntities(), jsonOutput);
|
|
1374
1363
|
if (jsonOutput) {
|
|
@@ -1386,7 +1375,7 @@ async function entitiesCommand(opts) {
|
|
|
1386
1375
|
async function entitiesShowCommand(entityId, opts) {
|
|
1387
1376
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
1388
1377
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
1389
|
-
const jsonOutput =
|
|
1378
|
+
const jsonOutput = Boolean(opts.json);
|
|
1390
1379
|
try {
|
|
1391
1380
|
const entities = await client.listEntities();
|
|
1392
1381
|
const entity = entities.find((e) => e.entity_id === entityId);
|
|
@@ -2219,7 +2208,7 @@ async function governanceConveneCommand(opts) {
|
|
|
2219
2208
|
}
|
|
2220
2209
|
async function governanceVoteCommand(meetingId, itemId, opts) {
|
|
2221
2210
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2222
|
-
const eid = resolveEntityId(cfg,
|
|
2211
|
+
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2223
2212
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2224
2213
|
try {
|
|
2225
2214
|
const result = await client.castVote(eid, meetingId, itemId, {
|
|
@@ -2371,6 +2360,19 @@ __export(documents_exports, {
|
|
|
2371
2360
|
documentsPreviewPdfCommand: () => documentsPreviewPdfCommand,
|
|
2372
2361
|
documentsSigningLinkCommand: () => documentsSigningLinkCommand
|
|
2373
2362
|
});
|
|
2363
|
+
function formatSigningLink(docId, result) {
|
|
2364
|
+
if (typeof result.token === "string" && result.token.length > 0) {
|
|
2365
|
+
return `${HUMANS_APP_ORIGIN}/sign/${docId}?token=${encodeURIComponent(result.token)}`;
|
|
2366
|
+
}
|
|
2367
|
+
if (typeof result.signing_url === "string" && result.signing_url.length > 0) {
|
|
2368
|
+
if (/^https?:\/\//.test(result.signing_url)) {
|
|
2369
|
+
return result.signing_url;
|
|
2370
|
+
}
|
|
2371
|
+
const normalizedPath = result.signing_url.startsWith("/human/sign/") ? result.signing_url.replace("/human/sign/", "/sign/") : result.signing_url;
|
|
2372
|
+
return `${HUMANS_APP_ORIGIN}${normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`}`;
|
|
2373
|
+
}
|
|
2374
|
+
return `${HUMANS_APP_ORIGIN}/sign/${docId}`;
|
|
2375
|
+
}
|
|
2374
2376
|
async function documentsListCommand(opts) {
|
|
2375
2377
|
const cfg = requireConfig("api_url", "api_key", "workspace_id");
|
|
2376
2378
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
@@ -2391,8 +2393,10 @@ async function documentsSigningLinkCommand(docId, opts) {
|
|
|
2391
2393
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2392
2394
|
try {
|
|
2393
2395
|
const result = await client.getSigningLink(docId, eid);
|
|
2394
|
-
const shareUrl =
|
|
2395
|
-
|
|
2396
|
+
const shareUrl = formatSigningLink(docId, result);
|
|
2397
|
+
if (process.stdout.isTTY) {
|
|
2398
|
+
printSuccess("Signing link generated.");
|
|
2399
|
+
}
|
|
2396
2400
|
console.log(shareUrl);
|
|
2397
2401
|
} catch (err) {
|
|
2398
2402
|
printError(`Failed to get signing link: ${err}`);
|
|
@@ -2431,12 +2435,14 @@ async function documentsPreviewPdfCommand(opts) {
|
|
|
2431
2435
|
process.exit(1);
|
|
2432
2436
|
}
|
|
2433
2437
|
}
|
|
2438
|
+
var HUMANS_APP_ORIGIN;
|
|
2434
2439
|
var init_documents = __esm({
|
|
2435
2440
|
"src/commands/documents.ts"() {
|
|
2436
2441
|
"use strict";
|
|
2437
2442
|
init_config();
|
|
2438
2443
|
init_api_client();
|
|
2439
2444
|
init_output();
|
|
2445
|
+
HUMANS_APP_ORIGIN = "https://humans.thecorporation.ai";
|
|
2440
2446
|
}
|
|
2441
2447
|
});
|
|
2442
2448
|
|
|
@@ -2709,6 +2715,10 @@ async function workItemsCreateCommand(opts) {
|
|
|
2709
2715
|
const eid = resolveEntityId(cfg, opts.entityId);
|
|
2710
2716
|
const client = new CorpAPIClient(cfg.api_url, cfg.api_key, cfg.workspace_id);
|
|
2711
2717
|
try {
|
|
2718
|
+
if (!opts.category) {
|
|
2719
|
+
printError("Missing required option: --category <category>");
|
|
2720
|
+
process.exit(1);
|
|
2721
|
+
}
|
|
2712
2722
|
const data = { title: opts.title, category: opts.category };
|
|
2713
2723
|
if (opts.description) data.description = opts.description;
|
|
2714
2724
|
if (opts.deadline) data.deadline = opts.deadline;
|
|
@@ -3489,6 +3499,13 @@ INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
|
|
|
3489
3499
|
// src/index.ts
|
|
3490
3500
|
import { Command, Option } from "commander";
|
|
3491
3501
|
import { createRequire } from "module";
|
|
3502
|
+
|
|
3503
|
+
// src/command-options.ts
|
|
3504
|
+
function inheritOption(localValue, parentValue) {
|
|
3505
|
+
return localValue ?? parentValue;
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3508
|
+
// src/index.ts
|
|
3492
3509
|
var require2 = createRequire(import.meta.url);
|
|
3493
3510
|
var pkg = require2("../package.json");
|
|
3494
3511
|
var program = new Command();
|
|
@@ -3539,8 +3556,12 @@ var entitiesCmd = program.command("entities").description("List entities, show d
|
|
|
3539
3556
|
await entitiesCommand2(opts);
|
|
3540
3557
|
});
|
|
3541
3558
|
entitiesCmd.command("show <entity-id>").option("--json", "Output as JSON").description("Show entity detail").action(async (entityId, opts, cmd) => {
|
|
3559
|
+
const parent = cmd.parent.opts();
|
|
3542
3560
|
const { entitiesShowCommand: entitiesShowCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
3543
|
-
await entitiesShowCommand2(entityId, {
|
|
3561
|
+
await entitiesShowCommand2(entityId, {
|
|
3562
|
+
...opts,
|
|
3563
|
+
json: inheritOption(opts.json, parent.json)
|
|
3564
|
+
});
|
|
3544
3565
|
});
|
|
3545
3566
|
entitiesCmd.command("convert <entity-id>").requiredOption("--to <type>", "Target entity type (llc, c_corp)").option("--jurisdiction <jurisdiction>", "New jurisdiction").description("Convert entity to a different type").action(async (entityId, opts) => {
|
|
3546
3567
|
const { entitiesConvertCommand: entitiesConvertCommand2 } = await Promise.resolve().then(() => (init_entities(), entities_exports));
|
|
@@ -3557,7 +3578,11 @@ var contactsCmd = program.command("contacts").description("Contact management").
|
|
|
3557
3578
|
contactsCmd.command("show <contact-id>").option("--json", "Output as JSON").description("Show contact detail/profile").action(async (contactId, opts, cmd) => {
|
|
3558
3579
|
const parent = cmd.parent.opts();
|
|
3559
3580
|
const { contactsShowCommand: contactsShowCommand2 } = await Promise.resolve().then(() => (init_contacts(), contacts_exports));
|
|
3560
|
-
await contactsShowCommand2(contactId, {
|
|
3581
|
+
await contactsShowCommand2(contactId, {
|
|
3582
|
+
...opts,
|
|
3583
|
+
entityId: parent.entityId,
|
|
3584
|
+
json: inheritOption(opts.json, parent.json)
|
|
3585
|
+
});
|
|
3561
3586
|
});
|
|
3562
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) => {
|
|
3563
3588
|
const parent = cmd.parent.opts();
|
|
@@ -3708,9 +3733,13 @@ governanceCmd.command("convene").requiredOption("--body <id>", "Governance body
|
|
|
3708
3733
|
const { governanceConveneCommand: governanceConveneCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3709
3734
|
await governanceConveneCommand2({ ...opts, meetingType: opts.type, entityId: parent.entityId });
|
|
3710
3735
|
});
|
|
3711
|
-
governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").addOption(new Option("--vote <value>", "Vote (for, against, abstain, recusal)").choices(["for", "against", "abstain", "recusal"]).makeOptionMandatory()).description("Cast a vote on an agenda item").action(async (meetingId, itemId, opts) => {
|
|
3736
|
+
governanceCmd.command("vote <meeting-id> <item-id>").requiredOption("--voter <id>", "Voter contact UUID").addOption(new Option("--vote <value>", "Vote (for, against, abstain, recusal)").choices(["for", "against", "abstain", "recusal"]).makeOptionMandatory()).description("Cast a vote on an agenda item").action(async (meetingId, itemId, opts, cmd) => {
|
|
3737
|
+
const parent = cmd.parent.opts();
|
|
3712
3738
|
const { governanceVoteCommand: governanceVoteCommand2 } = await Promise.resolve().then(() => (init_governance(), governance_exports));
|
|
3713
|
-
await governanceVoteCommand2(meetingId, itemId,
|
|
3739
|
+
await governanceVoteCommand2(meetingId, itemId, {
|
|
3740
|
+
...opts,
|
|
3741
|
+
entityId: parent.entityId
|
|
3742
|
+
});
|
|
3714
3743
|
});
|
|
3715
3744
|
governanceCmd.command("notice <meeting-id>").description("Send meeting notice").action(async (meetingId, _opts, cmd) => {
|
|
3716
3745
|
const parent = cmd.parent.opts();
|
|
@@ -3781,9 +3810,13 @@ var agentsCmd = program.command("agents").description("Agent management").option
|
|
|
3781
3810
|
const { agentsListCommand: agentsListCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3782
3811
|
await agentsListCommand2(opts);
|
|
3783
3812
|
});
|
|
3784
|
-
agentsCmd.command("show <agent-id>").option("--json", "Output as JSON").description("Show agent detail").action(async (agentId, opts) => {
|
|
3813
|
+
agentsCmd.command("show <agent-id>").option("--json", "Output as JSON").description("Show agent detail").action(async (agentId, opts, cmd) => {
|
|
3814
|
+
const parent = cmd.parent.opts();
|
|
3785
3815
|
const { agentsShowCommand: agentsShowCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
3786
|
-
await agentsShowCommand2(agentId,
|
|
3816
|
+
await agentsShowCommand2(agentId, {
|
|
3817
|
+
...opts,
|
|
3818
|
+
json: inheritOption(opts.json, parent.json)
|
|
3819
|
+
});
|
|
3787
3820
|
});
|
|
3788
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) => {
|
|
3789
3822
|
const { agentsCreateCommand: agentsCreateCommand2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
|
|
@@ -3816,12 +3849,20 @@ var workItemsCmd = program.command("work-items").description("Long-term work ite
|
|
|
3816
3849
|
workItemsCmd.command("show <item-id>").option("--json", "Output as JSON").description("Show work item detail").action(async (itemId, opts, cmd) => {
|
|
3817
3850
|
const parent = cmd.parent.opts();
|
|
3818
3851
|
const { workItemsShowCommand: workItemsShowCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3819
|
-
await workItemsShowCommand2(itemId, {
|
|
3852
|
+
await workItemsShowCommand2(itemId, {
|
|
3853
|
+
...opts,
|
|
3854
|
+
entityId: parent.entityId,
|
|
3855
|
+
json: inheritOption(opts.json, parent.json)
|
|
3856
|
+
});
|
|
3820
3857
|
});
|
|
3821
|
-
workItemsCmd.command("create").requiredOption("--title <title>", "Work item title").
|
|
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) => {
|
|
3822
3859
|
const parent = cmd.parent.opts();
|
|
3823
3860
|
const { workItemsCreateCommand: workItemsCreateCommand2 } = await Promise.resolve().then(() => (init_work_items(), work_items_exports));
|
|
3824
|
-
await workItemsCreateCommand2({
|
|
3861
|
+
await workItemsCreateCommand2({
|
|
3862
|
+
...opts,
|
|
3863
|
+
category: inheritOption(opts.category, parent.category),
|
|
3864
|
+
entityId: parent.entityId
|
|
3865
|
+
});
|
|
3825
3866
|
});
|
|
3826
3867
|
workItemsCmd.command("claim <item-id>").requiredOption("--by <name>", "Agent or user claiming the item").option("--ttl <seconds>", "Auto-release TTL in seconds", parseInt).description("Claim a work item").action(async (itemId, opts, cmd) => {
|
|
3827
3868
|
const parent = cmd.parent.opts();
|