@pxlabz/tasq-cli 0.1.5 → 0.1.7
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/dist/tasq.js +78 -8
- package/package.json +2 -2
package/dist/tasq.js
CHANGED
|
@@ -6845,7 +6845,7 @@ function reportError(error, io2) {
|
|
|
6845
6845
|
// package.json
|
|
6846
6846
|
var package_default = {
|
|
6847
6847
|
name: "@pxlabz/tasq-cli",
|
|
6848
|
-
version: "0.1.
|
|
6848
|
+
version: "0.1.7",
|
|
6849
6849
|
description: "Command-line client for Tasq, for humans and agents alike",
|
|
6850
6850
|
keywords: [
|
|
6851
6851
|
"tasq",
|
|
@@ -7004,12 +7004,13 @@ function dash(value) {
|
|
|
7004
7004
|
function formatTasks(tasks) {
|
|
7005
7005
|
if (tasks.length === 0) return "No tasks.";
|
|
7006
7006
|
return table(
|
|
7007
|
-
["Key", "Title", "Status", "Priority", "Assignee"],
|
|
7007
|
+
["Key", "Title", "Status", "Priority", "Due", "Assignee"],
|
|
7008
7008
|
tasks.map((task) => [
|
|
7009
7009
|
task.identifier,
|
|
7010
7010
|
task.title,
|
|
7011
7011
|
task.status.name,
|
|
7012
7012
|
task.priority,
|
|
7013
|
+
dash(task.dueDate),
|
|
7013
7014
|
dash(task.assignee?.name ?? task.assignee?.email)
|
|
7014
7015
|
])
|
|
7015
7016
|
);
|
|
@@ -7668,6 +7669,38 @@ function priority(value) {
|
|
|
7668
7669
|
}
|
|
7669
7670
|
return match;
|
|
7670
7671
|
}
|
|
7672
|
+
var DUE_FILTERS = ["overdue", "today", "week", "none"];
|
|
7673
|
+
var SORTS = ["due"];
|
|
7674
|
+
function oneOf(label, allowed, value) {
|
|
7675
|
+
const match = allowed.find((name) => name === value.toLowerCase());
|
|
7676
|
+
if (match === void 0) {
|
|
7677
|
+
throw new UsageError(
|
|
7678
|
+
`Unknown ${label} "${value}". Expected one of: ${allowed.join(", ")}.`
|
|
7679
|
+
);
|
|
7680
|
+
}
|
|
7681
|
+
return match;
|
|
7682
|
+
}
|
|
7683
|
+
var CALENDAR_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
7684
|
+
function calendarDate(flag, value) {
|
|
7685
|
+
if (value.toLowerCase() === "none") return null;
|
|
7686
|
+
if (!CALENDAR_DATE.test(value)) {
|
|
7687
|
+
throw new UsageError(
|
|
7688
|
+
`--${flag} takes a YYYY-MM-DD date, or "none" to clear it. Got "${value}".`
|
|
7689
|
+
);
|
|
7690
|
+
}
|
|
7691
|
+
return value;
|
|
7692
|
+
}
|
|
7693
|
+
function dateEdits(options) {
|
|
7694
|
+
if (options.due === void 0 && options.start === void 0) return null;
|
|
7695
|
+
const edits = {};
|
|
7696
|
+
if (options.due !== void 0) {
|
|
7697
|
+
edits.dueDate = calendarDate("due", options.due);
|
|
7698
|
+
}
|
|
7699
|
+
if (options.start !== void 0) {
|
|
7700
|
+
edits.startDate = calendarDate("start", options.start);
|
|
7701
|
+
}
|
|
7702
|
+
return edits;
|
|
7703
|
+
}
|
|
7671
7704
|
var StepRunner = class {
|
|
7672
7705
|
#applied = [];
|
|
7673
7706
|
async run(label, step) {
|
|
@@ -7694,6 +7727,12 @@ function filters(options) {
|
|
|
7694
7727
|
async function taskList2(ctx, options) {
|
|
7695
7728
|
const slug = requireWorkspace(ctx.config);
|
|
7696
7729
|
const query = filters(options);
|
|
7730
|
+
if (options.due !== void 0) {
|
|
7731
|
+
query.due = oneOf("due filter", DUE_FILTERS, options.due);
|
|
7732
|
+
}
|
|
7733
|
+
if (options.sort !== void 0) {
|
|
7734
|
+
query.sort = oneOf("sort", SORTS, options.sort);
|
|
7735
|
+
}
|
|
7697
7736
|
if (options.status !== void 0) {
|
|
7698
7737
|
const teamIdentifier = await resolveTeamIdentifier(
|
|
7699
7738
|
ctx,
|
|
@@ -7722,6 +7761,11 @@ async function taskView(ctx, taskRef) {
|
|
|
7722
7761
|
ctx.io.out(
|
|
7723
7762
|
`Status: ${task.status.name} Priority: ${task.priority} Assignee: ${task.assignee?.name ?? task.assignee?.email ?? "\u2014"}`
|
|
7724
7763
|
);
|
|
7764
|
+
if (task.startDate !== null || task.dueDate !== null) {
|
|
7765
|
+
ctx.io.out(
|
|
7766
|
+
`Start: ${task.startDate ?? "\u2014"} Due: ${task.dueDate ?? "\u2014"}`
|
|
7767
|
+
);
|
|
7768
|
+
}
|
|
7725
7769
|
if (task.descriptionMarkdown !== null && task.descriptionMarkdown !== "") {
|
|
7726
7770
|
ctx.io.out("");
|
|
7727
7771
|
ctx.io.out(task.descriptionMarkdown);
|
|
@@ -7768,6 +7812,7 @@ async function taskCreate(ctx, title, options) {
|
|
|
7768
7812
|
const teamIdentifier = await resolveTeamIdentifier(ctx, slug, options.team);
|
|
7769
7813
|
const labelNames = options.labels === void 0 || options.labels === "" ? [] : options.labels.split(",").map((name) => name.trim());
|
|
7770
7814
|
const labelIds = labelNames.length === 0 ? [] : await resolveLabelIds(ctx, slug, labelNames);
|
|
7815
|
+
const edits = dateEdits(options);
|
|
7771
7816
|
const input = { teamIdentifier, title };
|
|
7772
7817
|
if (options.description !== void 0) {
|
|
7773
7818
|
input.descriptionMarkdown = options.description;
|
|
@@ -7782,6 +7827,15 @@ async function taskCreate(ctx, title, options) {
|
|
|
7782
7827
|
() => ctx.client.dispatch("task.create", slug, input)
|
|
7783
7828
|
);
|
|
7784
7829
|
const task = created.result.task;
|
|
7830
|
+
if (edits) {
|
|
7831
|
+
await steps.run(
|
|
7832
|
+
"dates",
|
|
7833
|
+
() => ctx.client.dispatch("task.setDates", slug, {
|
|
7834
|
+
taskId: task.id,
|
|
7835
|
+
...edits
|
|
7836
|
+
})
|
|
7837
|
+
);
|
|
7838
|
+
}
|
|
7785
7839
|
for (const [index, labelId] of labelIds.entries()) {
|
|
7786
7840
|
await steps.run(
|
|
7787
7841
|
`label "${labelNames[index] ?? labelId}"`,
|
|
@@ -7812,9 +7866,10 @@ async function taskUpdate(ctx, taskRef, options) {
|
|
|
7812
7866
|
const changed = Object.values(options).some((value) => value !== void 0);
|
|
7813
7867
|
if (!changed) {
|
|
7814
7868
|
throw new UsageError(
|
|
7815
|
-
"Nothing to update. Pass at least one of --title, --description, --priority, --status."
|
|
7869
|
+
"Nothing to update. Pass at least one of --title, --description, --priority, --status, --due, --start."
|
|
7816
7870
|
);
|
|
7817
7871
|
}
|
|
7872
|
+
const edits = dateEdits(options);
|
|
7818
7873
|
const taskId = await resolveTaskId(ctx.client, slug, taskRef);
|
|
7819
7874
|
const task = await ctx.client.tasks.get(slug, taskId);
|
|
7820
7875
|
const steps = new StepRunner();
|
|
@@ -7840,6 +7895,15 @@ async function taskUpdate(ctx, taskRef, options) {
|
|
|
7840
7895
|
})
|
|
7841
7896
|
);
|
|
7842
7897
|
}
|
|
7898
|
+
if (edits) {
|
|
7899
|
+
await steps.run(
|
|
7900
|
+
"dates",
|
|
7901
|
+
() => ctx.client.dispatch("task.setDates", slug, {
|
|
7902
|
+
taskId: task.id,
|
|
7903
|
+
...edits
|
|
7904
|
+
})
|
|
7905
|
+
);
|
|
7906
|
+
}
|
|
7843
7907
|
if (options.status !== void 0) {
|
|
7844
7908
|
const statusId = await resolveStatusId(
|
|
7845
7909
|
ctx,
|
|
@@ -7898,7 +7962,7 @@ function buildProgram(io2) {
|
|
|
7898
7962
|
await workspaceUse(contextFor(program2, io2), slug);
|
|
7899
7963
|
});
|
|
7900
7964
|
const task = program2.command("task").description("Tasks");
|
|
7901
|
-
task.command("list").description("List tasks").option("--team <identifier>", "team identifier").option("--status <name>", "status name").option("--assignee <id>", "assignee member id").option("--priority <priority>", "urgent | high | medium | low | none").option("--project <id>", "project id").option("--cycle <id>", "cycle id").option("-q, --q <text>", "search text").option("--include-archived", "include archived tasks").action(async (options) => {
|
|
7965
|
+
task.command("list").description("List tasks").option("--team <identifier>", "team identifier").option("--status <name>", "status name").option("--assignee <id>", "assignee member id").option("--priority <priority>", "urgent | high | medium | low | none").option("--project <id>", "project id").option("--cycle <id>", "cycle id").option("--due <filter>", "overdue | today | week | none").option("--sort <field>", "due").option("-q, --q <text>", "search text").option("--include-archived", "include archived tasks").action(async (options) => {
|
|
7902
7966
|
await taskList2(contextFor(program2, io2), {
|
|
7903
7967
|
team: options.team,
|
|
7904
7968
|
status: options.status,
|
|
@@ -7906,6 +7970,8 @@ function buildProgram(io2) {
|
|
|
7906
7970
|
priority: options.priority,
|
|
7907
7971
|
project: options.project,
|
|
7908
7972
|
cycle: options.cycle,
|
|
7973
|
+
due: options.due,
|
|
7974
|
+
sort: options.sort,
|
|
7909
7975
|
q: options.q,
|
|
7910
7976
|
includeArchived: options.includeArchived === true ? true : void 0
|
|
7911
7977
|
});
|
|
@@ -7913,23 +7979,27 @@ function buildProgram(io2) {
|
|
|
7913
7979
|
task.command("view").argument("<id>", "task identifier or id").description("Show a task with its comments and activity").action(async (id) => {
|
|
7914
7980
|
await taskView(contextFor(program2, io2), id);
|
|
7915
7981
|
});
|
|
7916
|
-
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").action(
|
|
7982
|
+
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").action(
|
|
7917
7983
|
async (title, options) => {
|
|
7918
7984
|
await taskCreate(contextFor(program2, io2), title, {
|
|
7919
7985
|
team: options.team,
|
|
7920
7986
|
description: options.description,
|
|
7921
7987
|
priority: options.priority,
|
|
7922
7988
|
project: options.project,
|
|
7923
|
-
labels: options.labels
|
|
7989
|
+
labels: options.labels,
|
|
7990
|
+
due: options.due,
|
|
7991
|
+
start: options.start
|
|
7924
7992
|
});
|
|
7925
7993
|
}
|
|
7926
7994
|
);
|
|
7927
|
-
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").action(async (id, options) => {
|
|
7995
|
+
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').action(async (id, options) => {
|
|
7928
7996
|
await taskUpdate(contextFor(program2, io2), id, {
|
|
7929
7997
|
title: options.title,
|
|
7930
7998
|
description: options.description,
|
|
7931
7999
|
priority: options.priority,
|
|
7932
|
-
status: options.status
|
|
8000
|
+
status: options.status,
|
|
8001
|
+
due: options.due,
|
|
8002
|
+
start: options.start
|
|
7933
8003
|
});
|
|
7934
8004
|
});
|
|
7935
8005
|
const comment = program2.command("comment").description("Task and project comments");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pxlabz/tasq-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Command-line client for Tasq, for humans and agents alike",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tasq",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"commander": "^14.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@pxlabz/tasq-sdk": "0.1.
|
|
52
|
+
"@pxlabz/tasq-sdk": "0.1.4",
|
|
53
53
|
"@types/bun": "^1.3.12",
|
|
54
54
|
"tsup": "^8.5.0",
|
|
55
55
|
"typescript": "^5.7.2"
|