@ted-galago/wave-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { ZodError } from "zod";
8
8
  import { Command } from "commander";
9
9
 
10
10
  // src/commands/tasks.ts
11
- import { z as z2 } from "zod";
11
+ import { z as z3 } from "zod";
12
12
 
13
13
  // src/config.ts
14
14
  import { z } from "zod";
@@ -145,7 +145,7 @@ function getConfig(options) {
145
145
  return parsed.data;
146
146
  }
147
147
 
148
- // src/client/httpClient.ts
148
+ // src/client/graphqlClient.ts
149
149
  import { randomUUID } from "crypto";
150
150
  function buildEnvelope(params) {
151
151
  return {
@@ -177,129 +177,202 @@ function debugLog(config, message) {
177
177
  process.stderr.write(`[wave:debug] ${message}
178
178
  `);
179
179
  }
180
- async function executeFetch(params) {
181
- const controller = new AbortController();
182
- const timeoutId = setTimeout(() => controller.abort(), params.input.config.timeoutMs);
183
- try {
184
- return await fetch(params.url, {
185
- method: params.input.method,
186
- headers: {
187
- Authorization: `Bearer ${params.input.config.token}`,
188
- Accept: "application/json",
189
- "Content-Type": "application/json",
190
- "X-Origin": "langgraph-cli",
191
- "X-Request-Id": params.requestId,
192
- ...params.input.config.agentName ? { "X-Agent-Name": params.input.config.agentName } : {},
193
- ...params.input.config.agentRunId ? { "X-Agent-Run-Id": params.input.config.agentRunId } : {}
194
- },
195
- body: params.input.body && params.input.method !== "GET" ? JSON.stringify(params.input.body) : void 0,
196
- signal: controller.signal
197
- });
198
- } finally {
199
- clearTimeout(timeoutId);
180
+ function graphqlOperationName(command) {
181
+ return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
182
+ }
183
+ function inferStatusFromGraphqlErrors(errors) {
184
+ if (!Array.isArray(errors) || errors.length === 0) {
185
+ return 400;
186
+ }
187
+ const text = JSON.stringify(errors).toLowerCase();
188
+ if (text.includes("unauthorized") || text.includes("not authenticated")) {
189
+ return 401;
190
+ }
191
+ if (text.includes("forbidden")) {
192
+ return 403;
193
+ }
194
+ if (text.includes("not found")) {
195
+ return 404;
200
196
  }
197
+ if (text.includes("validation")) {
198
+ return 422;
199
+ }
200
+ return 400;
201
201
  }
202
- function errorFromPayload(payload, status) {
203
- if (typeof payload === "object" && payload !== null) {
204
- const asRecord = payload;
205
- if ("error" in asRecord && typeof asRecord.error === "object" && asRecord.error !== null) {
206
- const inner = asRecord.error;
207
- return {
208
- code: String(inner.code ?? `http_${status}`),
209
- message: String(inner.message ?? "Request failed."),
210
- details: typeof inner.details === "object" && inner.details !== null ? inner.details : {}
211
- };
202
+ function errorFromGraphqlErrors(errors, status) {
203
+ return {
204
+ code: status === 401 ? "missing_auth" : status === 403 ? "forbidden" : `http_${status}`,
205
+ message: "GraphQL request failed.",
206
+ details: { errors }
207
+ };
208
+ }
209
+ function graphqlTypeForValue(value) {
210
+ if (Array.isArray(value)) {
211
+ const firstNonNull = value.find((item) => item !== null && item !== void 0);
212
+ if (firstNonNull === void 0) {
213
+ return "[String!]";
212
214
  }
215
+ const innerType = graphqlTypeForValue(firstNonNull).replace(/\[|\]|!/g, "");
216
+ return `[${innerType}!]`;
217
+ }
218
+ if (typeof value === "string") {
219
+ return "String";
220
+ }
221
+ if (typeof value === "number") {
222
+ return Number.isInteger(value) ? "Int" : "Float";
223
+ }
224
+ if (typeof value === "boolean") {
225
+ return "Boolean";
213
226
  }
227
+ return "JSON";
228
+ }
229
+ function buildGraphqlBody(input) {
230
+ const operationName = graphqlOperationName(input.command);
231
+ const variableEntries = Object.entries(input.variables).filter(([, value]) => value !== void 0);
232
+ const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${graphqlTypeForValue(value)}`).join(", ");
233
+ const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
234
+ const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
235
+ const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
236
+ const query = `${input.operationType} ${operationName}${signature} { ${input.field}${args} ${input.selectionSet} }`;
214
237
  return {
215
- code: `http_${status}`,
216
- message: `HTTP ${status}`,
217
- details: {}
238
+ operationName,
239
+ query,
240
+ variables: input.variables
218
241
  };
219
242
  }
220
- async function httpRequest(input) {
243
+ async function graphqlRequest(input) {
221
244
  const base = new URL(input.config.baseUrl);
222
- const url = new URL(input.path, base);
245
+ const url = new URL("/graphql", base);
223
246
  const requestId = input.config.requestId ?? randomUUID();
224
- const maxAttempts = input.method === "GET" ? 2 : 1;
247
+ const body = buildGraphqlBody(input);
225
248
  debugLog(
226
249
  input.config,
227
- `request command=${input.command} method=${input.method} url=${url.toString()} token=${redactForLogs(
250
+ `graphql command=${input.command} op=${input.operationType} field=${input.field} url=${url.toString()} token=${redactForLogs(
228
251
  input.config.token
229
252
  )}`
230
253
  );
231
- let attempt = 0;
232
- while (attempt < maxAttempts) {
233
- attempt += 1;
234
- try {
235
- const response = await executeFetch({ requestId, url, input });
236
- const responseRequestId = response.headers.get("x-request-id") ?? requestId;
237
- const text = await response.text();
238
- const payload = text ? parseJsonSafely(text) : null;
239
- if (response.ok) {
254
+ const controller = new AbortController();
255
+ const timeoutId = setTimeout(() => controller.abort(), input.config.timeoutMs);
256
+ try {
257
+ const response = await fetch(url, {
258
+ method: "POST",
259
+ headers: {
260
+ Authorization: `Bearer ${input.config.token}`,
261
+ Accept: "application/json",
262
+ "Content-Type": "application/json",
263
+ "X-Origin": "langgraph-cli",
264
+ "X-Request-Id": requestId,
265
+ ...input.config.agentName ? { "X-Agent-Name": input.config.agentName } : {},
266
+ ...input.config.agentRunId ? { "X-Agent-Run-Id": input.config.agentRunId } : {}
267
+ },
268
+ body: JSON.stringify(body),
269
+ signal: controller.signal
270
+ });
271
+ const responseRequestId = response.headers.get("x-request-id") ?? requestId;
272
+ const text = await response.text();
273
+ const payload = text ? parseJsonSafely(text) : null;
274
+ const graph = payload && typeof payload === "object" ? payload : {};
275
+ const gqlErrors = graph.errors;
276
+ const gqlData = graph.data && typeof graph.data === "object" ? graph.data : {};
277
+ if (Array.isArray(gqlErrors) && gqlErrors.length > 0) {
278
+ const status = inferStatusFromGraphqlErrors(gqlErrors);
279
+ return {
280
+ envelope: buildEnvelope({
281
+ ok: false,
282
+ command: input.command,
283
+ status,
284
+ data: null,
285
+ error: errorFromGraphqlErrors(gqlErrors, status),
286
+ requestId: responseRequestId
287
+ }),
288
+ exitCode: mapStatusToExitCode(status)
289
+ };
290
+ }
291
+ const fieldPayload = gqlData[input.field];
292
+ if (input.operationType === "mutation") {
293
+ const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
294
+ const ok = Boolean(mutationPayload.ok);
295
+ const status = typeof mutationPayload.status === "number" ? mutationPayload.status : ok ? 200 : 400;
296
+ if (!ok) {
240
297
  return {
241
298
  envelope: buildEnvelope({
242
- ok: true,
299
+ ok: false,
243
300
  command: input.command,
244
- status: response.status,
245
- data: payload && typeof payload === "object" ? payload : { value: payload },
246
- error: null,
301
+ status,
302
+ data: null,
303
+ error: {
304
+ code: String(mutationPayload.error_code ?? `http_${status}`),
305
+ message: "Mutation failed.",
306
+ details: {
307
+ errors: mutationPayload.errors ?? null,
308
+ data: mutationPayload.data ?? null
309
+ }
310
+ },
247
311
  requestId: responseRequestId
248
312
  }),
249
- exitCode: EXIT_CODES.success
313
+ exitCode: mapStatusToExitCode(status)
250
314
  };
251
315
  }
252
316
  return {
253
317
  envelope: buildEnvelope({
254
- ok: false,
318
+ ok: true,
255
319
  command: input.command,
256
- status: response.status,
257
- data: null,
258
- error: errorFromPayload(payload, response.status),
320
+ status,
321
+ data: { [input.field]: mutationPayload },
322
+ error: null,
259
323
  requestId: responseRequestId
260
324
  }),
261
- exitCode: mapStatusToExitCode(response.status)
325
+ exitCode: EXIT_CODES.success
262
326
  };
263
- } catch (error) {
264
- const isRetryable = input.method === "GET" && attempt < maxAttempts;
265
- if (isRetryable) {
266
- debugLog(input.config, `retry command=${input.command} attempt=${attempt + 1}`);
267
- continue;
268
- }
269
- const message = error instanceof Error ? error.message : "Network error.";
270
- const status = 503;
327
+ }
328
+ if (input.isShow && (fieldPayload === null || fieldPayload === void 0)) {
271
329
  return {
272
330
  envelope: buildEnvelope({
273
331
  ok: false,
274
332
  command: input.command,
275
- status,
333
+ status: 404,
276
334
  data: null,
277
335
  error: {
278
- code: "network_error",
279
- message,
336
+ code: "not_found",
337
+ message: "Record not found.",
280
338
  details: {}
281
339
  },
282
- requestId
340
+ requestId: responseRequestId
283
341
  }),
284
- exitCode: EXIT_CODES.networkOrUpstream
342
+ exitCode: EXIT_CODES.notFound
285
343
  };
286
344
  }
345
+ return {
346
+ envelope: buildEnvelope({
347
+ ok: true,
348
+ command: input.command,
349
+ status: response.ok ? response.status : 200,
350
+ data: { [input.field]: fieldPayload ?? null },
351
+ error: null,
352
+ requestId: responseRequestId
353
+ }),
354
+ exitCode: EXIT_CODES.success
355
+ };
356
+ } catch (error) {
357
+ const message = error instanceof Error ? error.message : "Network error.";
358
+ return {
359
+ envelope: buildEnvelope({
360
+ ok: false,
361
+ command: input.command,
362
+ status: 503,
363
+ data: null,
364
+ error: {
365
+ code: "network_error",
366
+ message,
367
+ details: {}
368
+ },
369
+ requestId
370
+ }),
371
+ exitCode: EXIT_CODES.networkOrUpstream
372
+ };
373
+ } finally {
374
+ clearTimeout(timeoutId);
287
375
  }
288
- return {
289
- envelope: buildEnvelope({
290
- ok: false,
291
- command: input.command,
292
- status: 503,
293
- data: null,
294
- error: {
295
- code: "network_error",
296
- message: "Network request failed.",
297
- details: {}
298
- },
299
- requestId
300
- }),
301
- exitCode: EXIT_CODES.networkOrUpstream
302
- };
303
376
  }
304
377
 
305
378
  // src/output.ts
@@ -329,15 +402,109 @@ function buildCliErrorEnvelope(params) {
329
402
  }
330
403
  };
331
404
  }
332
- async function runApiCommand(input) {
405
+ function defaultQuerySelectionSet(field, isList) {
406
+ if (field === "organization") {
407
+ return "{ id slug members_count organization_detail { title name description timezone workspace_name } }";
408
+ }
409
+ if (isList) {
410
+ return "{ data { id type attributes } count current_page total_pages }";
411
+ }
412
+ return "{ id type attributes }";
413
+ }
414
+ function parseBooleanMaybe(value) {
415
+ const lowered = value.toLowerCase();
416
+ if (lowered === "true") {
417
+ return true;
418
+ }
419
+ if (lowered === "false") {
420
+ return false;
421
+ }
422
+ return value;
423
+ }
424
+ function normalizeGraphqlVariable(key, value) {
425
+ if (value === void 0 || value === null) {
426
+ return void 0;
427
+ }
428
+ if (Array.isArray(value)) {
429
+ return value.map((item) => String(item)).filter((item) => item.length > 0);
430
+ }
431
+ if (typeof value === "number" || typeof value === "boolean") {
432
+ return value;
433
+ }
434
+ if (typeof value !== "string") {
435
+ return value;
436
+ }
437
+ const trimmed = value.trim();
438
+ if (trimmed.length === 0) {
439
+ return void 0;
440
+ }
441
+ if (key === "page" || key === "per" || key === "start_time") {
442
+ const parsed = Number(trimmed);
443
+ return Number.isFinite(parsed) ? parsed : trimmed;
444
+ }
445
+ if (key.endsWith("_ids")) {
446
+ return trimmed.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
447
+ }
448
+ return parseBooleanMaybe(trimmed);
449
+ }
450
+ function normalizeGraphqlVariables(raw) {
451
+ const normalized = {};
452
+ Object.entries(raw).forEach(([key, value]) => {
453
+ const next = normalizeGraphqlVariable(key, value);
454
+ if (next !== void 0) {
455
+ normalized[key] = next;
456
+ }
457
+ });
458
+ return normalized;
459
+ }
460
+ async function runGraphqlQueryCommand(input) {
333
461
  try {
334
462
  const config = getConfig(input.runtimeOptions);
335
- const result = await httpRequest({
463
+ const result = await graphqlRequest({
336
464
  config,
337
465
  command: input.command,
338
- method: input.method,
339
- path: input.path,
340
- body: input.body
466
+ operationType: "query",
467
+ field: input.field,
468
+ variables: input.variables ?? {},
469
+ selectionSet: input.selectionSet ?? defaultQuerySelectionSet(input.field, Boolean(input.isList)),
470
+ isShow: input.isShow
471
+ });
472
+ printEnvelopeAndExit(result);
473
+ } catch (error) {
474
+ if (error instanceof CliError) {
475
+ printEnvelopeAndExit({
476
+ envelope: buildCliErrorEnvelope({
477
+ command: input.command,
478
+ status: error.status,
479
+ code: error.kind,
480
+ message: error.message,
481
+ details: error.details
482
+ }),
483
+ exitCode: error.exitCode
484
+ });
485
+ }
486
+ const message = error instanceof Error ? error.message : "Unexpected error.";
487
+ printEnvelopeAndExit({
488
+ envelope: buildCliErrorEnvelope({
489
+ command: input.command,
490
+ status: 500,
491
+ code: "generic_error",
492
+ message
493
+ }),
494
+ exitCode: EXIT_CODES.generic
495
+ });
496
+ }
497
+ }
498
+ async function runGraphqlMutationCommand(input) {
499
+ try {
500
+ const config = getConfig(input.runtimeOptions);
501
+ const result = await graphqlRequest({
502
+ config,
503
+ command: input.command,
504
+ operationType: "mutation",
505
+ field: input.field,
506
+ variables: input.variables ?? {},
507
+ selectionSet: input.selectionSet ?? "{ ok status error_code data errors }"
341
508
  });
342
509
  printEnvelopeAndExit(result);
343
510
  } catch (error) {
@@ -404,90 +571,589 @@ function resolveOrganizationId(raw) {
404
571
  return organizationId;
405
572
  }
406
573
 
407
- // src/commands/tasks.ts
408
- var projectIdSchema = z2.string().min(1);
409
- var idSchema = z2.string().min(1);
410
- var summarySchema = z2.string().min(1);
411
- function registerTaskCommands(program) {
412
- const tasks = program.command("tasks").description("Task operations");
413
- tasks.command("list").requiredOption("--project-id <projectId>").action(async (opts, cmd) => {
414
- const projectId = projectIdSchema.parse(opts.projectId);
415
- const globalOpts = cmd.optsWithGlobals();
416
- const organizationId = resolveOrganizationId(globalOpts.organizationId);
417
- await runApiCommand({
418
- command: "tasks.list",
419
- runtimeOptions: pickRuntimeOptions(globalOpts),
420
- method: "GET",
421
- path: `/organizations/${encodeURIComponent(organizationId)}/tasks?project_id=${encodeURIComponent(projectId)}`
422
- });
423
- });
424
- tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
425
- const parsed = idSchema.parse(opts.id);
426
- const globalOpts = cmd.optsWithGlobals();
427
- const organizationId = resolveOrganizationId(globalOpts.organizationId);
428
- await runApiCommand({
429
- command: "tasks.show",
430
- runtimeOptions: pickRuntimeOptions(globalOpts),
431
- method: "GET",
432
- path: `/organizations/${encodeURIComponent(organizationId)}/tasks/${encodeURIComponent(parsed)}`
433
- });
434
- });
435
- tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
436
- const projectId = projectIdSchema.parse(opts.projectId);
437
- const summary = summarySchema.parse(opts.summary ?? opts.title);
438
- const globalOpts = cmd.optsWithGlobals();
439
- const organizationId = resolveOrganizationId(globalOpts.organizationId);
440
- await runApiCommand({
441
- command: "tasks.create",
442
- runtimeOptions: pickRuntimeOptions(globalOpts),
443
- method: "POST",
444
- path: `/organizations/${encodeURIComponent(organizationId)}/tasks`,
445
- body: {
446
- task: {
447
- project_id: projectId,
448
- summary
449
- }
450
- }
451
- });
452
- });
453
- 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) => {
454
- const id = idSchema.parse(opts.id);
455
- const globalOpts = cmd.optsWithGlobals();
456
- const organizationId = resolveOrganizationId(globalOpts.organizationId);
457
- const taskPayload = {
458
- ...opts.summary ? { summary: String(opts.summary) } : {},
459
- ...opts.description ? { description: String(opts.description) } : {},
460
- ...opts.status ? { status: String(opts.status) } : {},
461
- ...opts.priority ? { priority: String(opts.priority) } : {},
462
- ...opts.dueDate ? { due_date: String(opts.dueDate) } : {},
463
- ...opts.memberId ? { member_id: String(opts.memberId) } : {}
464
- };
465
- if (Object.keys(taskPayload).length === 0) {
466
- throw new CliError({
467
- message: "tasks update requires at least one patch field (summary, description, status, priority, due-date, member-id).",
468
- kind: "invalid_args",
469
- status: 400,
470
- exitCode: EXIT_CODES.invalidArgs
471
- });
472
- }
473
- await runApiCommand({
474
- command: "tasks.update",
475
- runtimeOptions: pickRuntimeOptions(globalOpts),
476
- method: "PATCH",
477
- path: `/organizations/${encodeURIComponent(organizationId)}/tasks/${encodeURIComponent(id)}`,
478
- body: {
479
- task: taskPayload
480
- }
481
- });
574
+ // src/commands/entityCrud.ts
575
+ import { z as z2 } from "zod";
576
+
577
+ // src/commands/dtoHelpCatalog.ts
578
+ var dtoHelpCatalog = {
579
+ project: {
580
+ source: "wave-ui/src/types/project.ts + wave-api-rb/config/initializers/constants/project.rb + wave-api-rb/app/models/project.rb",
581
+ create: [
582
+ ["name*", "string"],
583
+ ["description", "string"],
584
+ ["status*", "enum(backlog|planned|in_progress|completed|cancelled)"],
585
+ ["priority*", "enum(no_priority|urgent|high|medium|low)"],
586
+ ["teams_ids", "number[]"],
587
+ ["member_id", "string"],
588
+ ["start_date", "string"],
589
+ ["target_date", "string"]
590
+ ],
591
+ update: [
592
+ ["name*", "string"],
593
+ ["description", "string"],
594
+ ["status*", "enum(backlog|planned|in_progress|completed|cancelled)"],
595
+ ["priority*", "enum(no_priority|urgent|high|medium|low)"],
596
+ ["teams_ids", "number[]"],
597
+ ["member_id", "string"],
598
+ ["background_image_attributes", "BackgroundImageDTO"],
599
+ ["emoji_attributes", "EmojiDTO"],
600
+ ["favorites_attributes", "FavoriteDTO['favorite'][]"],
601
+ ["start_date", "string"],
602
+ ["target_date", "string"],
603
+ ["resources_attributes", "ResourceDTO[]"],
604
+ ["archived_at", "string | null"]
605
+ ]
606
+ },
607
+ rock: {
608
+ source: "wave-ui/src/types/rock.ts + wave-api-rb/config/initializers/constants/rock.rb + wave-api-rb/app/models/rock.rb",
609
+ create: [
610
+ ["name*", "string"],
611
+ ["description", "string"],
612
+ ["notes", "string | null"],
613
+ ["resources_attributes", "ResourceDTO[]"],
614
+ ["member_id", "string"],
615
+ ["rock_type*", "RockType"],
616
+ ["label_ids", "number[]"],
617
+ ["status*", "enum(done|on_track|off_track)"],
618
+ ["due_by", "string"],
619
+ ["rock_collection_id", "string"],
620
+ ["priority*", "enum(no_priority|urgent|high|medium|low)"]
621
+ ],
622
+ update: [
623
+ ["name*", "string"],
624
+ ["description", "string"],
625
+ ["notes", "string | null"],
626
+ ["resources_attributes", "ResourceDTO[]"],
627
+ ["member_id", "string"],
628
+ ["rock_type*", "RockType"],
629
+ ["label_ids", "number[]"],
630
+ ["status*", "enum(done|on_track|off_track)"],
631
+ ["due_by", "string"],
632
+ ["archived_at", "string"],
633
+ ["rock_collection_id", "string"],
634
+ ["priority*", "enum(no_priority|urgent|high|medium|low)"],
635
+ ["rank", "number"],
636
+ ["quarterly_objective_id", "string"]
637
+ ]
638
+ },
639
+ meeting: {
640
+ source: "wave-ui/src/types/meeting.ts + wave-api-rb/config/initializers/constants/meeting.rb + wave-api-rb/app/models/meeting.rb",
641
+ create: [
642
+ ["member_id", "string"],
643
+ ["name", "string"],
644
+ ["type", "MeetingType"],
645
+ ["date", "string"],
646
+ ["status", "enum(upcoming|active|completed)"],
647
+ ["start_time", "number"],
648
+ ["end_time", "number"],
649
+ ["agenda_id", "string"],
650
+ ["repeats", "enum(never|weekly|biweekly|monthly|quarterly)"],
651
+ ["description", "string | null"],
652
+ ["notes", "string | null"],
653
+ ["member_ids", "string[]"],
654
+ ["teams_ids", "number[]"]
655
+ ]
656
+ },
657
+ member: {
658
+ source: "wave-ui/src/types/organization.ts + wave-api-rb/config/initializers/constants/member.rb + wave-api-rb/app/models/member.rb",
659
+ create: [
660
+ ["role", "MemberRole"],
661
+ ["email*", "string"],
662
+ ["teams_ids", "number[]"],
663
+ ["reports_to_id", "string"],
664
+ ["favorites_attributes", "FavoriteDTO['favorite'][]"]
665
+ ],
666
+ update: [
667
+ ["role", "MemberRole"],
668
+ ["email*", "string"],
669
+ ["teams_ids", "number[]"],
670
+ ["first_name", "string"],
671
+ ["last_name", "string"],
672
+ ["pinned", "boolean"],
673
+ ["status*", "enum(accepted|deactivated)"],
674
+ ["timezone", "string"],
675
+ ["title", "string"],
676
+ ["province", "string"],
677
+ ["birthdate", "string"],
678
+ ["work_anniversary", "string"],
679
+ ["role_purpose", "string"],
680
+ ["success_outcomes", "string"],
681
+ ["core_obsessions", "string"],
682
+ ["standards_of_success", "string"],
683
+ ["company_impact", "string"],
684
+ ["reports_to_id", "string"],
685
+ ["phone", "string"],
686
+ ["image_attributes", "{ image?: File | string; image_key?: string } | null"],
687
+ ["client_logs_attributes", "LogDTO[]"],
688
+ ["background_image_attributes", "BackgroundImageDTO"],
689
+ ["favorites_attributes", "FavoriteDTO['favorite'][]"],
690
+ ["side_nav_configurations_attributes", "SideNavConfigurationDTO[]"],
691
+ ["dashboard_tabs_configuration_attributes", "DashboardTabsConfigurationDTO"],
692
+ ["member_favorite_tool_attributes", "MemberFavoriteToolDTO"],
693
+ ["article_popup_interactions", "Record<string, string>"],
694
+ ["getting_started_completions", "Record<string, string>"]
695
+ ]
696
+ },
697
+ issue: {
698
+ source: "wave-ui/src/types/issue.ts + wave-api-rb/config/initializers/constants/issue.rb + wave-api-rb/app/models/issue.rb",
699
+ create: [
700
+ ["name*", "string"],
701
+ ["description", "string"],
702
+ ["notes", "string | null"],
703
+ ["resources_attributes", "ResourceDTO[]"],
704
+ ["member_id", "string"],
705
+ ["issue_type*", "IssueType"],
706
+ ["label_ids", "number[]"],
707
+ ["status*", "IssueStatus"],
708
+ ["due_by", "string"],
709
+ ["archived_at", "string"],
710
+ ["issue_group_id", "string"],
711
+ ["priority*", "Priority"],
712
+ ["rank", "number"]
713
+ ]
714
+ },
715
+ list: {
716
+ source: "wave-ui/src/types/list.ts + wave-api-rb/config/initializers/constants/list.rb + wave-api-rb/app/models/list.rb",
717
+ create: [
718
+ ["name*", "string"],
719
+ ["organization_id", "string"],
720
+ ["description", "string"],
721
+ ["member_id", "string"],
722
+ ["status*", "ListStatus"],
723
+ ["priority*", "Priority"],
724
+ ["start_date", "string"],
725
+ ["target_date", "string"],
726
+ ["teams_ids", "number[]"]
727
+ ]
728
+ },
729
+ list_item: {
730
+ source: "wave-ui/src/types/listItem.ts + wave-api-rb/config/initializers/constants/list_item.rb + wave-api-rb/app/models/list_item.rb",
731
+ create: [
732
+ ["rank", "number"],
733
+ ["organization_id", "string"],
734
+ ["list_id", "string"],
735
+ ["summary", "string"],
736
+ ["member_id", "string"],
737
+ ["status", "ListItemStatus"],
738
+ ["due_date", "string"],
739
+ ["priority", "Priority"],
740
+ ["description", "string"],
741
+ ["notes", "string | null"],
742
+ ["label_ids", "number[]"],
743
+ ["estimate_ids", "number[]"],
744
+ ["resources_attributes", "ResourceDTO[]"],
745
+ ["subitems_attributes", "SubitemAttributes[]"]
746
+ ],
747
+ update: [
748
+ ["rank", "number"],
749
+ ["organization_id", "string"],
750
+ ["list_id", "string"],
751
+ ["summary", "string"],
752
+ ["member_id", "string"],
753
+ ["status", "ListItemStatus"],
754
+ ["due_date", "string"],
755
+ ["priority", "Priority"],
756
+ ["description", "string"],
757
+ ["notes", "string | null"],
758
+ ["label_ids", "number[]"],
759
+ ["estimate_ids", "number[]"],
760
+ ["resources_attributes", "ResourceDTO[]"],
761
+ ["subitems_attributes", "SubitemAttributes[]"],
762
+ ["archived_at", "string | null"]
763
+ ]
764
+ },
765
+ issue_group: {
766
+ source: "wave-ui/src/types/issueGroup.ts + wave-api-rb/config/initializers/constants/issue_group.rb + wave-api-rb/app/models/issue_group.rb",
767
+ create: [
768
+ ["name*", "string"],
769
+ ["description", "string"],
770
+ ["member_id", "string"],
771
+ ["teams_ids", "number[]"],
772
+ ["status*", "IssueGroupStatus"],
773
+ ["priority*", "Priority"],
774
+ ["start_date", "string"],
775
+ ["target_date", "string"]
776
+ ]
777
+ },
778
+ todo_group: {
779
+ source: "wave-ui/src/types/todoGroup.ts + wave-api-rb/config/initializers/constants/todo_group.rb + wave-api-rb/app/models/todo_group.rb",
780
+ create: [
781
+ ["name*", "string"],
782
+ ["description", "string"],
783
+ ["member_id", "string"],
784
+ ["teams_ids", "number[]"],
785
+ ["status*", "TodoGroupStatus"],
786
+ ["priority*", "Priority"],
787
+ ["start_date", "string"],
788
+ ["target_date", "string"]
789
+ ]
790
+ },
791
+ todo: {
792
+ source: "wave-ui/src/types/todo.ts + wave-api-rb/config/initializers/constants/todo.rb + wave-api-rb/app/models/todo.rb",
793
+ create: [
794
+ ["name*", "string"],
795
+ ["description", "string"],
796
+ ["resources_attributes", "ResourceDTO[]"],
797
+ ["member_id", "string"],
798
+ ["label_ids", "number[]"],
799
+ ["status*", "TodoStatus"],
800
+ ["due_by", "string"],
801
+ ["archived_at", "string"],
802
+ ["todo_group_id", "string"],
803
+ ["priority*", "Priority"],
804
+ ["rank", "number"]
805
+ ]
806
+ },
807
+ rock_collection: {
808
+ source: "wave-ui/src/types/rockCollection.ts + wave-api-rb/config/initializers/constants/rock_collection.rb + wave-api-rb/app/models/rock_collection.rb",
809
+ create: [
810
+ ["name*", "string"],
811
+ ["description", "string"],
812
+ ["member_id", "string"],
813
+ ["teams_ids", "number[]"],
814
+ ["status*", "RockCollectionStatus"],
815
+ ["priority*", "Priority"],
816
+ ["start_date", "string"],
817
+ ["target_date", "string"]
818
+ ]
819
+ },
820
+ content: {
821
+ source: "wave-ui/src/types/content.tsx + wave-api-rb/config/initializers/constants/content.rb + wave-api-rb/app/models/content.rb",
822
+ create: [
823
+ ["type*", "ContentType"],
824
+ ["name", "string"],
825
+ ["member_id", "string"],
826
+ ["focus_member_id", "string"],
827
+ ["focus_team_id", "string"],
828
+ ["status*", "ContentStatus"],
829
+ ["parent_content_id", "string"],
830
+ ["content_type*", "ContentCategoryType"],
831
+ ["label_ids", "number[]"],
832
+ ["contentable_id", "string"],
833
+ ["contentable_type", "ContentableType"],
834
+ ["content", "string"]
835
+ ]
836
+ },
837
+ stand_up: {
838
+ source: "wave-ui/src/types/standUp.ts + wave-api-rb/config/initializers/constants/stand_up.rb + wave-api-rb/app/models/stand_up.rb",
839
+ create: [
840
+ ["completed_date", "string"],
841
+ ["met_goals", "number"],
842
+ ["aligned_on_track", "number"],
843
+ ["have_blockers", "boolean"],
844
+ ["have_questions", "number"],
845
+ ["organization_id", "string"],
846
+ ["member_id", "string"],
847
+ ["planned_work", "string"],
848
+ ["blockers", "string"]
849
+ ],
850
+ update: [
851
+ ["completed_date", "string"],
852
+ ["met_goals", "number"],
853
+ ["aligned_on_track", "number"],
854
+ ["have_blockers", "boolean"],
855
+ ["have_questions", "number"],
856
+ ["organization_id", "string"],
857
+ ["member_id", "string"],
858
+ ["planned_work", "string"],
859
+ ["blockers", "string"]
860
+ ]
861
+ },
862
+ headline: {
863
+ source: "wave-ui/src/types/headline.ts + wave-api-rb/config/initializers/constants/headline.rb + wave-api-rb/app/models/headline.rb",
864
+ create: [
865
+ ["organization_id", "string"],
866
+ ["summary*", "string"],
867
+ ["member_id", "string"],
868
+ ["status*", "HeadlineStatus"],
869
+ ["description", "string"],
870
+ ["headline_type*", "HeadlineType"],
871
+ ["read_receipts_attributes", "ReadReceiptAttributesDTO[]"],
872
+ ["teams_ids", "number[]"],
873
+ ["label_ids", "number[]"],
874
+ ["emojis_attributes", "EmojiDTO[]"]
875
+ ]
876
+ },
877
+ question: {
878
+ source: "wave-ui/src/types/question.ts + wave-api-rb/config/initializers/constants/question.rb + wave-api-rb/app/models/question.rb",
879
+ create: [
880
+ ["accepted_answer_ids", "string[]"],
881
+ ["name*", "string"],
882
+ ["description", "string"],
883
+ ["organization_id", "string"],
884
+ ["member_id", "string"],
885
+ ["label_ids", "number[]"],
886
+ ["resources_attributes", "QuestionResourceDTO[]"],
887
+ ["status*", "QuestionStatus"],
888
+ ["answers_attributes", "AnswerDTO[]"],
889
+ ["votes_attributes", "VoteDTO[]"]
890
+ ],
891
+ update: [
892
+ ["accepted_answer_ids", "string[]"],
893
+ ["name*", "string"],
894
+ ["description", "string"],
895
+ ["organization_id", "string"],
896
+ ["member_id", "string"],
897
+ ["label_ids", "number[]"],
898
+ ["resources_attributes", "QuestionResourceDTO[]"],
899
+ ["status*", "QuestionStatus"],
900
+ ["answers_attributes", "AnswerDTO[]"],
901
+ ["votes_attributes", "VoteDTO[]"]
902
+ ]
903
+ },
904
+ health_update: {
905
+ source: "wave-ui/src/types/update.ts + wave-api-rb/config/initializers/constants/health_update.rb + wave-api-rb/app/models/health_update.rb",
906
+ create: [
907
+ ["id", "string"],
908
+ ["value", "string"],
909
+ ["status", "enum(on_track|at_risk|off_track)"],
910
+ ["health_updatable_type", "UpdatableType"],
911
+ ["health_updatable_id", "string"],
912
+ ["member_id", "string"],
913
+ ["resources_attributes", "ResourceDTO[]"],
914
+ ["replies_attributes", "CreateUpdateDTO['health_update'][]"],
915
+ ["_destroy", "boolean"]
916
+ ],
917
+ update: [
918
+ ["id", "string"],
919
+ ["value", "string"],
920
+ ["status", "enum(on_track|at_risk|off_track)"],
921
+ ["health_updatable_type", "UpdatableType"],
922
+ ["health_updatable_id", "string"],
923
+ ["member_id", "string"],
924
+ ["emojis_attributes", "EmojiDTO[]"],
925
+ ["resources_attributes", "ResourceDTO[]"],
926
+ ["replies_attributes", "UpdateUpdateDTO['health_update'][]"],
927
+ ["_destroy", "boolean"]
928
+ ]
929
+ },
930
+ survey: {
931
+ source: "wave-ui/src/types/survey.ts + wave-api-rb/config/initializers/constants/survey.rb + wave-api-rb/app/models/survey.rb",
932
+ create: [
933
+ ["organization_id", "string"],
934
+ ["name*", "SurveyName"],
935
+ ["recipient_type*", "SurveyRecipientType"],
936
+ ["due_date", "string"],
937
+ ["survey_results_attributes", "SurveyResultDTO[]"],
938
+ ["survey_recipients_attributes", "SurveyRecipientDTO[]"],
939
+ ["evaluated_recipients_attributes", "SurveyRecipientDTO[]"]
940
+ ]
941
+ },
942
+ responsibility: {
943
+ source: "wave-ui/src/types/responsibility.ts + wave-api-rb/config/initializers/constants/responsibility.rb + wave-api-rb/app/models/responsibility.rb",
944
+ create: [
945
+ ["organization_id", "string"],
946
+ ["name", "string"],
947
+ ["member_id", "string"],
948
+ ["linked_items_attributes", "LinkedItemDTO[]"],
949
+ ["description", "string"],
950
+ ["rank", "number"],
951
+ ["resources_attributes", "ResourceDTO[]"],
952
+ ["time_commitment", "TimeCommitment"],
953
+ ["time_commitment_value", "number | null"]
954
+ ],
955
+ update: [
956
+ ["organization_id", "string"],
957
+ ["name", "string"],
958
+ ["member_id", "string"],
959
+ ["linked_items_attributes", "LinkedItemDTO[]"],
960
+ ["description", "string"],
961
+ ["rank", "number"],
962
+ ["resources_attributes", "ResourceDTO[]"],
963
+ ["time_commitment", "TimeCommitment"],
964
+ ["time_commitment_value", "number | null"]
965
+ ]
966
+ },
967
+ smart_kpi: {
968
+ source: "wave-ui/src/types/smartKpi.ts + wave-api-rb/config/initializers/constants/smart_kpi.rb + wave-api-rb/app/models/smart_kpi.rb",
969
+ create: [
970
+ ["name*", "SmartKpiType"],
971
+ ["notes", "string | null"],
972
+ ["smart_kpi_type*", "MeasurableType"],
973
+ ["condition*", "Condition"],
974
+ ["smart_kpi_view_id", "string"],
975
+ ["auto_increase", "number"],
976
+ ["status*", "SmartKpiStatus"],
977
+ ["organization_id", "string"],
978
+ ["integration_id", "string"],
979
+ ["member_id", "string"],
980
+ ["quarterly_objective_id", "string"],
981
+ ["resources_attributes", "ResourceDTO[]"]
982
+ ]
983
+ },
984
+ measurable_group: {
985
+ source: "wave-ui/src/types/measurableGroup.ts + wave-api-rb/config/initializers/constants/measurable_group.rb + wave-api-rb/app/models/measurable_group.rb",
986
+ create: [
987
+ ["name*", "string"],
988
+ ["description", "string"],
989
+ ["member_id", "string"],
990
+ ["teams_ids", "number[]"],
991
+ ["status*", "MeasurableGroupStatus"],
992
+ ["priority*", "Priority"],
993
+ ["resources_attributes", "ResourceDTO[]"]
994
+ ],
995
+ update: [
996
+ ["name*", "string"],
997
+ ["description", "string"],
998
+ ["member_id", "string"],
999
+ ["teams_ids", "number[]"],
1000
+ ["status*", "MeasurableGroupStatus"],
1001
+ ["priority*", "Priority"],
1002
+ ["resources_attributes", "ResourceDTO[]"],
1003
+ ["archived_at", "string"]
1004
+ ]
1005
+ },
1006
+ measurable: {
1007
+ source: "wave-ui/src/types/measurable.ts + wave-api-rb/config/initializers/constants/measurable.rb + wave-api-rb/app/models/measurable.rb",
1008
+ create: [
1009
+ ["name*", "string"],
1010
+ ["description", "string"],
1011
+ ["notes", "string | null"],
1012
+ ["rank", "number | null"],
1013
+ ["interval*", "Interval"],
1014
+ ["trend*", "Trend"],
1015
+ ["measurable_type*", "MeasurableType"],
1016
+ ["measurable_group_id", "string"],
1017
+ ["condition*", "Condition"],
1018
+ ["quarterly_objective_id", "string"],
1019
+ ["organization_id", "string"],
1020
+ ["member_id", "string"],
1021
+ ["label_ids", "number[]"],
1022
+ ["meeting_id", "string"],
1023
+ ["resources_attributes", "ResourceDTO[]"]
1024
+ ],
1025
+ update: [
1026
+ ["name*", "string"],
1027
+ ["description", "string"],
1028
+ ["notes", "string | null"],
1029
+ ["rank", "number | null"],
1030
+ ["interval*", "Interval"],
1031
+ ["trend*", "Trend"],
1032
+ ["measurable_type*", "MeasurableType"],
1033
+ ["measurable_group_id", "string"],
1034
+ ["condition*", "Condition"],
1035
+ ["quarterly_objective_id", "string"],
1036
+ ["organization_id", "string"],
1037
+ ["member_id", "string"],
1038
+ ["label_ids", "number[]"],
1039
+ ["meeting_id", "string"],
1040
+ ["resources_attributes", "ResourceDTO[]"],
1041
+ ["archived_at", "string"]
1042
+ ]
1043
+ },
1044
+ customer: {
1045
+ source: "wave-ui/src/types/customer.ts + wave-api-rb/config/initializers/constants/customer.rb + wave-api-rb/app/models/customer.rb",
1046
+ create: [
1047
+ ["name*", "string"],
1048
+ ["member_id", "string"],
1049
+ ["company_size", "string"],
1050
+ ["status*", "CustomerStatus"],
1051
+ ["rank", "number"],
1052
+ ["revenue", "number | null"],
1053
+ ["domain", "string"],
1054
+ ["primary_email", "string"],
1055
+ ["primary_phone", "string"],
1056
+ ["primary_location", "string"],
1057
+ ["organization_id", "string"],
1058
+ ["logs_attributes", "LogDTO[]"],
1059
+ ["notes_attributes", "ContentAttributes[]"],
1060
+ ["resources_attributes", "ResourceDTO[]"]
1061
+ ]
1062
+ },
1063
+ contact: {
1064
+ source: "wave-ui/src/types/contact.ts + wave-api-rb/config/initializers/constants/contact.rb + wave-api-rb/app/models/contact.rb",
1065
+ create: [
1066
+ ["name*", "string"],
1067
+ ["member_id", "string"],
1068
+ ["customer_id", "string"],
1069
+ ["status*", "ContactStatus"],
1070
+ ["rank", "number"],
1071
+ ["job_title", "string"],
1072
+ ["email", "string"],
1073
+ ["phone", "string"],
1074
+ ["location", "string"],
1075
+ ["organization_id", "string"],
1076
+ ["logs_attributes", "LogDTO[]"],
1077
+ ["notes_attributes", "ContentAttributes[]"],
1078
+ ["resources_attributes", "ResourceDTO[]"]
1079
+ ]
1080
+ },
1081
+ annual_objective: {
1082
+ source: "wave-ui/src/types/annualObjective.ts + wave-api-rb/config/initializers/constants/annual_objective.rb + wave-api-rb/app/models/annual_objective.rb",
1083
+ create: [
1084
+ ["strategic_objective_id", "string"],
1085
+ ["name", "string"],
1086
+ ["description", "string | null"],
1087
+ ["owner_id", "string"],
1088
+ ["creator_id", "string"],
1089
+ ["status", "MeasurableStatus"],
1090
+ ["emoji_attributes", "EmojiDTO"]
1091
+ ],
1092
+ update: [
1093
+ ["strategic_objective_id", "string"],
1094
+ ["name", "string"],
1095
+ ["description", "string | null"],
1096
+ ["owner_id", "string"],
1097
+ ["creator_id", "string"],
1098
+ ["status", "MeasurableStatus"],
1099
+ ["emoji_attributes", "EmojiDTO"]
1100
+ ]
1101
+ },
1102
+ quarterly_objective: {
1103
+ source: "wave-ui/src/types/quarterlyObjective.ts + wave-api-rb/config/initializers/constants/quarterly_objective.rb + wave-api-rb/app/models/quarterly_objective.rb",
1104
+ create: [
1105
+ ["strategic_objective_id", "string"],
1106
+ ["annual_objective_id", "string"],
1107
+ ["name", "string"],
1108
+ ["description", "string | null"],
1109
+ ["owner_id", "string"],
1110
+ ["creator_id", "string"],
1111
+ ["status", "MeasurableStatus"],
1112
+ ["department_id", "string"],
1113
+ ["emoji_attributes", "EmojiDTO"]
1114
+ ],
1115
+ update: [
1116
+ ["strategic_objective_id", "string"],
1117
+ ["annual_objective_id", "string"],
1118
+ ["name", "string"],
1119
+ ["description", "string | null"],
1120
+ ["owner_id", "string"],
1121
+ ["creator_id", "string"],
1122
+ ["status", "MeasurableStatus"],
1123
+ ["department_id", "string"],
1124
+ ["emoji_attributes", "EmojiDTO"]
1125
+ ]
1126
+ }
1127
+ };
1128
+ function humanize(field) {
1129
+ return field.replace(/_attributes$/, "").replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()) + " field.";
1130
+ }
1131
+ function toRows(fields, mode) {
1132
+ return fields.map(([rawField, type]) => {
1133
+ const required = rawField.endsWith("*") ? "yes" : "no";
1134
+ const field = rawField.replace(/\*$/, "");
1135
+ const requiredForMode = mode === "create" ? required : "no";
1136
+ return `${field} | required:${requiredForMode} | type:${type} | ${humanize(field)}`;
482
1137
  });
483
1138
  }
484
-
485
- // src/commands/projects.ts
486
- import { z as z4 } from "zod";
1139
+ function buildDataJsonHelp(rootKey, mode) {
1140
+ const config = dtoHelpCatalog[rootKey];
1141
+ if (!config) return null;
1142
+ const fields = mode === "create" ? config.create : config.update ?? config.create;
1143
+ if (!fields || fields.length === 0) return null;
1144
+ return [
1145
+ `JSON object for ${rootKey} or {"${rootKey}": {...}}`,
1146
+ `${rootKey} payload (${mode})`,
1147
+ `source: ${config.source}`,
1148
+ `note: fields containing "preference" are intentionally omitted.`,
1149
+ "field | required | type | description",
1150
+ ...toRows(fields, mode),
1151
+ `example: {"${rootKey}":{"${fields[0][0].replace(/\*$/, "")}":"value"}}`
1152
+ ].join("\n");
1153
+ }
487
1154
 
488
1155
  // src/commands/entityCrud.ts
489
- import { z as z3 } from "zod";
490
- var idSchema2 = z3.string().min(1);
1156
+ var idSchema = z2.string().min(1);
491
1157
  function parseJsonObject(raw) {
492
1158
  try {
493
1159
  const parsed = JSON.parse(raw);
@@ -512,6 +1178,12 @@ function normalizeBody(raw, rootKey) {
512
1178
  }
513
1179
  return { [rootKey]: payload };
514
1180
  }
1181
+ function parseQueryJson(raw) {
1182
+ if (!raw) {
1183
+ return {};
1184
+ }
1185
+ return parseJsonObject(raw);
1186
+ }
515
1187
  function assertRequiredCreateFields(body, rootKey, requiredFields) {
516
1188
  if (!requiredFields || requiredFields.length === 0) {
517
1189
  return;
@@ -542,87 +1214,266 @@ function assertRequiredCreateFields(body, rootKey, requiredFields) {
542
1214
  }
543
1215
  function registerEntityCrudCommands(program, config) {
544
1216
  const entityCommand = program.command(config.command).description(config.description);
545
- entityCommand.command("create").requiredOption("--data-json <dataJson>", "JSON object, optionally wrapped with root key").action(async (opts, cmd) => {
1217
+ const createHelp4 = buildDataJsonHelp(config.rootKey, "create") ?? "JSON object, optionally wrapped with root key";
1218
+ const updateHelp5 = buildDataJsonHelp(config.rootKey, "update") ?? "JSON object, optionally wrapped with root key";
1219
+ const list = entityCommand.command("list").option("--page <page>").option("--per <per>");
1220
+ const listParams = config.listParams ?? [];
1221
+ listParams.forEach((param) => {
1222
+ const cliParam = param.replace(/_/g, "-");
1223
+ list.option(`--${cliParam} <${cliParam}>`);
1224
+ });
1225
+ list.option("--query-json <queryJson>", "Additional query params as JSON object").action(async (opts, cmd) => {
1226
+ const globalOpts = cmd.optsWithGlobals();
1227
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1228
+ const extraQuery = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1229
+ const mappedKnownParams = Object.fromEntries(
1230
+ listParams.map((param) => {
1231
+ const optionKey = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
1232
+ return [param, opts[optionKey]];
1233
+ })
1234
+ );
1235
+ const variables = normalizeGraphqlVariables({
1236
+ organization_id: organizationId,
1237
+ page: opts.page,
1238
+ per: opts.per,
1239
+ ...mappedKnownParams,
1240
+ ...extraQuery
1241
+ });
1242
+ await runGraphqlQueryCommand({
1243
+ command: `${config.command}.list`,
1244
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1245
+ field: config.resourcePath === "feedback" ? "feedbacks" : config.resourcePath,
1246
+ variables,
1247
+ isList: true
1248
+ });
1249
+ });
1250
+ entityCommand.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
1251
+ const id = idSchema.parse(opts.id);
1252
+ const globalOpts = cmd.optsWithGlobals();
1253
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1254
+ await runGraphqlQueryCommand({
1255
+ command: `${config.command}.show`,
1256
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1257
+ field: config.resourcePath === "organization_meta_profiles" ? "organization_meta_profile" : config.resourcePath === "key_metric_meta_profiles" ? "key_metric_meta_profile" : config.resourcePath === "feedback" ? "feedback" : config.resourcePath.endsWith("s") ? config.resourcePath.slice(0, -1) : config.resourcePath,
1258
+ variables: normalizeGraphqlVariables({
1259
+ organization_id: organizationId,
1260
+ id
1261
+ }),
1262
+ isShow: true
1263
+ });
1264
+ });
1265
+ entityCommand.command("create").requiredOption("--data-json <dataJson>", createHelp4).action(async (opts, cmd) => {
546
1266
  const globalOpts = cmd.optsWithGlobals();
547
1267
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
548
1268
  const body = normalizeBody(String(opts.dataJson), config.rootKey);
549
1269
  assertRequiredCreateFields(body, config.rootKey, config.requiredCreateFields);
550
- await runApiCommand({
1270
+ await runGraphqlMutationCommand({
551
1271
  command: `${config.command}.create`,
552
1272
  runtimeOptions: pickRuntimeOptions(globalOpts),
553
- method: "POST",
554
- path: `/organizations/${encodeURIComponent(organizationId)}/${config.resourcePath}`,
555
- body
1273
+ field: config.resourcePath === "organization_meta_profiles" ? "create_organization_meta_profile" : config.resourcePath === "key_metric_meta_profiles" ? "create_key_metric_meta_profile" : `create_${config.resourcePath.endsWith("s") ? config.resourcePath.slice(0, -1) : config.resourcePath}`,
1274
+ variables: {
1275
+ organization_id: organizationId,
1276
+ params: body[config.rootKey] ?? body
1277
+ }
556
1278
  });
557
1279
  });
558
- entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", "JSON object, optionally wrapped with root key").action(async (opts, cmd) => {
559
- const id = idSchema2.parse(opts.id);
1280
+ entityCommand.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp5).action(async (opts, cmd) => {
1281
+ const id = idSchema.parse(opts.id);
560
1282
  const globalOpts = cmd.optsWithGlobals();
561
1283
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
562
1284
  const body = normalizeBody(String(opts.dataJson), config.rootKey);
563
- await runApiCommand({
1285
+ const singular = config.resourcePath === "organization_meta_profiles" ? "organization_meta_profile" : config.resourcePath === "key_metric_meta_profiles" ? "key_metric_meta_profile" : config.resourcePath.endsWith("s") ? config.resourcePath.slice(0, -1) : config.resourcePath;
1286
+ await runGraphqlMutationCommand({
564
1287
  command: `${config.command}.update`,
565
1288
  runtimeOptions: pickRuntimeOptions(globalOpts),
566
- method: "PATCH",
567
- path: `/organizations/${encodeURIComponent(organizationId)}/${config.resourcePath}/${encodeURIComponent(id)}`,
568
- body
1289
+ field: `update_${singular}`,
1290
+ variables: {
1291
+ organization_id: organizationId,
1292
+ [`${singular}_id`]: id,
1293
+ params: body[config.rootKey] ?? body
1294
+ }
569
1295
  });
570
1296
  });
571
1297
  }
572
1298
  var __testables = {
573
1299
  parseJsonObject,
574
1300
  normalizeBody,
575
- assertRequiredCreateFields
1301
+ assertRequiredCreateFields,
1302
+ parseQueryJson
576
1303
  };
577
1304
 
1305
+ // src/commands/tasks.ts
1306
+ var projectIdSchema = z3.string().min(1);
1307
+ var idSchema2 = z3.string().min(1);
1308
+ var summarySchema = z3.string().min(1);
1309
+ function registerTaskCommands(program) {
1310
+ const tasks = program.command("tasks").description("Task operations");
1311
+ 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 globalOpts = cmd.optsWithGlobals();
1313
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1314
+ const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
1315
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1316
+ await runGraphqlQueryCommand({
1317
+ command: "tasks.list",
1318
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1319
+ field: "tasks",
1320
+ variables: normalizeGraphqlVariables({
1321
+ organization_id: organizationId,
1322
+ page: opts.page,
1323
+ per: opts.per,
1324
+ project_id: projectId,
1325
+ team_id: opts.teamId,
1326
+ team_ids: opts.teamIds,
1327
+ member_id: opts.memberId,
1328
+ meeting_id: opts.meetingId,
1329
+ field_name: opts.fieldName,
1330
+ field_value: opts.fieldValue,
1331
+ field_blank: opts.fieldBlank,
1332
+ rank_direction: opts.rankDirection,
1333
+ include_archived: opts.includeArchived,
1334
+ ...extra
1335
+ }),
1336
+ isList: true
1337
+ });
1338
+ });
1339
+ tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
1340
+ const parsed = idSchema2.parse(opts.id);
1341
+ const globalOpts = cmd.optsWithGlobals();
1342
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1343
+ await runGraphqlQueryCommand({
1344
+ command: "tasks.show",
1345
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1346
+ field: "task",
1347
+ variables: {
1348
+ organization_id: organizationId,
1349
+ id: parsed
1350
+ },
1351
+ isShow: true
1352
+ });
1353
+ });
1354
+ tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
1355
+ const projectId = projectIdSchema.parse(opts.projectId);
1356
+ const summary = summarySchema.parse(opts.summary ?? opts.title);
1357
+ const globalOpts = cmd.optsWithGlobals();
1358
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1359
+ await runGraphqlMutationCommand({
1360
+ command: "tasks.create",
1361
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1362
+ field: "create_task",
1363
+ variables: {
1364
+ organization_id: organizationId,
1365
+ params: {
1366
+ project_id: projectId,
1367
+ summary
1368
+ }
1369
+ }
1370
+ });
1371
+ });
1372
+ 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
+ const id = idSchema2.parse(opts.id);
1374
+ const globalOpts = cmd.optsWithGlobals();
1375
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1376
+ const taskPayload = {
1377
+ ...opts.summary ? { summary: String(opts.summary) } : {},
1378
+ ...opts.description ? { description: String(opts.description) } : {},
1379
+ ...opts.status ? { status: String(opts.status) } : {},
1380
+ ...opts.priority ? { priority: String(opts.priority) } : {},
1381
+ ...opts.dueDate ? { due_date: String(opts.dueDate) } : {},
1382
+ ...opts.memberId ? { member_id: String(opts.memberId) } : {}
1383
+ };
1384
+ if (Object.keys(taskPayload).length === 0) {
1385
+ throw new CliError({
1386
+ message: "tasks update requires at least one patch field (summary, description, status, priority, due-date, member-id).",
1387
+ kind: "invalid_args",
1388
+ status: 400,
1389
+ exitCode: EXIT_CODES.invalidArgs
1390
+ });
1391
+ }
1392
+ await runGraphqlMutationCommand({
1393
+ command: "tasks.update",
1394
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1395
+ field: "update_task",
1396
+ variables: {
1397
+ organization_id: organizationId,
1398
+ task_id: id,
1399
+ params: taskPayload
1400
+ }
1401
+ });
1402
+ });
1403
+ }
1404
+
578
1405
  // src/commands/projects.ts
1406
+ import { z as z4 } from "zod";
579
1407
  var idSchema3 = z4.string().min(1);
1408
+ var projectCreateDataJsonHelp = buildDataJsonHelp("project", "create") ?? 'JSON object for project or {"project": {...}}';
1409
+ var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON object for project or {"project": {...}}';
580
1410
  function registerProjectCommands(program) {
581
1411
  const projects = program.command("projects").description("Project operations");
582
- projects.command("list").action(async (_opts, cmd) => {
1412
+ 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) => {
583
1413
  const globalOpts = cmd.optsWithGlobals();
584
1414
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
585
- await runApiCommand({
1415
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1416
+ await runGraphqlQueryCommand({
586
1417
  command: "projects.list",
587
1418
  runtimeOptions: pickRuntimeOptions(globalOpts),
588
- method: "GET",
589
- path: `/organizations/${encodeURIComponent(organizationId)}/projects`
1419
+ field: "projects",
1420
+ variables: normalizeGraphqlVariables({
1421
+ organization_id: organizationId,
1422
+ page: opts.page,
1423
+ per: opts.per,
1424
+ include_archived: opts.includeArchived,
1425
+ status: opts.status,
1426
+ term: opts.term,
1427
+ team_ids: opts.teamIds,
1428
+ member_id: opts.memberId,
1429
+ ...extra
1430
+ }),
1431
+ isList: true
590
1432
  });
591
1433
  });
592
1434
  projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
593
1435
  const id = idSchema3.parse(opts.id);
594
1436
  const globalOpts = cmd.optsWithGlobals();
595
1437
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
596
- await runApiCommand({
1438
+ await runGraphqlQueryCommand({
597
1439
  command: "projects.show",
598
1440
  runtimeOptions: pickRuntimeOptions(globalOpts),
599
- method: "GET",
600
- path: `/organizations/${encodeURIComponent(organizationId)}/projects/${encodeURIComponent(id)}`
1441
+ field: "project",
1442
+ variables: {
1443
+ organization_id: organizationId,
1444
+ id
1445
+ },
1446
+ isShow: true
601
1447
  });
602
1448
  });
603
- projects.command("create").requiredOption("--data-json <dataJson>", 'JSON object for project or {"project": {...}}').action(async (opts, cmd) => {
1449
+ projects.command("create").requiredOption("--data-json <dataJson>", projectCreateDataJsonHelp).action(async (opts, cmd) => {
604
1450
  const globalOpts = cmd.optsWithGlobals();
605
1451
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
606
1452
  const body = __testables.normalizeBody(String(opts.dataJson), "project");
607
- await runApiCommand({
1453
+ await runGraphqlMutationCommand({
608
1454
  command: "projects.create",
609
1455
  runtimeOptions: pickRuntimeOptions(globalOpts),
610
- method: "POST",
611
- path: `/organizations/${encodeURIComponent(organizationId)}/projects`,
612
- body
1456
+ field: "create_project",
1457
+ variables: {
1458
+ organization_id: organizationId,
1459
+ params: body.project ?? body
1460
+ }
613
1461
  });
614
1462
  });
615
- projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for project or {"project": {...}}').action(async (opts, cmd) => {
1463
+ projects.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", projectUpdateDataJsonHelp).action(async (opts, cmd) => {
616
1464
  const id = idSchema3.parse(opts.id);
617
1465
  const globalOpts = cmd.optsWithGlobals();
618
1466
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
619
1467
  const body = __testables.normalizeBody(String(opts.dataJson), "project");
620
- await runApiCommand({
1468
+ await runGraphqlMutationCommand({
621
1469
  command: "projects.update",
622
1470
  runtimeOptions: pickRuntimeOptions(globalOpts),
623
- method: "PATCH",
624
- path: `/organizations/${encodeURIComponent(organizationId)}/projects/${encodeURIComponent(id)}`,
625
- body
1471
+ field: "update_project",
1472
+ variables: {
1473
+ organization_id: organizationId,
1474
+ project_id: id,
1475
+ params: body.project ?? body
1476
+ }
626
1477
  });
627
1478
  });
628
1479
  }
@@ -632,28 +1483,53 @@ import { z as z5 } from "zod";
632
1483
  var idSchema4 = z5.string().min(1);
633
1484
  var rockCollectionIdSchema = z5.string().min(1);
634
1485
  var statusSchema = z5.enum(["on_track", "at_risk", "off_track"]);
1486
+ var createHelp = buildDataJsonHelp("rock", "create") ?? 'JSON object for rock or {"rock": {...}}';
1487
+ var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or {"rock": {...}}';
635
1488
  function registerRockCommands(program) {
636
1489
  const rocks = program.command("rocks").description("Rock operations");
637
- rocks.command("list").option("--rock-collection-id <rockCollectionId>").action(async (opts, cmd) => {
1490
+ 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) => {
638
1491
  const globalOpts = cmd.optsWithGlobals();
639
1492
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
640
1493
  const rockCollectionId = opts.rockCollectionId ? rockCollectionIdSchema.parse(opts.rockCollectionId) : void 0;
641
- await runApiCommand({
1494
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1495
+ await runGraphqlQueryCommand({
642
1496
  command: "rocks.list",
643
1497
  runtimeOptions: pickRuntimeOptions(globalOpts),
644
- method: "GET",
645
- path: rockCollectionId ? `/organizations/${encodeURIComponent(organizationId)}/rocks?rock_collection_id=${encodeURIComponent(rockCollectionId)}` : `/organizations/${encodeURIComponent(organizationId)}/rocks`
1498
+ field: "rocks",
1499
+ variables: normalizeGraphqlVariables({
1500
+ organization_id: organizationId,
1501
+ page: opts.page,
1502
+ per: opts.per,
1503
+ rock_collection_id: rockCollectionId,
1504
+ team_id: opts.teamId,
1505
+ team_ids: opts.teamIds,
1506
+ member_id: opts.memberId,
1507
+ meeting_id: opts.meetingId,
1508
+ annual_objective_id: opts.annualObjectiveId,
1509
+ quarterly_objective_id: opts.quarterlyObjectiveId,
1510
+ field_name: opts.fieldName,
1511
+ field_value: opts.fieldValue,
1512
+ field_blank: opts.fieldBlank,
1513
+ rank_direction: opts.rankDirection,
1514
+ include_archived: opts.includeArchived,
1515
+ ...extra
1516
+ }),
1517
+ isList: true
646
1518
  });
647
1519
  });
648
1520
  rocks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
649
1521
  const id = idSchema4.parse(opts.id);
650
1522
  const globalOpts = cmd.optsWithGlobals();
651
1523
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
652
- await runApiCommand({
1524
+ await runGraphqlQueryCommand({
653
1525
  command: "rocks.show",
654
1526
  runtimeOptions: pickRuntimeOptions(globalOpts),
655
- method: "GET",
656
- path: `/organizations/${encodeURIComponent(organizationId)}/rocks/${encodeURIComponent(id)}`
1527
+ field: "rock",
1528
+ variables: {
1529
+ organization_id: organizationId,
1530
+ id
1531
+ },
1532
+ isShow: true
657
1533
  });
658
1534
  });
659
1535
  rocks.command("update-status").requiredOption("--id <id>").requiredOption("--status <status>").action(async (opts, cmd) => {
@@ -661,38 +1537,46 @@ function registerRockCommands(program) {
661
1537
  const status = statusSchema.parse(opts.status);
662
1538
  const globalOpts = cmd.optsWithGlobals();
663
1539
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
664
- await runApiCommand({
1540
+ await runGraphqlMutationCommand({
665
1541
  command: "rocks.update-status",
666
1542
  runtimeOptions: pickRuntimeOptions(globalOpts),
667
- method: "PATCH",
668
- path: `/organizations/${encodeURIComponent(organizationId)}/rocks/${encodeURIComponent(id)}`,
669
- body: { rock: { status } }
1543
+ field: "update_rock",
1544
+ variables: {
1545
+ organization_id: organizationId,
1546
+ rock_id: id,
1547
+ params: { status }
1548
+ }
670
1549
  });
671
1550
  });
672
- rocks.command("create").requiredOption("--data-json <dataJson>", 'JSON object for rock or {"rock": {...}}').action(async (opts, cmd) => {
1551
+ rocks.command("create").requiredOption("--data-json <dataJson>", createHelp).action(async (opts, cmd) => {
673
1552
  const globalOpts = cmd.optsWithGlobals();
674
1553
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
675
1554
  const body = __testables.normalizeBody(String(opts.dataJson), "rock");
676
1555
  __testables.assertRequiredCreateFields(body, "rock", ["rock_collection_id"]);
677
- await runApiCommand({
1556
+ await runGraphqlMutationCommand({
678
1557
  command: "rocks.create",
679
1558
  runtimeOptions: pickRuntimeOptions(globalOpts),
680
- method: "POST",
681
- path: `/organizations/${encodeURIComponent(organizationId)}/rocks`,
682
- body
1559
+ field: "create_rock",
1560
+ variables: {
1561
+ organization_id: organizationId,
1562
+ params: body.rock ?? body
1563
+ }
683
1564
  });
684
1565
  });
685
- rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for rock or {"rock": {...}}').action(async (opts, cmd) => {
1566
+ rocks.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp).action(async (opts, cmd) => {
686
1567
  const id = idSchema4.parse(opts.id);
687
1568
  const globalOpts = cmd.optsWithGlobals();
688
1569
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
689
1570
  const body = __testables.normalizeBody(String(opts.dataJson), "rock");
690
- await runApiCommand({
1571
+ await runGraphqlMutationCommand({
691
1572
  command: "rocks.update",
692
1573
  runtimeOptions: pickRuntimeOptions(globalOpts),
693
- method: "PATCH",
694
- path: `/organizations/${encodeURIComponent(organizationId)}/rocks/${encodeURIComponent(id)}`,
695
- body
1574
+ field: "update_rock",
1575
+ variables: {
1576
+ organization_id: organizationId,
1577
+ rock_id: id,
1578
+ params: body.rock ?? body
1579
+ }
696
1580
  });
697
1581
  });
698
1582
  }
@@ -701,17 +1585,45 @@ function registerRockCommands(program) {
701
1585
  import { z as z6 } from "zod";
702
1586
  var idSchema5 = z6.string().min(1);
703
1587
  var notesSchema = z6.string().min(1);
1588
+ var createHelp2 = buildDataJsonHelp("meeting", "create") ?? 'JSON object for meeting or {"meeting": {...}}';
1589
+ var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for meeting or {"meeting": {...}}';
704
1590
  function registerMeetingCommands(program) {
705
1591
  const meetings = program.command("meetings").description("Meeting operations");
1592
+ 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 globalOpts = cmd.optsWithGlobals();
1594
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1595
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1596
+ await runGraphqlQueryCommand({
1597
+ command: "meetings.list",
1598
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1599
+ field: "meetings",
1600
+ variables: normalizeGraphqlVariables({
1601
+ organization_id: organizationId,
1602
+ per: opts.per,
1603
+ date: opts.date,
1604
+ occurrence_date: opts.occurrenceDate,
1605
+ past: opts.past,
1606
+ start_time: opts.startTime,
1607
+ today_and_active: opts.todayAndActive,
1608
+ upcoming: opts.upcoming,
1609
+ ...extra
1610
+ }),
1611
+ isList: true
1612
+ });
1613
+ });
706
1614
  meetings.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
707
1615
  const id = idSchema5.parse(opts.id);
708
1616
  const globalOpts = cmd.optsWithGlobals();
709
1617
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
710
- await runApiCommand({
1618
+ await runGraphqlQueryCommand({
711
1619
  command: "meetings.show",
712
1620
  runtimeOptions: pickRuntimeOptions(globalOpts),
713
- method: "GET",
714
- path: `/organizations/${encodeURIComponent(organizationId)}/meetings/${encodeURIComponent(id)}`
1621
+ field: "meeting",
1622
+ variables: {
1623
+ organization_id: organizationId,
1624
+ id
1625
+ },
1626
+ isShow: true
715
1627
  });
716
1628
  });
717
1629
  meetings.command("notes").requiredOption("--id <id>").requiredOption("--content <content>").action(async (opts, cmd) => {
@@ -719,41 +1631,47 @@ function registerMeetingCommands(program) {
719
1631
  const notes = notesSchema.parse(opts.content);
720
1632
  const globalOpts = cmd.optsWithGlobals();
721
1633
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
722
- await runApiCommand({
1634
+ await runGraphqlMutationCommand({
723
1635
  command: "meeting-notes.create",
724
1636
  runtimeOptions: pickRuntimeOptions(globalOpts),
725
- method: "PATCH",
726
- path: `/organizations/${encodeURIComponent(organizationId)}/meetings/${encodeURIComponent(id)}`,
727
- body: {
728
- meeting: {
1637
+ field: "update_meeting",
1638
+ variables: {
1639
+ organization_id: organizationId,
1640
+ meeting_id: id,
1641
+ params: {
729
1642
  notes
730
1643
  }
731
1644
  }
732
1645
  });
733
1646
  });
734
- meetings.command("create").requiredOption("--data-json <dataJson>", 'JSON object for meeting or {"meeting": {...}}').action(async (opts, cmd) => {
1647
+ meetings.command("create").requiredOption("--data-json <dataJson>", createHelp2).action(async (opts, cmd) => {
735
1648
  const globalOpts = cmd.optsWithGlobals();
736
1649
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
737
1650
  const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
738
- await runApiCommand({
1651
+ await runGraphqlMutationCommand({
739
1652
  command: "meetings.create",
740
1653
  runtimeOptions: pickRuntimeOptions(globalOpts),
741
- method: "POST",
742
- path: `/organizations/${encodeURIComponent(organizationId)}/meetings`,
743
- body
1654
+ field: "create_meeting",
1655
+ variables: {
1656
+ organization_id: organizationId,
1657
+ params: body.meeting ?? body
1658
+ }
744
1659
  });
745
1660
  });
746
- meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for meeting or {"meeting": {...}}').action(async (opts, cmd) => {
1661
+ meetings.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp2).action(async (opts, cmd) => {
747
1662
  const id = idSchema5.parse(opts.id);
748
1663
  const globalOpts = cmd.optsWithGlobals();
749
1664
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
750
1665
  const body = __testables.normalizeBody(String(opts.dataJson), "meeting");
751
- await runApiCommand({
1666
+ await runGraphqlMutationCommand({
752
1667
  command: "meetings.update",
753
1668
  runtimeOptions: pickRuntimeOptions(globalOpts),
754
- method: "PATCH",
755
- path: `/organizations/${encodeURIComponent(organizationId)}/meetings/${encodeURIComponent(id)}`,
756
- body
1669
+ field: "update_meeting",
1670
+ variables: {
1671
+ organization_id: organizationId,
1672
+ meeting_id: id,
1673
+ params: body.meeting ?? body
1674
+ }
757
1675
  });
758
1676
  });
759
1677
  }
@@ -761,52 +1679,70 @@ function registerMeetingCommands(program) {
761
1679
  // src/commands/members.ts
762
1680
  import { z as z7 } from "zod";
763
1681
  var idSchema6 = z7.string().min(1);
1682
+ var createHelp3 = buildDataJsonHelp("member", "create") ?? 'JSON object for member or {"member": {...}}';
1683
+ var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for member or {"member": {...}}';
764
1684
  function registerMemberCommands(program) {
765
1685
  const members = program.command("members").description("Member operations");
766
- members.command("list").action(async (_opts, cmd) => {
1686
+ members.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
767
1687
  const globalOpts = cmd.optsWithGlobals();
768
1688
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
769
- await runApiCommand({
1689
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1690
+ await runGraphqlQueryCommand({
770
1691
  command: "members.list",
771
1692
  runtimeOptions: pickRuntimeOptions(globalOpts),
772
- method: "GET",
773
- path: `/organizations/${encodeURIComponent(organizationId)}/members`
1693
+ field: "members",
1694
+ variables: normalizeGraphqlVariables({
1695
+ organization_id: organizationId,
1696
+ page: opts.page,
1697
+ per: opts.per,
1698
+ ...extra
1699
+ }),
1700
+ isList: true
774
1701
  });
775
1702
  });
776
1703
  members.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
777
1704
  const id = idSchema6.parse(opts.id);
778
1705
  const globalOpts = cmd.optsWithGlobals();
779
1706
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
780
- await runApiCommand({
1707
+ await runGraphqlQueryCommand({
781
1708
  command: "members.show",
782
1709
  runtimeOptions: pickRuntimeOptions(globalOpts),
783
- method: "GET",
784
- path: `/organizations/${encodeURIComponent(organizationId)}/members/${encodeURIComponent(id)}`
1710
+ field: "member",
1711
+ variables: {
1712
+ organization_id: organizationId,
1713
+ id
1714
+ },
1715
+ isShow: true
785
1716
  });
786
1717
  });
787
- members.command("create").requiredOption("--data-json <dataJson>", 'JSON object for member or {"member": {...}}').action(async (opts, cmd) => {
1718
+ members.command("create").requiredOption("--data-json <dataJson>", createHelp3).action(async (opts, cmd) => {
788
1719
  const globalOpts = cmd.optsWithGlobals();
789
1720
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
790
1721
  const body = __testables.normalizeBody(String(opts.dataJson), "member");
791
- await runApiCommand({
1722
+ await runGraphqlMutationCommand({
792
1723
  command: "members.create",
793
1724
  runtimeOptions: pickRuntimeOptions(globalOpts),
794
- method: "POST",
795
- path: `/organizations/${encodeURIComponent(organizationId)}/members`,
796
- body
1725
+ field: "create_member",
1726
+ variables: {
1727
+ organization_id: organizationId,
1728
+ params: body.member ?? body
1729
+ }
797
1730
  });
798
1731
  });
799
- members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for member or {"member": {...}}').action(async (opts, cmd) => {
1732
+ members.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp3).action(async (opts, cmd) => {
800
1733
  const id = idSchema6.parse(opts.id);
801
1734
  const globalOpts = cmd.optsWithGlobals();
802
1735
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
803
1736
  const body = __testables.normalizeBody(String(opts.dataJson), "member");
804
- await runApiCommand({
1737
+ await runGraphqlMutationCommand({
805
1738
  command: "members.update",
806
1739
  runtimeOptions: pickRuntimeOptions(globalOpts),
807
- method: "PATCH",
808
- path: `/organizations/${encodeURIComponent(organizationId)}/members/${encodeURIComponent(id)}`,
809
- body
1740
+ field: "update_member",
1741
+ variables: {
1742
+ organization_id: organizationId,
1743
+ member_id: id,
1744
+ params: body.member ?? body
1745
+ }
810
1746
  });
811
1747
  });
812
1748
  }
@@ -817,21 +1753,61 @@ var issueGroupIdSchema = z8.string().min(1);
817
1753
  var idSchema7 = z8.string().min(1);
818
1754
  var nameSchema = z8.string().min(1);
819
1755
  var issueTypeSchema = z8.string().min(1);
1756
+ var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue or {"issue": {...}}';
820
1757
  function registerIssueCommands(program) {
821
1758
  const issues = program.command("issues").description("Issue operations");
1759
+ 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 globalOpts = cmd.optsWithGlobals();
1761
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1762
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
1763
+ await runGraphqlQueryCommand({
1764
+ command: "issues.list",
1765
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1766
+ field: "issues",
1767
+ variables: normalizeGraphqlVariables({
1768
+ organization_id: organizationId,
1769
+ page: opts.page,
1770
+ per: opts.per,
1771
+ issue_group_id: opts.issueGroupId,
1772
+ team_id: opts.teamId,
1773
+ team_ids: opts.teamIds,
1774
+ member_id: opts.memberId,
1775
+ meeting_id: opts.meetingId,
1776
+ rank_direction: opts.rankDirection,
1777
+ include_archived: opts.includeArchived,
1778
+ ...extra
1779
+ }),
1780
+ isList: true
1781
+ });
1782
+ });
1783
+ issues.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
1784
+ const id = idSchema7.parse(opts.id);
1785
+ const globalOpts = cmd.optsWithGlobals();
1786
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
1787
+ await runGraphqlQueryCommand({
1788
+ command: "issues.show",
1789
+ runtimeOptions: pickRuntimeOptions(globalOpts),
1790
+ field: "issue",
1791
+ variables: {
1792
+ organization_id: organizationId,
1793
+ id
1794
+ },
1795
+ isShow: true
1796
+ });
1797
+ });
822
1798
  issues.command("create").requiredOption("--issue-group-id <issueGroupId>").requiredOption("--name <name>").requiredOption("--issue-type <issueType>").option("--status <status>").option("--priority <priority>").option("--description <description>").option("--due-by <dueBy>").option("--member-id <memberId>").action(async (opts, cmd) => {
823
1799
  const issueGroupId = issueGroupIdSchema.parse(opts.issueGroupId);
824
1800
  const name = nameSchema.parse(opts.name);
825
1801
  const issueType = issueTypeSchema.parse(opts.issueType);
826
1802
  const globalOpts = cmd.optsWithGlobals();
827
1803
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
828
- await runApiCommand({
1804
+ await runGraphqlMutationCommand({
829
1805
  command: "issues.create",
830
1806
  runtimeOptions: pickRuntimeOptions(globalOpts),
831
- method: "POST",
832
- path: `/organizations/${encodeURIComponent(organizationId)}/issues`,
833
- body: {
834
- issue: {
1807
+ field: "create_issue",
1808
+ variables: {
1809
+ organization_id: organizationId,
1810
+ params: {
835
1811
  issue_group_id: issueGroupId,
836
1812
  name,
837
1813
  issue_type: issueType,
@@ -844,17 +1820,20 @@ function registerIssueCommands(program) {
844
1820
  }
845
1821
  });
846
1822
  });
847
- issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for issue or {"issue": {...}}').action(async (opts, cmd) => {
1823
+ issues.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", updateHelp4).action(async (opts, cmd) => {
848
1824
  const id = idSchema7.parse(opts.id);
849
1825
  const globalOpts = cmd.optsWithGlobals();
850
1826
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
851
1827
  const body = __testables.normalizeBody(String(opts.dataJson), "issue");
852
- await runApiCommand({
1828
+ await runGraphqlMutationCommand({
853
1829
  command: "issues.update",
854
1830
  runtimeOptions: pickRuntimeOptions(globalOpts),
855
- method: "PATCH",
856
- path: `/organizations/${encodeURIComponent(organizationId)}/issues/${encodeURIComponent(id)}`,
857
- body
1831
+ field: "update_issue",
1832
+ variables: {
1833
+ organization_id: organizationId,
1834
+ issue_id: id,
1835
+ params: body.issue ?? body
1836
+ }
858
1837
  });
859
1838
  });
860
1839
  }
@@ -865,124 +1844,480 @@ function registerSystemToolCommands(program) {
865
1844
  command: "lists",
866
1845
  description: "List operations",
867
1846
  resourcePath: "lists",
868
- rootKey: "list"
1847
+ rootKey: "list",
1848
+ listParams: ["include_archived", "member_id", "team_ids", "term"]
869
1849
  });
870
1850
  registerEntityCrudCommands(program, {
871
1851
  command: "list-items",
872
1852
  description: "List item operations",
873
1853
  resourcePath: "list_items",
874
1854
  rootKey: "list_item",
875
- requiredCreateFields: ["list_id"]
1855
+ requiredCreateFields: ["list_id"],
1856
+ listParams: [
1857
+ "field_blank",
1858
+ "field_name",
1859
+ "field_value",
1860
+ "include_archived",
1861
+ "list_id",
1862
+ "meeting_id",
1863
+ "member_id",
1864
+ "rank_direction",
1865
+ "team_id",
1866
+ "team_ids"
1867
+ ]
876
1868
  });
877
1869
  registerEntityCrudCommands(program, {
878
1870
  command: "issue-groups",
879
1871
  description: "Issue group operations",
880
1872
  resourcePath: "issue_groups",
881
- rootKey: "issue_group"
1873
+ rootKey: "issue_group",
1874
+ listParams: ["include_archived", "member_id", "team_ids", "term"]
882
1875
  });
883
1876
  registerEntityCrudCommands(program, {
884
1877
  command: "todo-groups",
885
1878
  description: "To-do group operations",
886
1879
  resourcePath: "todo_groups",
887
- rootKey: "todo_group"
1880
+ rootKey: "todo_group",
1881
+ listParams: ["include_archived", "member_id", "team_ids", "term"]
888
1882
  });
889
1883
  registerEntityCrudCommands(program, {
890
1884
  command: "todos",
891
1885
  description: "To-do operations",
892
1886
  resourcePath: "todos",
893
1887
  rootKey: "todo",
894
- requiredCreateFields: ["todo_group_id"]
1888
+ requiredCreateFields: ["todo_group_id"],
1889
+ listParams: [
1890
+ "include_archived",
1891
+ "meeting_id",
1892
+ "member_id",
1893
+ "rank_direction",
1894
+ "team_id",
1895
+ "team_ids",
1896
+ "todo_group_id"
1897
+ ]
895
1898
  });
896
1899
  registerEntityCrudCommands(program, {
897
1900
  command: "rock-collections",
898
1901
  description: "Rock collection operations",
899
1902
  resourcePath: "rock_collections",
900
- rootKey: "rock_collection"
1903
+ rootKey: "rock_collection",
1904
+ listParams: ["include_archived", "member_id", "sort", "team_ids", "term"]
901
1905
  });
902
1906
  registerEntityCrudCommands(program, {
903
1907
  command: "knowledge",
904
1908
  description: "Knowledge content operations",
905
1909
  resourcePath: "contents",
906
- rootKey: "content"
1910
+ rootKey: "content",
1911
+ listParams: [
1912
+ "assigned",
1913
+ "contentable_id",
1914
+ "contentable_type",
1915
+ "include_all_rollups",
1916
+ "include_completed",
1917
+ "member_id",
1918
+ "parent_content_id",
1919
+ "team_id"
1920
+ ]
907
1921
  });
908
1922
  registerEntityCrudCommands(program, {
909
1923
  command: "stand-ups",
910
1924
  description: "Stand-up operations",
911
1925
  resourcePath: "stand_ups",
912
- rootKey: "stand_up"
1926
+ rootKey: "stand_up",
1927
+ listParams: [
1928
+ "compare_end_date",
1929
+ "compare_start_date",
1930
+ "date",
1931
+ "end_date",
1932
+ "start_date",
1933
+ "use_week_range"
1934
+ ]
913
1935
  });
914
1936
  registerEntityCrudCommands(program, {
915
1937
  command: "news",
916
1938
  description: "News operations",
917
1939
  resourcePath: "headlines",
918
- rootKey: "headline"
1940
+ rootKey: "headline",
1941
+ listParams: ["meeting_id", "unread"]
919
1942
  });
920
1943
  registerEntityCrudCommands(program, {
921
1944
  command: "questions",
922
1945
  description: "Q&A forum operations",
923
1946
  resourcePath: "questions",
924
- rootKey: "question"
1947
+ rootKey: "question",
1948
+ listParams: ["answered", "asked", "member_id", "team_id", "term"]
925
1949
  });
926
1950
  registerEntityCrudCommands(program, {
927
1951
  command: "pulse",
928
1952
  description: "Pulse operations",
929
1953
  resourcePath: "health_updates",
930
- rootKey: "health_update"
1954
+ rootKey: "health_update",
1955
+ listParams: ["health_updatable_id", "health_updatable_type"]
931
1956
  });
932
1957
  registerEntityCrudCommands(program, {
933
1958
  command: "surveys",
934
1959
  description: "Survey operations",
935
1960
  resourcePath: "surveys",
936
- rootKey: "survey"
1961
+ rootKey: "survey",
1962
+ listParams: ["completed", "current_member", "due", "exclude_completed"]
1963
+ });
1964
+ registerEntityCrudCommands(program, {
1965
+ command: "feedbacks",
1966
+ description: "Feedback operations",
1967
+ resourcePath: "feedback",
1968
+ rootKey: "feedback",
1969
+ listParams: ["last", "latest", "start_date"]
937
1970
  });
938
1971
  registerEntityCrudCommands(program, {
939
1972
  command: "accountability",
940
1973
  description: "Accountability operations",
941
1974
  resourcePath: "responsibilities",
942
- rootKey: "responsibility"
1975
+ rootKey: "responsibility",
1976
+ listParams: ["meeting_id", "term"]
943
1977
  });
944
1978
  registerEntityCrudCommands(program, {
945
1979
  command: "kpis",
946
1980
  description: "KPI operations",
947
1981
  resourcePath: "smart_kpis",
948
- rootKey: "smart_kpi"
1982
+ rootKey: "smart_kpi",
1983
+ listParams: [
1984
+ "annual_objective_id",
1985
+ "include_archived",
1986
+ "interval",
1987
+ "meeting_id",
1988
+ "member_id",
1989
+ "quarterly_objective_id",
1990
+ "smart_kpi_view_id",
1991
+ "team_id",
1992
+ "team_ids"
1993
+ ]
949
1994
  });
950
1995
  registerEntityCrudCommands(program, {
951
1996
  command: "scorecard-groups",
952
1997
  description: "Scorecard group operations",
953
1998
  resourcePath: "measurable_groups",
954
- rootKey: "measurable_group"
1999
+ rootKey: "measurable_group",
2000
+ listParams: ["include_archived", "member_id", "name", "sort", "team_ids", "term"]
955
2001
  });
956
2002
  registerEntityCrudCommands(program, {
957
2003
  command: "scorecards",
958
2004
  description: "Scorecard item operations",
959
2005
  resourcePath: "measurables",
960
2006
  rootKey: "measurable",
961
- requiredCreateFields: ["measurable_group_id"]
2007
+ requiredCreateFields: ["measurable_group_id"],
2008
+ listParams: [
2009
+ "annual_objective_id",
2010
+ "include_archived",
2011
+ "interval",
2012
+ "measurable_group_id",
2013
+ "meeting_id",
2014
+ "member_id",
2015
+ "quarterly_objective_id",
2016
+ "sort",
2017
+ "team_id",
2018
+ "team_ids"
2019
+ ]
962
2020
  });
963
2021
  registerEntityCrudCommands(program, {
964
2022
  command: "customers",
965
2023
  description: "CRM customer operations",
966
2024
  resourcePath: "customers",
967
- rootKey: "customer"
2025
+ rootKey: "customer",
2026
+ listParams: ["member_id", "status", "term"]
968
2027
  });
969
2028
  registerEntityCrudCommands(program, {
970
2029
  command: "contacts",
971
2030
  description: "CRM contact operations",
972
2031
  resourcePath: "contacts",
973
- rootKey: "contact"
2032
+ rootKey: "contact",
2033
+ listParams: ["customer_id", "member_id", "status", "term"]
974
2034
  });
975
- registerEntityCrudCommands(program, {
2035
+ }
2036
+
2037
+ // src/commands/teams.ts
2038
+ import { z as z9 } from "zod";
2039
+ var idSchema8 = z9.string().min(1);
2040
+ function registerTeamCommands(program) {
2041
+ const teams = program.command("teams").description("Team operations");
2042
+ teams.command("list").option("--page <page>").option("--per <per>").option("--query-json <queryJson>").action(async (opts, cmd) => {
2043
+ const globalOpts = cmd.optsWithGlobals();
2044
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2045
+ const extra = parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0);
2046
+ await runGraphqlQueryCommand({
2047
+ command: "teams.list",
2048
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2049
+ field: "teams",
2050
+ variables: normalizeGraphqlVariables({
2051
+ organization_id: organizationId,
2052
+ page: opts.page,
2053
+ per: opts.per,
2054
+ ...extra
2055
+ }),
2056
+ isList: true
2057
+ });
2058
+ });
2059
+ teams.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
2060
+ const id = idSchema8.parse(opts.id);
2061
+ const globalOpts = cmd.optsWithGlobals();
2062
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2063
+ await runGraphqlQueryCommand({
2064
+ command: "teams.show",
2065
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2066
+ field: "team",
2067
+ variables: {
2068
+ organization_id: organizationId,
2069
+ id
2070
+ },
2071
+ isShow: true
2072
+ });
2073
+ });
2074
+ teams.command("create").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
2075
+ const globalOpts = cmd.optsWithGlobals();
2076
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2077
+ const body = __testables.normalizeBody(String(opts.dataJson), "team");
2078
+ await runGraphqlMutationCommand({
2079
+ command: "teams.create",
2080
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2081
+ field: "create_team",
2082
+ variables: {
2083
+ organization_id: organizationId,
2084
+ params: body.team ?? body
2085
+ }
2086
+ });
2087
+ });
2088
+ teams.command("update").requiredOption("--id <id>").requiredOption("--data-json <dataJson>", 'JSON object for team or {"team": {...}}').action(async (opts, cmd) => {
2089
+ const id = idSchema8.parse(opts.id);
2090
+ const globalOpts = cmd.optsWithGlobals();
2091
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2092
+ const body = __testables.normalizeBody(String(opts.dataJson), "team");
2093
+ await runGraphqlMutationCommand({
2094
+ command: "teams.update",
2095
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2096
+ field: "update_team",
2097
+ variables: {
2098
+ organization_id: organizationId,
2099
+ team_id: id,
2100
+ params: body.team ?? body
2101
+ }
2102
+ });
2103
+ });
2104
+ }
2105
+
2106
+ // src/commands/organizations.ts
2107
+ import { z as z10 } from "zod";
2108
+ var idSchema9 = z10.string().min(1);
2109
+ function registerOrganizationCommands(program) {
2110
+ const organizations = program.command("organizations").description("Organization operations");
2111
+ organizations.command("show").option("--id <id>", "Organization ID (defaults to resolved organization context)").action(async (opts, cmd) => {
2112
+ const globalOpts = cmd.optsWithGlobals();
2113
+ const fallbackId = resolveOrganizationId(globalOpts.organizationId);
2114
+ const id = idSchema9.parse(opts.id ?? fallbackId);
2115
+ await runGraphqlQueryCommand({
2116
+ command: "organizations.show",
2117
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2118
+ field: "organization",
2119
+ variables: { id },
2120
+ isShow: true
2121
+ });
2122
+ });
2123
+ organizations.command("update").option("--id <id>", "Organization ID (defaults to resolved organization context)").requiredOption(
2124
+ "--data-json <dataJson>",
2125
+ 'JSON object for organization or {"organization": {...}}'
2126
+ ).action(async (opts, cmd) => {
2127
+ const globalOpts = cmd.optsWithGlobals();
2128
+ const fallbackId = resolveOrganizationId(globalOpts.organizationId);
2129
+ const id = idSchema9.parse(opts.id ?? fallbackId);
2130
+ const body = __testables.normalizeBody(String(opts.dataJson), "organization");
2131
+ await runGraphqlMutationCommand({
2132
+ command: "organizations.update",
2133
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2134
+ field: "update_organization",
2135
+ variables: {
2136
+ id,
2137
+ params: body.organization ?? body
2138
+ }
2139
+ });
2140
+ });
2141
+ }
2142
+
2143
+ // src/commands/metaProfiles.ts
2144
+ import { z as z11 } from "zod";
2145
+ var idSchema10 = z11.string().min(1);
2146
+ function registerMetaProfileCommands(program) {
2147
+ const organizationMetaProfiles = program.command("organization-meta-profiles").description("Organization meta profile operations");
2148
+ organizationMetaProfiles.command("show").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").action(async (opts, cmd) => {
2149
+ const globalOpts = cmd.optsWithGlobals();
2150
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2151
+ const id = idSchema10.parse(opts.id ?? organizationId);
2152
+ await runGraphqlQueryCommand({
2153
+ command: "organization-meta-profiles.show",
2154
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2155
+ field: "organization_meta_profile",
2156
+ variables: {
2157
+ organization_id: organizationId,
2158
+ id
2159
+ },
2160
+ isShow: true
2161
+ });
2162
+ });
2163
+ organizationMetaProfiles.command("update").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").requiredOption(
2164
+ "--data-json <dataJson>",
2165
+ 'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
2166
+ ).action(async (opts, cmd) => {
2167
+ const globalOpts = cmd.optsWithGlobals();
2168
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2169
+ const id = idSchema10.parse(opts.id ?? organizationId);
2170
+ const body = __testables.normalizeBody(
2171
+ String(opts.dataJson),
2172
+ "organization_meta_profile"
2173
+ );
2174
+ await runGraphqlMutationCommand({
2175
+ command: "organization-meta-profiles.update",
2176
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2177
+ field: "update_organization_meta_profile",
2178
+ variables: {
2179
+ organization_id: organizationId,
2180
+ organization_meta_profile_id: id,
2181
+ params: body.organization_meta_profile ?? body
2182
+ }
2183
+ });
2184
+ });
2185
+ const keyMetricMetaProfiles = program.command("key-metric-meta-profiles").description("Key metric meta profile operations");
2186
+ keyMetricMetaProfiles.command("show").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").action(async (opts, cmd) => {
2187
+ const globalOpts = cmd.optsWithGlobals();
2188
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2189
+ const id = idSchema10.parse(opts.id ?? organizationId);
2190
+ await runGraphqlQueryCommand({
2191
+ command: "key-metric-meta-profiles.show",
2192
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2193
+ field: "key_metric_meta_profile",
2194
+ variables: {
2195
+ organization_id: organizationId,
2196
+ id
2197
+ },
2198
+ isShow: true
2199
+ });
2200
+ });
2201
+ keyMetricMetaProfiles.command("update").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").requiredOption(
2202
+ "--data-json <dataJson>",
2203
+ 'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
2204
+ ).action(async (opts, cmd) => {
2205
+ const globalOpts = cmd.optsWithGlobals();
2206
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2207
+ const id = idSchema10.parse(opts.id ?? organizationId);
2208
+ const body = __testables.normalizeBody(String(opts.dataJson), "key_metric_meta_profile");
2209
+ await runGraphqlMutationCommand({
2210
+ command: "key-metric-meta-profiles.update",
2211
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2212
+ field: "update_key_metric_meta_profile",
2213
+ variables: {
2214
+ organization_id: organizationId,
2215
+ key_metric_meta_profile_id: id,
2216
+ params: body.key_metric_meta_profile ?? body
2217
+ }
2218
+ });
2219
+ });
2220
+ }
2221
+
2222
+ // src/commands/foundation.ts
2223
+ import { z as z12 } from "zod";
2224
+ var idSchema11 = z12.string().min(1);
2225
+ function registerFoundationCommands(program) {
2226
+ const foundation = program.command("foundation").description("Foundation operations");
2227
+ const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
2228
+ const strategicObjectives = foundation.command("strategic-objectives").description("Strategic objective operations");
2229
+ 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) => {
2230
+ const globalOpts = cmd.optsWithGlobals();
2231
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2232
+ const id = idSchema11.parse(opts.id ?? organizationId);
2233
+ await runGraphqlQueryCommand({
2234
+ command: "foundation.strategic-plans.show",
2235
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2236
+ field: "strategic_plan",
2237
+ variables: normalizeGraphqlVariables({
2238
+ organization_id: organizationId,
2239
+ id,
2240
+ progress_scope: opts.progressScope,
2241
+ all_progress: opts.allProgress,
2242
+ all: opts.all
2243
+ }),
2244
+ isShow: true
2245
+ });
2246
+ });
2247
+ strategicPlans.command("update").option("--id <id>", "Strategic plan ID (defaults to organization context)").requiredOption(
2248
+ "--data-json <dataJson>",
2249
+ 'JSON object for strategic_plan or {"strategic_plan": {...}}'
2250
+ ).action(async (opts, cmd) => {
2251
+ const globalOpts = cmd.optsWithGlobals();
2252
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2253
+ const id = idSchema11.parse(opts.id ?? organizationId);
2254
+ const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
2255
+ await runGraphqlMutationCommand({
2256
+ command: "foundation.strategic-plans.update",
2257
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2258
+ field: "update_strategic_plan",
2259
+ variables: {
2260
+ organization_id: organizationId,
2261
+ strategic_plan_id: id,
2262
+ params: body.strategic_plan ?? body
2263
+ }
2264
+ });
2265
+ });
2266
+ 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) => {
2267
+ const globalOpts = cmd.optsWithGlobals();
2268
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2269
+ const id = idSchema11.parse(opts.id ?? organizationId);
2270
+ await runGraphqlQueryCommand({
2271
+ command: "foundation.strategic-objectives.show",
2272
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2273
+ field: "strategic_objective",
2274
+ variables: normalizeGraphqlVariables({
2275
+ organization_id: organizationId,
2276
+ id,
2277
+ progress_scope: opts.progressScope,
2278
+ all_progress: opts.allProgress,
2279
+ all: opts.all
2280
+ }),
2281
+ isShow: true
2282
+ });
2283
+ });
2284
+ strategicObjectives.command("update").option("--id <id>", "Strategic objective ID (defaults to organization context)").requiredOption(
2285
+ "--data-json <dataJson>",
2286
+ 'JSON object for strategic_objective or {"strategic_objective": {...}}'
2287
+ ).action(async (opts, cmd) => {
2288
+ const globalOpts = cmd.optsWithGlobals();
2289
+ const organizationId = resolveOrganizationId(globalOpts.organizationId);
2290
+ const id = idSchema11.parse(opts.id ?? organizationId);
2291
+ const body = __testables.normalizeBody(
2292
+ String(opts.dataJson),
2293
+ "strategic_objective"
2294
+ );
2295
+ await runGraphqlMutationCommand({
2296
+ command: "foundation.strategic-objectives.update",
2297
+ runtimeOptions: pickRuntimeOptions(globalOpts),
2298
+ field: "update_strategic_objective",
2299
+ variables: {
2300
+ organization_id: organizationId,
2301
+ strategic_objective_id: id,
2302
+ params: body.strategic_objective ?? body
2303
+ }
2304
+ });
2305
+ });
2306
+ registerEntityCrudCommands(foundation, {
976
2307
  command: "annual-objectives",
977
2308
  description: "Foundation annual objective operations",
978
2309
  resourcePath: "annual_objectives",
979
- rootKey: "annual_objective"
2310
+ rootKey: "annual_objective",
2311
+ requiredCreateFields: ["strategic_objective_id"],
2312
+ listParams: []
980
2313
  });
981
- registerEntityCrudCommands(program, {
2314
+ registerEntityCrudCommands(foundation, {
982
2315
  command: "quarterly-objectives",
983
2316
  description: "Foundation quarterly objective operations",
984
2317
  resourcePath: "quarterly_objectives",
985
- rootKey: "quarterly_objective"
2318
+ rootKey: "quarterly_objective",
2319
+ requiredCreateFields: ["strategic_objective_id", "annual_objective_id"],
2320
+ listParams: ["annual_objective_id"]
986
2321
  });
987
2322
  }
988
2323
 
@@ -1010,8 +2345,12 @@ function buildCli() {
1010
2345
  registerRockCommands(program);
1011
2346
  registerMeetingCommands(program);
1012
2347
  registerMemberCommands(program);
2348
+ registerTeamCommands(program);
2349
+ registerOrganizationCommands(program);
2350
+ registerMetaProfileCommands(program);
1013
2351
  registerIssueCommands(program);
1014
2352
  registerSystemToolCommands(program);
2353
+ registerFoundationCommands(program);
1015
2354
  return program;
1016
2355
  }
1017
2356
 
@@ -1050,6 +2389,9 @@ main().catch((error) => {
1050
2389
  });
1051
2390
  }
1052
2391
  if (error instanceof CommanderError) {
2392
+ if (error.code === "commander.helpDisplayed" || error.code === "commander.version") {
2393
+ process.exit(EXIT_CODES.success);
2394
+ }
1053
2395
  printCliFailure({
1054
2396
  status: 400,
1055
2397
  code: "invalid_args",