@pxlabz/tasq-cli 0.1.21 → 0.1.23
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 +6 -1
- package/README.md +4 -0
- package/dist/tasq.js +246 -28
- package/package.json +1 -1
package/.tasq-skill.md
CHANGED
|
@@ -45,10 +45,13 @@ tasq task create <title> [--team <identifier>] [--description <markdown>]
|
|
|
45
45
|
[--priority <priority>] [--project <id>]
|
|
46
46
|
[--labels <a,b,c>] [--due <YYYY-MM-DD>]
|
|
47
47
|
[--start <YYYY-MM-DD>] [--parent <ref>]
|
|
48
|
+
[--field <key=value>]…
|
|
48
49
|
tasq task update <ref> [--title <title>] [--description <markdown>]
|
|
49
50
|
[--priority <priority>] [--status <name>]
|
|
50
51
|
[--due <YYYY-MM-DD|none>] [--start <YYYY-MM-DD|none>]
|
|
51
|
-
[--parent <ref> | --no-parent]
|
|
52
|
+
[--parent <ref> | --no-parent] [--field <key=value>]…
|
|
53
|
+
|
|
54
|
+
tasq field list [--all]
|
|
52
55
|
|
|
53
56
|
tasq comment add <ref> <body> [--reply-to <commentRef>] [--thread <threadId>]
|
|
54
57
|
[--mention <name>]…
|
|
@@ -88,6 +91,8 @@ tasq auth whoami
|
|
|
88
91
|
|
|
89
92
|
`--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.
|
|
90
93
|
|
|
94
|
+
Custom fields: `tasq field list` shows each field's key, type, whether it applies to tasks or projects, and a select's option names (`--all` adds archived fields). `--field key=value` sets one on `task create` or `task update`, repeatable, one step per field after the task is written; `update` with only `--field` is fine. A multi-select or people field takes `a,b`; options and people go by name, a person also by email; `key=` clears it. Anything else is read forgivingly by the server (`1,200` is a number, `yes` ticks a checkbox) and a value that cannot fit is refused with the reason. An unknown key is a usage error naming the task fields, before anything is written. `task view` lists the values under `Fields:`.
|
|
95
|
+
|
|
91
96
|
`--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.
|
|
92
97
|
|
|
93
98
|
`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.
|
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ 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 task create|update … [--field <key=value>]…
|
|
31
|
+
tasq field list [--all]
|
|
30
32
|
tasq comment add <ref> <body> [--reply-to <commentRef>] [--mention <name>]…
|
|
31
33
|
tasq time log <ref> <duration> [--day YYYY-MM-DD] [--note <text>] [--billable yes|no]
|
|
32
34
|
tasq time list <ref> | edit <entryId> [--duration] [--day] [--note | --no-note] [--billable] | delete <entryId>
|
|
@@ -42,6 +44,8 @@ tasq auth login | logout
|
|
|
42
44
|
|
|
43
45
|
`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.
|
|
44
46
|
|
|
47
|
+
`field list` prints the workspace's custom fields with the key `--field` takes, the type, whether it applies to tasks or projects, and a select's option names; `--all` includes archived ones. `--field key=value` is repeatable on `task create` and `task update` and is set after the task is written, one step per field. A multi-select or people field takes `a,b`; options and people go by name (a person also by email); `key=` clears the field. The action reads the rest forgivingly (`1,200` is a number, `yes` ticks a checkbox) and says why when it cannot. `task view` lists the task's values under `Fields:`.
|
|
48
|
+
|
|
45
49
|
`time log` reads a duration as `1h 30m`, `1h30m`, `90m`, `1.5h` or `1:30` (quotes optional) and logs it on today, your local date, unless `--day` says otherwise. One entry is at most 24 hours. `time list` prints each entry with its id, then the total including direct subtasks. Time tracking is member-only: a guest is refused.
|
|
46
50
|
|
|
47
51
|
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.
|
package/dist/tasq.js
CHANGED
|
@@ -6786,6 +6786,19 @@ var TasqClient = class _TasqClient {
|
|
|
6786
6786
|
`/workspaces/${encodeURIComponent(slug)}/labels`
|
|
6787
6787
|
)).labels
|
|
6788
6788
|
};
|
|
6789
|
+
/**
|
|
6790
|
+
* Custom fields (6.4): the workspace library, archived fields included.
|
|
6791
|
+
* Values are set with `task.setField` and `project.setField`, by field key.
|
|
6792
|
+
*/
|
|
6793
|
+
fields = {
|
|
6794
|
+
list: async (slug) => (await this.#get(
|
|
6795
|
+
`/workspaces/${encodeURIComponent(slug)}/fields`
|
|
6796
|
+
)).fields,
|
|
6797
|
+
/** Set a task's value; null, `[]` or `false` clears it. */
|
|
6798
|
+
setTaskValue: (slug, taskId, fieldKey, value) => this.dispatch("task.setField", slug, { taskId, fieldKey, value }),
|
|
6799
|
+
/** Set a project field's value; null clears it. */
|
|
6800
|
+
setProjectValue: (slug, projectId, fieldKey, value) => this.dispatch("project.setField", slug, { projectId, fieldKey, value })
|
|
6801
|
+
};
|
|
6789
6802
|
agents = {
|
|
6790
6803
|
policy: (slug, agentId) => this.#get(
|
|
6791
6804
|
`/workspaces/${encodeURIComponent(slug)}/agents/${encodeURIComponent(agentId)}/policy`
|
|
@@ -7004,7 +7017,7 @@ function reportError(error, io2) {
|
|
|
7004
7017
|
// package.json
|
|
7005
7018
|
var package_default = {
|
|
7006
7019
|
name: "@pxlabz/tasq-cli",
|
|
7007
|
-
version: "0.1.
|
|
7020
|
+
version: "0.1.23",
|
|
7008
7021
|
description: "Command-line client for Tasq, for humans and agents alike",
|
|
7009
7022
|
keywords: [
|
|
7010
7023
|
"tasq",
|
|
@@ -7182,6 +7195,21 @@ function formatProjects(projects) {
|
|
|
7182
7195
|
])
|
|
7183
7196
|
);
|
|
7184
7197
|
}
|
|
7198
|
+
function formatFields(fields) {
|
|
7199
|
+
if (fields.length === 0) return "No fields.";
|
|
7200
|
+
return table(
|
|
7201
|
+
["Key", "Name", "Type", "Applies to", "Options"],
|
|
7202
|
+
fields.map((field) => [
|
|
7203
|
+
field.key,
|
|
7204
|
+
field.archivedAt === null ? field.name : `${field.name} (archived)`,
|
|
7205
|
+
field.type,
|
|
7206
|
+
field.appliesTo,
|
|
7207
|
+
dash(
|
|
7208
|
+
field.options.filter((option) => option.archivedAt === null).map((option) => option.name).join(", ")
|
|
7209
|
+
)
|
|
7210
|
+
])
|
|
7211
|
+
);
|
|
7212
|
+
}
|
|
7185
7213
|
function formatInitiatives(initiatives) {
|
|
7186
7214
|
if (initiatives.length === 0) return "No initiatives.";
|
|
7187
7215
|
return table(
|
|
@@ -7706,6 +7734,14 @@ async function eventsAck(ctx, ids) {
|
|
|
7706
7734
|
line(ctx.io, { acked: page.acked });
|
|
7707
7735
|
}
|
|
7708
7736
|
|
|
7737
|
+
// src/commands/field.ts
|
|
7738
|
+
async function fieldList(ctx, options) {
|
|
7739
|
+
const slug = requireWorkspace(ctx.config);
|
|
7740
|
+
const library = await ctx.client.fields.list(slug);
|
|
7741
|
+
const fields = options.all === true ? library : library.filter((field) => field.archivedAt === null);
|
|
7742
|
+
ctx.io.out(ctx.config.json ? jsonOutput(fields) : formatFields(fields));
|
|
7743
|
+
}
|
|
7744
|
+
|
|
7709
7745
|
// src/project-ref.ts
|
|
7710
7746
|
var UUID_PATTERN3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7711
7747
|
async function resolveProject(client, slug, ref) {
|
|
@@ -8174,6 +8210,103 @@ async function threadContext(ctx, threadId, _options = {}) {
|
|
|
8174
8210
|
);
|
|
8175
8211
|
}
|
|
8176
8212
|
|
|
8213
|
+
// src/fields.ts
|
|
8214
|
+
var UUID_PATTERN5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8215
|
+
function parseFieldFlags(flags) {
|
|
8216
|
+
return flags.map((flag) => {
|
|
8217
|
+
const equals = flag.indexOf("=");
|
|
8218
|
+
const key = equals === -1 ? "" : flag.slice(0, equals).trim();
|
|
8219
|
+
if (key === "") {
|
|
8220
|
+
throw new UsageError(
|
|
8221
|
+
`--field takes key=value, such as --field budget=1200. Got "${flag}".`
|
|
8222
|
+
);
|
|
8223
|
+
}
|
|
8224
|
+
const raw = flag.slice(equals + 1).trim();
|
|
8225
|
+
return { key, value: raw === "" ? null : raw };
|
|
8226
|
+
});
|
|
8227
|
+
}
|
|
8228
|
+
function takesList(field) {
|
|
8229
|
+
return field.type === "multi_select" || field.type === "people";
|
|
8230
|
+
}
|
|
8231
|
+
function asPicks(value) {
|
|
8232
|
+
const picks = Array.isArray(value) ? value : String(value).split(",");
|
|
8233
|
+
return picks.map((pick) => pick.trim()).filter((pick) => pick !== "");
|
|
8234
|
+
}
|
|
8235
|
+
function resolvePerson(members, field, ref) {
|
|
8236
|
+
if (UUID_PATTERN5.test(ref)) return ref;
|
|
8237
|
+
const wanted = ref.toLowerCase();
|
|
8238
|
+
const matched = members.filter(
|
|
8239
|
+
(member) => member.role !== "guest" && ((member.name ?? "").toLowerCase() === wanted || member.type === "user" && (member.email ?? "").toLowerCase() === wanted)
|
|
8240
|
+
);
|
|
8241
|
+
const [only] = matched;
|
|
8242
|
+
if (only === void 0) {
|
|
8243
|
+
throw new UsageError(
|
|
8244
|
+
`No member named "${ref}" for ${field.name}. Pass a name, an email or a member id.`
|
|
8245
|
+
);
|
|
8246
|
+
}
|
|
8247
|
+
if (matched.length > 1) {
|
|
8248
|
+
throw new UsageError(
|
|
8249
|
+
`"${ref}" matches ${matched.length} members for ${field.name}. Pass their email or member id.`
|
|
8250
|
+
);
|
|
8251
|
+
}
|
|
8252
|
+
return only.id;
|
|
8253
|
+
}
|
|
8254
|
+
async function resolveFieldEdits(client, slug, edits) {
|
|
8255
|
+
if (edits.length === 0) return [];
|
|
8256
|
+
const library = await client.fields.list(slug);
|
|
8257
|
+
const taskFields = library.filter(
|
|
8258
|
+
(field) => field.appliesTo === "task" && field.archivedAt === null
|
|
8259
|
+
);
|
|
8260
|
+
const settled = edits.map((edit) => {
|
|
8261
|
+
const wanted = edit.key.toLowerCase();
|
|
8262
|
+
const field = taskFields.find((candidate) => candidate.key === wanted);
|
|
8263
|
+
if (field === void 0) {
|
|
8264
|
+
throw new UsageError(
|
|
8265
|
+
taskFields.length === 0 ? `Unknown field "${edit.key}". This workspace has no task fields.` : `Unknown field "${edit.key}". Task fields: ${taskFields.map((candidate) => candidate.key).join(", ")}.`
|
|
8266
|
+
);
|
|
8267
|
+
}
|
|
8268
|
+
if (edit.value === null || !takesList(field)) {
|
|
8269
|
+
return { field, value: edit.value };
|
|
8270
|
+
}
|
|
8271
|
+
const picks = asPicks(edit.value);
|
|
8272
|
+
return { field, value: picks.length === 0 ? null : picks };
|
|
8273
|
+
});
|
|
8274
|
+
const needsMembers = settled.some(
|
|
8275
|
+
(edit) => edit.field.type === "people" && edit.value !== null
|
|
8276
|
+
);
|
|
8277
|
+
const members = needsMembers ? await client.members.list(slug) : [];
|
|
8278
|
+
return settled.map(({ field, value }) => ({
|
|
8279
|
+
key: field.key,
|
|
8280
|
+
value: field.type === "people" && Array.isArray(value) ? value.map((ref) => resolvePerson(members, field, ref)) : value
|
|
8281
|
+
}));
|
|
8282
|
+
}
|
|
8283
|
+
function numberText(field, value) {
|
|
8284
|
+
const number = String(value);
|
|
8285
|
+
if (field.numberFormat === "percent") return `${number}%`;
|
|
8286
|
+
if (field.numberFormat === "currency" && field.currencyCode !== null) {
|
|
8287
|
+
return `${field.currencyCode} ${number}`;
|
|
8288
|
+
}
|
|
8289
|
+
return number;
|
|
8290
|
+
}
|
|
8291
|
+
function fieldValueText(field, value, memberName) {
|
|
8292
|
+
if (value === null) return "\u2014";
|
|
8293
|
+
const optionName = (id) => field.options.find((option) => option.id === id)?.name ?? "Removed option";
|
|
8294
|
+
const picks = Array.isArray(value) ? value : [String(value)];
|
|
8295
|
+
switch (field.type) {
|
|
8296
|
+
case "number":
|
|
8297
|
+
return numberText(field, value);
|
|
8298
|
+
case "checkbox":
|
|
8299
|
+
return value === true ? "yes" : "no";
|
|
8300
|
+
case "single_select":
|
|
8301
|
+
case "multi_select":
|
|
8302
|
+
return picks.map(optionName).join(", ");
|
|
8303
|
+
case "people":
|
|
8304
|
+
return picks.map(memberName).join(", ");
|
|
8305
|
+
default:
|
|
8306
|
+
return String(value);
|
|
8307
|
+
}
|
|
8308
|
+
}
|
|
8309
|
+
|
|
8177
8310
|
// src/commands/task.ts
|
|
8178
8311
|
var PRIORITIES = ["urgent", "high", "medium", "low", "none"];
|
|
8179
8312
|
function priority(value) {
|
|
@@ -8234,6 +8367,40 @@ var StepRunner = class {
|
|
|
8234
8367
|
return result;
|
|
8235
8368
|
}
|
|
8236
8369
|
};
|
|
8370
|
+
async function applyFieldEdits(ctx, slug, steps, taskId, edits) {
|
|
8371
|
+
const lines = [];
|
|
8372
|
+
for (const edit of edits) {
|
|
8373
|
+
const response = await steps.run(
|
|
8374
|
+
`field "${edit.key}"`,
|
|
8375
|
+
() => ctx.client.dispatch("task.setField", slug, {
|
|
8376
|
+
taskId,
|
|
8377
|
+
fieldKey: edit.key,
|
|
8378
|
+
value: edit.value
|
|
8379
|
+
})
|
|
8380
|
+
);
|
|
8381
|
+
const { field, display } = response.result;
|
|
8382
|
+
lines.push(
|
|
8383
|
+
display.value === null ? ` ${field.name}: cleared` : ` ${field.name}: ${display.value}`
|
|
8384
|
+
);
|
|
8385
|
+
}
|
|
8386
|
+
return lines;
|
|
8387
|
+
}
|
|
8388
|
+
async function fieldLines(ctx, slug, task) {
|
|
8389
|
+
if (task.fieldValues.length === 0) return [];
|
|
8390
|
+
const library = await ctx.client.fields.list(slug);
|
|
8391
|
+
const held = library.flatMap((field) => {
|
|
8392
|
+
const item = task.fieldValues.find((value) => value.fieldId === field.id);
|
|
8393
|
+
return item === void 0 ? [] : [{ field, value: item.value }];
|
|
8394
|
+
});
|
|
8395
|
+
const members = held.some(({ field }) => field.type === "people") ? await ctx.client.members.list(slug) : [];
|
|
8396
|
+
const memberName = (memberId) => {
|
|
8397
|
+
const member = members.find((candidate) => candidate.id === memberId);
|
|
8398
|
+
return member?.name ?? member?.email ?? "Someone";
|
|
8399
|
+
};
|
|
8400
|
+
return held.map(
|
|
8401
|
+
({ field, value }) => ` ${field.name}: ${fieldValueText(field, value, memberName)}`
|
|
8402
|
+
);
|
|
8403
|
+
}
|
|
8237
8404
|
function filters(options) {
|
|
8238
8405
|
const entries = Object.entries(options).filter(
|
|
8239
8406
|
([, value]) => value !== void 0
|
|
@@ -8293,6 +8460,11 @@ async function taskView(ctx, taskRef) {
|
|
|
8293
8460
|
`Subtasks: ${task.subtaskProgress.completed}/${task.subtaskProgress.total} done`
|
|
8294
8461
|
);
|
|
8295
8462
|
}
|
|
8463
|
+
const fields = await fieldLines(ctx, slug, task);
|
|
8464
|
+
if (fields.length > 0) {
|
|
8465
|
+
ctx.io.out("Fields:");
|
|
8466
|
+
for (const line2 of fields) ctx.io.out(line2);
|
|
8467
|
+
}
|
|
8296
8468
|
if (task.descriptionMarkdown !== null && task.descriptionMarkdown !== "") {
|
|
8297
8469
|
ctx.io.out("");
|
|
8298
8470
|
ctx.io.out(task.descriptionMarkdown);
|
|
@@ -8346,6 +8518,11 @@ async function taskCreate(ctx, title, options) {
|
|
|
8346
8518
|
const labelNames = options.labels === void 0 || options.labels === "" ? [] : options.labels.split(",").map((name) => name.trim());
|
|
8347
8519
|
const labelIds = labelNames.length === 0 ? [] : await resolveLabelIds(ctx, slug, labelNames);
|
|
8348
8520
|
const edits = dateEdits(options);
|
|
8521
|
+
const fieldEdits = await resolveFieldEdits(
|
|
8522
|
+
ctx.client,
|
|
8523
|
+
slug,
|
|
8524
|
+
parseFieldFlags(options.field ?? [])
|
|
8525
|
+
);
|
|
8349
8526
|
const input = { teamIdentifier, title };
|
|
8350
8527
|
if (options.description !== void 0) {
|
|
8351
8528
|
input.descriptionMarkdown = options.description;
|
|
@@ -8379,9 +8556,19 @@ async function taskCreate(ctx, title, options) {
|
|
|
8379
8556
|
})
|
|
8380
8557
|
);
|
|
8381
8558
|
}
|
|
8382
|
-
|
|
8383
|
-
ctx
|
|
8559
|
+
const fieldOutput = await applyFieldEdits(
|
|
8560
|
+
ctx,
|
|
8561
|
+
slug,
|
|
8562
|
+
steps,
|
|
8563
|
+
task.id,
|
|
8564
|
+
fieldEdits
|
|
8384
8565
|
);
|
|
8566
|
+
if (ctx.config.json) {
|
|
8567
|
+
ctx.io.out(jsonOutput(created.result));
|
|
8568
|
+
return;
|
|
8569
|
+
}
|
|
8570
|
+
ctx.io.out(`Created ${created.result.identifier}: ${task.title}`);
|
|
8571
|
+
for (const line2 of fieldOutput) ctx.io.out(line2);
|
|
8385
8572
|
}
|
|
8386
8573
|
async function resolveStatusId(ctx, slug, teamIdentifier, name) {
|
|
8387
8574
|
const team = await ctx.client.teams.get(slug, teamIdentifier);
|
|
@@ -8397,13 +8584,19 @@ async function resolveStatusId(ctx, slug, teamIdentifier, name) {
|
|
|
8397
8584
|
}
|
|
8398
8585
|
async function taskUpdate(ctx, taskRef, options) {
|
|
8399
8586
|
const slug = requireWorkspace(ctx.config);
|
|
8400
|
-
const
|
|
8587
|
+
const { field: fieldFlags = [], ...fixed } = options;
|
|
8588
|
+
const changed = fieldFlags.length > 0 || Object.values(fixed).some((value) => value !== void 0);
|
|
8401
8589
|
if (!changed) {
|
|
8402
8590
|
throw new UsageError(
|
|
8403
|
-
"Nothing to update. Pass at least one of --title, --description, --priority, --status, --due, --start, --parent, --no-parent."
|
|
8591
|
+
"Nothing to update. Pass at least one of --title, --description, --priority, --status, --due, --start, --parent, --no-parent, --field."
|
|
8404
8592
|
);
|
|
8405
8593
|
}
|
|
8406
8594
|
const edits = dateEdits(options);
|
|
8595
|
+
const fieldEdits = await resolveFieldEdits(
|
|
8596
|
+
ctx.client,
|
|
8597
|
+
slug,
|
|
8598
|
+
parseFieldFlags(fieldFlags)
|
|
8599
|
+
);
|
|
8407
8600
|
const parentTaskId = options.parent === void 0 ? void 0 : options.parent === false ? null : await resolveTaskId(ctx.client, slug, options.parent);
|
|
8408
8601
|
const taskId = await resolveTaskId(ctx.client, slug, taskRef);
|
|
8409
8602
|
const task = await ctx.client.tasks.get(slug, taskId);
|
|
@@ -8460,10 +8653,20 @@ async function taskUpdate(ctx, taskRef, options) {
|
|
|
8460
8653
|
() => ctx.client.dispatch("task.move", slug, { taskId: task.id, statusId })
|
|
8461
8654
|
);
|
|
8462
8655
|
}
|
|
8463
|
-
const
|
|
8464
|
-
|
|
8465
|
-
|
|
8656
|
+
const fieldOutput = await applyFieldEdits(
|
|
8657
|
+
ctx,
|
|
8658
|
+
slug,
|
|
8659
|
+
steps,
|
|
8660
|
+
task.id,
|
|
8661
|
+
fieldEdits
|
|
8466
8662
|
);
|
|
8663
|
+
const updated = await ctx.client.tasks.get(slug, task.id);
|
|
8664
|
+
if (ctx.config.json) {
|
|
8665
|
+
ctx.io.out(jsonOutput(updated));
|
|
8666
|
+
return;
|
|
8667
|
+
}
|
|
8668
|
+
ctx.io.out(`Updated ${updated.identifier}: ${updated.title}`);
|
|
8669
|
+
for (const line2 of fieldOutput) ctx.io.out(line2);
|
|
8467
8670
|
}
|
|
8468
8671
|
var APPROVAL_STATE_WORDS = {
|
|
8469
8672
|
requested: ["requested", "from"],
|
|
@@ -8478,7 +8681,7 @@ function approvalLine(approval) {
|
|
|
8478
8681
|
}
|
|
8479
8682
|
return `${state} ${preposition} ${approval.approver.name ?? approval.approver.memberId}`;
|
|
8480
8683
|
}
|
|
8481
|
-
var
|
|
8684
|
+
var UUID_PATTERN6 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8482
8685
|
function resolveApprover(members, ref) {
|
|
8483
8686
|
const wanted = ref.trim().toLowerCase();
|
|
8484
8687
|
const matched = members.filter(
|
|
@@ -8503,7 +8706,7 @@ async function taskRequestApproval(ctx, taskRef, options) {
|
|
|
8503
8706
|
throw new UsageError("--approver is required: a person's name, email or member id.");
|
|
8504
8707
|
}
|
|
8505
8708
|
const ref = options.approver.trim();
|
|
8506
|
-
const approver =
|
|
8709
|
+
const approver = UUID_PATTERN6.test(ref) ? { id: ref, name: null } : resolveApprover(await ctx.client.members.list(slug), ref);
|
|
8507
8710
|
const taskId = await resolveTaskId(ctx.client, slug, taskRef);
|
|
8508
8711
|
const response = await ctx.client.dispatch("task.requestApproval", slug, {
|
|
8509
8712
|
taskId,
|
|
@@ -8533,7 +8736,7 @@ async function taskDecide(ctx, taskRef, decision) {
|
|
|
8533
8736
|
// src/commands/time.ts
|
|
8534
8737
|
var MAX_ENTRY_MINUTES = 24 * 60;
|
|
8535
8738
|
var CALENDAR_DATE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
8536
|
-
var
|
|
8739
|
+
var UUID_PATTERN7 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8537
8740
|
var BILLABLE_FLAGS = [
|
|
8538
8741
|
["yes", "billable"],
|
|
8539
8742
|
["no", "non_billable"],
|
|
@@ -8584,7 +8787,7 @@ function billableValue(value) {
|
|
|
8584
8787
|
}
|
|
8585
8788
|
function entryId(ref) {
|
|
8586
8789
|
const trimmed = ref.trim();
|
|
8587
|
-
if (!
|
|
8790
|
+
if (!UUID_PATTERN7.test(trimmed)) {
|
|
8588
8791
|
throw new UsageError(
|
|
8589
8792
|
`"${ref}" is not a time entry id. Run "tasq time list <task>" to see the ids.`
|
|
8590
8793
|
);
|
|
@@ -8775,6 +8978,9 @@ async function workspaceUse(ctx, slug) {
|
|
|
8775
8978
|
}
|
|
8776
8979
|
|
|
8777
8980
|
// src/program.ts
|
|
8981
|
+
function collect(value, previous) {
|
|
8982
|
+
return [...previous ?? [], value];
|
|
8983
|
+
}
|
|
8778
8984
|
function contextFor(program2, io2) {
|
|
8779
8985
|
const flags = program2.opts();
|
|
8780
8986
|
const config = loadConfig({
|
|
@@ -8816,21 +9022,28 @@ function buildProgram(io2) {
|
|
|
8816
9022
|
task.command("view").argument("<id>", "task identifier or id").description("Show a task with its comments and activity").action(async (id) => {
|
|
8817
9023
|
await taskView(contextFor(program2, io2), id);
|
|
8818
9024
|
});
|
|
8819
|
-
task.command("create").argument("<title>", "task title").description("Create a task").option("--team <identifier>", "team identifier").option("--description <markdown>", "description in Markdown").option("--priority <priority>", "urgent | high | medium | low | none").option("--project <id>", "project id").option("--labels <names>", "comma-separated label names").option("--due <date>", "due date, YYYY-MM-DD").option("--start <date>", "start date, YYYY-MM-DD").option("--parent <id>", "parent task identifier or id, making this a subtask").
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
9025
|
+
task.command("create").argument("<title>", "task title").description("Create a task").option("--team <identifier>", "team identifier").option("--description <markdown>", "description in Markdown").option("--priority <priority>", "urgent | high | medium | low | none").option("--project <id>", "project id").option("--labels <names>", "comma-separated label names").option("--due <date>", "due date, YYYY-MM-DD").option("--start <date>", "start date, YYYY-MM-DD").option("--parent <id>", "parent task identifier or id, making this a subtask").option(
|
|
9026
|
+
"--field <key=value>",
|
|
9027
|
+
"custom field value by key, repeatable; a,b for a multi-select or people field",
|
|
9028
|
+
collect
|
|
9029
|
+
).action(async (title, options) => {
|
|
9030
|
+
await taskCreate(contextFor(program2, io2), title, {
|
|
9031
|
+
team: options.team,
|
|
9032
|
+
description: options.description,
|
|
9033
|
+
priority: options.priority,
|
|
9034
|
+
project: options.project,
|
|
9035
|
+
labels: options.labels,
|
|
9036
|
+
due: options.due,
|
|
9037
|
+
start: options.start,
|
|
9038
|
+
parent: options.parent,
|
|
9039
|
+
field: options.field
|
|
9040
|
+
});
|
|
9041
|
+
});
|
|
9042
|
+
task.command("update").argument("<id>", "task identifier or id").description("Update a task").option("--title <title>", "new title").option("--description <markdown>", "new description in Markdown").option("--priority <priority>", "urgent | high | medium | low | none").option("--status <name>", "status name on the task's team").option("--due <date>", 'due date, YYYY-MM-DD, or "none" to clear').option("--start <date>", 'start date, YYYY-MM-DD, or "none" to clear').option("--parent <id>", "parent task identifier or id, making this a subtask").option("--no-parent", "detach from its parent task").option(
|
|
9043
|
+
"--field <key=value>",
|
|
9044
|
+
'custom field value by key, repeatable; "key=" clears it',
|
|
9045
|
+
collect
|
|
9046
|
+
).action(async (id, options) => {
|
|
8834
9047
|
await taskUpdate(contextFor(program2, io2), id, {
|
|
8835
9048
|
title: options.title,
|
|
8836
9049
|
description: options.description,
|
|
@@ -8838,7 +9051,8 @@ function buildProgram(io2) {
|
|
|
8838
9051
|
status: options.status,
|
|
8839
9052
|
due: options.due,
|
|
8840
9053
|
start: options.start,
|
|
8841
|
-
parent: options.parent
|
|
9054
|
+
parent: options.parent,
|
|
9055
|
+
field: options.field
|
|
8842
9056
|
});
|
|
8843
9057
|
});
|
|
8844
9058
|
task.command("request-approval").argument("<id>", "task identifier or id").description("Ask a person to approve a task").requiredOption(
|
|
@@ -8858,6 +9072,10 @@ function buildProgram(io2) {
|
|
|
8858
9072
|
await taskDecide(contextFor(program2, io2), id, decision);
|
|
8859
9073
|
});
|
|
8860
9074
|
}
|
|
9075
|
+
const field = program2.command("field").description("Custom fields: the workspace's field library");
|
|
9076
|
+
field.command("list").description("List the fields, with the keys --field takes").option("--all", "include archived fields").action(async (options) => {
|
|
9077
|
+
await fieldList(contextFor(program2, io2), { all: options.all });
|
|
9078
|
+
});
|
|
8861
9079
|
const time = program2.command("time").description("Time logged on tasks (members only)");
|
|
8862
9080
|
time.command("log").argument("<task>", "task identifier or id").argument("<duration...>", "how long: 1h 30m, 90m, 1.5h or 1:30").description("Log time on a task").option("--day <date>", "the day the work was done, YYYY-MM-DD (default: today)").option("--note <text>", "what the time was spent on").option("--billable <yes|no>", "mark the entry billable or not").action(
|
|
8863
9081
|
async (taskRef, duration, options) => {
|