@wave-ai-os/wave-cli 0.1.72 → 0.1.74

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
@@ -74,6 +74,12 @@ The API base defaults to production: `https://api.ourwave.io`. Supply
74
74
  `--base-url`, stdin context, `WAVE_API_BASE_URL`/`WAVE_API_URL`, or config only
75
75
  when using a non-production environment.
76
76
 
77
+ `wave login` always opens the production browser login at
78
+ `https://app.ourwave.io/login` unless `--base-url` is supplied explicitly.
79
+ The CLI uses `https://api.ourwave.io` only to create and poll that login
80
+ session. Ambient endpoint configuration never redirects a bare login to a
81
+ local environment.
82
+
77
83
  Organization-scoped data commands use the organization certified by the
78
84
  authenticated CLI token. `--organization-id` is the only local override.
79
85
 
package/dist/index.cjs CHANGED
@@ -2556,6 +2556,20 @@ function parseSearchQuery(raw) {
2556
2556
  }
2557
2557
  return raw.trim();
2558
2558
  }
2559
+ function parseRequiredOption(raw, flag) {
2560
+ if (typeof raw !== "string" || raw.trim().length === 0) {
2561
+ throw new CliError({
2562
+ message: `Missing required option: --${flag}.`,
2563
+ kind: "invalid_args",
2564
+ status: 400,
2565
+ exitCode: EXIT_CODES.invalidArgs
2566
+ });
2567
+ }
2568
+ return raw.trim();
2569
+ }
2570
+ function optionKey(flag) {
2571
+ return flag.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
2572
+ }
2559
2573
  function asRecord2(value) {
2560
2574
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
2561
2575
  }
@@ -2592,10 +2606,21 @@ function buildSearchTransform(query, transformData) {
2592
2606
  };
2593
2607
  }
