@ted-galago/wave-cli 0.1.3 → 0.1.5
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/README.md +81 -5
- package/dist/index.cjs +816 -155
- package/dist/index.js +813 -152
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var import_commander2 = require("commander");
|
|
6
|
-
var
|
|
6
|
+
var import_zod14 = require("zod");
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
var import_commander = require("commander");
|
|
@@ -102,10 +102,10 @@ function parseDebug(rawDebugOption, rawDebugEnv) {
|
|
|
102
102
|
return lowered === "1" || lowered === "true" || lowered === "yes";
|
|
103
103
|
}
|
|
104
104
|
function getConfig(options) {
|
|
105
|
-
const token =
|
|
105
|
+
const token = options.token ?? options.jwt ?? process.env.WAVE_API_TOKEN ?? process.env.WAVE_JWT;
|
|
106
106
|
if (!token) {
|
|
107
107
|
throw new CliError({
|
|
108
|
-
message: "Missing API token.
|
|
108
|
+
message: "Missing API token. Pass --token/--jwt, use --token-stdin/--auth-json-stdin, or set WAVE_API_TOKEN/WAVE_JWT.",
|
|
109
109
|
kind: "missing_auth",
|
|
110
110
|
status: 401,
|
|
111
111
|
exitCode: EXIT_CODES.missingOrInvalidAuth
|
|
@@ -114,7 +114,7 @@ function getConfig(options) {
|
|
|
114
114
|
const baseUrl = options.baseUrl ?? process.env.WAVE_API_BASE_URL ?? process.env.WAVE_API_URL;
|
|
115
115
|
if (!baseUrl) {
|
|
116
116
|
throw new CliError({
|
|
117
|
-
message: "Missing API base URL.
|
|
117
|
+
message: "Missing API base URL. Pass --base-url, provide via --auth-json-stdin, or set WAVE_API_BASE_URL/WAVE_API_URL.",
|
|
118
118
|
kind: "invalid_args",
|
|
119
119
|
status: 400,
|
|
120
120
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -252,7 +252,7 @@ function normalizeGraphqlVariables(variables) {
|
|
|
252
252
|
function buildGraphqlBody(input) {
|
|
253
253
|
const graphqlField = toCamelCase(input.field);
|
|
254
254
|
const graphqlVariables = normalizeGraphqlVariables(input.variables);
|
|
255
|
-
const operationName = graphqlOperationName(input.command);
|
|
255
|
+
const operationName = input.operationName ?? graphqlOperationName(input.command);
|
|
256
256
|
const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
|
|
257
257
|
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
|
|
258
258
|
const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
|
|
@@ -490,12 +490,21 @@ async function runGraphqlQueryCommand(input) {
|
|
|
490
490
|
const result = await graphqlRequest({
|
|
491
491
|
config,
|
|
492
492
|
command: input.command,
|
|
493
|
+
operationName: input.operationName,
|
|
493
494
|
operationType: "query",
|
|
494
495
|
field: input.field,
|
|
495
496
|
variables: input.variables ?? {},
|
|
496
497
|
selectionSet: input.selectionSet ?? defaultQuerySelectionSet(input.field, Boolean(input.isList)),
|
|
497
498
|
isShow: input.isShow
|
|
498
499
|
});
|
|
500
|
+
if (result.envelope.ok && input.transformData && result.envelope.data) {
|
|
501
|
+
const dataRecord = result.envelope.data;
|
|
502
|
+
const transformed = input.transformData(dataRecord[input.field]);
|
|
503
|
+
result.envelope.data = {
|
|
504
|
+
...dataRecord,
|
|
505
|
+
[input.field]: transformed
|
|
506
|
+
};
|
|
507
|
+
}
|
|
499
508
|
printEnvelopeAndExit(result);
|
|
500
509
|
} catch (error) {
|
|
501
510
|
if (error instanceof CliError) {
|
|
@@ -528,6 +537,7 @@ async function runGraphqlMutationCommand(input) {
|
|
|
528
537
|
const result = await graphqlRequest({
|
|
529
538
|
config,
|
|
530
539
|
command: input.command,
|
|
540
|
+
operationName: input.operationName,
|
|
531
541
|
operationType: "mutation",
|
|
532
542
|
field: input.field,
|
|
533
543
|
variables: input.variables ?? {},
|
|
@@ -561,24 +571,196 @@ async function runGraphqlMutationCommand(input) {
|
|
|
561
571
|
}
|
|
562
572
|
|
|
563
573
|
// src/commands/runtimeOptions.ts
|
|
564
|
-
|
|
574
|
+
var stdinPromise = null;
|
|
575
|
+
function normalize(raw) {
|
|
576
|
+
if (typeof raw !== "string") {
|
|
577
|
+
return void 0;
|
|
578
|
+
}
|
|
579
|
+
const trimmed = raw.trim();
|
|
580
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
581
|
+
}
|
|
582
|
+
function parseBool(raw) {
|
|
583
|
+
if (typeof raw === "boolean") {
|
|
584
|
+
return raw;
|
|
585
|
+
}
|
|
586
|
+
if (typeof raw !== "string") {
|
|
587
|
+
return void 0;
|
|
588
|
+
}
|
|
589
|
+
const lowered = raw.toLowerCase();
|
|
590
|
+
if (lowered === "1" || lowered === "true" || lowered === "yes") {
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
if (lowered === "0" || lowered === "false" || lowered === "no") {
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
function parseAuthJson(raw) {
|
|
599
|
+
try {
|
|
600
|
+
const parsed = JSON.parse(raw);
|
|
601
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
602
|
+
throw new Error("Expected JSON object.");
|
|
603
|
+
}
|
|
604
|
+
const obj = parsed;
|
|
605
|
+
return {
|
|
606
|
+
token: normalize(obj.token),
|
|
607
|
+
jwt: normalize(obj.jwt),
|
|
608
|
+
baseUrl: normalize(obj.baseUrl ?? obj.base_url),
|
|
609
|
+
organizationId: normalize(obj.organizationId ?? obj.organization_id),
|
|
610
|
+
timeoutMs: typeof obj.timeoutMs === "number" || typeof obj.timeoutMs === "string" ? obj.timeoutMs : typeof obj.timeout_ms === "number" || typeof obj.timeout_ms === "string" ? obj.timeout_ms : void 0,
|
|
611
|
+
debug: parseBool(obj.debug),
|
|
612
|
+
agentName: normalize(obj.agentName ?? obj.agent_name),
|
|
613
|
+
agentRunId: normalize(obj.agentRunId ?? obj.agent_run_id),
|
|
614
|
+
requestId: normalize(obj.requestId ?? obj.request_id),
|
|
615
|
+
openapiPath: normalize(obj.openapiPath ?? obj.openapi_path),
|
|
616
|
+
openapiUrl: normalize(obj.openapiUrl ?? obj.openapi_url),
|
|
617
|
+
openapiVersion: normalize(obj.openapiVersion ?? obj.openapi_version)
|
|
618
|
+
};
|
|
619
|
+
} catch (error) {
|
|
620
|
+
throw new CliError({
|
|
621
|
+
message: error instanceof Error ? `Invalid --auth-json-stdin payload: ${error.message}` : "Invalid --auth-json-stdin payload.",
|
|
622
|
+
kind: "invalid_args",
|
|
623
|
+
status: 400,
|
|
624
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
async function readStdinRaw() {
|
|
629
|
+
if (!stdinPromise) {
|
|
630
|
+
stdinPromise = new Promise((resolve, reject) => {
|
|
631
|
+
if (process.stdin.isTTY) {
|
|
632
|
+
resolve("");
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
let data = "";
|
|
636
|
+
process.stdin.setEncoding("utf8");
|
|
637
|
+
process.stdin.on("data", (chunk) => {
|
|
638
|
+
data += chunk;
|
|
639
|
+
});
|
|
640
|
+
process.stdin.on("end", () => resolve(data));
|
|
641
|
+
process.stdin.on("error", reject);
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
return stdinPromise;
|
|
645
|
+
}
|
|
646
|
+
function firstDefined(...values) {
|
|
647
|
+
return values.find((value) => value !== void 0);
|
|
648
|
+
}
|
|
649
|
+
function resolveFromSources(options, stdin, env) {
|
|
650
|
+
const token = firstDefined(
|
|
651
|
+
normalize(options.token),
|
|
652
|
+
normalize(options.jwt),
|
|
653
|
+
normalize(stdin.token),
|
|
654
|
+
normalize(stdin.jwt),
|
|
655
|
+
normalize(env.WAVE_API_TOKEN),
|
|
656
|
+
normalize(env.WAVE_JWT)
|
|
657
|
+
);
|
|
658
|
+
const baseUrl = firstDefined(
|
|
659
|
+
normalize(options.baseUrl),
|
|
660
|
+
normalize(stdin.baseUrl),
|
|
661
|
+
normalize(env.WAVE_API_BASE_URL),
|
|
662
|
+
normalize(env.WAVE_API_URL)
|
|
663
|
+
);
|
|
664
|
+
const organizationId = firstDefined(
|
|
665
|
+
normalize(options.organizationId),
|
|
666
|
+
normalize(stdin.organizationId),
|
|
667
|
+
normalize(env.WAVE_ORGANIZATION_ID),
|
|
668
|
+
normalize(env.WAVE_ORG_ID)
|
|
669
|
+
);
|
|
670
|
+
const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
|
|
671
|
+
const debug = firstDefined(
|
|
672
|
+
options.debug === true ? true : void 0,
|
|
673
|
+
stdin.debug,
|
|
674
|
+
parseBool(env.WAVE_DEBUG)
|
|
675
|
+
);
|
|
676
|
+
const agentName = firstDefined(
|
|
677
|
+
normalize(options.agentName),
|
|
678
|
+
normalize(stdin.agentName),
|
|
679
|
+
normalize(env.WAVE_AGENT_NAME)
|
|
680
|
+
);
|
|
681
|
+
const agentRunId = firstDefined(
|
|
682
|
+
normalize(options.agentRunId),
|
|
683
|
+
normalize(stdin.agentRunId),
|
|
684
|
+
normalize(env.WAVE_AGENT_RUN_ID)
|
|
685
|
+
);
|
|
686
|
+
const requestId = firstDefined(
|
|
687
|
+
normalize(options.requestId),
|
|
688
|
+
normalize(stdin.requestId),
|
|
689
|
+
normalize(env.WAVE_REQUEST_ID)
|
|
690
|
+
);
|
|
691
|
+
const openapiPath = firstDefined(
|
|
692
|
+
normalize(options.openapiPath),
|
|
693
|
+
normalize(stdin.openapiPath),
|
|
694
|
+
normalize(env.WAVE_OPENAPI_PATH)
|
|
695
|
+
);
|
|
696
|
+
const openapiUrl = firstDefined(
|
|
697
|
+
normalize(options.openapiUrl),
|
|
698
|
+
normalize(stdin.openapiUrl),
|
|
699
|
+
normalize(env.WAVE_OPENAPI_URL)
|
|
700
|
+
);
|
|
701
|
+
const openapiVersion = firstDefined(
|
|
702
|
+
normalize(options.openapiVersion),
|
|
703
|
+
normalize(stdin.openapiVersion),
|
|
704
|
+
normalize(env.WAVE_OPENAPI_VERSION)
|
|
705
|
+
);
|
|
565
706
|
return {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
707
|
+
organizationId,
|
|
708
|
+
runtimeOptions: {
|
|
709
|
+
token,
|
|
710
|
+
baseUrl,
|
|
711
|
+
timeoutMs,
|
|
712
|
+
debug,
|
|
713
|
+
agentName,
|
|
714
|
+
agentRunId,
|
|
715
|
+
requestId,
|
|
716
|
+
openapiPath,
|
|
717
|
+
openapiUrl,
|
|
718
|
+
openapiVersion
|
|
719
|
+
}
|
|
577
720
|
};
|
|
578
721
|
}
|
|
722
|
+
async function resolveStdinContext(options) {
|
|
723
|
+
if (options.tokenStdin && options.authJsonStdin) {
|
|
724
|
+
throw new CliError({
|
|
725
|
+
message: "Use only one stdin auth mode: --token-stdin or --auth-json-stdin.",
|
|
726
|
+
kind: "invalid_args",
|
|
727
|
+
status: 400,
|
|
728
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
if (!options.tokenStdin && !options.authJsonStdin) {
|
|
732
|
+
return {};
|
|
733
|
+
}
|
|
734
|
+
const raw = (await readStdinRaw()).trim();
|
|
735
|
+
if (!raw) {
|
|
736
|
+
throw new CliError({
|
|
737
|
+
message: options.tokenStdin ? "Missing stdin token. Provide token via stdin when using --token-stdin." : "Missing stdin auth JSON. Provide JSON via stdin when using --auth-json-stdin.",
|
|
738
|
+
kind: "invalid_args",
|
|
739
|
+
status: 400,
|
|
740
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
if (options.tokenStdin) {
|
|
744
|
+
const token = normalize(raw);
|
|
745
|
+
if (!token) {
|
|
746
|
+
throw new CliError({
|
|
747
|
+
message: "Invalid stdin token. Token value is empty.",
|
|
748
|
+
kind: "invalid_args",
|
|
749
|
+
status: 400,
|
|
750
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
return { token };
|
|
754
|
+
}
|
|
755
|
+
return parseAuthJson(raw);
|
|
756
|
+
}
|
|
757
|
+
async function resolveCommandContext(options) {
|
|
758
|
+
const stdin = await resolveStdinContext(options);
|
|
759
|
+
return resolveFromSources(options, stdin, process.env);
|
|
760
|
+
}
|
|
579
761
|
|
|
580
762
|
// src/commands/organization.ts
|
|
581
|
-
function
|
|
763
|
+
function normalize2(input) {
|
|
582
764
|
if (!input) {
|
|
583
765
|
return void 0;
|
|
584
766
|
}
|
|
@@ -586,10 +768,10 @@ function normalize(input) {
|
|
|
586
768
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
587
769
|
}
|
|
588
770
|
function resolveOrganizationId(raw) {
|
|
589
|
-
const organizationId =
|
|
771
|
+
const organizationId = normalize2(raw);
|
|
590
772
|
if (!organizationId) {
|
|
591
773
|
throw new CliError({
|
|
592
|
-
message: "Missing organization ID.
|
|
774
|
+
message: "Missing organization ID. Pass --organization-id, provide via --auth-json-stdin, or set WAVE_ORGANIZATION_ID.",
|
|
593
775
|
kind: "invalid_args",
|
|
594
776
|
status: 400,
|
|
595
777
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -1265,8 +1447,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1265
1447
|
list.option(`--${cliParam} <${cliParam}>`);
|
|
1266
1448
|
});
|
|
1267
1449
|
list.option("--query-json <queryJson>", "Additional query params as JSON object").action(async (opts, cmd) => {
|
|
1268
|
-
const
|
|
1269
|
-
const organizationId = resolveOrganizationId(
|
|
1450
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1451
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1270
1452
|
const extraQuery = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1271
1453
|
const mappedKnownParams = Object.fromEntries(
|
|
1272
1454
|
listParams.map((param) => {
|
|
@@ -1283,7 +1465,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1283
1465
|
});
|
|
1284
1466
|
await runGraphqlQueryCommand({
|
|
1285
1467
|
command: `${config.command}.list`,
|
|
1286
|
-
runtimeOptions:
|
|
1468
|
+
runtimeOptions: context.runtimeOptions,
|
|
1287
1469
|
field: config.resourcePath === "feedback" ? "feedbacks" : config.resourcePath,
|
|
1288
1470
|
variables,
|
|
1289
1471
|
isList: true
|
|
@@ -1291,11 +1473,11 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1291
1473
|
});
|
|
1292
1474
|
entityCommand.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1293
1475
|
const id = idSchema.parse(opts.id);
|
|
1294
|
-
const
|
|
1295
|
-
const organizationId = resolveOrganizationId(
|
|
1476
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1477
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1296
1478
|
await runGraphqlQueryCommand({
|
|
1297
1479
|
command: `${config.command}.show`,
|
|
1298
|
-
runtimeOptions:
|
|
1480
|
+
runtimeOptions: context.runtimeOptions,
|
|
1299
1481
|
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1300
1482
|
variables: normalizeGraphqlVariables2({
|
|
1301
1483
|
organization_id: organizationId,
|
|
@@ -1305,13 +1487,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1305
1487
|
});
|
|
1306
1488
|
});
|
|
1307
1489
|
entityCommand.command("create").requiredOption("--data-json <dataJson>", createHelp4).action(async (opts, cmd) => {
|
|
1308
|
-
const
|
|
1309
|
-
const organizationId = resolveOrganizationId(
|
|
1490
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1491
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1310
1492
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1311
1493
|
assertRequiredCreateFields(body, config.rootKey, config.requiredCreateFields);
|
|
1312
1494
|
await runGraphqlMutationCommand({
|
|
1313
1495
|
command: `${config.command}.create`,
|
|
1314
|
-
runtimeOptions:
|
|
1496
|
+
runtimeOptions: context.runtimeOptions,
|
|
1315
1497
|
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1316
1498
|
variables: {
|
|
1317
1499
|
organization_id: organizationId,
|
|
@@ -1321,13 +1503,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1321
1503
|
});
|
|
1322
1504
|
entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp5).action(async (opts, cmd) => {
|
|
1323
1505
|
const id = idSchema.parse(opts.id);
|
|
1324
|
-
const
|
|
1325
|
-
const organizationId = resolveOrganizationId(
|
|
1506
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1507
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1326
1508
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1327
1509
|
const singular = toSingularResourceName(config.resourcePath);
|
|
1328
1510
|
await runGraphqlMutationCommand({
|
|
1329
1511
|
command: `${config.command}.update`,
|
|
1330
|
-
runtimeOptions:
|
|
1512
|
+
runtimeOptions: context.runtimeOptions,
|
|
1331
1513
|
field: `update_${singular}`,
|
|
1332
1514
|
variables: {
|
|
1333
1515
|
organization_id: organizationId,
|
|
@@ -1352,13 +1534,13 @@ var summarySchema = import_zod3.z.string().min(1);
|
|
|
1352
1534
|
function registerTaskCommands(program) {
|
|
1353
1535
|
const tasks = program.command("tasks").description("Task operations");
|
|
1354
1536
|
tasks.command("list").option("--project-id <projectId>").option("--page <page>").option("--per <per>").option("--team-id <teamId>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--meeting-id <meetingId>").option("--field-name <fieldName>").option("--field-value <fieldValue>").option("--field-blank <fieldBlank>").option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1355
|
-
const
|
|
1356
|
-
const organizationId = resolveOrganizationId(
|
|
1537
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1538
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1357
1539
|
const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
|
|
1358
1540
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1359
1541
|
await runGraphqlQueryCommand({
|
|
1360
1542
|
command: "tasks.list",
|
|
1361
|
-
runtimeOptions:
|
|
1543
|
+
runtimeOptions: context.runtimeOptions,
|
|
1362
1544
|
field: "tasks",
|
|
1363
1545
|
variables: normalizeGraphqlVariables2({
|
|
1364
1546
|
organization_id: organizationId,
|
|
@@ -1381,11 +1563,11 @@ function registerTaskCommands(program) {
|
|
|
1381
1563
|
});
|
|
1382
1564
|
tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1383
1565
|
const parsed = idSchema2.parse(opts.id);
|
|
1384
|
-
const
|
|
1385
|
-
const organizationId = resolveOrganizationId(
|
|
1566
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1567
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1386
1568
|
await runGraphqlQueryCommand({
|
|
1387
1569
|
command: "tasks.show",
|
|
1388
|
-
runtimeOptions:
|
|
1570
|
+
runtimeOptions: context.runtimeOptions,
|
|
1389
1571
|
field: "task",
|
|
1390
1572
|
variables: {
|
|
1391
1573
|
organization_id: organizationId,
|
|
@@ -1397,11 +1579,11 @@ function registerTaskCommands(program) {
|
|
|
1397
1579
|
tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
|
|
1398
1580
|
const projectId = projectIdSchema.parse(opts.projectId);
|
|
1399
1581
|
const summary = summarySchema.parse(opts.summary ?? opts.title);
|
|
1400
|
-
const
|
|
1401
|
-
const organizationId = resolveOrganizationId(
|
|
1582
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1583
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1402
1584
|
await runGraphqlMutationCommand({
|
|
1403
1585
|
command: "tasks.create",
|
|
1404
|
-
runtimeOptions:
|
|
1586
|
+
runtimeOptions: context.runtimeOptions,
|
|
1405
1587
|
field: "create_task",
|
|
1406
1588
|
variables: {
|
|
1407
1589
|
organization_id: organizationId,
|
|
@@ -1416,8 +1598,8 @@ function registerTaskCommands(program) {
|
|
|
1416
1598
|
});
|
|
1417
1599
|
tasks.command("update").requiredOption("--id <id>").option("--summary <summary>").option("--description <description>").option("--status <status>").option("--priority <priority>").option("--due-date <dueDate>").option("--member-id <memberId>").action(async (opts, cmd) => {
|
|
1418
1600
|
const id = idSchema2.parse(opts.id);
|
|
1419
|
-
const
|
|
1420
|
-
const organizationId = resolveOrganizationId(
|
|
1601
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1602
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1421
1603
|
const taskPayload = {
|
|
1422
1604
|
...opts.summary ? { summary: String(opts.summary) } : {},
|
|
1423
1605
|
...opts.description ? { description: String(opts.description) } : {},
|
|
@@ -1436,7 +1618,7 @@ function registerTaskCommands(program) {
|
|
|
1436
1618
|
}
|
|
1437
1619
|
await runGraphqlMutationCommand({
|
|
1438
1620
|
command: "tasks.update",
|
|
1439
|
-
runtimeOptions:
|
|
1621
|
+
runtimeOptions: context.runtimeOptions,
|
|
1440
1622
|
field: "update_task",
|
|
1441
1623
|
variables: {
|
|
1442
1624
|
organization_id: organizationId,
|
|
@@ -1457,12 +1639,12 @@ var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON
|
|
|
1457
1639
|
function registerProjectCommands(program) {
|
|
1458
1640
|
const projects = program.command("projects").description("Project operations");
|
|
1459
1641
|
projects.command("list").option("--page <page>").option("--per <per>").option("--include-archived <includeArchived>").option("--status <status>").option("--term <term>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1460
|
-
const
|
|
1461
|
-
const organizationId = resolveOrganizationId(
|
|
1642
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1643
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1462
1644
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1463
1645
|
await runGraphqlQueryCommand({
|
|
1464
1646
|
command: "projects.list",
|
|
1465
|
-
runtimeOptions:
|
|
1647
|
+
runtimeOptions: context.runtimeOptions,
|
|
1466
1648
|
field: "projects",
|
|
1467
1649
|
variables: normalizeGraphqlVariables2({
|
|
1468
1650
|
organization_id: organizationId,
|
|
@@ -1480,11 +1662,11 @@ function registerProjectCommands(program) {
|
|
|
1480
1662
|
});
|
|
1481
1663
|
projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1482
1664
|
const id = idSchema3.parse(opts.id);
|
|
1483
|
-
const
|
|
1484
|
-
const organizationId = resolveOrganizationId(
|
|
1665
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1666
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1485
1667
|
await runGraphqlQueryCommand({
|
|
1486
1668
|
command: "projects.show",
|
|
1487
|
-
runtimeOptions:
|
|
1669
|
+
runtimeOptions: context.runtimeOptions,
|
|
1488
1670
|
field: "project",
|
|
1489
1671
|
variables: {
|
|
1490
1672
|
organization_id: organizationId,
|
|
@@ -1494,12 +1676,12 @@ function registerProjectCommands(program) {
|
|
|
1494
1676
|
});
|
|
1495
1677
|
});
|
|
1496
1678
|
projects.command("create").requiredOption("--data-json <dataJson>", projectCreateDataJsonHelp).action(async (opts, cmd) => {
|
|
1497
|
-
const
|
|
1498
|
-
const organizationId = resolveOrganizationId(
|
|
1679
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1680
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1499
1681
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1500
1682
|
await runGraphqlMutationCommand({
|
|
1501
1683
|
command: "projects.create",
|
|
1502
|
-
runtimeOptions:
|
|
1684
|
+
runtimeOptions: context.runtimeOptions,
|
|
1503
1685
|
field: "create_project",
|
|
1504
1686
|
variables: {
|
|
1505
1687
|
organization_id: organizationId,
|
|
@@ -1509,12 +1691,12 @@ function registerProjectCommands(program) {
|
|
|
1509
1691
|
});
|
|
1510
1692
|
projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", projectUpdateDataJsonHelp).action(async (opts, cmd) => {
|
|
1511
1693
|
const id = idSchema3.parse(opts.id);
|
|
1512
|
-
const
|
|
1513
|
-
const organizationId = resolveOrganizationId(
|
|
1694
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1695
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1514
1696
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1515
1697
|
await runGraphqlMutationCommand({
|
|
1516
1698
|
command: "projects.update",
|
|
1517
|
-
runtimeOptions:
|
|
1699
|
+
runtimeOptions: context.runtimeOptions,
|
|
1518
1700
|
field: "update_project",
|
|
1519
1701
|
variables: {
|
|
1520
1702
|
organization_id: organizationId,
|
|
@@ -1535,13 +1717,13 @@ var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or
|
|
|
1535
1717
|
function registerRockCommands(program) {
|
|
1536
1718
|
const rocks = program.command("rocks").description("Rock operations");
|
|
1537
1719
|
rocks.command("list").option("--page <page>").option("--per <per>").option("--rock-collection-id <rockCollectionId>").option("--team-id <teamId>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--meeting-id <meetingId>").option("--annual-objective-id <annualObjectiveId>").option("--quarterly-objective-id <quarterlyObjectiveId>").option("--field-name <fieldName>").option("--field-value <fieldValue>").option("--field-blank <fieldBlank>").option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1538
|
-
const
|
|
1539
|
-
const organizationId = resolveOrganizationId(
|
|
1720
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1721
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1540
1722
|
const rockCollectionId = opts.rockCollectionId ? rockCollectionIdSchema.parse(opts.rockCollectionId) : void 0;
|
|
1541
1723
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1542
1724
|
await runGraphqlQueryCommand({
|
|
1543
1725
|
command: "rocks.list",
|
|
1544
|
-
runtimeOptions:
|
|
1726
|
+
runtimeOptions: context.runtimeOptions,
|
|
1545
1727
|
field: "rocks",
|
|
1546
1728
|
variables: normalizeGraphqlVariables2({
|
|
1547
1729
|
organization_id: organizationId,
|
|
@@ -1566,11 +1748,11 @@ function registerRockCommands(program) {
|
|
|
1566
1748
|
});
|
|
1567
1749
|
rocks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1568
1750
|
const id = idSchema4.parse(opts.id);
|
|
1569
|
-
const
|
|
1570
|
-
const organizationId = resolveOrganizationId(
|
|
1751
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1752
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1571
1753
|
await runGraphqlQueryCommand({
|
|
1572
1754
|
command: "rocks.show",
|
|
1573
|
-
runtimeOptions:
|
|
1755
|
+
runtimeOptions: context.runtimeOptions,
|
|
1574
1756
|
field: "rock",
|
|
1575
1757
|
variables: {
|
|
1576
1758
|
organization_id: organizationId,
|
|
@@ -1582,11 +1764,11 @@ function registerRockCommands(program) {
|
|
|
1582
1764
|
rocks.command("update-status").requiredOption("--id <id>").requiredOption("--status <status>").action(async (opts, cmd) => {
|
|
1583
1765
|
const id = idSchema4.parse(opts.id);
|
|
1584
1766
|
const status = statusSchema.parse(opts.status);
|
|
1585
|
-
const
|
|
1586
|
-
const organizationId = resolveOrganizationId(
|
|
1767
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1768
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1587
1769
|
await runGraphqlMutationCommand({
|
|
1588
1770
|
command: "rocks.update-status",
|
|
1589
|
-
runtimeOptions:
|
|
1771
|
+
runtimeOptions: context.runtimeOptions,
|
|
1590
1772
|
field: "update_rock",
|
|
1591
1773
|
variables: {
|
|
1592
1774
|
organization_id: organizationId,
|
|
@@ -1596,13 +1778,13 @@ function registerRockCommands(program) {
|
|
|
1596
1778
|
});
|
|
1597
1779
|
});
|
|
1598
1780
|
rocks.command("create").requiredOption("--data-json <dataJson>", createHelp).action(async (opts, cmd) => {
|
|
1599
|
-
const
|
|
1600
|
-
const organizationId = resolveOrganizationId(
|
|
1781
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1782
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1601
1783
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1602
1784
|
__testables.assertRequiredCreateFields(body, "rock", ["rock_collection_id"]);
|
|
1603
1785
|
await runGraphqlMutationCommand({
|
|
1604
1786
|
command: "rocks.create",
|
|
1605
|
-
runtimeOptions:
|
|
1787
|
+
runtimeOptions: context.runtimeOptions,
|
|
1606
1788
|
field: "create_rock",
|
|
1607
1789
|
variables: {
|
|
1608
1790
|
organization_id: organizationId,
|
|
@@ -1612,12 +1794,12 @@ function registerRockCommands(program) {
|
|
|
1612
1794
|
});
|
|
1613
1795
|
rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp).action(async (opts, cmd) => {
|
|
1614
1796
|
const id = idSchema4.parse(opts.id);
|
|
1615
|
-
const
|
|
1616
|
-
const organizationId = resolveOrganizationId(
|
|
1797
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1798
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1617
1799
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1618
1800
|
await runGraphqlMutationCommand({
|
|
1619
1801
|
command: "rocks.update",
|
|
1620
|
-
runtimeOptions:
|
|
1802
|
+
runtimeOptions: context.runtimeOptions,
|
|
1621
1803
|
field: "update_rock",
|
|
1622
1804
|
variables: {
|
|
1623
1805
|
organization_id: organizationId,
|
|
@@ -1637,12 +1819,12 @@ var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for mee
|
|
|
1637
1819
|
function registerMeetingCommands(program) {
|
|
1638
1820
|
const meetings = program.command("meetings").description("Meeting operations");
|
|
1639
1821
|
meetings.command("list").option("--per <per>").option("--date <date>").option("--occurrence-date <occurrenceDate>").option("--past <past>").option("--start-time <startTime>").option("--today-and-active <todayAndActive>").option("--upcoming <upcoming>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1640
|
-
const
|
|
1641
|
-
const organizationId = resolveOrganizationId(
|
|
1822
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1823
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1642
1824
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1643
1825
|
await runGraphqlQueryCommand({
|
|
1644
1826
|
command: "meetings.list",
|
|
1645
|
-
runtimeOptions:
|
|
1827
|
+
runtimeOptions: context.runtimeOptions,
|
|
1646
1828
|
field: "meetings",
|
|
1647
1829
|
variables: normalizeGraphqlVariables2({
|
|
1648
1830
|
organization_id: organizationId,
|
|
@@ -1660,11 +1842,11 @@ function registerMeetingCommands(program) {
|
|
|
1660
1842
|
});
|
|
1661
1843
|
meetings.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1662
1844
|
const id = idSchema5.parse(opts.id);
|
|
1663
|
-
const
|
|
1664
|
-
const organizationId = resolveOrganizationId(
|
|
1845
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1846
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1665
1847
|
await runGraphqlQueryCommand({
|
|
1666
1848
|
command: "meetings.show",
|
|
1667
|
-
runtimeOptions:
|
|
1849
|
+
runtimeOptions: context.runtimeOptions,
|
|
1668
1850
|
field: "meeting",
|
|
1669
1851
|
variables: {
|
|
1670
1852
|
organization_id: organizationId,
|
|
@@ -1676,11 +1858,11 @@ function registerMeetingCommands(program) {
|
|
|
1676
1858
|
meetings.command("notes").requiredOption("--id <id>").requiredOption("--content <content>").action(async (opts, cmd) => {
|
|
1677
1859
|
const id = idSchema5.parse(opts.id);
|
|
1678
1860
|
const notes = notesSchema.parse(opts.content);
|
|
1679
|
-
const
|
|
1680
|
-
const organizationId = resolveOrganizationId(
|
|
1861
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1862
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1681
1863
|
await runGraphqlMutationCommand({
|
|
1682
1864
|
command: "meeting-notes.create",
|
|
1683
|
-
runtimeOptions:
|
|
1865
|
+
runtimeOptions: context.runtimeOptions,
|
|
1684
1866
|
field: "update_meeting",
|
|
1685
1867
|
variables: {
|
|
1686
1868
|
organization_id: organizationId,
|
|
@@ -1694,12 +1876,12 @@ function registerMeetingCommands(program) {
|
|
|
1694
1876
|
});
|
|
1695
1877
|
});
|
|
1696
1878
|
meetings.command("create").requiredOption("--data-json <dataJson>", createHelp2).action(async (opts, cmd) => {
|
|
1697
|
-
const
|
|
1698
|
-
const organizationId = resolveOrganizationId(
|
|
1879
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1880
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1699
1881
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1700
1882
|
await runGraphqlMutationCommand({
|
|
1701
1883
|
command: "meetings.create",
|
|
1702
|
-
runtimeOptions:
|
|
1884
|
+
runtimeOptions: context.runtimeOptions,
|
|
1703
1885
|
field: "create_meeting",
|
|
1704
1886
|
variables: {
|
|
1705
1887
|
organization_id: organizationId,
|
|
@@ -1709,12 +1891,12 @@ function registerMeetingCommands(program) {
|
|
|
1709
1891
|
});
|
|
1710
1892
|
meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp2).action(async (opts, cmd) => {
|
|
1711
1893
|
const id = idSchema5.parse(opts.id);
|
|
1712
|
-
const
|
|
1713
|
-
const organizationId = resolveOrganizationId(
|
|
1894
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1895
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1714
1896
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1715
1897
|
await runGraphqlMutationCommand({
|
|
1716
1898
|
command: "meetings.update",
|
|
1717
|
-
runtimeOptions:
|
|
1899
|
+
runtimeOptions: context.runtimeOptions,
|
|
1718
1900
|
field: "update_meeting",
|
|
1719
1901
|
variables: {
|
|
1720
1902
|
organization_id: organizationId,
|
|
@@ -1733,12 +1915,12 @@ var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for memb
|
|
|
1733
1915
|
function registerMemberCommands(program) {
|
|
1734
1916
|
const members = program.command("members").description("Member operations");
|
|
1735
1917
|
members.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1736
|
-
const
|
|
1737
|
-
const organizationId = resolveOrganizationId(
|
|
1918
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1919
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1738
1920
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1739
1921
|
await runGraphqlQueryCommand({
|
|
1740
1922
|
command: "members.list",
|
|
1741
|
-
runtimeOptions:
|
|
1923
|
+
runtimeOptions: context.runtimeOptions,
|
|
1742
1924
|
field: "members",
|
|
1743
1925
|
variables: normalizeGraphqlVariables2({
|
|
1744
1926
|
organization_id: organizationId,
|
|
@@ -1751,11 +1933,11 @@ function registerMemberCommands(program) {
|
|
|
1751
1933
|
});
|
|
1752
1934
|
members.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1753
1935
|
const id = idSchema6.parse(opts.id);
|
|
1754
|
-
const
|
|
1755
|
-
const organizationId = resolveOrganizationId(
|
|
1936
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1937
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1756
1938
|
await runGraphqlQueryCommand({
|
|
1757
1939
|
command: "members.show",
|
|
1758
|
-
runtimeOptions:
|
|
1940
|
+
runtimeOptions: context.runtimeOptions,
|
|
1759
1941
|
field: "member",
|
|
1760
1942
|
variables: {
|
|
1761
1943
|
organization_id: organizationId,
|
|
@@ -1765,12 +1947,12 @@ function registerMemberCommands(program) {
|
|
|
1765
1947
|
});
|
|
1766
1948
|
});
|
|
1767
1949
|
members.command("create").requiredOption("--data-json <dataJson>", createHelp3).action(async (opts, cmd) => {
|
|
1768
|
-
const
|
|
1769
|
-
const organizationId = resolveOrganizationId(
|
|
1950
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1951
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1770
1952
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1771
1953
|
await runGraphqlMutationCommand({
|
|
1772
1954
|
command: "members.create",
|
|
1773
|
-
runtimeOptions:
|
|
1955
|
+
runtimeOptions: context.runtimeOptions,
|
|
1774
1956
|
field: "create_member",
|
|
1775
1957
|
variables: {
|
|
1776
1958
|
organization_id: organizationId,
|
|
@@ -1780,12 +1962,12 @@ function registerMemberCommands(program) {
|
|
|
1780
1962
|
});
|
|
1781
1963
|
members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp3).action(async (opts, cmd) => {
|
|
1782
1964
|
const id = idSchema6.parse(opts.id);
|
|
1783
|
-
const
|
|
1784
|
-
const organizationId = resolveOrganizationId(
|
|
1965
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1966
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1785
1967
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1786
1968
|
await runGraphqlMutationCommand({
|
|
1787
1969
|
command: "members.update",
|
|
1788
|
-
runtimeOptions:
|
|
1970
|
+
runtimeOptions: context.runtimeOptions,
|
|
1789
1971
|
field: "update_member",
|
|
1790
1972
|
variables: {
|
|
1791
1973
|
organization_id: organizationId,
|
|
@@ -1806,12 +1988,12 @@ var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue
|
|
|
1806
1988
|
function registerIssueCommands(program) {
|
|
1807
1989
|
const issues = program.command("issues").description("Issue operations");
|
|
1808
1990
|
issues.command("list").option("--page <page>").option("--per <per>").option("--issue-group-id <issueGroupId>").option("--team-id <teamId>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--meeting-id <meetingId>").option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1809
|
-
const
|
|
1810
|
-
const organizationId = resolveOrganizationId(
|
|
1991
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1992
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1811
1993
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1812
1994
|
await runGraphqlQueryCommand({
|
|
1813
1995
|
command: "issues.list",
|
|
1814
|
-
runtimeOptions:
|
|
1996
|
+
runtimeOptions: context.runtimeOptions,
|
|
1815
1997
|
field: "issues",
|
|
1816
1998
|
variables: normalizeGraphqlVariables2({
|
|
1817
1999
|
organization_id: organizationId,
|
|
@@ -1831,11 +2013,11 @@ function registerIssueCommands(program) {
|
|
|
1831
2013
|
});
|
|
1832
2014
|
issues.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1833
2015
|
const id = idSchema7.parse(opts.id);
|
|
1834
|
-
const
|
|
1835
|
-
const organizationId = resolveOrganizationId(
|
|
2016
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2017
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1836
2018
|
await runGraphqlQueryCommand({
|
|
1837
2019
|
command: "issues.show",
|
|
1838
|
-
runtimeOptions:
|
|
2020
|
+
runtimeOptions: context.runtimeOptions,
|
|
1839
2021
|
field: "issue",
|
|
1840
2022
|
variables: {
|
|
1841
2023
|
organization_id: organizationId,
|
|
@@ -1848,11 +2030,11 @@ function registerIssueCommands(program) {
|
|
|
1848
2030
|
const issueGroupId = issueGroupIdSchema.parse(opts.issueGroupId);
|
|
1849
2031
|
const name = nameSchema.parse(opts.name);
|
|
1850
2032
|
const issueType = issueTypeSchema.parse(opts.issueType);
|
|
1851
|
-
const
|
|
1852
|
-
const organizationId = resolveOrganizationId(
|
|
2033
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2034
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1853
2035
|
await runGraphqlMutationCommand({
|
|
1854
2036
|
command: "issues.create",
|
|
1855
|
-
runtimeOptions:
|
|
2037
|
+
runtimeOptions: context.runtimeOptions,
|
|
1856
2038
|
field: "create_issue",
|
|
1857
2039
|
variables: {
|
|
1858
2040
|
organization_id: organizationId,
|
|
@@ -1873,12 +2055,12 @@ function registerIssueCommands(program) {
|
|
|
1873
2055
|
});
|
|
1874
2056
|
issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp4).action(async (opts, cmd) => {
|
|
1875
2057
|
const id = idSchema7.parse(opts.id);
|
|
1876
|
-
const
|
|
1877
|
-
const organizationId = resolveOrganizationId(
|
|
2058
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2059
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1878
2060
|
const body = __testables.normalizeBody(String(opts.dataJson), "issue");
|
|
1879
2061
|
await runGraphqlMutationCommand({
|
|
1880
2062
|
command: "issues.update",
|
|
1881
|
-
runtimeOptions:
|
|
2063
|
+
runtimeOptions: context.runtimeOptions,
|
|
1882
2064
|
field: "update_issue",
|
|
1883
2065
|
variables: {
|
|
1884
2066
|
organization_id: organizationId,
|
|
@@ -2091,12 +2273,12 @@ var idSchema8 = import_zod9.z.string().min(1);
|
|
|
2091
2273
|
function registerTeamCommands(program) {
|
|
2092
2274
|
const teams = program.command("teams").description("Team operations");
|
|
2093
2275
|
teams.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
2094
|
-
const
|
|
2095
|
-
const organizationId = resolveOrganizationId(
|
|
2276
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2277
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2096
2278
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
2097
2279
|
await runGraphqlQueryCommand({
|
|
2098
2280
|
command: "teams.list",
|
|
2099
|
-
runtimeOptions:
|
|
2281
|
+
runtimeOptions: context.runtimeOptions,
|
|
2100
2282
|
field: "teams",
|
|
2101
2283
|
variables: normalizeGraphqlVariables2({
|
|
2102
2284
|
organization_id: organizationId,
|
|
@@ -2109,11 +2291,11 @@ function registerTeamCommands(program) {
|
|
|
2109
2291
|
});
|
|
2110
2292
|
teams.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2111
2293
|
const id = idSchema8.parse(opts.id);
|
|
2112
|
-
const
|
|
2113
|
-
const organizationId = resolveOrganizationId(
|
|
2294
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2295
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2114
2296
|
await runGraphqlQueryCommand({
|
|
2115
2297
|
command: "teams.show",
|
|
2116
|
-
runtimeOptions:
|
|
2298
|
+
runtimeOptions: context.runtimeOptions,
|
|
2117
2299
|
field: "team",
|
|
2118
2300
|
variables: {
|
|
2119
2301
|
organization_id: organizationId,
|
|
@@ -2123,12 +2305,12 @@ function registerTeamCommands(program) {
|
|
|
2123
2305
|
});
|
|
2124
2306
|
});
|
|
2125
2307
|
teams.command("create").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2126
|
-
const
|
|
2127
|
-
const organizationId = resolveOrganizationId(
|
|
2308
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2309
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2128
2310
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2129
2311
|
await runGraphqlMutationCommand({
|
|
2130
2312
|
command: "teams.create",
|
|
2131
|
-
runtimeOptions:
|
|
2313
|
+
runtimeOptions: context.runtimeOptions,
|
|
2132
2314
|
field: "create_team",
|
|
2133
2315
|
variables: {
|
|
2134
2316
|
organization_id: organizationId,
|
|
@@ -2138,12 +2320,12 @@ function registerTeamCommands(program) {
|
|
|
2138
2320
|
});
|
|
2139
2321
|
teams.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2140
2322
|
const id = idSchema8.parse(opts.id);
|
|
2141
|
-
const
|
|
2142
|
-
const organizationId = resolveOrganizationId(
|
|
2323
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2324
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2143
2325
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2144
2326
|
await runGraphqlMutationCommand({
|
|
2145
2327
|
command: "teams.update",
|
|
2146
|
-
runtimeOptions:
|
|
2328
|
+
runtimeOptions: context.runtimeOptions,
|
|
2147
2329
|
field: "update_team",
|
|
2148
2330
|
variables: {
|
|
2149
2331
|
organization_id: organizationId,
|
|
@@ -2160,12 +2342,12 @@ var idSchema9 = import_zod10.z.string().min(1);
|
|
|
2160
2342
|
function registerOrganizationCommands(program) {
|
|
2161
2343
|
const organizations = program.command("organizations").description("Organization operations");
|
|
2162
2344
|
organizations.command("show").option("--id <id>", "Organization ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2163
|
-
const
|
|
2164
|
-
const fallbackId = resolveOrganizationId(
|
|
2345
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2346
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2165
2347
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2166
2348
|
await runGraphqlQueryCommand({
|
|
2167
2349
|
command: "organizations.show",
|
|
2168
|
-
runtimeOptions:
|
|
2350
|
+
runtimeOptions: context.runtimeOptions,
|
|
2169
2351
|
field: "organization",
|
|
2170
2352
|
variables: { id },
|
|
2171
2353
|
isShow: true
|
|
@@ -2175,13 +2357,13 @@ function registerOrganizationCommands(program) {
|
|
|
2175
2357
|
"--data-json <dataJson>",
|
|
2176
2358
|
'JSON object for organization or {"organization": {...}}'
|
|
2177
2359
|
).action(async (opts, cmd) => {
|
|
2178
|
-
const
|
|
2179
|
-
const fallbackId = resolveOrganizationId(
|
|
2360
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2361
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2180
2362
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2181
2363
|
const body = __testables.normalizeBody(String(opts.dataJson), "organization");
|
|
2182
2364
|
await runGraphqlMutationCommand({
|
|
2183
2365
|
command: "organizations.update",
|
|
2184
|
-
runtimeOptions:
|
|
2366
|
+
runtimeOptions: context.runtimeOptions,
|
|
2185
2367
|
field: "update_organization",
|
|
2186
2368
|
variables: {
|
|
2187
2369
|
id,
|
|
@@ -2191,12 +2373,12 @@ function registerOrganizationCommands(program) {
|
|
|
2191
2373
|
});
|
|
2192
2374
|
const metaProfile = organizations.command("meta-profile").description("Organization meta profile operations");
|
|
2193
2375
|
metaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2194
|
-
const
|
|
2195
|
-
const organizationId = resolveOrganizationId(
|
|
2376
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2377
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2196
2378
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2197
2379
|
await runGraphqlQueryCommand({
|
|
2198
2380
|
command: "organizations.meta-profile.show",
|
|
2199
|
-
runtimeOptions:
|
|
2381
|
+
runtimeOptions: context.runtimeOptions,
|
|
2200
2382
|
field: "organization_meta_profile",
|
|
2201
2383
|
variables: {
|
|
2202
2384
|
organization_id: organizationId,
|
|
@@ -2209,8 +2391,8 @@ function registerOrganizationCommands(program) {
|
|
|
2209
2391
|
"--data-json <dataJson>",
|
|
2210
2392
|
'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
|
|
2211
2393
|
).action(async (opts, cmd) => {
|
|
2212
|
-
const
|
|
2213
|
-
const organizationId = resolveOrganizationId(
|
|
2394
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2395
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2214
2396
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2215
2397
|
const body = __testables.normalizeBody(
|
|
2216
2398
|
String(opts.dataJson),
|
|
@@ -2218,7 +2400,7 @@ function registerOrganizationCommands(program) {
|
|
|
2218
2400
|
);
|
|
2219
2401
|
await runGraphqlMutationCommand({
|
|
2220
2402
|
command: "organizations.meta-profile.update",
|
|
2221
|
-
runtimeOptions:
|
|
2403
|
+
runtimeOptions: context.runtimeOptions,
|
|
2222
2404
|
field: "update_organization_meta_profile",
|
|
2223
2405
|
variables: {
|
|
2224
2406
|
organization_id: organizationId,
|
|
@@ -2229,12 +2411,12 @@ function registerOrganizationCommands(program) {
|
|
|
2229
2411
|
});
|
|
2230
2412
|
const keyMetricMetaProfile = organizations.command("key-metric-meta-profile").description("Key metric meta profile operations");
|
|
2231
2413
|
keyMetricMetaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2232
|
-
const
|
|
2233
|
-
const organizationId = resolveOrganizationId(
|
|
2414
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2415
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2234
2416
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2235
2417
|
await runGraphqlQueryCommand({
|
|
2236
2418
|
command: "organizations.key-metric-meta-profile.show",
|
|
2237
|
-
runtimeOptions:
|
|
2419
|
+
runtimeOptions: context.runtimeOptions,
|
|
2238
2420
|
field: "key_metric_meta_profile",
|
|
2239
2421
|
variables: {
|
|
2240
2422
|
organization_id: organizationId,
|
|
@@ -2247,8 +2429,8 @@ function registerOrganizationCommands(program) {
|
|
|
2247
2429
|
"--data-json <dataJson>",
|
|
2248
2430
|
'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
|
|
2249
2431
|
).action(async (opts, cmd) => {
|
|
2250
|
-
const
|
|
2251
|
-
const organizationId = resolveOrganizationId(
|
|
2432
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2433
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2252
2434
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2253
2435
|
const body = __testables.normalizeBody(
|
|
2254
2436
|
String(opts.dataJson),
|
|
@@ -2256,7 +2438,7 @@ function registerOrganizationCommands(program) {
|
|
|
2256
2438
|
);
|
|
2257
2439
|
await runGraphqlMutationCommand({
|
|
2258
2440
|
command: "organizations.key-metric-meta-profile.update",
|
|
2259
|
-
runtimeOptions:
|
|
2441
|
+
runtimeOptions: context.runtimeOptions,
|
|
2260
2442
|
field: "update_key_metric_meta_profile",
|
|
2261
2443
|
variables: {
|
|
2262
2444
|
organization_id: organizationId,
|
|
@@ -2275,12 +2457,12 @@ function registerFoundationCommands(program) {
|
|
|
2275
2457
|
const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
|
|
2276
2458
|
const strategicObjectives = foundation.command("strategic-objectives").description("Strategic objective operations");
|
|
2277
2459
|
strategicPlans.command("show").option("--id <id>", "Strategic plan ID (defaults to organization context)").option("--progress-scope <progressScope>").option("--all-progress <allProgress>").option("--all <all>").action(async (opts, cmd) => {
|
|
2278
|
-
const
|
|
2279
|
-
const organizationId = resolveOrganizationId(
|
|
2460
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2461
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2280
2462
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2281
2463
|
await runGraphqlQueryCommand({
|
|
2282
2464
|
command: "foundation.strategic-plans.show",
|
|
2283
|
-
runtimeOptions:
|
|
2465
|
+
runtimeOptions: context.runtimeOptions,
|
|
2284
2466
|
field: "strategic_plan",
|
|
2285
2467
|
variables: normalizeGraphqlVariables2({
|
|
2286
2468
|
organization_id: organizationId,
|
|
@@ -2296,13 +2478,13 @@ function registerFoundationCommands(program) {
|
|
|
2296
2478
|
"--data-json <dataJson>",
|
|
2297
2479
|
'JSON object for strategic_plan or {"strategic_plan": {...}}'
|
|
2298
2480
|
).action(async (opts, cmd) => {
|
|
2299
|
-
const
|
|
2300
|
-
const organizationId = resolveOrganizationId(
|
|
2481
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2482
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2301
2483
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2302
2484
|
const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
|
|
2303
2485
|
await runGraphqlMutationCommand({
|
|
2304
2486
|
command: "foundation.strategic-plans.update",
|
|
2305
|
-
runtimeOptions:
|
|
2487
|
+
runtimeOptions: context.runtimeOptions,
|
|
2306
2488
|
field: "update_strategic_plan",
|
|
2307
2489
|
variables: {
|
|
2308
2490
|
organization_id: organizationId,
|
|
@@ -2312,12 +2494,12 @@ function registerFoundationCommands(program) {
|
|
|
2312
2494
|
});
|
|
2313
2495
|
});
|
|
2314
2496
|
strategicObjectives.command("show").option("--id <id>", "Strategic objective ID (defaults to organization context)").option("--progress-scope <progressScope>").option("--all-progress <allProgress>").option("--all <all>").action(async (opts, cmd) => {
|
|
2315
|
-
const
|
|
2316
|
-
const organizationId = resolveOrganizationId(
|
|
2497
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2498
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2317
2499
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2318
2500
|
await runGraphqlQueryCommand({
|
|
2319
2501
|
command: "foundation.strategic-objectives.show",
|
|
2320
|
-
runtimeOptions:
|
|
2502
|
+
runtimeOptions: context.runtimeOptions,
|
|
2321
2503
|
field: "strategic_objective",
|
|
2322
2504
|
variables: normalizeGraphqlVariables2({
|
|
2323
2505
|
organization_id: organizationId,
|
|
@@ -2333,8 +2515,8 @@ function registerFoundationCommands(program) {
|
|
|
2333
2515
|
"--data-json <dataJson>",
|
|
2334
2516
|
'JSON object for strategic_objective or {"strategic_objective": {...}}'
|
|
2335
2517
|
).action(async (opts, cmd) => {
|
|
2336
|
-
const
|
|
2337
|
-
const organizationId = resolveOrganizationId(
|
|
2518
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2519
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2338
2520
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2339
2521
|
const body = __testables.normalizeBody(
|
|
2340
2522
|
String(opts.dataJson),
|
|
@@ -2342,7 +2524,7 @@ function registerFoundationCommands(program) {
|
|
|
2342
2524
|
);
|
|
2343
2525
|
await runGraphqlMutationCommand({
|
|
2344
2526
|
command: "foundation.strategic-objectives.update",
|
|
2345
|
-
runtimeOptions:
|
|
2527
|
+
runtimeOptions: context.runtimeOptions,
|
|
2346
2528
|
field: "update_strategic_objective",
|
|
2347
2529
|
variables: {
|
|
2348
2530
|
organization_id: organizationId,
|
|
@@ -2369,10 +2551,487 @@ function registerFoundationCommands(program) {
|
|
|
2369
2551
|
});
|
|
2370
2552
|
}
|
|
2371
2553
|
|
|
2554
|
+
// src/commands/childEntities.ts
|
|
2555
|
+
var import_zod12 = require("zod");
|
|
2556
|
+
var idSchema11 = import_zod12.z.string().min(1);
|
|
2557
|
+
var jsonObjectSchema = import_zod12.z.record(import_zod12.z.string(), import_zod12.z.unknown());
|
|
2558
|
+
function parseJsonObject2(raw) {
|
|
2559
|
+
try {
|
|
2560
|
+
const parsed = JSON.parse(raw);
|
|
2561
|
+
return jsonObjectSchema.parse(parsed);
|
|
2562
|
+
} catch (error) {
|
|
2563
|
+
throw new CliError({
|
|
2564
|
+
message: error instanceof Error ? `Invalid --data-json: ${error.message}` : "Invalid --data-json.",
|
|
2565
|
+
kind: "invalid_args",
|
|
2566
|
+
status: 400,
|
|
2567
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
function normalizeBody2(raw, rootKey) {
|
|
2572
|
+
const payload = parseJsonObject2(raw);
|
|
2573
|
+
const rooted = payload[rootKey];
|
|
2574
|
+
if (rooted && typeof rooted === "object" && !Array.isArray(rooted)) {
|
|
2575
|
+
return payload;
|
|
2576
|
+
}
|
|
2577
|
+
return { [rootKey]: payload };
|
|
2578
|
+
}
|
|
2579
|
+
function assertRequiredParent(body, rootKey, parentKey) {
|
|
2580
|
+
const entity = body[rootKey];
|
|
2581
|
+
if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
|
|
2582
|
+
throw new CliError({
|
|
2583
|
+
message: `Invalid payload. Expected object at "${rootKey}".`,
|
|
2584
|
+
kind: "invalid_args",
|
|
2585
|
+
status: 400,
|
|
2586
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
const value = entity[parentKey];
|
|
2590
|
+
if (!(typeof value === "string" && value.trim().length > 0)) {
|
|
2591
|
+
throw new CliError({
|
|
2592
|
+
message: `Missing required create field for ${rootKey}: ${parentKey}.`,
|
|
2593
|
+
kind: "invalid_args",
|
|
2594
|
+
status: 400,
|
|
2595
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
function attrValue(attrs, keys) {
|
|
2600
|
+
if (!attrs || typeof attrs !== "object" || Array.isArray(attrs)) {
|
|
2601
|
+
return void 0;
|
|
2602
|
+
}
|
|
2603
|
+
const record = attrs;
|
|
2604
|
+
for (const key of keys) {
|
|
2605
|
+
if (record[key] !== void 0 && record[key] !== null && `${record[key]}`.trim() !== "") {
|
|
2606
|
+
return record[key];
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
return void 0;
|
|
2610
|
+
}
|
|
2611
|
+
function normalizePlacementRow(row, parentKind, parentIdFallback, parentTypedField) {
|
|
2612
|
+
const typedParent = parentTypedField ? row[parentTypedField] : void 0;
|
|
2613
|
+
const parentId = (typeof typedParent === "string" && typedParent.trim().length > 0 ? typedParent : void 0) ?? parentIdFallback ?? null;
|
|
2614
|
+
const attrs = row.attributes;
|
|
2615
|
+
const memberId = (typeof row.memberId === "string" ? row.memberId : void 0) ?? attrValue(attrs, ["memberId", "member_id"]) ?? null;
|
|
2616
|
+
const creatorId = (typeof row.creatorId === "string" ? row.creatorId : void 0) ?? attrValue(attrs, ["creatorId", "creator_id"]) ?? null;
|
|
2617
|
+
const ownerRaw = attrValue(attrs, ["memberId", "member_id", "creatorId", "creator_id"]) ?? null;
|
|
2618
|
+
const description = (typeof row.description === "string" && row.description.length > 0 ? row.description : attrValue(attrs, ["description"])) ?? null;
|
|
2619
|
+
return {
|
|
2620
|
+
id: row.id ?? null,
|
|
2621
|
+
type: row.type ?? null,
|
|
2622
|
+
parent: {
|
|
2623
|
+
kind: parentKind,
|
|
2624
|
+
id: parentId
|
|
2625
|
+
},
|
|
2626
|
+
owner: {
|
|
2627
|
+
memberId,
|
|
2628
|
+
creatorId,
|
|
2629
|
+
raw: ownerRaw
|
|
2630
|
+
},
|
|
2631
|
+
description,
|
|
2632
|
+
attributes: attrs ?? {}
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
function normalizeListPayload(payload, parentKind, parentIdFallback, parentTypedField) {
|
|
2636
|
+
const record = payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
|
|
2637
|
+
const rows = Array.isArray(record.data) ? record.data : [];
|
|
2638
|
+
const normalizedRows = rows.map(
|
|
2639
|
+
(row) => normalizePlacementRow(
|
|
2640
|
+
row,
|
|
2641
|
+
parentKind,
|
|
2642
|
+
parentIdFallback,
|
|
2643
|
+
parentTypedField
|
|
2644
|
+
)
|
|
2645
|
+
);
|
|
2646
|
+
return {
|
|
2647
|
+
data: normalizedRows,
|
|
2648
|
+
count: record.count ?? normalizedRows.length,
|
|
2649
|
+
currentPage: record.currentPage ?? 1,
|
|
2650
|
+
totalPages: record.totalPages ?? 1
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
function registerChildCommands(program, config) {
|
|
2654
|
+
const command = program.command(config.command).description(config.description);
|
|
2655
|
+
command.command("list").requiredOption(`--${config.parentFlag} <${config.parentFlag}>`).option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
|
|
2656
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2657
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2658
|
+
const parentId = idSchema11.parse(opts[config.parentFlag.replace(/-([a-z])/g, (_, c) => c.toUpperCase())]);
|
|
2659
|
+
await runGraphqlQueryCommand({
|
|
2660
|
+
command: `${config.command}.list`,
|
|
2661
|
+
operationName: config.listOperationName,
|
|
2662
|
+
runtimeOptions: context.runtimeOptions,
|
|
2663
|
+
field: config.listField,
|
|
2664
|
+
variables: {
|
|
2665
|
+
organization_id: organizationId,
|
|
2666
|
+
[config.parentFlag.replace(/-/g, "_")]: parentId,
|
|
2667
|
+
page: opts.page,
|
|
2668
|
+
per: opts.per
|
|
2669
|
+
},
|
|
2670
|
+
isList: true,
|
|
2671
|
+
selectionSet: config.listSelectionSet,
|
|
2672
|
+
transformData: (payload) => normalizeListPayload(
|
|
2673
|
+
payload,
|
|
2674
|
+
config.parentKind,
|
|
2675
|
+
parentId,
|
|
2676
|
+
config.listParentTypedField
|
|
2677
|
+
)
|
|
2678
|
+
});
|
|
2679
|
+
});
|
|
2680
|
+
command.command("create").requiredOption("--data-json <dataJson>").action(async (opts, cmd) => {
|
|
2681
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2682
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2683
|
+
const body = normalizeBody2(String(opts.dataJson), config.rootKey);
|
|
2684
|
+
assertRequiredParent(body, config.rootKey, config.parentFlag.replace(/-/g, "_"));
|
|
2685
|
+
await runGraphqlMutationCommand({
|
|
2686
|
+
command: `${config.command}.create`,
|
|
2687
|
+
operationName: config.createOperationName,
|
|
2688
|
+
runtimeOptions: context.runtimeOptions,
|
|
2689
|
+
field: config.createField,
|
|
2690
|
+
variables: {
|
|
2691
|
+
organization_id: organizationId,
|
|
2692
|
+
params: body
|
|
2693
|
+
}
|
|
2694
|
+
});
|
|
2695
|
+
});
|
|
2696
|
+
command.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>").action(async (opts, cmd) => {
|
|
2697
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2698
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2699
|
+
const id = idSchema11.parse(opts.id);
|
|
2700
|
+
const body = normalizeBody2(String(opts.dataJson), config.rootKey);
|
|
2701
|
+
await runGraphqlMutationCommand({
|
|
2702
|
+
command: `${config.command}.update`,
|
|
2703
|
+
operationName: config.updateOperationName,
|
|
2704
|
+
runtimeOptions: context.runtimeOptions,
|
|
2705
|
+
field: config.updateField,
|
|
2706
|
+
variables: {
|
|
2707
|
+
organization_id: organizationId,
|
|
2708
|
+
[config.idVariable]: id,
|
|
2709
|
+
params: body
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
});
|
|
2713
|
+
command.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2714
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2715
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2716
|
+
const id = idSchema11.parse(opts.id);
|
|
2717
|
+
await runGraphqlMutationCommand({
|
|
2718
|
+
command: `${config.command}.destroy`,
|
|
2719
|
+
operationName: config.destroyOperationName,
|
|
2720
|
+
runtimeOptions: context.runtimeOptions,
|
|
2721
|
+
field: config.destroyField,
|
|
2722
|
+
variables: {
|
|
2723
|
+
organization_id: organizationId,
|
|
2724
|
+
[config.idVariable]: id
|
|
2725
|
+
}
|
|
2726
|
+
});
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
function registerChildEntityCommands(program) {
|
|
2730
|
+
registerChildCommands(program, {
|
|
2731
|
+
command: "subtasks",
|
|
2732
|
+
description: "Subtask operations",
|
|
2733
|
+
parentFlag: "task-id",
|
|
2734
|
+
parentKind: "task",
|
|
2735
|
+
rootKey: "subtask",
|
|
2736
|
+
listField: "subtasks",
|
|
2737
|
+
createField: "create_subtask",
|
|
2738
|
+
updateField: "update_subtask",
|
|
2739
|
+
destroyField: "destroy_subtask",
|
|
2740
|
+
idVariable: "subtask_id",
|
|
2741
|
+
listOperationName: "SubtasksForTask",
|
|
2742
|
+
createOperationName: "CreateSubtask",
|
|
2743
|
+
updateOperationName: "UpdateSubtask",
|
|
2744
|
+
destroyOperationName: "DestroySubtask",
|
|
2745
|
+
listSelectionSet: "{ data { id type name status taskId attributes } count currentPage totalPages }",
|
|
2746
|
+
listParentTypedField: "taskId"
|
|
2747
|
+
});
|
|
2748
|
+
registerChildCommands(program, {
|
|
2749
|
+
command: "milestones",
|
|
2750
|
+
description: "Milestone operations",
|
|
2751
|
+
parentFlag: "rock-id",
|
|
2752
|
+
parentKind: "rock",
|
|
2753
|
+
rootKey: "milestone",
|
|
2754
|
+
listField: "milestones",
|
|
2755
|
+
createField: "create_milestone",
|
|
2756
|
+
updateField: "update_milestone",
|
|
2757
|
+
destroyField: "destroy_milestone",
|
|
2758
|
+
idVariable: "milestone_id",
|
|
2759
|
+
listOperationName: "MilestonesForRock",
|
|
2760
|
+
createOperationName: "CreateMilestone",
|
|
2761
|
+
updateOperationName: "UpdateMilestone",
|
|
2762
|
+
destroyOperationName: "DestroyMilestone",
|
|
2763
|
+
listSelectionSet: "{ data { id type name slug status attributes } count currentPage totalPages }"
|
|
2764
|
+
});
|
|
2765
|
+
registerChildCommands(program, {
|
|
2766
|
+
command: "subitems",
|
|
2767
|
+
description: "Subitem operations",
|
|
2768
|
+
parentFlag: "list-item-id",
|
|
2769
|
+
parentKind: "listItem",
|
|
2770
|
+
rootKey: "subitem",
|
|
2771
|
+
listField: "subitems",
|
|
2772
|
+
createField: "create_subitem",
|
|
2773
|
+
updateField: "update_subitem",
|
|
2774
|
+
destroyField: "destroy_subitem",
|
|
2775
|
+
idVariable: "subitem_id",
|
|
2776
|
+
listOperationName: "SubitemsForListItem",
|
|
2777
|
+
createOperationName: "CreateSubitem",
|
|
2778
|
+
updateOperationName: "UpdateSubitem",
|
|
2779
|
+
destroyOperationName: "DestroySubitem",
|
|
2780
|
+
listSelectionSet: "{ data { id type name status listItemId attributes } count currentPage totalPages }",
|
|
2781
|
+
listParentTypedField: "listItemId"
|
|
2782
|
+
});
|
|
2783
|
+
registerChildCommands(program, {
|
|
2784
|
+
command: "subtodos",
|
|
2785
|
+
description: "Subtodo operations",
|
|
2786
|
+
parentFlag: "todo-id",
|
|
2787
|
+
parentKind: "todo",
|
|
2788
|
+
rootKey: "sub_todo",
|
|
2789
|
+
listField: "sub_todos",
|
|
2790
|
+
createField: "create_sub_todo",
|
|
2791
|
+
updateField: "update_sub_todo",
|
|
2792
|
+
destroyField: "destroy_sub_todo",
|
|
2793
|
+
idVariable: "sub_todo_id",
|
|
2794
|
+
listOperationName: "SubtodosForTodo",
|
|
2795
|
+
createOperationName: "CreateSubTodo",
|
|
2796
|
+
updateOperationName: "UpdateSubTodo",
|
|
2797
|
+
destroyOperationName: "DestroySubTodo",
|
|
2798
|
+
listSelectionSet: "{ data { id type name status todoId attributes } count currentPage totalPages }",
|
|
2799
|
+
listParentTypedField: "todoId"
|
|
2800
|
+
});
|
|
2801
|
+
registerChildCommands(program, {
|
|
2802
|
+
command: "subissues",
|
|
2803
|
+
description: "Subissue operations",
|
|
2804
|
+
parentFlag: "issue-id",
|
|
2805
|
+
parentKind: "issue",
|
|
2806
|
+
rootKey: "sub_issue",
|
|
2807
|
+
listField: "sub_issues",
|
|
2808
|
+
createField: "create_sub_issue",
|
|
2809
|
+
updateField: "update_sub_issue",
|
|
2810
|
+
destroyField: "destroy_sub_issue",
|
|
2811
|
+
idVariable: "sub_issue_id",
|
|
2812
|
+
listOperationName: "SubissuesForIssue",
|
|
2813
|
+
createOperationName: "CreateSubIssue",
|
|
2814
|
+
updateOperationName: "UpdateSubIssue",
|
|
2815
|
+
destroyOperationName: "DestroySubIssue",
|
|
2816
|
+
listSelectionSet: "{ data { id type name status issueId attributes } count currentPage totalPages }",
|
|
2817
|
+
listParentTypedField: "issueId"
|
|
2818
|
+
});
|
|
2819
|
+
registerChildCommands(program, {
|
|
2820
|
+
command: "talking-points",
|
|
2821
|
+
description: "Talking point operations",
|
|
2822
|
+
parentFlag: "meeting-id",
|
|
2823
|
+
parentKind: "meeting",
|
|
2824
|
+
rootKey: "talking_point",
|
|
2825
|
+
listField: "talking_points",
|
|
2826
|
+
createField: "create_talking_point",
|
|
2827
|
+
updateField: "update_talking_point",
|
|
2828
|
+
destroyField: "destroy_talking_point",
|
|
2829
|
+
idVariable: "talking_point_id",
|
|
2830
|
+
listOperationName: "TalkingPointsForMeeting",
|
|
2831
|
+
createOperationName: "CreateTalkingPoint",
|
|
2832
|
+
updateOperationName: "UpdateTalkingPoint",
|
|
2833
|
+
destroyOperationName: "DestroyTalkingPoint",
|
|
2834
|
+
listSelectionSet: "{ data { id type name description status priority rank dueDate memberId creatorId meetingId attributes } count currentPage totalPages }",
|
|
2835
|
+
listParentTypedField: "meetingId"
|
|
2836
|
+
});
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
// src/commands/notes.ts
|
|
2840
|
+
var import_zod13 = require("zod");
|
|
2841
|
+
var idSchema12 = import_zod13.z.string().min(1);
|
|
2842
|
+
var nonEmptyString = import_zod13.z.string().min(1);
|
|
2843
|
+
function assertUpdateFields(params) {
|
|
2844
|
+
if (!params.name && !params.content && !params.status) {
|
|
2845
|
+
throw new CliError({
|
|
2846
|
+
message: "notes update requires at least one of --name, --body, or --status.",
|
|
2847
|
+
kind: "invalid_args",
|
|
2848
|
+
status: 400,
|
|
2849
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
async function createContent(command, cmd, payload) {
|
|
2854
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2855
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2856
|
+
return runGraphqlMutationCommand({
|
|
2857
|
+
command,
|
|
2858
|
+
operationName: "CreateContent",
|
|
2859
|
+
runtimeOptions: context.runtimeOptions,
|
|
2860
|
+
field: "create_content",
|
|
2861
|
+
variables: normalizeGraphqlVariables2({
|
|
2862
|
+
organization_id: organizationId,
|
|
2863
|
+
params: {
|
|
2864
|
+
content: payload
|
|
2865
|
+
}
|
|
2866
|
+
})
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
function registerNoteCommands(program) {
|
|
2870
|
+
const notes = program.command("notes").description("Content note operations");
|
|
2871
|
+
notes.command("list").option("--contentable-type <contentableType>").option("--contentable-id <contentableId>").option("--member-id <memberId>").option("--focus-member-id <focusMemberId>").option("--focus-team-id <focusTeamId>").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
|
|
2872
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2873
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2874
|
+
await runGraphqlQueryCommand({
|
|
2875
|
+
command: "notes.list",
|
|
2876
|
+
operationName: "ContentsIndex",
|
|
2877
|
+
runtimeOptions: context.runtimeOptions,
|
|
2878
|
+
field: "contents",
|
|
2879
|
+
variables: normalizeGraphqlVariables2({
|
|
2880
|
+
organization_id: organizationId,
|
|
2881
|
+
contentable_type: opts.contentableType,
|
|
2882
|
+
contentable_id: opts.contentableId,
|
|
2883
|
+
member_id: opts.memberId,
|
|
2884
|
+
focus_member_id: opts.focusMemberId,
|
|
2885
|
+
focus_team_id: opts.focusTeamId,
|
|
2886
|
+
page: opts.page,
|
|
2887
|
+
per: opts.per
|
|
2888
|
+
}),
|
|
2889
|
+
isList: true,
|
|
2890
|
+
selectionSet: "{ count currentPage totalPages data { id type name contentableType contentableId memberId focusMemberId focusTeamId attributes } }"
|
|
2891
|
+
});
|
|
2892
|
+
});
|
|
2893
|
+
notes.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2894
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2895
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2896
|
+
const id = idSchema12.parse(opts.id);
|
|
2897
|
+
await runGraphqlQueryCommand({
|
|
2898
|
+
command: "notes.show",
|
|
2899
|
+
operationName: "ContentShow",
|
|
2900
|
+
runtimeOptions: context.runtimeOptions,
|
|
2901
|
+
field: "content",
|
|
2902
|
+
variables: normalizeGraphqlVariables2({
|
|
2903
|
+
organization_id: organizationId,
|
|
2904
|
+
id
|
|
2905
|
+
}),
|
|
2906
|
+
isShow: true,
|
|
2907
|
+
selectionSet: "{ id type name contentableType contentableId memberId focusMemberId focusTeamId attributes }"
|
|
2908
|
+
});
|
|
2909
|
+
});
|
|
2910
|
+
notes.command("update").requiredOption("--id <id>").option("--name <name>").option("--body <body>").option("--status <status>").action(async (opts, cmd) => {
|
|
2911
|
+
assertUpdateFields({
|
|
2912
|
+
name: opts.name,
|
|
2913
|
+
content: opts.body,
|
|
2914
|
+
status: opts.status
|
|
2915
|
+
});
|
|
2916
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2917
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2918
|
+
const contentId = idSchema12.parse(opts.id);
|
|
2919
|
+
await runGraphqlMutationCommand({
|
|
2920
|
+
command: "notes.update",
|
|
2921
|
+
operationName: "UpdateContent",
|
|
2922
|
+
runtimeOptions: context.runtimeOptions,
|
|
2923
|
+
field: "update_content",
|
|
2924
|
+
variables: normalizeGraphqlVariables2({
|
|
2925
|
+
organization_id: organizationId,
|
|
2926
|
+
content_id: contentId,
|
|
2927
|
+
params: {
|
|
2928
|
+
content: normalizeGraphqlVariables2({
|
|
2929
|
+
name: opts.name,
|
|
2930
|
+
content: opts.body,
|
|
2931
|
+
status: opts.status
|
|
2932
|
+
})
|
|
2933
|
+
}
|
|
2934
|
+
})
|
|
2935
|
+
});
|
|
2936
|
+
});
|
|
2937
|
+
notes.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2938
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2939
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2940
|
+
const contentId = idSchema12.parse(opts.id);
|
|
2941
|
+
await runGraphqlMutationCommand({
|
|
2942
|
+
command: "notes.destroy",
|
|
2943
|
+
operationName: "DestroyContent",
|
|
2944
|
+
runtimeOptions: context.runtimeOptions,
|
|
2945
|
+
field: "destroy_content",
|
|
2946
|
+
variables: normalizeGraphqlVariables2({
|
|
2947
|
+
organization_id: organizationId,
|
|
2948
|
+
content_id: contentId
|
|
2949
|
+
})
|
|
2950
|
+
});
|
|
2951
|
+
});
|
|
2952
|
+
notes.command("create-member").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
2953
|
+
const targetMemberId = nonEmptyString.parse(opts.targetMemberId);
|
|
2954
|
+
await createContent("notes.create-member", cmd, {
|
|
2955
|
+
type: "WrittenContent",
|
|
2956
|
+
name: nonEmptyString.parse(opts.name),
|
|
2957
|
+
content: nonEmptyString.parse(opts.body),
|
|
2958
|
+
status: String(opts.status ?? "draft"),
|
|
2959
|
+
contentable_type: "Member",
|
|
2960
|
+
contentable_id: targetMemberId,
|
|
2961
|
+
member_id: targetMemberId,
|
|
2962
|
+
focus_member_id: null,
|
|
2963
|
+
focus_team_id: null
|
|
2964
|
+
});
|
|
2965
|
+
});
|
|
2966
|
+
notes.command("create-manager").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
2967
|
+
const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
|
|
2968
|
+
await createContent("notes.create-manager", cmd, {
|
|
2969
|
+
type: "WrittenContent",
|
|
2970
|
+
name: nonEmptyString.parse(opts.name),
|
|
2971
|
+
content: nonEmptyString.parse(opts.body),
|
|
2972
|
+
status: String(opts.status ?? "draft"),
|
|
2973
|
+
contentable_type: "Member",
|
|
2974
|
+
contentable_id: actorMemberId,
|
|
2975
|
+
member_id: actorMemberId,
|
|
2976
|
+
focus_member_id: nonEmptyString.parse(opts.targetMemberId)
|
|
2977
|
+
});
|
|
2978
|
+
});
|
|
2979
|
+
notes.command("create-team").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--team-id <teamId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
2980
|
+
const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
|
|
2981
|
+
const teamId = nonEmptyString.parse(opts.teamId);
|
|
2982
|
+
await createContent("notes.create-team", cmd, {
|
|
2983
|
+
type: "WrittenContent",
|
|
2984
|
+
name: nonEmptyString.parse(opts.name),
|
|
2985
|
+
content: nonEmptyString.parse(opts.body),
|
|
2986
|
+
status: String(opts.status ?? "draft"),
|
|
2987
|
+
contentable_type: "Team",
|
|
2988
|
+
contentable_id: teamId,
|
|
2989
|
+
member_id: actorMemberId,
|
|
2990
|
+
focus_team_id: teamId
|
|
2991
|
+
});
|
|
2992
|
+
});
|
|
2993
|
+
notes.command("create-project").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--project-id <projectId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
2994
|
+
await createContent("notes.create-project", cmd, {
|
|
2995
|
+
type: "WrittenContent",
|
|
2996
|
+
name: nonEmptyString.parse(opts.name),
|
|
2997
|
+
content: nonEmptyString.parse(opts.body),
|
|
2998
|
+
status: String(opts.status ?? "draft"),
|
|
2999
|
+
contentable_type: "Project",
|
|
3000
|
+
contentable_id: nonEmptyString.parse(opts.projectId),
|
|
3001
|
+
member_id: nonEmptyString.parse(opts.actorMemberId)
|
|
3002
|
+
});
|
|
3003
|
+
});
|
|
3004
|
+
notes.command("create-customer").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--customer-id <customerId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
3005
|
+
await createContent("notes.create-customer", cmd, {
|
|
3006
|
+
type: "WrittenContent",
|
|
3007
|
+
name: nonEmptyString.parse(opts.name),
|
|
3008
|
+
content: nonEmptyString.parse(opts.body),
|
|
3009
|
+
status: String(opts.status ?? "draft"),
|
|
3010
|
+
contentable_type: "Customer",
|
|
3011
|
+
contentable_id: nonEmptyString.parse(opts.customerId),
|
|
3012
|
+
member_id: nonEmptyString.parse(opts.actorMemberId)
|
|
3013
|
+
});
|
|
3014
|
+
});
|
|
3015
|
+
notes.command("create-contact").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--contact-id <contactId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
|
|
3016
|
+
await createContent("notes.create-contact", cmd, {
|
|
3017
|
+
type: "WrittenContent",
|
|
3018
|
+
name: nonEmptyString.parse(opts.name),
|
|
3019
|
+
content: nonEmptyString.parse(opts.body),
|
|
3020
|
+
status: String(opts.status ?? "draft"),
|
|
3021
|
+
contentable_type: "Contact",
|
|
3022
|
+
contentable_id: nonEmptyString.parse(opts.contactId),
|
|
3023
|
+
member_id: nonEmptyString.parse(opts.actorMemberId)
|
|
3024
|
+
});
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
|
|
2372
3028
|
// src/cli.ts
|
|
2373
3029
|
function buildCli() {
|
|
2374
3030
|
const program = new import_commander.Command();
|
|
2375
|
-
program.name("wave").description("Wave agent CLI").showHelpAfterError(false).allowExcessArguments(false).option("--token <token>", "API token (prefer WAVE_API_TOKEN env var)").option("--jwt <jwt>", "Legacy alias for --token (prefer WAVE_API_TOKEN env var)").option(
|
|
3031
|
+
program.name("wave").description("Wave agent CLI").showHelpAfterError(false).allowExcessArguments(false).option("--token <token>", "API token (prefer WAVE_API_TOKEN env var)").option("--jwt <jwt>", "Legacy alias for --token (prefer WAVE_API_TOKEN env var)").option("--token-stdin", "Read API token from stdin").option(
|
|
3032
|
+
"--auth-json-stdin",
|
|
3033
|
+
"Read auth/runtime context JSON from stdin (token, baseUrl, organizationId, ...)"
|
|
3034
|
+
).option(
|
|
2376
3035
|
"--base-url <baseUrl>",
|
|
2377
3036
|
"API base URL (prefer WAVE_API_BASE_URL env var)"
|
|
2378
3037
|
).option(
|
|
@@ -2398,6 +3057,8 @@ function buildCli() {
|
|
|
2398
3057
|
registerIssueCommands(program);
|
|
2399
3058
|
registerSystemToolCommands(program);
|
|
2400
3059
|
registerFoundationCommands(program);
|
|
3060
|
+
registerChildEntityCommands(program);
|
|
3061
|
+
registerNoteCommands(program);
|
|
2401
3062
|
return program;
|
|
2402
3063
|
}
|
|
2403
3064
|
|
|
@@ -2446,13 +3107,13 @@ main().catch((error) => {
|
|
|
2446
3107
|
exitCode: EXIT_CODES.invalidArgs
|
|
2447
3108
|
});
|
|
2448
3109
|
}
|
|
2449
|
-
if (error instanceof
|
|
3110
|
+
if (error instanceof import_zod14.ZodError || error instanceof import_commander2.InvalidArgumentError) {
|
|
2450
3111
|
printCliFailure({
|
|
2451
3112
|
status: 400,
|
|
2452
3113
|
code: "invalid_args",
|
|
2453
3114
|
message: "Invalid command arguments.",
|
|
2454
3115
|
details: {
|
|
2455
|
-
issues: error instanceof
|
|
3116
|
+
issues: error instanceof import_zod14.ZodError ? error.issues : [{ message: error.message, code: "invalid_argument" }]
|
|
2456
3117
|
},
|
|
2457
3118
|
exitCode: EXIT_CODES.invalidArgs
|
|
2458
3119
|
});
|