@ted-galago/wave-cli 0.1.1 → 0.1.3

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,7 +3,7 @@
3
3
 
4
4
  // src/index.ts
5
5
  var import_commander2 = require("commander");
6
- var import_zod13 = require("zod");
6
+ var import_zod12 = require("zod");
7
7
 
8
8
  // src/cli.ts
9
9
  var import_commander = require("commander");
@@ -181,6 +181,9 @@ function debugLog(config, message) {
181
181
  function graphqlOperationName(command) {
182
182
  return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
183
183
  }
184
+ function toCamelCase(value) {
185
+ return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
186
+ }
184
187
  function inferStatusFromGraphqlErrors(errors) {
185
188
  if (!Array.isArray(errors) || errors.length === 0) {
186
189
  return 400;
@@ -227,18 +230,39 @@ function graphqlTypeForValue(value) {
227
230
  }
228
231
  return "JSON";
229
232
  }
233
+ function graphqlTypeForVariable(name, value) {
234
+ if (name === "id" || name.endsWith("Id")) {
235
+ return "ID";
236
+ }
237
+ if (name.endsWith("Ids")) {
238
+ return "[ID!]";
239
+ }
240
+ return graphqlTypeForValue(value);
241
+ }
242
+ function withNonNull(typeName) {
243
+ return typeName.endsWith("!") ? typeName : `${typeName}!`;
244
+ }
245
+ function normalizeGraphqlVariables(variables) {
246
+ const normalized = {};
247
+ Object.entries(variables).forEach(([key, value]) => {
248
+ normalized[toCamelCase(key)] = value;
249
+ });
250
+ return normalized;
251
+ }
230
252
  function buildGraphqlBody(input) {
253
+ const graphqlField = toCamelCase(input.field);
254
+ const graphqlVariables = normalizeGraphqlVariables(input.variables);
231
255
  const operationName = graphqlOperationName(input.command);
232
- const variableEntries = Object.entries(input.variables).filter(([, value]) => value !== void 0);
233
- const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${graphqlTypeForValue(value)}`).join(", ");
256
+ const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
257
+ const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
234
258
  const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
235
259
  const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
236
260
  const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
237
- const query = `${input.operationType} ${operationName}${signature} { ${input.field}${args} ${input.selectionSet} }`;
261
+ const query = `${input.operationType} ${operationName}${signature} { ${graphqlField}${args} ${input.selectionSet} }`;
238
262
  return {
239
263
  operationName,
240
264
  query,
241
- variables: input.variables
265
+ variables: graphqlVariables
242
266
  };
243
267
  }
244
268
  async function graphqlRequest(input) {
@@ -289,7 +313,7 @@ async function graphqlRequest(input) {
289
313
  exitCode: mapStatusToExitCode(status)
290
314
  };
291
315
  }
292
- const fieldPayload = gqlData[input.field];
316
+ const fieldPayload = gqlData[toCamelCase(input.field)];
293
317
  if (input.operationType === "mutation") {
294
318
  const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
295
319
  const ok = Boolean(mutationPayload.ok);
@@ -302,7 +326,9 @@ async function graphqlRequest(input) {
302
326
  status,
303
327
  data: null,
304
328
  error: {
305
- code: String(mutationPayload.error_code ?? `http_${status}`),
329
+ code: String(
330
+ mutationPayload.errorCode ?? mutationPayload.error_code ?? `http_${status}`
331
+ ),
306
332
  message: "Mutation failed.",
307
333
  details: {
308
334
  errors: mutationPayload.errors ?? null,
@@ -405,10 +431,10 @@ function buildCliErrorEnvelope(params) {
405
431
  }
406
432
  function defaultQuerySelectionSet(field, isList) {
407
433
  if (field === "organization") {
408
- return "{ id slug members_count organization_detail { title name description timezone workspace_name } }";
434
+ return "{ id slug membersCount organizationDetail { title name description timezone workspaceName } }";
409
435
  }
410
436
  if (isList) {
411
- return "{ data { id type attributes } count current_page total_pages }";
437
+ return "{ data { id type attributes } count currentPage totalPages }";
412
438
  }
413
439
  return "{ id type attributes }";
414
440
  }
@@ -448,7 +474,7 @@ function normalizeGraphqlVariable(key, value) {
448
474
  }
449
475
  return parseBooleanMaybe(trimmed);
450
476
  }
451
- function normalizeGraphqlVariables(raw) {
477
+ function normalizeGraphqlVariables2(raw) {
452
478
  const normalized = {};
453
479
  Object.entries(raw).forEach(([key, value]) => {
454
480
  const next = normalizeGraphqlVariable(key, value);
@@ -505,7 +531,7 @@ async function runGraphqlMutationCommand(input) {
505
531
  operationType: "mutation",
506
532
  field: input.field,
507
533
  variables: input.variables ?? {},
508
- selectionSet: input.selectionSet ?? "{ ok status error_code data errors }"
534
+ selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
509
535
  });
510
536
  printEnvelopeAndExit(result);
511
537
  } catch (error) {
@@ -1155,6 +1181,21 @@ function buildDataJsonHelp(rootKey, mode) {
1155
1181
 
1156
1182
  // src/commands/entityCrud.ts
1157
1183
  var idSchema = import_zod2.z.string().min(1);
1184
+ function toSingularResourceName(resourcePath) {
1185
+ if (resourcePath === "organization_meta_profiles") {
1186
+ return "organization_meta_profile";
1187
+ }
1188
+ if (resourcePath === "key_metric_meta_profiles") {
1189
+ return "key_metric_meta_profile";
1190
+ }
1191
+ if (resourcePath.endsWith("ies")) {
1192
+ return resourcePath.slice(0, -3) + "y";
1193
+ }
1194
+ if (resourcePath.endsWith("s")) {
1195
+ return resourcePath.slice(0, -1);
1196
+ }
1197
+ return resourcePath;
1198
+ }
1158
1199
  function parseJsonObject(raw) {
1159
1200
  try {
1160
1201
  const parsed = JSON.parse(raw);
@@ -1233,7 +1274,7 @@ function registerEntityCrudCommands(program, config) {
1233
1274
  return [param, opts[optionKey]];
1234
1275
  })
1235
1276
  );
1236
- const variables = normalizeGraphqlVariables({
1277
+ const variables = normalizeGraphqlVariables2({
1237
1278
  organization_id: organizationId,
1238
1279
  page: opts.page,
1239
1280
  per: opts.per,
@@ -1255,8 +1296,8 @@ function registerEntityCrudCommands(program, config) {
1255
1296
  await runGraphqlQueryCommand({
1256
1297
  command: `${config.command}.show`,
1257
1298
  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({
1299
+ field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
1300
+ variables: normalizeGraphqlVariables2({
1260
1301
  organization_id: organizationId,
1261
1302
  id
1262
1303
  }),
@@ -1271,10 +1312,10 @@ function registerEntityCrudCommands(program, config) {
1271
1312
  await runGraphqlMutationCommand({
1272
1313
  command: `${config.command}.create`,
1273
1314
  runtimeOptions: pickRuntimeOptions(globalOpts),
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}`,
1315
+ field: `create_${toSingularResourceName(config.resourcePath)}`,
1275
1316
  variables: {
1276
1317
  organization_id: organizationId,
1277
- params: body[config.rootKey] ?? body
1318
+ params: body
1278
1319
  }
1279
1320
  });
1280
1321
  });
