@wave-ai-os/wave-cli 0.1.61 → 0.1.63

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.
Files changed (4) hide show
  1. package/README.md +15 -10
  2. package/dist/index.cjs +622 -333
  3. package/dist/index.js +619 -330
  4. package/package.json +1 -1
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_zod19 = require("zod");
6
+ var import_zod20 = require("zod");
7
7
 
8
8
  // src/cli.ts
9
9
  var import_commander = require("commander");
@@ -107,10 +107,10 @@ function parseDebug(rawDebugEnv) {
107
107
  return lowered === "1" || lowered === "true" || lowered === "yes";
108
108
  }
109
109
  function getConfig(options) {
110
- const token = options.token ?? options.jwt ?? process.env.WAVE_API_TOKEN ?? process.env.WAVE_JWT;
110
+ const token = options.token ?? process.env.WAVE_API_TOKEN;
111
111
  if (!token) {
112
112
  throw new CliError({
113
- message: "Missing API token. Pass --token/--jwt, use --token-stdin/--auth-json-stdin, or set WAVE_API_TOKEN/WAVE_JWT.",
113
+ message: "Missing API token. Pass --token, use --token-stdin/--auth-json-stdin, or set WAVE_API_TOKEN.",
114
114
  kind: "missing_auth",
115
115
  status: 401,
116
116
  exitCode: EXIT_CODES.missingOrInvalidAuth
@@ -1759,6 +1759,21 @@ async function runGraphqlMutationCommand(input) {
1759
1759
  variableTypes: input.variableTypes,
1760
1760
  selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
1761
1761
  });
1762
+ if (result.envelope.ok && input.transformMutationPayload) {
1763
+ const envelopeData = result.envelope.data;
1764
+ if (!isRecord(envelopeData) || !Object.prototype.hasOwnProperty.call(envelopeData, input.field)) {
1765
+ throw new CliError({
1766
+ message: "Mutation response was missing its expected payload.",
1767
+ kind: "malformed_response",
1768
+ status: 502,
1769
+ exitCode: EXIT_CODES.networkOrUpstream
1770
+ });
1771
+ }
1772
+ result.envelope.data = {
1773
+ ...envelopeData,
1774
+ [input.field]: input.transformMutationPayload(envelopeData[input.field])
1775
+ };
1776
+ }
1762
1777
  printEnvelopeAndExit(result);
1763
1778
  } catch (error) {
1764
1779
  if (isEnvelopeEmittedSignal(error)) {
@@ -2002,7 +2017,142 @@ async function getAuthStorageInfo(baseUrl) {
2002
2017
  return { kind: "file", available, path };
2003
2018
  }
2004
2019
 
2020
+ // src/authClient.ts
2021
+ var import_node_crypto2 = require("crypto");
2022
+
2023
+ // src/redaction.ts
2024
+ var TOKENISH_PATTERNS = [
2025
+ /\b(?:cli|wave|token|secret|bearer)[A-Za-z0-9._~+/=-]{8,}\b/gi,
2026
+ /\b[A-Za-z0-9._~+/=-]{24,}\b/g
2027
+ ];
2028
+ function redactOne(value) {
2029
+ if (value.length <= 8) {
2030
+ return "[redacted]";
2031
+ }
2032
+ return `${value.slice(0, 4)}...[redacted]...${value.slice(-4)}`;
2033
+ }
2034
+ function redactSecrets(input, knownSecrets = []) {
2035
+ let output = input;
2036
+ for (const secret of knownSecrets) {
2037
+ if (!secret) continue;
2038
+ output = output.split(secret).join(redactOne(secret));
2039
+ }
2040
+ for (const pattern of TOKENISH_PATTERNS) {
2041
+ output = output.replace(pattern, (match) => redactOne(match));
2042
+ }
2043
+ return output;
2044
+ }
2045
+ function redactUnknown(input, knownSecrets = []) {
2046
+ if (typeof input === "string") {
2047
+ return redactSecrets(input, knownSecrets);
2048
+ }
2049
+ if (Array.isArray(input)) {
2050
+ return input.map((entry2) => redactUnknown(entry2, knownSecrets));
2051
+ }
2052
+ if (!input || typeof input !== "object") {
2053
+ return input;
2054
+ }
2055
+ const output = {};
2056
+ for (const [key, value] of Object.entries(input)) {
2057
+ if (/token|secret|authorization|bearer/i.test(key)) {
2058
+ output[key] = typeof value === "string" ? redactSecrets(value, knownSecrets) : "[redacted]";
2059
+ continue;
2060
+ }
2061
+ output[key] = redactUnknown(value, knownSecrets);
2062
+ }
2063
+ return output;
2064
+ }
2065
+
2066
+ // src/authClient.ts
2067
+ function parseJsonSafely2(input) {
2068
+ try {
2069
+ return JSON.parse(input);
2070
+ } catch {
2071
+ return null;
2072
+ }
2073
+ }
2074
+ function graphqlErrors(payload, knownSecrets) {
2075
+ const errors = payload.errors;
2076
+ if (!Array.isArray(errors) || errors.length === 0) return null;
2077
+ return {
2078
+ code: "upstream_error",
2079
+ message: "GraphQL request failed.",
2080
+ status: 400,
2081
+ details: {
2082
+ errors: redactUnknown(errors, knownSecrets)
2083
+ }
2084
+ };
2085
+ }
2086
+ async function authGraphqlRequest(params) {
2087
+ const requestId = (0, import_node_crypto2.randomUUID)();
2088
+ const controller = new AbortController();
2089
+ const timeoutId = setTimeout(() => controller.abort(), params.timeoutMs);
2090
+ const knownSecrets = [params.token, ...params.knownSecrets ?? []].filter(
2091
+ (secret) => typeof secret === "string" && secret.length > 0
2092
+ );
2093
+ try {
2094
+ const url = new URL("/graphql", params.baseUrl);
2095
+ const response = await fetch(url, {
2096
+ method: "POST",
2097
+ headers: {
2098
+ Accept: "application/json",
2099
+ "Content-Type": "application/json",
2100
+ "X-Origin": "wave-cli",
2101
+ "X-Request-Id": requestId,
2102
+ ...params.token ? { Authorization: `Bearer ${params.token}` } : {}
2103
+ },
2104
+ body: JSON.stringify({ query: params.query, variables: params.variables ?? {} }),
2105
+ signal: controller.signal
2106
+ });
2107
+ const responseRequestId = response.headers.get("x-request-id") ?? requestId;
2108
+ const text = await response.text();
2109
+ const payload = text ? parseJsonSafely2(text) : null;
2110
+ const graph = payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
2111
+ const gqlError = graphqlErrors(graph, knownSecrets);
2112
+ if (gqlError) {
2113
+ return { ok: false, error: gqlError, requestId: responseRequestId };
2114
+ }
2115
+ if (!response.ok) {
2116
+ return {
2117
+ ok: false,
2118
+ requestId: responseRequestId,
2119
+ error: {
2120
+ code: `http_${response.status}`,
2121
+ message: "Auth request failed.",
2122
+ status: response.status,
2123
+ details: { body: redactUnknown(graph, knownSecrets) }
2124
+ }
2125
+ };
2126
+ }
2127
+ const data = graph.data && typeof graph.data === "object" && !Array.isArray(graph.data) ? graph.data : {};
2128
+ return {
2129
+ ok: true,
2130
+ result: {
2131
+ status: response.status,
2132
+ requestId: responseRequestId,
2133
+ data
2134
+ }
2135
+ };
2136
+ } catch (error) {
2137
+ const message = error instanceof Error ? error.message : "Network error.";
2138
+ const timedOut = error instanceof Error && error.name === "AbortError";
2139
+ return {
2140
+ ok: false,
2141
+ requestId,
2142
+ error: {
2143
+ code: timedOut ? "timeout" : "network_error",
2144
+ message: redactSecrets(timedOut ? "Auth request timed out." : message, knownSecrets),
2145
+ status: timedOut ? 408 : 503,
2146
+ details: {}
2147
+ }
2148
+ };
2149
+ } finally {
2150
+ clearTimeout(timeoutId);
2151
+ }
2152
+ }
2153
+
2005
2154
  // src/commands/runtimeOptions.ts
2155
+ var CLI_AUTH_STATUS_QUERY = "query WaveCliAuthenticatedOrganization { cliAuthStatus { authenticated baseAuthStatus organization { id slug } } }";
2006
2156
  var stdinPromise = null;
2007
2157
  function normalize3(raw) {
2008
2158
  if (typeof raw !== "string") {
@@ -2036,7 +2186,6 @@ function parseAuthJson(raw) {
2036
2186
  const obj = parsed;
2037
2187
  return {
2038
2188
  token: normalize3(obj.token),
2039
- jwt: normalize3(obj.jwt),
2040
2189
  baseUrl: normalize3(obj.baseUrl ?? obj.base_url),
2041
2190
  organizationId: normalize3(obj.organizationId ?? obj.organization_id),
2042
2191
  timeoutMs: typeof obj.timeoutMs === "number" || typeof obj.timeoutMs === "string" ? obj.timeoutMs : typeof obj.timeout_ms === "number" || typeof obj.timeout_ms === "string" ? obj.timeout_ms : void 0,
@@ -2119,13 +2268,10 @@ function firstDefined(...values) {
2119
2268
  function resolveAuthToken(options, stdin, config, env) {
2120
2269
  const candidates = [
2121
2270
  { token: normalize3(options.token), source: "flag" },
2122
- { token: normalize3(options.jwt), source: "flag" },
2123
2271
  { token: normalize3(stdin.token), source: "stdin" },
2124
- { token: normalize3(stdin.jwt), source: "stdin" },
2125
2272
  { token: normalize3(env.WAVE_API_TOKEN), source: "env" },
2126
- { token: normalize3(env.WAVE_JWT), source: "env" },
2127
2273
  { token: normalize3(config.token), source: "config" },
2128
- { token: normalize3(config.jwt), source: "config" }
2274
+ { token: normalize3(config.token), source: "config" }
2129
2275
  ];
2130
2276
  return candidates.find((candidate) => candidate.token) ?? { source: "none" };
2131
2277
  }
@@ -2276,6 +2422,34 @@ async function resolveWithStoredToken(context) {
2276
2422
  }
2277
2423
  };
2278
2424
  }
2425
+ async function resolveWithAuthenticatedOrganization(context) {
2426
+ if (context.organizationIdSource === "flag" && context.organizationId) {
2427
+ return context;
2428
+ }
2429
+ const baseUrl = normalize3(context.runtimeOptions.baseUrl);
2430
+ const token = normalize3(context.runtimeOptions.token);
2431
+ if (!baseUrl || !token) {
2432
+ return {
2433
+ ...context,
2434
+ organizationId: void 0,
2435
+ organizationIdSource: "none",
2436
+ runtimeOptions: { ...context.runtimeOptions, organizationId: void 0 }
2437
+ };
2438
+ }
2439
+ const response = await authGraphqlRequest({
2440
+ baseUrl,
2441
+ token,
2442
+ timeoutMs: typeof context.runtimeOptions.timeoutMs === "number" ? context.runtimeOptions.timeoutMs : 1e4,
2443
+ query: CLI_AUTH_STATUS_QUERY
2444
+ });
2445
+ const organizationId = response.ok ? organizationIdFromCliAuthStatus(response.result.data) : void 0;
2446
+ return {
2447
+ ...context,
2448
+ organizationId,
2449
+ organizationIdSource: organizationId ? "token" : "none",
2450
+ runtimeOptions: { ...context.runtimeOptions, organizationId }
2451
+ };
2452
+ }
2279
2453
  function defaultConfigPath(env) {
2280
2454
  const explicitEnv = normalize3(env.WAVE_CONFIG_PATH);
2281
2455
  if (explicitEnv) return explicitEnv;
@@ -2338,11 +2512,21 @@ async function resolveStdinContext(options) {
2338
2512
  }
2339
2513
  return parseAuthJson(raw);
2340
2514
  }
2341
- async function resolveCommandContext(options) {
2515
+ async function resolveUnscopedCommandContext(options) {
2342
2516
  const stdin = await resolveStdinContext(options);
2343
2517
  const config = await resolveConfigFileContext(options, process.env);
2344
2518
  return resolveWithStoredToken(resolveFromSources(options, stdin, config, process.env));
2345
2519
  }
2520
+ async function resolveCommandContext(options) {
2521
+ return resolveWithAuthenticatedOrganization(await resolveUnscopedCommandContext(options));
2522
+ }
2523
+ function organizationIdFromCliAuthStatus(data) {
2524
+ const status = data.cliAuthStatus;
2525
+ if (!status || typeof status !== "object" || Array.isArray(status)) return void 0;
2526
+ const organization = status.organization;
2527
+ if (!organization || typeof organization !== "object" || Array.isArray(organization)) return void 0;
2528
+ return normalize3(organization.id);
2529
+ }
2346
2530
 
2347
2531
  // src/commands/organization.ts
2348
2532
  function normalize4(input) {
@@ -2356,10 +2540,14 @@ function resolveOrganizationId(raw) {
2356
2540
  const organizationId = normalize4(raw);
2357
2541
  if (!organizationId) {
2358
2542
  throw new CliError({
2359
- message: "Missing organization ID. Pass --organization-id, provide via --auth-json-stdin, or set WAVE_ORGANIZATION_ID.",
2360
- kind: "invalid_args",
2361
- status: 400,
2362
- exitCode: EXIT_CODES.invalidArgs
2543
+ message: "Missing authenticated organization scope. Pass --organization-id explicitly or authenticate with a Wave CLI token scoped to an organization.",
2544
+ kind: "missing_auth",
2545
+ status: 401,
2546
+ exitCode: EXIT_CODES.missingOrInvalidAuth,
2547
+ details: {
2548
+ suggestedCommands: ["wave auth status", "wave login"],
2549
+ ignoredOrganizationSources: ["stdin", "env", "config"]
2550
+ }
2363
2551
  });
2364
2552
  }
2365
2553
  return organizationId;
@@ -2447,140 +2635,6 @@ function registerGraphqlSearchCommand(command, config) {
2447
2635
  });
2448
2636
  }
2449
2637
 
2450
- // src/authClient.ts
2451
- var import_node_crypto2 = require("crypto");
2452
-
2453
- // src/redaction.ts
2454
- var TOKENISH_PATTERNS = [
2455
- /\b(?:cli|wave|token|secret|bearer)[A-Za-z0-9._~+/=-]{8,}\b/gi,
2456
- /\b[A-Za-z0-9._~+/=-]{24,}\b/g
2457
- ];
2458
- function redactOne(value) {
2459
- if (value.length <= 8) {
2460
- return "[redacted]";
2461
- }
2462
- return `${value.slice(0, 4)}...[redacted]...${value.slice(-4)}`;
2463
- }
2464
- function redactSecrets(input, knownSecrets = []) {
2465
- let output = input;
2466
- for (const secret of knownSecrets) {
2467
- if (!secret) continue;
2468
- output = output.split(secret).join(redactOne(secret));
2469
- }
2470
- for (const pattern of TOKENISH_PATTERNS) {
2471
- output = output.replace(pattern, (match) => redactOne(match));
2472
- }
2473
- return output;
2474
- }
2475
- function redactUnknown(input, knownSecrets = []) {
2476
- if (typeof input === "string") {
2477
- return redactSecrets(input, knownSecrets);
2478
- }
2479
- if (Array.isArray(input)) {
2480
- return input.map((entry2) => redactUnknown(entry2, knownSecrets));
2481
- }
2482
- if (!input || typeof input !== "object") {
2483
- return input;
2484
- }
2485
- const output = {};
2486
- for (const [key, value] of Object.entries(input)) {
2487
- if (/token|secret|authorization|bearer/i.test(key)) {
2488
- output[key] = typeof value === "string" ? redactSecrets(value, knownSecrets) : "[redacted]";
2489
- continue;
2490
- }
2491
- output[key] = redactUnknown(value, knownSecrets);
2492
- }
2493
- return output;
2494
- }
2495
-
2496
- // src/authClient.ts
2497
- function parseJsonSafely2(input) {
2498
- try {
2499
- return JSON.parse(input);
2500
- } catch {
2501
- return null;
2502
- }
2503
- }
2504
- function graphqlErrors(payload, knownSecrets) {
2505
- const errors = payload.errors;
2506
- if (!Array.isArray(errors) || errors.length === 0) return null;
2507
- return {
2508
- code: "upstream_error",
2509
- message: "GraphQL request failed.",
2510
- status: 400,
2511
- details: {
2512
- errors: redactUnknown(errors, knownSecrets)
2513
- }
2514
- };
2515
- }
2516
- async function authGraphqlRequest(params) {
2517
- const requestId = (0, import_node_crypto2.randomUUID)();
2518
- const controller = new AbortController();
2519
- const timeoutId = setTimeout(() => controller.abort(), params.timeoutMs);
2520
- const knownSecrets = [params.token, ...params.knownSecrets ?? []].filter(
2521
- (secret) => typeof secret === "string" && secret.length > 0
2522
- );
2523
- try {
2524
- const url = new URL("/graphql", params.baseUrl);
2525
- const response = await fetch(url, {
2526
- method: "POST",
2527
- headers: {
2528
- Accept: "application/json",
2529
- "Content-Type": "application/json",
2530
- "X-Origin": "wave-cli",
2531
- "X-Request-Id": requestId,
2532
- ...params.token ? { Authorization: `Bearer ${params.token}` } : {}
2533
- },
2534
- body: JSON.stringify({ query: params.query, variables: params.variables ?? {} }),
2535
- signal: controller.signal
2536
- });
2537
- const responseRequestId = response.headers.get("x-request-id") ?? requestId;
2538
- const text = await response.text();
2539
- const payload = text ? parseJsonSafely2(text) : null;
2540
- const graph = payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
2541
- const gqlError = graphqlErrors(graph, knownSecrets);
2542
- if (gqlError) {
2543
- return { ok: false, error: gqlError, requestId: responseRequestId };
2544
- }
2545
- if (!response.ok) {
2546
- return {
2547
- ok: false,
2548
- requestId: responseRequestId,
2549
- error: {
2550
- code: `http_${response.status}`,
2551
- message: "Auth request failed.",
2552
- status: response.status,
2553
- details: { body: redactUnknown(graph, knownSecrets) }
2554
- }
2555
- };
2556
- }
2557
- const data = graph.data && typeof graph.data === "object" && !Array.isArray(graph.data) ? graph.data : {};
2558
- return {
2559
- ok: true,
2560
- result: {
2561
- status: response.status,
2562
- requestId: responseRequestId,
2563
- data
2564
- }
2565
- };
2566
- } catch (error) {
2567
- const message = error instanceof Error ? error.message : "Network error.";
2568
- const timedOut = error instanceof Error && error.name === "AbortError";
2569
- return {
2570
- ok: false,
2571
- requestId,
2572
- error: {
2573
- code: timedOut ? "timeout" : "network_error",
2574
- message: redactSecrets(timedOut ? "Auth request timed out." : message, knownSecrets),
2575
- status: timedOut ? 408 : 503,
2576
- details: {}
2577
- }
2578
- };
2579
- } finally {
2580
- clearTimeout(timeoutId);
2581
- }
2582
- }
2583
-
2584
2638
  // src/commands/tasks.ts
2585
2639
  var projectIdSchema = import_zod2.z.string().min(1);
2586
2640
  var idSchema = import_zod2.z.string().min(1);
@@ -2609,44 +2663,6 @@ function parseTaskUpdateJson(raw) {
2609
2663
  function parseLabelIds(raw) {
2610
2664
  return raw.split(",").map((labelId) => labelId.trim()).filter((labelId) => labelId.length > 0);
2611
2665
  }
2612
- function asRecord3(value) {
2613
- if (!value || typeof value !== "object" || Array.isArray(value)) {
2614
- return null;
2615
- }
2616
- return value;
2617
- }
2618
- function asNonEmptyString2(value) {
2619
- if (typeof value !== "string") {
2620
- return void 0;
2621
- }
2622
- const trimmed = value.trim();
2623
- return trimmed.length > 0 ? trimmed : void 0;
2624
- }
2625
- async function resolveTaskReadOrganizationId(params) {
2626
- const resolvedOrganizationId = asNonEmptyString2(params.organizationId);
2627
- if (params.organizationIdSource === "flag" && resolvedOrganizationId) {
2628
- return resolvedOrganizationId;
2629
- }
2630
- const baseUrl = asNonEmptyString2(params.runtimeOptions.baseUrl);
2631
- const token = asNonEmptyString2(params.runtimeOptions.token);
2632
- if (baseUrl && token) {
2633
- const result = await authGraphqlRequest({
2634
- baseUrl,
2635
- token,
2636
- timeoutMs: typeof params.runtimeOptions.timeoutMs === "number" ? params.runtimeOptions.timeoutMs : 1e4,
2637
- query: "query WaveCliTaskReadOrganization { cliAuthStatus { authenticated baseAuthStatus organization { id slug } } }"
2638
- });
2639
- if (result.ok) {
2640
- const status = asRecord3(result.result.data.cliAuthStatus);
2641
- const organization = status ? asRecord3(status.organization) : null;
2642
- const organizationId = organization ? asNonEmptyString2(organization.id) : void 0;
2643
- if (organizationId) {
2644
- return organizationId;
2645
- }
2646
- }
2647
- }
2648
- return resolveOrganizationId(resolvedOrganizationId);
2649
- }
2650
2666
  function registerTaskCommands(program) {
2651
2667
  const tasks = program.command("tasks").description("Task operations");
2652
2668
  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("--open <open>").option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").action(async (opts, cmd) => {
@@ -2683,11 +2699,7 @@ function registerTaskCommands(program) {
2683
2699
  tasks.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
2684
2700
  const parsed = idSchema.parse(opts.id);
2685
2701
  const context = await resolveCommandContext(cmd.optsWithGlobals());
2686
- const organizationId = await resolveTaskReadOrganizationId({
2687
- organizationId: context.organizationId,
2688
- organizationIdSource: context.organizationIdSource,
2689
- runtimeOptions: context.runtimeOptions
2690
- });
2702
+ const organizationId = resolveOrganizationId(context.organizationId);
2691
2703
  await runGraphqlQueryCommand({
2692
2704
  command: "tasks.show",
2693
2705
  runtimeOptions: context.runtimeOptions,
@@ -2699,9 +2711,9 @@ function registerTaskCommands(program) {
2699
2711
  isShow: true
2700
2712
  });
2701
2713
  });
2702
- tasks.command("create").requiredOption("--project-id <projectId>").option("--title <title>", "Legacy alias for --summary").option("--summary <summary>").action(async (opts, cmd) => {
2714
+ tasks.command("create").requiredOption("--project-id <projectId>").option("--summary <summary>").action(async (opts, cmd) => {
2703
2715
  const projectId = projectIdSchema.parse(opts.projectId);
2704
- const summary = summarySchema.parse(opts.summary ?? opts.title);
2716
+ const summary = summarySchema.parse(opts.summary);
2705
2717
  const context = await resolveCommandContext(cmd.optsWithGlobals());
2706
2718
  const organizationId = resolveOrganizationId(context.organizationId);
2707
2719
  await runGraphqlMutationCommand({
@@ -3589,16 +3601,16 @@ var displayPreferenceAttributesSelectionSet = "attributes { id viewType favorite
3589
3601
  var filterPreferenceAttributesSelectionSet = "attributes { id filterType filter memberId focusMemberId focusTeamId filterableId filterableType preferenceType agendaItemId }";
3590
3602
  var healthUpdateSummarySelectionSet = "id type value memberId status createdAt updatedAt updatableType updatableId parentUpdateId emojis { id name memberId } resources { ...ResourceSummaryFull }";
3591
3603
  var projectShowFullSelectionSet = `{ id type name slug description status priority createdAt updatedAt startDate targetDate archivedAt memberId organizationId teamIds emoji { id name memberId } backgroundImage { backgroundType gradientStart gradientEnd gradientDegrees color imageUrl image { url lowUrl } } favorites { id memberId } resources { ...ResourceSummaryFull } displayPreference { id type ${displayPreferenceAttributesSelectionSet} viewType favorite groupingField groupToggleState memberId focusMemberId focusTeamId displayableId displayableType preferenceType agendaItemId } filterPreferences { id type ${filterPreferenceAttributesSelectionSet} filterType filter memberId focusMemberId focusTeamId filterableId filterableType preferenceType agendaItemId } healthUpdates { ${healthUpdateSummarySelectionSet} replies { ${healthUpdateSummarySelectionSet} replies { id type } } } } fragment ResourceSummaryFull on ResourceSummary { id resourceType slug url skillId skill { id name slug emoji scope description } metadata { urlName imageUrl siteName providerName mediaType skillId skillName skillSlug skillScope skillEmoji skillDescription } attachment { id fileKey filename url } content { id name slug type firstChildSlug childCount } }`;
3592
- function asRecord4(value) {
3604
+ function asRecord3(value) {
3593
3605
  return value && typeof value === "object" ? value : null;
3594
3606
  }
3595
3607
  function toNonEmptyString(value) {
3596
3608
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
3597
3609
  }
3598
3610
  function normalizeProjectRowForDisplay(row) {
3599
- const record = asRecord4(row);
3611
+ const record = asRecord3(row);
3600
3612
  if (!record) return row;
3601
- const attributes = asRecord4(record.attributes);
3613
+ const attributes = asRecord3(record.attributes);
3602
3614
  const topLevelName = toNonEmptyString(record.name);
3603
3615
  const topLevelTitle = toNonEmptyString(record.title);
3604
3616
  const attributeName = toNonEmptyString(attributes?.name);
@@ -3613,7 +3625,7 @@ function normalizeProjectRowForDisplay(row) {
3613
3625
  };
3614
3626
  }
3615
3627
  function normalizeProjectsListForDisplay(payload) {
3616
- const record = asRecord4(payload);
3628
+ const record = asRecord3(payload);
3617
3629
  if (!record || !Array.isArray(record.data)) return payload;
3618
3630
  return {
3619
3631
  ...record,
@@ -3821,7 +3833,7 @@ var MEETING_STATUSES = /* @__PURE__ */ new Set(["upcoming", "active", "completed
3821
3833
  var MEETING_REPEATS = /* @__PURE__ */ new Set(["never", "weekly", "biweekly", "monthly", "quarterly"]);
3822
3834
  var createHelp2 = buildDataJsonHelp("meeting", "create") ?? 'JSON object for meeting or {"meeting": {...}}';
3823
3835
  var updateHelp2 = buildDataJsonHelp("meeting", "update") ?? 'JSON object for meeting or {"meeting": {...}}';
3824
- function asNonEmptyString3(value) {
3836
+ function asNonEmptyString2(value) {
3825
3837
  if (typeof value !== "string") {
3826
3838
  return void 0;
3827
3839
  }
@@ -3879,7 +3891,7 @@ function normalizeMeetingCreateBody(body) {
3879
3891
  });
3880
3892
  }
3881
3893
  const meeting = { ...entity };
3882
- const type = asNonEmptyString3(meeting.type);
3894
+ const type = asNonEmptyString2(meeting.type);
3883
3895
  if (!type || !MEETING_TYPES.has(type)) {
3884
3896
  throw new CliError({
3885
3897
  message: "Invalid meeting.type. Use one of: TeamMeeting, OneOnOneMeeting.",
@@ -3889,8 +3901,8 @@ function normalizeMeetingCreateBody(body) {
3889
3901
  details: { field: "meeting.type", allowed: Array.from(MEETING_TYPES) }
3890
3902
  });
3891
3903
  }
3892
- const memberId = asNonEmptyString3(meeting.member_id);
3893
- const date = asNonEmptyString3(meeting.date);
3904
+ const memberId = asNonEmptyString2(meeting.member_id);
3905
+ const date = asNonEmptyString2(meeting.date);
3894
3906
  const startTime = toFiniteNumber(meeting.start_time, "meeting.start_time");
3895
3907
  const missingRequired = [];
3896
3908
  if (!memberId) missingRequired.push("member_id");
@@ -3905,7 +3917,7 @@ function normalizeMeetingCreateBody(body) {
3905
3917
  details: { requiredFields: ["member_id", "date", "start_time"], rootKey: "meeting" }
3906
3918
  });
3907
3919
  }
3908
- const status = asNonEmptyString3(meeting.status);
3920
+ const status = asNonEmptyString2(meeting.status);
3909
3921
  if (status && !MEETING_STATUSES.has(status)) {
3910
3922
  throw new CliError({
3911
3923
  message: "Invalid meeting.status. Use one of: upcoming, active, completed.",
@@ -3915,7 +3927,7 @@ function normalizeMeetingCreateBody(body) {
3915
3927
  details: { field: "meeting.status", allowed: Array.from(MEETING_STATUSES) }
3916
3928
  });
3917
3929
  }
3918
- const repeats = asNonEmptyString3(meeting.repeats) ?? "never";
3930
+ const repeats = asNonEmptyString2(meeting.repeats) ?? "never";
3919
3931
  if (!MEETING_REPEATS.has(repeats)) {
3920
3932
  throw new CliError({
3921
3933
  message: "Invalid meeting.repeats. Use one of: never, weekly, biweekly, monthly, quarterly.",
@@ -4204,7 +4216,7 @@ var SKILL_SELECTION = `{
4204
4216
  createdAt
4205
4217
  updatedAt
4206
4218
  }`;
4207
- function asRecord5(value) {
4219
+ function asRecord4(value) {
4208
4220
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
4209
4221
  }
4210
4222
  function findSkillById(id) {
@@ -4212,11 +4224,11 @@ function findSkillById(id) {
4212
4224
  if (!Array.isArray(payload)) {
4213
4225
  return null;
4214
4226
  }
4215
- return payload.find((entry2) => String(asRecord5(entry2)?.id ?? "") === id) ?? null;
4227
+ return payload.find((entry2) => String(asRecord4(entry2)?.id ?? "") === id) ?? null;
4216
4228
  };
4217
4229
  }
4218
4230
  function registerSkillCommands(program) {
4219
- const skills = program.command("skills").description("Read Skill records");
4231
+ const skills = program.command("skills").description("Skill record operations");
4220
4232
  skills.command("list").description("List Skill records").option("--scope <scope>", "Filter skills by scope").option("--query <query>", "Filter skills by search query").option("--limit <limit>", "Limit skills returned").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4221
4233
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4222
4234
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -4242,7 +4254,7 @@ function registerSkillCommands(program) {
4242
4254
  isList: true
4243
4255
  });
4244
4256
  });
4245
- skills.command("show").description("Read one Skill record by id").requiredOption("--id <id>", "Skill id").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4257
+ skills.command("show").description("Read one persisted Skill record by id").requiredOption("--id <id>", "Skill id").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4246
4258
  const id = idSchema7.parse(opts.id);
4247
4259
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4248
4260
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -4604,7 +4616,7 @@ function normalizeTodosCreateBody(body) {
4604
4616
  }
4605
4617
  return { ...body, todo };
4606
4618
  }
4607
- function asNonEmptyString4(value) {
4619
+ function asNonEmptyString3(value) {
4608
4620
  if (typeof value !== "string") {
4609
4621
  return void 0;
4610
4622
  }
@@ -4612,7 +4624,7 @@ function asNonEmptyString4(value) {
4612
4624
  return trimmed.length > 0 ? trimmed : void 0;
4613
4625
  }
4614
4626
  function validateEnumField(params) {
4615
- const value = asNonEmptyString4(params.rawValue);
4627
+ const value = asNonEmptyString3(params.rawValue);
4616
4628
  if (!value) {
4617
4629
  return void 0;
4618
4630
  }
@@ -4646,7 +4658,7 @@ function normalizeKnowledgeCreateBody(body) {
4646
4658
  message: "Invalid content.status. Use one of: draft, published."
4647
4659
  });
4648
4660
  content.status = status ?? "draft";
4649
- const memberId = asNonEmptyString4(content.member_id);
4661
+ const memberId = asNonEmptyString3(content.member_id);
4650
4662
  if (!memberId) {
4651
4663
  throwMissingRequiredCreateFields("content", ["member_id"]);
4652
4664
  }
@@ -4655,7 +4667,7 @@ function normalizeKnowledgeCreateBody(body) {
4655
4667
  }
4656
4668
  function normalizeNewsCreateBody(body) {
4657
4669
  const headline = ensureEntityObject(body, "headline");
4658
- const memberId = asNonEmptyString4(headline.member_id);
4670
+ const memberId = asNonEmptyString3(headline.member_id);
4659
4671
  if (!memberId) {
4660
4672
  throwMissingRequiredCreateFields("headline", ["member_id"]);
4661
4673
  }
@@ -4684,14 +4696,14 @@ function normalizeNewsCreateBody(body) {
4684
4696
  }
4685
4697
  function normalizeQuestionsCreateBody(body) {
4686
4698
  const question = ensureEntityObject(body, "question");
4687
- const summary = asNonEmptyString4(question.summary);
4688
- const currentName = asNonEmptyString4(question.name);
4699
+ const summary = asNonEmptyString3(question.summary);
4700
+ const currentName = asNonEmptyString3(question.name);
4689
4701
  if (!currentName && summary) {
4690
4702
  question.name = summary;
4691
4703
  }
4692
4704
  delete question.summary;
4693
- const name = asNonEmptyString4(question.name);
4694
- const memberId = asNonEmptyString4(question.member_id);
4705
+ const name = asNonEmptyString3(question.name);
4706
+ const memberId = asNonEmptyString3(question.member_id);
4695
4707
  const missing = [];
4696
4708
  if (!name) missing.push("name");
4697
4709
  if (!memberId) missing.push("member_id");
@@ -4713,13 +4725,13 @@ function normalizeQuestionsCreateBody(body) {
4713
4725
  }
4714
4726
  function normalizeQuestionsUpdateBody(body) {
4715
4727
  const question = ensureEntityObject(body, "question");
4716
- const summary = asNonEmptyString4(question.summary);
4717
- const currentName = asNonEmptyString4(question.name);
4728
+ const summary = asNonEmptyString3(question.summary);
4729
+ const currentName = asNonEmptyString3(question.name);
4718
4730
  if (!currentName && summary) {
4719
4731
  question.name = summary;
4720
4732
  }
4721
4733
  delete question.summary;
4722
- const name = asNonEmptyString4(question.name);
4734
+ const name = asNonEmptyString3(question.name);
4723
4735
  if (name) {
4724
4736
  question.name = name;
4725
4737
  }
@@ -4736,9 +4748,9 @@ function normalizeQuestionsUpdateBody(body) {
4736
4748
  }
4737
4749
  function normalizePulseCreateBody(body) {
4738
4750
  const healthUpdate = ensureEntityObject(body, "health_update");
4739
- const healthUpdatableId = asNonEmptyString4(healthUpdate.health_updatable_id) ?? asNonEmptyString4(healthUpdate.updatable_id);
4740
- const healthUpdatableType = asNonEmptyString4(healthUpdate.health_updatable_type) ?? asNonEmptyString4(healthUpdate.updatable_type);
4741
- const memberId = asNonEmptyString4(healthUpdate.member_id);
4751
+ const healthUpdatableId = asNonEmptyString3(healthUpdate.health_updatable_id) ?? asNonEmptyString3(healthUpdate.updatable_id);
4752
+ const healthUpdatableType = asNonEmptyString3(healthUpdate.health_updatable_type) ?? asNonEmptyString3(healthUpdate.updatable_type);
4753
+ const memberId = asNonEmptyString3(healthUpdate.member_id);
4742
4754
  const status = validateEnumField({
4743
4755
  rawValue: healthUpdate.status,
4744
4756
  field: "health_update.status",
@@ -4763,8 +4775,8 @@ function normalizePulseCreateBody(body) {
4763
4775
  }
4764
4776
  function normalizeSurveysCreateBody(body) {
4765
4777
  const survey = ensureEntityObject(body, "survey");
4766
- const title = asNonEmptyString4(survey.title);
4767
- const currentName = asNonEmptyString4(survey.name);
4778
+ const title = asNonEmptyString3(survey.title);
4779
+ const currentName = asNonEmptyString3(survey.name);
4768
4780
  if (!currentName && title) {
4769
4781
  survey.name = title;
4770
4782
  }
@@ -4793,8 +4805,8 @@ function normalizeSurveysCreateBody(body) {
4793
4805
  }
4794
4806
  function normalizeSurveysUpdateBody(body) {
4795
4807
  const survey = ensureEntityObject(body, "survey");
4796
- const title = asNonEmptyString4(survey.title);
4797
- const currentName = asNonEmptyString4(survey.name);
4808
+ const title = asNonEmptyString3(survey.title);
4809
+ const currentName = asNonEmptyString3(survey.name);
4798
4810
  if (!currentName && title) {
4799
4811
  survey.name = title;
4800
4812
  }
@@ -4821,8 +4833,8 @@ function normalizeSurveysUpdateBody(body) {
4821
4833
  }
4822
4834
  function normalizeFeedbacksCreateBody(body) {
4823
4835
  const feedback = ensureEntityObject(body, "feedback");
4824
- const title = asNonEmptyString4(feedback.title);
4825
- const currentName = asNonEmptyString4(feedback.name);
4836
+ const title = asNonEmptyString3(feedback.title);
4837
+ const currentName = asNonEmptyString3(feedback.name);
4826
4838
  if (!currentName && title) {
4827
4839
  feedback.name = title;
4828
4840
  }
@@ -4839,7 +4851,7 @@ function normalizeFeedbacksCreateBody(body) {
4839
4851
  allowed: FEEDBACK_QUARTERS,
4840
4852
  message: "Invalid feedback.quarter. Use one of: q1, q2, q3, q4."
4841
4853
  });
4842
- const year = asNonEmptyString4(feedback.year);
4854
+ const year = asNonEmptyString3(feedback.year);
4843
4855
  const missing = [];
4844
4856
  if (!name) missing.push("name");
4845
4857
  if (!quarter) missing.push("quarter");
@@ -4854,8 +4866,8 @@ function normalizeFeedbacksCreateBody(body) {
4854
4866
  }
4855
4867
  function normalizeFeedbacksUpdateBody(body) {
4856
4868
  const feedback = ensureEntityObject(body, "feedback");
4857
- const title = asNonEmptyString4(feedback.title);
4858
- const currentName = asNonEmptyString4(feedback.name);
4869
+ const title = asNonEmptyString3(feedback.title);
4870
+ const currentName = asNonEmptyString3(feedback.name);
4859
4871
  if (!currentName && title) {
4860
4872
  feedback.name = title;
4861
4873
  }
@@ -4882,14 +4894,14 @@ function normalizeFeedbacksUpdateBody(body) {
4882
4894
  }
4883
4895
  function normalizeAccountabilityCreateBody(body) {
4884
4896
  const responsibility = ensureEntityObject(body, "responsibility");
4885
- const summary = asNonEmptyString4(responsibility.summary);
4886
- const currentName = asNonEmptyString4(responsibility.name);
4897
+ const summary = asNonEmptyString3(responsibility.summary);
4898
+ const currentName = asNonEmptyString3(responsibility.name);
4887
4899
  if (!currentName && summary) {
4888
4900
  responsibility.name = summary;
4889
4901
  }
4890
4902
  delete responsibility.summary;
4891
- const name = asNonEmptyString4(responsibility.name);
4892
- const memberId = asNonEmptyString4(responsibility.member_id);
4903
+ const name = asNonEmptyString3(responsibility.name);
4904
+ const memberId = asNonEmptyString3(responsibility.member_id);
4893
4905
  const missing = [];
4894
4906
  if (!name) missing.push("name");
4895
4907
  if (!memberId) missing.push("member_id");
@@ -4904,8 +4916,8 @@ function normalizeAccountabilityCreateBody(body) {
4904
4916
  }
4905
4917
  function normalizeAccountabilityUpdateBody(body) {
4906
4918
  const responsibility = ensureEntityObject(body, "responsibility");
4907
- const summary = asNonEmptyString4(responsibility.summary);
4908
- const currentName = asNonEmptyString4(responsibility.name);
4919
+ const summary = asNonEmptyString3(responsibility.summary);
4920
+ const currentName = asNonEmptyString3(responsibility.name);
4909
4921
  if (!currentName && summary) {
4910
4922
  responsibility.name = summary;
4911
4923
  }
@@ -4937,7 +4949,7 @@ function parseSmartKpiViewCreateBody(raw) {
4937
4949
  }
4938
4950
  function normalizeSmartKpiViewCreateBody(body) {
4939
4951
  const smartKpiView = ensureEntityObject(body, "smart_kpi_view");
4940
- const name = asNonEmptyString4(smartKpiView.name);
4952
+ const name = asNonEmptyString3(smartKpiView.name);
4941
4953
  if (!name) {
4942
4954
  throwMissingRequiredCreateFields("smart_kpi_view", ["name"]);
4943
4955
  }
@@ -4975,9 +4987,9 @@ function buildKpisCreateMutation(params) {
4975
4987
  });
4976
4988
  }
4977
4989
  const smartKpi = { ...entity };
4978
- const name = asNonEmptyString4(smartKpi.name);
4979
- const smartKpiViewId = asNonEmptyString4(smartKpi.smart_kpi_view_id);
4980
- const measurableGroupId = asNonEmptyString4(smartKpi.measurable_group_id);
4990
+ const name = asNonEmptyString3(smartKpi.name);
4991
+ const smartKpiViewId = asNonEmptyString3(smartKpi.smart_kpi_view_id);
4992
+ const measurableGroupId = asNonEmptyString3(smartKpi.measurable_group_id);
4981
4993
  const hasAllowedName = typeof name === "string" && SMART_KPI_NAME_SET.has(name);
4982
4994
  if (!name) {
4983
4995
  throw new CliError({
@@ -4997,7 +5009,7 @@ function buildKpisCreateMutation(params) {
4997
5009
  measurable_type: "number",
4998
5010
  condition: "greater_than_or_equal_to"
4999
5011
  };
5000
- const notes = asNonEmptyString4(smartKpi.notes);
5012
+ const notes = asNonEmptyString3(smartKpi.notes);
5001
5013
  if (notes) {
5002
5014
  measurable.notes = notes;
5003
5015
  }
@@ -5400,7 +5412,7 @@ function ensureRootObject(body, rootKey) {
5400
5412
  }
5401
5413
  return { ...root };
5402
5414
  }
5403
- function asNonEmptyString5(value) {
5415
+ function asNonEmptyString4(value) {
5404
5416
  if (typeof value !== "string") {
5405
5417
  return void 0;
5406
5418
  }
@@ -5410,7 +5422,7 @@ function asNonEmptyString5(value) {
5410
5422
  function normalizeOrganizationUpdateBody(body) {
5411
5423
  const organization = ensureRootObject(body, "organization");
5412
5424
  const detail = isRecord3(organization.organization_detail_attributes) ? { ...organization.organization_detail_attributes } : {};
5413
- const workspaceName = asNonEmptyString5(organization.workspace_name);
5425
+ const workspaceName = asNonEmptyString4(organization.workspace_name);
5414
5426
  if (workspaceName) {
5415
5427
  detail.workspace_name = workspaceName;
5416
5428
  }
@@ -5423,7 +5435,7 @@ function normalizeOrganizationUpdateBody(body) {
5423
5435
  function normalizeOrganizationMetaProfileUpdateBody(body) {
5424
5436
  const root = ensureRootObject(body, "organization_meta_profile");
5425
5437
  const profile = isRecord3(root.profile) ? { ...root.profile } : {};
5426
- const title = asNonEmptyString5(root.title);
5438
+ const title = asNonEmptyString4(root.title);
5427
5439
  if (title) {
5428
5440
  const companyIdentity = isRecord3(profile.company_identity) ? { ...profile.company_identity } : {};
5429
5441
  companyIdentity.one_sentence_summary = title;
@@ -5453,7 +5465,7 @@ function normalizeOrganizationMetaProfileUpdateBody(body) {
5453
5465
  function normalizeKeyMetricMetaProfileUpdateBody(body) {
5454
5466
  const root = ensureRootObject(body, "key_metric_meta_profile");
5455
5467
  const profile = isRecord3(root.profile) ? { ...root.profile } : {};
5456
- const annualRevenue = asNonEmptyString5(root.annual_revenue);
5468
+ const annualRevenue = asNonEmptyString4(root.annual_revenue);
5457
5469
  if (annualRevenue) {
5458
5470
  const financial = isRecord3(profile.financial) ? { ...profile.financial } : {};
5459
5471
  financial.revenue = annualRevenue;
@@ -5624,7 +5636,7 @@ function ensureRootObject2(body, rootKey) {
5624
5636
  }
5625
5637
  return { ...root };
5626
5638
  }
5627
- function asNonEmptyString6(value) {
5639
+ function asNonEmptyString5(value) {
5628
5640
  if (typeof value !== "string") {
5629
5641
  return void 0;
5630
5642
  }
@@ -5652,8 +5664,8 @@ function normalizeStrategicPlanUpdateBody(body) {
5652
5664
  }
5653
5665
  function normalizeStrategicObjectiveUpdateBody(body) {
5654
5666
  const strategicObjective = ensureRootObject2(body, "strategic_objective");
5655
- const title = asNonEmptyString6(strategicObjective.title);
5656
- if (!asNonEmptyString6(strategicObjective.summary) && title) {
5667
+ const title = asNonEmptyString5(strategicObjective.title);
5668
+ if (!asNonEmptyString5(strategicObjective.summary) && title) {
5657
5669
  strategicObjective.summary = title;
5658
5670
  }
5659
5671
  delete strategicObjective.title;
@@ -5676,8 +5688,8 @@ function normalizeStrategicObjectiveUpdateBody(body) {
5676
5688
  }
5677
5689
  function normalizeAnnualObjectiveCreateBody(body) {
5678
5690
  const annualObjective = ensureRootObject2(body, "annual_objective");
5679
- const title = asNonEmptyString6(annualObjective.title);
5680
- if (!asNonEmptyString6(annualObjective.name) && title) {
5691
+ const title = asNonEmptyString5(annualObjective.title);
5692
+ if (!asNonEmptyString5(annualObjective.name) && title) {
5681
5693
  annualObjective.name = title;
5682
5694
  }
5683
5695
  delete annualObjective.title;
@@ -5685,8 +5697,8 @@ function normalizeAnnualObjectiveCreateBody(body) {
5685
5697
  }
5686
5698
  function normalizeQuarterlyObjectiveCreateBody(body) {
5687
5699
  const quarterlyObjective = ensureRootObject2(body, "quarterly_objective");
5688
- const title = asNonEmptyString6(quarterlyObjective.title);
5689
- if (!asNonEmptyString6(quarterlyObjective.name) && title) {
5700
+ const title = asNonEmptyString5(quarterlyObjective.title);
5701
+ if (!asNonEmptyString5(quarterlyObjective.name) && title) {
5690
5702
  quarterlyObjective.name = title;
5691
5703
  }
5692
5704
  delete quarterlyObjective.title;
@@ -6487,7 +6499,7 @@ var import_zod16 = require("zod");
6487
6499
 
6488
6500
  // src/internalOptions.ts
6489
6501
  var INTERNAL_OPTIONS_KEY = "__waveInternalOptions";
6490
- function asRecord6(value) {
6502
+ function asRecord5(value) {
6491
6503
  if (!value || typeof value !== "object" || Array.isArray(value)) {
6492
6504
  return null;
6493
6505
  }
@@ -6501,7 +6513,7 @@ function setInternalCliOptions(program, options) {
6501
6513
  function getInternalCliOptions(command) {
6502
6514
  let current = command;
6503
6515
  while (current) {
6504
- const record = asRecord6(current[INTERNAL_OPTIONS_KEY]);
6516
+ const record = asRecord5(current[INTERNAL_OPTIONS_KEY]);
6505
6517
  if (record) {
6506
6518
  return {
6507
6519
  enableRetryOnEmptyPhrase: record.enableRetryOnEmptyPhrase === true
@@ -10173,7 +10185,7 @@ function positiveInt2(raw, fallback) {
10173
10185
  function requestTimeoutMs(totalTimeoutMs) {
10174
10186
  return Math.max(1e3, Math.min(totalTimeoutMs, 1e4));
10175
10187
  }
10176
- function asRecord7(value) {
10188
+ function asRecord6(value) {
10177
10189
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
10178
10190
  }
10179
10191
  function asString(value) {
@@ -10220,9 +10232,9 @@ function cliTokenFromPoll(payload) {
10220
10232
  return asString(payload.cliToken) ?? asString(payload.cli_token) ?? asString(payload.token);
10221
10233
  }
10222
10234
  function unwrapMutationResult(value) {
10223
- const record = asRecord7(value);
10235
+ const record = asRecord6(value);
10224
10236
  if (!record) return null;
10225
- const data = asRecord7(record.data);
10237
+ const data = asRecord6(record.data);
10226
10238
  if (data && (Object.prototype.hasOwnProperty.call(record, "ok") || Object.prototype.hasOwnProperty.call(record, "errors") || Object.prototype.hasOwnProperty.call(record, "errorCode") || Object.prototype.hasOwnProperty.call(record, "error_code"))) {
10227
10239
  return data;
10228
10240
  }
@@ -10240,7 +10252,7 @@ async function authStatusRequest(params) {
10240
10252
  });
10241
10253
  }
10242
10254
  async function runTokenLogin(cmd, opts) {
10243
- const context = await resolveCommandContext(cmd.optsWithGlobals());
10255
+ const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10244
10256
  const baseUrl = context.runtimeOptions.baseUrl;
10245
10257
  const globals = cmd.optsWithGlobals();
10246
10258
  const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : context.runtimeOptions.token;
@@ -10286,7 +10298,7 @@ async function runTokenLogin(cmd, opts) {
10286
10298
  exitCode: mapStatusToExitCode(status.error.status)
10287
10299
  });
10288
10300
  }
10289
- const statusData = asRecord7(status.result.data.cliAuthStatus) ?? {};
10301
+ const statusData = asRecord6(status.result.data.cliAuthStatus) ?? {};
10290
10302
  const storage = await writeStoredToken(token, baseUrl);
10291
10303
  const configPath2 = opts.saveBaseUrl ? await persistBaseUrl(baseUrl) : void 0;
10292
10304
  return printEnvelopeAndExit({
@@ -10307,7 +10319,7 @@ async function runTokenLogin(cmd, opts) {
10307
10319
  });
10308
10320
  }
10309
10321
  async function runBrowserLogin(cmd, opts) {
10310
- const context = await resolveCommandContext(cmd.optsWithGlobals());
10322
+ const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10311
10323
  const baseUrl = context.runtimeOptions.baseUrl;
10312
10324
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, DEFAULT_LOGIN_TIMEOUT_MS);
10313
10325
  const pollIntervalMs = positiveInt2(opts.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
@@ -10487,7 +10499,7 @@ async function runBrowserLogin(cmd, opts) {
10487
10499
  });
10488
10500
  }
10489
10501
  async function runLogout(cmd) {
10490
- const context = await resolveCommandContext(cmd.optsWithGlobals());
10502
+ const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10491
10503
  const baseUrl = context.runtimeOptions.baseUrl;
10492
10504
  const token = context.runtimeOptions.token;
10493
10505
  const timeoutMs = positiveInt2(context.runtimeOptions.timeoutMs, 1e4);
@@ -10503,7 +10515,7 @@ async function runLogout(cmd) {
10503
10515
  });
10504
10516
  if (result.ok) {
10505
10517
  requestId = result.result.requestId;
10506
- const payload = asRecord7(result.result.data.revokeCliToken) ?? {};
10518
+ const payload = asRecord6(result.result.data.revokeCliToken) ?? {};
10507
10519
  revokedRemote = payload.ok !== false;
10508
10520
  } else {
10509
10521
  requestId = result.requestId;
@@ -10526,7 +10538,7 @@ async function runLogout(cmd) {
10526
10538
  });
10527
10539
  }
10528
10540
  async function runAuthStatus(cmd) {
10529
- const context = await resolveCommandContext(cmd.optsWithGlobals());
10541
+ const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10530
10542
  const baseUrl = context.runtimeOptions.baseUrl;
10531
10543
  const token = context.runtimeOptions.token;
10532
10544
  const tokenSource = context.runtimeOptions.tokenSource ?? "none";
@@ -10566,7 +10578,7 @@ async function runAuthStatus(cmd) {
10566
10578
  exitCode: mapStatusToExitCode(result.error.status)
10567
10579
  });
10568
10580
  }
10569
- const status = asRecord7(result.result.data.cliAuthStatus) ?? {};
10581
+ const status = asRecord6(result.result.data.cliAuthStatus) ?? {};
10570
10582
  const baseAuthStatus = status.baseAuthStatus;
10571
10583
  return printEnvelopeAndExit({
10572
10584
  envelope: envelope({
@@ -12217,11 +12229,11 @@ function sanitizePlannerJson(value) {
12217
12229
  }
12218
12230
  return output;
12219
12231
  }
12220
- function asRecord8(value) {
12232
+ function asRecord7(value) {
12221
12233
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
12222
12234
  }
12223
12235
  function readPlannerStateKey(value, keys) {
12224
- const record = asRecord8(value);
12236
+ const record = asRecord7(value);
12225
12237
  if (!record) {
12226
12238
  return null;
12227
12239
  }
@@ -14886,6 +14898,259 @@ function registerAiNotesCommands(program) {
14886
14898
  });
14887
14899
  }
14888
14900
 
14901
+ // src/commands/atlasAuthoring.ts
14902
+ var import_zod19 = require("zod");
14903
+ var idSchema14 = import_zod19.z.string().trim().min(1);
14904
+ var idempotencyKeySchema = import_zod19.z.string().min(1).refine((value) => value.trim() === value, "Idempotency key must not have leading or trailing whitespace.");
14905
+ var skillScopeSchema = import_zod19.z.enum(["ADMIN_GLOBAL", "MEMBER_PERSONAL"]);
14906
+ var isoDateSchema = import_zod19.z.iso.date();
14907
+ var AGENT_SELECTION = `{
14908
+ id
14909
+ type
14910
+ name
14911
+ slug
14912
+ description
14913
+ notes
14914
+ status
14915
+ visibility
14916
+ model
14917
+ runWhenMentioned
14918
+ webAccessEnabled
14919
+ organizationId
14920
+ memberId
14921
+ createdAt
14922
+ updatedAt
14923
+ }`;
14924
+ var AUTOMATION_SELECTION = `{
14925
+ id
14926
+ type
14927
+ summary
14928
+ slug
14929
+ description
14930
+ notes
14931
+ status
14932
+ priority
14933
+ taskType
14934
+ aiTaskConfig
14935
+ organizationId
14936
+ memberId
14937
+ createdAt
14938
+ updatedAt
14939
+ }`;
14940
+ function asRecord8(value) {
14941
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
14942
+ }
14943
+ function asRequiredString(value) {
14944
+ if (typeof value !== "string") return null;
14945
+ const trimmed = value.trim();
14946
+ return trimmed.length > 0 ? trimmed : null;
14947
+ }
14948
+ function parseBooleanOption(value, optionName) {
14949
+ if (value === void 0) return void 0;
14950
+ if (value === "true") return true;
14951
+ if (value === "false") return false;
14952
+ throw new CliError({
14953
+ message: `Invalid ${optionName}: expected true or false.`,
14954
+ kind: "invalid_args",
14955
+ status: 400,
14956
+ exitCode: EXIT_CODES.invalidArgs
14957
+ });
14958
+ }
14959
+ function parseCommaSeparatedStrings(value) {
14960
+ if (value === void 0) return void 0;
14961
+ const entries = String(value).split(",").map((entry2) => entry2.trim()).filter((entry2) => entry2.length > 0);
14962
+ if (entries.length === 0) {
14963
+ throw new CliError({
14964
+ message: "--trusted-urls must include at least one URL.",
14965
+ kind: "invalid_args",
14966
+ status: 400,
14967
+ exitCode: EXIT_CODES.invalidArgs
14968
+ });
14969
+ }
14970
+ return entries;
14971
+ }
14972
+ function parseJson(value, optionName) {
14973
+ try {
14974
+ return JSON.parse(value);
14975
+ } catch (error) {
14976
+ throw new CliError({
14977
+ message: error instanceof Error ? `Invalid ${optionName}: ${error.message}` : `Invalid ${optionName}.`,
14978
+ kind: "invalid_args",
14979
+ status: 400,
14980
+ exitCode: EXIT_CODES.invalidArgs
14981
+ });
14982
+ }
14983
+ }
14984
+ function normalizePersistedCreatePayload(payload) {
14985
+ const mutation = asRecord8(payload);
14986
+ const mutationData = asRecord8(mutation?.data);
14987
+ const persisted = asRecord8(mutationData?.data) ?? mutationData;
14988
+ const attributes = asRecord8(persisted?.attributes);
14989
+ const meta = asRecord8(mutationData?.meta);
14990
+ const idempotency = asRecord8(meta?.atlas_idempotency);
14991
+ const id = asRequiredString(persisted?.id);
14992
+ const slug = asRequiredString(persisted?.slug) ?? asRequiredString(attributes?.slug);
14993
+ const replay = idempotency?.replay;
14994
+ if (!mutation || !mutationData || !persisted || !id || !slug || !idempotency || typeof replay !== "boolean") {
14995
+ throw new CliError({
14996
+ message: "Create response did not include persisted id/slug and idempotency metadata.",
14997
+ kind: "malformed_response",
14998
+ status: 502,
14999
+ exitCode: EXIT_CODES.networkOrUpstream
15000
+ });
15001
+ }
15002
+ return {
15003
+ ok: mutation.ok,
15004
+ status: mutation.status,
15005
+ errorCode: mutation.errorCode ?? null,
15006
+ errors: mutation.errors ?? null,
15007
+ persisted: { id, slug },
15008
+ idempotency: {
15009
+ object_type: asRequiredString(idempotency.object_type),
15010
+ id: asRequiredString(idempotency.id),
15011
+ slug: asRequiredString(idempotency.slug),
15012
+ idempotency_key: asRequiredString(idempotency.idempotency_key),
15013
+ fingerprint: asRequiredString(idempotency.fingerprint),
15014
+ replay,
15015
+ action: asRequiredString(idempotency.action)
15016
+ }
15017
+ };
15018
+ }
15019
+ function registerAtlasAuthoringCommands(program) {
15020
+ const agents = program.command("agents").description("Bounded Agent authoring operations");
15021
+ agents.command("create").description("Create an Agent through the API-owned createAgent contract").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--name <name>").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").action(async (opts, cmd) => {
15022
+ const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15023
+ const runWhenMentioned = parseBooleanOption(opts.runWhenMentioned, "--run-when-mentioned");
15024
+ const webAccessEnabled = parseBooleanOption(opts.webAccessEnabled, "--web-access-enabled");
15025
+ const trustedUrls = parseCommaSeparatedStrings(opts.trustedUrls);
15026
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15027
+ const organizationId = resolveOrganizationId(context.organizationId);
15028
+ await runGraphqlMutationCommand({
15029
+ command: "agents.create",
15030
+ operationName: "AgentsCreate",
15031
+ runtimeOptions: context.runtimeOptions,
15032
+ field: "create_agent",
15033
+ variableTypes: {
15034
+ organization_id: "ID!",
15035
+ params: "CreateAgentParamsInput!",
15036
+ idempotency_key: "String!"
15037
+ },
15038
+ variables: {
15039
+ organization_id: organizationId,
15040
+ params: {
15041
+ agent: {
15042
+ ...opts.name !== void 0 ? { name: String(opts.name) } : {},
15043
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15044
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15045
+ ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15046
+ ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15047
+ ...opts.visibility !== void 0 ? { visibility: String(opts.visibility) } : {},
15048
+ ...opts.model !== void 0 ? { model: String(opts.model) } : {},
15049
+ ...runWhenMentioned !== void 0 ? { run_when_mentioned: runWhenMentioned } : {},
15050
+ ...webAccessEnabled !== void 0 ? { web_access_enabled: webAccessEnabled } : {},
15051
+ ...trustedUrls !== void 0 ? { trusted_urls: trustedUrls } : {}
15052
+ }
15053
+ },
15054
+ idempotency_key: idempotencyKey
15055
+ },
15056
+ transformMutationPayload: normalizePersistedCreatePayload
15057
+ });
15058
+ });
15059
+ agents.command("show").description("Read one persisted Agent by id").requiredOption("--id <id>", "Agent id").action(async (opts, cmd) => {
15060
+ const id = idSchema14.parse(opts.id);
15061
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15062
+ const organizationId = resolveOrganizationId(context.organizationId);
15063
+ await runGraphqlQueryCommand({
15064
+ command: "agents.show",
15065
+ operationName: "AgentsShow",
15066
+ runtimeOptions: context.runtimeOptions,
15067
+ field: "agent",
15068
+ variables: { organization_id: organizationId, id },
15069
+ variableTypes: { organization_id: "ID!", id: "ID!" },
15070
+ selectionSet: AGENT_SELECTION,
15071
+ isShow: true
15072
+ });
15073
+ });
15074
+ const automations = program.command("automations").description("Bounded Automation authoring operations");
15075
+ automations.command("create").description("Create an Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15076
+ const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15077
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15078
+ const organizationId = resolveOrganizationId(context.organizationId);
15079
+ await runGraphqlMutationCommand({
15080
+ command: "automations.create",
15081
+ operationName: "AutomationsCreate",
15082
+ runtimeOptions: context.runtimeOptions,
15083
+ field: "create_automation",
15084
+ variableTypes: {
15085
+ organization_id: "ID!",
15086
+ input: "CreateAutomationInput!",
15087
+ idempotency_key: "String!"
15088
+ },
15089
+ variables: {
15090
+ organization_id: organizationId,
15091
+ input: {
15092
+ summary: idSchema14.parse(opts.summary),
15093
+ ai_task_config: parseJson(String(opts.aiTaskConfig), "--ai-task-config"),
15094
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15095
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15096
+ ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15097
+ ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15098
+ ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15099
+ ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
15100
+ },
15101
+ idempotency_key: idempotencyKey
15102
+ },
15103
+ transformMutationPayload: normalizePersistedCreatePayload
15104
+ });
15105
+ });
15106
+ automations.command("show").description("Read one persisted Automation by id").requiredOption("--id <id>", "Automation id").action(async (opts, cmd) => {
15107
+ const id = idSchema14.parse(opts.id);
15108
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15109
+ const organizationId = resolveOrganizationId(context.organizationId);
15110
+ await runGraphqlQueryCommand({
15111
+ command: "automations.show",
15112
+ operationName: "AutomationsShow",
15113
+ runtimeOptions: context.runtimeOptions,
15114
+ field: "automation",
15115
+ variables: { organization_id: organizationId, id },
15116
+ variableTypes: { organization_id: "ID!", id: "ID!" },
15117
+ selectionSet: AUTOMATION_SELECTION,
15118
+ isShow: true
15119
+ });
15120
+ });
15121
+ const skills = program.commands.find((command) => command.name() === "skills");
15122
+ if (!skills) {
15123
+ throw new Error("Skills command must be registered before Atlas authoring commands.");
15124
+ }
15125
+ skills.command("create").description("Create a Skill through the API-owned createSkill contract").requiredOption("--name <name>").requiredOption("--scope <scope>", "ADMIN_GLOBAL or MEMBER_PERSONAL").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--emoji <emoji>").option("--description <description>").action(async (opts, cmd) => {
15126
+ const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15127
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15128
+ const organizationId = resolveOrganizationId(context.organizationId);
15129
+ await runGraphqlMutationCommand({
15130
+ command: "skills.create",
15131
+ operationName: "SkillsCreate",
15132
+ runtimeOptions: context.runtimeOptions,
15133
+ field: "create_skill",
15134
+ variableTypes: {
15135
+ organization_id: "ID!",
15136
+ input: "CreateSkillInput!",
15137
+ idempotency_key: "String!"
15138
+ },
15139
+ variables: {
15140
+ organization_id: organizationId,
15141
+ input: {
15142
+ name: idSchema14.parse(opts.name),
15143
+ scope: skillScopeSchema.parse(opts.scope),
15144
+ ...opts.emoji !== void 0 ? { emoji: String(opts.emoji) } : {},
15145
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {}
15146
+ },
15147
+ idempotency_key: idempotencyKey
15148
+ },
15149
+ transformMutationPayload: normalizePersistedCreatePayload
15150
+ });
15151
+ });
15152
+ }
15153
+
14889
15154
  // src/commands/discovery.ts
14890
15155
  var import_node_fs4 = require("fs");
14891
15156
  var import_node_path4 = require("path");
@@ -14906,6 +15171,8 @@ var PRIMARY_NAMESPACES = [
14906
15171
  "rocks",
14907
15172
  "meetings",
14908
15173
  "members",
15174
+ "agents",
15175
+ "automations",
14909
15176
  "skills",
14910
15177
  "teams",
14911
15178
  "issues",
@@ -15019,20 +15286,62 @@ var NAMESPACE_DOCS = {
15019
15286
  skills: {
15020
15287
  name: "skills",
15021
15288
  tier: "primary",
15022
- description: "Read-only Skill record proof surfaces.",
15289
+ description: "Skill record readback and bounded create operations.",
15023
15290
  examples: [
15024
15291
  "wave skills list --json",
15025
15292
  "wave skills list --scope ADMIN_GLOBAL --json",
15026
- "wave skills show --id 123 --json"
15293
+ "wave skills show --id 123 --json",
15294
+ 'wave skills create --name "Weekly planning" --scope MEMBER_PERSONAL --idempotency-key skill-create-001'
15027
15295
  ],
15028
15296
  schema: {
15029
15297
  output: "json-envelope-default",
15030
- readOnly: true,
15298
+ mutates: true,
15031
15299
  safety: [
15032
15300
  "Uses API-owned Skill GraphQL read fields only.",
15033
- "Does not create, update, destroy, archive, approve, or apply Skill records."
15301
+ "Create calls only createSkill with an explicit idempotency key.",
15302
+ "Skill create supports the API-defined ADMIN_GLOBAL and MEMBER_PERSONAL scopes.",
15303
+ "Does not update, destroy, archive, approve, or apply Skill records."
15034
15304
  ],
15035
- commands: ["list", "show"]
15305
+ commands: ["list", "show", "create"]
15306
+ }
15307
+ },
15308
+ agents: {
15309
+ name: "agents",
15310
+ tier: "primary",
15311
+ description: "Bounded Agent create and persisted readback operations.",
15312
+ examples: [
15313
+ 'wave agents create --name "Planning helper" --idempotency-key agent-create-001',
15314
+ "wave agents show --id 123"
15315
+ ],
15316
+ schema: {
15317
+ output: "json-envelope-default",
15318
+ mutates: true,
15319
+ safety: [
15320
+ "Create calls only createAgent with an explicit idempotency key.",
15321
+ "Create preserves API-owned defaults by sending only supplied typed Agent fields.",
15322
+ "Show uses the API-owned agent query by id; no slug fallback is implemented."
15323
+ ],
15324
+ commands: ["create", "show"]
15325
+ }
15326
+ },
15327
+ automations: {
15328
+ name: "automations",
15329
+ tier: "primary",
15330
+ description: "Bounded Automation create and persisted readback operations.",
15331
+ examples: [
15332
+ `wave automations create --summary "Weekly review" --ai-task-config '{"prompt":"Review tasks"}' --idempotency-key automation-create-001`,
15333
+ "wave automations show --id 123"
15334
+ ],
15335
+ schema: {
15336
+ output: "json-envelope-default",
15337
+ mutates: true,
15338
+ safety: [
15339
+ "Create calls only createAutomation with an explicit idempotency key.",
15340
+ "Only the API-defined ai_task_config field accepts validated JSON.",
15341
+ "Does not create a project Task, run an Automation, or invoke AI OS actions.",
15342
+ "Show uses the API-owned automation query by id; no slug fallback is implemented."
15343
+ ],
15344
+ commands: ["create", "show"]
15036
15345
  }
15037
15346
  },
15038
15347
  broadcast: {
@@ -15380,12 +15689,39 @@ function namespaceDoc(name) {
15380
15689
  }
15381
15690
  };
15382
15691
  }
15383
- function allNamespaceDocs() {
15384
- return [
15385
- ...PRIMARY_NAMESPACES.map(namespaceDoc),
15386
- ...ADVANCED_NAMESPACES.map(namespaceDoc),
15387
- ...ALIASES.map(namespaceDoc)
15388
- ];
15692
+ function advertisedCommands(command) {
15693
+ const children = command.commands.filter((child) => !["help", "schema", "examples"].includes(child.name())).map((child) => child.name());
15694
+ return children.length > 0 ? children : [command.name()];
15695
+ }
15696
+ function examplesForRegisteredCommand(name, commands) {
15697
+ if (commands.includes("list")) {
15698
+ return [
15699
+ `wave ${name} list --page 1 --per 10`,
15700
+ ...commands.includes("show") ? [`wave ${name} show --id 123`] : []
15701
+ ];
15702
+ }
15703
+ const [firstCommand] = commands;
15704
+ return firstCommand && firstCommand !== name ? [`wave ${name} ${firstCommand}`] : [`wave ${name}`];
15705
+ }
15706
+ function registeredNamespaceDoc(command) {
15707
+ const doc = namespaceDoc(command.name());
15708
+ const commands = advertisedCommands(command);
15709
+ const usesGenericDocumentation = !NAMESPACE_DOCS[command.name()];
15710
+ return {
15711
+ ...doc,
15712
+ ...usesGenericDocumentation ? { examples: examplesForRegisteredCommand(command.name(), commands) } : {},
15713
+ schema: {
15714
+ ...doc.schema,
15715
+ commands
15716
+ }
15717
+ };
15718
+ }
15719
+ function allNamespaceDocs(program) {
15720
+ const names = program.commands.map((command) => command.name()).filter((name) => name !== "help").filter((name, index, values) => values.indexOf(name) === index);
15721
+ return names.flatMap((name) => {
15722
+ const command = program.commands.find((candidate) => candidate.name() === name);
15723
+ return command ? [registeredNamespaceDoc(command)] : [];
15724
+ });
15389
15725
  }
15390
15726
  function buildEnvelope2(command, data) {
15391
15727
  return {
@@ -15468,43 +15804,6 @@ function commandSummary(command) {
15468
15804
  }))
15469
15805
  };
15470
15806
  }
15471
- function graphqlFields(program) {
15472
- const fields = /* @__PURE__ */ new Set([
15473
- "agent_markdown_status",
15474
- "agent_markdown_file",
15475
- "agent_markdown_children",
15476
- "os_md_search",
15477
- "os_md_wiki_lint",
15478
- "os_md_memory_quality",
15479
- "phantom_ledger_inventory",
15480
- "phantom_runs",
15481
- "phantom_run",
15482
- "phantom_reports",
15483
- "phantom_report",
15484
- "phantom_observation",
15485
- "phantom_observations",
15486
- "member_meta_profile",
15487
- "skills",
15488
- "destroy_task",
15489
- "raw_source_ingestion_plan",
15490
- "register_raw_source",
15491
- "ingest_raw_source",
15492
- "run_phantom_osmd_maintenance",
15493
- "markdown_tree_root",
15494
- "markdown_tree_node",
15495
- "markdown_tree_children",
15496
- "markdown_tree_subtree",
15497
- "ai_notes",
15498
- "ai_note"
15499
- ]);
15500
- for (const path of commandPaths(program)) {
15501
- const parts = path.split(" ");
15502
- if (parts.length >= 3) {
15503
- fields.add(parts.slice(1, -1).join("_").replaceAll("-", "_"));
15504
- }
15505
- }
15506
- return Array.from(fields).sort();
15507
- }
15508
15807
  function packageVersion() {
15509
15808
  try {
15510
15809
  const pkg = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path4.join)(process.cwd(), "package.json"), "utf8"));
@@ -15556,7 +15855,7 @@ async function resolveDoctorAuthOrganization(params) {
15556
15855
  }
15557
15856
  }
15558
15857
  async function runDoctor(cmd, opts) {
15559
- const context = await resolveCommandContext(cmd.optsWithGlobals());
15858
+ const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
15560
15859
  const runtime = context.runtimeOptions;
15561
15860
  const baseUrl = runtime.baseUrl;
15562
15861
  const token = runtime.token;
@@ -15678,7 +15977,7 @@ function registerDiscoveryCommands(program) {
15678
15977
  stdout: "exactly one JSON envelope for machine commands",
15679
15978
  stderr: "diagnostics only"
15680
15979
  },
15681
- namespaces: allNamespaceDocs(),
15980
+ namespaces: allNamespaceDocs(program),
15682
15981
  toolSupportRegistry: {
15683
15982
  milestone: "WAVE-04",
15684
15983
  status: "registry_only",
@@ -15739,18 +16038,10 @@ function registerDiscoveryCommands(program) {
15739
16038
  return printEnvelopeAndExit({
15740
16039
  envelope: buildEnvelope2("api.ls", {
15741
16040
  commands: paths,
15742
- examples: ["wave api ls --json", "wave graphql fields --json"]
16041
+ examples: ["wave api ls --json"]
15743
16042
  })
15744
16043
  });
15745
16044
  });
15746
- const graphql = program.command("graphql").description("Discover GraphQL fields used by the CLI");
15747
- graphql.command("fields").description("List known GraphQL field names").option("--readable", "Print fields as plain lines").option("--json", "Emit the stable JSON envelope").action((opts) => {
15748
- const fields = graphqlFields(program);
15749
- if (opts.readable && !opts.json) {
15750
- return printTextAndExit({ text: fields.join("\n") });
15751
- }
15752
- return printEnvelopeAndExit({ envelope: buildEnvelope2("graphql.fields", { fields }) });
15753
- });
15754
16045
  program.command("doctor").description("Run read-only CLI diagnostics").option("--readable", "Print a human-readable diagnostic summary").option("--json", "Emit the stable JSON envelope").action((opts, cmd) => runDoctor(cmd, opts));
15755
16046
  const phantom = program.commands.find((command) => command.name() === "phantom");
15756
16047
  phantom?.addHelpText(
@@ -15764,7 +16055,6 @@ function attachNamespaceDiscovery(program) {
15764
16055
  ...ADVANCED_NAMESPACES,
15765
16056
  "capabilities",
15766
16057
  "api",
15767
- "graphql",
15768
16058
  "doctor",
15769
16059
  "auth"
15770
16060
  ]);
@@ -15774,7 +16064,7 @@ function attachNamespaceDiscovery(program) {
15774
16064
  if (!command.commands.some((child) => child.name() === "schema")) {
15775
16065
  command.command("schema").description("Describe this namespace's command and output contract").option("--readable", "Print a human-readable schema summary").option("--json", "Emit the stable JSON envelope").action((opts) => {
15776
16066
  const data = {
15777
- namespace: namespaceDoc(command.name()),
16067
+ namespace: registeredNamespaceDoc(command),
15778
16068
  command: commandSummary(command)
15779
16069
  };
15780
16070
  if (opts.readable && !opts.json) {
@@ -15790,7 +16080,7 @@ Output: ${data.namespace.schema.output}`
15790
16080
  }
15791
16081
  if (!command.commands.some((child) => child.name() === "examples")) {
15792
16082
  command.command("examples").description("Show scriptable examples for this namespace").option("--readable", "Print examples as shell lines").option("--json", "Emit the stable JSON envelope").action((opts) => {
15793
- const examples = namespaceDoc(command.name()).examples;
16083
+ const examples = registeredNamespaceDoc(command).examples;
15794
16084
  if (opts.readable && !opts.json) {
15795
16085
  return printTextAndExit({ text: examples.join("\n") });
15796
16086
  }
@@ -15810,7 +16100,6 @@ function attachDiscoveryHelp(program) {
15810
16100
  " wave capabilities list List primary, advanced, and alias namespaces",
15811
16101
  " wave capabilities tools List shared recent-tool support metadata",
15812
16102
  " wave api ls List scriptable command paths",
15813
- " wave graphql fields List known GraphQL fields",
15814
16103
  " wave <namespace> schema Describe namespace output and command contract",
15815
16104
  " wave <namespace> examples Show copyable examples",
15816
16105
  " wave doctor Run read-only diagnostics",
@@ -15834,7 +16123,6 @@ function attachDiscoveryHelp(program) {
15834
16123
  ["markdown-tree", "\nExamples:\n wave markdown-tree root --tree-view\n wave markdown-tree resolve --tool-key projects --node-key tasks --parent-id 123\n"],
15835
16124
  ["capabilities", "\nExamples:\n wave capabilities list\n wave capabilities list --readable\n wave capabilities tools\n wave capabilities tools mail\n"],
15836
16125
  ["api", "\nExamples:\n wave api ls\n wave api ls --readable\n"],
15837
- ["graphql", "\nExamples:\n wave graphql fields\n wave graphql fields --readable\n"],
15838
16126
  ["doctor", "\nExamples:\n wave doctor\n wave doctor --readable\n"]
15839
16127
  ]);
15840
16128
  for (const command of program.commands) {
@@ -15846,12 +16134,12 @@ function attachDiscoveryHelp(program) {
15846
16134
  }
15847
16135
 
15848
16136
  // src/version.ts
15849
- var CLI_VERSION = "0.1.61";
16137
+ var CLI_VERSION = "0.1.63";
15850
16138
 
15851
16139
  // src/cli.ts
15852
16140
  function buildCli(options) {
15853
16141
  const program = new import_commander.Command();
15854
- program.name("wave").description("Wave agent CLI").version(CLI_VERSION, "-V, --version", "output the version number").showHelpAfterError(false).allowExcessArguments(false).option("--token <token>", "API token (prefer WAVE_API_TOKEN env var)").option("--jwt <jwt>", "Legacy alias for --token (prefer WAVE_API_TOKEN env var)").option("--token-stdin", "Read API token from stdin").option(
16142
+ program.name("wave").description("Wave agent CLI").version(CLI_VERSION, "-V, --version", "output the version number").showHelpAfterError(false).allowExcessArguments(false).option("--token <token>", "API token (prefer WAVE_API_TOKEN env var)").option("--token-stdin", "Read API token from stdin").option(
15855
16143
  "--auth-json-stdin",
15856
16144
  "Read auth/runtime context JSON from stdin (token, baseUrl, organizationId, ...)"
15857
16145
  ).option(
@@ -15901,6 +16189,7 @@ function buildCli(options) {
15901
16189
  registerMeetingCommands(program);
15902
16190
  registerMemberCommands(program);
15903
16191
  registerSkillCommands(program);
16192
+ registerAtlasAuthoringCommands(program);
15904
16193
  registerTeamCommands(program);
15905
16194
  registerOrganizationCommands(program);
15906
16195
  registerIssueCommands(program);
@@ -15980,13 +16269,13 @@ main().catch((error) => {
15980
16269
  });
15981
16270
  return;
15982
16271
  }
15983
- if (error instanceof import_zod19.ZodError || error instanceof import_commander2.InvalidArgumentError) {
16272
+ if (error instanceof import_zod20.ZodError || error instanceof import_commander2.InvalidArgumentError) {
15984
16273
  printCliFailure({
15985
16274
  status: 400,
15986
16275
  code: "invalid_args",
15987
16276
  message: "Invalid command arguments.",
15988
16277
  details: {
15989
- issues: error instanceof import_zod19.ZodError ? error.issues : [{ message: error.message, code: "invalid_argument" }]
16278
+ issues: error instanceof import_zod20.ZodError ? error.issues : [{ message: error.message, code: "invalid_argument" }]
15990
16279
  },
15991
16280
  exitCode: EXIT_CODES.invalidArgs
15992
16281
  });