@ted-galago/wave-cli 0.1.9 → 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),
@@ -723,13 +720,52 @@ async function graphqlRequest(input) {
723
720
  }
724
721
 
725
722
  // src/output.ts
723
+ var import_node_fs = require("fs");
724
+ var RETRYABLE_WRITE_CODES = /* @__PURE__ */ new Set(["EAGAIN", "EINTR"]);
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
+ };
732
+ function sleepBriefly(ms) {
733
+ const lock = new Int32Array(new SharedArrayBuffer(4));
734
+ Atomics.wait(lock, 0, 0, ms);
735
+ }
736
+ function writeStdoutFully(text) {
737
+ const fd = typeof process.stdout.fd === "number" ? process.stdout.fd : 1;
738
+ const buffer = Buffer.from(text, "utf8");
739
+ let offset = 0;
740
+ while (offset < buffer.length) {
741
+ try {
742
+ const bytesWritten = (0, import_node_fs.writeSync)(fd, buffer, offset, buffer.length - offset);
743
+ if (bytesWritten <= 0) {
744
+ sleepBriefly(RETRY_BACKOFF_MS);
745
+ continue;
746
+ }
747
+ offset += bytesWritten;
748
+ } catch (error) {
749
+ const code = typeof error === "object" && error && "code" in error ? String(error.code ?? "") : "";
750
+ if (RETRYABLE_WRITE_CODES.has(code)) {
751
+ sleepBriefly(RETRY_BACKOFF_MS);
752
+ continue;
753
+ }
754
+ throw error;
755
+ }
756
+ }
757
+ }
726
758
  function printEnvelope(envelope) {
727
- process.stdout.write(`${JSON.stringify(envelope)}
759
+ writeStdoutFully(`${JSON.stringify(envelope)}
728
760
  `);
729
761
  }
730
762
  function printEnvelopeAndExit(params) {
731
763
  printEnvelope(params.envelope);
732
- 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;
733
769
  }
734
770
 
735
771
  // src/commandRunner.ts
@@ -1371,8 +1407,11 @@ async function runGraphqlQueryCommand(input) {
1371
1407
  }
1372
1408
  printEnvelopeAndExit(result);
1373
1409
  } catch (error) {
1410
+ if (isEnvelopeEmittedSignal(error)) {
1411
+ throw error;
1412
+ }
1374
1413
  if (error instanceof CliError) {
1375
- printEnvelopeAndExit({
1414
+ return printEnvelopeAndExit({
1376
1415
  envelope: buildCliErrorEnvelope({
1377
1416
  command: input.command,
1378
1417
  status: error.status,
@@ -1384,7 +1423,7 @@ async function runGraphqlQueryCommand(input) {
1384
1423
  });
1385
1424
  }
1386
1425
  const message = error instanceof Error ? error.message : "Unexpected error.";
1387
- printEnvelopeAndExit({
1426
+ return printEnvelopeAndExit({
1388
1427
  envelope: buildCliErrorEnvelope({
1389
1428
  command: input.command,
1390
1429
  status: 500,
@@ -1410,8 +1449,11 @@ async function runGraphqlMutationCommand(input) {
1410
1449
  });
1411
1450
  printEnvelopeAndExit(result);
1412
1451
  } catch (error) {
1452
+ if (isEnvelopeEmittedSignal(error)) {
1453
+ throw error;
1454
+ }
1413
1455
  if (error instanceof CliError) {
1414
- printEnvelopeAndExit({
1456
+ return printEnvelopeAndExit({
1415
1457
  envelope: buildCliErrorEnvelope({
1416
1458
  command: input.command,
1417
1459
  status: error.status,
@@ -1423,7 +1465,7 @@ async function runGraphqlMutationCommand(input) {
1423
1465
  });
1424
1466
  }
1425
1467
  const message = error instanceof Error ? error.message : "Unexpected error.";
1426
- printEnvelopeAndExit({
1468
+ return printEnvelopeAndExit({
1427
1469
  envelope: buildCliErrorEnvelope({
1428
1470
  command: input.command,
1429
1471
  status: 500,
@@ -1533,11 +1575,7 @@ function resolveFromSources(options, stdin, env) {
1533
1575
  normalize(env.WAVE_ORG_ID)
1534
1576
  );
1535
1577
  const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
1536
- const debug = firstDefined(
1537
- options.debug === true ? true : void 0,
1538
- stdin.debug,
1539
- parseBool(env.WAVE_DEBUG)
1540
- );
1578
+ const debug = parseBool(env.WAVE_DEBUG);
1541
1579
  const agentName = firstDefined(
1542
1580
  normalize(options.agentName),
1543
1581
  normalize(stdin.agentName),
@@ -2413,11 +2451,12 @@ function registerEntityCrudCommands(program, config) {
2413
2451
  const updateHelp5 = buildDataJsonHelp(config.rootKey, "update") ?? "JSON object, optionally wrapped with root key";
2414
2452
  const list = entityCommand.command("list").option("--page <page>").option("--per <per>");
2415
2453
  const listParams = config.listParams ?? [];
2454
+ const listParamHelp = config.listParamHelp ?? {};
2416
2455
  const showParams = config.showParams ?? [];
2417
2456
  const allowQueryJson = config.allowQueryJson !== false;
2418
2457
  listParams.forEach((param) => {
2419
2458
  const cliParam = param.replace(/_/g, "-");
2420
- list.option(`--${cliParam} <${cliParam}>`);
2459
+ list.option(`--${cliParam} <${cliParam}>`, listParamHelp[param]);
2421
2460
  });
2422
2461
  if (allowQueryJson) {
2423
2462
  list.option("--query-json <queryJson>", "Additional query params as JSON object");
@@ -2594,7 +2633,7 @@ function registerProjectCommands(program) {
2594
2633
  const organizationId = resolveOrganizationId(context.organizationId);
2595
2634
  await runGraphqlQueryCommand({
2596
2635
  command: "projects.list",
2597
- operationName: "ProjectsIndexSlim",
2636
+ operationName: "ProjectsList",
2598
2637
  runtimeOptions: context.runtimeOptions,
2599
2638
  field: "projects",
2600
2639
  variables: normalizeGraphqlVariables2({
@@ -2622,7 +2661,7 @@ function registerProjectCommands(program) {
2622
2661
  const organizationId = resolveOrganizationId(context.organizationId);
2623
2662
  await runGraphqlQueryCommand({
2624
2663
  command: "projects.show",
2625
- operationName: "ProjectShowDeepV2",
2664
+ operationName: "ProjectsShow",
2626
2665
  runtimeOptions: context.runtimeOptions,
2627
2666
  field: "project",
2628
2667
  variables: {
@@ -3885,6 +3924,11 @@ function registerSystemToolCommands(program) {
3885
3924
  "term",
3886
3925
  "type"
3887
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
+ },
3888
3932
  showParams: ["include_all_rollups"],
3889
3933
  allowQueryJson: false
3890
3934
  });
@@ -4537,6 +4581,7 @@ function registerFoundationCommands(program) {
4537
4581
  var import_zod12 = require("zod");
4538
4582
  var idSchema11 = import_zod12.z.string().min(1);
4539
4583
  var jsonObjectSchema = import_zod12.z.record(import_zod12.z.string(), import_zod12.z.unknown());
4584
+ var childListMinimalSelectionSet = "{ data { id type attributes } count currentPage totalPages }";
4540
4585
  function parseJsonObject2(raw) {
4541
4586
  try {
4542
4587
  const parsed = JSON.parse(raw);
@@ -4737,11 +4782,11 @@ function registerChildEntityCommands(program) {
4737
4782
  updateField: "update_subtask",
4738
4783
  destroyField: "destroy_subtask",
4739
4784
  idVariable: "subtask_id",
4740
- listOperationName: "SubtasksForTask",
4741
- createOperationName: "CreateSubtask",
4742
- updateOperationName: "UpdateSubtask",
4743
- destroyOperationName: "DestroySubtask",
4744
- listSelectionSet: "{ data { id type name status taskId attributes } count currentPage totalPages }",
4785
+ listOperationName: "SubtasksList",
4786
+ createOperationName: "SubtasksCreate",
4787
+ updateOperationName: "SubtasksUpdate",
4788
+ destroyOperationName: "SubtasksDestroy",
4789
+ listSelectionSet: childListMinimalSelectionSet,
4745
4790
  listParentTypedField: "taskId",
4746
4791
  normalizeCreateBody: normalizeSubtaskCreateBody
4747
4792
  });
@@ -4756,11 +4801,11 @@ function registerChildEntityCommands(program) {
4756
4801
  updateField: "update_milestone",
4757
4802
  destroyField: "destroy_milestone",
4758
4803
  idVariable: "milestone_id",
4759
- listOperationName: "MilestonesForRock",
4760
- createOperationName: "CreateMilestone",
4761
- updateOperationName: "UpdateMilestone",
4762
- destroyOperationName: "DestroyMilestone",
4763
- listSelectionSet: "{ data { id type name slug status attributes } count currentPage totalPages }"
4804
+ listOperationName: "MilestonesList",
4805
+ createOperationName: "MilestonesCreate",
4806
+ updateOperationName: "MilestonesUpdate",
4807
+ destroyOperationName: "MilestonesDestroy",
4808
+ listSelectionSet: childListMinimalSelectionSet
4764
4809
  });
4765
4810
  registerChildCommands(program, {
4766
4811
  command: "subitems",
@@ -4773,11 +4818,11 @@ function registerChildEntityCommands(program) {
4773
4818
  updateField: "update_subitem",
4774
4819
  destroyField: "destroy_subitem",
4775
4820
  idVariable: "subitem_id",
4776
- listOperationName: "SubitemsForListItem",
4777
- createOperationName: "CreateSubitem",
4778
- updateOperationName: "UpdateSubitem",
4779
- destroyOperationName: "DestroySubitem",
4780
- listSelectionSet: "{ data { id type name status listItemId attributes } count currentPage totalPages }",
4821
+ listOperationName: "SubitemsList",
4822
+ createOperationName: "SubitemsCreate",
4823
+ updateOperationName: "SubitemsUpdate",
4824
+ destroyOperationName: "SubitemsDestroy",
4825
+ listSelectionSet: childListMinimalSelectionSet,
4781
4826
  listParentTypedField: "listItemId"
4782
4827
  });
4783
4828
  registerChildCommands(program, {
@@ -4791,11 +4836,11 @@ function registerChildEntityCommands(program) {
4791
4836
  updateField: "update_sub_todo",
4792
4837
  destroyField: "destroy_sub_todo",
4793
4838
  idVariable: "sub_todo_id",
4794
- listOperationName: "SubtodosForTodo",
4795
- createOperationName: "CreateSubTodo",
4796
- updateOperationName: "UpdateSubTodo",
4797
- destroyOperationName: "DestroySubTodo",
4798
- listSelectionSet: "{ data { id type name status todoId attributes } count currentPage totalPages }",
4839
+ listOperationName: "SubtodosList",
4840
+ createOperationName: "SubtodosCreate",
4841
+ updateOperationName: "SubtodosUpdate",
4842
+ destroyOperationName: "SubtodosDestroy",
4843
+ listSelectionSet: childListMinimalSelectionSet,
4799
4844
  listParentTypedField: "todoId"
4800
4845
  });
4801
4846
  registerChildCommands(program, {
@@ -4809,11 +4854,11 @@ function registerChildEntityCommands(program) {
4809
4854
  updateField: "update_sub_issue",
4810
4855
  destroyField: "destroy_sub_issue",
4811
4856
  idVariable: "sub_issue_id",
4812
- listOperationName: "SubissuesForIssue",
4813
- createOperationName: "CreateSubIssue",
4814
- updateOperationName: "UpdateSubIssue",
4815
- destroyOperationName: "DestroySubIssue",
4816
- listSelectionSet: "{ data { id type name status issueId attributes } count currentPage totalPages }",
4857
+ listOperationName: "SubissuesList",
4858
+ createOperationName: "SubissuesCreate",
4859
+ updateOperationName: "SubissuesUpdate",
4860
+ destroyOperationName: "SubissuesDestroy",
4861
+ listSelectionSet: childListMinimalSelectionSet,
4817
4862
  listParentTypedField: "issueId"
4818
4863
  });
4819
4864
  registerChildCommands(program, {
@@ -4827,23 +4872,23 @@ function registerChildEntityCommands(program) {
4827
4872
  updateField: "update_talking_point",
4828
4873
  destroyField: "destroy_talking_point",
4829
4874
  idVariable: "talking_point_id",
4830
- listOperationName: "TalkingPointsForMeeting",
4831
- createOperationName: "CreateTalkingPoint",
4832
- updateOperationName: "UpdateTalkingPoint",
4833
- destroyOperationName: "DestroyTalkingPoint",
4834
- listSelectionSet: "{ data { id type name description status priority rank dueDate memberId creatorId meetingId attributes } count currentPage totalPages }",
4875
+ listOperationName: "TalkingPointsList",
4876
+ createOperationName: "TalkingPointsCreate",
4877
+ updateOperationName: "TalkingPointsUpdate",
4878
+ destroyOperationName: "TalkingPointsDestroy",
4879
+ listSelectionSet: childListMinimalSelectionSet,
4835
4880
  listParentTypedField: "meetingId"
4836
4881
  });
4837
4882
  }
4838
4883
 
4839
- // src/commands/notes.ts
4884
+ // src/commands/content.ts
4840
4885
  var import_zod13 = require("zod");
4841
4886
  var idSchema12 = import_zod13.z.string().min(1);
4842
4887
  var nonEmptyString = import_zod13.z.string().min(1);
4843
4888
  function assertUpdateFields(params) {
4844
4889
  if (!params.name && !params.content && !params.status) {
4845
4890
  throw new CliError({
4846
- message: "notes update requires at least one of --name, --body, or --status.",
4891
+ message: "content update requires at least one of --name, --body, or --status.",
4847
4892
  kind: "invalid_args",
4848
4893
  status: 400,
4849
4894
  exitCode: EXIT_CODES.invalidArgs
@@ -4866,13 +4911,13 @@ async function createContent(command, cmd, payload) {
4866
4911
  })
4867
4912
  });
4868
4913
  }
4869
- function registerNoteCommands(program) {
4870
- const notes = program.command("notes").description("Content note operations");
4871
- notes.command("list").option("--contentable-type <contentableType>").option("--contentable-id <contentableId>").option("--member-id <memberId>").option("--focus-member-id <focusMemberId>").option("--focus-team-id <focusTeamId>").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
4914
+ function registerContentCommands(program) {
4915
+ const content = program.command("content").description("Content note operations");
4916
+ content.command("list").option("--contentable-type <contentableType>").option("--contentable-id <contentableId>").option("--member-id <memberId>").option("--focus-member-id <focusMemberId>").option("--focus-team-id <focusTeamId>").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
4872
4917
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4873
4918
  const organizationId = resolveOrganizationId(context.organizationId);
4874
4919
  await runGraphqlQueryCommand({
4875
- command: "notes.list",
4920
+ command: "content.list",
4876
4921
  operationName: "ContentsIndex",
4877
4922
  runtimeOptions: context.runtimeOptions,
4878
4923
  field: "contents",
@@ -4887,15 +4932,15 @@ function registerNoteCommands(program) {
4887
4932
  per: opts.per
4888
4933
  }),
4889
4934
  isList: true,
4890
- selectionSet: "{ count currentPage totalPages data { id type name slug firstChildSlug rootParentSlug status contentType lastEdited organizationId memberId focusMemberId focusTeamId teamId creatorId createdAt updatedAt childCount assignmentType contentableId contentableSlug contentableType votesTotal labelIds rootContentId parentContentId attributes } }"
4935
+ selectionSet: "{ count currentPage totalPages data { id type attributes } }"
4891
4936
  });
4892
4937
  });
4893
- notes.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
4938
+ content.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
4894
4939
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4895
4940
  const organizationId = resolveOrganizationId(context.organizationId);
4896
4941
  const id = idSchema12.parse(opts.id);
4897
4942
  await runGraphqlQueryCommand({
4898
- command: "notes.show",
4943
+ command: "content.show",
4899
4944
  operationName: "ContentShow",
4900
4945
  runtimeOptions: context.runtimeOptions,
4901
4946
  field: "content",
@@ -4907,7 +4952,7 @@ function registerNoteCommands(program) {
4907
4952
  selectionSet: "{ id type name slug firstChildSlug rootParentSlug status contentType lastEdited organizationId memberId focusMemberId focusTeamId teamId creatorId createdAt updatedAt childCount assignmentType contentableId contentableSlug contentableType votesTotal labelIds rootContentId parentContentId attributes }"
4908
4953
  });
4909
4954
  });
4910
- notes.command("update").requiredOption("--id <id>").option("--name <name>").option("--body <body>").option("--status <status>").action(async (opts, cmd) => {
4955
+ content.command("update").requiredOption("--id <id>").option("--name <name>").option("--body <body>").option("--status <status>").action(async (opts, cmd) => {
4911
4956
  assertUpdateFields({
4912
4957
  name: opts.name,
4913
4958
  content: opts.body,
@@ -4917,7 +4962,7 @@ function registerNoteCommands(program) {
4917
4962
  const organizationId = resolveOrganizationId(context.organizationId);
4918
4963
  const contentId = idSchema12.parse(opts.id);
4919
4964
  await runGraphqlMutationCommand({
4920
- command: "notes.update",
4965
+ command: "content.update",
4921
4966
  operationName: "UpdateContent",
4922
4967
  runtimeOptions: context.runtimeOptions,
4923
4968
  field: "update_content",
@@ -4934,12 +4979,12 @@ function registerNoteCommands(program) {
4934
4979
  })
4935
4980
  });
4936
4981
  });
4937
- notes.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
4982
+ content.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
4938
4983
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4939
4984
  const organizationId = resolveOrganizationId(context.organizationId);
4940
4985
  const contentId = idSchema12.parse(opts.id);
4941
4986
  await runGraphqlMutationCommand({
4942
- command: "notes.destroy",
4987
+ command: "content.destroy",
4943
4988
  operationName: "DestroyContent",
4944
4989
  runtimeOptions: context.runtimeOptions,
4945
4990
  field: "destroy_content",
@@ -4949,9 +4994,9 @@ function registerNoteCommands(program) {
4949
4994
  })
4950
4995
  });
4951
4996
  });
4952
- notes.command("create-member").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4997
+ content.command("create-member").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4953
4998
  const targetMemberId = nonEmptyString.parse(opts.targetMemberId);
4954
- await createContent("notes.create-member", cmd, {
4999
+ await createContent("content.create-member", cmd, {
4955
5000
  type: "WrittenContent",
4956
5001
  name: nonEmptyString.parse(opts.name),
4957
5002
  content: nonEmptyString.parse(opts.body),
@@ -4963,9 +5008,9 @@ function registerNoteCommands(program) {
4963
5008
  focus_team_id: null
4964
5009
  });
4965
5010
  });
4966
- notes.command("create-manager").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5011
+ content.command("create-manager").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4967
5012
  const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
4968
- await createContent("notes.create-manager", cmd, {
5013
+ await createContent("content.create-manager", cmd, {
4969
5014
  type: "WrittenContent",
4970
5015
  name: nonEmptyString.parse(opts.name),
4971
5016
  content: nonEmptyString.parse(opts.body),
@@ -4976,10 +5021,10 @@ function registerNoteCommands(program) {
4976
5021
  focus_member_id: nonEmptyString.parse(opts.targetMemberId)
4977
5022
  });
4978
5023
  });
4979
- notes.command("create-team").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--team-id <teamId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5024
+ content.command("create-team").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--team-id <teamId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4980
5025
  const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
4981
5026
  const teamId = nonEmptyString.parse(opts.teamId);
4982
- await createContent("notes.create-team", cmd, {
5027
+ await createContent("content.create-team", cmd, {
4983
5028
  type: "WrittenContent",
4984
5029
  name: nonEmptyString.parse(opts.name),
4985
5030
  content: nonEmptyString.parse(opts.body),
@@ -4990,8 +5035,8 @@ function registerNoteCommands(program) {
4990
5035
  focus_team_id: teamId
4991
5036
  });
4992
5037
  });
4993
- notes.command("create-project").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--project-id <projectId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4994
- await createContent("notes.create-project", cmd, {
5038
+ content.command("create-project").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--project-id <projectId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5039
+ await createContent("content.create-project", cmd, {
4995
5040
  type: "WrittenContent",
4996
5041
  name: nonEmptyString.parse(opts.name),
4997
5042
  content: nonEmptyString.parse(opts.body),
@@ -5001,8 +5046,8 @@ function registerNoteCommands(program) {
5001
5046
  member_id: nonEmptyString.parse(opts.actorMemberId)
5002
5047
  });
5003
5048
  });
5004
- notes.command("create-customer").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--customer-id <customerId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5005
- await createContent("notes.create-customer", cmd, {
5049
+ content.command("create-customer").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--customer-id <customerId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5050
+ await createContent("content.create-customer", cmd, {
5006
5051
  type: "WrittenContent",
5007
5052
  name: nonEmptyString.parse(opts.name),
5008
5053
  content: nonEmptyString.parse(opts.body),
@@ -5012,8 +5057,8 @@ function registerNoteCommands(program) {
5012
5057
  member_id: nonEmptyString.parse(opts.actorMemberId)
5013
5058
  });
5014
5059
  });
5015
- notes.command("create-contact").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--contact-id <contactId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5016
- await createContent("notes.create-contact", cmd, {
5060
+ content.command("create-contact").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--contact-id <contactId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5061
+ await createContent("content.create-contact", cmd, {
5017
5062
  type: "WrittenContent",
5018
5063
  name: nonEmptyString.parse(opts.name),
5019
5064
  content: nonEmptyString.parse(opts.body),
@@ -5970,26 +6015,26 @@ function emitUnsupportedMutation(params) {
5970
6015
  });
5971
6016
  }
5972
6017
  function registerMutationCapabilityCommands(program) {
5973
- const projectNotes = program.command("project-notes").description("Project notes node (read-only in CLI mutation surface)");
5974
- projectNotes.command("create").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6018
+ const projectContent = program.command("project-content").description("Project content node (read-only in CLI mutation surface)");
6019
+ projectContent.command("create").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5975
6020
  emitUnsupportedMutation({
5976
- command: "project-notes.create",
6021
+ command: "project-content.create",
5977
6022
  toolKey: "projects",
5978
6023
  nodeKey: "project_notes",
5979
6024
  canonicalPath: opts.path
5980
6025
  });
5981
6026
  });
5982
- projectNotes.command("update").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6027
+ projectContent.command("update").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5983
6028
  emitUnsupportedMutation({
5984
- command: "project-notes.update",
6029
+ command: "project-content.update",
5985
6030
  toolKey: "projects",
5986
6031
  nodeKey: "project_notes",
5987
6032
  canonicalPath: opts.path
5988
6033
  });
5989
6034
  });
5990
- projectNotes.command("destroy").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6035
+ projectContent.command("destroy").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5991
6036
  emitUnsupportedMutation({
5992
- command: "project-notes.destroy",
6037
+ command: "project-content.destroy",
5993
6038
  toolKey: "projects",
5994
6039
  nodeKey: "project_notes",
5995
6040
  canonicalPath: opts.path
@@ -6009,7 +6054,7 @@ function buildCli(options) {
6009
6054
  ).option(
6010
6055
  "--organization-id <organizationId>",
6011
6056
  "Organization ID (prefer WAVE_ORGANIZATION_ID env var)"
6012
- ).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(
6013
6058
  "--openapi-path <openapiPath>",
6014
6059
  "Optional local OpenAPI file path for contract-aware tooling"
6015
6060
  ).option(
@@ -6031,7 +6076,7 @@ function buildCli(options) {
6031
6076
  registerSystemToolCommands(program);
6032
6077
  registerFoundationCommands(program);
6033
6078
  registerChildEntityCommands(program);
6034
- registerNoteCommands(program);
6079
+ registerContentCommands(program);
6035
6080
  registerMutationCapabilityCommands(program);
6036
6081
  registerMarkdownTreeCommands(program);
6037
6082
  registerNavigationCommands(program);
@@ -6063,6 +6108,9 @@ async function main() {
6063
6108
  await program.parseAsync(process.argv);
6064
6109
  }
6065
6110
  main().catch((error) => {
6111
+ if (isEnvelopeEmittedSignal(error)) {
6112
+ return;
6113
+ }
6066
6114
  if (error instanceof CliError) {
6067
6115
  printCliFailure({
6068
6116
  status: error.status,
@@ -6071,10 +6119,12 @@ main().catch((error) => {
6071
6119
  details: error.details,
6072
6120
  exitCode: error.exitCode
6073
6121
  });
6122
+ return;
6074
6123
  }
6075
6124
  if (error instanceof import_commander2.CommanderError) {
6076
6125
  if (error.code === "commander.helpDisplayed" || error.code === "commander.version") {
6077
- process.exit(EXIT_CODES.success);
6126
+ process.exitCode = EXIT_CODES.success;
6127
+ return;
6078
6128
  }
6079
6129
  printCliFailure({
6080
6130
  status: 400,
@@ -6082,6 +6132,7 @@ main().catch((error) => {
6082
6132
  message: error.message,
6083
6133
  exitCode: EXIT_CODES.invalidArgs
6084
6134
  });
6135
+ return;
6085
6136
  }
6086
6137
  if (error instanceof import_zod16.ZodError || error instanceof import_commander2.InvalidArgumentError) {
6087
6138
  printCliFailure({
@@ -6093,6 +6144,7 @@ main().catch((error) => {
6093
6144
  },
6094
6145
  exitCode: EXIT_CODES.invalidArgs
6095
6146
  });
6147
+ return;
6096
6148
  }
6097
6149
  const message = error instanceof Error ? error.message : "Unexpected error.";
6098
6150
  printCliFailure({
@@ -6101,4 +6153,5 @@ main().catch((error) => {
6101
6153
  message,
6102
6154
  exitCode: EXIT_CODES.generic
6103
6155
  });
6156
+ return;
6104
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),
@@ -722,13 +719,52 @@ async function graphqlRequest(input) {
722
719
  }
723
720
 
724
721
  // src/output.ts
722
+ import { writeSync } from "fs";
723
+ var RETRYABLE_WRITE_CODES = /* @__PURE__ */ new Set(["EAGAIN", "EINTR"]);
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
+ };
731
+ function sleepBriefly(ms) {
732
+ const lock = new Int32Array(new SharedArrayBuffer(4));
733
+ Atomics.wait(lock, 0, 0, ms);
734
+ }
735
+ function writeStdoutFully(text) {
736
+ const fd = typeof process.stdout.fd === "number" ? process.stdout.fd : 1;
737
+ const buffer = Buffer.from(text, "utf8");
738
+ let offset = 0;
739
+ while (offset < buffer.length) {
740
+ try {
741
+ const bytesWritten = writeSync(fd, buffer, offset, buffer.length - offset);
742
+ if (bytesWritten <= 0) {
743
+ sleepBriefly(RETRY_BACKOFF_MS);
744
+ continue;
745
+ }
746
+ offset += bytesWritten;
747
+ } catch (error) {
748
+ const code = typeof error === "object" && error && "code" in error ? String(error.code ?? "") : "";
749
+ if (RETRYABLE_WRITE_CODES.has(code)) {
750
+ sleepBriefly(RETRY_BACKOFF_MS);
751
+ continue;
752
+ }
753
+ throw error;
754
+ }
755
+ }
756
+ }
725
757
  function printEnvelope(envelope) {
726
- process.stdout.write(`${JSON.stringify(envelope)}
758
+ writeStdoutFully(`${JSON.stringify(envelope)}
727
759
  `);
728
760
  }
729
761
  function printEnvelopeAndExit(params) {
730
762
  printEnvelope(params.envelope);
731
- 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;
732
768
  }
733
769
 
734
770
  // src/commandRunner.ts
@@ -1370,8 +1406,11 @@ async function runGraphqlQueryCommand(input) {
1370
1406
  }
1371
1407
  printEnvelopeAndExit(result);
1372
1408
  } catch (error) {
1409
+ if (isEnvelopeEmittedSignal(error)) {
1410
+ throw error;
1411
+ }
1373
1412
  if (error instanceof CliError) {
1374
- printEnvelopeAndExit({
1413
+ return printEnvelopeAndExit({
1375
1414
  envelope: buildCliErrorEnvelope({
1376
1415
  command: input.command,
1377
1416
  status: error.status,
@@ -1383,7 +1422,7 @@ async function runGraphqlQueryCommand(input) {
1383
1422
  });
1384
1423
  }
1385
1424
  const message = error instanceof Error ? error.message : "Unexpected error.";
1386
- printEnvelopeAndExit({
1425
+ return printEnvelopeAndExit({
1387
1426
  envelope: buildCliErrorEnvelope({
1388
1427
  command: input.command,
1389
1428
  status: 500,
@@ -1409,8 +1448,11 @@ async function runGraphqlMutationCommand(input) {
1409
1448
  });
1410
1449
  printEnvelopeAndExit(result);
1411
1450
  } catch (error) {
1451
+ if (isEnvelopeEmittedSignal(error)) {
1452
+ throw error;
1453
+ }
1412
1454
  if (error instanceof CliError) {
1413
- printEnvelopeAndExit({
1455
+ return printEnvelopeAndExit({
1414
1456
  envelope: buildCliErrorEnvelope({
1415
1457
  command: input.command,
1416
1458
  status: error.status,
@@ -1422,7 +1464,7 @@ async function runGraphqlMutationCommand(input) {
1422
1464
  });
1423
1465
  }
1424
1466
  const message = error instanceof Error ? error.message : "Unexpected error.";
1425
- printEnvelopeAndExit({
1467
+ return printEnvelopeAndExit({
1426
1468
  envelope: buildCliErrorEnvelope({
1427
1469
  command: input.command,
1428
1470
  status: 500,
@@ -1532,11 +1574,7 @@ function resolveFromSources(options, stdin, env) {
1532
1574
  normalize(env.WAVE_ORG_ID)
1533
1575
  );
1534
1576
  const timeoutMs = firstDefined(options.timeoutMs, stdin.timeoutMs, env.WAVE_TIMEOUT_MS);
1535
- const debug = firstDefined(
1536
- options.debug === true ? true : void 0,
1537
- stdin.debug,
1538
- parseBool(env.WAVE_DEBUG)
1539
- );
1577
+ const debug = parseBool(env.WAVE_DEBUG);
1540
1578
  const agentName = firstDefined(
1541
1579
  normalize(options.agentName),
1542
1580
  normalize(stdin.agentName),
@@ -2412,11 +2450,12 @@ function registerEntityCrudCommands(program, config) {
2412
2450
  const updateHelp5 = buildDataJsonHelp(config.rootKey, "update") ?? "JSON object, optionally wrapped with root key";
2413
2451
  const list = entityCommand.command("list").option("--page <page>").option("--per <per>");
2414
2452
  const listParams = config.listParams ?? [];
2453
+ const listParamHelp = config.listParamHelp ?? {};
2415
2454
  const showParams = config.showParams ?? [];
2416
2455
  const allowQueryJson = config.allowQueryJson !== false;
2417
2456
  listParams.forEach((param) => {
2418
2457
  const cliParam = param.replace(/_/g, "-");
2419
- list.option(`--${cliParam} <${cliParam}>`);
2458
+ list.option(`--${cliParam} <${cliParam}>`, listParamHelp[param]);
2420
2459
  });
2421
2460
  if (allowQueryJson) {
2422
2461
  list.option("--query-json <queryJson>", "Additional query params as JSON object");
@@ -2593,7 +2632,7 @@ function registerProjectCommands(program) {
2593
2632
  const organizationId = resolveOrganizationId(context.organizationId);
2594
2633
  await runGraphqlQueryCommand({
2595
2634
  command: "projects.list",
2596
- operationName: "ProjectsIndexSlim",
2635
+ operationName: "ProjectsList",
2597
2636
  runtimeOptions: context.runtimeOptions,
2598
2637
  field: "projects",
2599
2638
  variables: normalizeGraphqlVariables2({
@@ -2621,7 +2660,7 @@ function registerProjectCommands(program) {
2621
2660
  const organizationId = resolveOrganizationId(context.organizationId);
2622
2661
  await runGraphqlQueryCommand({
2623
2662
  command: "projects.show",
2624
- operationName: "ProjectShowDeepV2",
2663
+ operationName: "ProjectsShow",
2625
2664
  runtimeOptions: context.runtimeOptions,
2626
2665
  field: "project",
2627
2666
  variables: {
@@ -3884,6 +3923,11 @@ function registerSystemToolCommands(program) {
3884
3923
  "term",
3885
3924
  "type"
3886
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
+ },
3887
3931
  showParams: ["include_all_rollups"],
3888
3932
  allowQueryJson: false
3889
3933
  });
@@ -4536,6 +4580,7 @@ function registerFoundationCommands(program) {
4536
4580
  import { z as z12 } from "zod";
4537
4581
  var idSchema11 = z12.string().min(1);
4538
4582
  var jsonObjectSchema = z12.record(z12.string(), z12.unknown());
4583
+ var childListMinimalSelectionSet = "{ data { id type attributes } count currentPage totalPages }";
4539
4584
  function parseJsonObject2(raw) {
4540
4585
  try {
4541
4586
  const parsed = JSON.parse(raw);
@@ -4736,11 +4781,11 @@ function registerChildEntityCommands(program) {
4736
4781
  updateField: "update_subtask",
4737
4782
  destroyField: "destroy_subtask",
4738
4783
  idVariable: "subtask_id",
4739
- listOperationName: "SubtasksForTask",
4740
- createOperationName: "CreateSubtask",
4741
- updateOperationName: "UpdateSubtask",
4742
- destroyOperationName: "DestroySubtask",
4743
- listSelectionSet: "{ data { id type name status taskId attributes } count currentPage totalPages }",
4784
+ listOperationName: "SubtasksList",
4785
+ createOperationName: "SubtasksCreate",
4786
+ updateOperationName: "SubtasksUpdate",
4787
+ destroyOperationName: "SubtasksDestroy",
4788
+ listSelectionSet: childListMinimalSelectionSet,
4744
4789
  listParentTypedField: "taskId",
4745
4790
  normalizeCreateBody: normalizeSubtaskCreateBody
4746
4791
  });
@@ -4755,11 +4800,11 @@ function registerChildEntityCommands(program) {
4755
4800
  updateField: "update_milestone",
4756
4801
  destroyField: "destroy_milestone",
4757
4802
  idVariable: "milestone_id",
4758
- listOperationName: "MilestonesForRock",
4759
- createOperationName: "CreateMilestone",
4760
- updateOperationName: "UpdateMilestone",
4761
- destroyOperationName: "DestroyMilestone",
4762
- listSelectionSet: "{ data { id type name slug status attributes } count currentPage totalPages }"
4803
+ listOperationName: "MilestonesList",
4804
+ createOperationName: "MilestonesCreate",
4805
+ updateOperationName: "MilestonesUpdate",
4806
+ destroyOperationName: "MilestonesDestroy",
4807
+ listSelectionSet: childListMinimalSelectionSet
4763
4808
  });
4764
4809
  registerChildCommands(program, {
4765
4810
  command: "subitems",
@@ -4772,11 +4817,11 @@ function registerChildEntityCommands(program) {
4772
4817
  updateField: "update_subitem",
4773
4818
  destroyField: "destroy_subitem",
4774
4819
  idVariable: "subitem_id",
4775
- listOperationName: "SubitemsForListItem",
4776
- createOperationName: "CreateSubitem",
4777
- updateOperationName: "UpdateSubitem",
4778
- destroyOperationName: "DestroySubitem",
4779
- listSelectionSet: "{ data { id type name status listItemId attributes } count currentPage totalPages }",
4820
+ listOperationName: "SubitemsList",
4821
+ createOperationName: "SubitemsCreate",
4822
+ updateOperationName: "SubitemsUpdate",
4823
+ destroyOperationName: "SubitemsDestroy",
4824
+ listSelectionSet: childListMinimalSelectionSet,
4780
4825
  listParentTypedField: "listItemId"
4781
4826
  });
4782
4827
  registerChildCommands(program, {
@@ -4790,11 +4835,11 @@ function registerChildEntityCommands(program) {
4790
4835
  updateField: "update_sub_todo",
4791
4836
  destroyField: "destroy_sub_todo",
4792
4837
  idVariable: "sub_todo_id",
4793
- listOperationName: "SubtodosForTodo",
4794
- createOperationName: "CreateSubTodo",
4795
- updateOperationName: "UpdateSubTodo",
4796
- destroyOperationName: "DestroySubTodo",
4797
- listSelectionSet: "{ data { id type name status todoId attributes } count currentPage totalPages }",
4838
+ listOperationName: "SubtodosList",
4839
+ createOperationName: "SubtodosCreate",
4840
+ updateOperationName: "SubtodosUpdate",
4841
+ destroyOperationName: "SubtodosDestroy",
4842
+ listSelectionSet: childListMinimalSelectionSet,
4798
4843
  listParentTypedField: "todoId"
4799
4844
  });
4800
4845
  registerChildCommands(program, {
@@ -4808,11 +4853,11 @@ function registerChildEntityCommands(program) {
4808
4853
  updateField: "update_sub_issue",
4809
4854
  destroyField: "destroy_sub_issue",
4810
4855
  idVariable: "sub_issue_id",
4811
- listOperationName: "SubissuesForIssue",
4812
- createOperationName: "CreateSubIssue",
4813
- updateOperationName: "UpdateSubIssue",
4814
- destroyOperationName: "DestroySubIssue",
4815
- listSelectionSet: "{ data { id type name status issueId attributes } count currentPage totalPages }",
4856
+ listOperationName: "SubissuesList",
4857
+ createOperationName: "SubissuesCreate",
4858
+ updateOperationName: "SubissuesUpdate",
4859
+ destroyOperationName: "SubissuesDestroy",
4860
+ listSelectionSet: childListMinimalSelectionSet,
4816
4861
  listParentTypedField: "issueId"
4817
4862
  });
4818
4863
  registerChildCommands(program, {
@@ -4826,23 +4871,23 @@ function registerChildEntityCommands(program) {
4826
4871
  updateField: "update_talking_point",
4827
4872
  destroyField: "destroy_talking_point",
4828
4873
  idVariable: "talking_point_id",
4829
- listOperationName: "TalkingPointsForMeeting",
4830
- createOperationName: "CreateTalkingPoint",
4831
- updateOperationName: "UpdateTalkingPoint",
4832
- destroyOperationName: "DestroyTalkingPoint",
4833
- listSelectionSet: "{ data { id type name description status priority rank dueDate memberId creatorId meetingId attributes } count currentPage totalPages }",
4874
+ listOperationName: "TalkingPointsList",
4875
+ createOperationName: "TalkingPointsCreate",
4876
+ updateOperationName: "TalkingPointsUpdate",
4877
+ destroyOperationName: "TalkingPointsDestroy",
4878
+ listSelectionSet: childListMinimalSelectionSet,
4834
4879
  listParentTypedField: "meetingId"
4835
4880
  });
4836
4881
  }
4837
4882
 
4838
- // src/commands/notes.ts
4883
+ // src/commands/content.ts
4839
4884
  import { z as z13 } from "zod";
4840
4885
  var idSchema12 = z13.string().min(1);
4841
4886
  var nonEmptyString = z13.string().min(1);
4842
4887
  function assertUpdateFields(params) {
4843
4888
  if (!params.name && !params.content && !params.status) {
4844
4889
  throw new CliError({
4845
- message: "notes update requires at least one of --name, --body, or --status.",
4890
+ message: "content update requires at least one of --name, --body, or --status.",
4846
4891
  kind: "invalid_args",
4847
4892
  status: 400,
4848
4893
  exitCode: EXIT_CODES.invalidArgs
@@ -4865,13 +4910,13 @@ async function createContent(command, cmd, payload) {
4865
4910
  })
4866
4911
  });
4867
4912
  }
4868
- function registerNoteCommands(program) {
4869
- const notes = program.command("notes").description("Content note operations");
4870
- notes.command("list").option("--contentable-type <contentableType>").option("--contentable-id <contentableId>").option("--member-id <memberId>").option("--focus-member-id <focusMemberId>").option("--focus-team-id <focusTeamId>").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
4913
+ function registerContentCommands(program) {
4914
+ const content = program.command("content").description("Content note operations");
4915
+ content.command("list").option("--contentable-type <contentableType>").option("--contentable-id <contentableId>").option("--member-id <memberId>").option("--focus-member-id <focusMemberId>").option("--focus-team-id <focusTeamId>").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
4871
4916
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4872
4917
  const organizationId = resolveOrganizationId(context.organizationId);
4873
4918
  await runGraphqlQueryCommand({
4874
- command: "notes.list",
4919
+ command: "content.list",
4875
4920
  operationName: "ContentsIndex",
4876
4921
  runtimeOptions: context.runtimeOptions,
4877
4922
  field: "contents",
@@ -4886,15 +4931,15 @@ function registerNoteCommands(program) {
4886
4931
  per: opts.per
4887
4932
  }),
4888
4933
  isList: true,
4889
- selectionSet: "{ count currentPage totalPages data { id type name slug firstChildSlug rootParentSlug status contentType lastEdited organizationId memberId focusMemberId focusTeamId teamId creatorId createdAt updatedAt childCount assignmentType contentableId contentableSlug contentableType votesTotal labelIds rootContentId parentContentId attributes } }"
4934
+ selectionSet: "{ count currentPage totalPages data { id type attributes } }"
4890
4935
  });
4891
4936
  });
4892
- notes.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
4937
+ content.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
4893
4938
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4894
4939
  const organizationId = resolveOrganizationId(context.organizationId);
4895
4940
  const id = idSchema12.parse(opts.id);
4896
4941
  await runGraphqlQueryCommand({
4897
- command: "notes.show",
4942
+ command: "content.show",
4898
4943
  operationName: "ContentShow",
4899
4944
  runtimeOptions: context.runtimeOptions,
4900
4945
  field: "content",
@@ -4906,7 +4951,7 @@ function registerNoteCommands(program) {
4906
4951
  selectionSet: "{ id type name slug firstChildSlug rootParentSlug status contentType lastEdited organizationId memberId focusMemberId focusTeamId teamId creatorId createdAt updatedAt childCount assignmentType contentableId contentableSlug contentableType votesTotal labelIds rootContentId parentContentId attributes }"
4907
4952
  });
4908
4953
  });
4909
- notes.command("update").requiredOption("--id <id>").option("--name <name>").option("--body <body>").option("--status <status>").action(async (opts, cmd) => {
4954
+ content.command("update").requiredOption("--id <id>").option("--name <name>").option("--body <body>").option("--status <status>").action(async (opts, cmd) => {
4910
4955
  assertUpdateFields({
4911
4956
  name: opts.name,
4912
4957
  content: opts.body,
@@ -4916,7 +4961,7 @@ function registerNoteCommands(program) {
4916
4961
  const organizationId = resolveOrganizationId(context.organizationId);
4917
4962
  const contentId = idSchema12.parse(opts.id);
4918
4963
  await runGraphqlMutationCommand({
4919
- command: "notes.update",
4964
+ command: "content.update",
4920
4965
  operationName: "UpdateContent",
4921
4966
  runtimeOptions: context.runtimeOptions,
4922
4967
  field: "update_content",
@@ -4933,12 +4978,12 @@ function registerNoteCommands(program) {
4933
4978
  })
4934
4979
  });
4935
4980
  });
4936
- notes.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
4981
+ content.command("destroy").requiredOption("--id <id>").action(async (opts, cmd) => {
4937
4982
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4938
4983
  const organizationId = resolveOrganizationId(context.organizationId);
4939
4984
  const contentId = idSchema12.parse(opts.id);
4940
4985
  await runGraphqlMutationCommand({
4941
- command: "notes.destroy",
4986
+ command: "content.destroy",
4942
4987
  operationName: "DestroyContent",
4943
4988
  runtimeOptions: context.runtimeOptions,
4944
4989
  field: "destroy_content",
@@ -4948,9 +4993,9 @@ function registerNoteCommands(program) {
4948
4993
  })
4949
4994
  });
4950
4995
  });
4951
- notes.command("create-member").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4996
+ content.command("create-member").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4952
4997
  const targetMemberId = nonEmptyString.parse(opts.targetMemberId);
4953
- await createContent("notes.create-member", cmd, {
4998
+ await createContent("content.create-member", cmd, {
4954
4999
  type: "WrittenContent",
4955
5000
  name: nonEmptyString.parse(opts.name),
4956
5001
  content: nonEmptyString.parse(opts.body),
@@ -4962,9 +5007,9 @@ function registerNoteCommands(program) {
4962
5007
  focus_team_id: null
4963
5008
  });
4964
5009
  });
4965
- notes.command("create-manager").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5010
+ content.command("create-manager").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--target-member-id <targetMemberId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4966
5011
  const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
4967
- await createContent("notes.create-manager", cmd, {
5012
+ await createContent("content.create-manager", cmd, {
4968
5013
  type: "WrittenContent",
4969
5014
  name: nonEmptyString.parse(opts.name),
4970
5015
  content: nonEmptyString.parse(opts.body),
@@ -4975,10 +5020,10 @@ function registerNoteCommands(program) {
4975
5020
  focus_member_id: nonEmptyString.parse(opts.targetMemberId)
4976
5021
  });
4977
5022
  });
4978
- notes.command("create-team").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--team-id <teamId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5023
+ content.command("create-team").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--team-id <teamId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4979
5024
  const actorMemberId = nonEmptyString.parse(opts.actorMemberId);
4980
5025
  const teamId = nonEmptyString.parse(opts.teamId);
4981
- await createContent("notes.create-team", cmd, {
5026
+ await createContent("content.create-team", cmd, {
4982
5027
  type: "WrittenContent",
4983
5028
  name: nonEmptyString.parse(opts.name),
4984
5029
  content: nonEmptyString.parse(opts.body),
@@ -4989,8 +5034,8 @@ function registerNoteCommands(program) {
4989
5034
  focus_team_id: teamId
4990
5035
  });
4991
5036
  });
4992
- notes.command("create-project").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--project-id <projectId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
4993
- await createContent("notes.create-project", cmd, {
5037
+ content.command("create-project").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--project-id <projectId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5038
+ await createContent("content.create-project", cmd, {
4994
5039
  type: "WrittenContent",
4995
5040
  name: nonEmptyString.parse(opts.name),
4996
5041
  content: nonEmptyString.parse(opts.body),
@@ -5000,8 +5045,8 @@ function registerNoteCommands(program) {
5000
5045
  member_id: nonEmptyString.parse(opts.actorMemberId)
5001
5046
  });
5002
5047
  });
5003
- notes.command("create-customer").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--customer-id <customerId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5004
- await createContent("notes.create-customer", cmd, {
5048
+ content.command("create-customer").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--customer-id <customerId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5049
+ await createContent("content.create-customer", cmd, {
5005
5050
  type: "WrittenContent",
5006
5051
  name: nonEmptyString.parse(opts.name),
5007
5052
  content: nonEmptyString.parse(opts.body),
@@ -5011,8 +5056,8 @@ function registerNoteCommands(program) {
5011
5056
  member_id: nonEmptyString.parse(opts.actorMemberId)
5012
5057
  });
5013
5058
  });
5014
- notes.command("create-contact").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--contact-id <contactId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5015
- await createContent("notes.create-contact", cmd, {
5059
+ content.command("create-contact").requiredOption("--actor-member-id <actorMemberId>").requiredOption("--contact-id <contactId>").requiredOption("--name <name>").requiredOption("--body <body>").option("--status <status>", "draft").action(async (opts, cmd) => {
5060
+ await createContent("content.create-contact", cmd, {
5016
5061
  type: "WrittenContent",
5017
5062
  name: nonEmptyString.parse(opts.name),
5018
5063
  content: nonEmptyString.parse(opts.body),
@@ -5969,26 +6014,26 @@ function emitUnsupportedMutation(params) {
5969
6014
  });
5970
6015
  }
5971
6016
  function registerMutationCapabilityCommands(program) {
5972
- const projectNotes = program.command("project-notes").description("Project notes node (read-only in CLI mutation surface)");
5973
- projectNotes.command("create").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6017
+ const projectContent = program.command("project-content").description("Project content node (read-only in CLI mutation surface)");
6018
+ projectContent.command("create").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5974
6019
  emitUnsupportedMutation({
5975
- command: "project-notes.create",
6020
+ command: "project-content.create",
5976
6021
  toolKey: "projects",
5977
6022
  nodeKey: "project_notes",
5978
6023
  canonicalPath: opts.path
5979
6024
  });
5980
6025
  });
5981
- projectNotes.command("update").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6026
+ projectContent.command("update").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5982
6027
  emitUnsupportedMutation({
5983
- command: "project-notes.update",
6028
+ command: "project-content.update",
5984
6029
  toolKey: "projects",
5985
6030
  nodeKey: "project_notes",
5986
6031
  canonicalPath: opts.path
5987
6032
  });
5988
6033
  });
5989
- projectNotes.command("destroy").option("--path <path>", "Canonical path for the selected node").action((opts) => {
6034
+ projectContent.command("destroy").option("--path <path>", "Canonical path for the selected node").action((opts) => {
5990
6035
  emitUnsupportedMutation({
5991
- command: "project-notes.destroy",
6036
+ command: "project-content.destroy",
5992
6037
  toolKey: "projects",
5993
6038
  nodeKey: "project_notes",
5994
6039
  canonicalPath: opts.path
@@ -6008,7 +6053,7 @@ function buildCli(options) {
6008
6053
  ).option(
6009
6054
  "--organization-id <organizationId>",
6010
6055
  "Organization ID (prefer WAVE_ORGANIZATION_ID env var)"
6011
- ).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(
6012
6057
  "--openapi-path <openapiPath>",
6013
6058
  "Optional local OpenAPI file path for contract-aware tooling"
6014
6059
  ).option(
@@ -6030,7 +6075,7 @@ function buildCli(options) {
6030
6075
  registerSystemToolCommands(program);
6031
6076
  registerFoundationCommands(program);
6032
6077
  registerChildEntityCommands(program);
6033
- registerNoteCommands(program);
6078
+ registerContentCommands(program);
6034
6079
  registerMutationCapabilityCommands(program);
6035
6080
  registerMarkdownTreeCommands(program);
6036
6081
  registerNavigationCommands(program);
@@ -6062,6 +6107,9 @@ async function main() {
6062
6107
  await program.parseAsync(process.argv);
6063
6108
  }
6064
6109
  main().catch((error) => {
6110
+ if (isEnvelopeEmittedSignal(error)) {
6111
+ return;
6112
+ }
6065
6113
  if (error instanceof CliError) {
6066
6114
  printCliFailure({
6067
6115
  status: error.status,
@@ -6070,10 +6118,12 @@ main().catch((error) => {
6070
6118
  details: error.details,
6071
6119
  exitCode: error.exitCode
6072
6120
  });
6121
+ return;
6073
6122
  }
6074
6123
  if (error instanceof CommanderError) {
6075
6124
  if (error.code === "commander.helpDisplayed" || error.code === "commander.version") {
6076
- process.exit(EXIT_CODES.success);
6125
+ process.exitCode = EXIT_CODES.success;
6126
+ return;
6077
6127
  }
6078
6128
  printCliFailure({
6079
6129
  status: 400,
@@ -6081,6 +6131,7 @@ main().catch((error) => {
6081
6131
  message: error.message,
6082
6132
  exitCode: EXIT_CODES.invalidArgs
6083
6133
  });
6134
+ return;
6084
6135
  }
6085
6136
  if (error instanceof ZodError || error instanceof InvalidArgumentError) {
6086
6137
  printCliFailure({
@@ -6092,6 +6143,7 @@ main().catch((error) => {
6092
6143
  },
6093
6144
  exitCode: EXIT_CODES.invalidArgs
6094
6145
  });
6146
+ return;
6095
6147
  }
6096
6148
  const message = error instanceof Error ? error.message : "Unexpected error.";
6097
6149
  printCliFailure({
@@ -6100,4 +6152,5 @@ main().catch((error) => {
6100
6152
  message,
6101
6153
  exitCode: EXIT_CODES.generic
6102
6154
  });
6155
+ return;
6103
6156
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ted-galago/wave-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"