@@ -1283,7 +1324,7 @@ function registerEntityCrudCommands(program, config) {
1283
1324
  const globalOpts = cmd.optsWithGlobals();
1284
1325
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
1285
1326
  const body = normalizeBody(String(opts.dataJson), config.rootKey);
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;
1327
+ const singular = toSingularResourceName(config.resourcePath);
1287
1328
  await runGraphqlMutationCommand({
1288
1329
  command: `${config.command}.update`,
1289
1330
  runtimeOptions: pickRuntimeOptions(globalOpts),
@@ -1291,12 +1332,13 @@ function registerEntityCrudCommands(program, config) {
1291
1332
  variables: {
1292
1333
  organization_id: organizationId,
1293
1334
  [`${singular}_id`]: id,
1294
- params: body[config.rootKey] ?? body
1335
+ params: body
1295
1336
  }
1296
1337
  });
1297
1338
  });
1298
1339
  }
1299
1340
  var __testables = {
1341
+ toSingularResourceName,
1300
1342
  parseJsonObject,
1301
1343
  normalizeBody,
1302
1344
  assertRequiredCreateFields,
@@ -1318,7 +1360,7 @@ function registerTaskCommands(program) {
1318
1360
  command: "tasks.list",
1319
1361
  runtimeOptions: pickRuntimeOptions(globalOpts),
1320
1362
  field: "tasks",
1321
- variables: normalizeGraphqlVariables({
1363
+ variables: normalizeGraphqlVariables2({
1322
1364
  organization_id: organizationId,
1323
1365
  page: opts.page,
1324
1366
  per: opts.per,
@@ -1364,8 +1406,10 @@ function registerTaskCommands(program) {
1364
1406
  variables: {
1365
1407
  organization_id: organizationId,
1366
1408
  params: {
1367
- project_id: projectId,
1368
- summary
1409
+ task: {
1410
+ project_id: projectId,
1411
+ summary
1412
+ }
1369
1413
  }
1370
1414
  }
1371
1415
  });
@@ -1397,7 +1441,9 @@ function registerTaskCommands(program) {
1397
1441
  variables: {
1398
1442
  organization_id: organizationId,
1399
1443
  task_id: id,
1400
- params: taskPayload
1444
+ params: {
1445
+ task: taskPayload
1446
+ }
1401
1447
  }
1402
1448
  });
1403
1449
  });
@@ -1418,7 +1464,7 @@ function registerProjectCommands(program) {
1418
1464
  command: "projects.list",
1419
1465
  runtimeOptions: pickRuntimeOptions(globalOpts),
1420
1466
  field: "projects",
1421
- variables: normalizeGraphqlVariables({
1467
+ variables: normalizeGraphqlVariables2({
1422
1468
  organization_id: organizationId,
1423
1469
  page: opts.page,
1424
1470
  per: opts.per,
@@ -1457,7 +1503,7 @@ function registerProjectCommands(program) {
1457
1503
  field: "create_project",
1458
1504
  variables: {
1459
1505
  organization_id: organizationId,
1460
- params: body.project ?? body
1506
+ params: body
1461
1507
  }
1462
1508
  });
1463
1509
  });
@@ -1473,7 +1519,7 @@ function registerProjectCommands(program) {
1473
1519
  variables: {
1474
1520
  organization_id: organizationId,
1475
1521
  project_id: id,
1476
- params: body.project ?? body
1522
+ params: body
1477
1523
  }
1478
1524
  });
1479
1525
  });
@@ -1497,7 +1543,7 @@ function registerRockCommands(program) {
1497
1543
  command: "rocks.list",
1498
1544
  runtimeOptions: pickRuntimeOptions(globalOpts),
1499
1545
  field: "rocks",
1500
- variables: normalizeGraphqlVariables({
1546
+ variables: normalizeGraphqlVariables2({
1501
1547
  organization_id: organizationId,
1502
1548
  page: opts.page,
1503
1549
  per: opts.per,
@@ -1545,7 +1591,7 @@ function registerRockCommands(program) {
1545
1591
  variables: {
1546
1592
  organization_id: organizationId,
1547
1593
  rock_id: id,
1548
- params: { status }
1594
+ params: { rock: { status } }
1549
1595
  }
1550
1596
  });
1551
1597
  });
@@ -1560,7 +1606,7 @@ function registerRockCommands(program) {
1560
1606
  field: "create_rock",
1561
1607
  variables: {
1562
1608
  organization_id: organizationId,
1563
- params: body.rock ?? body
1609
+ params: body
1564
1610
  }
1565
1611
  });
1566
1612
  });
