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