@somewhere-cloud/cli 0.38.144 → 0.38.145

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.145
4
+
5
+ - `somewhere tasks waiting` lists what is waiting for you across your projects: what agents have asked you to do, with the steps, the reason, who asked and when. `--project` reads one project; `--cursor` continues. It also lists what was answered and by which credential.
6
+ - `somewhere tasks answer <task-id> --done` (or `--cannot`, or `--not-needed`), with `--note`, answers one.
7
+ - `somewhere tasks create --supersedes <task-id>` replaces an earlier ask in one command; `tasks update --superseded-by <task-id>` marks one replaced. A replaced ask leaves the waiting list at once.
8
+ - `somewhere tasks create` and `tasks update` take `--waiting-on` and `--author`, and `tasks create` takes `--status-note`, so an agent can ask the person for something in one command.
9
+ - Matches platform consumer contract 39, so deploys no longer warn that the CLI contract differs from the platform.
10
+
3
11
  ## 0.38.144
4
12
 
5
13
  - Matches platform consumer contract 36, so deploys no longer warn that the CLI contract differs from the platform.
@@ -132186,11 +132186,60 @@ async function runTaskTool(name, args, json, printer) {
132186
132186
  process.exitCode = 1;
132187
132187
  }
132188
132188
  }
132189
+ function printWaiting(value) {
132190
+ const data2 = unwrapPlatformData(value);
132191
+ const items = isRecord(data2) && Array.isArray(data2.items) ? data2.items.filter(isRecord) : null;
132192
+ if (!items) {
132193
+ printJson(value);
132194
+ return;
132195
+ }
132196
+ if (items.length === 0)
132197
+ console.log("Nothing is waiting for you" + (isRecord(data2) && data2.next_cursor ? " on the apps checked so far." : "."));
132198
+ for (const item of items) {
132199
+ const asked = isRecord(item.asked_by) ? item.asked_by : {};
132200
+ const via = isRecord(asked.via) ? asked.via : {};
132201
+ const who = [typeof asked.name === "string" ? asked.name : null, typeof via.name === "string" ? via.name : typeof via.kind === "string" ? via.kind : null].filter(Boolean).join(" via ");
132202
+ const when = typeof item.asked_at === "string" ? timeAgo(item.asked_at) : null;
132203
+ console.log(`${teal(String(item.id))} ${String(item.title ?? "")}`);
132204
+ console.log(dim(` ${[who || null, when, typeof item.project_name === "string" ? item.project_name : null, item.kind === "product_decision" ? "a decision" : null].filter(Boolean).join(" \xB7 ")}`));
132205
+ const steps = Array.isArray(item.step_list) ? item.step_list.filter((step2) => typeof step2 === "string") : [];
132206
+ const lines = Array.isArray(item.sentences) ? item.sentences.filter((line) => typeof line === "string") : [];
132207
+ for (const line of lines)
132208
+ console.log(` ${line}`);
132209
+ steps.forEach((step2, at2) => console.log(` ${at2 + 1}. ${step2}`));
132210
+ if (steps.length === 0 && lines.length === 0 && typeof item.steps === "string")
132211
+ console.log(` ${item.steps.split("\n").join("\n ")}`);
132212
+ if (typeof item.replaces === "string" && item.replaces)
132213
+ console.log(dim(` Replaces an earlier request: ${item.replaces}`));
132214
+ if (typeof item.why === "string" && item.why)
132215
+ console.log(dim(` Why: ${item.why}`));
132216
+ console.log(dim(` Answer: ${cliInvocation()} tasks answer ${String(item.id)} -p ${String(item.project_id)} --done (or --cannot, or --not-needed, with --note "...")`));
132217
+ console.log("");
132218
+ }
132219
+ const answered = isRecord(data2) && Array.isArray(data2.answered) ? data2.answered.filter(isRecord) : [];
132220
+ if (answered.length > 0)
132221
+ console.log(dim("Answered:"));
132222
+ for (const item of answered) {
132223
+ const by = isRecord(item.answered_by) ? item.answered_by : {};
132224
+ const via = isRecord(by.via) ? by.via : {};
132225
+ const kind = typeof via.kind === "string" ? via.kind : "unknown";
132226
+ const who = kind === "dashboard" ? by.you === true ? "you, in the dashboard" : "someone on the team, in the dashboard" : `${{ connector: "connector", agent: "connected agent", terminal: "terminal", key: "API key", app: "the app" }[kind] ?? kind}${typeof via.name === "string" ? ` ${via.name}` : ""}`;
132227
+ const when = typeof by.at === "string" ? timeAgo(by.at) : null;
132228
+ console.log(`${teal(String(item.id))} ${String(item.title ?? "")}`);
132229
+ console.log(dim(` ${by.answer === "cannot" ? `Marked "can't do this"` : by.answer === "not_needed" ? "Marked as no longer needed" : "Marked done"} by ${who}${when ? ` \xB7 ${when}` : ""}${typeof item.project_name === "string" ? ` \xB7 ${item.project_name}` : ""}`));
132230
+ if (typeof item.note === "string" && item.note)
132231
+ console.log(` ${item.note}`);
132232
+ }
132233
+ if (isRecord(data2) && typeof data2.next_cursor === "string") {
132234
+ const checked = typeof data2.projects_checked === "number" && typeof data2.projects_total === "number" ? `Checked ${data2.projects_checked} of ${data2.projects_total} apps. ` : "";
132235
+ console.log(dim(`${checked}Show the rest: ${cliInvocation()} tasks waiting --cursor ${data2.next_cursor}`));
132236
+ }
132237
+ }
132189
132238
  function resolveTaskProject(project) {
132190
132239
  return resolveProjectRef(project, " Use -p default for the shared organization board if you have access.");
132191
132240
  }
