@zinn-dev/cli 0.33.0 → 0.35.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
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. If a description is not provided, it is stored as `null`. Also, if you want to _empty_ an existing description, you can do so with `project edit --description ""`, which stores an empty string. Project list, view and mutation text show _truncated_ inline description previews. Project JSON includes `description`, including null and empty strings.
|
|
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:
|
|
@@ -91,11 +95,14 @@ Tasks are created with keys such as `MDR-1`. List active tasks, optionally limit
|
|
|
91
95
|
```sh
|
|
92
96
|
zinn task list
|
|
93
97
|
zinn task list MDR
|
|
98
|
+
zinn task list MDR --label CLI --label Groom
|
|
94
99
|
zinn task view MDR-1
|
|
95
100
|
```
|
|
96
101
|
|
|
97
102
|
The list follows the project's column order and the task order within each column. Without a project key, projects are listed one after another, sorted by key.
|
|
98
103
|
|
|
104
|
+
Use `--label <name>` to list tasks with a label. You can provide multiple `--label` flags to refine your filter further down to more specific task results. Label names matching ignores casing. An unknown label causes an error to be raised.
|
|
105
|
+
|
|
99
106
|
## Search tasks
|
|
100
107
|
|
|
101
108
|
Search task titles, descriptions, and comments, optionally in one project:
|
|
@@ -105,6 +112,7 @@ zinn task search refine
|
|
|
105
112
|
zinn task search "quarterly quota" MDR
|
|
106
113
|
zinn task search MDR-1
|
|
107
114
|
zinn task search auth --all --limit 5
|
|
115
|
+
zinn task search auth MDR --label cli
|
|
108
116
|
```
|
|
109
117
|
|
|
110
118
|
Each query matches the start of a word, ignoring case and accents, so `cafe` finds "Café" and `auth` finds "Authentication". Every word must match somewhere in the task: its title, its description, or any of its comments. A comment match lists the task the comment belongs to.
|
|
@@ -114,6 +122,8 @@ If the whole query is an existing task key, such as `mdr-1`, that task comes fir
|
|
|
114
122
|
Note that by default only the active tasks are searched.
|
|
115
123
|
`--archived` searches only archived tasks and `--all` searches both, just like how it is with `task list`. When archived matches are left out, Zinn prints a note such as `2 archived matches hidden, use --all to include them`. This extra info is not a part of the `--json` output. `--limit <n>` shows at most `n` results.
|
|
116
124
|
|
|
125
|
+
`--label` works as it does for `task list`: repeat it to require every specified label. Label filtering happens before `--limit` and before archived matches are counted.
|
|
126
|
+
|
|
117
127
|
Results use the same rows and `--json` shape as `task list`. A search with no results prints nothing and exits successfully. Put `--` before a query that begins with a dash: `zinn task search -- -flag`.
|
|
118
128
|
|
|
119
129
|
Search uses an index that Zinn keeps up to date as tasks and comments change.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.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.24.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);
|
|
@@ -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 to an empty string.
|
|
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:
|
|
@@ -79,35 +79,46 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
79
79
|
},
|
|
80
80
|
list: {
|
|
81
81
|
run: (args) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const { values, positionals, tokens } = parseArgs({
|
|
83
|
+
args,
|
|
84
|
+
options: {
|
|
85
|
+
archived: { type: "boolean" },
|
|
86
|
+
all: { type: "boolean" },
|
|
87
|
+
label: { type: "string", multiple: true },
|
|
88
|
+
},
|
|
89
|
+
allowPositionals: true,
|
|
90
|
+
strict: true,
|
|
91
|
+
tokens: true,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
validateUniqueOptions(tokens, ["label"]);
|
|
84
95
|
|
|
85
|
-
if (
|
|
96
|
+
if (values.archived && values.all) {
|
|
86
97
|
quit('Use either "--archived" or "--all", not both');
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
const
|
|
90
|
-
const projectKey = positionalArgs[0];
|
|
100
|
+
const projectKey = positionals[0];
|
|
91
101
|
|
|
92
|
-
if (
|
|
102
|
+
if (positionals.length > 1) {
|
|
93
103
|
quit("Only one project key can be specified");
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
const archive =
|
|
106
|
+
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
97
107
|
|
|
98
|
-
const tasks = task.getAll({ projectKey, archive });
|
|
108
|
+
const tasks = task.getAll({ projectKey, archive, labelNames: values.label });
|
|
99
109
|
|
|
100
110
|
output(tasks.map(presentTask), (presentedTasks) =>
|
|
101
|
-
formatTaskList(presentedTasks, { showsStatus:
|
|
111
|
+
formatTaskList(presentedTasks, { showsStatus: values.all }),
|
|
102
112
|
);
|
|
103
113
|
},
|
|
104
|
-
help: `Usage: zinn task list [<project-key>] [--archived|--all]
|
|
114
|
+
help: `Usage: zinn task list [<project-key>] [--archived|--all] [--label <name>]
|
|
105
115
|
|
|
106
116
|
List active tasks by default.
|
|
107
117
|
Use --archived to list archived tasks or --all to list both.
|
|
118
|
+
Use --label to filter for tasks with a specific label, no case-sensitivity is applied for matching.
|
|
108
119
|
Priority markers: - unassigned, L low, M medium, H high, U urgent.
|
|
109
120
|
|
|
110
|
-
Example: zinn task list MDR --
|
|
121
|
+
Example: zinn task list MDR --label cli`,
|
|
111
122
|
},
|
|
112
123
|
search: {
|
|
113
124
|
run: (args) => {
|
|
@@ -117,6 +128,7 @@ Example: zinn task list MDR --all`,
|
|
|
117
128
|
archived: { type: "boolean" },
|
|
118
129
|
all: { type: "boolean" },
|
|
119
130
|
limit: { type: "string" },
|
|
131
|
+
label: { type: "string", multiple: true },
|
|
120
132
|
},
|
|
121
133
|
allowPositionals: true,
|
|
122
134
|
strict: true,
|
|
@@ -133,7 +145,7 @@ Example: zinn task list MDR --all`,
|
|
|
133
145
|
quit("Only one query and one project key can be specified; quote multi-word queries");
|
|
134
146
|
}
|
|
135
147
|
|
|
136
|
-
validateUniqueOptions(tokens);
|
|
148
|
+
validateUniqueOptions(tokens, ["label"]);
|
|
137
149
|
|
|
138
150
|
if (values.archived && values.all) {
|
|
139
151
|
quit('Use either "--archived" or "--all", not both');
|
|
@@ -146,7 +158,13 @@ Example: zinn task list MDR --all`,
|
|
|
146
158
|
}
|
|
147
159
|
|
|
148
160
|
const limit = values.limit === undefined ? undefined : Number(values.limit);
|
|
149
|
-
const result = task.search({
|
|
161
|
+
const result = task.search({
|
|
162
|
+
query,
|
|
163
|
+
projectKey,
|
|
164
|
+
archive,
|
|
165
|
+
limit,
|
|
166
|
+
labelNames: values.label,
|
|
167
|
+
});
|
|
150
168
|
|
|
151
169
|
output(result.tasks.map(presentTask), (presentedTasks) =>
|
|
152
170
|
formatTaskList(presentedTasks, { showsStatus: values.all }),
|
|
@@ -158,7 +176,7 @@ Example: zinn task list MDR --all`,
|
|
|
158
176
|
console.error(`${count} archived ${noun} hidden, use --all to include them`);
|
|
159
177
|
}
|
|
160
178
|
},
|
|
161
|
-
help: `Usage: zinn task search <query> [<project-key>] [--archived|--all] [--limit <n>]
|
|
179
|
+
help: `Usage: zinn task search <query> [<project-key>] [--archived|--all] [--limit <n>] [--label <name>]
|
|
162
180
|
|
|
163
181
|
Search task titles, descriptions, and comments. A comment match lists the task it belongs to.
|
|
164
182
|
Each word matches the start of a word, ignoring case and accents: e.g. "auth" finds "Authentication".
|
|
@@ -171,6 +189,7 @@ Equally relevant tasks are ordered by project key, then task number.
|
|
|
171
189
|
By default, only active tasks are searched. Use --archived to search archived tasks or --all to search both.
|
|
172
190
|
When archived matches are hidden, a note is printed to say how many.
|
|
173
191
|
Use --limit to show at most <n> results.
|
|
192
|
+
Use --label to filter for tasks with a specific label, no case-sensitivity is applied for matching.
|
|
174
193
|
A search result's output matches that of 'task list'.
|
|
175
194
|
|
|
176
195
|
Use -- before a query that begins with a dash.
|
package/src/constant.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const TASK_DESCRIPTION_PREVIEW_LENGTH = 80;
|