@zinn-dev/cli 0.36.1 → 0.38.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 +264 -78
- package/index.ts +7 -15
- package/package.json +7 -5
- package/release-stamp.json +1 -0
- package/src/database.test.ts +70 -0
- package/src/database.ts +41 -0
- package/src/lib.test.ts +86 -0
- package/src/lib.ts +75 -10
- package/src/presentation/activity-presentation.test.ts +71 -0
- package/src/presentation/activity-presentation.ts +489 -0
- package/src/presentation/color.ts +1 -1
- package/src/presentation/column-presentation.ts +48 -0
- package/src/presentation/description-presentation.ts +7 -4
- package/src/presentation/row-layout.ts +77 -0
- package/src/presentation/section.ts +16 -0
- package/src/presentation/task-presentation.ts +50 -63
- package/src/presentation/time.ts +17 -0
- package/src/routes/activity-router.ts +77 -0
- package/src/routes/backup-router.ts +3 -2
- package/src/routes/comment-router.ts +54 -38
- package/src/routes/label-router.ts +47 -27
- package/src/routes/migrate-router.test.ts +31 -0
- package/src/routes/migrate-router.ts +48 -0
- package/src/routes/project-router.ts +129 -106
- package/src/routes/reindex-router.ts +27 -0
- package/src/routes/relation-router.ts +20 -13
- package/src/routes/restore-router.test.ts +44 -0
- package/src/routes/restore-router.ts +90 -0
- package/src/routes/router.test.ts +41 -0
- package/src/routes/router.ts +133 -24
- package/src/routes/routes.ts +8 -0
- package/src/routes/task-router.ts +228 -142
- package/src/text-edit.ts +68 -0
package/README.md
CHANGED
|
@@ -2,18 +2,122 @@
|
|
|
2
2
|
|
|
3
3
|
The `zinn` command-line interface. Requires [Bun](https://bun.sh).
|
|
4
4
|
|
|
5
|
+
> [!IMPORTANT]
|
|
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).
|
|
8
|
+
|
|
5
9
|
## Install
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
12
|
bun add --global @zinn-dev/cli
|
|
9
13
|
```
|
|
10
14
|
|
|
15
|
+
For a first project and task, see the [quick start](../../README.md#quick-start).
|
|
16
|
+
|
|
11
17
|
Zinn stores projects and tasks in the shared local database at `~/.zinn/data/zinn.sqlite`.
|
|
12
|
-
Set `ZINN_DIR` to use another Zinn directory and keep using the same value for commands that should share that database.
|
|
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)).
|
|
19
|
+
|
|
20
|
+
## Settings files
|
|
21
|
+
|
|
22
|
+
Zinn reads two optional settings files:
|
|
23
|
+
|
|
24
|
+
- `settings.json` in the Zinn directory (`~/.zinn`, or `ZINN_DIR` when it is set) holds the global settings.
|
|
25
|
+
- `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.
|
|
26
|
+
|
|
27
|
+
`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. It is merged over the global file, field by field. A missing file is fine, and Zinn creates no settings file.
|
|
28
|
+
|
|
29
|
+
The files are plain JSON, without comments:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"storage": {
|
|
34
|
+
"directory": "~/work/zinn-data"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`$schema` (a string, ignored by Zinn) and `storage.directory` are the only fields. An unknown key, a value of the wrong type or invalid JSON stops every command with an error that names the file. Zinn does not fall back to the defaults.
|
|
40
|
+
|
|
41
|
+
`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.
|
|
42
|
+
|
|
43
|
+
## Editing conventions
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
Names and titles are trimmed and cannot be blank or contain line breaks or control characters, such as tabs.
|
|
50
|
+
|
|
51
|
+
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`.
|
|
52
|
+
|
|
53
|
+
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:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
zinn task edit MDR-1 --description "Bring waffles." --append
|
|
57
|
+
zinn task edit MDR-1 --description "new sentence" --replacing "old sentence"
|
|
58
|
+
zinn project edit MDR --description "database" --replacing "board" --all
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Flags:
|
|
62
|
+
|
|
63
|
+
- `--append` adds the text as a new paragraph,
|
|
64
|
+
- `--replacing <old>` replaces the one place where `<old>` appears, matching exactly and respecting case.
|
|
65
|
+
- `--all` replaces every match.
|
|
66
|
+
|
|
67
|
+
A command with no match, or with several matches and no `--all`, fails without changing anything.
|
|
68
|
+
An empty text with `--replacing` deletes the match. `--append` and `--replacing` cannot be combined.
|
|
69
|
+
|
|
70
|
+
## Text values
|
|
71
|
+
|
|
72
|
+
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:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
zinn task edit MDR-1 --description="- Bring waffles." --append
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
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:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
zinn task edit MDR-1 --description="$(cat <<'EOF'
|
|
82
|
+
- Bring waffles.
|
|
83
|
+
- Count the `numbers` for $5 and "Kier".
|
|
84
|
+
EOF
|
|
85
|
+
)"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`$(...)` drops trailing line breaks, so the stored text ends with the last character of the last line.
|
|
89
|
+
|
|
90
|
+
## Words and repeated flags
|
|
91
|
+
|
|
92
|
+
`--` 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:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
zinn project column create MDR -- -later
|
|
96
|
+
zinn task search -- -flag
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A flag can be given once.
|
|
100
|
+
Only these flags repeat:
|
|
101
|
+
|
|
102
|
+
- `--label` on `task create`, `task list` and `task search`,
|
|
103
|
+
- `--depends-on` and `--related` on `task create`,
|
|
104
|
+
- `--add-label` and `--remove-label` on `task edit`.
|
|
105
|
+
|
|
106
|
+
Any other flag given twice, `--json` and `--yes` included, **fails** without changing anything.
|
|
107
|
+
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!
|
|
108
|
+
|
|
109
|
+
## Changing tasks in bulk
|
|
110
|
+
|
|
111
|
+
`task move`, `task archive` and `task unarchive` accept multiple task keys, so several tasks can be changed in one command:
|
|
112
|
+
|
|
113
|
+
- Tasks are changed in the order given.
|
|
114
|
+
- If any task fails, for example because of an unknown key, none change.
|
|
115
|
+
- 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.
|
|
116
|
+
- 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.
|
|
13
117
|
|
|
14
118
|
## Concurrent access
|
|
15
119
|
|
|
16
|
-
Commands on the same machine can share a database on a local filesystem. Zinn waits up to 30 seconds each
|
|
120
|
+
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.
|
|
17
121
|
|
|
18
122
|
## Start a project
|
|
19
123
|
|
|
@@ -23,10 +127,9 @@ Create a project with a key and optionally provide a name and description:
|
|
|
23
127
|
zinn project create MDR --name "Macrodata Refinement" --description "Refine macrodata"
|
|
24
128
|
```
|
|
25
129
|
|
|
26
|
-
Project keys are stored in
|
|
27
|
-
Intetionally empty or whitespace project names are rejected.
|
|
130
|
+
Project keys are stored in uppercase. An omitted name defaults to the key.
|
|
28
131
|
|
|
29
|
-
|
|
132
|
+
Descriptions print in full with `project view`. See [Editing conventions](#editing-conventions) for name validation and description storage and clearing.
|
|
30
133
|
|
|
31
134
|
Each project starts with _Backlog_, _TODO_, _In Progress_, _Review_, and _Done_ columns.
|
|
32
135
|
|
|
@@ -38,7 +141,9 @@ zinn project view MDR
|
|
|
38
141
|
zinn project column list MDR
|
|
39
142
|
```
|
|
40
143
|
|
|
41
|
-
`project view`
|
|
144
|
+
`project view` shows the project's description and task counts. Use `zinn task list <project-key>` to read its tasks.
|
|
145
|
+
|
|
146
|
+
`project column list` counts unarchived tasks. With `--json`, it returns `[{ "name": "Backlog", "taskCount": 3 }, ...]`.
|
|
42
147
|
|
|
43
148
|
Edit a project:
|
|
44
149
|
|
|
@@ -48,9 +153,8 @@ zinn project edit MDR --description "Meet the quarterly quota"
|
|
|
48
153
|
zinn project edit MDR --description ""
|
|
49
154
|
```
|
|
50
155
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Use `--name="--example"` when a value begins with a dash.
|
|
156
|
+
Provide `--name`, `--description`, or both.
|
|
157
|
+
See [Text values](#text-values) for values that begin with a dash and multi-line text.
|
|
54
158
|
|
|
55
159
|
Add another column at the end of the board:
|
|
56
160
|
|
|
@@ -64,9 +168,7 @@ Rename a column:
|
|
|
64
168
|
zinn project column edit MDR "In Progress" --name "Refining"
|
|
65
169
|
```
|
|
66
170
|
|
|
67
|
-
|
|
68
|
-
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.
|
|
69
|
-
Tasks stay in the renamed column.
|
|
171
|
+
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.
|
|
70
172
|
|
|
71
173
|
Change a column's position on the board:
|
|
72
174
|
|
|
@@ -80,32 +182,41 @@ zinn project column order MDR Review after Done
|
|
|
80
182
|
```
|
|
81
183
|
|
|
82
184
|
Directions follow board order: `first` is the start of the board and `last` is its end.
|
|
83
|
-
Both the column and the target of `before` or `after` are matched by name, and matching is case-insensitive.
|
|
84
185
|
Moving a column to the position it already has, or before or after itself, does nothing. Tasks stay in their columns.
|
|
85
186
|
|
|
86
187
|
`zinn project delete MDR` asks for confirmation, then permanently deletes the project and all of its columns and tasks. `--yes` skips the confirmation (see [Confirmations](#confirmations)).
|
|
87
188
|
|
|
88
189
|
## Create and read tasks
|
|
89
190
|
|
|
90
|
-
Create a task with a title and an optional description. New tasks enter the project's first column:
|
|
191
|
+
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:
|
|
91
192
|
|
|
92
193
|
```sh
|
|
93
194
|
zinn task create MDR --title "Refine 75% of the numbers"
|
|
94
195
|
zinn task create MDR --title "Review the employee handbook" --description "Prepare for a 75% Dance Experience"
|
|
95
196
|
```
|
|
96
197
|
|
|
97
|
-
|
|
198
|
+
`--column <name>` starts the task at the bottom of a specific column. The column name matching is case insensitive:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
zinn task create MDR --title "Compile the Lexington letters" --column "In Progress"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
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:
|
|
98
205
|
|
|
99
206
|
```sh
|
|
100
207
|
zinn task list
|
|
101
208
|
zinn task list MDR
|
|
102
209
|
zinn task list MDR --label CLI --label Groom
|
|
210
|
+
zinn task list MDR --column "In Progress"
|
|
211
|
+
zinn task list --column Done --all
|
|
103
212
|
zinn task view MDR-1
|
|
104
213
|
```
|
|
105
214
|
|
|
106
|
-
|
|
215
|
+
Task lists are previews, so they omit descriptions, but `task view` prints the full description.
|
|
107
216
|
|
|
108
|
-
|
|
217
|
+
Repeat `--label <name>` to require every specified label. Matching ignores case.
|
|
218
|
+
|
|
219
|
+
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`).
|
|
109
220
|
|
|
110
221
|
## Search tasks
|
|
111
222
|
|
|
@@ -123,18 +234,23 @@ Each query matches the start of a word, ignoring case and accents, so `cafe` fin
|
|
|
123
234
|
|
|
124
235
|
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.
|
|
125
236
|
|
|
126
|
-
|
|
127
|
-
`--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.
|
|
237
|
+
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.
|
|
128
238
|
|
|
129
239
|
`--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.
|
|
130
240
|
|
|
131
|
-
|
|
241
|
+
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)).
|
|
242
|
+
|
|
243
|
+
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:
|
|
132
244
|
|
|
133
|
-
|
|
245
|
+
```sh
|
|
246
|
+
zinn reindex
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Only the index changes, completely or not at all, so no backup is saved. With `--json`, it prints `{ "databasePath": "...", "taskCount": 12 }`. The command fails without changing anything when there is no database yet, or when Zinn refuses changes to the database, such as one with a newer schema version (see [Upgrade the database](#upgrade-the-database)).
|
|
134
250
|
|
|
135
251
|
## Labels
|
|
136
252
|
|
|
137
|
-
Labels are global and reusable
|
|
253
|
+
Labels are global and reusable across projects.
|
|
138
254
|
|
|
139
255
|
```sh
|
|
140
256
|
zinn label create urgent --color red --description "Needs attention soon"
|
|
@@ -152,20 +268,20 @@ zinn task label remove MDR-1 review
|
|
|
152
268
|
zinn task edit MDR-1 --add-label review --remove-label urgent
|
|
153
269
|
```
|
|
154
270
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Label names
|
|
271
|
+
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"`.
|
|
272
|
+
|
|
273
|
+
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.
|
|
158
274
|
|
|
159
|
-
|
|
275
|
+
Label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
|
|
160
276
|
|
|
161
|
-
`
|
|
277
|
+
`--json` includes each label's color as a value.
|
|
162
278
|
|
|
163
|
-
`label edit`
|
|
279
|
+
`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.
|
|
164
280
|
|
|
165
281
|
Task creation and edits apply content and label changes together, or roll back together on failure.
|
|
166
|
-
|
|
282
|
+
Changing a task's label attachments updates that task's modification timestamp. Archived tasks can also have their labels edited.
|
|
167
283
|
|
|
168
|
-
|
|
284
|
+
`--json` lists a task's labels as names.
|
|
169
285
|
|
|
170
286
|
`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)).
|
|
171
287
|
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.
|
|
@@ -179,21 +295,23 @@ zinn task relation create MDR-1 OTHER-1 --type related
|
|
|
179
295
|
zinn task relation list MDR-1
|
|
180
296
|
```
|
|
181
297
|
|
|
182
|
-
`dependency` means the first task depends on the second
|
|
298
|
+
`dependency` means the first task depends on the second; `duplicate` means the first is a duplicate of the second. `related` is symmetric.
|
|
183
299
|
|
|
184
300
|
Relations do not automatically move, complete, or archive tasks.
|
|
185
301
|
Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
|
|
186
302
|
|
|
187
|
-
`task
|
|
188
|
-
|
|
189
|
-
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.
|
|
303
|
+
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.
|
|
190
304
|
|
|
191
305
|
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.
|
|
192
306
|
|
|
193
|
-
|
|
194
|
-
Note that a deletion happens _without_ confirmation.
|
|
307
|
+
`task create` can relate the new task with `--parent`, `--depends-on`, `--duplicate-of` and `--related`. Repeat `--depends-on` and `--related` to relate several tasks:
|
|
195
308
|
|
|
196
|
-
|
|
309
|
+
```sh
|
|
310
|
+
zinn task create MDR --title "Sort the files" --parent MDR-1 --depends-on MDR-2
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
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.
|
|
314
|
+
Relation deletion requires no confirmation.
|
|
197
315
|
|
|
198
316
|
## Task comments
|
|
199
317
|
|
|
@@ -205,8 +323,6 @@ zinn task comment list MDR-1
|
|
|
205
323
|
```
|
|
206
324
|
|
|
207
325
|
Comments receive keys per task like `MDR-1#1`.
|
|
208
|
-
Comment lists show each comment's creation time in local time as `YYYY-MM-DD HH:mm ±HH:mm`.
|
|
209
|
-
`task view` includes the task's comments in the same format.
|
|
210
326
|
|
|
211
327
|
Edit or delete a comment using its key:
|
|
212
328
|
|
|
@@ -227,10 +343,10 @@ zinn task edit MDR-1 --description "Complete refinement before the waffle party"
|
|
|
227
343
|
zinn task edit MDR-1 --title "Meet the quarterly refinement quota" --description ""
|
|
228
344
|
```
|
|
229
345
|
|
|
230
|
-
|
|
346
|
+
See [Editing conventions](#editing-conventions) for title validation, partial edits and clearing descriptions.
|
|
231
347
|
|
|
232
|
-
|
|
233
|
-
|
|
348
|
+
Archived tasks can be edited without unarchiving them.
|
|
349
|
+
See [Text values](#text-values) for values that begin with a dash and multi-line text.
|
|
234
350
|
|
|
235
351
|
## Move and order tasks
|
|
236
352
|
|
|
@@ -241,7 +357,14 @@ zinn task move MDR-1 "In Progress"
|
|
|
241
357
|
```
|
|
242
358
|
|
|
243
359
|
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.
|
|
244
|
-
|
|
360
|
+
|
|
361
|
+
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:
|
|
362
|
+
|
|
363
|
+
```sh
|
|
364
|
+
zinn task move MDR-1 MDR-2 APP-4 "In Progress"
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
See [Changing tasks in bulk](#changing-tasks-in-bulk).
|
|
245
368
|
|
|
246
369
|
Change a task's position within its current column:
|
|
247
370
|
|
|
@@ -250,7 +373,6 @@ zinn task order MDR-2 top
|
|
|
250
373
|
zinn task order MDR-2 up
|
|
251
374
|
zinn task order MDR-2 down
|
|
252
375
|
zinn task order MDR-2 bottom
|
|
253
|
-
zinn task move MDR-2 "In Progress"
|
|
254
376
|
zinn task order MDR-2 before MDR-1
|
|
255
377
|
zinn task order MDR-2 after MDR-1
|
|
256
378
|
```
|
|
@@ -259,24 +381,69 @@ The task being reordered and the target of `before` or `after` must be active ta
|
|
|
259
381
|
|
|
260
382
|
## Archive and delete tasks
|
|
261
383
|
|
|
262
|
-
Active tasks are shown by default. Archive
|
|
384
|
+
Active tasks are shown by default. Archive one or more tasks to hide them from active lists, then list archived tasks or all tasks:
|
|
263
385
|
|
|
264
386
|
```sh
|
|
265
387
|
zinn task archive MDR-1
|
|
388
|
+
zinn task archive MDR-2 MDR-3
|
|
266
389
|
zinn task list MDR --archived
|
|
267
390
|
zinn task list MDR --all
|
|
268
391
|
```
|
|
269
392
|
|
|
270
|
-
`--archived` and `--all` cannot be used together.
|
|
393
|
+
`--archived` and `--all` cannot be used together.
|
|
271
394
|
|
|
272
395
|
Unarchiving puts a task at the bottom of its previous column:
|
|
273
396
|
|
|
274
397
|
```sh
|
|
275
398
|
zinn task unarchive MDR-1
|
|
399
|
+
zinn task unarchive MDR-2 MDR-3
|
|
276
400
|
```
|
|
277
401
|
|
|
402
|
+
Archive or unarchive multiple tasks by giving several keys. Unarchived tasks land in the order given. See [Changing tasks in bulk](#changing-tasks-in-bulk).
|
|
403
|
+
|
|
278
404
|
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)).
|
|
279
405
|
|
|
406
|
+
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.
|
|
407
|
+
|
|
408
|
+
## Task priority
|
|
409
|
+
|
|
410
|
+
Priority is optional: `low`, `medium`, `high`, or `urgent`. New tasks have no assigned priority by default.
|
|
411
|
+
|
|
412
|
+
```sh
|
|
413
|
+
zinn task create MDR --title "Review the numbers" --priority high
|
|
414
|
+
zinn task edit MDR-1 --priority urgent
|
|
415
|
+
zinn task edit MDR-1 --priority none
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Use `none` to clear priority. Priority does not affect board ordering.
|
|
419
|
+
|
|
420
|
+
## Activity
|
|
421
|
+
|
|
422
|
+
Zinn records changes to tasks, projects, columns, labels, relations, and comments, including who made them.
|
|
423
|
+
|
|
424
|
+
Deleting a project records one project deletion rather than separate deletion activity for every cascaded row.
|
|
425
|
+
|
|
426
|
+
```sh
|
|
427
|
+
zinn activity list
|
|
428
|
+
zinn activity list --limit 10
|
|
429
|
+
zinn activity list --task MDR-1
|
|
430
|
+
zinn activity view 019abcdf-1234-7
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
`--limit` caps the newest matching events and must be a positive safe integer. Reorders and both affected-task events from relation changes are included.
|
|
434
|
+
|
|
435
|
+
`--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.
|
|
436
|
+
|
|
437
|
+
`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.
|
|
438
|
+
|
|
439
|
+
`activity view` preserves full recorded text and line breaks, including unknown change fields.
|
|
440
|
+
|
|
441
|
+
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.
|
|
442
|
+
|
|
443
|
+
When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
|
|
444
|
+
|
|
445
|
+
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.
|
|
446
|
+
|
|
280
447
|
## Back up the database
|
|
281
448
|
|
|
282
449
|
It is recommended to save a copy of the database before installing a new version:
|
|
@@ -285,7 +452,49 @@ It is recommended to save a copy of the database before installing a new version
|
|
|
285
452
|
zinn backup
|
|
286
453
|
```
|
|
287
454
|
|
|
288
|
-
The
|
|
455
|
+
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.
|
|
456
|
+
|
|
457
|
+
## Restore the database
|
|
458
|
+
|
|
459
|
+
Restore the whole database from a backup saved by `zinn backup` or an upgrade:
|
|
460
|
+
|
|
461
|
+
```sh
|
|
462
|
+
zinn restore ~/.zinn/backups/2026-09-29T12-30-05Z-cli-0.32.0-b38178c0.sqlite
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
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.
|
|
466
|
+
|
|
467
|
+
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.
|
|
468
|
+
|
|
469
|
+
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.
|
|
470
|
+
|
|
471
|
+
If the database being replaced is damaged, restore leaves it unchanged and prints recovery steps.
|
|
472
|
+
|
|
473
|
+
## Upgrade the database
|
|
474
|
+
|
|
475
|
+
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`.
|
|
476
|
+
|
|
477
|
+
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:
|
|
478
|
+
|
|
479
|
+
```sh
|
|
480
|
+
zinn migrate
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
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.
|
|
484
|
+
|
|
485
|
+
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.
|
|
486
|
+
|
|
487
|
+
A database with a newer schema version than your Zinn can be read, but changes are refused. Use a newer Zinn to change it.
|
|
488
|
+
|
|
489
|
+
### Databases without a schema version
|
|
490
|
+
|
|
491
|
+
A database created before Zinn recorded schema versions has none. Zinn refuses to open it, and `zinn migrate` does not upgrade it. Add `--allow-legacy-read` to a command to read it anyway:
|
|
492
|
+
|
|
493
|
+
```sh
|
|
494
|
+
zinn task list MDR --allow-legacy-read
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Reads are best effort and may fail or omit data, and Zinn warns about it on stderr once per command. The flag never lets a command change the database, and it applies only to the command that carries it. Like `--json`, it can go anywhere in the command, except after `--`, where it is treated as a regular argument. `zinn backup` works on such a database without the flag.
|
|
289
498
|
|
|
290
499
|
## Scripting and JSON output
|
|
291
500
|
|
|
@@ -298,22 +507,22 @@ zinn task create MDR --title "Refine the numbers" --json
|
|
|
298
507
|
|
|
299
508
|
- Read commands print what they list or show. Write commands print the entity they created, changed, or deleted.
|
|
300
509
|
- Output is a single JSON document on stdout. Empty lists print `[]`.
|
|
301
|
-
- Errors go to stderr as `{ "error": { "message": "..." } }`, stdout stays empty, and the command exits with code 1.
|
|
510
|
+
- 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.
|
|
302
511
|
|
|
303
|
-
|
|
512
|
+
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.
|
|
304
513
|
|
|
305
514
|
### Confirmations
|
|
306
515
|
|
|
307
|
-
|
|
516
|
+
Project, task, label, and comment deletion ask for confirmation, as does restoring the database. Use `--yes` to skip the prompt:
|
|
308
517
|
|
|
309
518
|
```sh
|
|
310
519
|
zinn task delete MDR-1 --yes
|
|
311
520
|
zinn task delete MDR-1 --yes --json
|
|
312
521
|
```
|
|
313
522
|
|
|
314
|
-
- With `--json`, `--yes` is **required**. Without it, the command exits with an error and
|
|
315
|
-
- When nothing answers the prompt, as in CI or with input redirected from an empty source, a
|
|
316
|
-
- `task relation delete`
|
|
523
|
+
- With `--json`, `--yes` is **required**. Without it, the command exits with an error and changes nothing.
|
|
524
|
+
- When nothing answers the prompt, as in CI or with input redirected from an empty source, a command without `--yes` counts as declined: it prints `Deletion cancelled …` (or `Restore cancelled …`) and exits with code 0. Scripts that delete or restore should always use `--yes`.
|
|
525
|
+
- `task relation delete` never asks for confirmation and does not accept `--yes`.
|
|
317
526
|
|
|
318
527
|
## Help
|
|
319
528
|
|
|
@@ -327,29 +536,6 @@ zinn task --help
|
|
|
327
536
|
zinn task move --help
|
|
328
537
|
```
|
|
329
538
|
|
|
330
|
-
The short `-h` form works in the same positions.
|
|
331
|
-
|
|
332
|
-
Running `zinn` without a command shows help
|
|
333
|
-
|
|
334
|
-
## Task priority
|
|
539
|
+
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.
|
|
335
540
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
```sh
|
|
339
|
-
zinn task create MDR --title "Review the numbers" --priority high
|
|
340
|
-
zinn task edit MDR-1 --priority urgent
|
|
341
|
-
zinn task edit MDR-1 --priority none
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
Use `none` to clear priority. Omitting `--priority` on edits preserves it. Task lists show priority in a compact column after the board column: `-` for unassigned and `L`, `M`, `H`, or `U` for low, medium, high, or urgent. Task views show the full priority value. Priority does not affect board ordering.
|
|
345
|
-
|
|
346
|
-
## Activity
|
|
347
|
-
|
|
348
|
-
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.
|
|
349
|
-
|
|
350
|
-
Deleting a project records one project deletion rather than separate deletion activity for every cascaded row.
|
|
351
|
-
Note that this data is not yet surfaced by any command yet.
|
|
352
|
-
|
|
353
|
-
When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
|
|
354
|
-
|
|
355
|
-
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.
|
|
541
|
+
Running `zinn` without a command shows help. Use `zinn --version` (or `-v`) to print the CLI version.
|
package/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
import { isHelpFlag } from "./src/lib";
|
|
4
3
|
import packageJson from "./package.json";
|
|
5
4
|
|
|
6
5
|
const args = process.argv.slice(2);
|
|
@@ -9,26 +8,19 @@ const isVersionRequest = args.length === 1 && ["-v", "--version"].includes(args[
|
|
|
9
8
|
if (isVersionRequest) {
|
|
10
9
|
console.info(packageJson.version);
|
|
11
10
|
} else {
|
|
11
|
+
const { isHelpFlag } = await import("./src/lib");
|
|
12
12
|
const { createRouter } = await import("./src/routes/router");
|
|
13
13
|
const { routes } = await import("./src/routes/routes");
|
|
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
|
-
|
|
26
|
-
Commands:
|
|
27
|
-
${router.commands}
|
|
28
|
-
|
|
29
|
-
Run zinn <namespace> --help or zinn <command> --help for more information.
|
|
30
|
-
Running zinn without a command shows this help.`);
|
|
17
|
+
console.info(router.help);
|
|
31
18
|
} else {
|
|
19
|
+
const { configureDatabase } = await import("@zinn-dev/core");
|
|
20
|
+
const { cliOpenPolicy } = await import("./src/database");
|
|
21
|
+
|
|
22
|
+
// Only records the policy. core then opens the database when a command first uses it.
|
|
23
|
+
configureDatabase(cliOpenPolicy());
|
|
32
24
|
router.route(args);
|
|
33
25
|
}
|
|
34
26
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A kanban workflow in the terminal.",
|
|
3
|
+
"version": "0.38.0",
|
|
4
|
+
"description": "A kanban workflow in the terminal. Experimental.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/yethranayeh/zinn/issues"
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"index.ts",
|
|
34
34
|
"src",
|
|
35
|
-
"LICENSE"
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"release-stamp.json"
|
|
36
37
|
],
|
|
37
38
|
"type": "module",
|
|
38
39
|
"bin": {
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@zinn-dev/core": "0.
|
|
46
|
-
}
|
|
46
|
+
"@zinn-dev/core": "0.27.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {}
|
|
47
49
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"release":"published"}
|