@pxlabz/tasq-cli 0.1.14 → 0.1.16

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
@@ -51,9 +51,9 @@ tasq task update <ref> [--title <title>] [--description <markdown>]
51
51
  [--parent <ref> | --no-parent]
52
52
 
53
53
  tasq comment add <ref> <body> [--reply-to <commentRef>] [--thread <threadId>]
54
- [--mention <agentName>]…
54
+ [--mention <name>]…
55
55
  tasq comment add --project <id|name> <body> [--reply-to <commentRef>]
56
- [--thread <threadId>] [--mention <agentName>]…
56
+ [--thread <threadId>] [--mention <name>]…
57
57
 
58
58
  tasq thread view <threadId>
59
59
  tasq thread context <threadId> [--markdown]
@@ -83,7 +83,7 @@ tasq auth whoami
83
83
 
84
84
  `--parent <ref>` makes the task a subtask of another task on the same team (one level only: a subtask cannot take subtasks, and an archived task cannot be a parent). A subtask's project and phase follow its parent, so `task create` refuses `--parent` together with `--project`; move the parent instead. `--no-parent` on `task update` detaches it and leaves its placement alone. `task view` prints `Parent: <key>` on a subtask and `Subtasks: <done>/<total> done` on a parent.
85
85
 
86
- `--mention` is repeatable and matches an agent name exactly, ignoring case.
86
+ `--mention` is repeatable and matches a person or agent name exactly, ignoring case; a person also matches by email. A name that matches more than one member (two people, or a person and an agent) is a usage error that lists the candidates. Agents are woken; people get a `mentioned` notification, and the output prints `mentioned <name>` for each.
87
87
 
88
88
  `task view` and `thread view` print every message with its id on the header line, as ` <createdAt> <author> #<id>` with the body indented beneath it. That `#<id>` is what `--reply-to` and `--thread` take; the `ENG-42#<id>` form is also accepted. The parent must be a message on the same task or project.
89
89
 
@@ -171,7 +171,7 @@ You draft; a person sends. `tasq update draft` always writes a draft, and nothin
171
171
  | --- | --- |
172
172
  | 0 | Success |
173
173
  | 1 | Error; details on stderr |
174
- | 2 | Usage error — a bad flag, or a `--mention` name matching no agent or more than one |
174
+ | 2 | Usage error — a bad flag, or a `--mention` name matching no one or more than one member |
175
175
  | 3 | Rate limited; the message says when to retry. `events listen` never exits here — it waits and continues |
176
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 |
177
177
 
package/README.md CHANGED
@@ -27,7 +27,7 @@ TASQ_API_KEY=tq_ag_… TASQ_WORKSPACE=acme tasq task list
27
27
  ```
28
28
  tasq workspace list | use <slug>
29
29
  tasq task list | view <ref> | create | update <ref>
30
- tasq comment add <ref> <body> [--reply-to <commentRef>] [--mention <agentName>]…
30
+ tasq comment add <ref> <body> [--reply-to <commentRef>] [--mention <name>]…
31
31
  tasq events listen [--wait <seconds>] [--once]
32
32
  tasq events ack <id>…
33
33
  tasq project list | star <project> | unstar <project>
@@ -41,7 +41,7 @@ Every command takes `--json` for raw output and `-w, --workspace <slug>` to over
41
41
 
42
42
  ### Mentions and replies
43
43
 
44
- `--mention <agentName>` is repeatable and matches an agent's name exactly, ignoring case. Two agents answering to one name is a usage error (exit 2) rather than a guess. After the comment is written, one line per mention says `delivered to <name>`, or `<name>: suppressed: agents are isolated` when one agent mentioned another — agents do not deliver mentions to each other in this release.
44
+ `--mention <name>` is repeatable and matches a person's or an agent's name exactly, ignoring case; a person also matches by email. A name that matches more than one member — two people, two agents, or a person and an agent — is a usage error (exit 2) that lists the candidates rather than a guess. Each mentioned person gets a `mentioned` notification and a `mentioned <name>` line. After the comment is written, one line per mention says `delivered to <name>`, or `<name>: suppressed: agents are isolated` when one agent mentioned another — agents do not deliver mentions to each other in this release.
45
45
 
46
46
  `--reply-to` takes a comment id, or the `ENG-42#<id>` form `task view` prints. The parent must be a comment on the same task.
47
47
 
@@ -89,7 +89,7 @@ Both are examples. Tasq stores and delivers the event; it never runs your agent.
89
89
  | --- | --- |
90
90
  | 0 | Success |
91
91
  | 1 | Error (details on stderr) |
92
- | 2 | Usage error — including an `--mention` name that matches no agent or more than one |
92
+ | 2 | Usage error — including an `--mention` name that matches no one or more than one member |
93
93
  | 3 | Rate limited; the message includes when to retry. `events listen` does not exit here: it sleeps for `Retry-After` and carries on |
