@zinn-dev/cli 0.34.0 → 0.36.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 +11 -7
- package/package.json +2 -2
- package/src/presentation/description-presentation.ts +15 -0
- package/src/presentation/task-presentation.ts +2 -16
- package/src/routes/label-router.ts +6 -4
- package/src/routes/project-router.ts +28 -24
- package/src/routes/task-router.ts +1 -1
- package/src/constant.ts +0 -1
package/README.md
CHANGED
|
@@ -13,15 +13,17 @@ Set `ZINN_DIR` to use another Zinn directory and keep using the same value for c
|
|
|
13
13
|
|
|
14
14
|
## Start a project
|
|
15
15
|
|
|
16
|
-
Create a project with a key
|
|
16
|
+
Create a project with a key and optionally provide a name and description:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
zinn project create MDR --name "Macrodata Refinement"
|
|
19
|
+
zinn project create MDR --name "Macrodata Refinement" --description "Refine macrodata"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Project keys are stored in **uppercase**. You can create a project without a project name, like `zinn project create MDR`, which will just default to having the key as the project name too.
|
|
23
23
|
Intetionally empty or whitespace project names are rejected.
|
|
24
24
|
|
|
25
|
+
Project descriptions are optional and may contain multiple lines. An omitted, empty or whitespace-only description is stored as `null`. Text containing a non-whitespace character is preserved exactly, including leading and trailing whitespace; the same rule applies to task and label descriptions. Clear an existing description with `zinn project edit <project-key> --description ""`. Project list, view and mutation text show truncated inline description previews. Project JSON includes the full description or `null`.
|
|
26
|
+
|
|
25
27
|
Each project starts with _Backlog_, _TODO_, _In Progress_, _Review_, and _Done_ columns.
|
|
26
28
|
|
|
27
29
|
You can list projects or inspect a project's columns with:
|
|
@@ -34,14 +36,16 @@ zinn project column list MDR
|
|
|
34
36
|
|
|
35
37
|
`project view` prints the project and its unarchived tasks. It's the same list as you would get with `zinn task list <project-key>`.
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
Edit a project:
|
|
38
40
|
|
|
39
41
|
```sh
|
|
40
42
|
zinn project edit MDR --name "Macrodata Refinement (Morning Shift)"
|
|
43
|
+
zinn project edit MDR --description "Meet the quarterly quota"
|
|
44
|
+
zinn project edit MDR --description ""
|
|
41
45
|
```
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
At least one of `--name` or `--description` is required. Names must contain printable text on a single line.
|
|
48
|
+
Only supplied fields change; unchanged values leave the modification timestamp unchanged.
|
|
45
49
|
Use `--name="--example"` when a value begins with a dash.
|
|
46
50
|
|
|
47
51
|
Add another column at the end of the board:
|
|
@@ -148,7 +152,7 @@ For adding or removing multiple labels at the same time, repeat `--label` on cre
|
|
|
148
152
|
Each value is considered as the label name: `--label "needs review"`, so if you have commas, then they are considered parts of names.
|
|
149
153
|
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.
|
|
150
154
|
|
|
151
|
-
Descriptions default
|
|
155
|
+
Descriptions are `null` by default, and empty or whitespace-only strings are also interpreted as `null`. Clear a label description with `zinn label edit <name> --description ""`. Label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
|
|
152
156
|
|
|
153
157
|
`label create`, `label edit` and `label list` print each label name in its color. When color is off (see [Scripting and JSON output](#scripting-and-json-output)), they name the color instead, such as `bug | red | Broken`. `--json` output always shows the color as a value.
|
|
154
158
|
|
|
@@ -219,7 +223,7 @@ zinn task edit MDR-1 --description "Complete refinement before the waffle party"
|
|
|
219
223
|
zinn task edit MDR-1 --title "Meet the quarterly refinement quota" --description ""
|
|
220
224
|
```
|
|
221
225
|
|
|
222
|
-
Only the explicitly specified fields are modified and the rest are untouched.
|
|
226
|
+
Only the explicitly specified fields are modified and the rest are untouched. Use `--description ""` to clear a description. It is stored and returned in JSON as `null`. If a description during task creation is omitted, it is treated as `null` by default, and if a _falsy_ value is provided, then it's also interpreted as `null`.
|
|
223
227
|
|
|
224
228
|
At least one flag is required and task titles cannot be blank. Archived tasks can be edited without unarchiving them. Supplying unchanged values does not change the modification timestamp.
|
|
225
229
|
Use `--title="--example"` when a value begins with a dash.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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.25.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function formatDescriptionPreview(description: string | null) {
|
|
2
|
+
const DESCRIPTION_PREVIEW_LENGTH = 80;
|
|
3
|
+
|
|
4
|
+
if (description == null) {
|
|
5
|
+
return "";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const normalizedDescription = description.replace(/\s+/g, " ").trim();
|
|
9
|
+
|
|
10
|
+
if (normalizedDescription.length <= DESCRIPTION_PREVIEW_LENGTH) {
|
|
11
|
+
return normalizedDescription;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return `${normalizedDescription.slice(0, DESCRIPTION_PREVIEW_LENGTH - 1).trimEnd()}…`;
|
|
15
|
+
}
|
|
@@ -2,23 +2,9 @@ import type { TaskPriority, TaskWithKey } from "@zinn-dev/core";
|
|
|
2
2
|
|
|
3
3
|
import { column, task } from "@zinn-dev/core";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { formatDescriptionPreview } from "./description-presentation";
|
|
6
6
|
import { styleOutputText } from "./color";
|
|
7
7
|
|
|
8
|
-
function formatTaskDescriptionPreview(description: string | null) {
|
|
9
|
-
if (description == null) {
|
|
10
|
-
return "";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const normalizedDescription = description.replace(/\s+/g, " ").trim();
|
|
14
|
-
|
|
15
|
-
if (normalizedDescription.length <= TASK_DESCRIPTION_PREVIEW_LENGTH) {
|
|
16
|
-
return normalizedDescription;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return `${normalizedDescription.slice(0, TASK_DESCRIPTION_PREVIEW_LENGTH - 1).trimEnd()}…`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
8
|
export type PresentedTask = {
|
|
23
9
|
key: string;
|
|
24
10
|
status: "Active" | "Archived";
|
|
@@ -107,7 +93,7 @@ export function formatTaskList(
|
|
|
107
93
|
const status = options.showsStatus
|
|
108
94
|
? ` | ${presentedTask.status.padEnd(longestStatusLength)}`
|
|
109
95
|
: "";
|
|
110
|
-
const descriptionPreview =
|
|
96
|
+
const descriptionPreview = formatDescriptionPreview(presentedTask.description);
|
|
111
97
|
const hasDescriptionPreview = descriptionPreview.length > 0;
|
|
112
98
|
const description = hasDescriptionPreview ? ` | ${descriptionPreview}` : "";
|
|
113
99
|
const priority = formatTaskPriorityMarker(presentedTask.priority);
|
|
@@ -26,7 +26,7 @@ function formatLabel(presented: PresentedLabel) {
|
|
|
26
26
|
? styleOutputText(presented.color, presented.name)
|
|
27
27
|
: `${presented.name} | ${presented.color}`;
|
|
28
28
|
|
|
29
|
-
if (presented.description
|
|
29
|
+
if (presented.description == null) {
|
|
30
30
|
return name;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -57,8 +57,10 @@ export const labelRouter = {
|
|
|
57
57
|
|
|
58
58
|
Create a global label. Names preserve casing, but uniqueness is case-insensitive.
|
|
59
59
|
Names are trimmed and cannot be blank.
|
|
60
|
-
Description
|
|
61
|
-
|
|
60
|
+
Description is optional.
|
|
61
|
+
|
|
62
|
+
Color defaults to white.
|
|
63
|
+
Valid colors: red, green, yellow, blue, magenta, cyan, white, gray.
|
|
62
64
|
|
|
63
65
|
Example: zinn label create bug --description "Unexpected behavior" --color red`,
|
|
64
66
|
},
|
|
@@ -96,7 +98,7 @@ List all global label definitions.`,
|
|
|
96
98
|
help: `Usage: zinn label edit <name> [--name <text>] [--description <text>] [--color <color>]
|
|
97
99
|
|
|
98
100
|
Change specified fields.
|
|
99
|
-
Provide at least one edit flag. Use --description ""
|
|
101
|
+
Provide at least one edit flag. Use --description "" to clear the description.
|
|
100
102
|
|
|
101
103
|
Names are matched and kept unique case-insensitively while preserving their casing.
|
|
102
104
|
Names are trimmed. Changing only the casing is allowed.
|
|
@@ -12,17 +12,20 @@ import {
|
|
|
12
12
|
validateUniqueOptions,
|
|
13
13
|
} from "../lib";
|
|
14
14
|
import { formatTaskList, presentTask } from "../presentation/task-presentation";
|
|
15
|
+
import { formatDescriptionPreview } from "../presentation/description-presentation";
|
|
15
16
|
import { currentActor } from "../actor";
|
|
16
17
|
|
|
17
|
-
type PresentedProject = { key: string; name: string };
|
|
18
|
+
type PresentedProject = { key: string; name: string; description: string | null };
|
|
18
19
|
type PresentedProjectView = PresentedProject & { tasks: Array<PresentedTask> };
|
|
19
20
|
|
|
20
21
|
function presentProject(projectMatch: PresentedProject): PresentedProject {
|
|
21
|
-
return { key: projectMatch.key, name: projectMatch.name };
|
|
22
|
+
return { key: projectMatch.key, name: projectMatch.name, description: projectMatch.description };
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
function formatProject(presented: PresentedProject) {
|
|
25
|
-
|
|
25
|
+
function formatProject(presented: PresentedProject, keyWidth = presented.key.length) {
|
|
26
|
+
const descriptionPreview = formatDescriptionPreview(presented.description);
|
|
27
|
+
const description = descriptionPreview.length > 0 ? ` | ${descriptionPreview}` : "";
|
|
28
|
+
return `${presented.key.padEnd(keyWidth)} | ${presented.name}${description}`;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
type PresentedColumn = { project: string; name: string };
|
|
@@ -42,7 +45,7 @@ export const projectRouter = {
|
|
|
42
45
|
run: (args: Array<string>) => {
|
|
43
46
|
const { values, positionals, tokens } = parseArgs({
|
|
44
47
|
args,
|
|
45
|
-
options: { name: { type: "string" } },
|
|
48
|
+
options: { name: { type: "string" }, description: { type: "string" } },
|
|
46
49
|
allowPositionals: true,
|
|
47
50
|
strict: true,
|
|
48
51
|
tokens: true,
|
|
@@ -59,19 +62,23 @@ export const projectRouter = {
|
|
|
59
62
|
validateUniqueOptions(tokens);
|
|
60
63
|
|
|
61
64
|
try {
|
|
62
|
-
const createdProject = project.create(
|
|
65
|
+
const createdProject = project.create(
|
|
66
|
+
{ key: projectKey, name: values.name, description: values.description },
|
|
67
|
+
currentActor(),
|
|
68
|
+
);
|
|
63
69
|
output(presentProject(createdProject), formatProject);
|
|
64
70
|
} catch (err: any) {
|
|
65
71
|
quit(err?.message ?? "Something went wrong");
|
|
66
72
|
}
|
|
67
73
|
},
|
|
68
|
-
help: `Usage: zinn project create <project-key> [--name <text>]
|
|
74
|
+
help: `Usage: zinn project create <project-key> [--name <text>] [--description <text>]
|
|
69
75
|
|
|
70
76
|
Create a project with the default columns.
|
|
71
77
|
Project keys are stored in uppercase.
|
|
72
78
|
|
|
73
79
|
An omitted name defaults to the uppercase project key.
|
|
74
80
|
Names cannot be blank.
|
|
81
|
+
Descriptions may contain multiple lines. If omitted, they are saved as null.
|
|
75
82
|
|
|
76
83
|
Example: zinn project create MDR --name "Macrodata Refinement"`,
|
|
77
84
|
},
|
|
@@ -85,14 +92,12 @@ Example: zinn project create MDR --name "Macrodata Refinement"`,
|
|
|
85
92
|
0,
|
|
86
93
|
);
|
|
87
94
|
|
|
88
|
-
return presentedProjects
|
|
89
|
-
.map((p) => `${p.key.padEnd(longestKeyLength)} | ${p.name}`)
|
|
90
|
-
.join("\n");
|
|
95
|
+
return presentedProjects.map((p) => formatProject(p, longestKeyLength)).join("\n");
|
|
91
96
|
});
|
|
92
97
|
},
|
|
93
98
|
help: `Usage: zinn project list
|
|
94
99
|
|
|
95
|
-
List projects and
|
|
100
|
+
List projects, their keys, and truncated description previews.
|
|
96
101
|
|
|
97
102
|
Example: zinn project list`,
|
|
98
103
|
},
|
|
@@ -134,7 +139,7 @@ Example: zinn project view MDR`,
|
|
|
134
139
|
run: (args) => {
|
|
135
140
|
const { values, positionals, tokens } = parseArgs({
|
|
136
141
|
args,
|
|
137
|
-
options: { name: { type: "string" } },
|
|
142
|
+
options: { name: { type: "string" }, description: { type: "string" } },
|
|
138
143
|
allowPositionals: true,
|
|
139
144
|
strict: true,
|
|
140
145
|
tokens: true,
|
|
@@ -150,19 +155,21 @@ Example: zinn project view MDR`,
|
|
|
150
155
|
|
|
151
156
|
validateUniqueOptions(tokens);
|
|
152
157
|
|
|
153
|
-
if (values.name === undefined) {
|
|
154
|
-
quit("Provide an edit flag: --name");
|
|
158
|
+
if (values.name === undefined && values.description === undefined) {
|
|
159
|
+
quit("Provide an edit flag: --name or --description");
|
|
155
160
|
}
|
|
156
161
|
|
|
157
|
-
const editedProject = project.edit(
|
|
162
|
+
const editedProject = project.edit(
|
|
163
|
+
{ projectKey, name: values.name, description: values.description },
|
|
164
|
+
currentActor(),
|
|
165
|
+
);
|
|
158
166
|
output(presentProject(editedProject), formatProject);
|
|
159
167
|
},
|
|
160
|
-
help: `Usage: zinn project edit <project-key> --name <text>
|
|
161
|
-
|
|
162
|
-
Change the project name.
|
|
163
|
-
The --name flag is required.
|
|
168
|
+
help: `Usage: zinn project edit <project-key> [--name <text>] [--description <text>]
|
|
164
169
|
|
|
165
|
-
|
|
170
|
+
Change the supplied project fields. At least one edit flag is required.
|
|
171
|
+
Use --description "" to clear the description.
|
|
172
|
+
Omitted fields are preserved. Unchanged values leave the timestamp unchanged.
|
|
166
173
|
|
|
167
174
|
Example: zinn project edit MDR --name "Macrodata Refinement"`,
|
|
168
175
|
},
|
|
@@ -332,10 +339,7 @@ Example: zinn project column edit MDR "In Progress" --name "Refining"`,
|
|
|
332
339
|
quit(`Order direction "${direction}" does not accept a target column`);
|
|
333
340
|
}
|
|
334
341
|
|
|
335
|
-
orderedColumn = column.order(
|
|
336
|
-
{ projectKey, columnName, direction },
|
|
337
|
-
currentActor(),
|
|
338
|
-
);
|
|
342
|
+
orderedColumn = column.order({ projectKey, columnName, direction }, currentActor());
|
|
339
343
|
break;
|
|
340
344
|
}
|
|
341
345
|
default:
|
|
@@ -291,7 +291,7 @@ Example: zinn task view MDR-1`,
|
|
|
291
291
|
|
|
292
292
|
Change the supplied fields and preserve everything else.
|
|
293
293
|
Use --priority none to clear priority.
|
|
294
|
-
Provide at least one edit flag. Use --description ""
|
|
294
|
+
Provide at least one edit flag. Use --description "" to clear the description.
|
|
295
295
|
|
|
296
296
|
Repeat --add-label or --remove-label for multiple existing labels.
|
|
297
297
|
Label names are matched case-insensitively.
|
package/src/constant.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const TASK_DESCRIPTION_PREVIEW_LENGTH = 80;
|