@pxlabz/tasq-cli 0.1.11 → 0.1.13

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/.tasq-skill.md CHANGED
@@ -71,6 +71,11 @@ tasq release diff <releaseId>
71
71
  tasq release export <releaseId> [--out <file>]
72
72
  tasq release narrate <releaseId> (--body <markdown> | --file <path>)
73
73
 
74
+ tasq update list <project>
75
+ tasq update draft <project> --health <on_track|at_risk|off_track> (--body <markdown> | --file <path>)
76
+ tasq update send <updateId>
77
+ tasq update delete <updateId>
78
+
74
79
  tasq auth login [--email <email>]
75
80
  tasq auth logout
76
81
  tasq auth whoami
@@ -154,6 +159,12 @@ Three things to know before you write:
154
159
 
155
160
  `tasq release list --team ENG` is the timeline, newest first; `tasq release view <releaseId>` shows one in full; `tasq release export <releaseId>` prints it as Markdown for a changelog. `examples/release-narrator.sh` in this package is a working reference for the loop above, minus the writing.
156
161
 
162
+ ## Project updates
163
+
164
+ A project update is a health call (`on_track`, `at_risk` or `off_track`) and a Markdown body for the project's client. `<project>` is a project id or its exact name, ignoring case.
165
+
166
+ You draft; a person sends. `tasq update draft` always writes a draft, and nothing an agent drafts goes to a client until a person reviews and sends it. `tasq update send` is refused for an agent key before any request (exit 4), and no policy can grant it. Drafts can be edited or deleted by their author; a sent update is final. `tasq update list` shows drafts and sent updates, newest first, and the project's health is its latest sent update.
167
+
157
168
  ## Exit codes
158
169
 
159
170
  | Code | Meaning |
@@ -162,7 +173,7 @@ Three things to know before you write:
162
173
  | 1 | Error; details on stderr |
163
174
  | 2 | Usage error — a bad flag, or a `--mention` name matching no agent or more than one |
164
175
  | 3 | Rate limited; the message says when to retry. `events listen` never exits here — it waits and continues |
165
- | 4 | Your policy denied the action. Do not retry it; say what was refused |
176
+ | 4 | Your policy denied the action, or it is one only a person may run (`update send`). Do not retry it; say what was refused |
166
177
 
167
178
  ## Working with other agents
168
179
 
package/README.md CHANGED
@@ -30,7 +30,9 @@ tasq task list | view <ref> | create | update <ref>
30
30
  tasq comment add <ref> <body> [--reply-to <commentRef>] [--mention <agentName>]…
31
31
  tasq events listen [--wait <seconds>] [--once]
32
32
  tasq events ack <id>…
33
- tasq project list
33
+ tasq project list | star <project> | unstar <project>
34
+ tasq initiative list | create <name> | rename <initiative> <name> | archive <initiative>
35
+ tasq initiative link <initiative> <project> | unlink <initiative> <project>
34
36
  tasq cycle current
35
37
  tasq auth login | logout