2594
2608
  function registerGraphqlSearchCommand(command, config) {
2595
- command.command("search").description("Search records through the existing list GraphQL contract").requiredOption("--query <query>", "Search query").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
2609
+ const requiredOptions = config.requiredOptions ?? [];
2610
+ const search = command.command("search").description("Search records through the existing list GraphQL contract").requiredOption("--query <query>", "Search query").option("--page <page>").option("--per <per>");
2611
+ for (const requiredOption of requiredOptions) {
2612
+ search.requiredOption(`--${requiredOption.flag} <${requiredOption.flag}>`, requiredOption.description);
2613
+ }
2614
+ search.action(async (opts, cmd) => {
2596
2615
  const context = await resolveCommandContext(cmd.optsWithGlobals());
2597
2616
  const organizationId = resolveOrganizationId(context.organizationId);
2598
2617
  const query = parseSearchQuery(opts.query);
2618
+ const requiredVariables = Object.fromEntries(
2619
+ requiredOptions.map((requiredOption) => [
2620
+ requiredOption.variable,
2621
+ parseRequiredOption(opts[optionKey(requiredOption.flag)], requiredOption.flag)
2622
+ ])
2623
+ );
2599
2624
  await runGraphqlQueryCommand({
2600
2625
  command: `${config.command}.search`,
2601
2626
  operationName: config.operationName,
@@ -2604,13 +2629,20 @@ function registerGraphqlSearchCommand(command, config) {
2604
2629
  variables: normalizeGraphqlVariables2({
2605
2630
  organization_id: organizationId,
2606
2631
  page: opts.page,
2607
- per: opts.per
2632
+ per: opts.per,
2633
+ ...requiredVariables
2608
2634
  }),
2609
2635
  variableTypes: {
2610
2636
  organization_id: "ID!",
2611
2637
  page: "Int",
2612
2638
  per: "Int",
2613
- ...config.variableTypes ?? {}
2639
+ ...config.variableTypes ?? {},
2640
+ ...Object.fromEntries(
2641
+ requiredOptions.map((requiredOption) => [
2642
+ requiredOption.variable,
2643
+ requiredOption.variableType
2644
+ ])
2645
+ )
2614
2646
  },
2615
2647
  isList: true,
2616
2648
  selectionSet: config.selectionSet,
@@ -3448,8 +3480,8 @@ function registerEntityCrudCommands(program, config) {
3448
3480
  const extraQuery = allowQueryJson ? parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0) : {};
3449
3481
  const mappedKnownParams = Object.fromEntries(
3450
3482
  listParams.map((param) => {
3451
- const optionKey = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3452
- return [param, opts[optionKey]];
3483
+ const optionKey2 = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3484
+ return [param, opts[optionKey2]];
3453
3485
  })
3454
3486
  );
3455
3487
  const variables = normalizeGraphqlVariables2({
@@ -3488,8 +3520,8 @@ function registerEntityCrudCommands(program, config) {
3488
3520
  const defaultField = config.showField ?? (config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath));
3489
3521
  const mappedShowParams = Object.fromEntries(
3490
3522
  showParams.map((param) => {
3491
- const optionKey = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3492
- return [param, opts[optionKey]];
3523
+ const optionKey2 = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3524
+ return [param, opts[optionKey2]];
3493
3525
  })
3494
3526
  );
3495
3527
  const defaultVariables = normalizeGraphqlVariables2({
@@ -5788,12 +5820,41 @@ function registerFoundationCommands(program) {
5788
5820
  var import_zod13 = require("zod");
5789
5821
  var idSchema12 = import_zod13.z.string().min(1);
5790
5822
  var jsonObjectSchema = import_zod13.z.record(import_zod13.z.string(), import_zod13.z.unknown());
5791
- function buildChildListSelectionSet(parentField, extraFields = []) {
5823
+ var NOTE_DETAIL_FIELDS = [
5824
+ "notes",
5825
+ "hasNotes",
5826
+ "hasUnreadNotes",
5827
+ "notesUpdatedAt",
5828
+ "notesLastReadAt",
5829
+ "estimateIds"
5830
+ ];
5831
+ var PARENT_KIND_LABELS = {
5832
+ task: "task",
5833
+ rock: "rock",
5834
+ listItem: "list item",
5835
+ todo: "todo",
5836
+ issue: "issue",
5837
+ meeting: "meeting"
5838
+ };
5839
+ function requiredParentSearchOption(parentFlag, parentKind) {
5840
+ return [
5841
+ {
5842
+ flag: parentFlag,
5843
+ variable: parentFlag.replace(/-/g, "_"),
5844
+ variableType: "ID!",
5845
+ description: `Parent ${PARENT_KIND_LABELS[parentKind]} ID`
5846
+ }
5847
+ ];
5848
+ }
5849
+ function buildChildResourceSelectionSet(parentField, extraFields = []) {
5792
5850
  const fields = Array.from(
5793
5851
  /* @__PURE__ */ new Set(["id", "type", "name", "status", "priority", "rank", "dueDate", "memberId", parentField, ...extraFields])
5794
5852
  );
5795
5853
  const attributeFields = fields.filter((field) => field !== "type");
5796
- return `{ data { ${fields.join(" ")} attributes { ${attributeFields.join(" ")} } } count currentPage totalPages }`;
5854
+ return `{ ${fields.join(" ")} attributes { ${attributeFields.join(" ")} } }`;
5855
+ }
5856
+ function buildChildListSelectionSet(parentField, extraFields = []) {
5857
+ return `{ data ${buildChildResourceSelectionSet(parentField, extraFields)} count currentPage totalPages }`;
5797
5858
  }
5798
5859
  function parseJsonObject2(raw) {
5799
5860
  try {
@@ -5937,7 +5998,31 @@ function registerChildCommands(program, config) {
5937
5998
  )
5938
5999
  });
5939
6000
  });
5940
- registerGraphqlSearchCommand(command, {
6001
+ if (config.showField) {
6002
+ const showField = config.showField;
6003
+ command.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
6004
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
6005
+ const organizationId = resolveOrganizationId(context.organizationId);
6006
+ const id = idSchema12.parse(opts.id);
6007
+ await runGraphqlQueryCommand({
6008
+ command: `${config.command}.show`,
6009
+ ...config.showOperationName ? { operationName: config.showOperationName } : {},
6010
+ runtimeOptions: context.runtimeOptions,
6011
+ field: showField,
6012
+ variables: {
6013
+ organization_id: organizationId,
6014
+ id
6015
+ },
6016
+ variableTypes: {
6017
+ organization_id: "ID!",
6018
+ id: "ID!"
6019
+ },
6020
+ ...config.showSelectionSet ? { selectionSet: config.showSelectionSet } : {},
6021
+ isShow: true
6022
+ });
6023
+ });
6024
+ }
6025
+ const searchConfig = {
5941
6026
  command: config.command,
5942
6027
  operationName: `${config.listOperationName.replace(/List$/, "")}Search`,
5943
6028
  field: config.listField,
@@ -5947,8 +6032,10 @@ function registerChildCommands(program, config) {
5947
6032
  config.parentKind,
5948
6033
  void 0,
5949
6034
  config.listParentTypedField
5950
- )
5951
- });
6035
+ ),
6036
+ ...config.searchRequiredOptions ? { requiredOptions: config.searchRequiredOptions } : {}
6037
+ };
6038
+ registerGraphqlSearchCommand(command, searchConfig);
5952
6039
  command.command("create").requiredOption("--data-json <dataJson>").action(async (opts, cmd) => {
5953
6040
  const context = await resolveCommandContext(cmd.optsWithGlobals());
5954
6041
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -6019,6 +6106,10 @@ function registerChildEntityCommands(program) {
6019
6106
  destroyOperationName: "SubtasksDestroy",
6020
6107
  listSelectionSet: buildChildListSelectionSet("taskId"),
6021
6108
  listParentTypedField: "taskId",
6109
+ searchRequiredOptions: requiredParentSearchOption("task-id", "task"),
6110
+ showField: "subtask",
6111
+ showOperationName: "SubtasksShow",
6112
+ showSelectionSet: buildChildResourceSelectionSet("taskId", NOTE_DETAIL_FIELDS),
6022
6113
  normalizeCreateBody: normalizeSubtaskCreateBody
6023
6114
  });
6024
6115
  registerChildCommands(program, {
@@ -6036,7 +6127,12 @@ function registerChildEntityCommands(program) {
6036
6127
  createOperationName: "MilestonesCreate",
6037
6128
  updateOperationName: "MilestonesUpdate",
6038
6129
  destroyOperationName: "MilestonesDestroy",
6039
- listSelectionSet: buildChildListSelectionSet("rockId")
6130
+ listSelectionSet: buildChildListSelectionSet("rockId"),
6131
+ listParentTypedField: "rockId",
6132
+ searchRequiredOptions: requiredParentSearchOption("rock-id", "rock"),
6133
+ showField: "milestone",
6134
+ showOperationName: "MilestonesShow",
6135
+ showSelectionSet: buildChildResourceSelectionSet("rockId", NOTE_DETAIL_FIELDS)
6040
6136
  });
6041
6137
  registerChildCommands(program, {
6042
6138
  command: "subitems",
@@ -6054,7 +6150,11 @@ function registerChildEntityCommands(program) {
6054
6150
  updateOperationName: "SubitemsUpdate",
6055
6151
  destroyOperationName: "SubitemsDestroy",
6056
6152
  listSelectionSet: buildChildListSelectionSet("listItemId"),
6057
- listParentTypedField: "listItemId"
6153
+ listParentTypedField: "listItemId",
6154
+ searchRequiredOptions: requiredParentSearchOption("list-item-id", "listItem"),
6155
+ showField: "subitem",
6156
+ showOperationName: "SubitemsShow",
6157
+ showSelectionSet: buildChildResourceSelectionSet("listItemId", NOTE_DETAIL_FIELDS)
6058
6158
  });
6059
6159
  registerChildCommands(program, {
6060
6160
  command: "subtodos",
@@ -6072,7 +6172,11 @@ function registerChildEntityCommands(program) {
6072
6172
  updateOperationName: "SubtodosUpdate",
6073
6173
  destroyOperationName: "SubtodosDestroy",
6074
6174
  listSelectionSet: buildChildListSelectionSet("todoId"),
6075
- listParentTypedField: "todoId"
6175
+ listParentTypedField: "todoId",
6176
+ searchRequiredOptions: requiredParentSearchOption("todo-id", "todo"),
6177
+ showField: "sub_todo",
6178
+ showOperationName: "SubtodosShow",
6179
+ showSelectionSet: buildChildResourceSelectionSet("todoId", NOTE_DETAIL_FIELDS)
6076
6180
  });
6077
6181
  registerChildCommands(program, {
6078
6182
  command: "subissues",
@@ -6090,7 +6194,11 @@ function registerChildEntityCommands(program) {
6090
6194
  updateOperationName: "SubissuesUpdate",
6091
6195
  destroyOperationName: "SubissuesDestroy",
6092
6196
  listSelectionSet: buildChildListSelectionSet("issueId"),
6093
- listParentTypedField: "issueId"
6197
+ listParentTypedField: "issueId",
6198
+ searchRequiredOptions: requiredParentSearchOption("issue-id", "issue"),
6199
+ showField: "sub_issue",
6200
+ showOperationName: "SubissuesShow",
6201
+ showSelectionSet: buildChildResourceSelectionSet("issueId", NOTE_DETAIL_FIELDS)
6094
6202
  });
6095
6203
  registerChildCommands(program, {
6096
6204
  command: "talking-points",
@@ -10166,6 +10274,9 @@ function asRecord5(value) {
10166
10274
  function asString(value) {
10167
10275
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
10168
10276
  }
10277
+ function resolveLoginApiBaseUrl(globals) {
10278
+ return asString(globals.baseUrl) ?? DEFAULT_PRODUCTION_API_BASE_URL;
10279
+ }
10169
10280
  function localUiBaseUrlFor(baseUrl) {
10170
10281
  const parsed = new URL(baseUrl);
10171
10282
  if ((parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") && parsed.port === "3009") {
@@ -10228,9 +10339,10 @@ async function authStatusRequest(params) {
10228
10339
  }
10229
10340
  async function runTokenLogin(cmd, opts) {
10230
10341
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10231
- const baseUrl = context.runtimeOptions.baseUrl;
10232
10342
  const globals = cmd.optsWithGlobals();
10233
- 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;
10343
+ const explicitBaseUrl = asString(globals.baseUrl);
10344
+ const baseUrl = resolveLoginApiBaseUrl(globals);
10345
+ const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : explicitBaseUrl ? context.runtimeOptions.token : void 0;
10234
10346
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, 1e4);
10235
10347
  if (!baseUrl) {
10236
10348
  return printEnvelopeAndExit({
@@ -10295,7 +10407,7 @@ async function runTokenLogin(cmd, opts) {
10295
10407
  }
10296
10408
  async function runBrowserLogin(cmd, opts) {
10297
10409
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10298
- const baseUrl = context.runtimeOptions.baseUrl;
10410
+ const baseUrl = resolveLoginApiBaseUrl(cmd.optsWithGlobals());
10299
10411
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, DEFAULT_LOGIN_TIMEOUT_MS);
10300
10412
  const pollIntervalMs = positiveInt2(opts.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
10301
10413
  if (!baseUrl) {
@@ -15233,7 +15345,7 @@ function registerAtlasAuthoringCommands(program) {
15233
15345
  });
15234
15346
  });
15235
15347
  const automations = program.command("automations").description("Bounded Automation authoring operations");
15236
- 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("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15348
+ automations.command("create").description("Create a Backlog 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("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15237
15349
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15238
15350
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15239
15351
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15256,7 +15368,6 @@ function registerAtlasAuthoringCommands(program) {
15256
15368
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15257
15369
  ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15258
15370
  ...opts.agentId !== void 0 ? { agentId: idSchema14.parse(opts.agentId) } : {},
15259
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15260
15371
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15261
15372
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
15262
15373
  },
@@ -15280,10 +15391,10 @@ function registerAtlasAuthoringCommands(program) {
15280
15391
  isShow: true
15281
15392
  });
15282
15393
  });
15283
- automations.command("update").description("Update one task-backed Automation through the API-owned updateTask contract").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15394
+ automations.command("update").description("Update one task-backed Automation without changing its system-managed status").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15284
15395
  "--expected-update-version <version>",
15285
15396
  "Exact opaque updateVersion value from automations show; rejects stale writes"
15286
- ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15397
+ ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15287
15398
  "--agent-id <agentId>",
15288
15399
  "Executor Agent id; requires --ai-task-config and is stored in that config"
15289
15400
  ).action(async (opts, cmd) => {
@@ -15303,7 +15414,6 @@ function registerAtlasAuthoringCommands(program) {
15303
15414
  ...opts.summary !== void 0 ? { summary: String(opts.summary) } : {},
15304
15415
  ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15305
15416
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15306
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15307
15417
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15308
15418
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {},
15309
15419
  ...aiTaskConfig !== void 0 ? { ai_task_config: aiTaskConfig } : {}
@@ -15422,7 +15532,7 @@ var import_node_path4 = require("path");
15422
15532
  var import_node_crypto3 = require("crypto");
15423
15533
 
15424
15534
  // src/version.ts
15425
- var CLI_VERSION = "0.1.72";
15535
+ var CLI_VERSION = "0.1.74";
15426
15536
 
15427
15537
  // src/operationMetadata.ts
15428
15538
  var DISCOVERY_OPERATION_IDS = [
@@ -15618,6 +15728,7 @@ var READ_OPERATION_IDS = [
15618
15728
  "members.show",
15619
15729
  "milestones.list",
15620
15730
  "milestones.search",
15731
+ "milestones.show",
15621
15732
  "news.list",
15622
15733
  "news.search",
15623
15734
  "news.show",
@@ -15688,12 +15799,16 @@ var READ_OPERATION_IDS = [
15688
15799
  "stand-ups.show",
15689
15800
  "subissues.list",
15690
15801
  "subissues.search",
15802
+ "subissues.show",
15691
15803
  "subitems.list",
15692
15804
  "subitems.search",
15805
+ "subitems.show",
15693
15806
  "subtasks.list",
15694
15807
  "subtasks.search",
15808
+ "subtasks.show",
15695
15809
  "subtodos.list",
15696
15810
  "subtodos.search",
15811
+ "subtodos.show",
15697
15812
  "support.counts",
15698
15813
  "support.inbox",
15699
15814
  "support.knowledge-articles",
@@ -16254,9 +16369,10 @@ var NAMESPACE_DOCS = {
16254
16369
  mutates: true,
16255
16370
  safety: [
16256
16371
  "Create calls only createAutomation with an explicit idempotency key.",
16372
+ "Create always leaves status to the API, which starts Automations in Backlog.",
16257
16373
  "Only the API-defined ai_task_config field accepts validated JSON.",
16258
16374
  "Optional executor Agent linkage is sent only through the API-defined top-level agentId input.",
16259
- "Update calls only updateTask with an exact opaque updateVersion token; it cannot change task type, ownership, or project linkage.",
16375
+ "Update calls only updateTask with an exact opaque updateVersion token; it cannot change status, task type, ownership, or project linkage.",
16260
16376
  "Does not create a project Task, run an Automation, or invoke AI OS actions.",
16261
16377
  "Show uses the API-owned automation query by id; no slug fallback is implemented."
16262
16378
  ],
package/dist/index.js CHANGED
@@ -2555,6 +2555,20 @@ function parseSearchQuery(raw) {
2555
2555
  }
2556
2556
  return raw.trim();
2557
2557
  }
2558
+ function parseRequiredOption(raw, flag) {
2559
+ if (typeof raw !== "string" || raw.trim().length === 0) {
2560
+ throw new CliError({
2561
+ message: `Missing required option: --${flag}.`,
2562
+ kind: "invalid_args",
2563
+ status: 400,
2564
+ exitCode: EXIT_CODES.invalidArgs
2565
+ });
2566
+ }
2567
+ return raw.trim();
2568
+ }
2569
+ function optionKey(flag) {
2570
+ return flag.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
2571
+ }
2558
2572
  function asRecord2(value) {
2559
2573
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
2560
2574
  }
@@ -2591,10 +2605,21 @@ function buildSearchTransform(query, transformData) {
2591
2605
  };
2592
2606
  }
2593
2607
  function registerGraphqlSearchCommand(command, config) {
2594
- command.command("search").description("Search records through the existing list GraphQL contract").requiredOption("--query <query>", "Search query").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
2608
+ const requiredOptions = config.requiredOptions ?? [];
2609
+ const search = command.command("search").description("Search records through the existing list GraphQL contract").requiredOption("--query <query>", "Search query").option("--page <page>").option("--per <per>");
2610
+ for (const requiredOption of requiredOptions) {
2611
+ search.requiredOption(`--${requiredOption.flag} <${requiredOption.flag}>`, requiredOption.description);
2612
+ }
2613
+ search.action(async (opts, cmd) => {
2595
2614
  const context = await resolveCommandContext(cmd.optsWithGlobals());
2596
2615
  const organizationId = resolveOrganizationId(context.organizationId);
2597
2616
  const query = parseSearchQuery(opts.query);
2617
+ const requiredVariables = Object.fromEntries(
2618
+ requiredOptions.map((requiredOption) => [
2619
+ requiredOption.variable,
2620
+ parseRequiredOption(opts[optionKey(requiredOption.flag)], requiredOption.flag)
2621
+ ])
2622
+ );
2598
2623
  await runGraphqlQueryCommand({
2599
2624
  command: `${config.command}.search`,
2600
2625
  operationName: config.operationName,
@@ -2603,13 +2628,20 @@ function registerGraphqlSearchCommand(command, config) {
2603
2628
  variables: normalizeGraphqlVariables2({
2604
2629
  organization_id: organizationId,
2605
2630
  page: opts.page,
2606
- per: opts.per
2631
+ per: opts.per,
2632
+ ...requiredVariables
2607
2633
  }),
2608
2634
  variableTypes: {
2609
2635
  organization_id: "ID!",
2610
2636
  page: "Int",
2611
2637
  per: "Int",
2612
- ...config.variableTypes ?? {}
2638
+ ...config.variableTypes ?? {},
2639
+ ...Object.fromEntries(
2640
+ requiredOptions.map((requiredOption) => [
2641
+ requiredOption.variable,
2642
+ requiredOption.variableType
2643
+ ])
2644
+ )
2613
2645
  },
2614
2646
  isList: true,
2615
2647
  selectionSet: config.selectionSet,
@@ -3447,8 +3479,8 @@ function registerEntityCrudCommands(program, config) {
3447
3479
  const extraQuery = allowQueryJson ? parseQueryJson(opts.queryJson ? String(opts.queryJson) : void 0) : {};
3448
3480
  const mappedKnownParams = Object.fromEntries(
3449
3481
  listParams.map((param) => {
3450
- const optionKey = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3451
- return [param, opts[optionKey]];
3482
+ const optionKey2 = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3483
+ return [param, opts[optionKey2]];
3452
3484
  })
3453
3485
  );
3454
3486
  const variables = normalizeGraphqlVariables2({
@@ -3487,8 +3519,8 @@ function registerEntityCrudCommands(program, config) {
3487
3519
  const defaultField = config.showField ?? (config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath));
3488
3520
  const mappedShowParams = Object.fromEntries(
3489
3521
  showParams.map((param) => {
3490
- const optionKey = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3491
- return [param, opts[optionKey]];
3522
+ const optionKey2 = param.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
3523
+ return [param, opts[optionKey2]];
3492
3524
  })
3493
3525
  );
3494
3526
  const defaultVariables = normalizeGraphqlVariables2({
@@ -5787,12 +5819,41 @@ function registerFoundationCommands(program) {
5787
5819
  import { z as z13 } from "zod";
5788
5820
  var idSchema12 = z13.string().min(1);
5789
5821
  var jsonObjectSchema = z13.record(z13.string(), z13.unknown());
5790
- function buildChildListSelectionSet(parentField, extraFields = []) {
5822
+ var NOTE_DETAIL_FIELDS = [
5823
+ "notes",
5824
+ "hasNotes",
5825
+ "hasUnreadNotes",
5826
+ "notesUpdatedAt",
5827
+ "notesLastReadAt",
5828
+ "estimateIds"
5829
+ ];
5830
+ var PARENT_KIND_LABELS = {
5831
+ task: "task",
5832
+ rock: "rock",
5833
+ listItem: "list item",
5834
+ todo: "todo",
5835
+ issue: "issue",
5836
+ meeting: "meeting"
5837
+ };
5838
+ function requiredParentSearchOption(parentFlag, parentKind) {
5839
+ return [
5840
+ {
5841
+ flag: parentFlag,
5842
+ variable: parentFlag.replace(/-/g, "_"),
5843
+ variableType: "ID!",
5844
+ description: `Parent ${PARENT_KIND_LABELS[parentKind]} ID`
5845
+ }
5846
+ ];
5847
+ }
5848
+ function buildChildResourceSelectionSet(parentField, extraFields = []) {
5791
5849
  const fields = Array.from(
5792
5850
  /* @__PURE__ */ new Set(["id", "type", "name", "status", "priority", "rank", "dueDate", "memberId", parentField, ...extraFields])
5793
5851
  );
5794
5852
  const attributeFields = fields.filter((field) => field !== "type");
5795
- return `{ data { ${fields.join(" ")} attributes { ${attributeFields.join(" ")} } } count currentPage totalPages }`;
5853
+ return `{ ${fields.join(" ")} attributes { ${attributeFields.join(" ")} } }`;
5854
+ }
5855
+ function buildChildListSelectionSet(parentField, extraFields = []) {
5856
+ return `{ data ${buildChildResourceSelectionSet(parentField, extraFields)} count currentPage totalPages }`;
5796
5857
  }
5797
5858
  function parseJsonObject2(raw) {
5798
5859
  try {
@@ -5936,7 +5997,31 @@ function registerChildCommands(program, config) {
5936
5997
  )
5937
5998
  });
5938
5999
  });
5939
- registerGraphqlSearchCommand(command, {
6000
+ if (config.showField) {
6001
+ const showField = config.showField;
6002
+ command.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
6003
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
6004
+ const organizationId = resolveOrganizationId(context.organizationId);
6005
+ const id = idSchema12.parse(opts.id);
6006
+ await runGraphqlQueryCommand({
6007
+ command: `${config.command}.show`,
6008
+ ...config.showOperationName ? { operationName: config.showOperationName } : {},
6009
+ runtimeOptions: context.runtimeOptions,
6010
+ field: showField,
6011
+ variables: {
6012
+ organization_id: organizationId,
6013
+ id
6014
+ },
6015
+ variableTypes: {
6016
+ organization_id: "ID!",
6017
+ id: "ID!"
6018
+ },
6019
+ ...config.showSelectionSet ? { selectionSet: config.showSelectionSet } : {},
6020
+ isShow: true
6021
+ });
6022
+ });
6023
+ }
6024
+ const searchConfig = {
5940
6025
  command: config.command,
5941
6026
  operationName: `${config.listOperationName.replace(/List$/, "")}Search`,
5942
6027
  field: config.listField,
@@ -5946,8 +6031,10 @@ function registerChildCommands(program, config) {
5946
6031
  config.parentKind,
5947
6032
  void 0,
5948
6033
  config.listParentTypedField
5949
- )
5950
- });
6034
+ ),
6035
+ ...config.searchRequiredOptions ? { requiredOptions: config.searchRequiredOptions } : {}
6036
+ };
6037
+ registerGraphqlSearchCommand(command, searchConfig);
5951
6038
  command.command("create").requiredOption("--data-json <dataJson>").action(async (opts, cmd) => {
5952
6039
  const context = await resolveCommandContext(cmd.optsWithGlobals());
5953
6040
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -6018,6 +6105,10 @@ function registerChildEntityCommands(program) {
6018
6105
  destroyOperationName: "SubtasksDestroy",
6019
6106
  listSelectionSet: buildChildListSelectionSet("taskId"),
6020
6107
  listParentTypedField: "taskId",
6108
+ searchRequiredOptions: requiredParentSearchOption("task-id", "task"),
6109
+ showField: "subtask",
6110
+ showOperationName: "SubtasksShow",
6111
+ showSelectionSet: buildChildResourceSelectionSet("taskId", NOTE_DETAIL_FIELDS),
6021
6112
  normalizeCreateBody: normalizeSubtaskCreateBody
6022
6113
  });
6023
6114
  registerChildCommands(program, {
@@ -6035,7 +6126,12 @@ function registerChildEntityCommands(program) {
6035
6126
  createOperationName: "MilestonesCreate",
6036
6127
  updateOperationName: "MilestonesUpdate",
6037
6128
  destroyOperationName: "MilestonesDestroy",
6038
- listSelectionSet: buildChildListSelectionSet("rockId")
6129
+ listSelectionSet: buildChildListSelectionSet("rockId"),
6130
+ listParentTypedField: "rockId",
6131
+ searchRequiredOptions: requiredParentSearchOption("rock-id", "rock"),
6132
+ showField: "milestone",
6133
+ showOperationName: "MilestonesShow",
6134
+ showSelectionSet: buildChildResourceSelectionSet("rockId", NOTE_DETAIL_FIELDS)
6039
6135
  });
6040
6136
  registerChildCommands(program, {
6041
6137
  command: "subitems",
@@ -6053,7 +6149,11 @@ function registerChildEntityCommands(program) {
6053
6149
  updateOperationName: "SubitemsUpdate",
6054
6150
  destroyOperationName: "SubitemsDestroy",
6055
6151
  listSelectionSet: buildChildListSelectionSet("listItemId"),
6056
- listParentTypedField: "listItemId"
6152
+ listParentTypedField: "listItemId",
6153
+ searchRequiredOptions: requiredParentSearchOption("list-item-id", "listItem"),
6154
+ showField: "subitem",
6155
+ showOperationName: "SubitemsShow",
6156
+ showSelectionSet: buildChildResourceSelectionSet("listItemId", NOTE_DETAIL_FIELDS)
6057
6157
  });
6058
6158
  registerChildCommands(program, {
6059
6159
  command: "subtodos",
@@ -6071,7 +6171,11 @@ function registerChildEntityCommands(program) {
6071
6171
  updateOperationName: "SubtodosUpdate",
6072
6172
  destroyOperationName: "SubtodosDestroy",
6073
6173
  listSelectionSet: buildChildListSelectionSet("todoId"),
6074
- listParentTypedField: "todoId"
6174
+ listParentTypedField: "todoId",
6175
+ searchRequiredOptions: requiredParentSearchOption("todo-id", "todo"),
6176
+ showField: "sub_todo",
6177
+ showOperationName: "SubtodosShow",
6178
+ showSelectionSet: buildChildResourceSelectionSet("todoId", NOTE_DETAIL_FIELDS)
6075
6179
  });
6076
6180
  registerChildCommands(program, {
6077
6181
  command: "subissues",
@@ -6089,7 +6193,11 @@ function registerChildEntityCommands(program) {
6089
6193
  updateOperationName: "SubissuesUpdate",
6090
6194
  destroyOperationName: "SubissuesDestroy",
6091
6195
  listSelectionSet: buildChildListSelectionSet("issueId"),
6092
- listParentTypedField: "issueId"
6196
+ listParentTypedField: "issueId",
6197
+ searchRequiredOptions: requiredParentSearchOption("issue-id", "issue"),
6198
+ showField: "sub_issue",
6199
+ showOperationName: "SubissuesShow",
6200
+ showSelectionSet: buildChildResourceSelectionSet("issueId", NOTE_DETAIL_FIELDS)
6093
6201
  });
6094
6202
  registerChildCommands(program, {
6095
6203
  command: "talking-points",
@@ -10165,6 +10273,9 @@ function asRecord5(value) {
10165
10273
  function asString(value) {
10166
10274
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
10167
10275
  }
10276
+ function resolveLoginApiBaseUrl(globals) {
10277
+ return asString(globals.baseUrl) ?? DEFAULT_PRODUCTION_API_BASE_URL;
10278
+ }
10168
10279
  function localUiBaseUrlFor(baseUrl) {
10169
10280
  const parsed = new URL(baseUrl);
10170
10281
  if ((parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") && parsed.port === "3009") {
@@ -10227,9 +10338,10 @@ async function authStatusRequest(params) {
10227
10338
  }
10228
10339
  async function runTokenLogin(cmd, opts) {
10229
10340
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10230
- const baseUrl = context.runtimeOptions.baseUrl;
10231
10341
  const globals = cmd.optsWithGlobals();
10232
- 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;
10342
+ const explicitBaseUrl = asString(globals.baseUrl);
10343
+ const baseUrl = resolveLoginApiBaseUrl(globals);
10344
+ const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : explicitBaseUrl ? context.runtimeOptions.token : void 0;
10233
10345
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, 1e4);
10234
10346
  if (!baseUrl) {
10235
10347
  return printEnvelopeAndExit({
@@ -10294,7 +10406,7 @@ async function runTokenLogin(cmd, opts) {
10294
10406
  }
10295
10407
  async function runBrowserLogin(cmd, opts) {
10296
10408
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10297
- const baseUrl = context.runtimeOptions.baseUrl;
10409
+ const baseUrl = resolveLoginApiBaseUrl(cmd.optsWithGlobals());
10298
10410
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, DEFAULT_LOGIN_TIMEOUT_MS);
10299
10411
  const pollIntervalMs = positiveInt2(opts.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
10300
10412
  if (!baseUrl) {
@@ -15232,7 +15344,7 @@ function registerAtlasAuthoringCommands(program) {
15232
15344
  });
15233
15345
  });
15234
15346
  const automations = program.command("automations").description("Bounded Automation authoring operations");
15235
- 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("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15347
+ automations.command("create").description("Create a Backlog 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("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15236
15348
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15237
15349
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15238
15350
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15255,7 +15367,6 @@ function registerAtlasAuthoringCommands(program) {
15255
15367
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15256
15368
  ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15257
15369
  ...opts.agentId !== void 0 ? { agentId: idSchema14.parse(opts.agentId) } : {},
15258
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15259
15370
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15260
15371
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
15261
15372
  },
@@ -15279,10 +15390,10 @@ function registerAtlasAuthoringCommands(program) {
15279
15390
  isShow: true
15280
15391
  });
15281
15392
  });
15282
- automations.command("update").description("Update one task-backed Automation through the API-owned updateTask contract").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15393
+ automations.command("update").description("Update one task-backed Automation without changing its system-managed status").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15283
15394
  "--expected-update-version <version>",
15284
15395
  "Exact opaque updateVersion value from automations show; rejects stale writes"
15285
- ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15396
+ ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15286
15397
  "--agent-id <agentId>",
15287
15398
  "Executor Agent id; requires --ai-task-config and is stored in that config"
15288
15399
  ).action(async (opts, cmd) => {
@@ -15302,7 +15413,6 @@ function registerAtlasAuthoringCommands(program) {
15302
15413
  ...opts.summary !== void 0 ? { summary: String(opts.summary) } : {},
15303
15414
  ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15304
15415
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15305
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15306
15416
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15307
15417
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {},
15308
15418
  ...aiTaskConfig !== void 0 ? { ai_task_config: aiTaskConfig } : {}
@@ -15421,7 +15531,7 @@ import { join as join3 } from "path";
15421
15531
  import { createHash } from "crypto";
15422
15532
 
15423
15533
  // src/version.ts
15424
- var CLI_VERSION = "0.1.72";
15534
+ var CLI_VERSION = "0.1.74";
15425
15535
 
15426
15536
  // src/operationMetadata.ts
15427
15537
  var DISCOVERY_OPERATION_IDS = [
@@ -15617,6 +15727,7 @@ var READ_OPERATION_IDS = [
15617
15727
  "members.show",
15618
15728
  "milestones.list",
15619
15729
  "milestones.search",
15730
+ "milestones.show",
15620
15731
  "news.list",
15621
15732
  "news.search",
15622
15733
  "news.show",
@@ -15687,12 +15798,16 @@ var READ_OPERATION_IDS = [
15687
15798
  "stand-ups.show",
15688
15799
  "subissues.list",
15689
15800
  "subissues.search",
15801
+ "subissues.show",
15690
15802
  "subitems.list",
15691
15803
  "subitems.search",
15804
+ "subitems.show",
15692
15805
  "subtasks.list",
15693
15806
  "subtasks.search",
15807
+ "subtasks.show",
15694
15808
  "subtodos.list",
15695
15809
  "subtodos.search",
15810
+ "subtodos.show",
15696
15811
  "support.counts",
15697
15812
  "support.inbox",
15698
15813
  "support.knowledge-articles",
@@ -16253,9 +16368,10 @@ var NAMESPACE_DOCS = {
16253
16368
  mutates: true,
16254
16369
  safety: [
16255
16370
  "Create calls only createAutomation with an explicit idempotency key.",
16371
+ "Create always leaves status to the API, which starts Automations in Backlog.",
16256
16372
  "Only the API-defined ai_task_config field accepts validated JSON.",
16257
16373
  "Optional executor Agent linkage is sent only through the API-defined top-level agentId input.",
16258
- "Update calls only updateTask with an exact opaque updateVersion token; it cannot change task type, ownership, or project linkage.",
16374
+ "Update calls only updateTask with an exact opaque updateVersion token; it cannot change status, task type, ownership, or project linkage.",
16259
16375
  "Does not create a project Task, run an Automation, or invoke AI OS actions.",
16260
16376
  "Show uses the API-owned automation query by id; no slug fallback is implemented."
16261
16377
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wave-ai-os/wave-cli",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"