@pxlabz/tasq-mcp 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/README.md CHANGED
@@ -67,6 +67,10 @@ so `tasq project share` and the web Share dialog are the only ways in.
67
67
  | `task_view` | `tasq task view` | `workspace`, `id` |
68
68
  | `task_create` | `tasq task create` | `workspace`, `title`, `team`, `description`, `priority`, `project`, `labels` |
69
69
  | `task_update` | `tasq task update` | `workspace`, `id`, `title`, `description`, `priority`, `status` |
70
+ | `time_log` | `tasq time log` | `workspace`, `task`, `duration`, `day`, `note`, `billable` (`yes`/`no`/`unset`) |
71
+ | `time_list` | `tasq time list` | `workspace`, `task` |
72
+ | `time_edit` | `tasq time edit` | `workspace`, `entryId`, `duration`, `day`, `note` (`null` clears), `billable` |
73
+ | `time_delete` | `tasq time delete` | `workspace`, `entryId` |
70
74
  | `comment_add` | `tasq comment add` | `workspace`, `body`, `task`, `project`, `replyTo`, `thread`, `mentions` |
71
75
  | `thread_view` | `tasq thread view` | `workspace`, `threadId` |
72
76
  | `thread_context` | `tasq thread context` | `workspace`, `threadId`, `format` (`markdown` by default) |
package/dist/tasq-mcp.js CHANGED
@@ -22436,6 +22436,33 @@ var TasqClient = class _TasqClient {
22436
22436
  */
22437
22437
  decide: (slug, taskId, decision) => this.dispatch("task.decide", slug, { taskId, decision })
22438
22438
  };