@@ -1576,7 +1622,7 @@ function registerRockCommands(program) {
1576
1622
  variables: {
1577
1623
  organization_id: organizationId,
1578
1624
  rock_id: id,
1579
- params: body.rock ?? body
1625
+ params: body
1580
1626
  }
1581
1627
  });
1582
1628
  });
@@ -1598,7 +1644,7 @@ function registerMeetingCommands(program) {
1598
1644
  command: "meetings.list",
1599
1645
  runtimeOptions: pickRuntimeOptions(globalOpts),
1600
1646
  field: "meetings",
1601
- variables: normalizeGraphqlVariables({
1647
+ variables: normalizeGraphqlVariables2({
1602
1648
  organization_id: organizationId,
1603
1649
  per: opts.per,
1604
1650
  date: opts.date,
@@ -1640,7 +1686,9 @@ function registerMeetingCommands(program) {
1640
1686
  organization_id: organizationId,
1641
1687
  meeting_id: id,
1642
1688
  params: {
1643
- notes
1689
+ meeting: {
1690
+ notes
1691
+ }
1644
1692
  }
1645
1693
  }
1646
1694
  });
@@ -1655,7 +1703,7 @@ function registerMeetingCommands(program) {
1655
1703
  field: "create_meeting",
1656
1704
  variables: {
1657
1705
  organization_id: organizationId,
1658
- params: body.meeting ?? body
1706
+ params: body
1659
1707
  }
1660
1708
  });
1661
1709
  });
