@ted-galago/wave-cli 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -190,6 +190,28 @@ If a required parent field is missing, CLI returns JSON error with exit code `2`
190
190
  - `content.member_id` is required.
191
191
  - `content.type` is not required for create.
192
192
 
193
+ `knowledge.list` filter notes:
194
+
195
+ - `--assigned true` uses backend "assigned for current authenticated member" logic.
196
+ - `--assigned true` defaults to incomplete items only.
197
+ - CLI `knowledge list` does not currently expose an `include_completed` toggle.
198
+ - `--member-id` filters `contents.member_id` (owner/author), not assignment target.
199
+ - `--focus-member-id` filters `contents.focus_member_id` (focus scope), not assignment target.
200
+ - For manager/admin users, `--assigned true` may include creator-visible items with assignments, not only direct assignee matches.
201
+
202
+ Examples:
203
+
204
+ ```bash
205
+ # Assigned to current authenticated member (incomplete only by default)
206
+ wave knowledge list --assigned true --page 1 --per 50
207
+
208
+ # Owner filter (not assignment target filter)
209
+ wave knowledge list --member-id 67 --page 1 --per 50
210
+
211
+ # Focus scope filter (not assignment target filter)
212
+ wave knowledge list --focus-member-id 67 --page 1 --per 50
213
+ ```
214
+
193
215
  `news.create` contract notes:
194
216
 
195
217
  - Requires `headline.member_id`, `headline.status`, and `headline.headline_type`.
package/dist/index.cjs CHANGED
@@ -91,10 +91,7 @@ function toOptionalNonEmpty(raw) {
91
91
  const trimmed = raw.trim();
92
92
  return trimmed.length > 0 ? trimmed : void 0;
93
93
  }
