@pxlabz/tasq-cli 0.1.13 → 0.1.14

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 (2) hide show
  1. package/dist/tasq.js +99 -4
  2. package/package.json +1 -1
package/dist/tasq.js CHANGED
@@ -6798,6 +6798,19 @@ var TasqClient = class _TasqClient {
6798
6798
  { unread: query.unread === true ? 1 : void 0 }
6799
6799
  )
6800
6800
  };
6801
+ activity = {
6802
+ /** The workspace activity feed, newest first; page with `nextCursor`. */
6803
+ list: (slug, query = {}) => this.#get(
6804
+ `/workspaces/${encodeURIComponent(slug)}/activity`,
6805
+ { limit: query.limit, before: query.before }
6806
+ )
6807
+ };
6808
+ waiting = {
6809
+ /** Approvals and agent drafts waiting on the caller. People only. */
6810
+ get: (slug) => this.#get(
6811
+ `/workspaces/${encodeURIComponent(slug)}/waiting`
6812
+ )
6813
+ };
6801
6814
  auth = {
6802
6815
  /** The principal behind the current credential. */
6803
6816
  me: async () => (await this.#get("/auth/me")).user,
@@ -6910,7 +6923,7 @@ function reportError(error, io2) {
6910
6923
  // package.json
6911
6924
  var package_default = {
6912
6925
  name: "@pxlabz/tasq-cli",
6913
- version: "0.1.13",
6926
+ version: "0.1.14",
6914
6927
  description: "Command-line client for Tasq, for humans and agents alike",
6915
6928
  keywords: [
6916
6929
  "tasq",
@@ -7050,9 +7063,6 @@ function requireWorkspace(config) {
7050
7063
  return config.workspace;
7051
7064
  }
7052
7065
 
7053
- // src/commands/auth.ts
7054
- import { hostname } from "os";
7055
-
7056
7066
  // src/output.ts
7057
7067
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
7058
7068
  function jsonOutput(value) {
@@ -7158,7 +7168,88 @@ function line(io2, value) {
7158
7168
  io2.out(JSON.stringify(value));
7159
7169
  }
7160
7170
 
7171
+ // src/commands/activity.ts
7172
+ var MAX_LIMIT = 100;
7173
+ function parseLimit(raw) {
7174
+ if (raw === void 0) return void 0;
7175
+ const limit = Number(raw);
7176
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {
7177
+ throw new UsageError(
7178
+ `--limit must be a whole number from 1 to ${MAX_LIMIT}.`
7179
+ );
7180
+ }
7181
+ return limit;
7182
+ }
7183
+ function timestamp(iso) {
7184
+ return `${iso.slice(0, 10)} ${iso.slice(11, 16)}`;
7185
+ }
7186
+ function activityLine(item) {
7187
+ const actor = item.actor.kind === "agent" ? `${item.actor.name} (agent)` : item.actor.name;
7188
+ const subject = item.subject.key ? `${item.subject.key} ${item.subject.title}` : item.subject.title;
7189
+ return `${timestamp(item.occurredAt)} ${actor} ${item.summary} ${subject}`;
7190
+ }
7191
+ async function activityList(ctx, options) {
7192
+ const limit = parseLimit(options.limit);
7193
+ const slug = requireWorkspace(ctx.config);
7194
+ const page = await ctx.client.activity.list(slug, { limit });
7195
+ if (ctx.config.json) {
7196
+ ctx.io.out(jsonOutput(page));
7197
+ return;
7198
+ }
7199
+ if (page.items.length === 0) {
7200
+ ctx.io.out("No activity yet.");
7201
+ return;
7202
+ }
7203
+ for (const item of page.items) ctx.io.out(activityLine(item));
7204
+ }
7205
+ function waitingLines(waiting) {
7206
+ const lines = [];
7207
+ if (waiting.approvals.length > 0) {
7208
+ lines.push(`Approvals (${waiting.approvals.length})`);
7209
+ for (const approval of waiting.approvals) {
7210
+ const parts = [`${approval.taskKey} ${approval.title}`];
7211
+ if (approval.projectName) parts.push(approval.projectName);
7212
+ if (approval.requestedBy) {
7213
+ parts.push(`asked by ${approval.requestedBy.name}`);
7214
+ }
7215
+ lines.push(` ${parts.join(" \xB7 ")}`);
7216
+ }
7217
+ }
7218
+ if (waiting.drafts.length > 0) {
7219
+ if (lines.length > 0) lines.push("");
7220
+ lines.push(`Drafts to review (${waiting.drafts.length})`);
7221
+ for (const draft of waiting.drafts) {
7222
+ lines.push(
7223
+ ` ${draft.updateId} ${draft.projectName} \xB7 ${draft.health} \xB7 by ${draft.author.name}`
7224
+ );
7225
+ if (draft.bodyExcerpt) lines.push(` ${draft.bodyExcerpt}`);
7226
+ }
7227
+ }
7228
+ return lines;
7229
+ }
7230
+ async function waitingShow(ctx) {
7231
+ const slug = requireWorkspace(ctx.config);
7232
+ const credential2 = ctx.config.credential;
7233
+ if (credential2 !== void 0 && "agentKey" in credential2) {
7234
+ throw new PersonOnlyError(
7235
+ "Waiting items belong to a person. Sign in with `tasq auth login` to see yours."
7236
+ );
7237
+ }
7238
+ const waiting = await ctx.client.waiting.get(slug);
7239
+ if (ctx.config.json) {
7240
+ ctx.io.out(jsonOutput(waiting));
7241
+ return;
7242
+ }
7243
+ const lines = waitingLines(waiting);
7244
+ if (lines.length === 0) {
7245
+ ctx.io.out("Nothing is waiting for you.");
7246
+ return;
7247
+ }
7248
+ for (const line2 of lines) ctx.io.out(line2);
7249
+ }
7250
+
7161
7251
  // src/commands/auth.ts
7252
+ import { hostname } from "os";
7162
7253
  var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
7163
7254
  var CODE_PATTERN = /^\d{6}$/;
7164
7255
  async function authLogin(ctx, options, prompts) {
@@ -8510,6 +8601,10 @@ function buildProgram(io2) {
8510
8601
  update.command("delete").argument("<updateId>", "update id").description("Delete a draft").action(async (updateId) => {
8511
8602
  await updateDelete(contextFor(program2, io2), updateId);
8512
8603
  });
8604
+ program2.command("activity").description("Recent activity in the workspace, newest first").option("--limit <n>", "how many rows, 1-100 (default 30)").action(async (options) => {
8605
+ await activityList(contextFor(program2, io2), options);
8606
+ });
8607
+ program2.command("waiting").description("Approvals and agent drafts waiting on you (people only)").action(run((ctx) => waitingShow(ctx)));
8513
8608
  const cycle = program2.command("cycle").description("Cycles");
8514
8609
  cycle.command("current").description("Show the active cycle and its tasks").option("--team <identifier>", "team identifier").action(async (options) => {
8515
8610
  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.13",
3
+ "version": "0.1.14",
4
4
  "description": "Command-line client for Tasq, for humans and agents alike",
5
5
  "keywords": [
6
6
  "tasq",