@ted-galago/wave-cli 0.1.0 → 0.1.2

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