@ted-galago/wave-cli 0.1.2 → 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 +431 -206
- package/dist/index.js +431 -206
- package/package.json +2 -1
- package/scripts/verify-dev-api.mjs +302 -0
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
|
|
@@ -180,6 +180,9 @@ function debugLog(config, message) {
|
|
|
180
180
|
function graphqlOperationName(command) {
|
|
181
181
|
return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
182
182
|
}
|
|
183
|
+
function toCamelCase(value) {
|
|
184
|
+
return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
185
|
+
}
|
|
183
186
|
function inferStatusFromGraphqlErrors(errors) {
|
|
184
187
|
if (!Array.isArray(errors) || errors.length === 0) {
|
|
185
188
|
return 400;
|
|
@@ -226,18 +229,39 @@ function graphqlTypeForValue(value) {
|
|
|
226
229
|
}
|
|
227
230
|
return "JSON";
|
|
228
231
|
}
|
|
232
|
+
function graphqlTypeForVariable(name, value) {
|
|
233
|
+
if (name === "id" || name.endsWith("Id")) {
|
|
234
|
+
return "ID";
|
|
235
|
+
}
|
|
236
|
+
if (name.endsWith("Ids")) {
|
|
237
|
+
return "[ID!]";
|
|
238
|
+
}
|
|
239
|
+
return graphqlTypeForValue(value);
|
|
240
|
+
}
|
|
241
|
+
function withNonNull(typeName) {
|
|
242
|
+
return typeName.endsWith("!") ? typeName : `${typeName}!`;
|
|
243
|
+
}
|
|
244
|
+
function normalizeGraphqlVariables(variables) {
|
|
245
|
+
const normalized = {};
|
|
246
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
247
|
+
normalized[toCamelCase(key)] = value;
|
|
248
|
+
});
|
|
249
|
+
return normalized;
|
|
250
|
+
}
|
|
229
251
|
function buildGraphqlBody(input) {
|
|
252
|
+
const graphqlField = toCamelCase(input.field);
|
|
253
|
+
const graphqlVariables = normalizeGraphqlVariables(input.variables);
|
|
230
254
|
const operationName = graphqlOperationName(input.command);
|
|
231
|
-
const variableEntries = Object.entries(
|
|
232
|
-
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${
|
|
255
|
+
const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
|
|
256
|
+
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
|
|
233
257
|
const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
|
|
234
258
|
const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
|
|
235
259
|
const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
|
|
236
|
-
const query = `${input.operationType} ${operationName}${signature} { ${
|
|
260
|
+
const query = `${input.operationType} ${operationName}${signature} { ${graphqlField}${args} ${input.selectionSet} }`;
|
|
237
261
|
return {
|
|
238
262
|
operationName,
|
|
239
263
|
query,
|
|
240
|
-
variables:
|
|
264
|
+
variables: graphqlVariables
|
|
241
265
|
};
|
|
242
266
|
}
|
|
243
267
|
async function graphqlRequest(input) {
|
|
@@ -288,7 +312,7 @@ async function graphqlRequest(input) {
|
|
|
288
312
|
exitCode: mapStatusToExitCode(status)
|
|
289
313
|
};
|
|
290
314
|
}
|
|
291
|
-
const fieldPayload = gqlData[input.field];
|
|
315
|
+
const fieldPayload = gqlData[toCamelCase(input.field)];
|
|
292
316
|
if (input.operationType === "mutation") {
|
|
293
317
|
const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
|
|
294
318
|
const ok = Boolean(mutationPayload.ok);
|
|
@@ -301,7 +325,9 @@ async function graphqlRequest(input) {
|
|
|
301
325
|
status,
|
|
302
326
|
data: null,
|
|
303
327
|
error: {
|
|
304
|
-
code: String(
|
|
328
|
+
code: String(
|
|
329
|
+
mutationPayload.errorCode ?? mutationPayload.error_code ?? `http_${status}`
|
|
330
|
+
),
|
|
305
331
|
message: "Mutation failed.",
|
|
306
332
|
details: {
|
|
307
333
|
errors: mutationPayload.errors ?? null,
|
|
@@ -404,10 +430,10 @@ function buildCliErrorEnvelope(params) {
|
|
|
404
430
|
}
|
|
405
431
|
function defaultQuerySelectionSet(field, isList) {
|
|
406
432
|
if (field === "organization") {
|
|
407
|
-
return "{ id slug
|
|
433
|
+
return "{ id slug membersCount organizationDetail { title name description timezone workspaceName } }";
|
|
408
434
|
}
|
|
409
435
|
if (isList) {
|
|
410
|
-
return "{ data { id type attributes } count
|
|
436
|
+
return "{ data { id type attributes } count currentPage totalPages }";
|
|
411
437
|
}
|
|
412
438
|
return "{ id type attributes }";
|
|
413
439
|
}
|
|
@@ -447,7 +473,7 @@ function normalizeGraphqlVariable(key, value) {
|
|
|
447
473
|
}
|
|
448
474
|
return parseBooleanMaybe(trimmed);
|
|
449
475
|
}
|
|
450
|
-
function
|
|
476
|
+
function normalizeGraphqlVariables2(raw) {
|
|
451
477
|
const normalized = {};
|
|
452
478
|
Object.entries(raw).forEach(([key, value]) => {
|
|
453
479
|
const next = normalizeGraphqlVariable(key, value);
|
|
@@ -504,7 +530,7 @@ async function runGraphqlMutationCommand(input) {
|
|
|
504
530
|
operationType: "mutation",
|
|
505
531
|
field: input.field,
|
|
506
532
|
variables: input.variables ?? {},
|
|
507
|
-
selectionSet: input.selectionSet ?? "{ ok status
|
|
533
|
+
selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
|
|
508
534
|
});
|
|
509
535
|
printEnvelopeAndExit(result);
|
|
510
536
|
} catch (error) {
|
|
@@ -534,24 +560,196 @@ async function runGraphqlMutationCommand(input) {
|
|
|
534
560
|
}
|
|
535
561
|
|
|
536
562
|
// src/commands/runtimeOptions.ts
|
|
537
|
-
|
|
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
|
+
);
|
|
538
695
|
return {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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
|
+
}
|
|
550
709
|
};
|
|
551
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
|
+
}
|
|
552
750
|
|
|
553
751
|
// src/commands/organization.ts
|
|
554
|
-
function
|
|
752
|
+
function normalize2(input) {
|
|
555
753
|
if (!input) {
|
|
556
754
|
return void 0;
|
|
557
755
|
}
|
|
@@ -559,10 +757,10 @@ function normalize(input) {
|
|
|
559
757
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
560
758
|
}
|
|
561
759
|
function resolveOrganizationId(raw) {
|
|
562
|
-
const organizationId =
|
|
760
|
+
const organizationId = normalize2(raw);
|
|
563
761
|
if (!organizationId) {
|
|
564
762
|
throw new CliError({
|
|
565
|
-
message: "Missing organization ID.
|
|
763
|
+
message: "Missing organization ID. Pass --organization-id, provide via --auth-json-stdin, or set WAVE_ORGANIZATION_ID.",
|
|
566
764
|
kind: "invalid_args",
|
|
567
765
|
status: 400,
|
|
568
766
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -1154,6 +1352,21 @@ function buildDataJsonHelp(rootKey, mode) {
|
|
|
1154
1352
|
|
|
1155
1353
|
// src/commands/entityCrud.ts
|
|
1156
1354
|
var idSchema = z2.string().min(1);
|
|
1355
|
+
function toSingularResourceName(resourcePath) {
|
|
1356
|
+
if (resourcePath === "organization_meta_profiles") {
|
|
1357
|
+
return "organization_meta_profile";
|
|
1358
|
+
}
|
|
1359
|
+
if (resourcePath === "key_metric_meta_profiles") {
|
|
1360
|
+
return "key_metric_meta_profile";
|
|
1361
|
+
}
|
|
1362
|
+
if (resourcePath.endsWith("ies")) {
|
|
1363
|
+
return resourcePath.slice(0, -3) + "y";
|
|
1364
|
+
}
|
|
1365
|
+
if (resourcePath.endsWith("s")) {
|
|
1366
|
+
return resourcePath.slice(0, -1);
|
|
1367
|
+
}
|
|
1368
|
+
return resourcePath;
|
|
1369
|
+
}
|
|
1157
1370
|
function parseJsonObject(raw) {
|
|
1158
1371
|
try {
|
|
1159
1372
|
const parsed = JSON.parse(raw);
|
|
@@ -1223,8 +1436,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1223
1436
|
list.option(`--${cliParam} <${cliParam}>`);
|
|
1224
1437
|
});
|
|
1225
1438
|
list.option("--query-json <queryJson>", "Additional query params as JSON object").action(async (opts, cmd) => {
|
|
1226
|
-
const
|
|
1227
|
-
const organizationId = resolveOrganizationId(
|
|
1439
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1440
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1228
1441
|
const extraQuery = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1229
1442
|
const mappedKnownParams = Object.fromEntries(
|
|
1230
1443
|
listParams.map((param) => {
|
|
@@ -1232,7 +1445,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1232
1445
|
return [param, opts[optionKey]];
|
|
1233
1446
|
})
|
|
1234
1447
|
);
|
|
1235
|
-
const variables =
|
|
1448
|
+
const variables = normalizeGraphqlVariables2({
|
|
1236
1449
|
organization_id: organizationId,
|
|
1237
1450
|
page: opts.page,
|
|
1238
1451
|
per: opts.per,
|
|
@@ -1241,7 +1454,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1241
1454
|
});
|
|
1242
1455
|
await runGraphqlQueryCommand({
|
|
1243
1456
|
command: `${config.command}.list`,
|
|
1244
|
-
runtimeOptions:
|
|
1457
|
+
runtimeOptions: context.runtimeOptions,
|
|
1245
1458
|
field: config.resourcePath === "feedback" ? "feedbacks" : config.resourcePath,
|
|
1246
1459
|
variables,
|
|
1247
1460
|
isList: true
|
|
@@ -1249,13 +1462,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1249
1462
|
});
|
|
1250
1463
|
entityCommand.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1251
1464
|
const id = idSchema.parse(opts.id);
|
|
1252
|
-
const
|
|
1253
|
-
const organizationId = resolveOrganizationId(
|
|
1465
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1466
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1254
1467
|
await runGraphqlQueryCommand({
|
|
1255
1468
|
command: `${config.command}.show`,
|
|
1256
|
-
runtimeOptions:
|
|
1257
|
-
field: config.resourcePath === "
|
|
1258
|
-
variables:
|
|
1469
|
+
runtimeOptions: context.runtimeOptions,
|
|
1470
|
+
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1471
|
+
variables: normalizeGraphqlVariables2({
|
|
1259
1472
|
organization_id: organizationId,
|
|
1260
1473
|
id
|
|
1261
1474
|
}),
|
|
@@ -1263,39 +1476,40 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1263
1476
|
});
|
|
1264
1477
|
});
|
|
1265
1478
|
entityCommand.command("create").requiredOption("--data-json <dataJson>", createHelp4).action(async (opts, cmd) => {
|
|
1266
|
-
const
|
|
1267
|
-
const organizationId = resolveOrganizationId(
|
|
1479
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1480
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1268
1481
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1269
1482
|
assertRequiredCreateFields(body, config.rootKey, config.requiredCreateFields);
|
|
1270
1483
|
await runGraphqlMutationCommand({
|
|
1271
1484
|
command: `${config.command}.create`,
|
|
1272
|
-
runtimeOptions:
|
|
1273
|
-
field:
|
|
1485
|
+
runtimeOptions: context.runtimeOptions,
|
|
1486
|
+
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1274
1487
|
variables: {
|
|
1275
1488
|
organization_id: organizationId,
|
|
1276
|
-
params: body
|
|
1489
|
+
params: body
|
|
1277
1490
|
}
|
|
1278
1491
|
});
|
|
1279
1492
|
});
|
|
1280
1493
|
entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp5).action(async (opts, cmd) => {
|
|
1281
1494
|
const id = idSchema.parse(opts.id);
|
|
1282
|
-
const
|
|
1283
|
-
const organizationId = resolveOrganizationId(
|
|
1495
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1496
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1284
1497
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1285
|
-
const singular =
|
|
1498
|
+
const singular = toSingularResourceName(config.resourcePath);
|
|
1286
1499
|
await runGraphqlMutationCommand({
|
|
1287
1500
|
command: `${config.command}.update`,
|
|
1288
|
-
runtimeOptions:
|
|
1501
|
+
runtimeOptions: context.runtimeOptions,
|
|
1289
1502
|
field: `update_${singular}`,
|
|
1290
1503
|
variables: {
|
|
1291
1504
|
organization_id: organizationId,
|
|
1292
1505
|
[`${singular}_id`]: id,
|
|
1293
|
-
params: body
|
|
1506
|
+
params: body
|
|
1294
1507
|
}
|
|
1295
1508
|
});
|
|
1296
1509
|
});
|
|
1297
1510
|
}
|
|
1298
1511
|
var __testables = {
|
|
1512
|
+
toSingularResourceName,
|
|
1299
1513
|
parseJsonObject,
|
|
1300
1514
|
normalizeBody,
|
|
1301
1515
|
assertRequiredCreateFields,
|
|
@@ -1309,15 +1523,15 @@ var summarySchema = z3.string().min(1);
|
|
|
1309
1523
|
function registerTaskCommands(program) {
|
|
1310
1524
|
const tasks = program.command("tasks").description("Task operations");
|
|
1311
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) => {
|
|
1312
|
-
const
|
|
1313
|
-
const organizationId = resolveOrganizationId(
|
|
1526
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1527
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1314
1528
|
const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
|
|
1315
1529
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1316
1530
|
await runGraphqlQueryCommand({
|
|
1317
1531
|
command: "tasks.list",
|
|
1318
|
-
runtimeOptions:
|
|
1532
|
+
runtimeOptions: context.runtimeOptions,
|
|
1319
1533
|
field: "tasks",
|
|
1320
|
-
variables:
|
|
1534
|
+
variables: normalizeGraphqlVariables2({
|
|
1321
1535
|
organization_id: organizationId,
|
|
1322
1536
|
page: opts.page,
|
|
1323
1537
|
per: opts.per,
|
|
@@ -1338,11 +1552,11 @@ function registerTaskCommands(program) {
|
|
|
1338
1552
|
});
|
|
1339
1553
|
tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1340
1554
|
const parsed = idSchema2.parse(opts.id);
|
|
1341
|
-
const
|
|
1342
|
-
const organizationId = resolveOrganizationId(
|
|
1555
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1556
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1343
1557
|
await runGraphqlQueryCommand({
|
|
1344
1558
|
command: "tasks.show",
|
|
1345
|
-
runtimeOptions:
|
|
1559
|
+
runtimeOptions: context.runtimeOptions,
|
|
1346
1560
|
field: "task",
|
|
1347
1561
|
variables: {
|
|
1348
1562
|
organization_id: organizationId,
|
|
@@ -1354,25 +1568,27 @@ function registerTaskCommands(program) {
|
|
|
1354
1568
|
tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
|
|
1355
1569
|
const projectId = projectIdSchema.parse(opts.projectId);
|
|
1356
1570
|
const summary = summarySchema.parse(opts.summary ?? opts.title);
|
|
1357
|
-
const
|
|
1358
|
-
const organizationId = resolveOrganizationId(
|
|
1571
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1572
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1359
1573
|
await runGraphqlMutationCommand({
|
|
1360
1574
|
command: "tasks.create",
|
|
1361
|
-
runtimeOptions:
|
|
1575
|
+
runtimeOptions: context.runtimeOptions,
|
|
1362
1576
|
field: "create_task",
|
|
1363
1577
|
variables: {
|
|
1364
1578
|
organization_id: organizationId,
|
|
1365
1579
|
params: {
|
|
1366
|
-
|
|
1367
|
-
|
|
1580
|
+
task: {
|
|
1581
|
+
project_id: projectId,
|
|
1582
|
+
summary
|
|
1583
|
+
}
|
|
1368
1584
|
}
|
|
1369
1585
|
}
|
|
1370
1586
|
});
|
|
1371
1587
|
});
|
|
1372
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) => {
|
|
1373
1589
|
const id = idSchema2.parse(opts.id);
|
|
1374
|
-
const
|
|
1375
|
-
const organizationId = resolveOrganizationId(
|
|
1590
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1591
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1376
1592
|
const taskPayload = {
|
|
1377
1593
|
...opts.summary ? { summary: String(opts.summary) } : {},
|
|
1378
1594
|
...opts.description ? { description: String(opts.description) } : {},
|
|
@@ -1391,12 +1607,14 @@ function registerTaskCommands(program) {
|
|
|
1391
1607
|
}
|
|
1392
1608
|
await runGraphqlMutationCommand({
|
|
1393
1609
|
command: "tasks.update",
|
|
1394
|
-
runtimeOptions:
|
|
1610
|
+
runtimeOptions: context.runtimeOptions,
|
|
1395
1611
|
field: "update_task",
|
|
1396
1612
|
variables: {
|
|
1397
1613
|
organization_id: organizationId,
|
|
1398
1614
|
task_id: id,
|
|
1399
|
-
params:
|
|
1615
|
+
params: {
|
|
1616
|
+
task: taskPayload
|
|
1617
|
+
}
|
|
1400
1618
|
}
|
|
1401
1619
|
});
|
|
1402
1620
|
});
|
|
@@ -1410,14 +1628,14 @@ var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON
|
|
|
1410
1628
|
function registerProjectCommands(program) {
|
|
1411
1629
|
const projects = program.command("projects").description("Project operations");
|
|
1412
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) => {
|
|
1413
|
-
const
|
|
1414
|
-
const organizationId = resolveOrganizationId(
|
|
1631
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1632
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1415
1633
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1416
1634
|
await runGraphqlQueryCommand({
|
|
1417
1635
|
command: "projects.list",
|
|
1418
|
-
runtimeOptions:
|
|
1636
|
+
runtimeOptions: context.runtimeOptions,
|
|
1419
1637
|
field: "projects",
|
|
1420
|
-
variables:
|
|
1638
|
+
variables: normalizeGraphqlVariables2({
|
|
1421
1639
|
organization_id: organizationId,
|
|
1422
1640
|
page: opts.page,
|
|
1423
1641
|
per: opts.per,
|
|
@@ -1433,11 +1651,11 @@ function registerProjectCommands(program) {
|
|
|
1433
1651
|
});
|
|
1434
1652
|
projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1435
1653
|
const id = idSchema3.parse(opts.id);
|
|
1436
|
-
const
|
|
1437
|
-
const organizationId = resolveOrganizationId(
|
|
1654
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1655
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1438
1656
|
await runGraphqlQueryCommand({
|
|
1439
1657
|
command: "projects.show",
|
|
1440
|
-
runtimeOptions:
|
|
1658
|
+
runtimeOptions: context.runtimeOptions,
|
|
1441
1659
|
field: "project",
|
|
1442
1660
|
variables: {
|
|
1443
1661
|
organization_id: organizationId,
|
|
@@ -1447,32 +1665,32 @@ function registerProjectCommands(program) {
|
|
|
1447
1665
|
});
|
|
1448
1666
|
});
|
|
1449
1667
|
projects.command("create").requiredOption("--data-json <dataJson>", projectCreateDataJsonHelp).action(async (opts, cmd) => {
|
|
1450
|
-
const
|
|
1451
|
-
const organizationId = resolveOrganizationId(
|
|
1668
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1669
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1452
1670
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1453
1671
|
await runGraphqlMutationCommand({
|
|
1454
1672
|
command: "projects.create",
|
|
1455
|
-
runtimeOptions:
|
|
1673
|
+
runtimeOptions: context.runtimeOptions,
|
|
1456
1674
|
field: "create_project",
|
|
1457
1675
|
variables: {
|
|
1458
1676
|
organization_id: organizationId,
|
|
1459
|
-
params: body
|
|
1677
|
+
params: body
|
|
1460
1678
|
}
|
|
1461
1679
|
});
|
|
1462
1680
|
});
|
|
1463
1681
|
projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", projectUpdateDataJsonHelp).action(async (opts, cmd) => {
|
|
1464
1682
|
const id = idSchema3.parse(opts.id);
|
|
1465
|
-
const
|
|
1466
|
-
const organizationId = resolveOrganizationId(
|
|
1683
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1684
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1467
1685
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1468
1686
|
await runGraphqlMutationCommand({
|
|
1469
1687
|
command: "projects.update",
|
|
1470
|
-
runtimeOptions:
|
|
1688
|
+
runtimeOptions: context.runtimeOptions,
|
|
1471
1689
|
field: "update_project",
|
|
1472
1690
|
variables: {
|
|
1473
1691
|
organization_id: organizationId,
|
|
1474
1692
|
project_id: id,
|
|
1475
|
-
params: body
|
|
1693
|
+
params: body
|
|
1476
1694
|
}
|
|
1477
1695
|
});
|
|
1478
1696
|
});
|
|
@@ -1488,15 +1706,15 @@ var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or
|
|
|
1488
1706
|
function registerRockCommands(program) {
|
|
1489
1707
|
const rocks = program.command("rocks").description("Rock operations");
|
|
1490
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) => {
|
|
1491
|
-
const
|
|
1492
|
-
const organizationId = resolveOrganizationId(
|
|
1709
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1710
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1493
1711
|
const rockCollectionId = opts.rockCollectionId ? rockCollectionIdSchema.parse(opts.rockCollectionId) : void 0;
|
|
1494
1712
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1495
1713
|
await runGraphqlQueryCommand({
|
|
1496
1714
|
command: "rocks.list",
|
|
1497
|
-
runtimeOptions:
|
|
1715
|
+
runtimeOptions: context.runtimeOptions,
|
|
1498
1716
|
field: "rocks",
|
|
1499
|
-
variables:
|
|
1717
|
+
variables: normalizeGraphqlVariables2({
|
|
1500
1718
|
organization_id: organizationId,
|
|
1501
1719
|
page: opts.page,
|
|
1502
1720
|
per: opts.per,
|
|
@@ -1519,11 +1737,11 @@ function registerRockCommands(program) {
|
|
|
1519
1737
|
});
|
|
1520
1738
|
rocks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1521
1739
|
const id = idSchema4.parse(opts.id);
|
|
1522
|
-
const
|
|
1523
|
-
const organizationId = resolveOrganizationId(
|
|
1740
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1741
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1524
1742
|
await runGraphqlQueryCommand({
|
|
1525
1743
|
command: "rocks.show",
|
|
1526
|
-
runtimeOptions:
|
|
1744
|
+
runtimeOptions: context.runtimeOptions,
|
|
1527
1745
|
field: "rock",
|
|
1528
1746
|
variables: {
|
|
1529
1747
|
organization_id: organizationId,
|
|
@@ -1535,47 +1753,47 @@ function registerRockCommands(program) {
|
|
|
1535
1753
|
rocks.command("update-status").requiredOption("--id <id>").requiredOption("--status <status>").action(async (opts, cmd) => {
|
|
1536
1754
|
const id = idSchema4.parse(opts.id);
|
|
1537
1755
|
const status = statusSchema.parse(opts.status);
|
|
1538
|
-
const
|
|
1539
|
-
const organizationId = resolveOrganizationId(
|
|
1756
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1757
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1540
1758
|
await runGraphqlMutationCommand({
|
|
1541
1759
|
command: "rocks.update-status",
|
|
1542
|
-
runtimeOptions:
|
|
1760
|
+
runtimeOptions: context.runtimeOptions,
|
|
1543
1761
|
field: "update_rock",
|
|
1544
1762
|
variables: {
|
|
1545
1763
|
organization_id: organizationId,
|
|
1546
1764
|
rock_id: id,
|
|
1547
|
-
params: { status }
|
|
1765
|
+
params: { rock: { status } }
|
|
1548
1766
|
}
|
|
1549
1767
|
});
|
|
1550
1768
|
});
|
|
1551
1769
|
rocks.command("create").requiredOption("--data-json <dataJson>", createHelp).action(async (opts, cmd) => {
|
|
1552
|
-
const
|
|
1553
|
-
const organizationId = resolveOrganizationId(
|
|
1770
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1771
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1554
1772
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1555
1773
|
__testables.assertRequiredCreateFields(body, "rock", ["rock_collection_id"]);
|
|
1556
1774
|
await runGraphqlMutationCommand({
|
|
1557
1775
|
command: "rocks.create",
|
|
1558
|
-
runtimeOptions:
|
|
1776
|
+
runtimeOptions: context.runtimeOptions,
|
|
1559
1777
|
field: "create_rock",
|
|
1560
1778
|
variables: {
|
|
1561
1779
|
organization_id: organizationId,
|
|
1562
|
-
params: body
|
|
1780
|
+
params: body
|
|
1563
1781
|
}
|
|
1564
1782
|
});
|
|
1565
1783
|
});
|
|
1566
1784
|
rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp).action(async (opts, cmd) => {
|
|
1567
1785
|
const id = idSchema4.parse(opts.id);
|
|
1568
|
-
const
|
|
1569
|
-
const organizationId = resolveOrganizationId(
|
|
1786
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1787
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1570
1788
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1571
1789
|
await runGraphqlMutationCommand({
|
|
1572
1790
|
command: "rocks.update",
|
|
1573
|
-
runtimeOptions:
|
|
1791
|
+
runtimeOptions: context.runtimeOptions,
|
|
1574
1792
|
field: "update_rock",
|
|
1575
1793
|
variables: {
|
|
1576
1794
|
organization_id: organizationId,
|
|
1577
1795
|
rock_id: id,
|
|
1578
|
-
params: body
|
|
1796
|
+
params: body
|
|
1579
1797
|
}
|
|
1580
1798
|
});
|
|
1581
1799
|
});
|
|
@@ -1590,14 +1808,14 @@ var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for mee
|
|
|
1590
1808
|
function registerMeetingCommands(program) {
|
|
1591
1809
|
const meetings = program.command("meetings").description("Meeting operations");
|
|
1592
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) => {
|
|
1593
|
-
const
|
|
1594
|
-
const organizationId = resolveOrganizationId(
|
|
1811
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1812
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1595
1813
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1596
1814
|
await runGraphqlQueryCommand({
|
|
1597
1815
|
command: "meetings.list",
|
|
1598
|
-
runtimeOptions:
|
|
1816
|
+
runtimeOptions: context.runtimeOptions,
|
|
1599
1817
|
field: "meetings",
|
|
1600
|
-
variables:
|
|
1818
|
+
variables: normalizeGraphqlVariables2({
|
|
1601
1819
|
organization_id: organizationId,
|
|
1602
1820
|
per: opts.per,
|
|
1603
1821
|
date: opts.date,
|
|
@@ -1613,11 +1831,11 @@ function registerMeetingCommands(program) {
|
|
|
1613
1831
|
});
|
|
1614
1832
|
meetings.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1615
1833
|
const id = idSchema5.parse(opts.id);
|
|
1616
|
-
const
|
|
1617
|
-
const organizationId = resolveOrganizationId(
|
|
1834
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1835
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1618
1836
|
await runGraphqlQueryCommand({
|
|
1619
1837
|
command: "meetings.show",
|
|
1620
|
-
runtimeOptions:
|
|
1838
|
+
runtimeOptions: context.runtimeOptions,
|
|
1621
1839
|
field: "meeting",
|
|
1622
1840
|
variables: {
|
|
1623
1841
|
organization_id: organizationId,
|
|
@@ -1629,48 +1847,50 @@ function registerMeetingCommands(program) {
|
|
|
1629
1847
|
meetings.command("notes").requiredOption("--id <id>").requiredOption("--content <content>").action(async (opts, cmd) => {
|
|
1630
1848
|
const id = idSchema5.parse(opts.id);
|
|
1631
1849
|
const notes = notesSchema.parse(opts.content);
|
|
1632
|
-
const
|
|
1633
|
-
const organizationId = resolveOrganizationId(
|
|
1850
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1851
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1634
1852
|
await runGraphqlMutationCommand({
|
|
1635
1853
|
command: "meeting-notes.create",
|
|
1636
|
-
runtimeOptions:
|
|
1854
|
+
runtimeOptions: context.runtimeOptions,
|
|
1637
1855
|
field: "update_meeting",
|
|
1638
1856
|
variables: {
|
|
1639
1857
|
organization_id: organizationId,
|
|
1640
1858
|
meeting_id: id,
|
|
1641
1859
|
params: {
|
|
1642
|
-
|
|
1860
|
+
meeting: {
|
|
1861
|
+
notes
|
|
1862
|
+
}
|
|
1643
1863
|
}
|
|
1644
1864
|
}
|
|
1645
1865
|
});
|
|
1646
1866
|
});
|
|
1647
1867
|
meetings.command("create").requiredOption("--data-json <dataJson>", createHelp2).action(async (opts, cmd) => {
|
|
1648
|
-
const
|
|
1649
|
-
const organizationId = resolveOrganizationId(
|
|
1868
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1869
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1650
1870
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1651
1871
|
await runGraphqlMutationCommand({
|
|
1652
1872
|
command: "meetings.create",
|
|
1653
|
-
runtimeOptions:
|
|
1873
|
+
runtimeOptions: context.runtimeOptions,
|
|
1654
1874
|
field: "create_meeting",
|
|
1655
1875
|
variables: {
|
|
1656
1876
|
organization_id: organizationId,
|
|
1657
|
-
params: body
|
|
1877
|
+
params: body
|
|
1658
1878
|
}
|
|
1659
1879
|
});
|
|
1660
1880
|
});
|
|
1661
1881
|
meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp2).action(async (opts, cmd) => {
|
|
1662
1882
|
const id = idSchema5.parse(opts.id);
|
|
1663
|
-
const
|
|
1664
|
-
const organizationId = resolveOrganizationId(
|
|
1883
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1884
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1665
1885
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1666
1886
|
await runGraphqlMutationCommand({
|
|
1667
1887
|
command: "meetings.update",
|
|
1668
|
-
runtimeOptions:
|
|
1888
|
+
runtimeOptions: context.runtimeOptions,
|
|
1669
1889
|
field: "update_meeting",
|
|
1670
1890
|
variables: {
|
|
1671
1891
|
organization_id: organizationId,
|
|
1672
1892
|
meeting_id: id,
|
|
1673
|
-
params: body
|
|
1893
|
+
params: body
|
|
1674
1894
|
}
|
|
1675
1895
|
});
|
|
1676
1896
|
});
|
|
@@ -1684,14 +1904,14 @@ var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for memb
|
|
|
1684
1904
|
function registerMemberCommands(program) {
|
|
1685
1905
|
const members = program.command("members").description("Member operations");
|
|
1686
1906
|
members.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1687
|
-
const
|
|
1688
|
-
const organizationId = resolveOrganizationId(
|
|
1907
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1908
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1689
1909
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1690
1910
|
await runGraphqlQueryCommand({
|
|
1691
1911
|
command: "members.list",
|
|
1692
|
-
runtimeOptions:
|
|
1912
|
+
runtimeOptions: context.runtimeOptions,
|
|
1693
1913
|
field: "members",
|
|
1694
|
-
variables:
|
|
1914
|
+
variables: normalizeGraphqlVariables2({
|
|
1695
1915
|
organization_id: organizationId,
|
|
1696
1916
|
page: opts.page,
|
|
1697
1917
|
per: opts.per,
|
|
@@ -1702,11 +1922,11 @@ function registerMemberCommands(program) {
|
|
|
1702
1922
|
});
|
|
1703
1923
|
members.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1704
1924
|
const id = idSchema6.parse(opts.id);
|
|
1705
|
-
const
|
|
1706
|
-
const organizationId = resolveOrganizationId(
|
|
1925
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1926
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1707
1927
|
await runGraphqlQueryCommand({
|
|
1708
1928
|
command: "members.show",
|
|
1709
|
-
runtimeOptions:
|
|
1929
|
+
runtimeOptions: context.runtimeOptions,
|
|
1710
1930
|
field: "member",
|
|
1711
1931
|
variables: {
|
|
1712
1932
|
organization_id: organizationId,
|
|
@@ -1716,32 +1936,32 @@ function registerMemberCommands(program) {
|
|
|
1716
1936
|
});
|
|
1717
1937
|
});
|
|
1718
1938
|
members.command("create").requiredOption("--data-json <dataJson>", createHelp3).action(async (opts, cmd) => {
|
|
1719
|
-
const
|
|
1720
|
-
const organizationId = resolveOrganizationId(
|
|
1939
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1940
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1721
1941
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1722
1942
|
await runGraphqlMutationCommand({
|
|
1723
1943
|
command: "members.create",
|
|
1724
|
-
runtimeOptions:
|
|
1944
|
+
runtimeOptions: context.runtimeOptions,
|
|
1725
1945
|
field: "create_member",
|
|
1726
1946
|
variables: {
|
|
1727
1947
|
organization_id: organizationId,
|
|
1728
|
-
params: body
|
|
1948
|
+
params: body
|
|
1729
1949
|
}
|
|
1730
1950
|
});
|
|
1731
1951
|
});
|
|
1732
1952
|
members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp3).action(async (opts, cmd) => {
|
|
1733
1953
|
const id = idSchema6.parse(opts.id);
|
|
1734
|
-
const
|
|
1735
|
-
const organizationId = resolveOrganizationId(
|
|
1954
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1955
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1736
1956
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1737
1957
|
await runGraphqlMutationCommand({
|
|
1738
1958
|
command: "members.update",
|
|
1739
|
-
runtimeOptions:
|
|
1959
|
+
runtimeOptions: context.runtimeOptions,
|
|
1740
1960
|
field: "update_member",
|
|
1741
1961
|
variables: {
|
|
1742
1962
|
organization_id: organizationId,
|
|
1743
1963
|
member_id: id,
|
|
1744
|
-
params: body
|
|
1964
|
+
params: body
|
|
1745
1965
|
}
|
|
1746
1966
|
});
|
|
1747
1967
|
});
|
|
@@ -1757,14 +1977,14 @@ var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue
|
|
|
1757
1977
|
function registerIssueCommands(program) {
|
|
1758
1978
|
const issues = program.command("issues").description("Issue operations");
|
|
1759
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) => {
|
|
1760
|
-
const
|
|
1761
|
-
const organizationId = resolveOrganizationId(
|
|
1980
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1981
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1762
1982
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1763
1983
|
await runGraphqlQueryCommand({
|
|
1764
1984
|
command: "issues.list",
|
|
1765
|
-
runtimeOptions:
|
|
1985
|
+
runtimeOptions: context.runtimeOptions,
|
|
1766
1986
|
field: "issues",
|
|
1767
|
-
variables:
|
|
1987
|
+
variables: normalizeGraphqlVariables2({
|
|
1768
1988
|
organization_id: organizationId,
|
|
1769
1989
|
page: opts.page,
|
|
1770
1990
|
per: opts.per,
|
|
@@ -1782,11 +2002,11 @@ function registerIssueCommands(program) {
|
|
|
1782
2002
|
});
|
|
1783
2003
|
issues.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1784
2004
|
const id = idSchema7.parse(opts.id);
|
|
1785
|
-
const
|
|
1786
|
-
const organizationId = resolveOrganizationId(
|
|
2005
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2006
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1787
2007
|
await runGraphqlQueryCommand({
|
|
1788
2008
|
command: "issues.show",
|
|
1789
|
-
runtimeOptions:
|
|
2009
|
+
runtimeOptions: context.runtimeOptions,
|
|
1790
2010
|
field: "issue",
|
|
1791
2011
|
variables: {
|
|
1792
2012
|
organization_id: organizationId,
|
|
@@ -1799,40 +2019,42 @@ function registerIssueCommands(program) {
|
|
|
1799
2019
|
const issueGroupId = issueGroupIdSchema.parse(opts.issueGroupId);
|
|
1800
2020
|
const name = nameSchema.parse(opts.name);
|
|
1801
2021
|
const issueType = issueTypeSchema.parse(opts.issueType);
|
|
1802
|
-
const
|
|
1803
|
-
const organizationId = resolveOrganizationId(
|
|
2022
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2023
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1804
2024
|
await runGraphqlMutationCommand({
|
|
1805
2025
|
command: "issues.create",
|
|
1806
|
-
runtimeOptions:
|
|
2026
|
+
runtimeOptions: context.runtimeOptions,
|
|
1807
2027
|
field: "create_issue",
|
|
1808
2028
|
variables: {
|
|
1809
2029
|
organization_id: organizationId,
|
|
1810
2030
|
params: {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
2031
|
+
issue: {
|
|
2032
|
+
issue_group_id: issueGroupId,
|
|
2033
|
+
name,
|
|
2034
|
+
issue_type: issueType,
|
|
2035
|
+
...opts.status ? { status: String(opts.status) } : {},
|
|
2036
|
+
...opts.priority ? { priority: String(opts.priority) } : {},
|
|
2037
|
+
...opts.description ? { description: String(opts.description) } : {},
|
|
2038
|
+
...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
|
|
2039
|
+
...opts.memberId ? { member_id: String(opts.memberId) } : {}
|
|
2040
|
+
}
|
|
1819
2041
|
}
|
|
1820
2042
|
}
|
|
1821
2043
|
});
|
|
1822
2044
|
});
|
|
1823
2045
|
issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp4).action(async (opts, cmd) => {
|
|
1824
2046
|
const id = idSchema7.parse(opts.id);
|
|
1825
|
-
const
|
|
1826
|
-
const organizationId = resolveOrganizationId(
|
|
2047
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2048
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1827
2049
|
const body = __testables.normalizeBody(String(opts.dataJson), "issue");
|
|
1828
2050
|
await runGraphqlMutationCommand({
|
|
1829
2051
|
command: "issues.update",
|
|
1830
|
-
runtimeOptions:
|
|
2052
|
+
runtimeOptions: context.runtimeOptions,
|
|
1831
2053
|
field: "update_issue",
|
|
1832
2054
|
variables: {
|
|
1833
2055
|
organization_id: organizationId,
|
|
1834
2056
|
issue_id: id,
|
|
1835
|
-
params: body
|
|
2057
|
+
params: body
|
|
1836
2058
|
}
|
|
1837
2059
|
});
|
|
1838
2060
|
});
|
|
@@ -2040,14 +2262,14 @@ var idSchema8 = z9.string().min(1);
|
|
|
2040
2262
|
function registerTeamCommands(program) {
|
|
2041
2263
|
const teams = program.command("teams").description("Team operations");
|
|
2042
2264
|
teams.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
2043
|
-
const
|
|
2044
|
-
const organizationId = resolveOrganizationId(
|
|
2265
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2266
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2045
2267
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
2046
2268
|
await runGraphqlQueryCommand({
|
|
2047
2269
|
command: "teams.list",
|
|
2048
|
-
runtimeOptions:
|
|
2270
|
+
runtimeOptions: context.runtimeOptions,
|
|
2049
2271
|
field: "teams",
|
|
2050
|
-
variables:
|
|
2272
|
+
variables: normalizeGraphqlVariables2({
|
|
2051
2273
|
organization_id: organizationId,
|
|
2052
2274
|
page: opts.page,
|
|
2053
2275
|
per: opts.per,
|
|
@@ -2058,11 +2280,11 @@ function registerTeamCommands(program) {
|
|
|
2058
2280
|
});
|
|
2059
2281
|
teams.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2060
2282
|
const id = idSchema8.parse(opts.id);
|
|
2061
|
-
const
|
|
2062
|
-
const organizationId = resolveOrganizationId(
|
|
2283
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2284
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2063
2285
|
await runGraphqlQueryCommand({
|
|
2064
2286
|
command: "teams.show",
|
|
2065
|
-
runtimeOptions:
|
|
2287
|
+
runtimeOptions: context.runtimeOptions,
|
|
2066
2288
|
field: "team",
|
|
2067
2289
|
variables: {
|
|
2068
2290
|
organization_id: organizationId,
|
|
@@ -2072,32 +2294,32 @@ function registerTeamCommands(program) {
|
|
|
2072
2294
|
});
|
|
2073
2295
|
});
|
|
2074
2296
|
teams.command("create").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2075
|
-
const
|
|
2076
|
-
const organizationId = resolveOrganizationId(
|
|
2297
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2298
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2077
2299
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2078
2300
|
await runGraphqlMutationCommand({
|
|
2079
2301
|
command: "teams.create",
|
|
2080
|
-
runtimeOptions:
|
|
2302
|
+
runtimeOptions: context.runtimeOptions,
|
|
2081
2303
|
field: "create_team",
|
|
2082
2304
|
variables: {
|
|
2083
2305
|
organization_id: organizationId,
|
|
2084
|
-
params: body
|
|
2306
|
+
params: body
|
|
2085
2307
|
}
|
|
2086
2308
|
});
|
|
2087
2309
|
});
|
|
2088
2310
|
teams.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2089
2311
|
const id = idSchema8.parse(opts.id);
|
|
2090
|
-
const
|
|
2091
|
-
const organizationId = resolveOrganizationId(
|
|
2312
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2313
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2092
2314
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2093
2315
|
await runGraphqlMutationCommand({
|
|
2094
2316
|
command: "teams.update",
|
|
2095
|
-
runtimeOptions:
|
|
2317
|
+
runtimeOptions: context.runtimeOptions,
|
|
2096
2318
|
field: "update_team",
|
|
2097
2319
|
variables: {
|
|
2098
2320
|
organization_id: organizationId,
|
|
2099
2321
|
team_id: id,
|
|
2100
|
-
params: body
|
|
2322
|
+
params: body
|
|
2101
2323
|
}
|
|
2102
2324
|
});
|
|
2103
2325
|
});
|
|
@@ -2109,12 +2331,12 @@ var idSchema9 = z10.string().min(1);
|
|
|
2109
2331
|
function registerOrganizationCommands(program) {
|
|
2110
2332
|
const organizations = program.command("organizations").description("Organization operations");
|
|
2111
2333
|
organizations.command("show").option("--id <id>", "Organization ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2112
|
-
const
|
|
2113
|
-
const fallbackId = resolveOrganizationId(
|
|
2334
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2335
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2114
2336
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2115
2337
|
await runGraphqlQueryCommand({
|
|
2116
2338
|
command: "organizations.show",
|
|
2117
|
-
runtimeOptions:
|
|
2339
|
+
runtimeOptions: context.runtimeOptions,
|
|
2118
2340
|
field: "organization",
|
|
2119
2341
|
variables: { id },
|
|
2120
2342
|
isShow: true
|
|
@@ -2124,28 +2346,28 @@ function registerOrganizationCommands(program) {
|
|
|
2124
2346
|
"--data-json <dataJson>",
|
|
2125
2347
|
'JSON object for organization or {"organization": {...}}'
|
|
2126
2348
|
).action(async (opts, cmd) => {
|
|
2127
|
-
const
|
|
2128
|
-
const fallbackId = resolveOrganizationId(
|
|
2349
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2350
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2129
2351
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2130
2352
|
const body = __testables.normalizeBody(String(opts.dataJson), "organization");
|
|
2131
2353
|
await runGraphqlMutationCommand({
|
|
2132
2354
|
command: "organizations.update",
|
|
2133
|
-
runtimeOptions:
|
|
2355
|
+
runtimeOptions: context.runtimeOptions,
|
|
2134
2356
|
field: "update_organization",
|
|
2135
2357
|
variables: {
|
|
2136
2358
|
id,
|
|
2137
|
-
params: body
|
|
2359
|
+
params: body
|
|
2138
2360
|
}
|
|
2139
2361
|
});
|
|
2140
2362
|
});
|
|
2141
2363
|
const metaProfile = organizations.command("meta-profile").description("Organization meta profile operations");
|
|
2142
2364
|
metaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2143
|
-
const
|
|
2144
|
-
const organizationId = resolveOrganizationId(
|
|
2365
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2366
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2145
2367
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2146
2368
|
await runGraphqlQueryCommand({
|
|
2147
2369
|
command: "organizations.meta-profile.show",
|
|
2148
|
-
runtimeOptions:
|
|
2370
|
+
runtimeOptions: context.runtimeOptions,
|
|
2149
2371
|
field: "organization_meta_profile",
|
|
2150
2372
|
variables: {
|
|
2151
2373
|
organization_id: organizationId,
|
|
@@ -2158,8 +2380,8 @@ function registerOrganizationCommands(program) {
|
|
|
2158
2380
|
"--data-json <dataJson>",
|
|
2159
2381
|
'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
|
|
2160
2382
|
).action(async (opts, cmd) => {
|
|
2161
|
-
const
|
|
2162
|
-
const organizationId = resolveOrganizationId(
|
|
2383
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2384
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2163
2385
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2164
2386
|
const body = __testables.normalizeBody(
|
|
2165
2387
|
String(opts.dataJson),
|
|
@@ -2167,23 +2389,23 @@ function registerOrganizationCommands(program) {
|
|
|
2167
2389
|
);
|
|
2168
2390
|
await runGraphqlMutationCommand({
|
|
2169
2391
|
command: "organizations.meta-profile.update",
|
|
2170
|
-
runtimeOptions:
|
|
2392
|
+
runtimeOptions: context.runtimeOptions,
|
|
2171
2393
|
field: "update_organization_meta_profile",
|
|
2172
2394
|
variables: {
|
|
2173
2395
|
organization_id: organizationId,
|
|
2174
2396
|
organization_meta_profile_id: id,
|
|
2175
|
-
params: body
|
|
2397
|
+
params: body
|
|
2176
2398
|
}
|
|
2177
2399
|
});
|
|
2178
2400
|
});
|
|
2179
2401
|
const keyMetricMetaProfile = organizations.command("key-metric-meta-profile").description("Key metric meta profile operations");
|
|
2180
2402
|
keyMetricMetaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2181
|
-
const
|
|
2182
|
-
const organizationId = resolveOrganizationId(
|
|
2403
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2404
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2183
2405
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2184
2406
|
await runGraphqlQueryCommand({
|
|
2185
2407
|
command: "organizations.key-metric-meta-profile.show",
|
|
2186
|
-
runtimeOptions:
|
|
2408
|
+
runtimeOptions: context.runtimeOptions,
|
|
2187
2409
|
field: "key_metric_meta_profile",
|
|
2188
2410
|
variables: {
|
|
2189
2411
|
organization_id: organizationId,
|
|
@@ -2196,8 +2418,8 @@ function registerOrganizationCommands(program) {
|
|
|
2196
2418
|
"--data-json <dataJson>",
|
|
2197
2419
|
'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
|
|
2198
2420
|
).action(async (opts, cmd) => {
|
|
2199
|
-
const
|
|
2200
|
-
const organizationId = resolveOrganizationId(
|
|
2421
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2422
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2201
2423
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2202
2424
|
const body = __testables.normalizeBody(
|
|
2203
2425
|
String(opts.dataJson),
|
|
@@ -2205,12 +2427,12 @@ function registerOrganizationCommands(program) {
|
|
|
2205
2427
|
);
|
|
2206
2428
|
await runGraphqlMutationCommand({
|
|
2207
2429
|
command: "organizations.key-metric-meta-profile.update",
|
|
2208
|
-
runtimeOptions:
|
|
2430
|
+
runtimeOptions: context.runtimeOptions,
|
|
2209
2431
|
field: "update_key_metric_meta_profile",
|
|
2210
2432
|
variables: {
|
|
2211
2433
|
organization_id: organizationId,
|
|
2212
2434
|
key_metric_meta_profile_id: id,
|
|
2213
|
-
params: body
|
|
2435
|
+
params: body
|
|
2214
2436
|
}
|
|
2215
2437
|
});
|
|
2216
2438
|
});
|
|
@@ -2224,14 +2446,14 @@ function registerFoundationCommands(program) {
|
|
|
2224
2446
|
const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
|
|
2225
2447
|
const strategicObjectives = foundation.command("strategic-objectives").description("Strategic objective operations");
|
|
2226
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) => {
|
|
2227
|
-
const
|
|
2228
|
-
const organizationId = resolveOrganizationId(
|
|
2449
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2450
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2229
2451
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2230
2452
|
await runGraphqlQueryCommand({
|
|
2231
2453
|
command: "foundation.strategic-plans.show",
|
|
2232
|
-
runtimeOptions:
|
|
2454
|
+
runtimeOptions: context.runtimeOptions,
|
|
2233
2455
|
field: "strategic_plan",
|
|
2234
|
-
variables:
|
|
2456
|
+
variables: normalizeGraphqlVariables2({
|
|
2235
2457
|
organization_id: organizationId,
|
|
2236
2458
|
id,
|
|
2237
2459
|
progress_scope: opts.progressScope,
|
|
@@ -2245,30 +2467,30 @@ function registerFoundationCommands(program) {
|
|
|
2245
2467
|
"--data-json <dataJson>",
|
|
2246
2468
|
'JSON object for strategic_plan or {"strategic_plan": {...}}'
|
|
2247
2469
|
).action(async (opts, cmd) => {
|
|
2248
|
-
const
|
|
2249
|
-
const organizationId = resolveOrganizationId(
|
|
2470
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2471
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2250
2472
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2251
2473
|
const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
|
|
2252
2474
|
await runGraphqlMutationCommand({
|
|
2253
2475
|
command: "foundation.strategic-plans.update",
|
|
2254
|
-
runtimeOptions:
|
|
2476
|
+
runtimeOptions: context.runtimeOptions,
|
|
2255
2477
|
field: "update_strategic_plan",
|
|
2256
2478
|
variables: {
|
|
2257
2479
|
organization_id: organizationId,
|
|
2258
2480
|
strategic_plan_id: id,
|
|
2259
|
-
params: body
|
|
2481
|
+
params: body
|
|
2260
2482
|
}
|
|
2261
2483
|
});
|
|
2262
2484
|
});
|
|
2263
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) => {
|
|
2264
|
-
const
|
|
2265
|
-
const organizationId = resolveOrganizationId(
|
|
2486
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2487
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2266
2488
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2267
2489
|
await runGraphqlQueryCommand({
|
|
2268
2490
|
command: "foundation.strategic-objectives.show",
|
|
2269
|
-
runtimeOptions:
|
|
2491
|
+
runtimeOptions: context.runtimeOptions,
|
|
2270
2492
|
field: "strategic_objective",
|
|
2271
|
-
variables:
|
|
2493
|
+
variables: normalizeGraphqlVariables2({
|
|
2272
2494
|
organization_id: organizationId,
|
|
2273
2495
|
id,
|
|
2274
2496
|
progress_scope: opts.progressScope,
|
|
@@ -2282,8 +2504,8 @@ function registerFoundationCommands(program) {
|
|
|
2282
2504
|
"--data-json <dataJson>",
|
|
2283
2505
|
'JSON object for strategic_objective or {"strategic_objective": {...}}'
|
|
2284
2506
|
).action(async (opts, cmd) => {
|
|
2285
|
-
const
|
|
2286
|
-
const organizationId = resolveOrganizationId(
|
|
2507
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2508
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2287
2509
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2288
2510
|
const body = __testables.normalizeBody(
|
|
2289
2511
|
String(opts.dataJson),
|
|
@@ -2291,12 +2513,12 @@ function registerFoundationCommands(program) {
|
|
|
2291
2513
|
);
|
|
2292
2514
|
await runGraphqlMutationCommand({
|
|
2293
2515
|
command: "foundation.strategic-objectives.update",
|
|
2294
|
-
runtimeOptions:
|
|
2516
|
+
runtimeOptions: context.runtimeOptions,
|
|
2295
2517
|
field: "update_strategic_objective",
|
|
2296
2518
|
variables: {
|
|
2297
2519
|
organization_id: organizationId,
|
|
2298
2520
|
strategic_objective_id: id,
|
|
2299
|
-
params: body
|
|
2521
|
+
params: body
|
|
2300
2522
|
}
|
|
2301
2523
|
});
|
|
2302
2524
|
});
|
|
@@ -2321,7 +2543,10 @@ function registerFoundationCommands(program) {
|
|
|
2321
2543
|
// src/cli.ts
|
|
2322
2544
|
function buildCli() {
|
|
2323
2545
|
const program = new Command();
|
|
2324
|
-
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(
|
|
2325
2550
|
"--base-url <baseUrl>",
|
|
2326
2551
|
"API base URL (prefer WAVE_API_BASE_URL env var)"
|
|
2327
2552
|
).option(
|