@pxlabz/tasq-mcp 0.1.17 → 0.1.19
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 +18 -3
- package/dist/tasq-mcp.js +415 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ moves together.
|
|
|
56
56
|
|
|
57
57
|
## Tools
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Twenty-two tools, stdio transport only. No resources, no prompts. There is no
|
|
60
60
|
tool that sends a project update: an agent drafts, and a person sends. There
|
|
61
61
|
is no tool that shares a project with a guest either: no agent may share,
|
|
62
62
|
so `tasq project share` and the web Share dialog are the only ways in.
|
|
@@ -65,17 +65,28 @@ so `tasq project share` and the web Share dialog are the only ways in.
|
|
|
65
65
|
| ---------------- | ---------------------- | ---------------------------------------------------------------------------- |
|
|
66
66
|
| `task_list` | `tasq task list` | `workspace`, `team`, `status`, `assignee`, `priority`, `project`, `cycle`, `q`, `includeArchived` |
|
|
67
67
|
| `task_view` | `tasq task view` | `workspace`, `id` |
|
|
68
|
-
| `task_create` | `tasq task create` | `workspace`, `title`, `team`, `description`, `priority`, `project`, `labels` |
|
|
69
|
-
| `task_update` | `tasq task update` | `workspace`, `id`, `title`, `description`, `priority`, `status`
|
|
68
|
+
| `task_create` | `tasq task create` | `workspace`, `title`, `team`, `description`, `priority`, `project`, `labels`, `due`, `start`, `parent`, `fields` |
|
|
69
|
+
| `task_update` | `tasq task update` | `workspace`, `id`, `title`, `description`, `priority`, `status`, `due`, `start`, `parent`, `fields` |
|
|
70
|
+
| `task_request_approval` | `tasq task request-approval` | `workspace`, `id`, `approver` |
|
|
71
|
+
| `field_list` | `tasq field list` | `workspace`, `all` |
|
|
70
72
|
| `time_log` | `tasq time log` | `workspace`, `task`, `duration`, `day`, `note`, `billable` (`yes`/`no`/`unset`) |
|
|
71
73
|
| `time_list` | `tasq time list` | `workspace`, `task` |
|
|
72
74
|
| `time_edit` | `tasq time edit` | `workspace`, `entryId`, `duration`, `day`, `note` (`null` clears), `billable` |
|
|
73
75
|
| `time_delete` | `tasq time delete` | `workspace`, `entryId` |
|
|
76
|
+
| `client_hours` | `tasq clients hours` | `workspace`, `client`, `month` (`YYYY-MM`), `billableOnly` |
|
|
77
|
+
| `my_week` | `tasq week` | `workspace`, `day` (`YYYY-MM-DD`) |
|
|
78
|
+
| `time_draft_get` | `tasq timesheet show` | `workspace`, `draftId`: the draft from a `timesheet_due` or `timesheet_reply` event, with the member's day |
|
|
79
|
+
| `time_draft_save` | `tasq timesheet save` | `workspace`, `draftId`, `lines` (`task`, `duration`, `billable?`, `evidence?`), `message?` |
|
|
80
|
+
| `client_billing` | `tasq clients billing` | `workspace`, `client` |
|
|
81
|
+
| `billing_period_close` | `tasq clients close` | `workspace`, `client`, `month` (admins) |
|
|
82
|
+
| `billing_period_mark_invoiced` | `tasq clients invoice` | `workspace`, `client`, `month`, `invoiceRef` (admins) |
|
|
83
|
+
| `billing_period_reopen` | `tasq clients reopen` | `workspace`, `client`, `month` (admins) |
|
|
74
84
|
| `comment_add` | `tasq comment add` | `workspace`, `body`, `task`, `project`, `replyTo`, `thread`, `mentions` |
|
|
75
85
|
| `thread_view` | `tasq thread view` | `workspace`, `threadId` |
|
|
76
86
|
| `thread_context` | `tasq thread context` | `workspace`, `threadId`, `format` (`markdown` by default) |
|
|
77
87
|
| `project_list` | `tasq project list` | `workspace` |
|
|
78
88
|
| `initiative_list` | `tasq initiative list` | `workspace` |
|
|
89
|
+
| `activity_list` | `tasq activity` | `workspace`, `limit` |
|
|
79
90
|
| `project_update_list` | `tasq update list` | `workspace`, `project`, `limit` |
|
|
80
91
|
| `project_update_draft` | `tasq update draft` | `workspace`, `project`, `health`, `body` |
|
|
81
92
|
| `cycle_current` | `tasq cycle current` | `workspace`, `team` |
|
|
@@ -83,6 +94,10 @@ so `tasq project share` and the web Share dialog are the only ways in.
|
|
|
83
94
|
| `events_ack` | `tasq events ack` | `workspace`, `ids` |
|
|
84
95
|
| `whoami` | `tasq auth whoami` | — |
|
|
85
96
|
|
|
97
|
+
### Custom fields
|
|
98
|
+
|
|
99
|
+
`field_list` returns each field compactly — `id`, `key`, `name`, `type`, `appliesTo`, live `options` by name, `archived` — rather than the full library `tasq field list --json` prints; archived fields only with `all`. `fields` on `task_create` and `task_update` is one object of field key to value, the CLI's repeated `--field key=value`: `{"budget": 1200, "tier": "Gold", "areas": ["Web", "API"], "owner": "ana@example.com"}`. Options and people go by name (a person also by email), a list field also takes `"a,b"`, and `null` clears. Each field is set after the task is written, one `task.setField` per key, and the result leads with a `Name: value.` line per field as the server read it. An unknown key is a usage error naming the task fields, before anything is written.
|
|
100
|
+
|
|
86
101
|
### The event loop
|
|
87
102
|
|
|
88
103
|
`events_listen` is one poll, not a stream: an MCP tool call has to return, so
|
package/dist/tasq-mcp.js
CHANGED
|
@@ -22463,6 +22463,62 @@ var TasqClient = class _TasqClient {
|
|
|
22463
22463
|
update: (slug, input) => this.dispatch("time.update", slug, input),
|
|
22464
22464
|
delete: (slug, input) => this.dispatch("time.delete", slug, input)
|
|
22465
22465
|
};
|
|
22466
|
+
/**
|
|
22467
|
+
* Clients (initiatives) and their hours. Member-only; refused unless a team
|
|
22468
|
+
* with a project for the client has Client hours on.
|
|
22469
|
+
*/
|
|
22470
|
+
clients = {
|
|
22471
|
+
/**
|
|
22472
|
+
* One month of a client's hours by billable flag, project and person.
|
|
22473
|
+
* `month` is `YYYY-MM`; `billableOnly` counts billable entries only.
|
|
22474
|
+
*/
|
|
22475
|
+
hours: (slug, clientId, month, options = {}) => this.#get(
|
|
22476
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/hours`,
|
|
22477
|
+
{ month, billable: options.billableOnly ? "billable" : "all" }
|
|
22478
|
+
),
|
|
22479
|
+
/** A client's billing months, newest first, with each one's hours and state. */
|
|
22480
|
+
billing: (slug, clientId) => this.#get(
|
|
22481
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/billing`
|
|
22482
|
+
)
|
|
22483
|
+
};
|
|
22484
|
+
/** The caller's own time (TM-2, My week). */
|
|
22485
|
+
me = {
|
|
22486
|
+
/**
|
|
22487
|
+
* The caller's Monday-to-Sunday week around `day` (`YYYY-MM-DD`), that
|
|
22488
|
+
* day's entries, and tasks they worked on that day with no time logged.
|
|
22489
|
+
* `tz` is the IANA zone that decides which edits fall on the day.
|
|
22490
|
+
*/
|
|
22491
|
+
week: (slug, day, options = {}) => this.#get(
|
|
22492
|
+
`/workspaces/${encodeURIComponent(slug)}/me/week`,
|
|
22493
|
+
options.tz ? { day, tz: options.tz } : { day }
|
|
22494
|
+
)
|
|
22495
|
+
};
|
|
22496
|
+
/**
|
|
22497
|
+
* Agent timesheet drafts (TM-2). The drafting agent reads a draft and the
|
|
22498
|
+
* member's day and saves lines; the member requests, logs, dismisses or
|
|
22499
|
+
* replies. Agent keys are refused the member's side by policy.
|
|
22500
|
+
*/
|
|
22501
|
+
timeDrafts = {
|
|
22502
|
+
get: async (slug, draftId) => (await this.#get(
|
|
22503
|
+
`/workspaces/${encodeURIComponent(slug)}/time-drafts/${encodeURIComponent(draftId)}`
|
|
22504
|
+
)).draft,
|
|
22505
|
+
/** The member's week around `day`, read by the agent that drafts it. */
|
|
22506
|
+
memberWeek: (slug, memberId, day) => this.#get(
|
|
22507
|
+
`/workspaces/${encodeURIComponent(slug)}/members/${encodeURIComponent(memberId)}/week`,
|
|
22508
|
+
{ day }
|
|
22509
|
+
),
|
|
22510
|
+
request: (slug, input) => this.dispatch("timeDraft.request", slug, input),
|
|
22511
|
+
save: (slug, input) => this.dispatch("timeDraft.save", slug, input),
|
|
22512
|
+
confirm: (slug, input) => this.dispatch("timeDraft.confirm", slug, input),
|
|
22513
|
+
dismiss: (slug, input) => this.dispatch("timeDraft.dismiss", slug, input),
|
|
22514
|
+
reply: (slug, input) => this.dispatch("timeDraft.reply", slug, input)
|
|
22515
|
+
};
|
|
22516
|
+
/** Close, invoice and reopen a client's month (admins only). */
|
|
22517
|
+
billingPeriods = {
|
|
22518
|
+
close: (slug, input) => this.dispatch("billingPeriod.close", slug, input),
|
|
22519
|
+
markInvoiced: (slug, input) => this.dispatch("billingPeriod.markInvoiced", slug, input),
|
|
22520
|
+
reopen: (slug, input) => this.dispatch("billingPeriod.reopen", slug, input)
|
|
22521
|
+
};
|
|
22466
22522
|
projects = {
|
|
22467
22523
|
list: async (slug) => (await this.#get(
|
|
22468
22524
|
`/workspaces/${encodeURIComponent(slug)}/projects`
|
|
@@ -22583,6 +22639,19 @@ var TasqClient = class _TasqClient {
|
|
|
22583
22639
|
`/workspaces/${encodeURIComponent(slug)}/labels`
|
|
22584
22640
|
)).labels
|
|
22585
22641
|
};
|
|
22642
|
+
/**
|
|
22643
|
+
* Custom fields (6.4): the workspace library, archived fields included.
|
|
22644
|
+
* Values are set with `task.setField` and `project.setField`, by field key.
|
|
22645
|
+
*/
|
|
22646
|
+
fields = {
|
|
22647
|
+
list: async (slug) => (await this.#get(
|
|
22648
|
+
`/workspaces/${encodeURIComponent(slug)}/fields`
|
|
22649
|
+
)).fields,
|
|
22650
|
+
/** Set a task's value; null, `[]` or `false` clears it. */
|
|
22651
|
+
setTaskValue: (slug, taskId, fieldKey, value) => this.dispatch("task.setField", slug, { taskId, fieldKey, value }),
|
|
22652
|
+
/** Set a project field's value; null clears it. */
|
|
22653
|
+
setProjectValue: (slug, projectId, fieldKey, value) => this.dispatch("project.setField", slug, { projectId, fieldKey, value })
|
|
22654
|
+
};
|
|
22586
22655
|
agents = {
|
|
22587
22656
|
policy: (slug, agentId) => this.#get(
|
|
22588
22657
|
`/workspaces/${encodeURIComponent(slug)}/agents/${encodeURIComponent(agentId)}/policy`
|
|
@@ -30693,7 +30762,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
30693
30762
|
// package.json
|
|
30694
30763
|
var package_default = {
|
|
30695
30764
|
name: "@pxlabz/tasq-mcp",
|
|
30696
|
-
version: "0.1.
|
|
30765
|
+
version: "0.1.19",
|
|
30697
30766
|
description: "MCP stdio server for Tasq: tasks, threads, comments and mentions for MCP-capable agents",
|
|
30698
30767
|
keywords: [
|
|
30699
30768
|
"tasq",
|
|
@@ -30891,6 +30960,80 @@ function deliveryLines(outcomes, nameByAgentId, nameByMemberId = /* @__PURE__ */
|
|
|
30891
30960
|
return lines;
|
|
30892
30961
|
}
|
|
30893
30962
|
|
|
30963
|
+
// src/fields.ts
|
|
30964
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
30965
|
+
var FIELD_VALUE_INPUT = external_exports.union([
|
|
30966
|
+
external_exports.string(),
|
|
30967
|
+
external_exports.number(),
|
|
30968
|
+
external_exports.boolean(),
|
|
30969
|
+
external_exports.array(external_exports.string()),
|
|
30970
|
+
external_exports.null()
|
|
30971
|
+
]);
|
|
30972
|
+
function compactField(field) {
|
|
30973
|
+
return {
|
|
30974
|
+
id: field.id,
|
|
30975
|
+
key: field.key,
|
|
30976
|
+
name: field.name,
|
|
30977
|
+
type: field.type,
|
|
30978
|
+
appliesTo: field.appliesTo,
|
|
30979
|
+
options: field.options.filter((option) => option.archivedAt === null).map((option) => option.name),
|
|
30980
|
+
archived: field.archivedAt !== null
|
|
30981
|
+
};
|
|
30982
|
+
}
|
|
30983
|
+
function takesList(field) {
|
|
30984
|
+
return field.type === "multi_select" || field.type === "people";
|
|
30985
|
+
}
|
|
30986
|
+
function asPicks(value) {
|
|
30987
|
+
const picks = Array.isArray(value) ? value : String(value).split(",");
|
|
30988
|
+
return picks.map((pick2) => pick2.trim()).filter((pick2) => pick2 !== "");
|
|
30989
|
+
}
|
|
30990
|
+
function resolvePerson(members, field, ref) {
|
|
30991
|
+
if (UUID_PATTERN.test(ref)) return ref;
|
|
30992
|
+
const wanted = ref.toLowerCase();
|
|
30993
|
+
const matched = members.filter(
|
|
30994
|
+
(member) => member.role !== "guest" && ((member.name ?? "").toLowerCase() === wanted || member.type === "user" && (member.email ?? "").toLowerCase() === wanted)
|
|
30995
|
+
);
|
|
30996
|
+
const [only] = matched;
|
|
30997
|
+
if (only === void 0) {
|
|
30998
|
+
throw new UsageError(
|
|
30999
|
+
`No member named "${ref}" for ${field.name}. Pass a name, an email or a member id.`
|
|
31000
|
+
);
|
|
31001
|
+
}
|
|
31002
|
+
if (matched.length > 1) {
|
|
31003
|
+
throw new UsageError(
|
|
31004
|
+
`"${ref}" matches ${matched.length} members for ${field.name}. Pass their email or member id.`
|
|
31005
|
+
);
|
|
31006
|
+
}
|
|
31007
|
+
return only.id;
|
|
31008
|
+
}
|
|
31009
|
+
async function resolveFieldEdits(client, slug, fields) {
|
|
31010
|
+
if (fields.size === 0) return [];
|
|
31011
|
+
const library = await client.fields.list(slug);
|
|
31012
|
+
const taskFields = library.filter(
|
|
31013
|
+
(field) => field.appliesTo === "task" && field.archivedAt === null
|
|
31014
|
+
);
|
|
31015
|
+
const settled = [...fields].map(([key, value]) => {
|
|
31016
|
+
const wanted = key.trim().toLowerCase();
|
|
31017
|
+
const field = taskFields.find((candidate) => candidate.key === wanted);
|
|
31018
|
+
if (field === void 0) {
|
|
31019
|
+
throw new UsageError(
|
|
31020
|
+
taskFields.length === 0 ? `Unknown field "${key}". This workspace has no task fields.` : `Unknown field "${key}". Task fields: ${taskFields.map((candidate) => candidate.key).join(", ")}. Call field_list for their types and options.`
|
|
31021
|
+
);
|
|
31022
|
+
}
|
|
31023
|
+
if (value === null || !takesList(field)) return { field, value };
|
|
31024
|
+
const picks = asPicks(value);
|
|
31025
|
+
return { field, value: picks.length === 0 ? null : picks };
|
|
31026
|
+
});
|
|
31027
|
+
const needsMembers = settled.some(
|
|
31028
|
+
(edit) => edit.field.type === "people" && edit.value !== null
|
|
31029
|
+
);
|
|
31030
|
+
const members = needsMembers ? await client.members.list(slug) : [];
|
|
31031
|
+
return settled.map(({ field, value }) => ({
|
|
31032
|
+
key: field.key,
|
|
31033
|
+
value: field.type === "people" && Array.isArray(value) ? value.map((ref) => resolvePerson(members, field, ref)) : value
|
|
31034
|
+
}));
|
|
31035
|
+
}
|
|
31036
|
+
|
|
30894
31037
|
// src/render/thread-context.ts
|
|
30895
31038
|
function entityHeading(entity) {
|
|
30896
31039
|
return entity.key === null ? `**${entity.title}**` : `**${entity.key}** \u2014 ${entity.title}`;
|
|
@@ -30966,11 +31109,11 @@ function renderThreadContext(bundle) {
|
|
|
30966
31109
|
}
|
|
30967
31110
|
|
|
30968
31111
|
// src/resolve.ts
|
|
30969
|
-
var
|
|
31112
|
+
var UUID_PATTERN2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
30970
31113
|
var TASK_KEY_PATTERN = /^([A-Za-z][A-Za-z0-9]*)-(\d+)$/;
|
|
30971
31114
|
async function resolveTaskId(client, slug, ref) {
|
|
30972
31115
|
const trimmed = ref.trim();
|
|
30973
|
-
if (
|
|
31116
|
+
if (UUID_PATTERN2.test(trimmed)) return trimmed;
|
|
30974
31117
|
const match = TASK_KEY_PATTERN.exec(trimmed);
|
|
30975
31118
|
if (match?.[1] === void 0 || match[2] === void 0) {
|
|
30976
31119
|
throw new UsageError(
|
|
@@ -31025,7 +31168,7 @@ async function resolveLabelIds(client, slug, names) {
|
|
|
31025
31168
|
}
|
|
31026
31169
|
async function resolveProjectId(client, slug, ref) {
|
|
31027
31170
|
const trimmed = ref.trim();
|
|
31028
|
-
if (
|
|
31171
|
+
if (UUID_PATTERN2.test(trimmed)) return trimmed;
|
|
31029
31172
|
const wanted = trimmed.toLowerCase();
|
|
31030
31173
|
const projects = await client.projects.list(slug);
|
|
31031
31174
|
const matched = projects.filter(
|
|
@@ -31043,6 +31186,25 @@ async function resolveProjectId(client, slug, ref) {
|
|
|
31043
31186
|
}
|
|
31044
31187
|
return matched[0]?.id ?? "";
|
|
31045
31188
|
}
|
|
31189
|
+
async function resolveClientId(client, slug, ref) {
|
|
31190
|
+
const trimmed = ref.trim();
|
|
31191
|
+
if (UUID_PATTERN2.test(trimmed)) return trimmed;
|
|
31192
|
+
const wanted = trimmed.toLowerCase();
|
|
31193
|
+
const matched = (await client.initiatives.list(slug)).filter(
|
|
31194
|
+
(initiative) => initiative.name.toLowerCase() === wanted
|
|
31195
|
+
);
|
|
31196
|
+
if (matched.length === 0) {
|
|
31197
|
+
throw new UsageError(
|
|
31198
|
+
`No client named "${ref}" in this workspace. Call initiative_list to see the names.`
|
|
31199
|
+
);
|
|
31200
|
+
}
|
|
31201
|
+
if (matched.length > 1) {
|
|
31202
|
+
throw new UsageError(
|
|
31203
|
+
`"${ref}" matches ${matched.length} clients. Pass the client id.`
|
|
31204
|
+
);
|
|
31205
|
+
}
|
|
31206
|
+
return matched[0]?.id ?? "";
|
|
31207
|
+
}
|
|
31046
31208
|
function mentionCandidate(member) {
|
|
31047
31209
|
const name = member.name ?? "(no name)";
|
|
31048
31210
|
return member.type === "agent" ? `${name} (agent)` : `${name} <${member.email ?? "no email"}> (person)`;
|
|
@@ -31075,7 +31237,7 @@ function resolveMentions(members, names) {
|
|
|
31075
31237
|
}
|
|
31076
31238
|
async function resolveApproverId(client, slug, ref) {
|
|
31077
31239
|
const trimmed = ref.trim();
|
|
31078
|
-
if (
|
|
31240
|
+
if (UUID_PATTERN2.test(trimmed)) return trimmed;
|
|
31079
31241
|
const wanted = trimmed.toLowerCase();
|
|
31080
31242
|
const members = await client.members.list(slug);
|
|
31081
31243
|
const matched = members.filter(
|
|
@@ -31109,7 +31271,7 @@ function resolveDurationMinutes(raw) {
|
|
|
31109
31271
|
}
|
|
31110
31272
|
function resolveTimeEntryId(ref) {
|
|
31111
31273
|
const trimmed = ref.trim();
|
|
31112
|
-
if (!
|
|
31274
|
+
if (!UUID_PATTERN2.test(trimmed)) {
|
|
31113
31275
|
throw new UsageError(
|
|
31114
31276
|
`"${ref}" is not a time entry id. Call time_list on the task to see the ids.`
|
|
31115
31277
|
);
|
|
@@ -31142,6 +31304,30 @@ function datesInput(taskId, input) {
|
|
|
31142
31304
|
}
|
|
31143
31305
|
return action;
|
|
31144
31306
|
}
|
|
31307
|
+
var FIELDS_INPUT = external_exports.record(external_exports.string(), FIELD_VALUE_INPUT).describe(
|
|
31308
|
+
'Custom field values by key, e.g. {"budget": 1200, "tier": "Gold", "areas": ["Web", "API"]}: options and people by name, null clears. Call field_list for the keys.'
|
|
31309
|
+
);
|
|
31310
|
+
function fieldPairs(fields) {
|
|
31311
|
+
return new Map(Object.entries(fields ?? {}));
|
|
31312
|
+
}
|
|
31313
|
+
async function applyFieldEdits(client, slug, steps, taskId, edits) {
|
|
31314
|
+
const lines = [];
|
|
31315
|
+
for (const edit of edits) {
|
|
31316
|
+
const response = await steps.run(
|
|
31317
|
+
`field "${edit.key}"`,
|
|
31318
|
+
() => client.dispatch("task.setField", slug, {
|
|
31319
|
+
taskId,
|
|
31320
|
+
fieldKey: edit.key,
|
|
31321
|
+
value: edit.value
|
|
31322
|
+
})
|
|
31323
|
+
);
|
|
31324
|
+
const { field, display } = response.result;
|
|
31325
|
+
lines.push(
|
|
31326
|
+
display.value === null ? `${field.name}: cleared.` : `${field.name}: ${display.value}.`
|
|
31327
|
+
);
|
|
31328
|
+
}
|
|
31329
|
+
return lines;
|
|
31330
|
+
}
|
|
31145
31331
|
var BILLABLE_INPUT = external_exports.enum(["yes", "no", "unset"]);
|
|
31146
31332
|
var BILLABLE_VALUES = {
|
|
31147
31333
|
yes: "billable",
|
|
@@ -31149,6 +31335,7 @@ var BILLABLE_VALUES = {
|
|
|
31149
31335
|
unset: "not_set"
|
|
31150
31336
|
};
|
|
31151
31337
|
var DURATION_INPUT = external_exports.string().describe("How long, e.g. 1h 30m, 90m, 1.5h or 1:30; at most 24h per entry.");
|
|
31338
|
+
var billingMonth = external_exports.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/).describe("YYYY-MM, the month to act on.");
|
|
31152
31339
|
var workspaceFields = {
|
|
31153
31340
|
workspace: external_exports.string().optional().describe("Workspace slug; defaults to TASQ_WORKSPACE.")
|
|
31154
31341
|
};
|
|
@@ -31291,7 +31478,8 @@ var definitions = [
|
|
|
31291
31478
|
start: DATE_INPUT.optional().describe("Start date, YYYY-MM-DD."),
|
|
31292
31479
|
parent: external_exports.string().optional().describe(
|
|
31293
31480
|
"Parent task key such as ENG-42, or a task id, to create this as its subtask."
|
|
31294
|
-
)
|
|
31481
|
+
),
|
|
31482
|
+
fields: FIELDS_INPUT.optional()
|
|
31295
31483
|
}),
|
|
31296
31484
|
run: async ({ client, config: config2 }, input) => {
|
|
31297
31485
|
const slug = requireWorkspace(config2, input);
|
|
@@ -31308,6 +31496,11 @@ var definitions = [
|
|
|
31308
31496
|
);
|
|
31309
31497
|
const labelNames = input.labels === void 0 || input.labels === "" ? [] : input.labels.split(",").map((name) => name.trim());
|
|
31310
31498
|
const labelIds = labelNames.length === 0 ? [] : await resolveLabelIds(client, slug, labelNames);
|
|
31499
|
+
const fieldEdits = await resolveFieldEdits(
|
|
31500
|
+
client,
|
|
31501
|
+
slug,
|
|
31502
|
+
fieldPairs(input.fields)
|
|
31503
|
+
);
|
|
31311
31504
|
const action = {
|
|
31312
31505
|
teamIdentifier,
|
|
31313
31506
|
title: input.title
|
|
@@ -31341,12 +31534,19 @@ var definitions = [
|
|
|
31341
31534
|
})
|
|
31342
31535
|
);
|
|
31343
31536
|
}
|
|
31344
|
-
|
|
31537
|
+
const lines = await applyFieldEdits(
|
|
31538
|
+
client,
|
|
31539
|
+
slug,
|
|
31540
|
+
steps,
|
|
31541
|
+
created.result.task.id,
|
|
31542
|
+
fieldEdits
|
|
31543
|
+
);
|
|
31544
|
+
return { data: created.result, lines };
|
|
31345
31545
|
}
|
|
31346
31546
|
}),
|
|
31347
31547
|
define({
|
|
31348
31548
|
name: "task_update",
|
|
31349
|
-
description: "Update a task's title, description, priority, status, dates or
|
|
31549
|
+
description: "Update a task's title, description, priority, status, dates, parent or custom fields.",
|
|
31350
31550
|
schema: external_exports.object({
|
|
31351
31551
|
...workspaceFields,
|
|
31352
31552
|
id: external_exports.string().describe("Task key such as ENG-42, or a task id."),
|
|
@@ -31362,15 +31562,21 @@ var definitions = [
|
|
|
31362
31562
|
),
|
|
31363
31563
|
parent: external_exports.string().optional().describe(
|
|
31364
31564
|
'Parent task key such as ENG-42 or a task id, or "none" to detach it.'
|
|
31365
|
-
)
|
|
31565
|
+
),
|
|
31566
|
+
fields: FIELDS_INPUT.optional()
|
|
31366
31567
|
}),
|
|
31367
31568
|
run: async ({ client, config: config2 }, input) => {
|
|
31368
31569
|
const slug = requireWorkspace(config2, input);
|
|
31369
|
-
if (input.title === void 0 && input.description === void 0 && input.priority === void 0 && input.status === void 0 && input.due === void 0 && input.start === void 0 && input.parent === void 0) {
|
|
31570
|
+
if (input.title === void 0 && input.description === void 0 && input.priority === void 0 && input.status === void 0 && input.due === void 0 && input.start === void 0 && input.parent === void 0 && fieldPairs(input.fields).size === 0) {
|
|
31370
31571
|
throw new UsageError(
|
|
31371
|
-
"Nothing to update. Pass at least one of title, description, priority, status, due, start, parent."
|
|
31572
|
+
"Nothing to update. Pass at least one of title, description, priority, status, due, start, parent, fields."
|
|
31372
31573
|
);
|
|
31373
31574
|
}
|
|
31575
|
+
const fieldEdits = await resolveFieldEdits(
|
|
31576
|
+
client,
|
|
31577
|
+
slug,
|
|
31578
|
+
fieldPairs(input.fields)
|
|
31579
|
+
);
|
|
31374
31580
|
const parentTaskId = input.parent === void 0 ? void 0 : input.parent === "none" ? null : await resolveTaskId(client, slug, input.parent);
|
|
31375
31581
|
const taskId = await resolveTaskId(client, slug, input.id);
|
|
31376
31582
|
const task = await client.tasks.get(slug, taskId);
|
|
@@ -31428,7 +31634,15 @@ var definitions = [
|
|
|
31428
31634
|
});
|
|
31429
31635
|
});
|
|
31430
31636
|
}
|
|
31431
|
-
|
|
31637
|
+
const lines = await applyFieldEdits(
|
|
31638
|
+
client,
|
|
31639
|
+
slug,
|
|
31640
|
+
steps,
|
|
31641
|
+
task.id,
|
|
31642
|
+
fieldEdits
|
|
31643
|
+
);
|
|
31644
|
+
const updated = await client.tasks.get(slug, task.id);
|
|
31645
|
+
return { data: updated, lines };
|
|
31432
31646
|
}
|
|
31433
31647
|
}),
|
|
31434
31648
|
define({
|
|
@@ -31451,6 +31665,21 @@ var definitions = [
|
|
|
31451
31665
|
return { data: response.result };
|
|
31452
31666
|
}
|
|
31453
31667
|
}),
|
|
31668
|
+
define({
|
|
31669
|
+
name: "field_list",
|
|
31670
|
+
description: "List the workspace's custom fields: the keys task_create and task_update take in fields, with types and option names.",
|
|
31671
|
+
schema: external_exports.object({
|
|
31672
|
+
...workspaceFields,
|
|
31673
|
+
all: external_exports.boolean().optional().describe("Include archived fields, which take no new values.")
|
|
31674
|
+
}),
|
|
31675
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31676
|
+
const library = await client.fields.list(
|
|
31677
|
+
requireWorkspace(config2, input)
|
|
31678
|
+
);
|
|
31679
|
+
const fields = input.all === true ? library : library.filter((field) => field.archivedAt === null);
|
|
31680
|
+
return { data: fields.map(compactField) };
|
|
31681
|
+
}
|
|
31682
|
+
}),
|
|
31454
31683
|
define({
|
|
31455
31684
|
name: "time_log",
|
|
31456
31685
|
description: "Log time worked on a task for one day, as yourself.",
|
|
@@ -31551,6 +31780,179 @@ var definitions = [
|
|
|
31551
31780
|
return { data: response.result };
|
|
31552
31781
|
}
|
|
31553
31782
|
}),
|
|
31783
|
+
define({
|
|
31784
|
+
name: "client_hours",
|
|
31785
|
+
description: "One month of a client's logged hours by billable flag, project and person, plus the entries with no billable flag yet.",
|
|
31786
|
+
schema: external_exports.object({
|
|
31787
|
+
...workspaceFields,
|
|
31788
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31789
|
+
month: external_exports.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/).optional().describe("YYYY-MM (default: this month)."),
|
|
31790
|
+
billableOnly: external_exports.boolean().optional().describe("Count billable entries only.")
|
|
31791
|
+
}),
|
|
31792
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31793
|
+
const slug = requireWorkspace(config2, input);
|
|
31794
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31795
|
+
const month = input.month ?? localToday().slice(0, 7);
|
|
31796
|
+
const hours = await client.clients.hours(slug, clientId, month, {
|
|
31797
|
+
billableOnly: input.billableOnly === true
|
|
31798
|
+
});
|
|
31799
|
+
return {
|
|
31800
|
+
data: hours,
|
|
31801
|
+
lines: [
|
|
31802
|
+
`${hours.name}, ${hours.month}: ${formatMinutes(hours.totals.total)} logged, ${formatMinutes(hours.totals.billable)} billable, ${formatMinutes(hours.totals.notSet)} not set.`
|
|
31803
|
+
]
|
|
31804
|
+
};
|
|
31805
|
+
}
|
|
31806
|
+
}),
|
|
31807
|
+
define({
|
|
31808
|
+
name: "my_week",
|
|
31809
|
+
description: "Your Monday-to-Sunday week of logged time, one day's entries, and the tasks you changed or commented on that day without logging time.",
|
|
31810
|
+
schema: external_exports.object({
|
|
31811
|
+
...workspaceFields,
|
|
31812
|
+
day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("YYYY-MM-DD (default: today).")
|
|
31813
|
+
}),
|
|
31814
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31815
|
+
const slug = requireWorkspace(config2, input);
|
|
31816
|
+
const day = input.day ?? localToday();
|
|
31817
|
+
const result2 = await client.me.week(slug, day, {
|
|
31818
|
+
tz: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
31819
|
+
});
|
|
31820
|
+
return {
|
|
31821
|
+
data: result2,
|
|
31822
|
+
lines: [
|
|
31823
|
+
`Week of ${result2.from}: ${formatMinutes(result2.totalMinutes)} logged; ${result2.day}: ${result2.entries.length} entries, ${result2.unlogged.length} tasks with no time yet.`
|
|
31824
|
+
]
|
|
31825
|
+
};
|
|
31826
|
+
}
|
|
31827
|
+
}),
|
|
31828
|
+
define({
|
|
31829
|
+
name: "time_draft_get",
|
|
31830
|
+
description: "Read the timesheet draft a timesheet_due or timesheet_reply event names, with the member's day and the conversation.",
|
|
31831
|
+
schema: external_exports.object({
|
|
31832
|
+
...workspaceFields,
|
|
31833
|
+
draftId: external_exports.string().uuid().describe("The timeDraftId from the event.")
|
|
31834
|
+
}),
|
|
31835
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31836
|
+
const slug = requireWorkspace(config2, input);
|
|
31837
|
+
const draft = await client.timeDrafts.get(slug, input.draftId);
|
|
31838
|
+
const day = await client.timeDrafts.memberWeek(slug, draft.memberId, draft.day);
|
|
31839
|
+
return {
|
|
31840
|
+
data: { draft, day },
|
|
31841
|
+
lines: [
|
|
31842
|
+
`Draft for ${draft.day} (${draft.state}): ${day.unlogged.length} tasks with no time, ${day.entries.length} entries already logged, ${draft.messages.length} messages.`
|
|
31843
|
+
]
|
|
31844
|
+
};
|
|
31845
|
+
}
|
|
31846
|
+
}),
|
|
31847
|
+
define({
|
|
31848
|
+
name: "time_draft_save",
|
|
31849
|
+
description: "Save a timesheet draft's lines, replacing earlier ones; nothing is logged until the member confirms.",
|
|
31850
|
+
schema: external_exports.object({
|
|
31851
|
+
...workspaceFields,
|
|
31852
|
+
draftId: external_exports.string().uuid().describe("The draft to write."),
|
|
31853
|
+
lines: external_exports.array(
|
|
31854
|
+
external_exports.object({
|
|
31855
|
+
task: external_exports.string().describe("Task key such as ENG-12, or a task UUID."),
|
|
31856
|
+
duration: external_exports.string().describe("How long, such as 1h30m, 45m or 1.5h."),
|
|
31857
|
+
billable: BILLABLE_INPUT.optional().describe("yes or no; unset by default."),
|
|
31858
|
+
evidence: external_exports.string().max(200).optional().describe("One line on why, such as 2 comments, moved to In review.")
|
|
31859
|
+
})
|
|
31860
|
+
).max(30),
|
|
31861
|
+
message: external_exports.string().max(2e3).optional().describe("A short note to the member about the draft.")
|
|
31862
|
+
}),
|
|
31863
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31864
|
+
const slug = requireWorkspace(config2, input);
|
|
31865
|
+
const lines = [];
|
|
31866
|
+
for (const line of input.lines) {
|
|
31867
|
+
const draftLine = {
|
|
31868
|
+
taskId: await resolveTaskId(client, slug, line.task),
|
|
31869
|
+
minutes: resolveDurationMinutes(line.duration)
|
|
31870
|
+
};
|
|
31871
|
+
if (line.billable !== void 0) draftLine.billable = BILLABLE_VALUES[line.billable];
|
|
31872
|
+
if (line.evidence !== void 0) draftLine.evidence = line.evidence;
|
|
31873
|
+
lines.push(draftLine);
|
|
31874
|
+
}
|
|
31875
|
+
const save = { draftId: input.draftId, lines };
|
|
31876
|
+
if (input.message !== void 0) save.message = input.message;
|
|
31877
|
+
const response = await client.timeDrafts.save(slug, save);
|
|
31878
|
+
return { data: response.result };
|
|
31879
|
+
}
|
|
31880
|
+
}),
|
|
31881
|
+
define({
|
|
31882
|
+
name: "client_billing",
|
|
31883
|
+
description: "A client's billing months, newest first: each month's hours and whether it is open, closed or invoiced.",
|
|
31884
|
+
schema: external_exports.object({
|
|
31885
|
+
...workspaceFields,
|
|
31886
|
+
client: external_exports.string().describe("Client (initiative) id or name.")
|
|
31887
|
+
}),
|
|
31888
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31889
|
+
const slug = requireWorkspace(config2, input);
|
|
31890
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31891
|
+
const billing = await client.clients.billing(slug, clientId);
|
|
31892
|
+
return {
|
|
31893
|
+
data: billing,
|
|
31894
|
+
lines: billing.months.map(
|
|
31895
|
+
(month) => `${month.month}: ${formatMinutes(month.total)} logged, ${month.period ? month.period.state : "open"}.`
|
|
31896
|
+
)
|
|
31897
|
+
};
|
|
31898
|
+
}
|
|
31899
|
+
}),
|
|
31900
|
+
define({
|
|
31901
|
+
name: "billing_period_close",
|
|
31902
|
+
description: "Close a client's month so its hours can no longer be logged, edited or moved (admins only).",
|
|
31903
|
+
schema: external_exports.object({
|
|
31904
|
+
...workspaceFields,
|
|
31905
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31906
|
+
month: billingMonth
|
|
31907
|
+
}),
|
|
31908
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31909
|
+
const slug = requireWorkspace(config2, input);
|
|
31910
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31911
|
+
const response = await client.billingPeriods.close(slug, {
|
|
31912
|
+
clientId,
|
|
31913
|
+
month: input.month
|
|
31914
|
+
});
|
|
31915
|
+
return { data: response.result };
|
|
31916
|
+
}
|
|
31917
|
+
}),
|
|
31918
|
+
define({
|
|
31919
|
+
name: "billing_period_mark_invoiced",
|
|
31920
|
+
description: "Mark a client's month invoiced with an optional reference label, closing it if it is still open (admins only).",
|
|
31921
|
+
schema: external_exports.object({
|
|
31922
|
+
...workspaceFields,
|
|
31923
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31924
|
+
month: billingMonth,
|
|
31925
|
+
invoiceRef: external_exports.string().max(120).optional().describe("Invoice number or reference, to find the invoice elsewhere.")
|
|
31926
|
+
}),
|
|
31927
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31928
|
+
const slug = requireWorkspace(config2, input);
|
|
31929
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31930
|
+
const response = await client.billingPeriods.markInvoiced(slug, {
|
|
31931
|
+
clientId,
|
|
31932
|
+
month: input.month,
|
|
31933
|
+
invoiceRef: input.invoiceRef ?? null
|
|
31934
|
+
});
|
|
31935
|
+
return { data: response.result };
|
|
31936
|
+
}
|
|
31937
|
+
}),
|
|
31938
|
+
define({
|
|
31939
|
+
name: "billing_period_reopen",
|
|
31940
|
+
description: "Reopen a client's closed or invoiced month so its hours can change again (admins only).",
|
|
31941
|
+
schema: external_exports.object({
|
|
31942
|
+
...workspaceFields,
|
|
31943
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31944
|
+
month: billingMonth
|
|
31945
|
+
}),
|
|
31946
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31947
|
+
const slug = requireWorkspace(config2, input);
|
|
31948
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31949
|
+
const response = await client.billingPeriods.reopen(slug, {
|
|
31950
|
+
clientId,
|
|
31951
|
+
month: input.month
|
|
31952
|
+
});
|
|
31953
|
+
return { data: response.result };
|
|
31954
|
+
}
|
|
31955
|
+
}),
|
|
31554
31956
|
define({
|
|
31555
31957
|
name: "comment_add",
|
|
31556
31958
|
description: "Comment on a task or a project, optionally replying and mentioning people or agents.",
|