@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.cjs
CHANGED
|
@@ -102,10 +102,10 @@ function parseDebug(rawDebugOption, rawDebugEnv) {
|
|
|
102
102
|
return lowered === "1" || lowered === "true" || lowered === "yes";
|
|
103
103
|
}
|
|
104
104
|
function getConfig(options) {
|
|
105
|
-
const token =
|
|
105
|
+
const token = options.token ?? options.jwt ?? process.env.WAVE_API_TOKEN ?? process.env.WAVE_JWT;
|
|
106
106
|
if (!token) {
|
|
107
107
|
throw new CliError({
|
|
108
|
-
message: "Missing API token.
|
|
108
|
+
message: "Missing API token. Pass --token/--jwt, use --token-stdin/--auth-json-stdin, or set WAVE_API_TOKEN/WAVE_JWT.",
|
|
109
109
|
kind: "missing_auth",
|
|
110
110
|
status: 401,
|
|
111
111
|
exitCode: EXIT_CODES.missingOrInvalidAuth
|
|
@@ -114,7 +114,7 @@ function getConfig(options) {
|
|
|
114
114
|
const baseUrl = options.baseUrl ?? process.env.WAVE_API_BASE_URL ?? process.env.WAVE_API_URL;
|
|
115
115
|
if (!baseUrl) {
|
|
116
116
|
throw new CliError({
|
|
117
|
-
message: "Missing API base URL.
|
|
117
|
+
message: "Missing API base URL. Pass --base-url, provide via --auth-json-stdin, or set WAVE_API_BASE_URL/WAVE_API_URL.",
|
|
118
118
|
kind: "invalid_args",
|
|
119
119
|
status: 400,
|
|
120
120
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -181,6 +181,9 @@ function debugLog(config, message) {
|
|
|
181
181
|
function graphqlOperationName(command) {
|
|
182
182
|
return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
183
183
|
}
|
|
184
|
+
function toCamelCase(value) {
|
|
185
|
+
return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
186
|
+
}
|
|
184
187
|
function inferStatusFromGraphqlErrors(errors) {
|
|
185
188
|
if (!Array.isArray(errors) || errors.length === 0) {
|
|
186
189
|
return 400;
|
|
@@ -227,18 +230,39 @@ function graphqlTypeForValue(value) {
|
|
|
227
230
|
}
|
|
228
231
|
return "JSON";
|
|
229
232
|
}
|
|
233
|
+
function graphqlTypeForVariable(name, value) {
|
|
234
|
+
if (name === "id" || name.endsWith("Id")) {
|
|
235
|
+
return "ID";
|
|
236
|
+
}
|
|
237
|
+
if (name.endsWith("Ids")) {
|
|
238
|
+
return "[ID!]";
|
|
239
|
+
}
|
|
240
|
+
return graphqlTypeForValue(value);
|
|
241
|
+
}
|
|
242
|
+
function withNonNull(typeName) {
|
|
243
|
+
return typeName.endsWith("!") ? typeName : `${typeName}!`;
|
|
244
|
+
}
|
|
245
|
+
function normalizeGraphqlVariables(variables) {
|
|
246
|
+
const normalized = {};
|
|
247
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
248
|
+
normalized[toCamelCase(key)] = value;
|
|
249
|
+
});
|
|
250
|
+
return normalized;
|
|
251
|
+
}
|
|
230
252
|
function buildGraphqlBody(input) {
|
|
253
|
+
const graphqlField = toCamelCase(input.field);
|
|
254
|
+
const graphqlVariables = normalizeGraphqlVariables(input.variables);
|
|
231
255
|
const operationName = graphqlOperationName(input.command);
|
|
232
|
-
const variableEntries = Object.entries(
|
|
233
|
-
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${
|
|
256
|
+
const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
|
|
257
|
+
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
|
|
234
258
|
const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
|
|
235
259
|
const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
|
|
236
260
|
const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
|
|
237
|
-
const query = `${input.operationType} ${operationName}${signature} { ${
|
|
261
|
+
const query = `${input.operationType} ${operationName}${signature} { ${graphqlField}${args} ${input.selectionSet} }`;
|
|
238
262
|
return {
|
|
239
263
|
operationName,
|
|
240
264
|
query,
|
|
241
|
-
variables:
|
|
265
|
+
variables: graphqlVariables
|
|
242
266
|
};
|
|
243
267
|
}
|
|
244
268
|
async function graphqlRequest(input) {
|
|
@@ -289,7 +313,7 @@ async function graphqlRequest(input) {
|
|
|
289
313
|
exitCode: mapStatusToExitCode(status)
|
|
290
314
|
};
|
|
291
315
|
}
|
|
292
|
-
const fieldPayload = gqlData[input.field];
|
|
316
|
+
const fieldPayload = gqlData[toCamelCase(input.field)];
|
|
293
317
|
if (input.operationType === "mutation") {
|
|
294
318
|
const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
|
|
295
319
|
const ok = Boolean(mutationPayload.ok);
|
|
@@ -302,7 +326,9 @@ async function graphqlRequest(input) {
|
|
|
302
326
|
status,
|
|
303
327
|
data: null,
|
|
304
328
|
error: {
|
|
305
|
-
code: String(
|
|
329
|
+
code: String(
|
|
330
|
+
mutationPayload.errorCode ?? mutationPayload.error_code ?? `http_${status}`
|
|
331
|
+
),
|
|
306
332
|
message: "Mutation failed.",
|
|
307
333
|
details: {
|
|
308
334
|
errors: mutationPayload.errors ?? null,
|
|
@@ -405,10 +431,10 @@ function buildCliErrorEnvelope(params) {
|
|
|
405
431
|
}
|
|
406
432
|
function defaultQuerySelectionSet(field, isList) {
|
|
407
433
|
if (field === "organization") {
|
|
408
|
-
return "{ id slug
|
|
434
|
+
return "{ id slug membersCount organizationDetail { title name description timezone workspaceName } }";
|
|
409
435
|
}
|
|
410
436
|
if (isList) {
|
|
411
|
-
return "{ data { id type attributes } count
|
|
437
|
+
return "{ data { id type attributes } count currentPage totalPages }";
|
|
412
438
|
}
|
|
413
439
|
return "{ id type attributes }";
|
|
414
440
|
}
|
|
@@ -448,7 +474,7 @@ function normalizeGraphqlVariable(key, value) {
|
|
|
448
474
|
}
|
|
449
475
|
return parseBooleanMaybe(trimmed);
|
|
450
476
|
}
|
|
451
|
-
function
|
|
477
|
+
function normalizeGraphqlVariables2(raw) {
|
|
452
478
|
const normalized = {};
|
|
453
479
|
Object.entries(raw).forEach(([key, value]) => {
|
|
454
480
|
const next = normalizeGraphqlVariable(key, value);
|
|
@@ -505,7 +531,7 @@ async function runGraphqlMutationCommand(input) {
|
|
|
505
531
|
operationType: "mutation",
|
|
506
532
|
field: input.field,
|
|
507
533
|
variables: input.variables ?? {},
|
|
508
|
-
selectionSet: input.selectionSet ?? "{ ok status
|
|
534
|
+
selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
|
|
509
535
|
});
|
|
510
536
|
printEnvelopeAndExit(result);
|
|
511
537
|
} catch (error) {
|
|
@@ -535,24 +561,196 @@ async function runGraphqlMutationCommand(input) {
|
|
|
535
561
|
}
|
|
536
562
|
|
|
537
563
|
// src/commands/runtimeOptions.ts
|
|
538
|
-
|
|
564
|
+
var stdinPromise = null;
|
|
565
|
+
function normalize(raw) {
|
|
566
|
+
if (typeof raw !== "string") {
|
|
567
|
+
return void 0;
|
|
568
|
+
}
|
|
569
|
+
const trimmed = raw.trim();
|
|
570
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
571
|
+
}
|
|
572
|
+
function parseBool(raw) {
|
|
573
|
+
if (typeof raw === "boolean") {
|
|
574
|
+
return raw;
|
|
575
|
+
}
|
|
576
|
+
if (typeof raw !== "string") {
|
|
577
|
+
return void 0;
|
|
578
|
+
}
|
|
579
|
+
const lowered = raw.toLowerCase();
|
|
580
|
+
if (lowered === "1" || lowered === "true" || lowered === "yes") {
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
|
+
if (lowered === "0" || lowered === "false" || lowered === "no") {
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
return void 0;
|
|
587
|
+
}
|
|
588
|
+
function parseAuthJson(raw) {
|
|
589
|
+
try {
|
|
590
|
+
const parsed = JSON.parse(raw);
|
|
591
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
592
|
+
throw new Error("Expected JSON object.");
|
|
593
|
+
}
|
|
594
|
+
const obj = parsed;
|
|
595
|
+
return {
|
|
596
|
+
token: normalize(obj.token),
|
|
597
|
+
jwt: normalize(obj.jwt),
|
|
598
|
+
baseUrl: normalize(obj.baseUrl ?? obj.base_url),
|
|
599
|
+
organizationId: normalize(obj.organizationId ?? obj.organization_id),
|
|
600
|
+
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,
|
|
601
|
+
debug: parseBool(obj.debug),
|
|
602
|
+
agentName: normalize(obj.agentName ?? obj.agent_name),
|
|
603
|
+
agentRunId: normalize(obj.agentRunId ?? obj.agent_run_id),
|
|
604
|
+
requestId: normalize(obj.requestId ?? obj.request_id),
|
|
605
|
+
openapiPath: normalize(obj.openapiPath ?? obj.openapi_path),
|
|
606
|
+
openapiUrl: normalize(obj.openapiUrl ?? obj.openapi_url),
|
|
607
|
+
openapiVersion: normalize(obj.openapiVersion ?? obj.openapi_version)
|
|
608
|
+
};
|
|
609
|
+
} catch (error) {
|
|
610
|
+
throw new CliError({
|
|
611
|
+
message: error instanceof Error ? `Invalid --auth-json-stdin payload: ${error.message}` : "Invalid --auth-json-stdin payload.",
|
|
612
|
+
kind: "invalid_args",
|
|
613
|
+
status: 400,
|
|
614
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
async function readStdinRaw() {
|
|
619
|
+
if (!stdinPromise) {
|
|
620
|
+
stdinPromise = new Promise((resolve, reject) => {
|
|
621
|
+
if (process.stdin.isTTY) {
|
|
622
|
+
resolve("");
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
let data = "";
|
|
626
|
+
process.stdin.setEncoding("utf8");
|
|
627
|
+
process.stdin.on("data", (chunk) => {
|
|
628
|
+
data += chunk;
|
|
629
|
+
});
|
|
630
|
+
process.stdin.on("end", () => resolve(data));
|
|
631
|
+
process.stdin.on("error", reject);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
return stdinPromise;
|
|
635
|
+
}
|
|
636
|
+
function firstDefined(...values) {
|
|
637
|
+
return values.find((value) => value !== void 0);
|
|
638
|
+
}
|
|
639
|
+
function resolveFromSources(options, stdin, env) {
|
|
640
|
+
const token = firstDefined(
|
|
641
|
+
normalize(options.token),
|
|
642
|
+
normalize(options.jwt),
|
|
643
|
+
normalize(stdin.token),
|
|
644
|
+
normalize(stdin.jwt),
|
|
645
|
+
normalize(env.WAVE_API_TOKEN),
|
|
646
|
+
normalize(env.WAVE_JWT)
|
|
647
|
+
);
|
|
648
|
+
const baseUrl = firstDefined(
|
|
649
|
+
normalize(options.baseUrl),
|
|
650
|
+
normalize(stdin.baseUrl),
|
|
651
|
+
normalize(env.WAVE_API_BASE_URL),
|
|
652
|
+
normalize(env.WAVE_API_URL)
|
|
653
|
+
);
|
|
654
|
+
const organizationId = firstDefined(
|
|
655
|
+
normalize(options.organizationId),
|
|
656
|
+
normalize(stdin.organizationId),
|
|
657
|
+
normalize(env.WAVE_ORGANIZATION_ID),
|
|
658
|
+
normalize(env.WAVE_ORG_ID)
|
|
659
|
+
);
|
|
660
|
+
const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
|
|
661
|
+
const debug = firstDefined(
|
|
662
|
+
options.debug === true ? true : void 0,
|
|
663
|
+
stdin.debug,
|
|
664
|
+
parseBool(env.WAVE_DEBUG)
|
|
665
|
+
);
|
|
666
|
+
const agentName = firstDefined(
|
|
667
|
+
normalize(options.agentName),
|
|
668
|
+
normalize(stdin.agentName),
|
|
669
|
+
normalize(env.WAVE_AGENT_NAME)
|
|
670
|
+
);
|
|
671
|
+
const agentRunId = firstDefined(
|
|
672
|
+
normalize(options.agentRunId),
|
|
673
|
+
normalize(stdin.agentRunId),
|
|
674
|
+
normalize(env.WAVE_AGENT_RUN_ID)
|
|
675
|
+
);
|
|
676
|
+
const requestId = firstDefined(
|
|
677
|
+
normalize(options.requestId),
|
|
678
|
+
normalize(stdin.requestId),
|
|
679
|
+
normalize(env.WAVE_REQUEST_ID)
|
|
680
|
+
);
|
|
681
|
+
const openapiPath = firstDefined(
|
|
682
|
+
normalize(options.openapiPath),
|
|
683
|
+
normalize(stdin.openapiPath),
|
|
684
|
+
normalize(env.WAVE_OPENAPI_PATH)
|
|
685
|
+
);
|
|
686
|
+
const openapiUrl = firstDefined(
|
|
687
|
+
normalize(options.openapiUrl),
|
|
688
|
+
normalize(stdin.openapiUrl),
|
|
689
|
+
normalize(env.WAVE_OPENAPI_URL)
|
|
690
|
+
);
|
|
691
|
+
const openapiVersion = firstDefined(
|
|
692
|
+
normalize(options.openapiVersion),
|
|
693
|
+
normalize(stdin.openapiVersion),
|
|
694
|
+
normalize(env.WAVE_OPENAPI_VERSION)
|
|
695
|
+
);
|
|
539
696
|
return {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
697
|
+
organizationId,
|
|
698
|
+
runtimeOptions: {
|
|
699
|
+
token,
|
|
700
|
+
baseUrl,
|
|
701
|
+
timeoutMs,
|
|
702
|
+
debug,
|
|
703
|
+
agentName,
|
|
704
|
+
agentRunId,
|
|
705
|
+
requestId,
|
|
706
|
+
openapiPath,
|
|
707
|
+
openapiUrl,
|
|
708
|
+
openapiVersion
|
|
709
|
+
}
|
|
551
710
|
};
|
|
552
711
|
}
|
|
712
|
+
async function resolveStdinContext(options) {
|
|
713
|
+
if (options.tokenStdin && options.authJsonStdin) {
|
|
714
|
+
throw new CliError({
|
|
715
|
+
message: "Use only one stdin auth mode: --token-stdin or --auth-json-stdin.",
|
|
716
|
+
kind: "invalid_args",
|
|
717
|
+
status: 400,
|
|
718
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
if (!options.tokenStdin && !options.authJsonStdin) {
|
|
722
|
+
return {};
|
|
723
|
+
}
|
|
724
|
+
const raw = (await readStdinRaw()).trim();
|
|
725
|
+
if (!raw) {
|
|
726
|
+
throw new CliError({
|
|
727
|
+
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.",
|
|
728
|
+
kind: "invalid_args",
|
|
729
|
+
status: 400,
|
|
730
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
if (options.tokenStdin) {
|
|
734
|
+
const token = normalize(raw);
|
|
735
|
+
if (!token) {
|
|
736
|
+
throw new CliError({
|
|
737
|
+
message: "Invalid stdin token. Token value is empty.",
|
|
738
|
+
kind: "invalid_args",
|
|
739
|
+
status: 400,
|
|
740
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
return { token };
|
|
744
|
+
}
|
|
745
|
+
return parseAuthJson(raw);
|
|
746
|
+
}
|
|
747
|
+
async function resolveCommandContext(options) {
|
|
748
|
+
const stdin = await resolveStdinContext(options);
|
|
749
|
+
return resolveFromSources(options, stdin, process.env);
|
|
750
|
+
}
|
|
553
751
|
|
|
554
752
|
// src/commands/organization.ts
|
|
555
|
-
function
|
|
753
|
+
function normalize2(input) {
|
|
556
754
|
if (!input) {
|
|
557
755
|
return void 0;
|
|
558
756
|
}
|
|
@@ -560,10 +758,10 @@ function normalize(input) {
|
|
|
560
758
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
561
759
|
}
|
|
562
760
|
function resolveOrganizationId(raw) {
|
|
563
|
-
const organizationId =
|
|
761
|
+
const organizationId = normalize2(raw);
|
|
564
762
|
if (!organizationId) {
|
|
565
763
|
throw new CliError({
|
|
566
|
-
message: "Missing organization ID.
|
|
764
|
+
message: "Missing organization ID. Pass --organization-id, provide via --auth-json-stdin, or set WAVE_ORGANIZATION_ID.",
|
|
567
765
|
kind: "invalid_args",
|
|
568
766
|
status: 400,
|
|
569
767
|
exitCode: EXIT_CODES.invalidArgs
|
|
@@ -1155,6 +1353,21 @@ function buildDataJsonHelp(rootKey, mode) {
|
|
|
1155
1353
|
|
|
1156
1354
|
// src/commands/entityCrud.ts
|
|
1157
1355
|
var idSchema = import_zod2.z.string().min(1);
|
|
1356
|
+
function toSingularResourceName(resourcePath) {
|
|
1357
|
+
if (resourcePath === "organization_meta_profiles") {
|
|
1358
|
+
return "organization_meta_profile";
|
|
1359
|
+
}
|
|
1360
|
+
if (resourcePath === "key_metric_meta_profiles") {
|
|
1361
|
+
return "key_metric_meta_profile";
|
|
1362
|
+
}
|
|
1363
|
+
if (resourcePath.endsWith("ies")) {
|
|
1364
|
+
return resourcePath.slice(0, -3) + "y";
|
|
1365
|
+
}
|
|
1366
|
+
if (resourcePath.endsWith("s")) {
|
|
1367
|
+
return resourcePath.slice(0, -1);
|
|
1368
|
+
}
|
|
1369
|
+
return resourcePath;
|
|
1370
|
+
}
|
|
1158
1371
|
function parseJsonObject(raw) {
|
|
1159
1372
|
try {
|
|
1160
1373
|
const parsed = JSON.parse(raw);
|
|
@@ -1224,8 +1437,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1224
1437
|
list.option(`--${cliParam} <${cliParam}>`);
|
|
1225
1438
|
});
|
|
1226
1439
|
list.option("--query-json <queryJson>", "Additional query params as JSON object").action(async (opts, cmd) => {
|
|
1227
|
-
const
|
|
1228
|
-
const organizationId = resolveOrganizationId(
|
|
1440
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1441
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1229
1442
|
const extraQuery = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1230
1443
|
const mappedKnownParams = Object.fromEntries(
|
|
1231
1444
|
listParams.map((param) => {
|
|
@@ -1233,7 +1446,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1233
1446
|
return [param, opts[optionKey]];
|
|
1234
1447
|
})
|
|
1235
1448
|
);
|
|
1236
|
-
const variables =
|
|
1449
|
+
const variables = normalizeGraphqlVariables2({
|
|
1237
1450
|
organization_id: organizationId,
|
|
1238
1451
|
page: opts.page,
|
|
1239
1452
|
per: opts.per,
|
|
@@ -1242,7 +1455,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1242
1455
|
});
|
|
1243
1456
|
await runGraphqlQueryCommand({
|
|
1244
1457
|
command: `${config.command}.list`,
|
|
1245
|
-
runtimeOptions:
|
|
1458
|
+
runtimeOptions: context.runtimeOptions,
|
|
1246
1459
|
field: config.resourcePath === "feedback" ? "feedbacks" : config.resourcePath,
|
|
1247
1460
|
variables,
|
|
1248
1461
|
isList: true
|
|
@@ -1250,13 +1463,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1250
1463
|
});
|
|
1251
1464
|
entityCommand.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1252
1465
|
const id = idSchema.parse(opts.id);
|
|
1253
|
-
const
|
|
1254
|
-
const organizationId = resolveOrganizationId(
|
|
1466
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1467
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1255
1468
|
await runGraphqlQueryCommand({
|
|
1256
1469
|
command: `${config.command}.show`,
|
|
1257
|
-
runtimeOptions:
|
|
1258
|
-
field: config.resourcePath === "
|
|
1259
|
-
variables:
|
|
1470
|
+
runtimeOptions: context.runtimeOptions,
|
|
1471
|
+
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1472
|
+
variables: normalizeGraphqlVariables2({
|
|
1260
1473
|
organization_id: organizationId,
|
|
1261
1474
|
id
|
|
1262
1475
|
}),
|
|
@@ -1264,39 +1477,40 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1264
1477
|
});
|
|
1265
1478
|
});
|
|
1266
1479
|
entityCommand.command("create").requiredOption("--data-json <dataJson>", createHelp4).action(async (opts, cmd) => {
|
|
1267
|
-
const
|
|
1268
|
-
const organizationId = resolveOrganizationId(
|
|
1480
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1481
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1269
1482
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1270
1483
|
assertRequiredCreateFields(body, config.rootKey, config.requiredCreateFields);
|
|
1271
1484
|
await runGraphqlMutationCommand({
|
|
1272
1485
|
command: `${config.command}.create`,
|
|
1273
|
-
runtimeOptions:
|
|
1274
|
-
field:
|
|
1486
|
+
runtimeOptions: context.runtimeOptions,
|
|
1487
|
+
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1275
1488
|
variables: {
|
|
1276
1489
|
organization_id: organizationId,
|
|
1277
|
-
params: body
|
|
1490
|
+
params: body
|
|
1278
1491
|
}
|
|
1279
1492
|
});
|
|
1280
1493
|
});
|
|
1281
1494
|
entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp5).action(async (opts, cmd) => {
|
|
1282
1495
|
const id = idSchema.parse(opts.id);
|
|
1283
|
-
const
|
|
1284
|
-
const organizationId = resolveOrganizationId(
|
|
1496
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1497
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1285
1498
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1286
|
-
const singular =
|
|
1499
|
+
const singular = toSingularResourceName(config.resourcePath);
|
|
1287
1500
|
await runGraphqlMutationCommand({
|
|
1288
1501
|
command: `${config.command}.update`,
|
|
1289
|
-
runtimeOptions:
|
|
1502
|
+
runtimeOptions: context.runtimeOptions,
|
|
1290
1503
|
field: `update_${singular}`,
|
|
1291
1504
|
variables: {
|
|
1292
1505
|
organization_id: organizationId,
|
|
1293
1506
|
[`${singular}_id`]: id,
|
|
1294
|
-
params: body
|
|
1507
|
+
params: body
|
|
1295
1508
|
}
|
|
1296
1509
|
});
|
|
1297
1510
|
});
|
|
1298
1511
|
}
|
|
1299
1512
|
var __testables = {
|
|
1513
|
+
toSingularResourceName,
|
|
1300
1514
|
parseJsonObject,
|
|
1301
1515
|
normalizeBody,
|
|
1302
1516
|
assertRequiredCreateFields,
|
|
@@ -1310,15 +1524,15 @@ var summarySchema = import_zod3.z.string().min(1);
|
|
|
1310
1524
|
function registerTaskCommands(program) {
|
|
1311
1525
|
const tasks = program.command("tasks").description("Task operations");
|
|
1312
1526
|
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) => {
|
|
1313
|
-
const
|
|
1314
|
-
const organizationId = resolveOrganizationId(
|
|
1527
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1528
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1315
1529
|
const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
|
|
1316
1530
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1317
1531
|
await runGraphqlQueryCommand({
|
|
1318
1532
|
command: "tasks.list",
|
|
1319
|
-
runtimeOptions:
|
|
1533
|
+
runtimeOptions: context.runtimeOptions,
|
|
1320
1534
|
field: "tasks",
|
|
1321
|
-
variables:
|
|
1535
|
+
variables: normalizeGraphqlVariables2({
|
|
1322
1536
|
organization_id: organizationId,
|
|
1323
1537
|
page: opts.page,
|
|
1324
1538
|
per: opts.per,
|
|
@@ -1339,11 +1553,11 @@ function registerTaskCommands(program) {
|
|
|
1339
1553
|
});
|
|
1340
1554
|
tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1341
1555
|
const parsed = idSchema2.parse(opts.id);
|
|
1342
|
-
const
|
|
1343
|
-
const organizationId = resolveOrganizationId(
|
|
1556
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1557
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1344
1558
|
await runGraphqlQueryCommand({
|
|
1345
1559
|
command: "tasks.show",
|
|
1346
|
-
runtimeOptions:
|
|
1560
|
+
runtimeOptions: context.runtimeOptions,
|
|
1347
1561
|
field: "task",
|
|
1348
1562
|
variables: {
|
|
1349
1563
|
organization_id: organizationId,
|
|
@@ -1355,25 +1569,27 @@ function registerTaskCommands(program) {
|
|
|
1355
1569
|
tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
|
|
1356
1570
|
const projectId = projectIdSchema.parse(opts.projectId);
|
|
1357
1571
|
const summary = summarySchema.parse(opts.summary ?? opts.title);
|
|
1358
|
-
const
|
|
1359
|
-
const organizationId = resolveOrganizationId(
|
|
1572
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1573
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1360
1574
|
await runGraphqlMutationCommand({
|
|
1361
1575
|
command: "tasks.create",
|
|
1362
|
-
runtimeOptions:
|
|
1576
|
+
runtimeOptions: context.runtimeOptions,
|
|
1363
1577
|
field: "create_task",
|
|
1364
1578
|
variables: {
|
|
1365
1579
|
organization_id: organizationId,
|
|
1366
1580
|
params: {
|
|
1367
|
-
|
|
1368
|
-
|
|
1581
|
+
task: {
|
|
1582
|
+
project_id: projectId,
|
|
1583
|
+
summary
|
|
1584
|
+
}
|
|
1369
1585
|
}
|
|
1370
1586
|
}
|
|
1371
1587
|
});
|
|
1372
1588
|
});
|
|
1373
1589
|
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) => {
|
|
1374
1590
|
const id = idSchema2.parse(opts.id);
|
|
1375
|
-
const
|
|
1376
|
-
const organizationId = resolveOrganizationId(
|
|
1591
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1592
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1377
1593
|
const taskPayload = {
|
|
1378
1594
|
...opts.summary ? { summary: String(opts.summary) } : {},
|
|
1379
1595
|
...opts.description ? { description: String(opts.description) } : {},
|
|
@@ -1392,12 +1608,14 @@ function registerTaskCommands(program) {
|
|
|
1392
1608
|
}
|
|
1393
1609
|
await runGraphqlMutationCommand({
|
|
1394
1610
|
command: "tasks.update",
|
|
1395
|
-
runtimeOptions:
|
|
1611
|
+
runtimeOptions: context.runtimeOptions,
|
|
1396
1612
|
field: "update_task",
|
|
1397
1613
|
variables: {
|
|
1398
1614
|
organization_id: organizationId,
|
|
1399
1615
|
task_id: id,
|
|
1400
|
-
params:
|
|
1616
|
+
params: {
|
|
1617
|
+
task: taskPayload
|
|
1618
|
+
}
|
|
1401
1619
|
}
|
|
1402
1620
|
});
|
|
1403
1621
|
});
|
|
@@ -1411,14 +1629,14 @@ var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON
|
|
|
1411
1629
|
function registerProjectCommands(program) {
|
|
1412
1630
|
const projects = program.command("projects").description("Project operations");
|
|
1413
1631
|
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) => {
|
|
1414
|
-
const
|
|
1415
|
-
const organizationId = resolveOrganizationId(
|
|
1632
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1633
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1416
1634
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1417
1635
|
await runGraphqlQueryCommand({
|
|
1418
1636
|
command: "projects.list",
|
|
1419
|
-
runtimeOptions:
|
|
1637
|
+
runtimeOptions: context.runtimeOptions,
|
|
1420
1638
|
field: "projects",
|
|
1421
|
-
variables:
|
|
1639
|
+
variables: normalizeGraphqlVariables2({
|
|
1422
1640
|
organization_id: organizationId,
|
|
1423
1641
|
page: opts.page,
|
|
1424
1642
|
per: opts.per,
|
|
@@ -1434,11 +1652,11 @@ function registerProjectCommands(program) {
|
|
|
1434
1652
|
});
|
|
1435
1653
|
projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1436
1654
|
const id = idSchema3.parse(opts.id);
|
|
1437
|
-
const
|
|
1438
|
-
const organizationId = resolveOrganizationId(
|
|
1655
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1656
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1439
1657
|
await runGraphqlQueryCommand({
|
|
1440
1658
|
command: "projects.show",
|
|
1441
|
-
runtimeOptions:
|
|
1659
|
+
runtimeOptions: context.runtimeOptions,
|
|
1442
1660
|
field: "project",
|
|
1443
1661
|
variables: {
|
|
1444
1662
|
organization_id: organizationId,
|
|
@@ -1448,32 +1666,32 @@ function registerProjectCommands(program) {
|
|
|
1448
1666
|
});
|
|
1449
1667
|
});
|
|
1450
1668
|
projects.command("create").requiredOption("--data-json <dataJson>", projectCreateDataJsonHelp).action(async (opts, cmd) => {
|
|
1451
|
-
const
|
|
1452
|
-
const organizationId = resolveOrganizationId(
|
|
1669
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1670
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1453
1671
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1454
1672
|
await runGraphqlMutationCommand({
|
|
1455
1673
|
command: "projects.create",
|
|
1456
|
-
runtimeOptions:
|
|
1674
|
+
runtimeOptions: context.runtimeOptions,
|
|
1457
1675
|
field: "create_project",
|
|
1458
1676
|
variables: {
|
|
1459
1677
|
organization_id: organizationId,
|
|
1460
|
-
params: body
|
|
1678
|
+
params: body
|
|
1461
1679
|
}
|
|
1462
1680
|
});
|
|
1463
1681
|
});
|
|
1464
1682
|
projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", projectUpdateDataJsonHelp).action(async (opts, cmd) => {
|
|
1465
1683
|
const id = idSchema3.parse(opts.id);
|
|
1466
|
-
const
|
|
1467
|
-
const organizationId = resolveOrganizationId(
|
|
1684
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1685
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1468
1686
|
const body = __testables.normalizeBody(String(opts.dataJson), "project");
|
|
1469
1687
|
await runGraphqlMutationCommand({
|
|
1470
1688
|
command: "projects.update",
|
|
1471
|
-
runtimeOptions:
|
|
1689
|
+
runtimeOptions: context.runtimeOptions,
|
|
1472
1690
|
field: "update_project",
|
|
1473
1691
|
variables: {
|
|
1474
1692
|
organization_id: organizationId,
|
|
1475
1693
|
project_id: id,
|
|
1476
|
-
params: body
|
|
1694
|
+
params: body
|
|
1477
1695
|
}
|
|
1478
1696
|
});
|
|
1479
1697
|
});
|
|
@@ -1489,15 +1707,15 @@ var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or
|
|
|
1489
1707
|
function registerRockCommands(program) {
|
|
1490
1708
|
const rocks = program.command("rocks").description("Rock operations");
|
|
1491
1709
|
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) => {
|
|
1492
|
-
const
|
|
1493
|
-
const organizationId = resolveOrganizationId(
|
|
1710
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1711
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1494
1712
|
const rockCollectionId = opts.rockCollectionId ? rockCollectionIdSchema.parse(opts.rockCollectionId) : void 0;
|
|
1495
1713
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1496
1714
|
await runGraphqlQueryCommand({
|
|
1497
1715
|
command: "rocks.list",
|
|
1498
|
-
runtimeOptions:
|
|
1716
|
+
runtimeOptions: context.runtimeOptions,
|
|
1499
1717
|
field: "rocks",
|
|
1500
|
-
variables:
|
|
1718
|
+
variables: normalizeGraphqlVariables2({
|
|
1501
1719
|
organization_id: organizationId,
|
|
1502
1720
|
page: opts.page,
|
|
1503
1721
|
per: opts.per,
|
|
@@ -1520,11 +1738,11 @@ function registerRockCommands(program) {
|
|
|
1520
1738
|
});
|
|
1521
1739
|
rocks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1522
1740
|
const id = idSchema4.parse(opts.id);
|
|
1523
|
-
const
|
|
1524
|
-
const organizationId = resolveOrganizationId(
|
|
1741
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1742
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1525
1743
|
await runGraphqlQueryCommand({
|
|
1526
1744
|
command: "rocks.show",
|
|
1527
|
-
runtimeOptions:
|
|
1745
|
+
runtimeOptions: context.runtimeOptions,
|
|
1528
1746
|
field: "rock",
|
|
1529
1747
|
variables: {
|
|
1530
1748
|
organization_id: organizationId,
|
|
@@ -1536,47 +1754,47 @@ function registerRockCommands(program) {
|
|
|
1536
1754
|
rocks.command("update-status").requiredOption("--id <id>").requiredOption("--status <status>").action(async (opts, cmd) => {
|
|
1537
1755
|
const id = idSchema4.parse(opts.id);
|
|
1538
1756
|
const status = statusSchema.parse(opts.status);
|
|
1539
|
-
const
|
|
1540
|
-
const organizationId = resolveOrganizationId(
|
|
1757
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1758
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1541
1759
|
await runGraphqlMutationCommand({
|
|
1542
1760
|
command: "rocks.update-status",
|
|
1543
|
-
runtimeOptions:
|
|
1761
|
+
runtimeOptions: context.runtimeOptions,
|
|
1544
1762
|
field: "update_rock",
|
|
1545
1763
|
variables: {
|
|
1546
1764
|
organization_id: organizationId,
|
|
1547
1765
|
rock_id: id,
|
|
1548
|
-
params: { status }
|
|
1766
|
+
params: { rock: { status } }
|
|
1549
1767
|
}
|
|
1550
1768
|
});
|
|
1551
1769
|
});
|
|
1552
1770
|
rocks.command("create").requiredOption("--data-json <dataJson>", createHelp).action(async (opts, cmd) => {
|
|
1553
|
-
const
|
|
1554
|
-
const organizationId = resolveOrganizationId(
|
|
1771
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1772
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1555
1773
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1556
1774
|
__testables.assertRequiredCreateFields(body, "rock", ["rock_collection_id"]);
|
|
1557
1775
|
await runGraphqlMutationCommand({
|
|
1558
1776
|
command: "rocks.create",
|
|
1559
|
-
runtimeOptions:
|
|
1777
|
+
runtimeOptions: context.runtimeOptions,
|
|
1560
1778
|
field: "create_rock",
|
|
1561
1779
|
variables: {
|
|
1562
1780
|
organization_id: organizationId,
|
|
1563
|
-
params: body
|
|
1781
|
+
params: body
|
|
1564
1782
|
}
|
|
1565
1783
|
});
|
|
1566
1784
|
});
|
|
1567
1785
|
rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp).action(async (opts, cmd) => {
|
|
1568
1786
|
const id = idSchema4.parse(opts.id);
|
|
1569
|
-
const
|
|
1570
|
-
const organizationId = resolveOrganizationId(
|
|
1787
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1788
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1571
1789
|
const body = __testables.normalizeBody(String(opts.dataJson), "rock");
|
|
1572
1790
|
await runGraphqlMutationCommand({
|
|
1573
1791
|
command: "rocks.update",
|
|
1574
|
-
runtimeOptions:
|
|
1792
|
+
runtimeOptions: context.runtimeOptions,
|
|
1575
1793
|
field: "update_rock",
|
|
1576
1794
|
variables: {
|
|
1577
1795
|
organization_id: organizationId,
|
|
1578
1796
|
rock_id: id,
|
|
1579
|
-
params: body
|
|
1797
|
+
params: body
|
|
1580
1798
|
}
|
|
1581
1799
|
});
|
|
1582
1800
|
});
|
|
@@ -1591,14 +1809,14 @@ var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for mee
|
|
|
1591
1809
|
function registerMeetingCommands(program) {
|
|
1592
1810
|
const meetings = program.command("meetings").description("Meeting operations");
|
|
1593
1811
|
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) => {
|
|
1594
|
-
const
|
|
1595
|
-
const organizationId = resolveOrganizationId(
|
|
1812
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1813
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1596
1814
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1597
1815
|
await runGraphqlQueryCommand({
|
|
1598
1816
|
command: "meetings.list",
|
|
1599
|
-
runtimeOptions:
|
|
1817
|
+
runtimeOptions: context.runtimeOptions,
|
|
1600
1818
|
field: "meetings",
|
|
1601
|
-
variables:
|
|
1819
|
+
variables: normalizeGraphqlVariables2({
|
|
1602
1820
|
organization_id: organizationId,
|
|
1603
1821
|
per: opts.per,
|
|
1604
1822
|
date: opts.date,
|
|
@@ -1614,11 +1832,11 @@ function registerMeetingCommands(program) {
|
|
|
1614
1832
|
});
|
|
1615
1833
|
meetings.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1616
1834
|
const id = idSchema5.parse(opts.id);
|
|
1617
|
-
const
|
|
1618
|
-
const organizationId = resolveOrganizationId(
|
|
1835
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1836
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1619
1837
|
await runGraphqlQueryCommand({
|
|
1620
1838
|
command: "meetings.show",
|
|
1621
|
-
runtimeOptions:
|
|
1839
|
+
runtimeOptions: context.runtimeOptions,
|
|
1622
1840
|
field: "meeting",
|
|
1623
1841
|
variables: {
|
|
1624
1842
|
organization_id: organizationId,
|
|
@@ -1630,48 +1848,50 @@ function registerMeetingCommands(program) {
|
|
|
1630
1848
|
meetings.command("notes").requiredOption("--id <id>").requiredOption("--content <content>").action(async (opts, cmd) => {
|
|
1631
1849
|
const id = idSchema5.parse(opts.id);
|
|
1632
1850
|
const notes = notesSchema.parse(opts.content);
|
|
1633
|
-
const
|
|
1634
|
-
const organizationId = resolveOrganizationId(
|
|
1851
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1852
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1635
1853
|
await runGraphqlMutationCommand({
|
|
1636
1854
|
command: "meeting-notes.create",
|
|
1637
|
-
runtimeOptions:
|
|
1855
|
+
runtimeOptions: context.runtimeOptions,
|
|
1638
1856
|
field: "update_meeting",
|
|
1639
1857
|
variables: {
|
|
1640
1858
|
organization_id: organizationId,
|
|
1641
1859
|
meeting_id: id,
|
|
1642
1860
|
params: {
|
|
1643
|
-
|
|
1861
|
+
meeting: {
|
|
1862
|
+
notes
|
|
1863
|
+
}
|
|
1644
1864
|
}
|
|
1645
1865
|
}
|
|
1646
1866
|
});
|
|
1647
1867
|
});
|
|
1648
1868
|
meetings.command("create").requiredOption("--data-json <dataJson>", createHelp2).action(async (opts, cmd) => {
|
|
1649
|
-
const
|
|
1650
|
-
const organizationId = resolveOrganizationId(
|
|
1869
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1870
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1651
1871
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1652
1872
|
await runGraphqlMutationCommand({
|
|
1653
1873
|
command: "meetings.create",
|
|
1654
|
-
runtimeOptions:
|
|
1874
|
+
runtimeOptions: context.runtimeOptions,
|
|
1655
1875
|
field: "create_meeting",
|
|
1656
1876
|
variables: {
|
|
1657
1877
|
organization_id: organizationId,
|
|
1658
|
-
params: body
|
|
1878
|
+
params: body
|
|
1659
1879
|
}
|
|
1660
1880
|
});
|
|
1661
1881
|
});
|
|
1662
1882
|
meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp2).action(async (opts, cmd) => {
|
|
1663
1883
|
const id = idSchema5.parse(opts.id);
|
|
1664
|
-
const
|
|
1665
|
-
const organizationId = resolveOrganizationId(
|
|
1884
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1885
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1666
1886
|
const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
|
|
1667
1887
|
await runGraphqlMutationCommand({
|
|
1668
1888
|
command: "meetings.update",
|
|
1669
|
-
runtimeOptions:
|
|
1889
|
+
runtimeOptions: context.runtimeOptions,
|
|
1670
1890
|
field: "update_meeting",
|
|
1671
1891
|
variables: {
|
|
1672
1892
|
organization_id: organizationId,
|
|
1673
1893
|
meeting_id: id,
|
|
1674
|
-
params: body
|
|
1894
|
+
params: body
|
|
1675
1895
|
}
|
|
1676
1896
|
});
|
|
1677
1897
|
});
|
|
@@ -1685,14 +1905,14 @@ var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for memb
|
|
|
1685
1905
|
function registerMemberCommands(program) {
|
|
1686
1906
|
const members = program.command("members").description("Member operations");
|
|
1687
1907
|
members.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
1688
|
-
const
|
|
1689
|
-
const organizationId = resolveOrganizationId(
|
|
1908
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1909
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1690
1910
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1691
1911
|
await runGraphqlQueryCommand({
|
|
1692
1912
|
command: "members.list",
|
|
1693
|
-
runtimeOptions:
|
|
1913
|
+
runtimeOptions: context.runtimeOptions,
|
|
1694
1914
|
field: "members",
|
|
1695
|
-
variables:
|
|
1915
|
+
variables: normalizeGraphqlVariables2({
|
|
1696
1916
|
organization_id: organizationId,
|
|
1697
1917
|
page: opts.page,
|
|
1698
1918
|
per: opts.per,
|
|
@@ -1703,11 +1923,11 @@ function registerMemberCommands(program) {
|
|
|
1703
1923
|
});
|
|
1704
1924
|
members.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1705
1925
|
const id = idSchema6.parse(opts.id);
|
|
1706
|
-
const
|
|
1707
|
-
const organizationId = resolveOrganizationId(
|
|
1926
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1927
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1708
1928
|
await runGraphqlQueryCommand({
|
|
1709
1929
|
command: "members.show",
|
|
1710
|
-
runtimeOptions:
|
|
1930
|
+
runtimeOptions: context.runtimeOptions,
|
|
1711
1931
|
field: "member",
|
|
1712
1932
|
variables: {
|
|
1713
1933
|
organization_id: organizationId,
|
|
@@ -1717,32 +1937,32 @@ function registerMemberCommands(program) {
|
|
|
1717
1937
|
});
|
|
1718
1938
|
});
|
|
1719
1939
|
members.command("create").requiredOption("--data-json <dataJson>", createHelp3).action(async (opts, cmd) => {
|
|
1720
|
-
const
|
|
1721
|
-
const organizationId = resolveOrganizationId(
|
|
1940
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1941
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1722
1942
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1723
1943
|
await runGraphqlMutationCommand({
|
|
1724
1944
|
command: "members.create",
|
|
1725
|
-
runtimeOptions:
|
|
1945
|
+
runtimeOptions: context.runtimeOptions,
|
|
1726
1946
|
field: "create_member",
|
|
1727
1947
|
variables: {
|
|
1728
1948
|
organization_id: organizationId,
|
|
1729
|
-
params: body
|
|
1949
|
+
params: body
|
|
1730
1950
|
}
|
|
1731
1951
|
});
|
|
1732
1952
|
});
|
|
1733
1953
|
members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp3).action(async (opts, cmd) => {
|
|
1734
1954
|
const id = idSchema6.parse(opts.id);
|
|
1735
|
-
const
|
|
1736
|
-
const organizationId = resolveOrganizationId(
|
|
1955
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1956
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1737
1957
|
const body = __testables.normalizeBody(String(opts.dataJson), "member");
|
|
1738
1958
|
await runGraphqlMutationCommand({
|
|
1739
1959
|
command: "members.update",
|
|
1740
|
-
runtimeOptions:
|
|
1960
|
+
runtimeOptions: context.runtimeOptions,
|
|
1741
1961
|
field: "update_member",
|
|
1742
1962
|
variables: {
|
|
1743
1963
|
organization_id: organizationId,
|
|
1744
1964
|
member_id: id,
|
|
1745
|
-
params: body
|
|
1965
|
+
params: body
|
|
1746
1966
|
}
|
|
1747
1967
|
});
|
|
1748
1968
|
});
|
|
@@ -1758,14 +1978,14 @@ var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue
|
|
|
1758
1978
|
function registerIssueCommands(program) {
|
|
1759
1979
|
const issues = program.command("issues").description("Issue operations");
|
|
1760
1980
|
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) => {
|
|
1761
|
-
const
|
|
1762
|
-
const organizationId = resolveOrganizationId(
|
|
1981
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
1982
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1763
1983
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
1764
1984
|
await runGraphqlQueryCommand({
|
|
1765
1985
|
command: "issues.list",
|
|
1766
|
-
runtimeOptions:
|
|
1986
|
+
runtimeOptions: context.runtimeOptions,
|
|
1767
1987
|
field: "issues",
|
|
1768
|
-
variables:
|
|
1988
|
+
variables: normalizeGraphqlVariables2({
|
|
1769
1989
|
organization_id: organizationId,
|
|
1770
1990
|
page: opts.page,
|
|
1771
1991
|
per: opts.per,
|
|
@@ -1783,11 +2003,11 @@ function registerIssueCommands(program) {
|
|
|
1783
2003
|
});
|
|
1784
2004
|
issues.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
1785
2005
|
const id = idSchema7.parse(opts.id);
|
|
1786
|
-
const
|
|
1787
|
-
const organizationId = resolveOrganizationId(
|
|
2006
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2007
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1788
2008
|
await runGraphqlQueryCommand({
|
|
1789
2009
|
command: "issues.show",
|
|
1790
|
-
runtimeOptions:
|
|
2010
|
+
runtimeOptions: context.runtimeOptions,
|
|
1791
2011
|
field: "issue",
|
|
1792
2012
|
variables: {
|
|
1793
2013
|
organization_id: organizationId,
|
|
@@ -1800,40 +2020,42 @@ function registerIssueCommands(program) {
|
|
|
1800
2020
|
const issueGroupId = issueGroupIdSchema.parse(opts.issueGroupId);
|
|
1801
2021
|
const name = nameSchema.parse(opts.name);
|
|
1802
2022
|
const issueType = issueTypeSchema.parse(opts.issueType);
|
|
1803
|
-
const
|
|
1804
|
-
const organizationId = resolveOrganizationId(
|
|
2023
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2024
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1805
2025
|
await runGraphqlMutationCommand({
|
|
1806
2026
|
command: "issues.create",
|
|
1807
|
-
runtimeOptions:
|
|
2027
|
+
runtimeOptions: context.runtimeOptions,
|
|
1808
2028
|
field: "create_issue",
|
|
1809
2029
|
variables: {
|
|
1810
2030
|
organization_id: organizationId,
|
|
1811
2031
|
params: {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
2032
|
+
issue: {
|
|
2033
|
+
issue_group_id: issueGroupId,
|
|
2034
|
+
name,
|
|
2035
|
+
issue_type: issueType,
|
|
2036
|
+
...opts.status ? { status: String(opts.status) } : {},
|
|
2037
|
+
...opts.priority ? { priority: String(opts.priority) } : {},
|
|
2038
|
+
...opts.description ? { description: String(opts.description) } : {},
|
|
2039
|
+
...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
|
|
2040
|
+
...opts.memberId ? { member_id: String(opts.memberId) } : {}
|
|
2041
|
+
}
|
|
1820
2042
|
}
|
|
1821
2043
|
}
|
|
1822
2044
|
});
|
|
1823
2045
|
});
|
|
1824
2046
|
issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp4).action(async (opts, cmd) => {
|
|
1825
2047
|
const id = idSchema7.parse(opts.id);
|
|
1826
|
-
const
|
|
1827
|
-
const organizationId = resolveOrganizationId(
|
|
2048
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2049
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
1828
2050
|
const body = __testables.normalizeBody(String(opts.dataJson), "issue");
|
|
1829
2051
|
await runGraphqlMutationCommand({
|
|
1830
2052
|
command: "issues.update",
|
|
1831
|
-
runtimeOptions:
|
|
2053
|
+
runtimeOptions: context.runtimeOptions,
|
|
1832
2054
|
field: "update_issue",
|
|
1833
2055
|
variables: {
|
|
1834
2056
|
organization_id: organizationId,
|
|
1835
2057
|
issue_id: id,
|
|
1836
|
-
params: body
|
|
2058
|
+
params: body
|
|
1837
2059
|
}
|
|
1838
2060
|
});
|
|
1839
2061
|
});
|
|
@@ -2041,14 +2263,14 @@ var idSchema8 = import_zod9.z.string().min(1);
|
|
|
2041
2263
|
function registerTeamCommands(program) {
|
|
2042
2264
|
const teams = program.command("teams").description("Team operations");
|
|
2043
2265
|
teams.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
|
|
2044
|
-
const
|
|
2045
|
-
const organizationId = resolveOrganizationId(
|
|
2266
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2267
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2046
2268
|
const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
|
|
2047
2269
|
await runGraphqlQueryCommand({
|
|
2048
2270
|
command: "teams.list",
|
|
2049
|
-
runtimeOptions:
|
|
2271
|
+
runtimeOptions: context.runtimeOptions,
|
|
2050
2272
|
field: "teams",
|
|
2051
|
-
variables:
|
|
2273
|
+
variables: normalizeGraphqlVariables2({
|
|
2052
2274
|
organization_id: organizationId,
|
|
2053
2275
|
page: opts.page,
|
|
2054
2276
|
per: opts.per,
|
|
@@ -2059,11 +2281,11 @@ function registerTeamCommands(program) {
|
|
|
2059
2281
|
});
|
|
2060
2282
|
teams.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
2061
2283
|
const id = idSchema8.parse(opts.id);
|
|
2062
|
-
const
|
|
2063
|
-
const organizationId = resolveOrganizationId(
|
|
2284
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2285
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2064
2286
|
await runGraphqlQueryCommand({
|
|
2065
2287
|
command: "teams.show",
|
|
2066
|
-
runtimeOptions:
|
|
2288
|
+
runtimeOptions: context.runtimeOptions,
|
|
2067
2289
|
field: "team",
|
|
2068
2290
|
variables: {
|
|
2069
2291
|
organization_id: organizationId,
|
|
@@ -2073,32 +2295,32 @@ function registerTeamCommands(program) {
|
|
|
2073
2295
|
});
|
|
2074
2296
|
});
|
|
2075
2297
|
teams.command("create").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2076
|
-
const
|
|
2077
|
-
const organizationId = resolveOrganizationId(
|
|
2298
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2299
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2078
2300
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2079
2301
|
await runGraphqlMutationCommand({
|
|
2080
2302
|
command: "teams.create",
|
|
2081
|
-
runtimeOptions:
|
|
2303
|
+
runtimeOptions: context.runtimeOptions,
|
|
2082
2304
|
field: "create_team",
|
|
2083
2305
|
variables: {
|
|
2084
2306
|
organization_id: organizationId,
|
|
2085
|
-
params: body
|
|
2307
|
+
params: body
|
|
2086
2308
|
}
|
|
2087
2309
|
});
|
|
2088
2310
|
});
|
|
2089
2311
|
teams.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
|
|
2090
2312
|
const id = idSchema8.parse(opts.id);
|
|
2091
|
-
const
|
|
2092
|
-
const organizationId = resolveOrganizationId(
|
|
2313
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2314
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2093
2315
|
const body = __testables.normalizeBody(String(opts.dataJson), "team");
|
|
2094
2316
|
await runGraphqlMutationCommand({
|
|
2095
2317
|
command: "teams.update",
|
|
2096
|
-
runtimeOptions:
|
|
2318
|
+
runtimeOptions: context.runtimeOptions,
|
|
2097
2319
|
field: "update_team",
|
|
2098
2320
|
variables: {
|
|
2099
2321
|
organization_id: organizationId,
|
|
2100
2322
|
team_id: id,
|
|
2101
|
-
params: body
|
|
2323
|
+
params: body
|
|
2102
2324
|
}
|
|
2103
2325
|
});
|
|
2104
2326
|
});
|
|
@@ -2110,12 +2332,12 @@ var idSchema9 = import_zod10.z.string().min(1);
|
|
|
2110
2332
|
function registerOrganizationCommands(program) {
|
|
2111
2333
|
const organizations = program.command("organizations").description("Organization operations");
|
|
2112
2334
|
organizations.command("show").option("--id <id>", "Organization ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2113
|
-
const
|
|
2114
|
-
const fallbackId = resolveOrganizationId(
|
|
2335
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2336
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2115
2337
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2116
2338
|
await runGraphqlQueryCommand({
|
|
2117
2339
|
command: "organizations.show",
|
|
2118
|
-
runtimeOptions:
|
|
2340
|
+
runtimeOptions: context.runtimeOptions,
|
|
2119
2341
|
field: "organization",
|
|
2120
2342
|
variables: { id },
|
|
2121
2343
|
isShow: true
|
|
@@ -2125,28 +2347,28 @@ function registerOrganizationCommands(program) {
|
|
|
2125
2347
|
"--data-json <dataJson>",
|
|
2126
2348
|
'JSON object for organization or {"organization": {...}}'
|
|
2127
2349
|
).action(async (opts, cmd) => {
|
|
2128
|
-
const
|
|
2129
|
-
const fallbackId = resolveOrganizationId(
|
|
2350
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2351
|
+
const fallbackId = resolveOrganizationId(context.organizationId);
|
|
2130
2352
|
const id = idSchema9.parse(opts.id ?? fallbackId);
|
|
2131
2353
|
const body = __testables.normalizeBody(String(opts.dataJson), "organization");
|
|
2132
2354
|
await runGraphqlMutationCommand({
|
|
2133
2355
|
command: "organizations.update",
|
|
2134
|
-
runtimeOptions:
|
|
2356
|
+
runtimeOptions: context.runtimeOptions,
|
|
2135
2357
|
field: "update_organization",
|
|
2136
2358
|
variables: {
|
|
2137
2359
|
id,
|
|
2138
|
-
params: body
|
|
2360
|
+
params: body
|
|
2139
2361
|
}
|
|
2140
2362
|
});
|
|
2141
2363
|
});
|
|
2142
2364
|
const metaProfile = organizations.command("meta-profile").description("Organization meta profile operations");
|
|
2143
2365
|
metaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2144
|
-
const
|
|
2145
|
-
const organizationId = resolveOrganizationId(
|
|
2366
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2367
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2146
2368
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2147
2369
|
await runGraphqlQueryCommand({
|
|
2148
2370
|
command: "organizations.meta-profile.show",
|
|
2149
|
-
runtimeOptions:
|
|
2371
|
+
runtimeOptions: context.runtimeOptions,
|
|
2150
2372
|
field: "organization_meta_profile",
|
|
2151
2373
|
variables: {
|
|
2152
2374
|
organization_id: organizationId,
|
|
@@ -2159,8 +2381,8 @@ function registerOrganizationCommands(program) {
|
|
|
2159
2381
|
"--data-json <dataJson>",
|
|
2160
2382
|
'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
|
|
2161
2383
|
).action(async (opts, cmd) => {
|
|
2162
|
-
const
|
|
2163
|
-
const organizationId = resolveOrganizationId(
|
|
2384
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2385
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2164
2386
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2165
2387
|
const body = __testables.normalizeBody(
|
|
2166
2388
|
String(opts.dataJson),
|
|
@@ -2168,23 +2390,23 @@ function registerOrganizationCommands(program) {
|
|
|
2168
2390
|
);
|
|
2169
2391
|
await runGraphqlMutationCommand({
|
|
2170
2392
|
command: "organizations.meta-profile.update",
|
|
2171
|
-
runtimeOptions:
|
|
2393
|
+
runtimeOptions: context.runtimeOptions,
|
|
2172
2394
|
field: "update_organization_meta_profile",
|
|
2173
2395
|
variables: {
|
|
2174
2396
|
organization_id: organizationId,
|
|
2175
2397
|
organization_meta_profile_id: id,
|
|
2176
|
-
params: body
|
|
2398
|
+
params: body
|
|
2177
2399
|
}
|
|
2178
2400
|
});
|
|
2179
2401
|
});
|
|
2180
2402
|
const keyMetricMetaProfile = organizations.command("key-metric-meta-profile").description("Key metric meta profile operations");
|
|
2181
2403
|
keyMetricMetaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
|
|
2182
|
-
const
|
|
2183
|
-
const organizationId = resolveOrganizationId(
|
|
2404
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2405
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2184
2406
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2185
2407
|
await runGraphqlQueryCommand({
|
|
2186
2408
|
command: "organizations.key-metric-meta-profile.show",
|
|
2187
|
-
runtimeOptions:
|
|
2409
|
+
runtimeOptions: context.runtimeOptions,
|
|
2188
2410
|
field: "key_metric_meta_profile",
|
|
2189
2411
|
variables: {
|
|
2190
2412
|
organization_id: organizationId,
|
|
@@ -2197,8 +2419,8 @@ function registerOrganizationCommands(program) {
|
|
|
2197
2419
|
"--data-json <dataJson>",
|
|
2198
2420
|
'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
|
|
2199
2421
|
).action(async (opts, cmd) => {
|
|
2200
|
-
const
|
|
2201
|
-
const organizationId = resolveOrganizationId(
|
|
2422
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2423
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2202
2424
|
const id = idSchema9.parse(opts.id ?? organizationId);
|
|
2203
2425
|
const body = __testables.normalizeBody(
|
|
2204
2426
|
String(opts.dataJson),
|
|
@@ -2206,12 +2428,12 @@ function registerOrganizationCommands(program) {
|
|
|
2206
2428
|
);
|
|
2207
2429
|
await runGraphqlMutationCommand({
|
|
2208
2430
|
command: "organizations.key-metric-meta-profile.update",
|
|
2209
|
-
runtimeOptions:
|
|
2431
|
+
runtimeOptions: context.runtimeOptions,
|
|
2210
2432
|
field: "update_key_metric_meta_profile",
|
|
2211
2433
|
variables: {
|
|
2212
2434
|
organization_id: organizationId,
|
|
2213
2435
|
key_metric_meta_profile_id: id,
|
|
2214
|
-
params: body
|
|
2436
|
+
params: body
|
|
2215
2437
|
}
|
|
2216
2438
|
});
|
|
2217
2439
|
});
|
|
@@ -2225,14 +2447,14 @@ function registerFoundationCommands(program) {
|
|
|
2225
2447
|
const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
|
|
2226
2448
|
const strategicObjectives = foundation.command("strategic-objectives").description("Strategic objective operations");
|
|
2227
2449
|
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) => {
|
|
2228
|
-
const
|
|
2229
|
-
const organizationId = resolveOrganizationId(
|
|
2450
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2451
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2230
2452
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2231
2453
|
await runGraphqlQueryCommand({
|
|
2232
2454
|
command: "foundation.strategic-plans.show",
|
|
2233
|
-
runtimeOptions:
|
|
2455
|
+
runtimeOptions: context.runtimeOptions,
|
|
2234
2456
|
field: "strategic_plan",
|
|
2235
|
-
variables:
|
|
2457
|
+
variables: normalizeGraphqlVariables2({
|
|
2236
2458
|
organization_id: organizationId,
|
|
2237
2459
|
id,
|
|
2238
2460
|
progress_scope: opts.progressScope,
|
|
@@ -2246,30 +2468,30 @@ function registerFoundationCommands(program) {
|
|
|
2246
2468
|
"--data-json <dataJson>",
|
|
2247
2469
|
'JSON object for strategic_plan or {"strategic_plan": {...}}'
|
|
2248
2470
|
).action(async (opts, cmd) => {
|
|
2249
|
-
const
|
|
2250
|
-
const organizationId = resolveOrganizationId(
|
|
2471
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2472
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2251
2473
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2252
2474
|
const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
|
|
2253
2475
|
await runGraphqlMutationCommand({
|
|
2254
2476
|
command: "foundation.strategic-plans.update",
|
|
2255
|
-
runtimeOptions:
|
|
2477
|
+
runtimeOptions: context.runtimeOptions,
|
|
2256
2478
|
field: "update_strategic_plan",
|
|
2257
2479
|
variables: {
|
|
2258
2480
|
organization_id: organizationId,
|
|
2259
2481
|
strategic_plan_id: id,
|
|
2260
|
-
params: body
|
|
2482
|
+
params: body
|
|
2261
2483
|
}
|
|
2262
2484
|
});
|
|
2263
2485
|
});
|
|
2264
2486
|
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) => {
|
|
2265
|
-
const
|
|
2266
|
-
const organizationId = resolveOrganizationId(
|
|
2487
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2488
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2267
2489
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2268
2490
|
await runGraphqlQueryCommand({
|
|
2269
2491
|
command: "foundation.strategic-objectives.show",
|
|
2270
|
-
runtimeOptions:
|
|
2492
|
+
runtimeOptions: context.runtimeOptions,
|
|
2271
2493
|
field: "strategic_objective",
|
|
2272
|
-
variables:
|
|
2494
|
+
variables: normalizeGraphqlVariables2({
|
|
2273
2495
|
organization_id: organizationId,
|
|
2274
2496
|
id,
|
|
2275
2497
|
progress_scope: opts.progressScope,
|
|
@@ -2283,8 +2505,8 @@ function registerFoundationCommands(program) {
|
|
|
2283
2505
|
"--data-json <dataJson>",
|
|
2284
2506
|
'JSON object for strategic_objective or {"strategic_objective": {...}}'
|
|
2285
2507
|
).action(async (opts, cmd) => {
|
|
2286
|
-
const
|
|
2287
|
-
const organizationId = resolveOrganizationId(
|
|
2508
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2509
|
+
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2288
2510
|
const id = idSchema10.parse(opts.id ?? organizationId);
|
|
2289
2511
|
const body = __testables.normalizeBody(
|
|
2290
2512
|
String(opts.dataJson),
|
|
@@ -2292,12 +2514,12 @@ function registerFoundationCommands(program) {
|
|
|
2292
2514
|
);
|
|
2293
2515
|
await runGraphqlMutationCommand({
|
|
2294
2516
|
command: "foundation.strategic-objectives.update",
|
|
2295
|
-
runtimeOptions:
|
|
2517
|
+
runtimeOptions: context.runtimeOptions,
|
|
2296
2518
|
field: "update_strategic_objective",
|
|
2297
2519
|
variables: {
|
|
2298
2520
|
organization_id: organizationId,
|
|
2299
2521
|
strategic_objective_id: id,
|
|
2300
|
-
params: body
|
|
2522
|
+
params: body
|
|
2301
2523
|
}
|
|
2302
2524
|
});
|
|
2303
2525
|
});
|
|
@@ -2322,7 +2544,10 @@ function registerFoundationCommands(program) {
|
|
|
2322
2544
|
// src/cli.ts
|
|
2323
2545
|
function buildCli() {
|
|
2324
2546
|
const program = new import_commander.Command();
|
|
2325
|
-
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(
|
|
2547
|
+
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(
|
|
2548
|
+
"--auth-json-stdin",
|
|
2549
|
+
"Read auth/runtime context JSON from stdin (token, baseUrl, organizationId, ...)"
|
|
2550
|
+
).option(
|
|
2326
2551
|
"--base-url <baseUrl>",
|
|
2327
2552
|
"API base URL (prefer WAVE_API_BASE_URL env var)"
|
|
2328
2553
|
).option(
|