94
94
  | 4 | The agent's policy denied the action |
95
95
 
package/dist/tasq.js CHANGED
@@ -6502,6 +6502,7 @@ function toTasqError(status, body, retryAfterHeader) {
6502
6502
  }
6503
6503
 
6504
6504
  // ../sdk/src/client.ts
6505
+ var PROJECT_UPDATES_PAGE_MAX = 100;
6505
6506
  function assertPrefix(token, prefix, label) {
6506
6507
  if (!token.startsWith(prefix)) {
6507
6508
  throw new Error(
@@ -6675,10 +6676,32 @@ var TasqClient = class _TasqClient {
6675
6676
  * approving it.
6676
6677
  */
6677
6678
  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,
6679
+ /**
6680
+ * Every update on the project, drafts included, newest first. Follows
6681
+ * `nextCursor` until the last page; use `listPage` for one page.
6682
+ */
6683
+ list: async (slug, projectId) => {
6684
+ const updates = [];
6685
+ let before;
6686
+ do {
6687
+ const page = await this.projectUpdates.listPage(slug, projectId, {
6688
+ limit: PROJECT_UPDATES_PAGE_MAX,
6689
+ before
6690
+ });
6691
+ updates.push(...page.updates);
6692
+ before = page.nextCursor ?? void 0;
6693
+ } while (before !== void 0);
6694
+ return updates;
6695
+ },
6696
+ /**
6697
+ * One page of the project's updates, drafts included, newest first; pass
6698
+ * `nextCursor` as `before` for the next. The API returns 20 by default,
6699
+ * at most 100.
6700
+ */
6701
+ listPage: (slug, projectId, query = {}) => this.#get(
6702
+ `/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/updates`,
6703
+ { limit: query.limit, before: query.before }
6704
+ ),
6682
6705
  draft: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
6683
6706
  create: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
6684
6707
  update: (slug, input) => this.dispatch("projectUpdate.update", slug, input),
@@ -6923,7 +6946,7 @@ function reportError(error, io2) {
6923
6946
  // package.json
6924
6947
  var package_default = {
6925
6948
  name: "@pxlabz/tasq-cli",
6926
- version: "0.1.14",
6949
+ version: "0.1.16",
6927
6950
  description: "Command-line client for Tasq, for humans and agents alike",
6928
6951
  keywords: [
6929
6952
  "tasq",
@@ -7377,27 +7400,35 @@ function replyRef(options) {
7377
7400
  }
7378
7401
  return replyTo;
7379
7402
  }
7403
+ function mentionCandidate(member) {
7404
+ const name = member.name ?? "(no name)";
7405
+ return member.type === "agent" ? `${name} (agent)` : `${name} <${member.email ?? "no email"}> (person)`;
7406
+ }
7380
7407
  function resolveMentions(members, names) {
7381
- const agents = members.filter(
7382
- (member) => member.type === "agent" && member.agentId !== null
7383
- );
7384
- return names.map((name) => {
7408
+ const resolved = { agentIds: [], memberIds: [] };
7409
+ for (const name of names) {
7385
7410
  const wanted = name.trim().toLowerCase();
7386
- const matched = agents.filter(
7387
- (agent) => (agent.name ?? "").toLowerCase() === wanted
7411
+ const matched = members.filter(
7412
+ (member) => member.type === "agent" ? member.agentId !== null && (member.name ?? "").toLowerCase() === wanted : (member.name ?? "").toLowerCase() === wanted || (member.email ?? "").toLowerCase() === wanted
7388
7413
  );
7389
- if (matched.length === 0) {
7414
+ const [only] = matched;
7415
+ if (only === void 0) {
7390
7416
  throw new UsageError(
7391
- `No agent named "${name}" in this workspace. Run "tasq workspace members" to see the names.`
7417
+ `No person or agent named "${name}" in this workspace. Run "tasq workspace members" to see the names.`
7392
7418
  );
7393
7419
  }
7394
7420
  if (matched.length > 1) {
7395
7421
  throw new UsageError(
7396
- `"${name}" matches ${matched.length} agents. Rename one, or pass the agent id.`
7422
+ `"${name}" is ambiguous: it matches ${matched.map(mentionCandidate).join(", ")}. Mention a person by email, or rename one.`
7397
7423
  );
7398
7424
  }
7399
- return matched[0]?.agentId ?? "";
7400
- });
7425
+ if (only.type === "agent" && only.agentId !== null) {
7426
+ resolved.agentIds.push(only.agentId);
7427
+ } else {
7428
+ resolved.memberIds.push(only.id);
7429
+ }
7430
+ }
7431
+ return resolved;
7401
7432
  }
7402
7433
  function reasonPhrase(reason) {
7403
7434
  switch (reason) {
@@ -7506,7 +7537,8 @@ async function commentAdd(ctx, taskRef, body, options = {}) {
7506
7537
  if (parent !== void 0) {
7507
7538
  input.parentId = resolveParentId(target.comments, target.label, parent);
7508
7539
  }
7509
- if (mentions.length > 0) input.mentions = mentions;
7540
+ if (mentions.agentIds.length > 0) input.mentions = mentions.agentIds;
7541
+ if (mentions.memberIds.length > 0) input.memberMentions = mentions.memberIds;
7510
7542
  const added = await ctx.client.dispatch("comment.add", slug, input);
7511
7543
  if (ctx.config.json) {
7512
7544
  ctx.io.out(jsonOutput(added.result));
@@ -7519,6 +7551,12 @@ async function commentAdd(ctx, taskRef, body, options = {}) {
7519
7551
  for (const mention of added.result.mentions ?? []) {
7520
7552
  ctx.io.out(mentionLine(mention, nameById.get(mention.agentId)));
7521
7553
  }
7554
+ const nameByMemberId = new Map(
7555
+ members.map((member) => [member.id, member.name])
7556
+ );
7557
+ for (const memberId of added.result.memberMentions ?? []) {
7558
+ ctx.io.out(`mentioned ${nameByMemberId.get(memberId) ?? "a person"}`);
7559
+ }
7522
7560
  const threadMessages = added.result.threadMessages ?? [];
7523
7561
  if (threadMessages.length > 0) ctx.io.out(threadLine(threadMessages));
7524
7562
  }
@@ -8366,10 +8404,22 @@ function draftBody(options, deps) {
8366
8404
  "Pass the update with --body <markdown> or --file <path>."
8367
8405
  );
8368
8406
  }
8369
- async function updateList(ctx, projectRef) {
8407
+ var MAX_LIST_LIMIT = 100;
8408
+ function parseListLimit(raw) {
8409
+ if (raw === void 0) return void 0;
8410
+ const limit = Number(raw);
8411
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIST_LIMIT) {
8412
+ throw new UsageError(
8413
+ `--limit must be a whole number from 1 to ${MAX_LIST_LIMIT}.`
8414
+ );
8415
+ }
8416
+ return limit;
8417
+ }
8418
+ async function updateList(ctx, projectRef, options) {
8419
+ const limit = parseListLimit(options.limit);
8370
8420
  const slug = requireWorkspace(ctx.config);
8371
8421
  const projectId = await resolveProjectId(ctx, slug, projectRef);
8372
- const updates = await ctx.client.projectUpdates.list(slug, projectId);
8422
+ const updates = limit === void 0 ? await ctx.client.projectUpdates.list(slug, projectId) : (await ctx.client.projectUpdates.listPage(slug, projectId, { limit })).updates;
8373
8423
  ctx.io.out(
8374
8424
  ctx.config.json ? jsonOutput(updates) : formatProjectUpdates(updates)
8375
8425
  );
@@ -8520,8 +8570,8 @@ function buildProgram(io2) {
8520
8570
  }
8521
8571
  const comment = program2.command("comment").description("Task and project comments");
8522
8572
  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(
8523
- "--mention <agentName>",
8524
- "agent to mention, repeatable",
8573
+ "--mention <name>",
8574
+ "person or agent to mention, by name (or a person's email), repeatable",
8525
8575
  (value, previous) => [
8526
8576
  ...previous ?? [],
8527
8577
  value
@@ -8587,8 +8637,8 @@ function buildProgram(io2) {
8587
8637
  await initiativeUnlink(contextFor(program2, io2), ref, projectRef);
8588
8638
  });
8589
8639
  const update = program2.command("update").description("Project updates: agents draft, a person sends");
8590
- update.command("list").argument("<project>", "project id or name").description("List a project's updates, drafts included, newest first").action(async (projectRef) => {
8591
- await updateList(contextFor(program2, io2), projectRef);
8640
+ update.command("list").argument("<project>", "project id or name").description("List a project's updates, drafts included, newest first").option("--limit <n>", "only the latest n updates, 1-100 (default: all)").action(async (projectRef, options) => {
8641
+ await updateList(contextFor(program2, io2), projectRef, options);
8592
8642
  });
8593
8643
  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(
8594
8644
  async (projectRef, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxlabz/tasq-cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Command-line client for Tasq, for humans and agents alike",
5
5
  "keywords": [
6
6
  "tasq",
@@ -49,7 +49,7 @@
49
49
  "commander": "^14.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@pxlabz/tasq-sdk": "0.1.4",
52
+ "@pxlabz/tasq-sdk": "0.1.15",
53
53
  "@types/bun": "^1.3.12",
54
54
  "tsup": "^8.5.0",
55
55
  "typescript": "^5.7.2"