132192
132241
  function registerTasks(program2) {
132193
- const tasks = program2.command("tasks").description("List, read, create, update, delete, and restore platform tasks").addHelpText("after", `
132242
+ const tasks = program2.command("tasks").description("List, read, create, update, answer, delete, and restore platform tasks").addHelpText("after", `
132194
132243
  Shared organization board (requires access): ${cliInvocation()} tasks list -p default`);
132195
132244
  tasks.command("list").description("List tasks").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("--status <status>", "Filter by status").option("--type <type>", "Filter by type, or a comma-separated list (e.g. decision, directive)").option("--assignee <assignee>", "Filter by assignee").option("--label <label>", "Match an exact label").option("--area <area>", "Filter by area").option("--parent <task-id>", 'Filter by parent task; use "null" for top-level tasks').option("-q, --query <text>", "Search task titles and descriptions").option("--active", "Only open and in-progress tasks").option("--stale", "Only stale in-progress tasks").option("--stale-days <days>", "Staleness threshold").option("--sort <sort>", "Sort by priority, updated, or created").option("--full", "Return complete descriptions").option("--limit <n>", "Maximum rows").option("--offset <n>", "Fresh row offset; prefer cursor for continuation").option("--cursor <cursor>", "next_cursor from the previous page; repeat filters").option("--json", "Print the complete response as JSON").action(async (opts) => {
132196
132245
  const args = compactRecord([
@@ -132246,7 +132295,29 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
132246
132295
  ["limit", numberOption(opts.limit)]
132247
132296
  ]), opts.json, (value) => printJson(unwrapPlatformData(value)));
132248
132297
  });
132249
- tasks.command("create <title>").description("Create a task without opening an editor").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("-d, --description <text>", "Long-form task description").option("--status <status>", "Initial status").option("--priority <priority>", "low, normal, high, or urgent").option("--type <type>", "Task type").option("--assignee <assignee>", "Assignee").option("--labels <labels>", "Comma-separated labels").option("--area <area>", "Subsystem area").option("--parent <task-id>", "Parent task ID").option("--due-at <unix-ms>", "Due time as a Unix timestamp in milliseconds").option("--json", "Print the complete response as JSON").action(async (title, opts) => {
132298
+ tasks.command("waiting").description("List what is waiting for you: what agents have asked you to do, across your projects, with the steps").option("-p, --project <project>", "Only this project (slug or ID), read at once").option("--cursor <cursor>", "next_cursor from the previous answer: the next 25 projects").option("--json", "Print the complete response as JSON").action(async (opts) => {
132299
+ const args = compactRecord([
132300
+ ["waiting", "me"],
132301
+ ["project_id", opts.project ? resolveTaskProject(opts.project) : void 0],
132302
+ ["cursor", opts.cursor]
132303
+ ]);
132304
+ await runTaskTool("tasks_list", args, opts.json, printWaiting);
132305
+ });
132306
+ tasks.command("answer <task-id>").description("Answer something that is waiting for you: --done when you did it, --cannot when you can't or won't, --not-needed when it is no longer needed").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("--done", "You did it").option("--cannot", "You can't or won't do it").option("--not-needed", "It is no longer needed").option("--note <text>", "A short note for the agent that asked; never a password or a key").option("--json", "Print the complete response as JSON").action(async (taskId, opts) => {
132307
+ if ([opts.done, opts.cannot, opts.notNeeded].filter(Boolean).length !== 1) {
132308
+ error("Say which one: --done, --cannot or --not-needed.");
132309
+ process.exitCode = 1;
132310
+ return;
132311
+ }
132312
+ const args = compactRecord([
132313
+ ["project_id", resolveTaskProject(opts.project)],
132314
+ ["task_id", taskId],
132315
+ ["answer", opts.done ? "done" : opts.cannot ? "cannot" : "not_needed"],
132316
+ ["note", opts.note]
132317
+ ]);
132318
+ await runTaskTool("tasks_update", args, opts.json, printTaskMutation);
132319
+ });
132320
+ tasks.command("create <title>").description("Create a task without opening an editor").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("-d, --description <text>", "Long-form task description").option("--status <status>", "Initial status").option("--priority <priority>", "low, normal, high, or urgent").option("--type <type>", "Task type").option("--assignee <assignee>", "Assignee").option("--labels <labels>", "Comma-separated labels").option("--area <area>", "Subsystem area").option("--parent <task-id>", "Parent task ID").option("--due-at <unix-ms>", "Due time as a Unix timestamp in milliseconds").option("--waiting-on <who>", 'human or product_decision asks the person (shown under "Waiting for you"); external records an outside wait').option("--status-note <text>", "Current state; with --waiting-on human, the numbered steps for the person, one per line").option("--author <name>", "The asking agent's own name, shown to the person as who asked").option("--supersedes <task-id>", "An earlier task this one replaces; the earlier one leaves the person's waiting list at once").option("--json", "Print the complete response as JSON").action(async (title, opts) => {
132250
132321
  const args = compactRecord([
132251
132322
  ["project_id", resolveTaskProject(opts.project)],
132252
132323
  ["title", title],
@@ -132258,11 +132329,15 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
132258
132329
  ["labels", parseCommaList(opts.labels)],
132259
132330
  ["area", opts.area],
132260
132331
  ["parent_id", opts.parent],
132261
- ["due_at", numberOption(opts.dueAt)]
132332
+ ["due_at", numberOption(opts.dueAt)],
132333
+ ["waiting_on", opts.waitingOn],
132334
+ ["status_note", opts.statusNote],
132335
+ ["author", opts.author],
132336
+ ["supersedes", opts.supersedes]
132262
132337
  ]);
132263
132338
  await runTaskTool("tasks_create", args, opts.json, printTaskMutation);
132264
132339
  });
132265
- tasks.command("update <task-id>").description("Update task fields or add a comment").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("--title <title>", "New title").option("-d, --description <text>", "New description").option("--status <status>", "New status").option("--priority <priority>", "New priority").option("--type <type>", "New type").option("--assignee <assignee>", "New assignee").option("--labels <labels>", "Replacement comma-separated labels").option("--area <area>", "New area; pass an empty string to clear").option("--parent <task-id>", "New parent; pass an empty string to detach").option("--due-at <unix-ms>", "Due time as a Unix timestamp in milliseconds").option("--status-note <text>", "Overwrite the current status note").option("--health <health>", "on_track, at_risk, or off_track").option("--comment <text>", "Append an evidence comment").option("--resolution-note <text>", "Resolution note when closing the task").option("--shipped-in <version>", "Release/version tag this task shipped in").option("--deployment-project <project>", "Project owning --deployment-version").option("--deployment-version <version>", "Verified production version to link").option("--json", "Print the complete response as JSON").action(async (taskId, opts) => {
132340
+ tasks.command("update <task-id>").description("Update task fields or add a comment").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("--title <title>", "New title").option("-d, --description <text>", "New description").option("--status <status>", "New status").option("--priority <priority>", "New priority").option("--type <type>", "New type").option("--assignee <assignee>", "New assignee").option("--labels <labels>", "Replacement comma-separated labels").option("--area <area>", "New area; pass an empty string to clear").option("--parent <task-id>", "New parent; pass an empty string to detach").option("--due-at <unix-ms>", "Due time as a Unix timestamp in milliseconds").option("--status-note <text>", "Overwrite the current status note").option("--waiting-on <who>", "human or product_decision asks the person; external records an outside wait; an empty string clears it (withdraws an ask)").option("--superseded-by <task-id>", "The task that replaces this one; a replaced ask leaves the person's waiting list at once").option("--author <name>", "The asking agent's own name, shown as who asked or who commented").option("--health <health>", "on_track, at_risk, or off_track").option("--comment <text>", "Append an evidence comment").option("--resolution-note <text>", "Resolution note when closing the task").option("--shipped-in <version>", "Release/version tag this task shipped in").option("--deployment-project <project>", "Project owning --deployment-version").option("--deployment-version <version>", "Verified production version to link").option("--json", "Print the complete response as JSON").action(async (taskId, opts) => {
132266
132341
  const args = compactRecord([
132267
132342
  ["project_id", resolveTaskProject(opts.project)],
132268
132343
  ["task_id", taskId],
@@ -132277,6 +132352,9 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
132277
132352
  ["parent_id", opts.parent],
132278
132353
  ["due_at", numberOption(opts.dueAt)],
132279
132354
  ["status_note", opts.statusNote],
132355
+ ["waiting_on", opts.waitingOn],
132356
+ ["superseded_by", opts.supersededBy],
132357
+ ["author", opts.author],
132280
132358
  ["health", opts.health],
132281
132359
  ["comment", opts.comment],
132282
132360
  ["resolution_note", opts.resolutionNote],
@@ -132285,7 +132363,7 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
132285
132363
  ["deployment_version", numberOption(opts.deploymentVersion)]
132286
132364
  ]);
132287
132365
  if (Object.keys(args).length === 2) {
132288
- error("No update supplied. Pass a field such as --status, --status-note, or --comment.");
132366
+ error("No update supplied. Pass a field such as --status, --status-note, --waiting-on, or --comment.");
132289
132367
  process.exitCode = 1;
132290
132368
  return;
132291
132369
  }
@@ -132357,6 +132435,7 @@ var init_tasks = __esm({
132357
132435
  __name(taskRows, "taskRows");
132358
132436
  __name(printTaskMutation, "printTaskMutation");
132359
132437
  __name(runTaskTool, "runTaskTool");
132438
+ __name(printWaiting, "printWaiting");
132360
132439
  __name(resolveTaskProject, "resolveTaskProject");
132361
132440
  __name(registerTasks, "registerTasks");
132362
132441
  }