@@ -1671,7 +1719,7 @@ function registerMeetingCommands(program) {
1671
1719
  variables: {
1672
1720
  organization_id: organizationId,
1673
1721
  meeting_id: id,
1674
- params: body.meeting ?? body
1722
+ params: body
1675
1723
  }
1676
1724
  });
1677
1725
  });
@@ -1692,7 +1740,7 @@ function registerMemberCommands(program) {
1692
1740
  command: "members.list",
1693
1741
  runtimeOptions: pickRuntimeOptions(globalOpts),
1694
1742
  field: "members",
1695
- variables: normalizeGraphqlVariables({
1743
+ variables: normalizeGraphqlVariables2({
1696
1744
  organization_id: organizationId,
1697
1745
  page: opts.page,
1698
1746
  per: opts.per,
@@ -1726,7 +1774,7 @@ function registerMemberCommands(program) {
1726
1774
  field: "create_member",
1727
1775
  variables: {
1728
1776
  organization_id: organizationId,
1729
- params: body.member ?? body
1777
+ params: body
1730
1778
  }
1731
1779
  });
1732
1780
  });
@@ -1742,7 +1790,7 @@ function registerMemberCommands(program) {
1742
1790
  variables: {
1743
1791
  organization_id: organizationId,
1744
1792
  member_id: id,
1745
- params: body.member ?? body
1793
+ params: body
1746
1794
  }
1747
1795
  });
1748
1796
  });
@@ -1765,7 +1813,7 @@ function registerIssueCommands(program) {
1765
1813
  command: "issues.list",
1766
1814
  runtimeOptions: pickRuntimeOptions(globalOpts),
1767
1815
  field: "issues",
1768
- variables: normalizeGraphqlVariables({
1816
+ variables: normalizeGraphqlVariables2({
1769
1817
  organization_id: organizationId,
1770
1818
  page: opts.page,
1771
1819
  per: opts.per,
@@ -1809,14 +1857,16 @@ function registerIssueCommands(program) {
1809
1857
  variables: {
1810
1858
  organization_id: organizationId,
1811
1859
  params: {
1812
- issue_group_id: issueGroupId,
1813
- name,
1814
- issue_type: issueType,
1815
- ...opts.status ? { status: String(opts.status) } : {},
1816
- ...opts.priority ? { priority: String(opts.priority) } : {},
1817
- ...opts.description ? { description: String(opts.description) } : {},
1818
- ...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
1819
- ...opts.memberId ? { member_id: String(opts.memberId) } : {}
1860
+ issue: {
1861
+ issue_group_id: issueGroupId,
1862
+ name,
1863
+ issue_type: issueType,
1864
+ ...opts.status ? { status: String(opts.status) } : {},
1865
+ ...opts.priority ? { priority: String(opts.priority) } : {},
1866
+ ...opts.description ? { description: String(opts.description) } : {},
1867
+ ...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
1868
+ ...opts.memberId ? { member_id: String(opts.memberId) } : {}
1869
+ }
1820
1870
  }
1821
1871
  }
1822
1872
  });
@@ -1833,7 +1883,7 @@ function registerIssueCommands(program) {
1833
1883
  variables: {
1834
1884
  organization_id: organizationId,
1835
1885
  issue_id: id,
1836
- params: body.issue ?? body
1886
+ params: body
1837
1887
  }
1838
1888
  });
1839
1889
  });
@@ -2048,7 +2098,7 @@ function registerTeamCommands(program) {
2048
2098
  command: "teams.list",
2049
2099
  runtimeOptions: pickRuntimeOptions(globalOpts),
2050
2100
  field: "teams",
2051
- variables: normalizeGraphqlVariables({
2101
+ variables: normalizeGraphqlVariables2({
2052
2102
  organization_id: organizationId,
2053
2103
  page: opts.page,
2054
2104
  per: opts.per,
@@ -2082,7 +2132,7 @@ function registerTeamCommands(program) {
2082
2132
  field: "create_team",
2083
2133
  variables: {
2084
2134
  organization_id: organizationId,
2085
- params: body.team ?? body
2135
+ params: body
2086
2136
  }
2087
2137
  });
2088
2138
  });
@@ -2098,7 +2148,7 @@ function registerTeamCommands(program) {
2098
2148
  variables: {
2099
2149
  organization_id: organizationId,
2100
2150
  team_id: id,
2101
- params: body.team ?? body
2151
+ params: body
2102
2152
  }
2103
2153
  });
2104
2154
  });