94
- function parseDebug(rawDebugOption, rawDebugEnv) {
95
- if (typeof rawDebugOption === "boolean") {
96
- return rawDebugOption;
97
- }
94
+ function parseDebug(rawDebugEnv) {
98
95
  if (!rawDebugEnv) {
99
96
  return false;
100
97
  }
@@ -124,7 +121,7 @@ function getConfig(options) {
124
121
  baseUrl,
125
122
  token,
126
123
  timeoutMs: parseTimeoutMs(options.timeoutMs ?? process.env.WAVE_TIMEOUT_MS),
127
- debug: parseDebug(options.debug, process.env.WAVE_DEBUG),
124
+ debug: parseDebug(process.env.WAVE_DEBUG),
128
125
  agentName: toOptionalNonEmpty(options.agentName ?? process.env.WAVE_AGENT_NAME),
129
126
  agentRunId: toOptionalNonEmpty(options.agentRunId ?? process.env.WAVE_AGENT_RUN_ID),
130
127
  requestId: toOptionalNonEmpty(options.requestId ?? process.env.WAVE_REQUEST_ID),
@@ -726,6 +723,12 @@ async function graphqlRequest(input) {
726
723
  var import_node_fs = require("fs");
727
724
  var RETRYABLE_WRITE_CODES = /* @__PURE__ */ new Set(["EAGAIN", "EINTR"]);
728
725
  var RETRY_BACKOFF_MS = 1;
726
+ var EnvelopeEmittedSignal = class extends Error {
727
+ constructor() {
728
+ super("wave_cli_envelope_emitted");
729
+ this.name = "EnvelopeEmittedSignal";
730
+ }
731
+ };
729
732
  function sleepBriefly(ms) {
730
733
  const lock = new Int32Array(new SharedArrayBuffer(4));
731
734
  Atomics.wait(lock, 0, 0, ms);
@@ -758,7 +761,11 @@ function printEnvelope(envelope) {
758
761
  }
759
762
  function printEnvelopeAndExit(params) {
760
763
  printEnvelope(params.envelope);
761
- process.exit(params.exitCode ?? EXIT_CODES.success);
764
+ process.exitCode = params.exitCode ?? EXIT_CODES.success;
765
+ throw new EnvelopeEmittedSignal();
766
+ }
767
+ function isEnvelopeEmittedSignal(error) {
768
+ return error instanceof EnvelopeEmittedSignal;
762
769
  }
763
770
 
764
771
  // src/commandRunner.ts
@@ -1400,8 +1407,11 @@ async function runGraphqlQueryCommand(input) {
1400
1407
  }
1401
1408
  printEnvelopeAndExit(result);
1402
1409
  } catch (error) {
1410
+ if (isEnvelopeEmittedSignal(error)) {
1411
+ throw error;
1412
+ }
1403
1413
  if (error instanceof CliError) {
1404
- printEnvelopeAndExit({
1414
+ return printEnvelopeAndExit({
1405
1415
  envelope: buildCliErrorEnvelope({
1406
1416
  command: input.command,
1407
1417
  status: error.status,
@@ -1413,7 +1423,7 @@ async function runGraphqlQueryCommand(input) {
1413
1423
  });
1414
1424
  }
1415
1425
  const message = error instanceof Error ? error.message : "Unexpected error.";
1416
- printEnvelopeAndExit({
1426
+ return printEnvelopeAndExit({
1417
1427
  envelope: buildCliErrorEnvelope({
1418
1428
  command: input.command,
1419
1429
  status: 500,
@@ -1439,8 +1449,11 @@ async function runGraphqlMutationCommand(input) {
1439
1449
  });
1440
1450
  printEnvelopeAndExit(result);
1441
1451
  } catch (error) {
1452
+ if (isEnvelopeEmittedSignal(error)) {
1453
+ throw error;
1454
+ }
1442
1455
  if (error instanceof CliError) {
1443
- printEnvelopeAndExit({
1456
+ return printEnvelopeAndExit({
1444
1457
  envelope: buildCliErrorEnvelope({
1445
1458
  command: input.command,
1446
1459
  status: error.status,
@@ -1452,7 +1465,7 @@ async function runGraphqlMutationCommand(input) {
1452
1465
  });
1453
1466
  }
1454
1467
  const message = error instanceof Error ? error.message : "Unexpected error.";
1455
- printEnvelopeAndExit({
1468
+ return printEnvelopeAndExit({
1456
1469
  envelope: buildCliErrorEnvelope({
1457
1470
  command: input.command,
1458
1471
  status: 500,
@@ -1562,11 +1575,7 @@ function resolveFromSources(options, stdin, env) {
1562
1575
  normalize(env.WAVE_ORG_ID)
1563
1576
  );
1564
1577
  const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
1565
- const debug = firstDefined(
1566
- options.debug === true ? true : void 0,
1567
- stdin.debug,
1568
- parseBool(env.WAVE_DEBUG)
1569
- );
1578
+ const debug = parseBool(env.WAVE_DEBUG);
1570
1579
  const agentName = firstDefined(
1571
1580
  normalize(options.agentName),
1572
1581
  normalize(stdin.agentName),
@@ -2442,11 +2451,12 @@ function registerEntityCrudCommands(program, config) {
2442
2451
  const updateHelp5 = buildDataJsonHelp(config.rootKey, "update") ?? "JSON object, optionally wrapped with root key";
2443
2452
  const list = entityCommand.command("list").option("--page <page>").option("--per <per>");
2444
2453
  const listParams = config.listParams ?? [];
2454
+ const listParamHelp = config.listParamHelp ?? {};
2445
2455
  const showParams = config.showParams ?? [];
2446
2456
  const allowQueryJson = config.allowQueryJson !== false;
2447
2457
  listParams.forEach((param) => {
2448
2458
  const cliParam = param.replace(/_/g, "-");
2449
- list.option(`--${cliParam} <${cliParam}>`);
2459
+ list.option(`--${cliParam} <${cliParam}>`, listParamHelp[param]);
2450
2460
  });
2451
2461
  if (allowQueryJson) {
2452
2462
  list.option("--query-json <queryJson>", "Additional query params as JSON object");
@@ -3914,6 +3924,11 @@ function registerSystemToolCommands(program) {
3914
3924
  "term",
3915
3925
  "type"
3916
3926
  ],
3927
+ listParamHelp: {
3928
+ assigned: "Show assigned knowledge for the authenticated current member context (not a direct assignee-id filter).",
3929
+ member_id: "Filter by content owner/author (contents.member_id), not assignment target member.",
3930
+ focus_member_id: "Filter by focus scope (contents.focus_member_id), not assignment target member."
3931
+ },
3917
3932
  showParams: ["include_all_rollups"],
3918
3933
  allowQueryJson: false
3919
3934
  });
@@ -6039,7 +6054,7 @@ function buildCli(options) {
6039
6054
  ).option(
6040
6055
  "--organization-id <organizationId>",
6041
6056
  "Organization ID (prefer WAVE_ORGANIZATION_ID env var)"
6042
- ).option("--timeout-ms <timeoutMs>", "HTTP timeout in milliseconds").option("--debug", "Enable debug logs to stderr").option("--agent-name <agentName>", "Agent name for tracing").option("--agent-run-id <agentRunId>", "Agent run identifier for tracing").option("--request-id <requestId>", "Request identifier").option(
6057
+ ).option("--timeout-ms <timeoutMs>", "HTTP timeout in milliseconds").option("--agent-name <agentName>", "Agent name for tracing").option("--agent-run-id <agentRunId>", "Agent run identifier for tracing").option("--request-id <requestId>", "Request identifier").option(
6043
6058
  "--openapi-path <openapiPath>",
6044
6059
  "Optional local OpenAPI file path for contract-aware tooling"
6045
6060
  ).option(
@@ -6093,6 +6108,9 @@ async function main() {
6093
6108
  await program.parseAsync(process.argv);
6094
6109
  }
6095
6110
  main().catch((error) => {
6111
+ if (isEnvelopeEmittedSignal(error)) {
6112
+ return;
6113
+ }
6096
6114
  if (error instanceof CliError) {
6097
6115
  printCliFailure({
6098
6116
  status: error.status,
@@ -6101,10 +6119,12 @@ main().catch((error) => {
6101
6119
  details: error.details,
6102
6120
  exitCode: error.exitCode
6103
6121
  });
6122
+ return;
6104
6123
  }
6105
6124
  if (error instanceof import_commander2.CommanderError) {
6106
6125
  if (error.code === "commander.helpDisplayed" || error.code === "commander.version") {
6107
- process.exit(EXIT_CODES.success);
6126
+ process.exitCode = EXIT_CODES.success;
6127
+ return;
6108
6128
  }
6109
6129
  printCliFailure({
6110
6130
  status: 400,
@@ -6112,6 +6132,7 @@ main().catch((error) => {
6112
6132
  message: error.message,
6113
6133
  exitCode: EXIT_CODES.invalidArgs
6114
6134
  });
6135
+ return;
6115
6136
  }
6116
6137
  if (error instanceof import_zod16.ZodError || error instanceof import_commander2.InvalidArgumentError) {
6117
6138
  printCliFailure({
@@ -6123,6 +6144,7 @@ main().catch((error) => {
6123
6144
  },
6124
6145
  exitCode: EXIT_CODES.invalidArgs
6125
6146
  });
6147
+ return;
6126
6148
  }
6127
6149
  const message = error instanceof Error ? error.message : "Unexpected error.";
6128
6150
  printCliFailure({
@@ -6131,4 +6153,5 @@ main().catch((error) => {
6131
6153
  message,
6132
6154
  exitCode: EXIT_CODES.generic
6133
6155
  });
6156
+ return;
6134
6157
  });
package/dist/index.js CHANGED
@@ -90,10 +90,7 @@ function toOptionalNonEmpty(raw) {
90
90
  const trimmed = raw.trim();
91
91
  return trimmed.length > 0 ? trimmed : void 0;
92
92
  }
93
- function parseDebug(rawDebugOption, rawDebugEnv) {
94
- if (typeof rawDebugOption === "boolean") {
95
- return rawDebugOption;
96
- }
93
+ function parseDebug(rawDebugEnv) {
97
94
  if (!rawDebugEnv) {
98
95
  return false;
99
96
  }
@@ -123,7 +120,7 @@ function getConfig(options) {
123
120
  baseUrl,
124
121
  token,
125
122
  timeoutMs: parseTimeoutMs(options.timeoutMs ?? process.env.WAVE_TIMEOUT_MS),
126
- debug: parseDebug(options.debug, process.env.WAVE_DEBUG),
123
+ debug: parseDebug(process.env.WAVE_DEBUG),
127
124
  agentName: toOptionalNonEmpty(options.agentName ?? process.env.WAVE_AGENT_NAME),
128
125
  agentRunId: toOptionalNonEmpty(options.agentRunId ?? process.env.WAVE_AGENT_RUN_ID),
129
126
  requestId: toOptionalNonEmpty(options.requestId ?? process.env.WAVE_REQUEST_ID),
@@ -725,6 +722,12 @@ async function graphqlRequest(input) {
725
722
  import { writeSync } from "fs";
726
723
  var RETRYABLE_WRITE_CODES = /* @__PURE__ */ new Set(["EAGAIN", "EINTR"]);
727
724
  var RETRY_BACKOFF_MS = 1;
725
+ var EnvelopeEmittedSignal = class extends Error {
726
+ constructor() {
727
+ super("wave_cli_envelope_emitted");
728
+ this.name = "EnvelopeEmittedSignal";
729
+ }
730
+ };
728
731
  function sleepBriefly(ms) {
729
732
  const lock = new Int32Array(new SharedArrayBuffer(4));
730
733
  Atomics.wait(lock, 0, 0, ms);
@@ -757,7 +760,11 @@ function printEnvelope(envelope) {
757
760
  }
758
761
  function printEnvelopeAndExit(params) {
759
762
  printEnvelope(params.envelope);
760
- process.exit(params.exitCode ?? EXIT_CODES.success);
763
+ process.exitCode = params.exitCode ?? EXIT_CODES.success;
764
+ throw new EnvelopeEmittedSignal();
765
+ }
766
+ function isEnvelopeEmittedSignal(error) {
767
+ return error instanceof EnvelopeEmittedSignal;
761
768
  }
762
769
 
763
770
  // src/commandRunner.ts
@@ -1399,8 +1406,11 @@ async function runGraphqlQueryCommand(input) {
1399
1406
  }
1400
1407
  printEnvelopeAndExit(result);
1401
1408
  } catch (error) {
1409
+ if (isEnvelopeEmittedSignal(error)) {
1410
+ throw error;
1411
+ }
1402
1412
  if (error instanceof CliError) {
1403
- printEnvelopeAndExit({
1413
+ return printEnvelopeAndExit({
1404
1414
  envelope: buildCliErrorEnvelope({
1405
1415
  command: input.command,
1406
1416
  status: error.status,
@@ -1412,7 +1422,7 @@ async function runGraphqlQueryCommand(input) {
1412
1422
  });
1413
1423
  }
1414
1424
  const message = error instanceof Error ? error.message : "Unexpected error.";
1415
- printEnvelopeAndExit({
1425
+ return printEnvelopeAndExit({
1416
1426
  envelope: buildCliErrorEnvelope({
1417
1427
  command: input.command,
1418
1428
  status: 500,
@@ -1438,8 +1448,11 @@ async function runGraphqlMutationCommand(input) {
1438
1448
  });
1439
1449
  printEnvelopeAndExit(result);
1440
1450
  } catch (error) {
1451
+ if (isEnvelopeEmittedSignal(error)) {
1452
+ throw error;
1453
+ }
1441
1454
  if (error instanceof CliError) {
1442
- printEnvelopeAndExit({
1455
+ return printEnvelopeAndExit({
1443
1456
  envelope: buildCliErrorEnvelope({
1444
1457
  command: input.command,
1445
1458
  status: error.status,
@@ -1451,7 +1464,7 @@ async function runGraphqlMutationCommand(input) {
1451
1464
  });
1452
1465
  }
1453
1466
  const message = error instanceof Error ? error.message : "Unexpected error.";
1454
- printEnvelopeAndExit({
1467
+ return printEnvelopeAndExit({
1455
1468
  envelope: buildCliErrorEnvelope({
1456
1469
  command: input.command,
1457
1470
  status: 500,
@@ -1561,11 +1574,7 @@ function resolveFromSources(options, stdin, env) {
1561
1574
  normalize(env.WAVE_ORG_ID)
1562
1575
  );
1563
1576
  const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
1564
- const debug = firstDefined(
1565
- options.debug === true ? true : void 0,
1566
- stdin.debug,
1567
- parseBool(env.WAVE_DEBUG)
1568
- );
1577
+ const debug = parseBool(env.WAVE_DEBUG);
1569
1578
  const agentName = firstDefined(
1570
1579
  normalize(options.agentName),
1571
1580
  normalize(stdin.agentName),
@@ -2441,11 +2450,12 @@ function registerEntityCrudCommands(program, config) {
2441
2450
  const updateHelp5 = buildDataJsonHelp(config.rootKey, "update") ?? "JSON object, optionally wrapped with root key";
2442
2451
  const list = entityCommand.command("list").option("--page <page>").option("--per <per>");
2443
2452
  const listParams = config.listParams ?? [];
2453
+ const listParamHelp = config.listParamHelp ?? {};
2444
2454
  const showParams = config.showParams ?? [];
2445
2455
  const allowQueryJson = config.allowQueryJson !== false;
2446
2456
  listParams.forEach((param) => {
2447
2457
  const cliParam = param.replace(/_/g, "-");
2448
- list.option(`--${cliParam} <${cliParam}>`);
2458
+ list.option(`--${cliParam} <${cliParam}>`, listParamHelp[param]);
2449
2459
  });
2450
2460
  if (allowQueryJson) {
2451
2461
  list.option("--query-json <queryJson>", "Additional query params as JSON object");
@@ -3913,6 +3923,11 @@ function registerSystemToolCommands(program) {
3913
3923
  "term",
3914
3924
  "type"
3915
3925
  ],
3926
+ listParamHelp: {
3927
+ assigned: "Show assigned knowledge for the authenticated current member context (not a direct assignee-id filter).",
3928
+ member_id: "Filter by content owner/author (contents.member_id), not assignment target member.",
3929
+ focus_member_id: "Filter by focus scope (contents.focus_member_id), not assignment target member."
3930
+ },
3916
3931
  showParams: ["include_all_rollups"],
3917
3932
  allowQueryJson: false
3918
3933
  });
@@ -6038,7 +6053,7 @@ function buildCli(options) {
6038
6053
  ).option(
6039
6054
  "--organization-id <organizationId>",
6040
6055
  "Organization ID (prefer WAVE_ORGANIZATION_ID env var)"
6041
- ).option("--timeout-ms <timeoutMs>", "HTTP timeout in milliseconds").option("--debug", "Enable debug logs to stderr").option("--agent-name <agentName>", "Agent name for tracing").option("--agent-run-id <agentRunId>", "Agent run identifier for tracing").option("--request-id <requestId>", "Request identifier").option(
6056
+ ).option("--timeout-ms <timeoutMs>", "HTTP timeout in milliseconds").option("--agent-name <agentName>", "Agent name for tracing").option("--agent-run-id <agentRunId>", "Agent run identifier for tracing").option("--request-id <requestId>", "Request identifier").option(
6042
6057
  "--openapi-path <openapiPath>",
6043
6058
  "Optional local OpenAPI file path for contract-aware tooling"
6044
6059
  ).option(
@@ -6092,6 +6107,9 @@ async function main() {
6092
6107
  await program.parseAsync(process.argv);
6093
6108
  }
6094
6109
  main().catch((error) => {
6110
+ if (isEnvelopeEmittedSignal(error)) {
6111
+ return;
6112
+ }
6095
6113
  if (error instanceof CliError) {
6096
6114
  printCliFailure({
6097
6115
  status: error.status,
@@ -6100,10 +6118,12 @@ main().catch((error) => {
6100
6118
  details: error.details,
6101
6119
  exitCode: error.exitCode
6102
6120
  });
6121
+ return;
6103
6122
  }
6104
6123
  if (error instanceof CommanderError) {
6105
6124
  if (error.code === "commander.helpDisplayed" || error.code === "commander.version") {
6106
- process.exit(EXIT_CODES.success);
6125
+ process.exitCode = EXIT_CODES.success;
6126
+ return;
6107
6127
  }
6108
6128
  printCliFailure({
6109
6129
  status: 400,
@@ -6111,6 +6131,7 @@ main().catch((error) => {
6111
6131
  message: error.message,
6112
6132
  exitCode: EXIT_CODES.invalidArgs
6113
6133
  });
6134
+ return;
6114
6135
  }
6115
6136
  if (error instanceof ZodError || error instanceof InvalidArgumentError) {
6116
6137
  printCliFailure({
@@ -6122,6 +6143,7 @@ main().catch((error) => {
6122
6143
  },
6123
6144
  exitCode: EXIT_CODES.invalidArgs
6124
6145
  });
6146
+ return;
6125
6147
  }
6126
6148
  const message = error instanceof Error ? error.message : "Unexpected error.";
6127
6149
  printCliFailure({
@@ -6130,4 +6152,5 @@ main().catch((error) => {
6130
6152
  message,
6131
6153
  exitCode: EXIT_CODES.generic
6132
6154
  });
6155
+ return;
6133
6156
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ted-galago/wave-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"