22439
+ /**
22440
+ * Time tracking: whole minutes on a task for a day, no running timer.
22441
+ * Everything here is member-level; a guest credential is refused. Turn a
22442
+ * typed duration into minutes with `parseDuration`.
22443
+ */
22444
+ time = {
22445
+ /** A task's entries, newest day first, and its total with direct subtasks. */
22446
+ forTask: (slug, taskId) => this.#get(
22447
+ `/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}/time`
22448
+ ),
22449
+ /**
22450
+ * Time on a project's tasks between two inclusive `YYYY-MM-DD` days, by
22451
+ * person and day. The API reads at most 92 days at a time.
22452
+ */
22453
+ forProject: (slug, projectId, range) => this.#get(
22454
+ `/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/time`,
22455
+ { from: range.from, to: range.to }
22456
+ ),
22457
+ /**
22458
+ * Log minutes on a task for a day. `memberId` defaults to the caller;
22459
+ * logging for someone else is an admin's job.
22460
+ */
22461
+ log: (slug, input) => this.dispatch("time.log", slug, input),
22462
+ /** Change an entry; omitted fields are left alone, `note: null` clears it. */
22463
+ update: (slug, input) => this.dispatch("time.update", slug, input),
22464
+ delete: (slug, input) => this.dispatch("time.delete", slug, input)
22465
+ };
22439
22466
  projects = {
22440
22467
  list: async (slug) => (await this.#get(
22441
22468
  `/workspaces/${encodeURIComponent(slug)}/projects`
@@ -22669,6 +22696,30 @@ var TasqClient = class _TasqClient {
22669
22696
  }
22670
22697
  };
22671
22698
 
22699
+ // ../sdk/src/time.ts
22700
+ var DURATION_FORMS = "1h 30m, 1h30m, 90m, 1.5h, 1:30 or a bare number of hours";
22701
+ function parseDuration(raw) {
22702
+ const value = raw.trim().toLowerCase().replace(/\s+/g, "");
22703
+ if (!value) return null;
22704
+ let match = value.match(/^(\d{1,2}):([0-5]\d)$/);
22705
+ if (match) return Number(match[1]) * 60 + Number(match[2]);
22706
+ match = value.match(/^(\d+(?:\.\d+)?)h$/);
22707
+ if (match) return Math.round(Number(match[1]) * 60);
22708
+ match = value.match(/^(\d+)m(?:in|ins)?$/);
22709
+ if (match) return Number(match[1]);
22710
+ match = value.match(/^(\d+)h(\d+)m?(?:in|ins)?$/);
22711
+ if (match) return Number(match[1]) * 60 + Number(match[2]);
22712
+ match = value.match(/^(\d+(?:\.\d+)?)$/);
22713
+ if (match) return Math.round(Number(match[1]) * 60);
22714
+ return null;
22715
+ }
22716
+ function formatMinutes(minutes) {
22717
+ const hours = Math.floor(minutes / 60);
22718
+ const rest = minutes % 60;
22719
+ if (hours === 0) return `${rest}m`;
22720
+ return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;
22721
+ }
22722
+
22672
22723
  // ../sdk/src/types.ts
22673
22724
  var PROJECT_HEALTH_VALUES = [
22674
22725
  "on_track",
@@ -30642,7 +30693,7 @@ var EMPTY_COMPLETION_RESULT = {
30642
30693
  // package.json
30643
30694
  var package_default = {
30644
30695
  name: "@pxlabz/tasq-mcp",
30645
- version: "0.1.14",
30696
+ version: "0.1.16",
30646
30697
  description: "MCP stdio server for Tasq: tasks, threads, comments and mentions for MCP-capable agents",
30647
30698
  keywords: [
30648
30699
  "tasq",
@@ -31042,6 +31093,34 @@ async function resolveApproverId(client, slug, ref) {
31042
31093
  }
31043
31094
  return matched[0]?.id ?? "";
31044
31095
  }
31096
+ var MAX_ENTRY_MINUTES = 24 * 60;
31097
+ function resolveDurationMinutes(raw) {
31098
+ const minutes = parseDuration(raw);
31099
+ if (minutes === null) {
31100
+ throw new UsageError(`"${raw}" is not a duration. Use ${DURATION_FORMS}.`);
31101
+ }
31102
+ if (minutes < 1) throw new UsageError("Log at least one minute.");
31103
+ if (minutes > MAX_ENTRY_MINUTES) {
31104
+ throw new UsageError(
31105
+ `One entry is at most 24 hours; "${raw}" is ${formatMinutes(minutes)}. Split it across days.`
31106
+ );
31107
+ }
31108
+ return minutes;
31109
+ }
31110
+ function resolveTimeEntryId(ref) {
31111
+ const trimmed = ref.trim();
31112
+ if (!UUID_PATTERN.test(trimmed)) {
31113
+ throw new UsageError(
31114
+ `"${ref}" is not a time entry id. Call time_list on the task to see the ids.`
31115
+ );
31116
+ }
31117
+ return trimmed;
31118
+ }
31119
+ function localToday(now = /* @__PURE__ */ new Date()) {
31120
+ const month = String(now.getMonth() + 1).padStart(2, "0");
31121
+ const day = String(now.getDate()).padStart(2, "0");
31122
+ return `${now.getFullYear()}-${month}-${day}`;
31123
+ }
31045
31124
  function commentIdOf(ref) {
31046
31125
  const hash2 = ref.lastIndexOf("#");
31047
31126
  return hash2 === -1 ? ref.trim() : ref.slice(hash2 + 1).trim();
@@ -31063,6 +31142,13 @@ function datesInput(taskId, input) {
31063
31142
  }
31064
31143
  return action;
31065
31144
  }
31145
+ var BILLABLE_INPUT = external_exports.enum(["yes", "no", "unset"]);
31146
+ var BILLABLE_VALUES = {
31147
+ yes: "billable",
31148
+ no: "non_billable",
31149
+ unset: "not_set"
31150
+ };
31151
+ var DURATION_INPUT = external_exports.string().describe("How long, e.g. 1h 30m, 90m, 1.5h or 1:30; at most 24h per entry.");
31066
31152
  var workspaceFields = {
31067
31153
  workspace: external_exports.string().optional().describe("Workspace slug; defaults to TASQ_WORKSPACE.")
31068
31154
  };
@@ -31365,6 +31451,106 @@ var definitions = [
31365
31451
  return { data: response.result };
31366
31452
  }
31367
31453
  }),
31454
+ define({
31455
+ name: "time_log",
31456
+ description: "Log time worked on a task for one day, as yourself.",
31457
+ schema: external_exports.object({
31458
+ ...workspaceFields,
31459
+ task: external_exports.string().describe("Task key such as ENG-42, or a task id."),
31460
+ duration: DURATION_INPUT,
31461
+ day: DATE_INPUT.optional().describe(
31462
+ "The day the work was done, YYYY-MM-DD; defaults to today."
31463
+ ),
31464
+ note: external_exports.string().optional().describe("What the time was spent on."),
31465
+ billable: BILLABLE_INPUT.optional().describe(
31466
+ "yes or no to mark the entry billable; unset by default."
31467
+ )
31468
+ }),
31469
+ run: async ({ client, config: config2 }, input) => {
31470
+ const slug = requireWorkspace(config2, input);
31471
+ const minutes = resolveDurationMinutes(input.duration);
31472
+ const spentOn = input.day ?? localToday();
31473
+ const taskId = await resolveTaskId(client, slug, input.task);
31474
+ const action = { taskId, minutes, spentOn };
31475
+ if (input.note !== void 0) action.note = input.note;
31476
+ if (input.billable !== void 0) {
31477
+ action.billable = BILLABLE_VALUES[input.billable];
31478
+ }
31479
+ const response = await client.time.log(slug, action);
31480
+ return {
31481
+ data: response.result,
31482
+ lines: [
31483
+ `Logged ${formatMinutes(minutes)} on ${input.task} for ${spentOn} (entry ${response.result.entry.id}).`
31484
+ ]
31485
+ };
31486
+ }
31487
+ }),
31488
+ define({
31489
+ name: "time_list",
31490
+ description: "List a task's time entries, newest day first, with its total including direct subtasks.",
31491
+ schema: external_exports.object({
31492
+ ...workspaceFields,
31493
+ task: external_exports.string().describe("Task key such as ENG-42, or a task id.")
31494
+ }),
31495
+ run: async ({ client, config: config2 }, input) => {
31496
+ const slug = requireWorkspace(config2, input);
31497
+ const taskId = await resolveTaskId(client, slug, input.task);
31498
+ const time3 = await client.time.forTask(slug, taskId);
31499
+ const subtaskMinutes = time3.totalMinutes - time3.ownMinutes;
31500
+ return {
31501
+ data: time3,
31502
+ lines: [
31503
+ subtaskMinutes > 0 ? `Total: ${formatMinutes(time3.totalMinutes)} (${formatMinutes(time3.ownMinutes)} on ${input.task}, ${formatMinutes(subtaskMinutes)} on subtasks).` : `Total: ${formatMinutes(time3.totalMinutes)}.`
31504
+ ]
31505
+ };
31506
+ }
31507
+ }),
31508
+ define({
31509
+ name: "time_edit",
31510
+ description: "Change a time entry's duration, day, note or billable flag; omitted fields stay as they are.",
31511
+ schema: external_exports.object({
31512
+ ...workspaceFields,
31513
+ entryId: external_exports.string().describe("Time entry id, as time_list returns it."),
31514
+ duration: DURATION_INPUT.optional(),
31515
+ day: DATE_INPUT.optional().describe("New day, YYYY-MM-DD."),
31516
+ note: external_exports.string().nullable().optional().describe("New note; null clears it."),
31517
+ billable: BILLABLE_INPUT.optional().describe("yes, no or unset.")
31518
+ }),
31519
+ run: async ({ client, config: config2 }, input) => {
31520
+ const slug = requireWorkspace(config2, input);
31521
+ const entryId = resolveTimeEntryId(input.entryId);
31522
+ const minutes = input.duration === void 0 ? void 0 : resolveDurationMinutes(input.duration);
31523
+ if (minutes === void 0 && input.day === void 0 && input.note === void 0 && input.billable === void 0) {
31524
+ throw new UsageError(
31525
+ "Nothing to change. Pass duration, day, note or billable."
31526
+ );
31527
+ }
31528
+ const action = { entryId };
31529
+ if (minutes !== void 0) action.minutes = minutes;
31530
+ if (input.day !== void 0) action.spentOn = input.day;
31531
+ if (input.note !== void 0) action.note = input.note;
31532
+ if (input.billable !== void 0) {
31533
+ action.billable = BILLABLE_VALUES[input.billable];
31534
+ }
31535
+ const response = await client.time.update(slug, action);
31536
+ return { data: response.result };
31537
+ }
31538
+ }),
31539
+ define({
31540
+ name: "time_delete",
31541
+ description: "Delete a time entry.",
31542
+ schema: external_exports.object({
31543
+ ...workspaceFields,
31544
+ entryId: external_exports.string().describe("Time entry id, as time_list returns it.")
31545
+ }),
31546
+ run: async ({ client, config: config2 }, input) => {
31547
+ const slug = requireWorkspace(config2, input);
31548
+ const response = await client.time.delete(slug, {
31549
+ entryId: resolveTimeEntryId(input.entryId)
31550
+ });
31551
+ return { data: response.result };
31552
+ }
31553
+ }),
31368
31554
  define({
31369
31555
  name: "comment_add",
31370
31556
  description: "Comment on a task or a project, optionally replying and mentioning people or agents.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxlabz/tasq-mcp",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "MCP stdio server for Tasq: tasks, threads, comments and mentions for MCP-capable agents",
5
5
  "keywords": [
6
6
  "tasq",