@@ -2135,23 +2185,17 @@ function registerOrganizationCommands(program) {
2135
2185
  field: "update_organization",
2136
2186
  variables: {
2137
2187
  id,
2138
- params: body.organization ?? body
2188
+ params: body
2139
2189
  }
2140
2190
  });
2141
2191
  });
2142
- }
2143
-
2144
- // src/commands/metaProfiles.ts
2145
- var import_zod11 = require("zod");
2146
- var idSchema10 = import_zod11.z.string().min(1);
2147
- function registerMetaProfileCommands(program) {
2148
- const organizationMetaProfiles = program.command("organization-meta-profiles").description("Organization meta profile operations");
2149
- organizationMetaProfiles.command("show").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").action(async (opts, cmd) => {
2192
+ const metaProfile = organizations.command("meta-profile").description("Organization meta profile operations");
2193
+ metaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
2150
2194
  const globalOpts = cmd.optsWithGlobals();
2151
2195
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2152
- const id = idSchema10.parse(opts.id ?? organizationId);
2196
+ const id = idSchema9.parse(opts.id ?? organizationId);
2153
2197
  await runGraphqlQueryCommand({
2154
- command: "organization-meta-profiles.show",
2198
+ command: "organizations.meta-profile.show",
2155
2199
  runtimeOptions: pickRuntimeOptions(globalOpts),
2156
2200
  field: "organization_meta_profile",
2157
2201
  variables: {
@@ -2161,35 +2205,35 @@ function registerMetaProfileCommands(program) {
2161
2205
  isShow: true
2162
2206
  });
2163
2207
  });
2164
- organizationMetaProfiles.command("update").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").requiredOption(
2208
+ metaProfile.command("update").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").requiredOption(
2165
2209
  "--data-json <dataJson>",
2166
2210
  'JSON object for organization_meta_profile or {"organization_meta_profile": {...}}'
2167
2211
  ).action(async (opts, cmd) => {
2168
2212
  const globalOpts = cmd.optsWithGlobals();
2169
2213
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2170
- const id = idSchema10.parse(opts.id ?? organizationId);
2214
+ const id = idSchema9.parse(opts.id ?? organizationId);
2171
2215
  const body = __testables.normalizeBody(
2172
2216
  String(opts.dataJson),
2173
2217
  "organization_meta_profile"
2174
2218
  );
2175
2219
  await runGraphqlMutationCommand({
2176
- command: "organization-meta-profiles.update",
2220
+ command: "organizations.meta-profile.update",
2177
2221
  runtimeOptions: pickRuntimeOptions(globalOpts),
2178
2222
  field: "update_organization_meta_profile",
2179
2223
  variables: {
2180
2224
  organization_id: organizationId,
2181
2225
  organization_meta_profile_id: id,
2182
- params: body.organization_meta_profile ?? body
2226
+ params: body
2183
2227
  }
2184
2228
  });
2185
2229
  });
