@pxlabz/tasq-cli 0.1.16 → 0.1.17

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/dist/tasq.js +100 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,12 +31,15 @@ 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>
34
+ tasq project share <project> <guest> [--access view|comment] | access <project> <guest> <view|comment> | unshare <project> <guest>
34
35
  tasq initiative list | create <name> | rename <initiative> <name> | archive <initiative>
35
36
  tasq initiative link <initiative> <project> | unlink <initiative> <project>
36
37
  tasq cycle current
37
38
  tasq auth login | logout
38
39
  ```
39
40
 
41
+ `project share` gives a guest (invited from the web app) a project, with comment access unless `--access view`; `project access` changes it and `project unshare` removes it. Admins and the project lead only; an agent key is refused.
42
+
40
43
  Every command takes `--json` for raw output and `-w, --workspace <slug>` to override the default. Task refs accept either the human key (`ENG-42`) or the UUID.
41
44
 
42
45
  ### Mentions and replies
package/dist/tasq.js CHANGED
@@ -6651,7 +6651,14 @@ var TasqClient = class _TasqClient {
6651
6651
  * key is refused by policy whatever its preset.
6652
6652
  */
6653
6653
  star: (slug, input) => this.dispatch("project.star", slug, input),
6654
- unstar: (slug, input) => this.dispatch("project.unstar", slug, input)
6654
+ unstar: (slug, input) => this.dispatch("project.unstar", slug, input),
6655
+ /**
6656
+ * Share a project with a guest already in the workspace (6.2). Admins
6657
+ * and the project lead only; an agent key is always refused.
6658
+ */
6659
+ grantGuest: (slug, input) => this.dispatch("project.grantGuest", slug, input),
6660
+ setGuestAccess: (slug, input) => this.dispatch("project.setGuestAccess", slug, input),
6661
+ revokeGuest: (slug, input) => this.dispatch("project.revokeGuest", slug, input)
6655
6662
  };
6656
6663
  /**
6657
6664
  * Initiatives group projects across teams. Any member reads them; every
@@ -6946,7 +6953,7 @@ function reportError(error, io2) {
6946
6953
  // package.json
6947
6954
  var package_default = {
6948
6955
  name: "@pxlabz/tasq-cli",
6949
- version: "0.1.16",
6956
+ version: "0.1.17",
6950
6957
  description: "Command-line client for Tasq, for humans and agents alike",
6951
6958
  keywords: [
6952
6959
  "tasq",
@@ -7438,6 +7445,8 @@ function reasonPhrase(reason) {
7438
7445
  return `loop stopped after ${MAX_CONSECUTIVE_AGENT_MESSAGES} agent messages in a row; waiting for a person`;
7439
7446
  case "fanout_cap":
7440
7447
  return `fan-out cap of ${MAX_AGENT_WAKES_PER_MESSAGE} reached`;
7448
+ case "guest_actor":
7449
+ return "a guest wrote it; guests never wake agents";
7441
7450
  default:
7442
7451
  return null;
7443
7452
  }
@@ -7786,6 +7795,82 @@ async function projectUnstar(ctx, ref) {
7786
7795
  ctx.config.json ? jsonOutput(result) : `Unstarred ${project.name}.`
7787
7796
  );
7788
7797
  }
7798
+ var UUID_PATTERN4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7799
+ function parseAccess(value) {
7800
+ const access = value.trim().toLowerCase();
7801
+ if (access !== "view" && access !== "comment") {
7802
+ throw new UsageError(
7803
+ `Access must be view or comment, not "${value}".`
7804
+ );
7805
+ }
7806
+ return access;
7807
+ }
7808
+ async function resolveGuest(client, slug, ref) {
7809
+ const trimmed = ref.trim();
7810
+ const guests = (await client.members.list(slug)).filter(
7811
+ (member) => member.role === "guest"
7812
+ );
7813
+ if (UUID_PATTERN4.test(trimmed)) {
7814
+ const found = guests.find((guest) => guest.id === trimmed);
7815
+ return { id: trimmed, name: found?.name ?? found?.email ?? trimmed };
7816
+ }
7817
+ const wanted = trimmed.toLowerCase();
7818
+ const matched = guests.filter(
7819
+ (guest) => (guest.name ?? "").toLowerCase() === wanted || (guest.email ?? "").toLowerCase() === wanted
7820
+ );
7821
+ const [only] = matched;
7822
+ if (only === void 0) {
7823
+ throw new UsageError(
7824
+ `No guest named "${ref}" in this workspace. Invite them from the web app first; run "tasq workspace members" to see the names.`
7825
+ );
7826
+ }
7827
+ if (matched.length > 1) {
7828
+ throw new UsageError(
7829
+ `"${ref}" matches ${matched.length} guests. Pass their email or member id instead.`
7830
+ );
7831
+ }
7832
+ return { id: only.id, name: only.name ?? only.email ?? only.id };
7833
+ }
7834
+ async function projectShare(ctx, projectRef, guestRef, options) {
7835
+ const slug = requireWorkspace(ctx.config);
7836
+ const access = parseAccess(options.access ?? "comment");
7837
+ const project = await resolveProject(ctx.client, slug, projectRef);
7838
+ const guest = await resolveGuest(ctx.client, slug, guestRef);
7839
+ const { result } = await ctx.client.projects.grantGuest(slug, {
7840
+ projectId: project.id,
7841
+ memberId: guest.id,
7842
+ access
7843
+ });
7844
+ ctx.io.out(
7845
+ ctx.config.json ? jsonOutput(result) : `Shared ${project.name} with ${guest.name} (can ${access}).`
7846
+ );
7847
+ }
7848
+ async function projectAccess(ctx, projectRef, guestRef, accessValue) {
7849
+ const slug = requireWorkspace(ctx.config);
7850
+ const access = parseAccess(accessValue);
7851
+ const project = await resolveProject(ctx.client, slug, projectRef);
7852
+ const guest = await resolveGuest(ctx.client, slug, guestRef);
7853
+ const { result } = await ctx.client.projects.setGuestAccess(slug, {
7854
+ projectId: project.id,
7855
+ memberId: guest.id,
7856
+ access
7857
+ });
7858
+ ctx.io.out(
7859
+ ctx.config.json ? jsonOutput(result) : `${guest.name} can now ${access} ${project.name}.`
7860
+ );
7861
+ }
7862
+ async function projectUnshare(ctx, projectRef, guestRef) {
7863
+ const slug = requireWorkspace(ctx.config);
7864
+ const project = await resolveProject(ctx.client, slug, projectRef);
7865
+ const guest = await resolveGuest(ctx.client, slug, guestRef);
7866
+ const { result } = await ctx.client.projects.revokeGuest(slug, {
7867
+ projectId: project.id,
7868
+ memberId: guest.id
7869
+ });
7870
+ ctx.io.out(
7871
+ ctx.config.json ? jsonOutput(result) : `Stopped sharing ${project.name} with ${guest.name}.`
7872
+ );
7873
+ }
7789
7874
 
7790
7875
  // src/commands/release.ts
7791
7876
  import { writeFileSync as writeFileSync2 } from "fs";
@@ -8328,7 +8413,7 @@ function approvalLine(approval) {
8328
8413
  }
8329
8414
  return `${state} ${preposition} ${approval.approver.name ?? approval.approver.memberId}`;
8330
8415
  }
8331
- var UUID_PATTERN4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8416
+ var UUID_PATTERN5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8332
8417
  function resolveApprover(members, ref) {
8333
8418
  const wanted = ref.trim().toLowerCase();
8334
8419
  const matched = members.filter(
@@ -8353,7 +8438,7 @@ async function taskRequestApproval(ctx, taskRef, options) {
8353
8438
  throw new UsageError("--approver is required: a person's name, email or member id.");
8354
8439
  }
8355
8440
  const ref = options.approver.trim();
8356
- const approver = UUID_PATTERN4.test(ref) ? { id: ref, name: null } : resolveApprover(await ctx.client.members.list(slug), ref);
8441
+ const approver = UUID_PATTERN5.test(ref) ? { id: ref, name: null } : resolveApprover(await ctx.client.members.list(slug), ref);
8357
8442
  const taskId = await resolveTaskId(ctx.client, slug, taskRef);
8358
8443
  const response = await ctx.client.dispatch("task.requestApproval", slug, {
8359
8444
  taskId,
@@ -8619,6 +8704,17 @@ function buildProgram(io2) {
8619
8704
  project.command("unstar").argument("<project>", "project id or name").description("Remove your star from a project").action(async (ref) => {
8620
8705
  await projectUnstar(contextFor(program2, io2), ref);
8621
8706
  });
8707
+ project.command("share").argument("<project>", "project id or name").argument("<guest>", "the guest's name, email or member id").option("--access <access>", "view or comment", "comment").description("Share a project with a guest (admins and the project lead)").action(
8708
+ async (ref, guestRef, options) => {
8709
+ await projectShare(contextFor(program2, io2), ref, guestRef, options);
8710
+ }
8711
+ );
8712
+ project.command("access").argument("<project>", "project id or name").argument("<guest>", "the guest's name, email or member id").argument("<access>", "view or comment").description("Change what a guest can do on a project").action(async (ref, guestRef, access) => {
8713
+ await projectAccess(contextFor(program2, io2), ref, guestRef, access);
8714
+ });
8715
+ project.command("unshare").argument("<project>", "project id or name").argument("<guest>", "the guest's name, email or member id").description("Stop sharing a project with a guest").action(async (ref, guestRef) => {
8716
+ await projectUnshare(contextFor(program2, io2), ref, guestRef);
8717
+ });
8622
8718
  const initiative = program2.command("initiative").description("Initiatives: groups of projects across teams");
8623
8719
  initiative.command("list").description("List initiatives, archived ones included").action(run((ctx) => initiativeList(ctx)));
8624
8720
  initiative.command("create").argument("<name>", "initiative name").description("Create an initiative (admins)").action(async (name) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxlabz/tasq-cli",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Command-line client for Tasq, for humans and agents alike",
5
5
  "keywords": [
6
6
  "tasq",