36
38
  ```
package/dist/tasq.js CHANGED
@@ -6625,7 +6625,18 @@ var TasqClient = class _TasqClient {
6625
6625
  )).tasks,
6626
6626
  get: async (slug, taskId) => (await this.#get(
6627
6627
  `/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}`
6628
- )).task
6628
+ )).task,
6629
+ /**
6630
+ * Ask a person to sign off on a task (6.3). Asking again while a
6631
+ * request stands replaces the approver. The approver cannot be an agent.
6632
+ */
6633
+ requestApproval: (slug, taskId, approverId) => this.dispatch("task.requestApproval", slug, { taskId, approverId }),
6634
+ /**
6635
+ * The approver's answer (6.3). `approve` also moves the task to the next
6636
+ * status in its team's category order. Person credentials only: no
6637
+ * agent policy can include it.
6638
+ */
6639
+ decide: (slug, taskId, decision) => this.dispatch("task.decide", slug, { taskId, decision })
6629
6640
  };
6630
6641
  projects = {
6631
6642
  list: async (slug) => (await this.#get(
@@ -6633,7 +6644,46 @@ var TasqClient = class _TasqClient {
6633
6644
  )).projects,
6634
6645
  get: async (slug, projectId) => (await this.#get(
6635
6646
  `/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}`
6636
- )).project
6647
+ )).project,
6648
+ /**
6649
+ * Pin a project to the caller's own sidebar. People only: an agent
6650
+ * key is refused by policy whatever its preset.
6651
+ */
6652
+ star: (slug, input) => this.dispatch("project.star", slug, input),
6653
+ unstar: (slug, input) => this.dispatch("project.unstar", slug, input)
6654
+ };
6655
+ /**
6656
+ * Initiatives group projects across teams. Any member reads them; every
6657
+ * write is admin-level, so an agent key (always a member) cannot make one.
6658
+ */
6659
+ initiatives = {
6660
+ list: async (slug) => (await this.#get(
6661
+ `/workspaces/${encodeURIComponent(slug)}/initiatives`
6662
+ )).initiatives,
6663
+ create: (slug, input) => this.dispatch("initiative.create", slug, input),
6664
+ update: (slug, input) => this.dispatch("initiative.update", slug, input),
6665
+ delete: (slug, input) => this.dispatch("initiative.delete", slug, input),
6666
+ linkProject: (slug, input) => this.dispatch("initiative.linkProject", slug, input),
6667
+ unlinkProject: (slug, input) => this.dispatch("initiative.unlinkProject", slug, input)
6668
+ };
6669
+ /**
6670
+ * Project updates: a health call and a body for the project's client (7.5).
6671
+ *
6672
+ * `draft` is what an agent calls; an agent's update is always a draft
6673
+ * whatever it passes. `send` is people only: no agent policy can grant it,
6674
+ * because nothing an agent drafts goes to a client without a person
6675
+ * approving it.
6676
+ */
6677
+ projectUpdates = {
6678
+ /** Every update on the project, drafts included, newest first. */
6679
+ list: async (slug, projectId) => (await this.#get(
6680
+ `/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/updates`
6681
+ )).updates,
6682
+ draft: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
6683
+ create: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
6684
+ update: (slug, input) => this.dispatch("projectUpdate.update", slug, input),
6685
+ send: (slug, input) => this.dispatch("projectUpdate.send", slug, input),
6686
+ delete: (slug, input) => this.dispatch("projectUpdate.delete", slug, input)
6637
6687
  };
6638
6688
  threads = {
6639
6689
  /**
@@ -6780,6 +6830,11 @@ var TasqClient = class _TasqClient {
6780
6830
  };
6781
6831
 
6782
6832
  // ../sdk/src/types.ts
6833
+ var PROJECT_HEALTH_VALUES = [
6834
+ "on_track",
6835
+ "at_risk",
6836
+ "off_track"
6837
+ ];
6783
6838
  var MAX_AGENT_WAKES_PER_MESSAGE = 10;
6784
6839
  var MAX_CONSECUTIVE_AGENT_MESSAGES = 5;
6785
6840
  var RELEASE_NARRATIVE_MAX = 5e4;
@@ -6796,6 +6851,12 @@ var UsageError = class extends Error {
6796
6851
  this.name = "UsageError";
6797
6852
  }
6798
6853
  };
6854
+ var PersonOnlyError = class extends Error {
6855
+ constructor(message) {
6856
+ super(message);
6857
+ this.name = "PersonOnlyError";
6858
+ }
6859
+ };
6799
6860
  var STEP_CONTEXT = /* @__PURE__ */ Symbol.for("tasq.stepContext");
6800
6861
  function attachStepContext(error, context) {
6801
6862
  error[STEP_CONTEXT] = context;
@@ -6817,6 +6878,10 @@ function reportError(error, io2) {
6817
6878
  io2.err(error.message);
6818
6879
  return EXIT_USAGE;
6819
6880
  }
6881
+ if (error instanceof PersonOnlyError) {
6882
+ io2.err(error.message);
6883
+ return EXIT_POLICY_DENIED;
6884
+ }
6820
6885
  if (error instanceof TasqRateLimitError) {
6821
6886
  io2.err(`Rate limited. Retry after ${error.retryAfterSeconds}s.`);
6822
6887
  return EXIT_RATE_LIMITED;
@@ -6845,7 +6910,7 @@ function reportError(error, io2) {
6845
6910
  // package.json
6846
6911
  var package_default = {
6847
6912
  name: "@pxlabz/tasq-cli",
6848
- version: "0.1.11",
6913
+ version: "0.1.13",
6849
6914
  description: "Command-line client for Tasq, for humans and agents alike",
6850
6915
  keywords: [
6851
6916
  "tasq",
@@ -7026,6 +7091,30 @@ function formatProjects(projects) {
7026
7091
  ])
7027
7092
  );
7028
7093
  }
7094
+ function formatInitiatives(initiatives) {
7095
+ if (initiatives.length === 0) return "No initiatives.";
7096
+ return table(
7097
+ ["Name", "Status", "Projects"],
7098
+ initiatives.map((initiative) => [
7099
+ initiative.name,
7100
+ initiative.status,
7101
+ String(initiative.projectIds.length)
7102
+ ])
7103
+ );
7104
+ }
7105
+ function formatProjectUpdates(updates) {
7106
+ if (updates.length === 0) return "No updates.";
7107
+ return table(
7108
+ ["Id", "Health", "State", "Author", "Date"],
7109
+ updates.map((update) => [
7110
+ update.id,
7111
+ update.health,
7112
+ update.sentAt === null ? "Draft" : "Sent",
7113
+ dash(update.author?.name),
7114
+ (update.sentAt ?? update.createdAt).slice(0, 10)
7115
+ ])
7116
+ );
7117
+ }
7029
7118
  function formatCycles(cycles) {
7030
7119
  if (cycles.length === 0) return "No cycles.";
7031
7120
  return table(
@@ -7414,12 +7503,160 @@ async function eventsAck(ctx, ids) {
7414
7503
  line(ctx.io, { acked: page.acked });
7415
7504
  }
7416
7505
 
7506
+ // src/project-ref.ts
7507
+ var UUID_PATTERN3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7508
+ async function resolveProject(client, slug, ref) {
7509
+ const trimmed = ref.trim();
7510
+ const projects = await client.projects.list(slug);
7511
+ if (UUID_PATTERN3.test(trimmed)) {
7512
+ const found = projects.find((project2) => project2.id === trimmed);
7513
+ return { id: trimmed, name: found?.name ?? trimmed };
7514
+ }
7515
+ const wanted = trimmed.toLowerCase();
7516
+ const matched = projects.filter(
7517
+ (project2) => project2.name.toLowerCase() === wanted
7518
+ );
7519
+ if (matched.length === 0) {
7520
+ throw new UsageError(
7521
+ `No project named "${ref}" in this workspace. Run "tasq project list" to see the names.`
7522
+ );
7523
+ }
7524
+ if (matched.length > 1) {
7525
+ throw new UsageError(
7526
+ `"${ref}" matches ${matched.length} projects. Pass the project id.`
7527
+ );
7528
+ }
7529
+ const [project] = matched;
7530
+ return { id: project?.id ?? "", name: project?.name ?? "" };
7531
+ }
7532
+
7533
+ // src/commands/initiative.ts
7534
+ async function resolveInitiative(ctx, slug, ref) {
7535
+ const trimmed = ref.trim();
7536
+ const wanted = trimmed.toLowerCase();
7537
+ const initiatives = await ctx.client.initiatives.list(slug);
7538
+ const byId = initiatives.find((initiative) => initiative.id === trimmed);
7539
+ if (byId !== void 0) return byId;
7540
+ const matched = initiatives.filter(
7541
+ (initiative) => initiative.name.toLowerCase() === wanted
7542
+ );
7543
+ const [only] = matched;
7544
+ if (only === void 0) {
7545
+ throw new UsageError(
7546
+ `No initiative named "${ref}" in this workspace. Run "tasq initiative list" to see the names.`
7547
+ );
7548
+ }
7549
+ if (matched.length > 1) {
7550
+ throw new UsageError(
7551
+ `"${ref}" matches ${matched.length} initiatives. Pass the initiative id.`
7552
+ );
7553
+ }
7554
+ return only;
7555
+ }
7556
+ function requireName(name) {
7557
+ const trimmed = name.trim();
7558
+ if (trimmed === "") {
7559
+ throw new UsageError("The initiative name is empty.");
7560
+ }
7561
+ return trimmed;
7562
+ }
7563
+ async function initiativeList(ctx) {
7564
+ const slug = requireWorkspace(ctx.config);
7565
+ const initiatives = await ctx.client.initiatives.list(slug);
7566
+ ctx.io.out(
7567
+ ctx.config.json ? jsonOutput(initiatives) : formatInitiatives(initiatives)
7568
+ );
7569
+ }
7570
+ async function initiativeCreate(ctx, name) {
7571
+ const trimmed = requireName(name);
7572
+ const slug = requireWorkspace(ctx.config);
7573
+ const { result } = await ctx.client.initiatives.create(slug, {
7574
+ name: trimmed
7575
+ });
7576
+ ctx.io.out(
7577
+ ctx.config.json ? jsonOutput(result.initiative) : `Created initiative ${result.initiative.name}.`
7578
+ );
7579
+ }
7580
+ async function initiativeRename(ctx, ref, name) {
7581
+ const trimmed = requireName(name);
7582
+ const slug = requireWorkspace(ctx.config);
7583
+ const initiative = await resolveInitiative(ctx, slug, ref);
7584
+ const { result } = await ctx.client.initiatives.update(slug, {
7585
+ initiativeId: initiative.id,
7586
+ name: trimmed
7587
+ });
7588
+ ctx.io.out(
7589
+ ctx.config.json ? jsonOutput(result.initiative) : `Renamed initiative ${initiative.name} to ${result.initiative.name}.`
7590
+ );
7591
+ }
7592
+ async function initiativeArchive(ctx, ref) {
7593
+ const slug = requireWorkspace(ctx.config);
7594
+ const initiative = await resolveInitiative(ctx, slug, ref);
7595
+ const { result } = await ctx.client.initiatives.update(slug, {
7596
+ initiativeId: initiative.id,
7597
+ status: "archived"
7598
+ });
7599
+ ctx.io.out(
7600
+ ctx.config.json ? jsonOutput(result.initiative) : `Archived initiative ${initiative.name}.`
7601
+ );
7602
+ }
7603
+ async function initiativeLink(ctx, initiativeRef, projectRef) {
7604
+ const slug = requireWorkspace(ctx.config);
7605
+ const initiative = await resolveInitiative(ctx, slug, initiativeRef);
7606
+ const project = await resolveProject(ctx.client, slug, projectRef);
7607
+ const { result } = await ctx.client.initiatives.linkProject(slug, {
7608
+ initiativeId: initiative.id,
7609
+ projectId: project.id
7610
+ });
7611
+ if (ctx.config.json) {
7612
+ ctx.io.out(jsonOutput(result));
7613
+ return;
7614
+ }
7615
+ ctx.io.out(
7616
+ result.linked ? `Linked ${project.name} to initiative ${initiative.name}.` : `${project.name} was already in initiative ${initiative.name}.`
7617
+ );
7618
+ }
7619
+ async function initiativeUnlink(ctx, initiativeRef, projectRef) {
7620
+ const slug = requireWorkspace(ctx.config);
7621
+ const initiative = await resolveInitiative(ctx, slug, initiativeRef);
7622
+ const project = await resolveProject(ctx.client, slug, projectRef);
7623
+ const { result } = await ctx.client.initiatives.unlinkProject(slug, {
7624
+ initiativeId: initiative.id,
7625
+ projectId: project.id
7626
+ });
7627
+ if (ctx.config.json) {
7628
+ ctx.io.out(jsonOutput(result));
7629
+ return;
7630
+ }
7631
+ ctx.io.out(
7632
+ result.unlinked ? `Unlinked ${project.name} from initiative ${initiative.name}.` : `${project.name} was not in initiative ${initiative.name}.`
7633
+ );
7634
+ }
7635
+
7417
7636
  // src/commands/project.ts
7418
7637
  async function projectList(ctx) {
7419
7638
  const slug = requireWorkspace(ctx.config);
7420
7639
  const projects = await ctx.client.projects.list(slug);
7421
7640
  ctx.io.out(ctx.config.json ? jsonOutput(projects) : formatProjects(projects));
7422
7641
  }
7642
+ async function projectStar(ctx, ref) {
7643
+ const slug = requireWorkspace(ctx.config);
7644
+ const project = await resolveProject(ctx.client, slug, ref);
7645
+ const { result } = await ctx.client.projects.star(slug, {
7646
+ projectId: project.id
7647
+ });
7648
+ ctx.io.out(ctx.config.json ? jsonOutput(result) : `Starred ${project.name}.`);
7649
+ }
7650
+ async function projectUnstar(ctx, ref) {
7651
+ const slug = requireWorkspace(ctx.config);
7652
+ const project = await resolveProject(ctx.client, slug, ref);
7653
+ const { result } = await ctx.client.projects.unstar(slug, {
7654
+ projectId: project.id
7655
+ });
7656
+ ctx.io.out(
7657
+ ctx.config.json ? jsonOutput(result) : `Unstarred ${project.name}.`
7658
+ );
7659
+ }
7423
7660
 
7424
7661
  // src/commands/release.ts
7425
7662
  import { writeFileSync as writeFileSync2 } from "fs";
@@ -7766,6 +8003,9 @@ async function taskView(ctx, taskRef) {
7766
8003
  `Start: ${task.startDate ?? "\u2014"} Due: ${task.dueDate ?? "\u2014"}`
7767
8004
  );
7768
8005
  }
8006
+ if (task.approval) {
8007
+ ctx.io.out(`Approval: ${approvalLine(task.approval)}`);
8008
+ }
7769
8009
  if (task.parent) {
7770
8010
  ctx.io.out(`Parent: ${task.parent.identifier} ${task.parent.title}`);
7771
8011
  }
@@ -7946,6 +8186,147 @@ async function taskUpdate(ctx, taskRef, options) {
7946
8186
  ctx.config.json ? jsonOutput(updated) : `Updated ${updated.identifier}: ${updated.title}`
7947
8187
  );
7948
8188
  }
8189
+ var APPROVAL_STATE_WORDS = {
8190
+ requested: ["requested", "from"],
8191
+ approved: ["approved", "by"],
8192
+ changes_requested: ["changes requested", "by"],
8193
+ rejected: ["rejected", "by"]
8194
+ };
8195
+ function approvalLine(approval) {
8196
+ const [state, preposition] = APPROVAL_STATE_WORDS[approval.state];
8197
+ if (approval.approver === null) {
8198
+ return `${state} (the approver has left the workspace)`;
8199
+ }
8200
+ return `${state} ${preposition} ${approval.approver.name ?? approval.approver.memberId}`;
8201
+ }
8202
+ var UUID_PATTERN4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8203
+ function resolveApprover(members, ref) {
8204
+ const wanted = ref.trim().toLowerCase();
8205
+ const matched = members.filter(
8206
+ (member) => member.type === "user" && ((member.name ?? "").toLowerCase() === wanted || (member.email ?? "").toLowerCase() === wanted)
8207
+ );
8208
+ const [only] = matched;
8209
+ if (only === void 0) {
8210
+ throw new UsageError(
8211
+ `No person named "${ref}" in this workspace. Agents cannot approve. Run "tasq workspace members" to see the names.`
8212
+ );
8213
+ }
8214
+ if (matched.length > 1) {
8215
+ throw new UsageError(
8216
+ `"${ref}" matches ${matched.length} people. Pass their email or member id instead.`
8217
+ );
8218
+ }
8219
+ return only;
8220
+ }
8221
+ async function taskRequestApproval(ctx, taskRef, options) {
8222
+ const slug = requireWorkspace(ctx.config);
8223
+ if (options.approver === void 0 || options.approver.trim() === "") {
8224
+ throw new UsageError("--approver is required: a person's name, email or member id.");
8225
+ }
8226
+ const ref = options.approver.trim();
8227
+ const approver = UUID_PATTERN4.test(ref) ? { id: ref, name: null } : resolveApprover(await ctx.client.members.list(slug), ref);
8228
+ const taskId = await resolveTaskId(ctx.client, slug, taskRef);
8229
+ const response = await ctx.client.dispatch("task.requestApproval", slug, {
8230
+ taskId,
8231
+ approverId: approver.id
8232
+ });
8233
+ ctx.io.out(
8234
+ ctx.config.json ? jsonOutput(response.result) : `Requested approval on ${taskRef} from ${approver.name ?? approver.id}`
8235
+ );
8236
+ }
8237
+ var DECISION_SENTENCES = {
8238
+ approve: (task) => `Approved ${task}`,
8239
+ changes: (task) => `Requested changes on ${task}`,
8240
+ reject: (task) => `Rejected ${task}`
8241
+ };
8242
+ async function taskDecide(ctx, taskRef, decision) {
8243
+ const slug = requireWorkspace(ctx.config);
8244
+ const taskId = await resolveTaskId(ctx.client, slug, taskRef);
8245
+ const response = await ctx.client.dispatch("task.decide", slug, {
8246
+ taskId,
8247
+ decision
8248
+ });
8249
+ ctx.io.out(
8250
+ ctx.config.json ? jsonOutput(response.result) : DECISION_SENTENCES[decision](taskRef)
8251
+ );
8252
+ }
8253
+
8254
+ // src/commands/update.ts
8255
+ import { readFileSync as readFileSync3 } from "fs";
8256
+ function isHealth(value) {
8257
+ return PROJECT_HEALTH_VALUES.includes(value);
8258
+ }
8259
+ function requireHealth(value) {
8260
+ if (value === void 0 || !isHealth(value)) {
8261
+ throw new UsageError(`Pass --health ${PROJECT_HEALTH_VALUES.join(" | ")}.`);
8262
+ }
8263
+ return value;
8264
+ }
8265
+ function draftBody(options, deps) {
8266
+ if (options.body !== void 0 && options.file !== void 0) {
8267
+ throw new UsageError("Pass --body or --file, not both.");
8268
+ }
8269
+ if (options.body !== void 0) return options.body;
8270
+ if (options.file !== void 0) {
8271
+ const read = deps.readFile ?? ((path) => readFileSync3(path, "utf8"));
8272
+ return read(options.file);
8273
+ }
8274
+ throw new UsageError(
8275
+ "Pass the update with --body <markdown> or --file <path>."
8276
+ );
8277
+ }
8278
+ async function updateList(ctx, projectRef) {
8279
+ const slug = requireWorkspace(ctx.config);
8280
+ const projectId = await resolveProjectId(ctx, slug, projectRef);
8281
+ const updates = await ctx.client.projectUpdates.list(slug, projectId);
8282
+ ctx.io.out(
8283
+ ctx.config.json ? jsonOutput(updates) : formatProjectUpdates(updates)
8284
+ );
8285
+ }
8286
+ async function updateDraft(ctx, projectRef, options, deps = {}) {
8287
+ const slug = requireWorkspace(ctx.config);
8288
+ const health = requireHealth(options.health);
8289
+ const body = draftBody(options, deps);
8290
+ const projectId = await resolveProjectId(ctx, slug, projectRef);
8291
+ const { result } = await ctx.client.projectUpdates.draft(slug, {
8292
+ projectId,
8293
+ health,
8294
+ body
8295
+ });
8296
+ if (ctx.config.json) {
8297
+ ctx.io.out(jsonOutput(result.update));
8298
+ return;
8299
+ }
8300
+ ctx.io.out(
8301
+ `Drafted update ${result.update.id}. A person sends it with: tasq update send ${result.update.id}`
8302
+ );
8303
+ }
8304
+ async function updateSend(ctx, updateId) {
8305
+ const slug = requireWorkspace(ctx.config);
8306
+ const credential2 = ctx.config.credential;
8307
+ if (credential2 !== void 0 && "agentKey" in credential2) {
8308
+ throw new PersonOnlyError(
8309
+ "Only a person can send a project update. An agent drafts it; a person reviews and sends it."
8310
+ );
8311
+ }
8312
+ const { result } = await ctx.client.projectUpdates.send(slug, { updateId });
8313
+ if (ctx.config.json) {
8314
+ ctx.io.out(jsonOutput(result.update));
8315
+ return;
8316
+ }
8317
+ ctx.io.out(`Sent update ${result.update.id} (${result.update.health}).`);
8318
+ }
8319
+ async function updateDelete(ctx, updateId) {
8320
+ const slug = requireWorkspace(ctx.config);
8321
+ const { result } = await ctx.client.projectUpdates.delete(slug, {
8322
+ updateId
8323
+ });
8324
+ if (ctx.config.json) {
8325
+ ctx.io.out(jsonOutput(result));
8326
+ return;
8327
+ }
8328
+ ctx.io.out(`Deleted draft ${result.deletedUpdateId}.`);
8329
+ }
7949
8330
 
7950
8331
  // src/commands/workspace.ts
7951
8332
  async function workspaceList(ctx) {
@@ -8029,6 +8410,23 @@ function buildProgram(io2) {
8029
8410
  parent: options.parent
8030
8411
  });
8031
8412
  });
8413
+ task.command("request-approval").argument("<id>", "task identifier or id").description("Ask a person to approve a task").requiredOption(
8414
+ "--approver <member>",
8415
+ "the person's name, email or member id"
8416
+ ).action(async (id, options) => {
8417
+ await taskRequestApproval(contextFor(program2, io2), id, {
8418
+ approver: options.approver
8419
+ });
8420
+ });
8421
+ for (const [name, decision, description] of [
8422
+ ["approve", "approve", "Approve a task you were asked to approve"],
8423
+ ["request-changes", "changes", "Ask for changes on a task you were asked to approve"],
8424
+ ["reject", "reject", "Reject a task you were asked to approve"]
8425
+ ]) {
8426
+ task.command(name).argument("<id>", "task identifier or id").description(description).action(async (id) => {
8427
+ await taskDecide(contextFor(program2, io2), id, decision);
8428
+ });
8429
+ }
8032
8430
  const comment = program2.command("comment").description("Task and project comments");
8033
8431
  comment.command("add").argument("<taskRefOrBody>", "task identifier or id, or the body with --project").argument("[body]", "comment body, when a task was given").description("Add a comment to a task or a project").usage("[options] <taskRef> <body>\n tasq comment add [options] --project <projectRef> <body>").option("--project <projectRef>", "project id or name, instead of a task").option("--reply-to <commentRef>", "comment id, or ENG-42#<id>, to reply to").option("--thread <threadId>", "thread root id, an alias for --reply-to").option(
8034
8432
  "--mention <agentName>",
@@ -8074,6 +8472,44 @@ function buildProgram(io2) {
8074
8472
  });
8075
8473
  const project = program2.command("project").description("Projects");
8076
8474
  project.command("list").description("List projects").action(run((ctx) => projectList(ctx)));
8475
+ project.command("star").argument("<project>", "project id or name").description("Star a project for yourself").action(async (ref) => {
8476
+ await projectStar(contextFor(program2, io2), ref);
8477
+ });
8478
+ project.command("unstar").argument("<project>", "project id or name").description("Remove your star from a project").action(async (ref) => {
8479
+ await projectUnstar(contextFor(program2, io2), ref);
8480
+ });
8481
+ const initiative = program2.command("initiative").description("Initiatives: groups of projects across teams");
8482
+ initiative.command("list").description("List initiatives, archived ones included").action(run((ctx) => initiativeList(ctx)));
8483
+ initiative.command("create").argument("<name>", "initiative name").description("Create an initiative (admins)").action(async (name) => {
8484
+ await initiativeCreate(contextFor(program2, io2), name);
8485
+ });
8486
+ initiative.command("rename").argument("<initiative>", "initiative id or name").argument("<name>", "new name").description("Rename an initiative (admins)").action(async (ref, name) => {
8487
+ await initiativeRename(contextFor(program2, io2), ref, name);
8488
+ });
8489
+ initiative.command("archive").argument("<initiative>", "initiative id or name").description("Archive an initiative (admins)").action(async (ref) => {
8490
+ await initiativeArchive(contextFor(program2, io2), ref);
8491
+ });
8492
+ initiative.command("link").argument("<initiative>", "initiative id or name").argument("<project>", "project id or name").description("Add a project to an initiative (admins)").action(async (ref, projectRef) => {
8493
+ await initiativeLink(contextFor(program2, io2), ref, projectRef);
8494
+ });
8495
+ initiative.command("unlink").argument("<initiative>", "initiative id or name").argument("<project>", "project id or name").description("Remove a project from an initiative (admins)").action(async (ref, projectRef) => {
8496
+ await initiativeUnlink(contextFor(program2, io2), ref, projectRef);
8497
+ });
8498
+ const update = program2.command("update").description("Project updates: agents draft, a person sends");
8499
+ update.command("list").argument("<project>", "project id or name").description("List a project's updates, drafts included, newest first").action(async (projectRef) => {
8500
+ await updateList(contextFor(program2, io2), projectRef);
8501
+ });
8502
+ update.command("draft").argument("<project>", "project id or name").description("Draft an update for a person to review and send").option("--health <health>", "on_track | at_risk | off_track").option("--body <markdown>", "the update itself").option("--file <path>", "read the update from a file").action(
8503
+ async (projectRef, options) => {
8504
+ await updateDraft(contextFor(program2, io2), projectRef, options);
8505
+ }
8506
+ );
8507
+ update.command("send").argument("<updateId>", "update id").description("Send a draft to the client (people only)").action(async (updateId) => {
8508
+ await updateSend(contextFor(program2, io2), updateId);
8509
+ });
8510
+ update.command("delete").argument("<updateId>", "update id").description("Delete a draft").action(async (updateId) => {
8511
+ await updateDelete(contextFor(program2, io2), updateId);
8512
+ });
8077
8513
  const cycle = program2.command("cycle").description("Cycles");
8078
8514
  cycle.command("current").description("Show the active cycle and its tasks").option("--team <identifier>", "team identifier").action(async (options) => {
8079
8515
  await cycleCurrent(contextFor(program2, io2), { team: options.team });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxlabz/tasq-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Command-line client for Tasq, for humans and agents alike",
5
5
  "keywords": [
6
6
  "tasq",