2186
- const keyMetricMetaProfiles = program.command("key-metric-meta-profiles").description("Key metric meta profile operations");
2187
- keyMetricMetaProfiles.command("show").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").action(async (opts, cmd) => {
2230
+ const keyMetricMetaProfile = organizations.command("key-metric-meta-profile").description("Key metric meta profile operations");
2231
+ keyMetricMetaProfile.command("show").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").action(async (opts, cmd) => {
2188
2232
  const globalOpts = cmd.optsWithGlobals();
2189
2233
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2190
- const id = idSchema10.parse(opts.id ?? organizationId);
2234
+ const id = idSchema9.parse(opts.id ?? organizationId);
2191
2235
  await runGraphqlQueryCommand({
2192
- command: "key-metric-meta-profiles.show",
2236
+ command: "organizations.key-metric-meta-profile.show",
2193
2237
  runtimeOptions: pickRuntimeOptions(globalOpts),
2194
2238
  field: "key_metric_meta_profile",
2195
2239
  variables: {
@@ -2199,30 +2243,33 @@ function registerMetaProfileCommands(program) {
2199
2243
  isShow: true
2200
2244
  });
2201
2245
  });
2202
- keyMetricMetaProfiles.command("update").option("--id <id>", "Meta profile ID (optional; defaults to organization_id)").requiredOption(
2246
+ keyMetricMetaProfile.command("update").option("--id <id>", "Meta profile ID (defaults to resolved organization context)").requiredOption(
2203
2247
  "--data-json <dataJson>",
2204
2248
  'JSON object for key_metric_meta_profile or {"key_metric_meta_profile": {...}}'
2205
2249
  ).action(async (opts, cmd) => {
2206
2250
  const globalOpts = cmd.optsWithGlobals();
2207
2251
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2208
- const id = idSchema10.parse(opts.id ?? organizationId);
2209
- const body = __testables.normalizeBody(String(opts.dataJson), "key_metric_meta_profile");
2252
+ const id = idSchema9.parse(opts.id ?? organizationId);
2253
+ const body = __testables.normalizeBody(
2254
+ String(opts.dataJson),
2255
+ "key_metric_meta_profile"
2256
+ );
2210
2257
  await runGraphqlMutationCommand({
2211
- command: "key-metric-meta-profiles.update",
2258
+ command: "organizations.key-metric-meta-profile.update",
2212
2259
  runtimeOptions: pickRuntimeOptions(globalOpts),
2213
2260
  field: "update_key_metric_meta_profile",
2214
2261
  variables: {
2215
2262
  organization_id: organizationId,
2216
2263
  key_metric_meta_profile_id: id,
2217
- params: body.key_metric_meta_profile ?? body
2264
+ params: body
2218
2265
  }
2219
2266
  });
2220
2267
  });
2221
2268
  }
2222
2269
 
2223
2270
  // src/commands/foundation.ts
