@zinn-dev/cli 0.14.0 → 0.15.0
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 +2 -1
- package/package.json +2 -2
- package/src/routes/label-router.ts +5 -0
- package/src/routes/router.ts +2 -1
- package/src/routes/task-router.ts +51 -8
package/README.md
CHANGED
|
@@ -148,6 +148,7 @@ zinn task move MDR-1 "In Progress"
|
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
A moved task appears at the bottom of its destination column. Moving it to its current column does nothing. Archived tasks must be unarchived before they can be moved.
|
|
151
|
+
Moving prints only the task's key and new column, such as `MDR-1 | In Progress`, while `--json` prints the full task details.
|
|
151
152
|
|
|
152
153
|
Change a task's position within its current column:
|
|
153
154
|
|
|
@@ -209,4 +210,4 @@ zinn task edit MDR-1 --priority urgent
|
|
|
209
210
|
zinn task edit MDR-1 --priority none
|
|
210
211
|
```
|
|
211
212
|
|
|
212
|
-
Use `none` to clear priority. Omitting `--priority` on edits preserves it.
|
|
213
|
+
Use `none` to clear priority. Omitting `--priority` on edits preserves it. Task lists show priority in a compact column after the board column: `-` for unassigned and `L`, `M`, `H`, or `U` for low, medium, high, or urgent. Task views show the full priority value. Priority does not affect board ordering.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "A kanban workflow in the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@zinn-dev/core": "0.11.
|
|
45
|
+
"@zinn-dev/core": "0.11.1"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -20,6 +20,11 @@ function presentLabel(labelMatch: Label): PresentedLabel {
|
|
|
20
20
|
|
|
21
21
|
function formatLabel(presented: PresentedLabel) {
|
|
22
22
|
const coloredName = styleText(presented.color, presented.name);
|
|
23
|
+
|
|
24
|
+
if (presented.description.length === 0) {
|
|
25
|
+
return coloredName;
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
return `${coloredName} | ${presented.description}`;
|
|
24
29
|
}
|
|
25
30
|
|
package/src/routes/router.ts
CHANGED
|
@@ -14,7 +14,8 @@ function getNamespaceHelp(parsedRoutes: Array<ParsedRoute>, namespace: string) {
|
|
|
14
14
|
const prefix = `${namespace} `;
|
|
15
15
|
const commands = parsedRoutes
|
|
16
16
|
.map((route) => route.command)
|
|
17
|
-
.filter((command) => command.startsWith(prefix))
|
|
17
|
+
.filter((command) => command.startsWith(prefix))
|
|
18
|
+
.map((command) => command.slice(prefix.length));
|
|
18
19
|
|
|
19
20
|
if (commands.length === 0) {
|
|
20
21
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaskPriority } from "@zinn-dev/core";
|
|
2
2
|
import type { RouteDef } from "../types";
|
|
3
3
|
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
4
|
+
import { parseArgs, styleText } from "node:util";
|
|
5
5
|
import { task, project, column } from "@zinn-dev/core";
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -38,6 +38,29 @@ type PresentedTask = {
|
|
|
38
38
|
labels: Array<string>;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
function formatTaskPriorityMarker(priority: TaskPriority | null) {
|
|
42
|
+
if (priority == null) {
|
|
43
|
+
return "-";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return priority[0]!.toUpperCase();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function formatTaskColumn(columnName: string, width = columnName.length) {
|
|
50
|
+
const paddedColumnName = columnName.padEnd(width);
|
|
51
|
+
|
|
52
|
+
// TODO: Derive column colors from column roles once roles exist instead of relying on names.
|
|
53
|
+
if (columnName === "Backlog") {
|
|
54
|
+
return styleText("gray", paddedColumnName);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (columnName === "Done") {
|
|
58
|
+
return styleText("green", paddedColumnName);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return paddedColumnName;
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
function presentTask(taskMatch: ReturnType<typeof task.getByKey>): PresentedTask {
|
|
42
65
|
return {
|
|
43
66
|
key: taskMatch.key,
|
|
@@ -52,21 +75,29 @@ function presentTask(taskMatch: ReturnType<typeof task.getByKey>): PresentedTask
|
|
|
52
75
|
|
|
53
76
|
// TODO: a CLI row formatter that accepts text columns and joins them with " | " would be useful
|
|
54
77
|
// Reuse it across task list/view and other command output in a separate change.
|
|
55
|
-
function formatTask(
|
|
78
|
+
function formatTask(
|
|
79
|
+
presented: PresentedTask,
|
|
80
|
+
options: { showsStatus?: boolean } = {},
|
|
81
|
+
) {
|
|
56
82
|
const status = options.showsStatus ? ` | ${presented.status}` : "";
|
|
83
|
+
const column = formatTaskColumn(presented.column);
|
|
57
84
|
const description = presented.description == null ? "" : ` | ${presented.description}`;
|
|
58
85
|
|
|
59
86
|
const priority = presented.priority == null ? "" : ` | Priority: ${presented.priority}`;
|
|
60
87
|
const labelText =
|
|
61
88
|
presented.labels.length === 0 ? "" : ` | Labels: ${presented.labels.join(", ")}`;
|
|
62
89
|
|
|
63
|
-
return `${presented.key}${status} | ${
|
|
90
|
+
return `${presented.key}${status} | ${column} | ${presented.title}${description}${priority}${labelText}`;
|
|
64
91
|
}
|
|
65
92
|
|
|
66
93
|
function formatTaskWithStatus(presented: PresentedTask) {
|
|
67
94
|
return formatTask(presented, { showsStatus: true });
|
|
68
95
|
}
|
|
69
96
|
|
|
97
|
+
function formatTaskMove(presented: PresentedTask) {
|
|
98
|
+
return `${presented.key} | ${formatTaskColumn(presented.column)}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
70
101
|
export const taskRouter = {
|
|
71
102
|
edit: {
|
|
72
103
|
run: (args) => {
|
|
@@ -209,6 +240,11 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
209
240
|
(prev, current) => Math.max(prev, current.key.length),
|
|
210
241
|
0,
|
|
211
242
|
);
|
|
243
|
+
const longestColumnNameLength = presentedTasks.reduce(
|
|
244
|
+
(previousLength, currentTask) =>
|
|
245
|
+
Math.max(previousLength, currentTask.column.length),
|
|
246
|
+
0,
|
|
247
|
+
);
|
|
212
248
|
const longestStatusLength = presentedTasks.reduce(
|
|
213
249
|
(prev, current) => Math.max(prev, current.status.length),
|
|
214
250
|
0,
|
|
@@ -220,8 +256,10 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
220
256
|
const status = showsAll ? ` | ${t.status.padEnd(longestStatusLength)}` : "";
|
|
221
257
|
const descriptionPreview = formatTaskDescriptionPreview(t.description);
|
|
222
258
|
const description = t.description == null ? "" : ` | ${descriptionPreview}`;
|
|
223
|
-
const priority = t.priority
|
|
224
|
-
|
|
259
|
+
const priority = formatTaskPriorityMarker(t.priority);
|
|
260
|
+
const column = formatTaskColumn(t.column, longestColumnNameLength);
|
|
261
|
+
|
|
262
|
+
return `${t.key.padEnd(longestKeyLength)}${status} | ${column} | ${priority} | ${t.title}${description}`;
|
|
225
263
|
})
|
|
226
264
|
.join("\n");
|
|
227
265
|
});
|
|
@@ -230,6 +268,7 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
230
268
|
|
|
231
269
|
List active tasks by default.
|
|
232
270
|
Use --archived to list archived tasks or --all to list both.
|
|
271
|
+
Priority markers: - unassigned, L low, M medium, H high, U urgent.
|
|
233
272
|
|
|
234
273
|
Example: zinn task list MDR --all`,
|
|
235
274
|
},
|
|
@@ -246,9 +285,11 @@ Example: zinn task list MDR --all`,
|
|
|
246
285
|
|
|
247
286
|
output(viewedTask, (t) => {
|
|
248
287
|
const relations = formatRelations(t.relations);
|
|
288
|
+
const formattedTask = formatTask(t);
|
|
289
|
+
|
|
249
290
|
return relations.length > 0
|
|
250
|
-
? `${
|
|
251
|
-
:
|
|
291
|
+
? `${formattedTask}\n\nRelations:\n${relations}`
|
|
292
|
+
: formattedTask;
|
|
252
293
|
});
|
|
253
294
|
},
|
|
254
295
|
help: `Usage: zinn task view <task-key>
|
|
@@ -270,7 +311,7 @@ Example: zinn task view MDR-1`,
|
|
|
270
311
|
}
|
|
271
312
|
|
|
272
313
|
const movedTask = task.move({ taskKey, targetColumn });
|
|
273
|
-
output(presentTask(movedTask),
|
|
314
|
+
output(presentTask(movedTask), formatTaskMove);
|
|
274
315
|
},
|
|
275
316
|
help: `Usage: zinn task move <task-key> <target-column>
|
|
276
317
|
|
|
@@ -278,6 +319,8 @@ Move a task to another column in its project.
|
|
|
278
319
|
Moving a task to a different column lists it last in that column,
|
|
279
320
|
matching placement at the bottom of a visual kanban column.
|
|
280
321
|
|
|
322
|
+
Prints the task's key and new column.
|
|
323
|
+
|
|
281
324
|
Giving a task's current column as the target will not do anything.
|
|
282
325
|
Archived tasks must be unarchived before they can be moved.
|
|
283
326
|
|