@zinn-dev/cli 0.37.0 → 0.39.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 +198 -85
- package/index.ts +1 -15
- package/package.json +2 -2
- package/src/lib.test.ts +28 -2
- package/src/lib.ts +52 -15
- package/src/presentation/activity-presentation.test.ts +112 -0
- package/src/presentation/activity-presentation.ts +490 -0
- package/src/presentation/column-presentation.ts +19 -9
- package/src/presentation/description-presentation.ts +7 -4
- package/src/presentation/task-presentation.ts +5 -4
- package/src/presentation/time.ts +17 -0
- package/src/project.test.ts +479 -0
- package/src/project.ts +53 -0
- package/src/routes/activity-router.ts +81 -0
- package/src/routes/backup-router.ts +3 -2
- package/src/routes/comment-router.ts +39 -27
- package/src/routes/label-router.ts +25 -17
- package/src/routes/migrate-router.ts +4 -2
- package/src/routes/project-router.ts +110 -88
- package/src/routes/reindex-router.ts +3 -2
- package/src/routes/relation-router.ts +9 -7
- package/src/routes/restore-router.ts +2 -2
- package/src/routes/router.test.ts +18 -0
- package/src/routes/router.ts +108 -22
- package/src/routes/routes.ts +2 -0
- package/src/routes/task-router.ts +172 -103
- package/src/text-edit.ts +68 -0
package/README.md
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
The `zinn` command-line interface. Requires [Bun](https://bun.sh).
|
|
4
4
|
|
|
5
5
|
> [!IMPORTANT]
|
|
6
|
-
> **Experimental.** Commands, output and the database schema
|
|
7
|
-
>
|
|
8
|
-
> Run `zinn backup` before upgrading.
|
|
6
|
+
> **Experimental.** Commands, output, and the database schema will likely change often between releases until stable.
|
|
7
|
+
> Run `zinn backup` before upgrading. See [upgrade the database](#upgrade-the-database).
|
|
9
8
|
|
|
10
9
|
## Install
|
|
11
10
|
|
|
@@ -13,54 +12,122 @@ The `zinn` command-line interface. Requires [Bun](https://bun.sh).
|
|
|
13
12
|
bun add --global @zinn-dev/cli
|
|
14
13
|
```
|
|
15
14
|
|
|
15
|
+
For a first project and task, see the [quick start](../../README.md#quick-start).
|
|
16
|
+
|
|
16
17
|
Zinn stores projects and tasks in the shared local database at `~/.zinn/data/zinn.sqlite`.
|
|
17
18
|
Set `ZINN_DIR` to use another Zinn directory and keep using the same value for commands that should share that database. A relative `ZINN_DIR` stays relative to the current folder. A settings file can also choose the directory (see [Settings files](#settings-files)).
|
|
18
19
|
|
|
19
20
|
## Settings files
|
|
20
21
|
|
|
21
|
-
Zinn
|
|
22
|
+
With `ZINN_DIR` set, Zinn uses `data/zinn.sqlite`, `backups/`, and `settings.json` inside that directory. That `settings.json` is the sole configuration file for the invocation, which means its `defaultProject` applies to that store. `ZINN_DIR` also takes precedence over `storage.directory` in that file.
|
|
23
|
+
|
|
24
|
+
Without `ZINN_DIR`, Zinn reads two optional settings files:
|
|
22
25
|
|
|
23
|
-
- `settings.json` in
|
|
26
|
+
- `settings.json` in `~/.zinn` holds the global settings.
|
|
24
27
|
- `zinn.local.json` holds the settings for one codebase. Zinn uses the nearest one, from the current folder up to the Git root. Outside a Git repository it checks only the current folder.
|
|
25
28
|
|
|
26
|
-
`zinn.local.json` is personal, since it holds paths from one machine, and is not meant to be committed. Zinn reads it whether or not git ignores it
|
|
29
|
+
`zinn.local.json` is personal, since it holds paths from one machine, and is not meant to be committed. Without `ZINN_DIR`, Zinn reads it whether or not git ignores it and merges it over the global file, field by field. A missing file is fine, and Zinn creates no settings file.
|
|
27
30
|
|
|
28
31
|
The files are plain JSON, without comments:
|
|
29
32
|
|
|
30
33
|
```json
|
|
31
34
|
{
|
|
35
|
+
"$schema": "https://zinn.sh/schemas/settings/v1.json",
|
|
36
|
+
"defaultProject": "MDR",
|
|
32
37
|
"storage": {
|
|
33
38
|
"directory": "~/work/zinn-data"
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
`$schema`
|
|
43
|
+
`$schema` is optional and lets editors handle autocomplete and check the file, but Zinn itself ignores it. New settings are added to the same number; only a change that would make existing files invalid gets a new number. An unknown key, a value of the wrong type or invalid JSON in a selected settings file stops every command with an error that names the file. Zinn _does not fall back to the defaults_.
|
|
39
44
|
|
|
40
45
|
`storage.directory` names a Zinn directory with the same layout as `ZINN_DIR`: `data/zinn.sqlite` and `backups/`. The first of these that is set decides the directory: `ZINN_DIR`, `storage.directory` in `zinn.local.json`, `storage.directory` in the global `settings.json`, then `~/.zinn`. A relative path is relative to the folder of the file that sets it. A leading `~` or `~/` means your home folder.
|
|
41
46
|
|
|
47
|
+
`defaultProject` names the project used when its key is omitted from `task create`, `task list`, `task search`, `project view`, `project column list`, `project edit`, or `project delete`. Project keys are matched case-insensitively. A key typed in the command wins, then the local setting, then the global setting. A local file that omits this field keeps the global value; `null` is not accepted.
|
|
48
|
+
|
|
49
|
+
Without a default, `task list` and `task search` cover every project, and the other commands require a key. When a configured default names a missing project, commands using it fail with an error naming the key and its settings file.
|
|
50
|
+
|
|
51
|
+
On `task list` and `task search`, `--all-projects` covers every project, overriding the default, and works with `--all` or `--archived`. It cannot be combined with a typed project key. Commands taking a task key use the project named by that key. Column creation, editing, and ordering require an explicit project key.
|
|
52
|
+
|
|
42
53
|
## Editing conventions
|
|
43
54
|
|
|
44
|
-
Edit commands change only the fields you supply
|
|
55
|
+
Edit commands change only the fields you supply, whereas omitted fields keep their current values. At least one edit field is required. After input normalization, a valid edit that leaves all values unchanged succeeds without writing changes, updating modification timestamps, or recording activity.
|
|
45
56
|
|
|
46
57
|
Move, order, archive, unarchive, and task-label attachment commands also succeed without changes when the requested state is already satisfied. This does not apply to creation: creating an existing relation, for example, is an error.
|
|
47
58
|
|
|
48
|
-
|
|
59
|
+
Names and titles are trimmed and cannot be blank or contain line breaks or control characters, such as tabs.
|
|
49
60
|
|
|
50
61
|
Project, task, and label descriptions may contain multiple lines. Omitted descriptions on creation, empty strings, and whitespace-only strings are stored as `null`. Text containing a non-whitespace character is preserved exactly, including leading and trailing whitespace. Use `--description ""` on an edit to clear a description. JSON returns the full text or `null`.
|
|
51
62
|
|
|
63
|
+
To change part of a description, or of a comment's text, `--append` and `--replacing` modify how `--description` (or `--text` on `task comment edit`) is applied to the stored text:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
zinn task edit MDR-1 --description "Bring waffles." --append
|
|
67
|
+
zinn task edit MDR-1 --description "new sentence" --replacing "old sentence"
|
|
68
|
+
zinn project edit MDR --description "database" --replacing "board" --all
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Flags:
|
|
72
|
+
|
|
73
|
+
- `--append` adds the text as a new paragraph,
|
|
74
|
+
- `--replacing <old>` replaces the one place where `<old>` appears, matching exactly and respecting case.
|
|
75
|
+
- `--all` replaces every match.
|
|
76
|
+
|
|
77
|
+
A command with no match, or with several matches and no `--all`, fails without changing anything.
|
|
78
|
+
An empty text with `--replacing` deletes the match. `--append` and `--replacing` cannot be combined.
|
|
79
|
+
|
|
80
|
+
## Text values
|
|
81
|
+
|
|
82
|
+
A value that begins with a dash, such as a Markdown bullet, must be joined to its flag with `=`. Otherwise the command fails without changing anything:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
zinn task edit MDR-1 --description="- Bring waffles." --append
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For multi-line text, such as Markdown, pass a heredoc with a quoted delimiter (`'EOF'`) in bash or zsh. The shell then passes `$`, backticks, quotes and leading dashes as written:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
zinn task edit MDR-1 --description="$(cat <<'EOF'
|
|
92
|
+
- Bring waffles.
|
|
93
|
+
- Count the `numbers` for $5 and "Kier".
|
|
94
|
+
EOF
|
|
95
|
+
)"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`$(...)` drops trailing line breaks, so the stored text ends with the last character of the last line.
|
|
99
|
+
|
|
100
|
+
## Words and repeated flags
|
|
101
|
+
|
|
102
|
+
`--` ends the options. Every word after the first `--` is considered a plain word, even a secondary instance of `--` or anything else that starts with a dash. Flags after it, such as `--json`, are not read. A trailing `--` changes nothing:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
zinn project column create MDR -- -later
|
|
106
|
+
zinn task search -- -flag
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A flag can be given once.
|
|
110
|
+
Only these flags repeat:
|
|
111
|
+
|
|
112
|
+
- `--label` on `task create`, `task list` and `task search`,
|
|
113
|
+
- `--depends-on` and `--related` on `task create`,
|
|
114
|
+
- `--add-label` and `--remove-label` on `task edit`.
|
|
115
|
+
|
|
116
|
+
Any other flag given twice, `--json` and `--yes` included, **fails** without changing anything.
|
|
117
|
+
A help flag is the _exception_: the first one shows help and the rest of the line is ignored, so `-h --help` works and help is given whenever needed! No problem!
|
|
118
|
+
|
|
52
119
|
## Changing tasks in bulk
|
|
53
120
|
|
|
54
121
|
`task move`, `task archive` and `task unarchive` accept multiple task keys, so several tasks can be changed in one command:
|
|
55
122
|
|
|
56
123
|
- Tasks are changed in the order given.
|
|
57
124
|
- If any task fails, for example because of an unknown key, none change.
|
|
58
|
-
- A task already in the requested state is
|
|
125
|
+
- A task already in the requested state is unchanged, with a note on stderr. This includes a key given twice: by its second occurrence, the task is already in the requested state.
|
|
59
126
|
- With `--json`, one task prints an object and several print an array. Each task has a `changed` field, which is `false` when the task was already in the requested state.
|
|
60
127
|
|
|
61
128
|
## Concurrent access
|
|
62
129
|
|
|
63
|
-
Commands on the same machine can share a database on a local filesystem. Zinn waits up to 30 seconds each
|
|
130
|
+
Commands on the same machine can share a database on a local filesystem. Zinn waits up to 30 seconds for each lock acquisition, then fails if the lock is still held. The command's total running time can exceed 30 seconds.
|
|
64
131
|
|
|
65
132
|
## Start a project
|
|
66
133
|
|
|
@@ -70,9 +137,9 @@ Create a project with a key and optionally provide a name and description:
|
|
|
70
137
|
zinn project create MDR --name "Macrodata Refinement" --description "Refine macrodata"
|
|
71
138
|
```
|
|
72
139
|
|
|
73
|
-
Project keys are stored in
|
|
140
|
+
Project keys are stored in uppercase. An omitted name defaults to the key.
|
|
74
141
|
|
|
75
|
-
|
|
142
|
+
Descriptions print in full with `project view`. See [Editing conventions](#editing-conventions) for name validation and description storage and clearing.
|
|
76
143
|
|
|
77
144
|
Each project starts with _Backlog_, _TODO_, _In Progress_, _Review_, and _Done_ columns.
|
|
78
145
|
|
|
@@ -84,7 +151,11 @@ zinn project view MDR
|
|
|
84
151
|
zinn project column list MDR
|
|
85
152
|
```
|
|
86
153
|
|
|
87
|
-
`project view`
|
|
154
|
+
`project view` shows the project's description and task counts. Use `zinn task list <project-key>` to read its tasks.
|
|
155
|
+
|
|
156
|
+
`project view` and `project column list` accept an omitted project key when [defaultProject](#settings-files) is configured.
|
|
157
|
+
|
|
158
|
+
`project column list` counts unarchived tasks. With `--json`, it returns `[{ "name": "Backlog", "taskCount": 3 }, ...]`.
|
|
88
159
|
|
|
89
160
|
Edit a project:
|
|
90
161
|
|
|
@@ -95,7 +166,8 @@ zinn project edit MDR --description ""
|
|
|
95
166
|
```
|
|
96
167
|
|
|
97
168
|
Provide `--name`, `--description`, or both.
|
|
98
|
-
|
|
169
|
+
The project key can be omitted when [defaultProject](#settings-files) is configured.
|
|
170
|
+
See [Text values](#text-values) for values that begin with a dash and multi-line text.
|
|
99
171
|
|
|
100
172
|
Add another column at the end of the board:
|
|
101
173
|
|
|
@@ -109,9 +181,7 @@ Rename a column:
|
|
|
109
181
|
zinn project column edit MDR "In Progress" --name "Refining"
|
|
110
182
|
```
|
|
111
183
|
|
|
112
|
-
|
|
113
|
-
Since columns are case-insensitive, you cannot have two columns with only different casing such as `todo` and `Todo`. However, you are free to change the casing of an existing column.
|
|
114
|
-
Tasks stay in the renamed column.
|
|
184
|
+
Column names follow the shared [name and title rules](#editing-conventions) and match case-insensitively. Names must be unique within the project; changing only the casing is allowed. Renaming keeps tasks in the column.
|
|
115
185
|
|
|
116
186
|
Change a column's position on the board:
|
|
117
187
|
|
|
@@ -125,36 +195,53 @@ zinn project column order MDR Review after Done
|
|
|
125
195
|
```
|
|
126
196
|
|
|
127
197
|
Directions follow board order: `first` is the start of the board and `last` is its end.
|
|
128
|
-
Both the column and the target of `before` or `after` are matched by name, and matching is case-insensitive.
|
|
129
198
|
Moving a column to the position it already has, or before or after itself, does nothing. Tasks stay in their columns.
|
|
130
199
|
|
|
131
|
-
`zinn project delete MDR` asks for confirmation, then permanently deletes the project and all of its columns and tasks. `--yes` skips the
|
|
200
|
+
`zinn project delete MDR` asks for confirmation, then permanently deletes the project and all of its columns and tasks. `--yes` skips confirmation when the project key is **typed**. With an _omitted_ key and [defaultProject](#settings-files), it always asks: `--yes` is ignored with a warning, and without a terminal the command refuses with exit code 1. With `--json`, type the key and pass `--yes` (see [Confirmations](#confirmations)).
|
|
132
201
|
|
|
133
202
|
## Create and read tasks
|
|
134
203
|
|
|
135
|
-
Create a task with a title and an optional description. New tasks enter the project's first column:
|
|
204
|
+
Create a task with a title and an optional description. Titles follow the shared [name and title rules](#editing-conventions). New tasks enter the project's first column:
|
|
136
205
|
|
|
137
206
|
```sh
|
|
138
207
|
zinn task create MDR --title "Refine 75% of the numbers"
|
|
139
208
|
zinn task create MDR --title "Review the employee handbook" --description "Prepare for a 75% Dance Experience"
|
|
140
209
|
```
|
|
141
210
|
|
|
142
|
-
|
|
211
|
+
The project key can be omitted when [defaultProject](#settings-files) is configured.
|
|
212
|
+
|
|
213
|
+
`--column <name>` starts the task at the bottom of a specific column. The column name matching is case insensitive:
|
|
214
|
+
|
|
215
|
+
```sh
|
|
216
|
+
zinn task create MDR --title "Compile the Lexington letters" --column "In Progress"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Tasks are created with keys such as `MDR-1`. Task numbers increase in creation order within each project. List active tasks, optionally limited to one project, or view one task:
|
|
143
220
|
|
|
144
221
|
```sh
|
|
145
222
|
zinn task list
|
|
146
223
|
zinn task list MDR
|
|
224
|
+
zinn task list --all-projects
|
|
147
225
|
zinn task list MDR --label CLI --label Groom
|
|
226
|
+
zinn task list MDR --column "In Progress"
|
|
227
|
+
zinn task list --column Done --all
|
|
148
228
|
zinn task view MDR-1
|
|
229
|
+
zinn task view MDR-1 --history
|
|
149
230
|
```
|
|
150
231
|
|
|
151
|
-
|
|
232
|
+
Task lists are previews, so they _omit_ descriptions, but `task view` prints the full description.
|
|
233
|
+
|
|
234
|
+
An omitted project key uses [defaultProject](#settings-files), or every project when none is configured. `--all-projects` overrides the default.
|
|
152
235
|
|
|
153
|
-
|
|
236
|
+
`task view --history` includes the inspected task's recorded activity, newest first by time, then event ID. Reorders and comment changes are included. Use `activity view <activity-id>` for full recorded changes. See [Activity](#activity) for timestamps, event IDs, and record fields.
|
|
154
237
|
|
|
155
|
-
|
|
238
|
+
With `--history --json`, the task gains an `activity` array of full activity records. It returns `[]` when no events are recorded. Without `--history`, this field is _omitted_.
|
|
156
239
|
|
|
157
|
-
|
|
240
|
+
If a project is deleted and recreated with the same key, `task view --history` shows only the _current_ task’s history. `activity list --task <key>` can also show history for **deleted tasks** that previously had that same key.
|
|
241
|
+
|
|
242
|
+
Repeat `--label <name>` to require every specified label. Matching ignores case.
|
|
243
|
+
|
|
244
|
+
Use `--column <name>` to filter by an exact column name, ignoring case, within one project or across projects. Column, label, and archive filters apply together. No matches is a successful empty result (`[]` with `--json`).
|
|
158
245
|
|
|
159
246
|
## Search tasks
|
|
160
247
|
|
|
@@ -162,6 +249,7 @@ Search task titles, descriptions, and comments, optionally in one project:
|
|
|
162
249
|
|
|
163
250
|
```sh
|
|
164
251
|
zinn task search refine
|
|
252
|
+
zinn task search refine --all-projects
|
|
165
253
|
zinn task search "quarterly quota" MDR
|
|
166
254
|
zinn task search MDR-1
|
|
167
255
|
zinn task search auth --all --limit 5
|
|
@@ -170,14 +258,17 @@ zinn task search auth MDR --label cli
|
|
|
170
258
|
|
|
171
259
|
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.
|
|
172
260
|
|
|
261
|
+
The query comes first, then the optional project key. An omitted key uses [defaultProject](#settings-files), or every project when none is configured. `--all-projects` overrides the default.
|
|
262
|
+
|
|
173
263
|
If the whole query is an existing task key, such as `mdr-1`, that task comes first. Other results follow by relevance, with title matches weighted highest. Equally relevant tasks are ordered by project key, then task number.
|
|
174
264
|
|
|
175
|
-
|
|
176
|
-
|
|
265
|
+
An exact task-key query overrides the configured default project. A project key supplied after the query still filters the search.
|
|
266
|
+
|
|
267
|
+
Search defaults to active tasks. `--archived` searches archived tasks and `--all` searches both. A note on stderr reports hidden archived matches. This is purely a convenience hint and it is _omitted_ from JSON. `--limit <n>` caps the results.
|
|
177
268
|
|
|
178
269
|
`--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.
|
|
179
270
|
|
|
180
|
-
|
|
271
|
+
With `--json`, search returns an array of tasks like `task list` does. A search with no results succeeds. A query that begins with a dash goes after `--` (see [Words and repeated flags](#words-and-repeated-flags)).
|
|
181
272
|
|
|
182
273
|
Search uses an index that Zinn keeps up to date as tasks and comments change. `zinn reindex` rebuilds it from the tasks and their comments, archived tasks included:
|
|
183
274
|
|
|
@@ -189,7 +280,7 @@ Only the index changes, completely or not at all, so no backup is saved. With `-
|
|
|
189
280
|
|
|
190
281
|
## Labels
|
|
191
282
|
|
|
192
|
-
Labels are global and reusable
|
|
283
|
+
Labels are global and reusable across projects.
|
|
193
284
|
|
|
194
285
|
```sh
|
|
195
286
|
zinn label create urgent --color red --description "Needs attention soon"
|
|
@@ -207,20 +298,20 @@ zinn task label remove MDR-1 review
|
|
|
207
298
|
zinn task edit MDR-1 --add-label review --remove-label urgent
|
|
208
299
|
```
|
|
209
300
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
Label names
|
|
301
|
+
Repeat `--label`, `--add-label`, or `--remove-label` for several labels. Each value is one name, so commas are part of the name. Quote names containing spaces: `--label "needs review"`.
|
|
302
|
+
|
|
303
|
+
Label names follow the shared [name and title rules](#editing-conventions), preserve their stored casing, and match case-insensitively. Changing only the casing is allowed; names that differ only in case _cannot_ coexist.
|
|
213
304
|
|
|
214
305
|
Label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
|
|
215
306
|
|
|
216
|
-
`
|
|
307
|
+
`--json` includes each label's color as a value.
|
|
217
308
|
|
|
218
309
|
`label edit` accepts name, color, and description. Renaming preserves every task attachment because attachments refer to the label's internal ID. Updating a label definition does not affect attached tasks' timestamps.
|
|
219
310
|
|
|
220
311
|
Task creation and edits apply content and label changes together, or roll back together on failure.
|
|
221
312
|
Changing a task's label attachments updates that task's modification timestamp. Archived tasks can also have their labels edited.
|
|
222
313
|
|
|
223
|
-
|
|
314
|
+
`--json` lists a task's labels as names.
|
|
224
315
|
|
|
225
316
|
`zinn label delete urgent` asks for confirmation, then deletes the definition and removes it from every task. Declining confirmation leaves the label and its attachments unchanged. `--yes` skips the confirmation (see [Confirmations](#confirmations)).
|
|
226
317
|
Use `task label remove` to remove a label attachment from one task instead. Task/project deletion cleans up label attachments, but does not affect labels themselves.
|
|
@@ -234,21 +325,23 @@ zinn task relation create MDR-1 OTHER-1 --type related
|
|
|
234
325
|
zinn task relation list MDR-1
|
|
235
326
|
```
|
|
236
327
|
|
|
237
|
-
`dependency` means the first task depends on the second
|
|
328
|
+
`dependency` means the first task depends on the second; `duplicate` means the first is a duplicate of the second. `related` is symmetric.
|
|
238
329
|
|
|
239
330
|
Relations do not automatically move, complete, or archive tasks.
|
|
240
331
|
Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
|
|
241
332
|
|
|
242
|
-
`task
|
|
243
|
-
|
|
244
|
-
Use `zinn task relation create APP-2 APP-1 --type subtask` to make APP-2 a child of APP-1. Each task can have at most one parent and any number of subtasks. A nested type of relationship is allowed, so a task can have both a parent and a child. Parents are also just ordinary tasks, including tasks in other projects or archived tasks. Relation list and task view show **Parent** on the child and **Subtask** on the parent.
|
|
333
|
+
Use `zinn task relation create APP-2 APP-1 --type subtask` to make APP-2 a child of APP-1. Each task can have one parent and any number of subtasks, including nested subtasks.
|
|
245
334
|
|
|
246
335
|
Remove the existing subtask relation before assigning a different parent. Moving or archiving a parent does not change its children, and deleting a parent removes its child relations while retaining child task data.
|
|
247
336
|
|
|
248
|
-
|
|
249
|
-
|
|
337
|
+
`task create` can relate the new task with `--parent`, `--depends-on`, `--duplicate-of` and `--related`. Repeat `--depends-on` and `--related` to relate several tasks:
|
|
338
|
+
|
|
339
|
+
```sh
|
|
340
|
+
zinn task create MDR --title "Sort the files" --parent MDR-1 --depends-on MDR-2
|
|
341
|
+
```
|
|
250
342
|
|
|
251
|
-
|
|
343
|
+
Remove a relation with `zinn task relation delete MDR-1 MDR-2 --type dependency`, using its original direction for `dependency`, `duplicate`, and `subtask`. For `related`, order does not matter.
|
|
344
|
+
Relation deletion requires no confirmation.
|
|
252
345
|
|
|
253
346
|
## Task comments
|
|
254
347
|
|
|
@@ -260,8 +353,6 @@ zinn task comment list MDR-1
|
|
|
260
353
|
```
|
|
261
354
|
|
|
262
355
|
Comments receive keys per task like `MDR-1#1`.
|
|
263
|
-
Comment lists show each comment's creation time in local time as `YYYY-MM-DD HH:mm ±HH:mm`.
|
|
264
|
-
`task view` includes the task's comments in the same format.
|
|
265
356
|
|
|
266
357
|
Edit or delete a comment using its key:
|
|
267
358
|
|
|
@@ -282,10 +373,10 @@ zinn task edit MDR-1 --description "Complete refinement before the waffle party"
|
|
|
282
373
|
zinn task edit MDR-1 --title "Meet the quarterly refinement quota" --description ""
|
|
283
374
|
```
|
|
284
375
|
|
|
285
|
-
See [Editing conventions](#editing-conventions) for partial edits and clearing descriptions.
|
|
376
|
+
See [Editing conventions](#editing-conventions) for title validation, partial edits and clearing descriptions.
|
|
286
377
|
|
|
287
378
|
Archived tasks can be edited without unarchiving them.
|
|
288
|
-
|
|
379
|
+
See [Text values](#text-values) for values that begin with a dash and multi-line text.
|
|
289
380
|
|
|
290
381
|
## Move and order tasks
|
|
291
382
|
|
|
@@ -297,7 +388,7 @@ zinn task move MDR-1 "In Progress"
|
|
|
297
388
|
|
|
298
389
|
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.
|
|
299
390
|
|
|
300
|
-
|
|
391
|
+
For multiple tasks, give their keys before the column. They move in input order; tasks already in that column retain their positions. Each task's column is looked up in its own project:
|
|
301
392
|
|
|
302
393
|
```sh
|
|
303
394
|
zinn task move MDR-1 MDR-2 APP-4 "In Progress"
|
|
@@ -312,7 +403,6 @@ zinn task order MDR-2 top
|
|
|
312
403
|
zinn task order MDR-2 up
|
|
313
404
|
zinn task order MDR-2 down
|
|
314
405
|
zinn task order MDR-2 bottom
|
|
315
|
-
zinn task move MDR-2 "In Progress"
|
|
316
406
|
zinn task order MDR-2 before MDR-1
|
|
317
407
|
zinn task order MDR-2 after MDR-1
|
|
318
408
|
```
|
|
@@ -330,7 +420,7 @@ zinn task list MDR --archived
|
|
|
330
420
|
zinn task list MDR --all
|
|
331
421
|
```
|
|
332
422
|
|
|
333
|
-
`--archived` and `--all` cannot be used together.
|
|
423
|
+
`--archived` and `--all` cannot be used together.
|
|
334
424
|
|
|
335
425
|
Unarchiving puts a task at the bottom of its previous column:
|
|
336
426
|
|
|
@@ -343,6 +433,50 @@ Archive or unarchive multiple tasks by giving several keys. Unarchived tasks lan
|
|
|
343
433
|
|
|
344
434
|
Delete a task permanently with `zinn task delete MDR-1`. It asks for confirmation before performing the action, unless `--yes` is used (see [Confirmations](#confirmations)).
|
|
345
435
|
|
|
436
|
+
Deleting a task does not make its number available again within that project. Deleting and recreating the project starts its task numbering again at 1.
|
|
437
|
+
|
|
438
|
+
## Task priority
|
|
439
|
+
|
|
440
|
+
Priority is optional: `low`, `medium`, `high`, or `urgent`. New tasks have no assigned priority by default.
|
|
441
|
+
|
|
442
|
+
```sh
|
|
443
|
+
zinn task create MDR --title "Review the numbers" --priority high
|
|
444
|
+
zinn task edit MDR-1 --priority urgent
|
|
445
|
+
zinn task edit MDR-1 --priority none
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Use `none` to clear priority. Priority does not affect board ordering.
|
|
449
|
+
|
|
450
|
+
## Activity
|
|
451
|
+
|
|
452
|
+
Zinn records changes to tasks, projects, columns, labels, relations, and comments, including who made them.
|
|
453
|
+
|
|
454
|
+
Deleting a project records one project deletion rather than separate deletion activity for every cascaded row.
|
|
455
|
+
|
|
456
|
+
```sh
|
|
457
|
+
zinn activity list
|
|
458
|
+
zinn activity list --limit 10
|
|
459
|
+
zinn activity list --task MDR-1
|
|
460
|
+
zinn activity view 019abcdf-1234-7
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
`--limit` caps the newest matching events and must be a positive safe integer. Reorders and both affected-task events from relation changes are included.
|
|
464
|
+
|
|
465
|
+
`--task` includes active, archived, and deleted tasks by readable key, with history recovered from current tasks and recorded deletion snapshots. A reused key includes all known task lifetimes. A project deletion that removed the task is included as the original project event. A valid key with no recoverable history returns an empty list.
|
|
466
|
+
|
|
467
|
+
`activity view` accepts a full UUID or a unique prefix of at least eight hexadecimal digits for convenience. The match ignores case and accepts both the full hyphenated or compact forms. Prefixes must be unique across all activity. Use a full ID for reliable reference results. Using prefixes may result in unreliable results over time as history grows.
|
|
468
|
+
|
|
469
|
+
`activity view` preserves full recorded text and line breaks, including unknown change fields.
|
|
470
|
+
|
|
471
|
+
With `--json`, list returns an array and view returns one event object. Both include `id`, `created_at` (epoch milliseconds), `actor_name`, `actor_email`, `actor_kind`, `entity_type`, `entity_id`, `action`, and `changes` (parsed JSON or `null`). Payloads and IDs are preserved in full, including after deletion.
|
|
472
|
+
|
|
473
|
+
> [!WARNING]
|
|
474
|
+
> A readable task key can identify different tasks after a project is deleted and recreated. Group JSON records by (`entity_type`, `entity_id`) to keep their histories distinct. The `id` identifies the activity event itself. Project deletion events keep the project's `entity_id`, with removed task IDs in `changes.tasks`.
|
|
475
|
+
|
|
476
|
+
When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
|
|
477
|
+
|
|
478
|
+
Zinn recognizes Claude Code, Codex, OpenCode, Gemini CLI, Cline, Cursor, Copilot's coding agent, Crush, Amp, and any tool that sets `AI_AGENT`. If you are using a tool that Zinn does not recognize, you can set `AI_AGENT` in that tool's environment settings, for example `AI_AGENT=hermes`. Otherwise, Zinn uses your git `user.name` and `user.email`, and if that's also not set, it falls to your system username.
|
|
479
|
+
|
|
346
480
|
## Back up the database
|
|
347
481
|
|
|
348
482
|
It is recommended to save a copy of the database before installing a new version:
|
|
@@ -351,21 +485,21 @@ It is recommended to save a copy of the database before installing a new version
|
|
|
351
485
|
zinn backup
|
|
352
486
|
```
|
|
353
487
|
|
|
354
|
-
The
|
|
488
|
+
The snapshot goes to `backups/` in the Zinn directory. It includes all committed changes and can be taken while Zinn is in use. Existing backups are never overwritten. With `--json`, the command returns `{ "path": "..." }`. It fails when there is no database yet.
|
|
355
489
|
|
|
356
490
|
## Restore the database
|
|
357
491
|
|
|
358
|
-
|
|
492
|
+
Restore the whole database from a backup saved by `zinn backup` or an upgrade:
|
|
359
493
|
|
|
360
494
|
```sh
|
|
361
495
|
zinn restore ~/.zinn/backups/2026-09-29T12-30-05Z-cli-0.32.0-b38178c0.sqlite
|
|
362
496
|
```
|
|
363
497
|
|
|
364
|
-
The command asks for confirmation
|
|
498
|
+
The command asks for confirmation unless `--yes` is used (see [Confirmations](#confirmations)). It saves the current database first, then restores completely or not at all. Restoring onto a missing database creates it. With `--json`, it returns `{ "databasePath": "...", "previousVersion": 1, "restoredVersion": 1, "backupPath": "..." }`, where `backupPath` is the saved copy of the previous database, or `null` when it was missing or empty.
|
|
365
499
|
|
|
366
500
|
A backup with an older schema version is restored at that version, and Zinn then upgrades it like any older database (see [Upgrade the database](#upgrade-the-database)). The restore works whatever the version of the database it replaces, so you can go back to an older Zinn and restore the backup an upgrade saved.
|
|
367
501
|
|
|
368
|
-
|
|
502
|
+
Missing, damaged, unmarked, non-Zinn, or newer-schema backups are refused without changes. Any later failure rolls back the restore and retains the saved backup.
|
|
369
503
|
|
|
370
504
|
If the database being replaced is damaged, restore leaves it unchanged and prints recovery steps.
|
|
371
505
|
|
|
@@ -373,13 +507,13 @@ If the database being replaced is damaged, restore leaves it unchanged and print
|
|
|
373
507
|
|
|
374
508
|
The database records a schema version, and a newer Zinn upgrades an older database to its own version. The upgrade is applied completely or not at all, and a backup is saved first, in the same folder as `zinn backup`.
|
|
375
509
|
|
|
376
|
-
A published release
|
|
510
|
+
A published release upgrades an older database on first use. Source builds automatically upgrade **only a separate database** chosen through `ZINN_DIR`. Other older databases open in read-only mode. To upgrade explicitly:
|
|
377
511
|
|
|
378
512
|
```sh
|
|
379
513
|
zinn migrate
|
|
380
514
|
```
|
|
381
515
|
|
|
382
|
-
|
|
516
|
+
An already-current database is unchanged and saves no backup. With `--json`, the command returns `{ "databasePath": "...", "previousVersion": 1, "finalVersion": 2, "changed": true, "backupPath": "..." }`, where `backupPath` is `null` when nothing changed.
|
|
383
517
|
|
|
384
518
|
If the upgrade fails, the database is unchanged. The backups taken before each attempt stay in the `backups/` folder. The command fails without attempting anything when there is no database with data yet, when the database has no schema version, or when it is newer than your Zinn.
|
|
385
519
|
|
|
@@ -406,13 +540,13 @@ zinn task create MDR --title "Refine the numbers" --json
|
|
|
406
540
|
|
|
407
541
|
- Read commands print what they list or show. Write commands print the entity they created, changed, or deleted.
|
|
408
542
|
- Output is a single JSON document on stdout. Empty lists print `[]`.
|
|
409
|
-
- Errors go to stderr as `{ "error": { "message": "..." } }`, stdout stays empty, and the command exits with code 1.
|
|
543
|
+
- Errors go to stderr as `{ "error": { "message": "..." } }`, stdout stays empty, and the command exits with code 1. An error can also carry `"help"`: the command's usage line for a missing or extra word, or the namespace help for a missing command.
|
|
410
544
|
|
|
411
|
-
|
|
545
|
+
Scripts should use `--json`. Text is colored only in a terminal unless `NO_COLOR` disables it. `FORCE_COLOR` overrides both: `0` turns color off and any other nonempty value turns it on, including when piped.
|
|
412
546
|
|
|
413
547
|
### Confirmations
|
|
414
548
|
|
|
415
|
-
|
|
549
|
+
Project, task, label, and comment deletion ask for confirmation, as does restoring the database. Use `--yes` to skip the prompt:
|
|
416
550
|
|
|
417
551
|
```sh
|
|
418
552
|
zinn task delete MDR-1 --yes
|
|
@@ -420,8 +554,10 @@ zinn task delete MDR-1 --yes --json
|
|
|
420
554
|
```
|
|
421
555
|
|
|
422
556
|
- With `--json`, `--yes` is **required**. Without it, the command exits with an error and changes nothing.
|
|
423
|
-
-
|
|
424
|
-
-
|
|
557
|
+
- Project deletion also requires a typed project key to skip confirmation; a configured default always needs confirmation and cannot be deleted with `--json`.
|
|
558
|
+
- Without a terminal, when stdin or stdout is redirected as in CI or a pipe, a command without `--yes` refuses before asking: it changes nothing and exits with code 1. Piped input such as `echo y` does not answer the prompt, so scripts that delete or restore must use `--yes`.
|
|
559
|
+
- Declining the prompt in a terminal changes nothing and exits with code 0.
|
|
560
|
+
- `task relation delete` never asks for confirmation and does not accept `--yes`.
|
|
425
561
|
|
|
426
562
|
## Help
|
|
427
563
|
|
|
@@ -435,29 +571,6 @@ zinn task --help
|
|
|
435
571
|
zinn task move --help
|
|
436
572
|
```
|
|
437
573
|
|
|
438
|
-
The short `-h` form works in the same positions.
|
|
439
|
-
|
|
440
|
-
Running `zinn` without a command shows help
|
|
441
|
-
|
|
442
|
-
## Task priority
|
|
443
|
-
|
|
444
|
-
Priority is optional: `low`, `medium`, `high`, or `urgent`. New tasks have no assigned priority by default.
|
|
445
|
-
|
|
446
|
-
```sh
|
|
447
|
-
zinn task create MDR --title "Review the numbers" --priority high
|
|
448
|
-
zinn task edit MDR-1 --priority urgent
|
|
449
|
-
zinn task edit MDR-1 --priority none
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
Use `none` to clear priority. 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. Priority does not affect board ordering.
|
|
453
|
-
|
|
454
|
-
## Activity
|
|
455
|
-
|
|
456
|
-
Zinn keeps an activity log of task changes such as creating, editing, moving, reordering, archiving, unarchiving and deleting a task, its labels, its relations, and its comments. Project, column, and global label definition changes are recorded too. Each log also says _who_ made the change.
|
|
457
|
-
|
|
458
|
-
Deleting a project records one project deletion rather than separate deletion activity for every cascaded row.
|
|
459
|
-
Note that this data is not yet surfaced by any command yet.
|
|
460
|
-
|
|
461
|
-
When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
|
|
574
|
+
The short `-h` form works in the same positions. `--help` shows help for the command words before it and runs nothing. The rest of the line is ignored.
|
|
462
575
|
|
|
463
|
-
|
|
576
|
+
Running `zinn` without a command shows help. Use `zinn --version` (or `-v`) to print the CLI version.
|
package/index.ts
CHANGED
|
@@ -14,21 +14,7 @@ if (isVersionRequest) {
|
|
|
14
14
|
const router = createRouter(routes);
|
|
15
15
|
|
|
16
16
|
if (args.length === 0 || isHelpFlag(args[0]!)) {
|
|
17
|
-
console.info(
|
|
18
|
-
|
|
19
|
-
Usage: zinn <command>
|
|
20
|
-
|
|
21
|
-
Options:
|
|
22
|
-
-h, --help Show help
|
|
23
|
-
-v, --version Show version
|
|
24
|
-
--json Print command output as JSON
|
|
25
|
-
--allow-legacy-read Read a database without a schema version, best effort and read-only
|
|
26
|
-
|
|
27
|
-
Commands:
|
|
28
|
-
${router.commands}
|
|
29
|
-
|
|
30
|
-
Run zinn <namespace> --help or zinn <command> --help for more information.
|
|
31
|
-
Running zinn without a command shows this help.`);
|
|
17
|
+
console.info(router.help);
|
|
32
18
|
} else {
|
|
33
19
|
const { configureDatabase } = await import("@zinn-dev/core");
|
|
34
20
|
const { cliOpenPolicy } = await import("./src/database");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "A kanban workflow in the terminal. Experimental.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@zinn-dev/core": "0.
|
|
46
|
+
"@zinn-dev/core": "0.28.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {}
|
|
49
49
|
}
|