@zinn-dev/cli 0.26.0 → 0.27.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 +1 -1
- package/index.ts +11 -38
- package/package.json +2 -2
- package/src/routes/label-router.ts +14 -11
- package/src/routes/project-router.ts +56 -57
- package/src/routes/relation-router.ts +30 -30
- package/src/routes/router.ts +25 -8
- package/src/routes/task-router.ts +116 -114
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ zinn task edit MDR-1 --add-label review --remove-label urgent
|
|
|
140
140
|
|
|
141
141
|
For adding or removing multiple labels at the same time, repeat `--label` on creation, or `--add-label` and `--remove-label` while editing for each label.
|
|
142
142
|
Each value is considered as the label name: `--label "needs review"`, so if you have commas, then they are considered parts of names.
|
|
143
|
-
Label names are case-
|
|
143
|
+
Label names preserve their stored casing, but matching and uniqueness are case-insensitive. For example, `BUG` can match to a label stored as `Bug`, `Bug` or `bug`, but all three canno exist at the same time as three different label entries. Changing only the casing of an existing label is allowed. Whitespace around label names is trimmed.
|
|
144
144
|
|
|
145
145
|
Descriptions default to an empty string and the label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
|
|
146
146
|
|
package/index.ts
CHANGED
|
@@ -8,8 +8,13 @@ const isVersionRequest = args.length === 1 && ["-v", "--version"].includes(args[
|
|
|
8
8
|
|
|
9
9
|
if (isVersionRequest) {
|
|
10
10
|
console.info(packageJson.version);
|
|
11
|
-
} else
|
|
12
|
-
|
|
11
|
+
} else {
|
|
12
|
+
const { createRouter } = await import("./src/routes/router");
|
|
13
|
+
const { routes } = await import("./src/routes/routes");
|
|
14
|
+
const router = createRouter(routes);
|
|
15
|
+
|
|
16
|
+
if (args.length === 0 || isHelpFlag(args[0]!)) {
|
|
17
|
+
console.info(`ZINN - A kanban workflow in the terminal
|
|
13
18
|
|
|
14
19
|
Usage: zinn <command>
|
|
15
20
|
|
|
@@ -19,43 +24,11 @@ Options:
|
|
|
19
24
|
--json Print command output as JSON
|
|
20
25
|
|
|
21
26
|
Commands:
|
|
22
|
-
|
|
23
|
-
project list
|
|
24
|
-
project view
|
|
25
|
-
project delete
|
|
26
|
-
project column create
|
|
27
|
-
project column edit
|
|
28
|
-
project column list
|
|
29
|
-
project column order
|
|
30
|
-
task create
|
|
31
|
-
task list
|
|
32
|
-
task search
|
|
33
|
-
task view
|
|
34
|
-
task edit
|
|
35
|
-
task move
|
|
36
|
-
task order
|
|
37
|
-
task archive
|
|
38
|
-
task unarchive
|
|
39
|
-
task delete
|
|
40
|
-
task relation create
|
|
41
|
-
task relation list
|
|
42
|
-
task relation delete
|
|
43
|
-
task comment create
|
|
44
|
-
task comment list
|
|
45
|
-
task comment edit
|
|
46
|
-
task comment delete
|
|
47
|
-
task label add
|
|
48
|
-
task label remove
|
|
49
|
-
label create
|
|
50
|
-
label edit
|
|
51
|
-
label list
|
|
52
|
-
label delete
|
|
27
|
+
${router.commands}
|
|
53
28
|
|
|
54
29
|
Run zinn <namespace> --help or zinn <command> --help for more information.
|
|
55
30
|
Running zinn without a command shows this help.`);
|
|
56
|
-
} else {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const router = createRouter(routes);
|
|
60
|
-
router.route(args);
|
|
31
|
+
} else {
|
|
32
|
+
router.route(args);
|
|
33
|
+
}
|
|
61
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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.
|
|
45
|
+
"@zinn-dev/core": "0.18.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -51,11 +51,21 @@ export const labelRouter = {
|
|
|
51
51
|
},
|
|
52
52
|
help: `Usage: zinn label create <name> [--description <text>] [--color <color>]
|
|
53
53
|
|
|
54
|
-
Create a global label. Names
|
|
54
|
+
Create a global label. Names preserve casing, but uniqueness is case-insensitive.
|
|
55
|
+
Names are trimmed and cannot be blank.
|
|
55
56
|
Description defaults to an empty string; color defaults to white.
|
|
56
57
|
Colors: red, green, yellow, blue, magenta, cyan, white, gray.
|
|
57
58
|
|
|
58
59
|
Example: zinn label create bug --description "Unexpected behavior" --color red`,
|
|
60
|
+
},
|
|
61
|
+
list: {
|
|
62
|
+
run: (args) => {
|
|
63
|
+
parseArgs({ args, strict: true, allowPositionals: false });
|
|
64
|
+
output(label.getAll().map(presentLabel), (labels) => labels.map(formatLabel).join("\n"));
|
|
65
|
+
},
|
|
66
|
+
help: `Usage: zinn label list
|
|
67
|
+
|
|
68
|
+
List all global label definitions.`,
|
|
59
69
|
},
|
|
60
70
|
edit: {
|
|
61
71
|
run: (args) => {
|
|
@@ -84,19 +94,11 @@ Example: zinn label create bug --description "Unexpected behavior" --color red`,
|
|
|
84
94
|
Change specified fields.
|
|
85
95
|
Provide at least one edit flag. Use --description "" for an empty description.
|
|
86
96
|
|
|
87
|
-
Names are case-
|
|
97
|
+
Names are matched and kept unique case-insensitively while preserving their casing.
|
|
98
|
+
Names are trimmed. Changing only the casing is allowed.
|
|
88
99
|
Editing does not affect task attachments or task timestamps.
|
|
89
100
|
|
|
90
101
|
Example: zinn label edit bug --name defect --color yellow`,
|
|
91
|
-
},
|
|
92
|
-
list: {
|
|
93
|
-
run: (args) => {
|
|
94
|
-
parseArgs({ args, strict: true, allowPositionals: false });
|
|
95
|
-
output(label.getAll().map(presentLabel), (labels) => labels.map(formatLabel).join("\n"));
|
|
96
|
-
},
|
|
97
|
-
help: `Usage: zinn label list
|
|
98
|
-
|
|
99
|
-
List all global label definitions.`,
|
|
100
102
|
},
|
|
101
103
|
delete: {
|
|
102
104
|
run: (args) => {
|
|
@@ -133,6 +135,7 @@ List all global label definitions.`,
|
|
|
133
135
|
|
|
134
136
|
Delete a label definition and remove it from all tasks after confirmation.
|
|
135
137
|
To remove a label from just one task, use zinn task label remove.
|
|
138
|
+
Label names are matched case-insensitively.
|
|
136
139
|
|
|
137
140
|
Use --yes to skip the confirmation prompt, for example in scripts or with --json.`,
|
|
138
141
|
},
|
|
@@ -37,43 +37,6 @@ function formatColumn(presented: PresentedColumn) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const projectRouter = {
|
|
40
|
-
edit: {
|
|
41
|
-
run: (args) => {
|
|
42
|
-
const { values, positionals, tokens } = parseArgs({
|
|
43
|
-
args,
|
|
44
|
-
options: { name: { type: "string" } },
|
|
45
|
-
allowPositionals: true,
|
|
46
|
-
strict: true,
|
|
47
|
-
tokens: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const projectKey = positionals[0];
|
|
51
|
-
|
|
52
|
-
if (projectKey == null) {
|
|
53
|
-
quit("Project key must be specified");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
validatePositionalCount(positionals, 1, "Only one project key can be specified");
|
|
57
|
-
|
|
58
|
-
validateUniqueOptions(tokens);
|
|
59
|
-
|
|
60
|
-
if (values.name === undefined) {
|
|
61
|
-
quit("Provide an edit flag: --name");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const editedProject = project.edit({ projectKey, name: values.name });
|
|
65
|
-
output(presentProject(editedProject), formatProject);
|
|
66
|
-
},
|
|
67
|
-
help: `Usage: zinn project edit <project-key> --name <text>
|
|
68
|
-
|
|
69
|
-
Change the project name.
|
|
70
|
-
The --name flag is required.
|
|
71
|
-
|
|
72
|
-
Unchanged names leave the modification timestamp unchanged.
|
|
73
|
-
|
|
74
|
-
Example: zinn project edit MDR --name "Macrodata Refinement"`,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
40
|
create: {
|
|
78
41
|
run: (args: Array<string>) => {
|
|
79
42
|
const { values, positionals, tokens } = parseArgs({
|
|
@@ -165,6 +128,42 @@ Example: zinn project list`,
|
|
|
165
128
|
Show a project and its active tasks in board order.
|
|
166
129
|
|
|
167
130
|
Example: zinn project view MDR`,
|
|
131
|
+
},
|
|
132
|
+
edit: {
|
|
133
|
+
run: (args) => {
|
|
134
|
+
const { values, positionals, tokens } = parseArgs({
|
|
135
|
+
args,
|
|
136
|
+
options: { name: { type: "string" } },
|
|
137
|
+
allowPositionals: true,
|
|
138
|
+
strict: true,
|
|
139
|
+
tokens: true,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const projectKey = positionals[0];
|
|
143
|
+
|
|
144
|
+
if (projectKey == null) {
|
|
145
|
+
quit("Project key must be specified");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
validatePositionalCount(positionals, 1, "Only one project key can be specified");
|
|
149
|
+
|
|
150
|
+
validateUniqueOptions(tokens);
|
|
151
|
+
|
|
152
|
+
if (values.name === undefined) {
|
|
153
|
+
quit("Provide an edit flag: --name");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const editedProject = project.edit({ projectKey, name: values.name });
|
|
157
|
+
output(presentProject(editedProject), formatProject);
|
|
158
|
+
},
|
|
159
|
+
help: `Usage: zinn project edit <project-key> --name <text>
|
|
160
|
+
|
|
161
|
+
Change the project name.
|
|
162
|
+
The --name flag is required.
|
|
163
|
+
|
|
164
|
+
Unchanged names leave the modification timestamp unchanged.
|
|
165
|
+
|
|
166
|
+
Example: zinn project edit MDR --name "Macrodata Refinement"`,
|
|
168
167
|
},
|
|
169
168
|
delete: {
|
|
170
169
|
run: (args: Array<string>) => {
|
|
@@ -232,6 +231,24 @@ Add a column at the end of a project's board.
|
|
|
232
231
|
Names are trimmed, must contain printable text on a single line, and must be unique within the project regardless of casing.
|
|
233
232
|
|
|
234
233
|
Example: zinn project column create MDR "Boardlog"`,
|
|
234
|
+
},
|
|
235
|
+
list: {
|
|
236
|
+
run: (args: Array<string>) => {
|
|
237
|
+
const projectKey = args[0];
|
|
238
|
+
if (projectKey == null) {
|
|
239
|
+
quit("Project key needs to be specified to list columns");
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// TODO: attach per-column task count
|
|
243
|
+
// TODO: terminal formatting
|
|
244
|
+
const columns = column.getAllByProjectKey(projectKey).map((c) => ({ name: c.name }));
|
|
245
|
+
output(columns, (presentedColumns) => presentedColumns.map((c) => c.name).join("\n"));
|
|
246
|
+
},
|
|
247
|
+
help: `Usage: zinn project column list <project-key>
|
|
248
|
+
|
|
249
|
+
List a project's columns in board order.
|
|
250
|
+
|
|
251
|
+
Example: zinn project column list MDR`,
|
|
235
252
|
},
|
|
236
253
|
edit: {
|
|
237
254
|
run: (args: Array<string>) => {
|
|
@@ -318,8 +335,8 @@ Example: zinn project column edit MDR "In Progress" --name "Refining"`,
|
|
|
318
335
|
// TODO: maybe also print the new full column state?
|
|
319
336
|
output(presentColumn(orderedColumn), formatColumn);
|
|
320
337
|
},
|
|
321
|
-
help: `Usage: zinn project column order <project-key> <column-name>
|
|
322
|
-
zinn project column order <project-key> <column-name>
|
|
338
|
+
help: `Usage: zinn project column order <project-key> <column-name> {first|previous|next|last}
|
|
339
|
+
zinn project column order <project-key> <column-name> {before|after} <target-column-name>
|
|
323
340
|
|
|
324
341
|
Change a column's position on the project's board.
|
|
325
342
|
Use first or last for either end, previous or next for one position,
|
|
@@ -329,23 +346,5 @@ Columns are matched by name, and matching is case-insensitive.
|
|
|
329
346
|
|
|
330
347
|
Example: zinn project column order MDR Review before "In Progress"`,
|
|
331
348
|
},
|
|
332
|
-
list: {
|
|
333
|
-
run: (args: Array<string>) => {
|
|
334
|
-
const projectKey = args[0];
|
|
335
|
-
if (projectKey == null) {
|
|
336
|
-
quit("Project key needs to be specified to list columns");
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// TODO: attach per-column task count
|
|
340
|
-
// TODO: terminal formatting
|
|
341
|
-
const columns = column.getAllByProjectKey(projectKey).map((c) => ({ name: c.name }));
|
|
342
|
-
output(columns, (presentedColumns) => presentedColumns.map((c) => c.name).join("\n"));
|
|
343
|
-
},
|
|
344
|
-
help: `Usage: zinn project column list <project-key>
|
|
345
|
-
|
|
346
|
-
List a project's columns in board order.
|
|
347
|
-
|
|
348
|
-
Example: zinn project column list MDR`,
|
|
349
|
-
},
|
|
350
349
|
},
|
|
351
350
|
} satisfies RouteDef;
|
|
@@ -94,36 +94,6 @@ function parseRelationArgs(args: string[]) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export const relationRouter = {
|
|
97
|
-
delete: {
|
|
98
|
-
run: (args) => {
|
|
99
|
-
const props = parseRelationArgs(args);
|
|
100
|
-
relation.delete(props, currentActor());
|
|
101
|
-
|
|
102
|
-
const source = task.getByKey(props.sourceTaskKey);
|
|
103
|
-
const target = task.getByKey(props.targetTaskKey);
|
|
104
|
-
const deleted: PresentedRelationChange = {
|
|
105
|
-
type: props.relation_type,
|
|
106
|
-
source: source.key,
|
|
107
|
-
target: target.key,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
output(deleted, (r) => `Deleted ${r.type} relation from ${r.source} to ${r.target}`);
|
|
111
|
-
},
|
|
112
|
-
help: `Usage: zinn task relation delete <source-task-key> <target-task-key> --type <type>
|
|
113
|
-
|
|
114
|
-
Remove only the specified relation. No confirmation is required.
|
|
115
|
-
|
|
116
|
-
Types: related, dependency, duplicate.
|
|
117
|
-
|
|
118
|
-
For related, either task order works.
|
|
119
|
-
For dependency and duplicate, use the creation direction:
|
|
120
|
-
source depends on target, or source is a duplicate of target.
|
|
121
|
-
|
|
122
|
-
Archived and cross-project tasks are supported.
|
|
123
|
-
A missing relation is an error.
|
|
124
|
-
|
|
125
|
-
Example: zinn task relation delete APP-1 APP-2 --type dependency`,
|
|
126
|
-
},
|
|
127
97
|
create: {
|
|
128
98
|
run: (args) => {
|
|
129
99
|
const props = parseRelationArgs(args);
|
|
@@ -175,4 +145,34 @@ An empty list prints nothing.
|
|
|
175
145
|
|
|
176
146
|
Example: zinn task relation list APP-1`,
|
|
177
147
|
},
|
|
148
|
+
delete: {
|
|
149
|
+
run: (args) => {
|
|
150
|
+
const props = parseRelationArgs(args);
|
|
151
|
+
relation.delete(props, currentActor());
|
|
152
|
+
|
|
153
|
+
const source = task.getByKey(props.sourceTaskKey);
|
|
154
|
+
const target = task.getByKey(props.targetTaskKey);
|
|
155
|
+
const deleted: PresentedRelationChange = {
|
|
156
|
+
type: props.relation_type,
|
|
157
|
+
source: source.key,
|
|
158
|
+
target: target.key,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
output(deleted, (r) => `Deleted ${r.type} relation from ${r.source} to ${r.target}`);
|
|
162
|
+
},
|
|
163
|
+
help: `Usage: zinn task relation delete <source-task-key> <target-task-key> --type <type>
|
|
164
|
+
|
|
165
|
+
Remove only the specified relation. No confirmation is required.
|
|
166
|
+
|
|
167
|
+
Types: related, dependency, duplicate.
|
|
168
|
+
|
|
169
|
+
For related, either task order works.
|
|
170
|
+
For dependency and duplicate, use the creation direction:
|
|
171
|
+
source depends on target, or source is a duplicate of target.
|
|
172
|
+
|
|
173
|
+
Archived and cross-project tasks are supported.
|
|
174
|
+
A missing relation is an error.
|
|
175
|
+
|
|
176
|
+
Example: zinn task relation delete APP-1 APP-2 --type dependency`,
|
|
177
|
+
},
|
|
178
178
|
} satisfies RouteDef;
|
package/src/routes/router.ts
CHANGED
|
@@ -10,18 +10,32 @@ function toCommand(args: Array<string>) {
|
|
|
10
10
|
return args.join(" ");
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Groups sibling commands into one line, e.g. " comment {create|list|edit|delete}".
|
|
14
|
+
function formatCommands(parsedRoutes: Array<ParsedRoute>, prefix: string) {
|
|
15
|
+
const siblingsByParent = new Map<string, Array<string>>();
|
|
16
|
+
for (const { command } of parsedRoutes) {
|
|
17
|
+
if (!command.startsWith(prefix)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const words = command.slice(prefix.length).split(" ");
|
|
22
|
+
const parent = toCommand(words.slice(0, -1));
|
|
23
|
+
siblingsByParent.set(parent, [...(siblingsByParent.get(parent) ?? []), words.at(-1)!]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return [...siblingsByParent]
|
|
27
|
+
.map(([parent, siblings]) => ` ${parent === "" ? "" : `${parent} `}{${siblings.join("|")}}`)
|
|
28
|
+
.join("\n");
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
function getNamespaceHelp(parsedRoutes: Array<ParsedRoute>, namespace: string) {
|
|
14
|
-
const
|
|
15
|
-
const commands = parsedRoutes
|
|
16
|
-
.map((route) => route.command)
|
|
17
|
-
.filter((command) => command.startsWith(prefix))
|
|
18
|
-
.map((command) => command.slice(prefix.length));
|
|
32
|
+
const commands = formatCommands(parsedRoutes, `${namespace} `);
|
|
19
33
|
|
|
20
|
-
if (commands
|
|
34
|
+
if (commands === "") {
|
|
21
35
|
return null;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
|
-
return `Usage: zinn ${namespace} <command>\n\nCommands:\n${commands
|
|
38
|
+
return `Usage: zinn ${namespace} <command>\n\nCommands:\n${commands}`;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
export function parseRoutes(routesDef: RouteDef, prefix?: string) {
|
|
@@ -114,5 +128,8 @@ function route(parsedRoutes: Array<ParsedRoute>, rawArgs: Array<string>) {
|
|
|
114
128
|
export function createRouter(routesDef: RouteDef) {
|
|
115
129
|
const parsedRoutes = parseRoutes(routesDef);
|
|
116
130
|
|
|
117
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
route: (args: Array<string>) => route(parsedRoutes, args),
|
|
133
|
+
commands: formatCommands(parsedRoutes, ""),
|
|
134
|
+
};
|
|
118
135
|
}
|
|
@@ -24,76 +24,6 @@ import {
|
|
|
24
24
|
const limitPattern = new RegExp(`^${positiveIntegerPattern}$`);
|
|
25
25
|
|
|
26
26
|
export const taskRouter = {
|
|
27
|
-
edit: {
|
|
28
|
-
run: (args) => {
|
|
29
|
-
const { values, positionals, tokens } = parseArgs({
|
|
30
|
-
args,
|
|
31
|
-
options: {
|
|
32
|
-
title: { type: "string" },
|
|
33
|
-
description: { type: "string" },
|
|
34
|
-
priority: { type: "string" },
|
|
35
|
-
"add-label": { type: "string", multiple: true },
|
|
36
|
-
"remove-label": { type: "string", multiple: true },
|
|
37
|
-
},
|
|
38
|
-
allowPositionals: true,
|
|
39
|
-
strict: true,
|
|
40
|
-
tokens: true,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const taskKey = positionals[0];
|
|
44
|
-
|
|
45
|
-
if (taskKey == null) {
|
|
46
|
-
quit("Task key must be specified");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
validatePositionalCount(positionals, 1, "Only one task key can be specified");
|
|
50
|
-
|
|
51
|
-
validateUniqueOptions(tokens, ["add-label", "remove-label"]);
|
|
52
|
-
|
|
53
|
-
const hasEditFlags =
|
|
54
|
-
values.title !== undefined ||
|
|
55
|
-
values.description !== undefined ||
|
|
56
|
-
values.priority !== undefined ||
|
|
57
|
-
values["add-label"] !== undefined ||
|
|
58
|
-
values["remove-label"] !== undefined;
|
|
59
|
-
|
|
60
|
-
if (!hasEditFlags) {
|
|
61
|
-
quit(
|
|
62
|
-
"Provide at least one edit flag: --title, --description, --priority, --add-label, or --remove-label",
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const editedTask = task.edit(
|
|
67
|
-
{
|
|
68
|
-
taskKey,
|
|
69
|
-
title: values.title,
|
|
70
|
-
description: values.description,
|
|
71
|
-
priority: parsePriority(values.priority),
|
|
72
|
-
addLabelNames: values["add-label"],
|
|
73
|
-
removeLabelNames: values["remove-label"],
|
|
74
|
-
},
|
|
75
|
-
currentActor(),
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
output(presentTask(editedTask), formatTask);
|
|
79
|
-
},
|
|
80
|
-
help: `Usage: zinn task edit <task-key> [--title <text>] [--description <text>] [--priority <low|medium|high|urgent|none>] [--add-label <name>] [--remove-label <name>]
|
|
81
|
-
|
|
82
|
-
Change the supplied fields and preserve everything else.
|
|
83
|
-
Use --priority none to clear priority.
|
|
84
|
-
Provide at least one edit flag. Use --description "" for an empty description.
|
|
85
|
-
|
|
86
|
-
Repeat --add-label or --remove-label for multiple existing labels.
|
|
87
|
-
Adding an attached label or removing an unattached label does not do anything.
|
|
88
|
-
Archived tasks can be edited. Unchanged values leave the task unchanged.
|
|
89
|
-
|
|
90
|
-
The same label cannot be both added and removed.
|
|
91
|
-
Titles cannot be blank.
|
|
92
|
-
|
|
93
|
-
Use --title="--example" for text beginning with a dash.
|
|
94
|
-
|
|
95
|
-
Example: zinn task edit MDR-1 --title "Meet the quarterly refinement quota"`,
|
|
96
|
-
},
|
|
97
27
|
create: {
|
|
98
28
|
run: (args) => {
|
|
99
29
|
const { values, positionals, tokens } = parseArgs({
|
|
@@ -137,11 +67,12 @@ Example: zinn task edit MDR-1 --title "Meet the quarterly refinement quota"`,
|
|
|
137
67
|
);
|
|
138
68
|
output(presentTask(createdTask), formatTask);
|
|
139
69
|
},
|
|
140
|
-
help: `Usage: zinn task create <project-key> --title <text> [--description <text>] [--priority
|
|
70
|
+
help: `Usage: zinn task create <project-key> --title <text> [--description <text>] [--priority {low|medium|high|urgent|none}] [--label <name>]
|
|
141
71
|
|
|
142
72
|
Create a task in the project's first column.
|
|
143
73
|
Priority defaults to none (unassigned).
|
|
144
74
|
Repeat --label to attach multiple existing labels. Unknown labels are errors.
|
|
75
|
+
Label names are matched case-insensitively.
|
|
145
76
|
Titles cannot be blank. Use --title="--example" for text beginning with a dash.
|
|
146
77
|
|
|
147
78
|
Example: zinn task create MDR --title "Refine the numbers" --description "Meet the quarterly quota" --label urgent`,
|
|
@@ -170,7 +101,7 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
170
101
|
formatTaskList(presentedTasks, { showsStatus: showsAll }),
|
|
171
102
|
);
|
|
172
103
|
},
|
|
173
|
-
help: `Usage: zinn task list [project-key] [--archived
|
|
104
|
+
help: `Usage: zinn task list [<project-key>] [--archived|--all]
|
|
174
105
|
|
|
175
106
|
List active tasks by default.
|
|
176
107
|
Use --archived to list archived tasks or --all to list both.
|
|
@@ -227,7 +158,7 @@ Example: zinn task list MDR --all`,
|
|
|
227
158
|
console.error(`${count} archived ${noun} hidden, use --all to include them`);
|
|
228
159
|
}
|
|
229
160
|
},
|
|
230
|
-
help: `Usage: zinn task search <query> [project-key] [--archived
|
|
161
|
+
help: `Usage: zinn task search <query> [<project-key>] [--archived|--all] [--limit <n>]
|
|
231
162
|
|
|
232
163
|
Search task titles, descriptions, and comments. A comment match lists the task it belongs to.
|
|
233
164
|
Each word matches the start of a word, ignoring case and accents: e.g. "auth" finds "Authentication".
|
|
@@ -283,6 +214,77 @@ Example: zinn task search "refinement quota" MDR --limit 5`,
|
|
|
283
214
|
Show a task with its current column, description, priority, labels, relations, and comments.
|
|
284
215
|
|
|
285
216
|
Example: zinn task view MDR-1`,
|
|
217
|
+
},
|
|
218
|
+
edit: {
|
|
219
|
+
run: (args) => {
|
|
220
|
+
const { values, positionals, tokens } = parseArgs({
|
|
221
|
+
args,
|
|
222
|
+
options: {
|
|
223
|
+
title: { type: "string" },
|
|
224
|
+
description: { type: "string" },
|
|
225
|
+
priority: { type: "string" },
|
|
226
|
+
"add-label": { type: "string", multiple: true },
|
|
227
|
+
"remove-label": { type: "string", multiple: true },
|
|
228
|
+
},
|
|
229
|
+
allowPositionals: true,
|
|
230
|
+
strict: true,
|
|
231
|
+
tokens: true,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
const taskKey = positionals[0];
|
|
235
|
+
|
|
236
|
+
if (taskKey == null) {
|
|
237
|
+
quit("Task key must be specified");
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
validatePositionalCount(positionals, 1, "Only one task key can be specified");
|
|
241
|
+
|
|
242
|
+
validateUniqueOptions(tokens, ["add-label", "remove-label"]);
|
|
243
|
+
|
|
244
|
+
const hasEditFlags =
|
|
245
|
+
values.title !== undefined ||
|
|
246
|
+
values.description !== undefined ||
|
|
247
|
+
values.priority !== undefined ||
|
|
248
|
+
values["add-label"] !== undefined ||
|
|
249
|
+
values["remove-label"] !== undefined;
|
|
250
|
+
|
|
251
|
+
if (!hasEditFlags) {
|
|
252
|
+
quit(
|
|
253
|
+
"Provide at least one edit flag: --title, --description, --priority, --add-label, or --remove-label",
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const editedTask = task.edit(
|
|
258
|
+
{
|
|
259
|
+
taskKey,
|
|
260
|
+
title: values.title,
|
|
261
|
+
description: values.description,
|
|
262
|
+
priority: parsePriority(values.priority),
|
|
263
|
+
addLabelNames: values["add-label"],
|
|
264
|
+
removeLabelNames: values["remove-label"],
|
|
265
|
+
},
|
|
266
|
+
currentActor(),
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
output(presentTask(editedTask), formatTask);
|
|
270
|
+
},
|
|
271
|
+
help: `Usage: zinn task edit <task-key> [--title <text>] [--description <text>] [--priority {low|medium|high|urgent|none}] [--add-label <name>] [--remove-label <name>]
|
|
272
|
+
|
|
273
|
+
Change the supplied fields and preserve everything else.
|
|
274
|
+
Use --priority none to clear priority.
|
|
275
|
+
Provide at least one edit flag. Use --description "" for an empty description.
|
|
276
|
+
|
|
277
|
+
Repeat --add-label or --remove-label for multiple existing labels.
|
|
278
|
+
Label names are matched case-insensitively.
|
|
279
|
+
Adding an attached label or removing an unattached label does not do anything.
|
|
280
|
+
Archived tasks can be edited. Unchanged values leave the task unchanged.
|
|
281
|
+
|
|
282
|
+
The same label cannot be both added and removed.
|
|
283
|
+
Titles cannot be blank.
|
|
284
|
+
|
|
285
|
+
Use --title="--example" for text beginning with a dash.
|
|
286
|
+
|
|
287
|
+
Example: zinn task edit MDR-1 --title "Meet the quarterly refinement quota"`,
|
|
286
288
|
},
|
|
287
289
|
move: {
|
|
288
290
|
run: (args) => {
|
|
@@ -355,14 +357,48 @@ Example: zinn task move MDR-1 "In Progress"`,
|
|
|
355
357
|
quit(`Unknown order direction "${direction}"`);
|
|
356
358
|
}
|
|
357
359
|
},
|
|
358
|
-
help: `Usage: zinn task order <task-key>
|
|
359
|
-
zinn task order <task-key>
|
|
360
|
+
help: `Usage: zinn task order <task-key> {top|up|down|bottom}
|
|
361
|
+
zinn task order <task-key> {before|after} <target-task-key>
|
|
360
362
|
|
|
361
363
|
Change a task's position within its current column.
|
|
362
364
|
Use top or bottom for either end, up or down for one position,
|
|
363
365
|
or before or after to place it relative to another task.
|
|
364
366
|
|
|
365
367
|
Example: zinn task order MDR-2 before MDR-1`,
|
|
368
|
+
},
|
|
369
|
+
archive: {
|
|
370
|
+
run: (args: Array<string>) => {
|
|
371
|
+
const taskKey = args[0];
|
|
372
|
+
|
|
373
|
+
if (taskKey == null) {
|
|
374
|
+
quit("Task key must be specified");
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const archivedTask = task.archive(taskKey, currentActor());
|
|
378
|
+
output(presentTask(archivedTask), formatTaskWithStatus);
|
|
379
|
+
},
|
|
380
|
+
help: `Usage: zinn task archive <task-key>
|
|
381
|
+
|
|
382
|
+
Archive a task so it no longer appears in active task lists.
|
|
383
|
+
|
|
384
|
+
Example: zinn task archive MDR-1`,
|
|
385
|
+
},
|
|
386
|
+
unarchive: {
|
|
387
|
+
run: (args: Array<string>) => {
|
|
388
|
+
const taskKey = args[0];
|
|
389
|
+
|
|
390
|
+
if (taskKey == null) {
|
|
391
|
+
quit("Task key must be specified");
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const unarchivedTask = task.unarchive(taskKey, currentActor());
|
|
395
|
+
output(presentTask(unarchivedTask), formatTaskWithStatus);
|
|
396
|
+
},
|
|
397
|
+
help: `Usage: zinn task unarchive <task-key>
|
|
398
|
+
|
|
399
|
+
Unarchive a task at the bottom of its previous column.
|
|
400
|
+
|
|
401
|
+
Example: zinn task unarchive MDR-1`,
|
|
366
402
|
},
|
|
367
403
|
delete: {
|
|
368
404
|
run: (args: Array<string>) => {
|
|
@@ -402,40 +438,6 @@ Permanently delete a task after confirmation.
|
|
|
402
438
|
Use --yes to skip the confirmation prompt, for example in scripts or with --json.
|
|
403
439
|
|
|
404
440
|
Example: zinn task delete MDR-1`,
|
|
405
|
-
},
|
|
406
|
-
archive: {
|
|
407
|
-
run: (args: Array<string>) => {
|
|
408
|
-
const taskKey = args[0];
|
|
409
|
-
|
|
410
|
-
if (taskKey == null) {
|
|
411
|
-
quit("Task key must be specified");
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const archivedTask = task.archive(taskKey, currentActor());
|
|
415
|
-
output(presentTask(archivedTask), formatTaskWithStatus);
|
|
416
|
-
},
|
|
417
|
-
help: `Usage: zinn task archive <task-key>
|
|
418
|
-
|
|
419
|
-
Archive a task so it no longer appears in active task lists.
|
|
420
|
-
|
|
421
|
-
Example: zinn task archive MDR-1`,
|
|
422
|
-
},
|
|
423
|
-
unarchive: {
|
|
424
|
-
run: (args: Array<string>) => {
|
|
425
|
-
const taskKey = args[0];
|
|
426
|
-
|
|
427
|
-
if (taskKey == null) {
|
|
428
|
-
quit("Task key must be specified");
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
const unarchivedTask = task.unarchive(taskKey, currentActor());
|
|
432
|
-
output(presentTask(unarchivedTask), formatTaskWithStatus);
|
|
433
|
-
},
|
|
434
|
-
help: `Usage: zinn task unarchive <task-key>
|
|
435
|
-
|
|
436
|
-
Unarchive a task at the bottom of its previous column.
|
|
437
|
-
|
|
438
|
-
Example: zinn task unarchive MDR-1`,
|
|
439
441
|
},
|
|
440
442
|
relation: relationRouter,
|
|
441
443
|
comment: commentRouter,
|
|
@@ -445,19 +447,19 @@ Example: zinn task unarchive MDR-1`,
|
|
|
445
447
|
const props = parseTaskLabelArgs(args);
|
|
446
448
|
output(presentTask(task.label.add(props, currentActor())), formatTask);
|
|
447
449
|
},
|
|
448
|
-
help: `Usage: zinn task label add <task-key> <label-name
|
|
450
|
+
help: `Usage: zinn task label add <task-key> <label-name>...
|
|
449
451
|
|
|
450
|
-
Add existing labels to a task.
|
|
452
|
+
Add existing labels to a task. Label names are matched case-insensitively.
|
|
453
|
+
Already attached labels are unchanged.`,
|
|
451
454
|
},
|
|
452
455
|
remove: {
|
|
453
456
|
run: (args) => {
|
|
454
457
|
const props = parseTaskLabelArgs(args);
|
|
455
458
|
output(presentTask(task.label.remove(props, currentActor())), formatTask);
|
|
456
459
|
},
|
|
457
|
-
help: `Usage: zinn task label remove <task-key> <label-name
|
|
460
|
+
help: `Usage: zinn task label remove <task-key> <label-name>...
|
|
458
461
|
|
|
459
|
-
Remove existing labels from a task.
|
|
460
|
-
Label definitions are preserved.`,
|
|
462
|
+
Remove existing labels from a task. Label names are matched case-insensitively.`,
|
|
461
463
|
},
|
|
462
464
|
},
|
|
463
465
|
} satisfies RouteDef;
|