2224
- var import_zod12 = require("zod");
2225
- var idSchema11 = import_zod12.z.string().min(1);
2271
+ var import_zod11 = require("zod");
2272
+ var idSchema10 = import_zod11.z.string().min(1);
2226
2273
  function registerFoundationCommands(program) {
2227
2274
  const foundation = program.command("foundation").description("Foundation operations");
2228
2275
  const strategicPlans = foundation.command("strategic-plans").description("Strategic plan operations");
@@ -2230,12 +2277,12 @@ function registerFoundationCommands(program) {
2230
2277
  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) => {
2231
2278
  const globalOpts = cmd.optsWithGlobals();
2232
2279
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2233
- const id = idSchema11.parse(opts.id ?? organizationId);
2280
+ const id = idSchema10.parse(opts.id ?? organizationId);
2234
2281
  await runGraphqlQueryCommand({
2235
2282
  command: "foundation.strategic-plans.show",
2236
2283
  runtimeOptions: pickRuntimeOptions(globalOpts),
2237
2284
  field: "strategic_plan",
2238
- variables: normalizeGraphqlVariables({
2285
+ variables: normalizeGraphqlVariables2({
2239
2286
  organization_id: organizationId,
2240
2287
  id,
2241
2288
  progress_scope: opts.progressScope,
@@ -2251,7 +2298,7 @@ function registerFoundationCommands(program) {
2251
2298
  ).action(async (opts, cmd) => {
2252
2299
  const globalOpts = cmd.optsWithGlobals();
2253
2300
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2254
- const id = idSchema11.parse(opts.id ?? organizationId);
2301
+ const id = idSchema10.parse(opts.id ?? organizationId);
2255
2302
  const body = __testables.normalizeBody(String(opts.dataJson), "strategic_plan");
2256
2303
  await runGraphqlMutationCommand({
2257
2304
  command: "foundation.strategic-plans.update",
@@ -2260,19 +2307,19 @@ function registerFoundationCommands(program) {
2260
2307
  variables: {
2261
2308
  organization_id: organizationId,
2262
2309
  strategic_plan_id: id,
2263
- params: body.strategic_plan ?? body
2310
+ params: body
2264
2311
  }
2265
2312
  });
2266
2313
  });
2267
2314
  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) => {
2268
2315
  const globalOpts = cmd.optsWithGlobals();
2269
2316
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2270
- const id = idSchema11.parse(opts.id ?? organizationId);
2317
+ const id = idSchema10.parse(opts.id ?? organizationId);
2271
2318
  await runGraphqlQueryCommand({
2272
2319
  command: "foundation.strategic-objectives.show",
2273
2320
  runtimeOptions: pickRuntimeOptions(globalOpts),
2274
2321
  field: "strategic_objective",
2275
- variables: normalizeGraphqlVariables({
2322
+ variables: normalizeGraphqlVariables2({
2276
2323
  organization_id: organizationId,
2277
2324
  id,
2278
2325
  progress_scope: opts.progressScope,
@@ -2288,7 +2335,7 @@ function registerFoundationCommands(program) {
2288
2335
  ).action(async (opts, cmd) => {
2289
2336
  const globalOpts = cmd.optsWithGlobals();
2290
2337
  const organizationId = resolveOrganizationId(globalOpts.organizationId);
2291
- const id = idSchema11.parse(opts.id ?? organizationId);
2338
+ const id = idSchema10.parse(opts.id ?? organizationId);
2292
2339
  const body = __testables.normalizeBody(
2293
2340
  String(opts.dataJson),
2294
2341
  "strategic_objective"
@@ -2300,7 +2347,7 @@ function registerFoundationCommands(program) {
2300
2347
  variables: {
2301
2348
  organization_id: organizationId,
2302
2349
  strategic_objective_id: id,
2303
- params: body.strategic_objective ?? body
2350
+ params: body
2304
2351
  }
2305
2352
  });
2306
2353
  });
@@ -2348,7 +2395,6 @@ function buildCli() {
2348
2395
  registerMemberCommands(program);
2349
2396
  registerTeamCommands(program);
2350
2397
  registerOrganizationCommands(program);
2351
- registerMetaProfileCommands(program);
2352
2398
  registerIssueCommands(program);
2353
2399
  registerSystemToolCommands(program);
2354
2400
  registerFoundationCommands(program);
@@ -2400,13 +2446,13 @@ main().catch((error) => {
2400
2446
  exitCode: EXIT_CODES.invalidArgs
2401
2447
  });
2402
2448
  }
2403
- if (error instanceof import_zod13.ZodError || error instanceof import_commander2.InvalidArgumentError) {
2449
+ if (error instanceof import_zod12.ZodError || error instanceof import_commander2.InvalidArgumentError) {
2404
2450
  printCliFailure({
2405
2451
  status: 400,
2406
2452
  code: "invalid_args",
2407
2453
  message: "Invalid command arguments.",
2408
2454
  details: {
2409
- issues: error instanceof import_zod13.ZodError ? error.issues : [{ message: error.message, code: "invalid_argument" }]
2455
+ issues: error instanceof import_zod12.ZodError ? error.issues : [{ message: error.message, code: "invalid_argument" }]
2410
2456
  },
2411
2457
  exitCode: EXIT_CODES.invalidArgs
2412
2458
  });