@ted-galago/wave-cli 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -5
- package/dist/index.cjs +326 -151
- package/dist/index.js +326 -151
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -101,10 +101,10 @@ function parseDebug(rawDebugOption, rawDebugEnv) {
|
|
|
101
101
|
return lowered === "1" || lowered === "true" || lowered === "yes";
|
|
102
102
|
}
|
|
103
103
|
function getConfig(options) {
|
|
104
|
-
const token =
|
|
104
|
+
const token = options.token ?? options.jwt ?? process.env.WAVE_API_TOKEN ?? process.env.WAVE_JWT;
|
|
105
105
|
if (!token) {
|
|
106
106
|
throw new CliError({
|
|
107
|
-
message: "Missing API token.
|
|
107
|
+
message: "Missing API token. Pass --token/--jwt, use --token-stdin/--auth-json-stdin, or set WAVE_API_TOKEN/WAVE_JWT.",
|
|
108
108
|
kind: "missing_auth",
|
|
109
109
|
status: 401,
|
|
110
110
|
exitCode: EXIT_CODES.missingOrInvalidAuth
|
|
@@ -113,7 +113,7 @@ function getConfig(options) {
|
|
|
113
113
|
const baseUrl = options.baseUrl ?? process.env.WAVE_API_BASE_URL ?? process.env.WAVE_API_URL;
|
|
114
114
|
if (!baseUrl) {
|
|
115
115
|
throw new CliError({
|
|
116
|
-
message: "Missing API base URL.
|
|
116
|
+
message: "Missing API base URL. Pass --base-url, provide via --auth-json-stdin, or set WAVE_API_BASE_URL/WAVE_API_URL.",
|
|
117
117
|
kind: "invalid_args",
|
|
118
118
|
status: 400,
|
|
119
119
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -560,24 +560,196 @@ async function runGraphqlMutationCommand(input) {
|
|
|
560
560
|
}
|
|
561
561
|
|
|
562
562
|
// src/commands/runtimeOptions.ts
|
|
563
|
-
|
|
563
|
+
var stdinPromise = null;
|
|
564
|
+
function normalize(raw) {
|
|
565
|
+
if (typeof raw !== "string") {
|
|
566
|
+
return void 0;
|
|
567
|
+
}
|
|
568
|
+
const trimmed = raw.trim();
|
|
569
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
570
|
+
}
|
|
571
|
+
function parseBool(raw) {
|
|
572
|
+
if (typeof raw === "boolean") {
|
|
573
|
+
return raw;
|
|
574
|
+
}
|
|
575
|
+
if (typeof raw !== "string") {
|
|
576
|
+
return void 0;
|
|
577
|
+
}
|
|
578
|
+
const lowered = raw.toLowerCase();
|
|
579
|
+
if (lowered === "1" || lowered === "true" || lowered === "yes") {
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
if (lowered === "0" || lowered === "false" || lowered === "no") {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
return void 0;
|
|
586
|
+
}
|
|
587
|
+
function parseAuthJson(raw) {
|
|
588
|
+
try {
|
|
589
|
+
const parsed = JSON.parse(raw);
|
|
590
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
591
|
+
throw new Error("Expected JSON object.");
|
|
592
|
+
}
|
|
593
|
+
const obj = parsed;
|
|
594
|
+
return {
|
|
595
|
+
token: normalize(obj.token),
|
|
596
|
+
jwt: normalize(obj.jwt),
|
|
597
|
+
baseUrl: normalize(obj.baseUrl ?? obj.base_url),
|
|
598
|
+
organizationId: normalize(obj.organizationId ?? obj.organization_id),
|
|
599
|
+
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,
|
|
600
|
+
debug: parseBool(obj.debug),
|
|
601
|
+
agentName: normalize(obj.agentName ?? obj.agent_name),
|
|
602
|
+
agentRunId: normalize(obj.agentRunId ?? obj.agent_run_id),
|
|
603
|
+
requestId: normalize(obj.requestId ?? obj.request_id),
|
|
604
|
+
openapiPath: normalize(obj.openapiPath ?? obj.openapi_path),
|
|
605
|
+
openapiUrl: normalize(obj.openapiUrl ?? obj.openapi_url),
|
|
606
|
+
openapiVersion: normalize(obj.openapiVersion ?? obj.openapi_version)
|
|
607
|
+
};
|
|
608
|
+
} catch (error) {
|
|
609
|
+
throw new CliError({
|
|
610
|
+
message: error instanceof Error ? `Invalid --auth-json-stdin payload: ${error.message}` : "Invalid --auth-json-stdin payload.",
|
|
611
|
+
kind: "invalid_args",
|
|
612
|
+
status: 400,
|
|
613
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
async function readStdinRaw() {
|
|
618
|
+
if (!stdinPromise) {
|
|
619
|
+
stdinPromise = new Promise((resolve, reject) => {
|
|
620
|
+
if (process.stdin.isTTY) {
|
|
621
|
+
resolve("");
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
let data = "";
|
|
625
|
+
process.stdin.setEncoding("utf8");
|
|
626
|
+
process.stdin.on("data", (chunk) => {
|
|
627
|
+
data += chunk;
|
|
628
|
+
});
|
|
629
|
+
process.stdin.on("end", () => resolve(data));
|
|
630
|
+
process.stdin.on("error", reject);
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
return stdinPromise;
|
|
634
|
+
}
|
|
635
|
+
function firstDefined(...values) {
|
|
636
|
+
return values.find((value) => value !== void 0);
|
|
637
|
+
}
|
|
638
|
+
function resolveFromSources(options, stdin, env) {
|
|
639
|
+
const token = firstDefined(
|
|
640
|
+
normalize(options.token),
|
|
641
|
+
normalize(options.jwt),
|
|
642
|
+
normalize(stdin.token),
|
|
643
|
+
normalize(stdin.jwt),
|
|
644
|
+
normalize(env.WAVE_API_TOKEN),
|
|
645
|
+
normalize(env.WAVE_JWT)
|
|
646
|
+
);
|
|
647
|
+
const baseUrl = firstDefined(
|
|
648
|
+
normalize(options.baseUrl),
|
|
649
|
+
normalize(stdin.baseUrl),
|
|
650
|
+
normalize(env.WAVE_API_BASE_URL),
|
|
651
|
+
normalize(env.WAVE_API_URL)
|
|
652
|
+
);
|
|
653
|
+
const organizationId = firstDefined(
|
|
654
|
+
normalize(options.organizationId),
|
|
655
|
+
normalize(stdin.organizationId),
|
|
656
|
+
normalize(env.WAVE_ORGANIZATION_ID),
|
|
657
|
+
normalize(env.WAVE_ORG_ID)
|
|
658
|
+
);
|
|
659
|
+
const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
|
|
660
|
+
const debug = firstDefined(
|
|
661
|
+
options.debug === true ? true : void 0,
|
|
662
|
+
stdin.debug,
|
|
663
|
+
parseBool(env.WAVE_DEBUG)
|
|
664
|
+
);
|
|
665
|
+
const agentName = firstDefined(
|
|
666
|
+
normalize(options.agentName),
|
|
667
|
+
normalize(stdin.agentName),
|
|
668
|
+
normalize(env.WAVE_AGENT_NAME)
|
|
669
|
+
);
|
|
670
|
+
const agentRunId = firstDefined(
|
|
671
|
+
normalize(options.agentRunId),
|
|
672
|
+
normalize(stdin.agentRunId),
|
|
673
|
+
normalize(env.WAVE_AGENT_RUN_ID)
|
|
674
|
+
);
|
|
675
|
+
const requestId = firstDefined(
|
|
676
|
+
normalize(options.requestId),
|
|
677
|
+
normalize(stdin.requestId),
|
|
678
|
+
normalize(env.WAVE_REQUEST_ID)
|
|
679
|
+
);
|
|
680
|
+
const openapiPath = firstDefined(
|
|
681
|
+
normalize(options.openapiPath),
|
|
682
|
+
normalize(stdin.openapiPath),
|
|
683
|
+
normalize(env.WAVE_OPENAPI_PATH)
|
|
684
|
+
);
|
|
685
|
+
const openapiUrl = firstDefined(
|
|
686
|
+
normalize(options.openapiUrl),
|
|
687
|
+
normalize(stdin.openapiUrl),
|
|
688
|
+
normalize(env.WAVE_OPENAPI_URL)
|
|
689
|
+
);
|
|
690
|
+
const openapiVersion = firstDefined(
|
|
691
|
+
normalize(options.openapiVersion),
|
|
692
|
+
normalize(stdin.openapiVersion),
|
|
693
|
+
normalize(env.WAVE_OPENAPI_VERSION)
|
|
694
|
+
);
|
|
564
695
|
return {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
696
|
+
organizationId,
|
|
697
|
+
runtimeOptions: {
|
|
698
|
+
token,
|
|
699
|
+
baseUrl,
|
|
700
|
+
timeoutMs,
|
|
701
|
+
debug,
|
|
702
|
+
agentName,
|
|
703
|
+
agentRunId,
|
|
704
|
+
requestId,
|
|
705
|
+
openapiPath,
|
|
706
|
+
openapiUrl,
|
|
707
|
+
openapiVersion
|
|
708
|
+
}
|
|
576
709
|
};
|
|
577
710
|
}
|
|
711
|
+
async function resolveStdinContext(options) {
|
|
712
|
+
if (options.tokenStdin && options.authJsonStdin) {
|
|
713
|
+
throw new CliError({
|
|
714
|
+
message: "Use only one stdin auth mode: --token-stdin or --auth-json-stdin.",
|
|
715
|
+
kind: "invalid_args",
|
|
716
|
+
status: 400,
|
|
717
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
if (!options.tokenStdin && !options.authJsonStdin) {
|
|
721
|
+
return {};
|
|
722
|
+
}
|
|
723
|
+
const raw = (await readStdinRaw()).trim();
|
|
724
|
+
if (!raw) {
|
|
725
|
+
throw new CliError({
|
|
726
|
+
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.",
|
|
727
|
+
kind: "invalid_args",
|
|
728
|
+
status: 400,
|
|
729
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
if (options.tokenStdin) {
|
|
733
|
+
const token = normalize(raw);
|
|
734
|
+
if (!token) {
|
|
735
|
+
throw new CliError({
|
|
736
|
+
message: "Invalid stdin token. Token value is empty.",
|
|
737
|
+
kind: "invalid_args",
|
|
738
|
+
status: 400,
|
|
739
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
return { token };
|
|
743
|
+
}
|
|
744
|
+
return parseAuthJson(raw);
|
|
745
|
+
}
|
|
746
|
+
async function resolveCommandContext(options) {
|
|
747
|
+
const stdin = await resolveStdinContext(options);
|
|
748
|
+
return resolveFromSources(options, stdin, process.env);
|
|
749
|
+
}
|
|
578
750
|
|
|
579
751
|
// src/commands/organization.ts
|
|
580
|
-
function
|
|
752
|
+
function normalize2(input) {
|
|
581
753
|
if (!input) {
|
|
582
754
|
return void 0;
|
|
583
755
|
}
|
|
@@ -585,10 +757,10 @@ function normalize(input) {
|
|
|
585
757
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
586
758
|
}
|
|
587
759
|
function resolveOrganizationId(raw) {
|
|
588
|
-
const organizationId =
|
|
760
|
+
const organizationId = normalize2(raw);
|
|
589
761
|
if (!organizationId) {
|
|
590
762
|
throw new CliError({
|
|
591
|
-
message: "Missing organization ID.
|
|
763
|
+
message: "Missing organization ID. Pass --organization-id, provide via --auth-json-stdin, or set WAVE_ORGANIZATION_ID.",
|
|
592
764
|
kind: "invalid_args",
|
|
593
765
|
status: 400,
|
|
594
766
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -1264,8 +1436,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1264
1436
|
list.option(`--${cliParam} <${cliParam}>`);
|
|
1265
1437
|
});
|
|
1266
1438
|
list.option("--query-json <queryJson>", "Additional query params as JSON object").action(async (opts, cmd) => {
|
|
1267
|
-
const
|
|
1268
|
-
const organizationId = resolveOrganizationId(
|
|
1439
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1440
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1269
1441
|
const extraQuery = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1270
1442
|
const mappedKnownParams = Object.fromEntries(
|
|
1271
1443
|
listParams.map((param) => {
|
|
@@ -1282,7 +1454,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1282
1454
|
});
|
|
1283
1455
|
await runGraphqlQueryCommand({
|
|
1284
1456
|
command: `${config.command}.list`,
|
|
1285
|
-
runtimeOptions:
|
|
1457
|
+
runtimeOptions: context.runtimeOptions,
|
|
1286
1458
|
field: config.resourcePath === "feedback" ? "feedbacks" : config.resourcePath,
|
|
1287
1459
|
variables,
|
|
1288
1460
|
isList: true
|
|
@@ -1290,11 +1462,11 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1290
1462
|
});
|
|
1291
1463
|
entityCommand.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1292
1464
|
const id = idSchema.parse(opts.id);
|
|
1293
|
-
const
|
|
1294
|
-
const organizationId = resolveOrganizationId(
|
|
1465
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1466
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1295
1467
|
await runGraphqlQueryCommand({
|
|
1296
1468
|
command: `${config.command}.show`,
|
|
1297
|
-
runtimeOptions:
|
|
1469
|
+
runtimeOptions: context.runtimeOptions,
|
|
1298
1470
|
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1299
1471
|
variables: normalizeGraphqlVariables2({
|
|
1300
1472
|
organization_id: organizationId,
|
|
@@ -1304,13 +1476,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1304
1476
|
});
|
|
1305
1477
|
});
|
|
1306
1478
|
entityCommand.command("create").requiredOption("--data-json <dataJson>", createHelp4).action(async (opts, cmd) => {
|
|
1307
|
-
const
|
|
1308
|
-
const organizationId = resolveOrganizationId(
|
|
1479
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1480
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1309
1481
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1310
1482
|
assertRequiredCreateFields(body, config.rootKey, config.requiredCreateFields);
|
|
1311
1483
|
await runGraphqlMutationCommand({
|
|
1312
1484
|
command: `${config.command}.create`,
|
|
1313
|
-
runtimeOptions:
|
|
1485
|
+
runtimeOptions: context.runtimeOptions,
|
|
1314
1486
|
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1315
1487
|
variables: {
|
|
1316
1488
|
organization_id: organizationId,
|
|
@@ -1320,13 +1492,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1320
1492
|
});
|
|
1321
1493
|
entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp5).action(async (opts, cmd) => {
|
|
1322
1494
|
const id = idSchema.parse(opts.id);
|
|
1323
|
-
const
|
|
1324
|
-
const organizationId = resolveOrganizationId(
|
|
1495
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1496
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1325
1497
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1326
1498
|
const singular = toSingularResourceName(config.resourcePath);
|
|
1327
1499
|
await runGraphqlMutationCommand({
|
|
1328
1500
|
command: `${config.command}.update`,
|
|
1329
|
-
runtimeOptions:
|
|
1501
|
+
runtimeOptions: context.runtimeOptions,
|
|
1330
1502
|
field: `update_${singular}`,
|
|
1331
1503
|
variables: {
|
|
1332
1504
|
organization_id: organizationId,
|
|
@@ -1351,13 +1523,13 @@ var summarySchema = z3.string().min(1);
|
|
|
1351
1523
|
function registerTaskCommands(program) {
|
|
1352
1524
|
const tasks = program.command("tasks").description("Task operations");
|
|
1353
1525
|
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) => {
|
|
1354
|
-
const
|
|
1355
|
-
const organizationId = resolveOrganizationId(
|
|
1526
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1527
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1356
1528
|
const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
|
|
1357
1529
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1358
1530
|
await runGraphqlQueryCommand({
|
|
1359
1531
|
command: "tasks.list",
|
|
1360
|
-
runtimeOptions:
|
|
1532
|
+
runtimeOptions: context.runtimeOptions,
|
|
1361
1533
|
field: "tasks",
|
|
1362
1534
|
variables: normalizeGraphqlVariables2({
|
|
1363
1535
|
organization_id: organizationId,
|
|
@@ -1380,11 +1552,11 @@ function registerTaskCommands(program) {
|
|
|
1380
1552
|
});
|
|
1381
1553
|
tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1382
1554
|
const parsed = idSchema2.parse(opts.id);
|
|
1383
|
-
const
|
|
1384
|
-
const organizationId = resolveOrganizationId(
|
|
1555
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1556
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1385
1557
|
await runGraphqlQueryCommand({
|
|
1386
1558
|
command: "tasks.show",
|
|
1387
|
-
runtimeOptions:
|
|
1559
|
+
runtimeOptions: context.runtimeOptions,
|
|
1388
1560
|
field: "task",
|
|
1389
1561
|
variables: {
|
|
1390
1562
|
organization_id: organizationId,
|
|
@@ -1396,11 +1568,11 @@ function registerTaskCommands(program) {
|
|
|
1396
1568
|
tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
|
|
1397
1569
|
const projectId = projectIdSchema.parse(opts.projectId);
|
|
1398
1570
|
const summary = summarySchema.parse(opts.summary ?? opts.title);
|
|
1399
|
-
const
|
|
1400
|
-
const organizationId = resolveOrganizationId(
|
|
1571
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1572
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1401
1573
|
await runGraphqlMutationCommand({
|
|
1402
1574
|
command: "tasks.create",
|
|
1403
|
-
runtimeOptions:
|
|
1575
|
+
runtimeOptions: context.runtimeOptions,
|
|
1404
1576
|
field: "create_task",
|
|
1405
1577
|
variables: {
|
|
1406
1578
|
organization_id: organizationId,
|
|
@@ -1415,8 +1587,8 @@ function registerTaskCommands(program) {
|
|
|
1415
1587
|
});
|
|
1416
1588
|
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) => {
|
|
1417
1589
|
const id = idSchema2.parse(opts.id);
|
|
1418
|
-
const
|
|
1419
|
-
const organizationId = resolveOrganizationId(
|
|
1590
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1591
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1420
1592
|
const taskPayload = {
|
|
1421
1593
|
...opts.summary ? { summary: String(opts.summary) } : {},
|
|
1422
1594
|
...opts.description ? { description: String(opts.description) } : {},
|
|
@@ -1435,7 +1607,7 @@ function registerTaskCommands(program) {
|
|
|
1435
1607
|
}
|
|
1436
1608
|
await runGraphqlMutationCommand({
|
|
1437
1609
|
command: "tasks.update",
|
|
1438
|
-
runtimeOptions:
|
|
1610
|
+
runtimeOptions: context.runtimeOptions,
|
|
1439
1611
|
field: "update_task",
|
|
1440
1612
|
variables: {
|
|
1441
1613
|
organization_id: organizationId,
|
|
@@ -1456,12 +1628,12 @@ var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON
|
|
|
1456
1628
|
function registerProjectCommands(program) {
|
|
1457
1629
|
const projects = program.command("projects").description("Project operations");
|
|
1458
1630
|
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) => {
|
|
1459
|
-
const
|
|
1460
|
-
const organizationId = resolveOrganizationId(
|
|
1631
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1632
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1461
1633
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1462
1634
|
await runGraphqlQueryCommand({
|
|
1463
1635
|
command: "projects.list",
|
|
1464
|
-
runtimeOptions:
|
|
1636
|
+
runtimeOptions: context.runtimeOptions,
|
|
1465
1637
|
field: "projects",
|
|
1466
1638
|
variables: normalizeGraphqlVariables2({
|
|
1467
1639
|
organization_id: organizationId,
|
|
@@ -1479,11 +1651,11 @@ function registerProjectCommands(program) {
|
|
|
1479
1651
|
});
|
|
1480
1652
|
projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1481
1653
|
const id = idSchema3.parse(opts.id);
|
|
1482
|
-
const
|
|
1483
|
-
const organizationId = resolveOrganizationId(
|
|
1654
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1655
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1484
1656
|
await runGraphqlQueryCommand({
|
|
1485
1657
|
command: "projects.show",
|
|
1486
|
-
runtimeOptions:
|
|
1658
|
+
runtimeOptions: context.runtimeOptions,
|
|
1487
1659
|
field: "project",
|
|
1488
1660
|
variables: {
|
|
1489
1661
|
organization_id: organizationId,
|
|
@@ -1493,12 +1665,12 @@ function registerProjectCommands(program) {
|
|
|
1493
1665
|
});
|
|
1494
1666
|
});
|
|
1495
1667
|
projects.command("create").requiredOption("--data-json <dataJson>", projectCreateDataJsonHelp).action(async (opts, cmd) => {
|
|
1496
|
-
const
|
|
1497
|
-
const organizationId = resolveOrganizationId(
|
|
1668
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1669
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1498
1670
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1499
1671
|
await runGraphqlMutationCommand({
|
|
1500
1672
|
command: "projects.create",
|
|
1501
|
-
runtimeOptions:
|
|
1673
|
+
runtimeOptions: context.runtimeOptions,
|
|
1502
1674
|
field: "create_project",
|
|
1503
1675
|
variables: {
|
|
1504
1676
|
organization_id: organizationId,
|
|
@@ -1508,12 +1680,12 @@ function registerProjectCommands(program) {
|
|
|
1508
1680
|
});
|
|
1509
1681
|
projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", projectUpdateDataJsonHelp).action(async (opts, cmd) => {
|
|
1510
1682
|
const id = idSchema3.parse(opts.id);
|
|
1511
|
-
const
|
|
1512
|
-
const organizationId = resolveOrganizationId(
|
|
1683
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1684
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1513
1685
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1514
1686
|
await runGraphqlMutationCommand({
|
|
1515
1687
|
command: "projects.update",
|
|
1516
|
-
runtimeOptions:
|
|
1688
|
+
runtimeOptions: context.runtimeOptions,
|
|
1517
1689
|
field: "update_project",
|
|
1518
1690
|
variables: {
|
|
1519
1691
|
organization_id: organizationId,
|
|
@@ -1534,13 +1706,13 @@ var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or
|
|
|
1534
1706
|
function registerRockCommands(program) {
|
|
1535
1707
|
const rocks = program.command("rocks").description("Rock operations");
|
|
1536
1708
|
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) => {
|
|
1537
|
-
const
|
|
1538
|
-
const organizationId = resolveOrganizationId(
|
|
1709
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1710
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1539
1711
|
const rockCollectionId = opts.rockCollectionId ? rockCollectionIdSchema.parse(opts.rockCollectionId) : void 0;
|
|
1540
1712
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1541
1713
|
await runGraphqlQueryCommand({
|
|
1542
1714
|
command: "rocks.list",
|
|
1543
|
-
runtimeOptions:
|
|
1715
|
+
runtimeOptions: context.runtimeOptions,
|
|
1544
1716
|
field: "rocks",
|
|
1545
1717
|
variables: normalizeGraphqlVariables2({
|
|
1546
1718
|
organization_id: organizationId,
|
|
@@ -1565,11 +1737,11 @@ function registerRockCommands(program) {
|
|
|
1565
1737
|
});
|
|
1566
1738
|
rocks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1567
1739
|
const id = idSchema4.parse(opts.id);
|
|
1568
|
-
const
|
|
1569
|
-
const organizationId = resolveOrganizationId(
|
|
1740
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1741
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1570
1742
|
await runGraphqlQueryCommand({
|
|
1571
1743
|
command: "rocks.show",
|
|
1572
|
-
runtimeOptions:
|
|
1744
|
+
runtimeOptions: context.runtimeOptions,
|
|
1573
1745
|
field: "rock",
|
|
1574
1746
|
variables: {
|
|
1575
1747
|
organization_id: organizationId,
|
|
@@ -1581,11 +1753,11 @@ function registerRockCommands(program) {
|
|
|
1581
1753
|
rocks.command("update-status").requiredOption("--id <id>").requiredOption("--status <status>").action(async (opts, cmd) => {
|
|
1582
1754
|
const id = idSchema4.parse(opts.id);
|
|
1583
1755
|
const status = statusSchema.parse(opts.status);
|
|
1584
|
-
const
|
|
1585
|
-
const organizationId = resolveOrganizationId(
|
|
1756
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1757
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1586
1758
|
await runGraphqlMutationCommand({
|
|
1587
1759
|
command: "rocks.update-status",
|
|
1588
|
-
runtimeOptions:
|
|
1760
|
+
runtimeOptions: context.runtimeOptions,
|
|
1589
1761
|
field: "update_rock",
|
|
1590
1762
|
variables: {
|
|
1591
1763
|
organization_id: organizationId,
|
|
@@ -1595,13 +1767,13 @@ function registerRockCommands(program) {
|
|
|
1595
1767
|
});
|
|
1596
1768
|
});
|
|
1597
1769
|
rocks.command("create").requiredOption("--data-json <dataJson>", createHelp).action(async (opts, cmd) => {
|
|
1598
|
-
const
|
|
1599
|
-
const organizationId = resolveOrganizationId(
|
|
1770
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1771
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1600
1772
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1601
1773
|
__testables.assertRequiredCreateFields(body, "rock", ["rock_collection_id"]);
|
|
1602
1774
|
await runGraphqlMutationCommand({
|
|
1603
1775
|
command: "rocks.create",
|
|
1604
|
-
runtimeOptions:
|
|
1776
|
+
runtimeOptions: context.runtimeOptions,
|
|
1605
1777
|
field: "create_rock",
|
|
1606
1778
|
variables: {
|
|
1607
1779
|
organization_id: organizationId,
|
|
@@ -1611,12 +1783,12 @@ function registerRockCommands(program) {
|
|
|
1611
1783
|
});
|
|
1612
1784
|
rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp).action(async (opts, cmd) => {
|
|
1613
1785
|
const id = idSchema4.parse(opts.id);
|
|
1614
|
-
const
|
|
1615
|
-
const organizationId = resolveOrganizationId(
|
|
1786
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1787
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1616
1788
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1617
1789
|
await runGraphqlMutationCommand({
|
|
1618
1790
|
command: "rocks.update",
|
|
1619
|
-
runtimeOptions:
|
|
1791
|
+
runtimeOptions: context.runtimeOptions,
|
|
1620
1792
|
field: "update_rock",
|
|
1621
1793
|
variables: {
|
|
1622
1794
|
organization_id: organizationId,
|
|
@@ -1636,12 +1808,12 @@ var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for mee
|
|
|
1636
1808
|
function registerMeetingCommands(program) {
|
|
1637
1809
|
const meetings = program.command("meetings").description("Meeting operations");
|
|
1638
1810
|
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) => {
|
|
1639
|
-
const
|
|
1640
|
-
const organizationId = resolveOrganizationId(
|
|
1811
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1812
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1641
1813
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1642
1814
|
await runGraphqlQueryCommand({
|
|
1643
1815
|
command: "meetings.list",
|
|
1644
|
-
runtimeOptions:
|
|
1816
|
+
runtimeOptions: context.runtimeOptions,
|
|
1645
1817
|
field: "meetings",
|
|
1646
1818
|
variables: normalizeGraphqlVariables2({
|
|
1647
1819
|
organization_id: organizationId,
|
|
@@ -1659,11 +1831,11 @@ function registerMeetingCommands(program) {
|
|
|
1659
1831
|
});
|
|
1660
1832
|
meetings.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1661
1833
|
const id = idSchema5.parse(opts.id);
|
|
1662
|
-
const
|
|
1663
|
-
const organizationId = resolveOrganizationId(
|
|
1834
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1835
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1664
1836
|
await runGraphqlQueryCommand({
|
|
1665
1837
|
command: "meetings.show",
|
|
1666
|
-
runtimeOptions:
|
|
1838
|
+
runtimeOptions: context.runtimeOptions,
|
|
1667
1839
|
field: "meeting",
|
|
1668
1840
|
variables: {
|
|
1669
1841
|
organization_id: organizationId,
|
|
@@ -1675,11 +1847,11 @@ function registerMeetingCommands(program) {
|
|
|
1675
1847
|
meetings.command("notes").requiredOption("--id <id>").requiredOption("--content <content>").action(async (opts, cmd) => {
|
|
1676
1848
|
const id = idSchema5.parse(opts.id);
|
|
1677
1849
|
const notes = notesSchema.parse(opts.content);
|
|
1678
|
-
const
|
|
1679
|
-
const organizationId = resolveOrganizationId(
|
|
1850
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1851
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1680
1852
|
await runGraphqlMutationCommand({
|
|
1681
1853
|
command: "meeting-notes.create",
|
|
1682
|
-
runtimeOptions:
|
|
1854
|
+
runtimeOptions: context.runtimeOptions,
|
|
1683
1855
|
field: "update_meeting",
|
|
1684
1856
|
variables: {
|
|
1685
1857
|
organization_id: organizationId,
|
|
@@ -1693,12 +1865,12 @@ function registerMeetingCommands(program) {
|
|
|
1693
1865
|
});
|
|
1694
1866
|
});
|
|
1695
1867
|
meetings.command("create").requiredOption("--data-json <dataJson>", createHelp2).action(async (opts, cmd) => {
|
|
1696
|
-
const
|
|
1697
|
-
const organizationId = resolveOrganizationId(
|
|
1868
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1869
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1698
1870
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1699
1871
|
await runGraphqlMutationCommand({
|
|
1700
1872
|
command: "meetings.create",
|
|
1701
|
-
runtimeOptions:
|
|
1873
|
+
runtimeOptions: context.runtimeOptions,
|
|
1702
1874
|
field: "create_meeting",
|
|
1703
1875
|
variables: {
|
|
1704
1876
|
organization_id: organizationId,
|
|
@@ -1708,12 +1880,12 @@ function registerMeetingCommands(program) {
|
|
|
1708
1880
|
});
|
|
1709
1881
|
meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp2).action(async (opts, cmd) => {
|
|
1710
1882
|
const id = idSchema5.parse(opts.id);
|
|
1711
|
-
const
|
|
1712
|
-
const organizationId = resolveOrganizationId(
|
|
1883
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1884
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1713
1885
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1714
1886
|
await runGraphqlMutationCommand({
|
|
1715
1887
|
command: "meetings.update",
|
|
1716
|
-
runtimeOptions:
|
|
1888
|
+
runtimeOptions: context.runtimeOptions,
|
|
1717
1889
|
field: "update_meeting",
|
|
1718
1890
|
variables: {
|
|
1719
1891
|
organization_id: organizationId,
|
|
@@ -1732,12 +1904,12 @@ var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for memb
|
|
|
1732
1904
|
function registerMemberCommands(program) {
|
|
1733
1905
|
const members = program.command("members").description("Member operations");
|
|
1734
1906
|
members.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1735
|
-
const
|
|
1736
|
-
const organizationId = resolveOrganizationId(
|
|
1907
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1908
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1737
1909
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1738
1910
|
await runGraphqlQueryCommand({
|
|
1739
1911
|
command: "members.list",
|
|
1740
|
-
runtimeOptions:
|
|
1912
|
+
runtimeOptions: context.runtimeOptions,
|
|
1741
1913
|
field: "members",
|
|
1742
1914
|
variables: normalizeGraphqlVariables2({
|
|
1743
1915
|
organization_id: organizationId,
|
|
@@ -1750,11 +1922,11 @@ function registerMemberCommands(program) {
|
|
|
1750
1922
|
});
|
|
1751
1923
|
members.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1752
1924
|
const id = idSchema6.parse(opts.id);
|
|
1753
|
-
const
|
|
1754
|
-
const organizationId = resolveOrganizationId(
|
|
1925
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1926
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1755
1927
|
await runGraphqlQueryCommand({
|
|
1756
1928
|
command: "members.show",
|
|
1757
|
-
runtimeOptions:
|
|
1929
|
+
runtimeOptions: context.runtimeOptions,
|
|
1758
1930
|
field: "member",
|
|
1759
1931
|
variables: {
|
|
1760
1932
|
organization_id: organizationId,
|
|
@@ -1764,12 +1936,12 @@ function registerMemberCommands(program) {
|
|
|
1764
1936
|
});
|
|
1765
1937
|
});
|
|
1766
1938
|
members.command("create").requiredOption("--data-json <dataJson>", createHelp3).action(async (opts, cmd) => {
|
|
1767
|
-
const
|
|
1768
|
-
const organizationId = resolveOrganizationId(
|
|
1939
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1940
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1769
1941
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1770
1942
|
await runGraphqlMutationCommand({
|
|
1771
1943
|
command: "members.create",
|
|
1772
|
-
runtimeOptions:
|
|
1944
|
+
runtimeOptions: context.runtimeOptions,
|
|
1773
1945
|
field: "create_member",
|
|
1774
1946
|
variables: {
|
|
1775
1947
|
organization_id: organizationId,
|
|
@@ -1779,12 +1951,12 @@ function registerMemberCommands(program) {
|
|
|
1779
1951
|
});
|
|
1780
1952
|
members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp3).action(async (opts, cmd) => {
|
|
1781
1953
|
const id = idSchema6.parse(opts.id);
|
|
1782
|
-
const
|
|
1783
|
-
const organizationId = resolveOrganizationId(
|
|
1954
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1955
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1784
1956
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1785
1957
|
await runGraphqlMutationCommand({
|
|
1786
1958
|
command: "members.update",
|
|
1787
|
-
runtimeOptions:
|
|
1959
|
+
runtimeOptions: context.runtimeOptions,
|
|
1788
1960
|
field: "update_member",
|
|
1789
1961
|
variables: {
|
|
1790
1962
|
organization_id: organizationId,
|
|
@@ -1805,12 +1977,12 @@ var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue
|
|
|
1805
1977
|
function registerIssueCommands(program) {
|
|
1806
1978
|
const issues = program.command("issues").description("Issue operations");
|
|
1807
1979
|
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) => {
|
|
1808
|
-
const
|
|
1809
|
-
const organizationId = resolveOrganizationId(
|
|
1980
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1981
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1810
1982
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1811
1983
|
await runGraphqlQueryCommand({
|
|
1812
1984
|
command: "issues.list",
|
|
1813
|
-
runtimeOptions:
|
|
1985
|
+
runtimeOptions: context.runtimeOptions,
|
|
1814
1986
|
field: "issues",
|
|
1815
1987
|
variables: normalizeGraphqlVariables2({
|
|
1816
1988
|
organization_id: organizationId,
|
|
@@ -1830,11 +2002,11 @@ function registerIssueCommands(program) {
|
|
|
1830
2002
|
});
|
|
1831
2003
|
issues.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1832
2004
|
const id = idSchema7.parse(opts.id);
|
|
1833
|
-
const
|
|
1834
|
-
const organizationId = resolveOrganizationId(
|
|
2005
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2006
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1835
2007
|
await runGraphqlQueryCommand({
|
|
1836
2008
|
command: "issues.show",
|
|
1837
|
-
runtimeOptions:
|
|
2009
|
+
runtimeOptions: context.runtimeOptions,
|
|
1838
2010
|
field: "issue",
|
|
1839
2011
|
variables: {
|
|
1840
2012
|
organization_id: organizationId,
|
|
@@ -1847,11 +2019,11 @@ function registerIssueCommands(program) {
|
|
|
1847
2019
|
const issueGroupId = issueGroupIdSchema.parse(opts.issueGroupId);
|
|
1848
2020
|
const name = nameSchema.parse(opts.name);
|
|
1849
2021
|
const issueType = issueTypeSchema.parse(opts.issueType);
|
|
1850
|
-
const
|
|
1851
|
-
const organizationId = resolveOrganizationId(
|
|
2022
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2023
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1852
2024
|
await runGraphqlMutationCommand({
|
|
1853
2025
|
command: "issues.create",
|
|
1854
|
-
runtimeOptions:
|
|
2026
|
+
runtimeOptions: context.runtimeOptions,
|
|
1855
2027
|
field: "create_issue",
|
|
1856
2028
|
variables: {
|
|
1857
2029
|
organization_id: organizationId,
|
|
@@ -1872,12 +2044,12 @@ function registerIssueCommands(program) {
|
|
|
1872
2044
|
});
|
|
1873
2045
|
issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp4).action(async (opts, cmd) => {
|
|
1874
2046
|
const id = idSchema7.parse(opts.id);
|
|
1875
|
-
const
|
|
1876
|
-
const organizationId = resolveOrganizationId(
|
|
2047
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2048
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1877
2049
|
const body = __testables.normalizeBody(String(opts.dataJson), "issue");
|
|
1878
2050
|
await runGraphqlMutationCommand({
|
|
1879
2051
|
command: "issues.update",
|
|
1880
|
-
runtimeOptions:
|
|
2052
|
+
runtimeOptions: context.runtimeOptions,
|
|
1881
2053
|
field: "update_issue",
|
|
1882
2054
|
variables: {
|
|
1883
2055
|
organization_id: organizationId,
|
|
@@ -2090,12 +2262,12 @@ var idSchema8 = z9.string().min(1);
|
|
|
2090
2262
|
function registerTeamCommands(program) {
|
|
2091
2263
|
const teams = program.command("teams").description("Team operations");
|
|
2092
2264
|
teams.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
2093
|
-
const
|
|
2094
|
-
const organizationId = resolveOrganizationId(
|
|
2265
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2266
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2095
2267
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
2096
2268
|
await runGraphqlQueryCommand({
|
|
2097
2269
|
command: "teams.list",
|
|
2098
|
-
runtimeOptions:
|
|
2270
|
+
runtimeOptions: context.runtimeOptions,
|
|
2099
2271
|
field: "teams",
|
|
2100
2272
|
variables: normalizeGraphqlVariables2({
|
|
2101
2273
|
organization_id: organizationId,
|
|
@@ -2108,11 +2280,11 @@ function registerTeamCommands(program) {
|
|
|
2108
2280
|
});
|
|
2109
2281
|
teams.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2110
2282
|
const id = idSchema8.parse(opts.id);
|
|
2111
|
-
const
|
|
2112
|
-
const organizationId = resolveOrganizationId(
|
|
2283
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2284
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2113
2285
|
await runGraphqlQueryCommand({
|
|
2114
2286
|
command: "teams.show",
|
|
2115
|
-
runtimeOptions:
|
|
2287
|
+
runtimeOptions: context.runtimeOptions,
|
|
2116
2288
|
field: "team",
|
|
2117
2289
|
variables: {
|
|
2118
2290
|
organization_id: organizationId,
|
|
@@ -2122,12 +2294,12 @@ function registerTeamCommands(program) {
|
|
|
2122
2294
|
});
|
|
2123
2295
|
});
|
|
2124
2296
|
teams.command("create").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2125
|
-
const
|
|
2126
|
-
const organizationId = resolveOrganizationId(
|
|
2297
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2298
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2127
2299
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2128
2300
|
await runGraphqlMutationCommand({
|
|
2129
2301
|
command: "teams.create",
|
|
2130
|
-
runtimeOptions:
|
|
2302
|
+
runtimeOptions: context.runtimeOptions,
|
|
2131
2303
|
field: "create_team",
|
|
2132
2304
|
variables: {
|
|
2133
2305
|
organization_id: organizationId,
|
|
@@ -2137,12 +2309,12 @@ function registerTeamCommands(program) {
|
|
|
2137
2309
|
});
|
|
2138
2310
|
teams.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2139
2311
|
const id = idSchema8.parse(opts.id);
|
|
2140
|
-
const
|
|
2141
|
-
const organizationId = resolveOrganizationId(
|
|
2312
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2313
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2142
2314
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2143
2315
|
await runGraphqlMutationCommand({
|
|
2144
2316
|
command: "teams.update",
|
|
2145
|
-
runtimeOptions:
|
|
2317
|
+
runtimeOptions: context.runtimeOptions,
|
|
2146
2318
|
field: "update_team",
|
|
2147
2319
|
variables: {
|
|
2148
2320
|
organization_id: organizationId,
|
|
@@ -2159,12 +2331,12 @@ var idSchema9 = z10.string().min(1);
|
|
|
2159
2331
|
function registerOrganizationCommands(program) {
|
|
2160
2332
|
const organizations = program.command("organizations").description("Organization operations");
|
|
2161
2333
|
organizations.command("show").option("--id <id>", "Organization ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2162
|
-
const
|
|
2163
|
-
const fallbackId = resolveOrganizationId(
|
|
2334
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2335
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2164
2336
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2165
2337
|
await runGraphqlQueryCommand({
|
|
2166
2338
|
command: "organizations.show",
|
|
2167
|
-
runtimeOptions:
|
|
2339
|
+
runtimeOptions: context.runtimeOptions,
|
|
2168
2340
|
field: "organization",
|
|
2169
2341
|
variables: { id },
|
|
2170
2342
|
isShow: true
|
|
@@ -2174,13 +2346,13 @@ function registerOrganizationCommands(program) {
|
|
|
2174
2346
|
"--data-json <dataJson>",
|
|
2175
2347
|
'JSON object for organization or {"organization": {...}}'
|
|
2176
2348
|
).action(async (opts, cmd) => {
|
|
2177
|
-
const
|
|
2178
|
-
const fallbackId = resolveOrganizationId(
|
|
2349
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2350
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2179
2351
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2180
2352
|
const body = __testables.normalizeBody(String(opts.dataJson), "organization");
|
|
2181
2353
|
await runGraphqlMutationCommand({
|
|
2182
2354
|
command: "organizations.update",
|
|
2183
|
-
runtimeOptions:
|
|
2355
|
+
runtimeOptions: context.runtimeOptions,
|
|
2184
2356
|
field: "update_organization",
|
|
2185
2357
|
variables: {
|
|
2186
2358
|
id,
|
|
@@ -2190,12 +2362,12 @@ function registerOrganizationCommands(program) {
|
|
|
2190
2362
|
});
|
|
2191
2363
|
const metaProfile = organizations.command("meta-profile").description("Organization meta profile operations");
|
|
2192
2364
|
metaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2193
|
-
const
|
|
2194
|
-
const organizationId = resolveOrganizationId(
|
|
2365
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2366
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2195
2367
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2196
2368
|
await runGraphqlQueryCommand({
|
|
2197
2369
|
command: "organizations.meta-profile.show",
|
|
2198
|
-
runtimeOptions:
|
|
2370
|
+
runtimeOptions: context.runtimeOptions,
|
|
2199
2371
|
field: "organization_meta_profile",
|
|
2200
2372
|
variables: {
|
|
2201
2373
|
organization_id: organizationId,
|
|
@@ -2208,8 +2380,8 @@ function registerOrganizationCommands(program) {
|
|
|
2208
2380
|
"--data-json <dataJson>",
|
|
2209
2381
|
'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
|
|
2210
2382
|
).action(async (opts, cmd) => {
|
|
2211
|
-
const
|
|
2212
|
-
const organizationId = resolveOrganizationId(
|
|
2383
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2384
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2213
2385
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2214
2386
|
const body = __testables.normalizeBody(
|
|
2215
2387
|
String(opts.dataJson),
|
|
@@ -2217,7 +2389,7 @@ function registerOrganizationCommands(program) {
|
|
|
2217
2389
|
);
|
|
2218
2390
|
await runGraphqlMutationCommand({
|
|
2219
2391
|
command: "organizations.meta-profile.update",
|
|
2220
|
-
runtimeOptions:
|
|
2392
|
+
runtimeOptions: context.runtimeOptions,
|
|
2221
2393
|
field: "update_organization_meta_profile",
|
|
2222
2394
|
variables: {
|
|
2223
2395
|
organization_id: organizationId,
|
|
@@ -2228,12 +2400,12 @@ function registerOrganizationCommands(program) {
|
|
|
2228
2400
|
});
|
|
2229
2401
|
const keyMetricMetaProfile = organizations.command("key-metric-meta-profile").description("Key metric meta profile operations");
|
|
2230
2402
|
keyMetricMetaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2231
|
-
const
|
|
2232
|
-
const organizationId = resolveOrganizationId(
|
|
2403
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2404
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2233
2405
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2234
2406
|
await runGraphqlQueryCommand({
|
|
2235
2407
|
command: "organizations.key-metric-meta-profile.show",
|
|
2236
|
-
runtimeOptions:
|
|
2408
|
+
runtimeOptions: context.runtimeOptions,
|
|
2237
2409
|
field: "key_metric_meta_profile",
|
|
2238
2410
|
variables: {
|
|
2239
2411
|
organization_id: organizationId,
|
|
@@ -2246,8 +2418,8 @@ function registerOrganizationCommands(program) {
|
|
|
2246
2418
|
"--data-json <dataJson>",
|
|
2247
2419
|
'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
|
|
2248
2420
|
).action(async (opts, cmd) => {
|
|
2249
|
-
const
|
|
2250
|
-
const organizationId = resolveOrganizationId(
|
|
2421
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2422
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2251
2423
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2252
2424
|
const body = __testables.normalizeBody(
|
|
2253
2425
|
String(opts.dataJson),
|
|
@@ -2255,7 +2427,7 @@ function registerOrganizationCommands(program) {
|
|
|
2255
2427
|
);
|
|
2256
2428
|
await runGraphqlMutationCommand({
|
|
2257
2429
|
command: "organizations.key-metric-meta-profile.update",
|
|
2258
|
-
runtimeOptions:
|
|
2430
|
+
runtimeOptions: context.runtimeOptions,
|
|
2259
2431
|
field: "update_key_metric_meta_profile",
|
|
2260
2432
|
variables: {
|
|
2261
2433
|
organization_id: organizationId,
|
|
@@ -2274,12 +2446,12 @@ function registerFoundationCommands(program) {
|
|
|
2274
2446
|
const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
|
|
2275
2447
|
const strategicObjectives = foundation.command("strategic-objectives").description("Strategic objective operations");
|
|
2276
2448
|
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) => {
|
|
2277
|
-
const
|
|
2278
|
-
const organizationId = resolveOrganizationId(
|
|
2449
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2450
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2279
2451
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2280
2452
|
await runGraphqlQueryCommand({
|
|
2281
2453
|
command: "foundation.strategic-plans.show",
|
|
2282
|
-
runtimeOptions:
|
|
2454
|
+
runtimeOptions: context.runtimeOptions,
|
|
2283
2455
|
field: "strategic_plan",
|
|
2284
2456
|
variables: normalizeGraphqlVariables2({
|
|
2285
2457
|
organization_id: organizationId,
|
|
@@ -2295,13 +2467,13 @@ function registerFoundationCommands(program) {
|
|
|
2295
2467
|
"--data-json <dataJson>",
|
|
2296
2468
|
'JSON object for strategic_plan or {"strategic_plan": {...}}'
|
|
2297
2469
|
).action(async (opts, cmd) => {
|
|
2298
|
-
const
|
|
2299
|
-
const organizationId = resolveOrganizationId(
|
|
2470
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2471
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2300
2472
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2301
2473
|
const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
|
|
2302
2474
|
await runGraphqlMutationCommand({
|
|
2303
2475
|
command: "foundation.strategic-plans.update",
|
|
2304
|
-
runtimeOptions:
|
|
2476
|
+
runtimeOptions: context.runtimeOptions,
|
|
2305
2477
|
field: "update_strategic_plan",
|
|
2306
2478
|
variables: {
|
|
2307
2479
|
organization_id: organizationId,
|
|
@@ -2311,12 +2483,12 @@ function registerFoundationCommands(program) {
|
|
|
2311
2483
|
});
|
|
2312
2484
|
});
|
|
2313
2485
|
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) => {
|
|
2314
|
-
const
|
|
2315
|
-
const organizationId = resolveOrganizationId(
|
|
2486
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2487
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2316
2488
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2317
2489
|
await runGraphqlQueryCommand({
|
|
2318
2490
|
command: "foundation.strategic-objectives.show",
|
|
2319
|
-
runtimeOptions:
|
|
2491
|
+
runtimeOptions: context.runtimeOptions,
|
|
2320
2492
|
field: "strategic_objective",
|
|
2321
2493
|
variables: normalizeGraphqlVariables2({
|
|
2322
2494
|
organization_id: organizationId,
|
|
@@ -2332,8 +2504,8 @@ function registerFoundationCommands(program) {
|
|
|
2332
2504
|
"--data-json <dataJson>",
|
|
2333
2505
|
'JSON object for strategic_objective or {"strategic_objective": {...}}'
|
|
2334
2506
|
).action(async (opts, cmd) => {
|
|
2335
|
-
const
|
|
2336
|
-
const organizationId = resolveOrganizationId(
|
|
2507
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2508
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2337
2509
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2338
2510
|
const body = __testables.normalizeBody(
|
|
2339
2511
|
String(opts.dataJson),
|
|
@@ -2341,7 +2513,7 @@ function registerFoundationCommands(program) {
|
|
|
2341
2513
|
);
|
|
2342
2514
|
await runGraphqlMutationCommand({
|
|
2343
2515
|
command: "foundation.strategic-objectives.update",
|
|
2344
|
-
runtimeOptions:
|
|
2516
|
+
runtimeOptions: context.runtimeOptions,
|
|
2345
2517
|
field: "update_strategic_objective",
|
|
2346
2518
|
variables: {
|
|
2347
2519
|
organization_id: organizationId,
|
|
@@ -2371,7 +2543,10 @@ function registerFoundationCommands(program) {
|
|
|
2371
2543
|
// src/cli.ts
|
|
2372
2544
|
function buildCli() {
|
|
2373
2545
|
const program = new Command();
|
|
2374
|
-
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(
|
|
2546
|
+
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(
|
|
2547
|
+
"--auth-json-stdin",
|
|
2548
|
+
"Read auth/runtime context JSON from stdin (token, baseUrl, organizationId, ...)"
|
|
2549
|
+
).option(
|
|
2375
2550
|
"--base-url <baseUrl>",
|
|
2376
2551
|
"API base URL (prefer WAVE_API_BASE_URL env var)"
|
|
2377
2552
|
).option(
|