@zinn-dev/cli 0.37.0 → 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 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 _can_ and **will** change between releases.
7
- > A newer Zinn upgrades an older database. Read ([how](#upgrade-the-database)).
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,6 +12,8 @@ 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
 
@@ -41,26 +42,82 @@ The files are plain JSON, without comments:
41
42
 
42
43
  ## Editing conventions
43
44
 
44
- Edit commands change only the fields you supply; 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
+ 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
46
 
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.
47
48
 
48
- Project and column names cannot be blank or contain line breaks or control characters, such as tabs. Column names are trimmed; project names retain surrounding spaces. Label names are trimmed and cannot be blank; task titles cannot be blank. Labels and task titles do not currently enforce the project/column single-line rule.
49
+ Names and titles are trimmed and cannot be blank or contain line breaks or control characters, such as tabs.
49
50
 
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`.
51
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
+
52
109
  ## Changing tasks in bulk
53
110
 
54
111
  `task move`, `task archive` and `task unarchive` accept multiple task keys, so several tasks can be changed in one command:
55
112
 
56
113
  - Tasks are changed in the order given.
57
114
  - If any task fails, for example because of an unknown key, none change.
58
- - A task already in the requested state is listed as usual, with a note on stderr, such as `MDR-1 was already archived`. This includes a key given twice: by its second occurrence, the task is already in the requested state.
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.
59
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.
60
117
 
61
118
  ## Concurrent access
62
119
 
63
- Commands on the same machine can share a database on a local filesystem. Zinn waits up to 30 seconds each time the database is locked by another command. If the lock is still held after that wait, the command _fails_. The command's total running time can exceed 30 seconds. Zinn also briefly retries specific initialization races internally. Initialization errors include the underlying message and code.
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.
64
121
 
65
122
  ## Start a project
66
123
 
@@ -70,9 +127,9 @@ Create a project with a key and optionally provide a name and description:
70
127
  zinn project create MDR --name "Macrodata Refinement" --description "Refine macrodata"
71
128
  ```
72
129
 
73
- 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.
130
+ Project keys are stored in uppercase. An omitted name defaults to the key.
74
131
 
75
- Project list and mutation text show truncated inline description previews, while `project view` prints the description in full. See [Editing conventions](#editing-conventions) for description storage and clearing.
132
+ Descriptions print in full with `project view`. See [Editing conventions](#editing-conventions) for name validation and description storage and clearing.
76
133
 
77
134
  Each project starts with _Backlog_, _TODO_, _In Progress_, _Review_, and _Done_ columns.
78
135
 
@@ -84,7 +141,9 @@ zinn project view MDR
84
141
  zinn project column list MDR
85
142
  ```
86
143
 
87
- `project view` prints the project with its full description and the number of unarchived tasks in each column. Archived tasks are counted as one total. Use `zinn task list <project-key>` to list the tasks themselves.
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 }, ...]`.
88
147
 
89
148
  Edit a project:
90
149
 
@@ -95,7 +154,7 @@ zinn project edit MDR --description ""
95
154
  ```
96
155
 
97
156
  Provide `--name`, `--description`, or both.
98
- Use `--name="--example"` when a value begins with a dash.
157
+ See [Text values](#text-values) for values that begin with a dash and multi-line text.
99
158
 
100
159
  Add another column at the end of the board:
101
160
 
@@ -109,9 +168,7 @@ Rename a column:
109
168
  zinn project column edit MDR "In Progress" --name "Refining"
110
169
  ```
111
170
 
112
- Columns are matched by name, and matching is case-insenstivie. Names are trimmed and they cannot be blank.
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.
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.
115
172
 
116
173
  Change a column's position on the board:
117
174
 
@@ -125,36 +182,41 @@ zinn project column order MDR Review after Done
125
182
  ```
126
183
 
127
184
  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
185
  Moving a column to the position it already has, or before or after itself, does nothing. Tasks stay in their columns.
130
186
 
131
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)).
132
188
 
133
189
  ## Create and read tasks
134
190
 
135
- 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:
136
192
 
137
193
  ```sh
138
194
  zinn task create MDR --title "Refine 75% of the numbers"
139
195
  zinn task create MDR --title "Review the employee handbook" --description "Prepare for a 75% Dance Experience"
140
196
  ```
141
197
 
142
- Tasks are created with keys such as `MDR-1`. List active tasks, optionally limited to one project, or view one task:
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:
143
205
 
144
206
  ```sh
145
207
  zinn task list
146
208
  zinn task list MDR
147
209
  zinn task list MDR --label CLI --label Groom
210
+ zinn task list MDR --column "In Progress"
211
+ zinn task list --column Done --all
148
212
  zinn task view MDR-1
149
213
  ```
150
214
 
151
- 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.
215
+ Task lists are previews, so they omit descriptions, but `task view` prints the full description.
152
216
 
153
- Each row shows the task's key, column, priority marker, title, and labels, such as `MDR-1 | TODO | H | Refine the numbers | bug, cli`. Preview lists _do not_ contain the descriptions. To see everything, `task view` should be used.
217
+ Repeat `--label <name>` to require every specified label. Matching ignores case.
154
218
 
155
- `task view` prints the description in full, keeping its line breaks.
156
-
157
- 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.
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`).
158
220
 
159
221
  ## Search tasks
160
222
 
@@ -172,12 +234,11 @@ Each query matches the start of a word, ignoring case and accents, so `cafe` fin
172
234
 
173
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.
174
236
 
175
- Note that by default only the active tasks are searched.
176
- `--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.
177
238
 
178
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.
179
240
 
180
- 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`.
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)).
181
242
 
182
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:
183
244
 
@@ -189,7 +250,7 @@ Only the index changes, completely or not at all, so no backup is saved. With `-
189
250
 
190
251
  ## Labels
191
252
 
192
- Labels are global and reusable in all the available projects.
253
+ Labels are global and reusable across projects.
193
254
 
194
255
  ```sh
195
256
  zinn label create urgent --color red --description "Needs attention soon"
@@ -207,20 +268,20 @@ zinn task label remove MDR-1 review
207
268
  zinn task edit MDR-1 --add-label review --remove-label urgent
208
269
  ```
209
270
 
210
- For adding or removing multiple labels at the same time, repeat `--label` on creation, or `--add-label` and `--remove-label` while editing for each label.
211
- Each value is considered as the label name: `--label "needs review"`, so if you have commas, then they are considered parts of names.
212
- Label names preserve their stored casing, but matching and uniqueness are case-insensitive. For example, `BUG` can match to a label stored as `Bug`, `Bug` or `bug`, but all three canno exist at the same time as three different label entries. Changing only the casing of an existing label is allowed. Whitespace around label names is trimmed.
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.
213
274
 
214
275
  Label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
215
276
 
216
- `label create`, `label edit` and `label list` print each label name in its color. When color is off (see [Scripting and JSON output](#scripting-and-json-output)), they name the color instead, such as `bug | red | Broken`. `--json` output always shows the color as a value.
277
+ `--json` includes each label's color as a value.
217
278
 
218
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.
219
280
 
220
281
  Task creation and edits apply content and label changes together, or roll back together on failure.
221
282
  Changing a task's label attachments updates that task's modification timestamp. Archived tasks can also have their labels edited.
222
283
 
223
- Commands like `task list`, `task view` and task mutation output show attached labels, printing each label name in its color (see [Scripting and JSON output](#scripting-and-json-output) for when color appears). `--json` output lists a task's labels as names.
284
+ `--json` lists a task's labels as names.
224
285
 
225
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)).
226
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.
@@ -234,21 +295,23 @@ zinn task relation create MDR-1 OTHER-1 --type related
234
295
  zinn task relation list MDR-1
235
296
  ```
236
297
 
237
- `dependency` means the first task depends on the second, `duplicate` means the first task is a duplicate of the second. `related` is a bit different as the order of the tasks mentioned _does not matter_, either case describes the same relation.
298
+ `dependency` means the first task depends on the second; `duplicate` means the first is a duplicate of the second. `related` is symmetric.
238
299
 
239
300
  Relations do not automatically move, complete, or archive tasks.
240
301
  Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
241
302
 
242
- `task view` a task's existing relations.
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.
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.
245
304
 
246
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.
247
306
 
248
- 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.
249
- 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:
308
+
309
+ ```sh
310
+ zinn task create MDR --title "Sort the files" --parent MDR-1 --depends-on MDR-2
311
+ ```
250
312
 
251
- Use `task relation create --help` to discover types.
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.
252
315
 
253
316
  ## Task comments
254
317
 
@@ -260,8 +323,6 @@ zinn task comment list MDR-1
260
323
  ```
261
324
 
262
325
  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
326
 
266
327
  Edit or delete a comment using its key:
267
328
 
@@ -282,10 +343,10 @@ zinn task edit MDR-1 --description "Complete refinement before the waffle party"
282
343
  zinn task edit MDR-1 --title "Meet the quarterly refinement quota" --description ""
283
344
  ```
284
345
 
285
- See [Editing conventions](#editing-conventions) for partial edits and clearing descriptions.
346
+ See [Editing conventions](#editing-conventions) for title validation, partial edits and clearing descriptions.
286
347
 
287
348
  Archived tasks can be edited without unarchiving them.
288
- Use `--title="--example"` when a value begins with a dash.
349
+ See [Text values](#text-values) for values that begin with a dash and multi-line text.
289
350
 
290
351
  ## Move and order tasks
291
352
 
@@ -297,7 +358,7 @@ zinn task move MDR-1 "In Progress"
297
358
 
298
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.
299
360
 
300
- Move multiple tasks at once by giving their keys before the column. They land at the bottom of the column in the order given, unless of course a task was _already_ in that column, in which case they stay as they were. Tasks from different projects can be moved together, and each one's column is looked up in its own project:
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:
301
362
 
302
363
  ```sh
303
364
  zinn task move MDR-1 MDR-2 APP-4 "In Progress"
@@ -312,7 +373,6 @@ zinn task order MDR-2 top
312
373
  zinn task order MDR-2 up
313
374
  zinn task order MDR-2 down
314
375
  zinn task order MDR-2 bottom
315
- zinn task move MDR-2 "In Progress"
316
376
  zinn task order MDR-2 before MDR-1
317
377
  zinn task order MDR-2 after MDR-1
318
378
  ```
@@ -330,7 +390,7 @@ zinn task list MDR --archived
330
390
  zinn task list MDR --all
331
391
  ```
332
392
 
333
- `--archived` and `--all` cannot be used together. In an `--all` listing, Zinn adds an Active or Archived status column.
393
+ `--archived` and `--all` cannot be used together.
334
394
 
335
395
  Unarchiving puts a task at the bottom of its previous column:
336
396
 
@@ -343,6 +403,47 @@ Archive or unarchive multiple tasks by giving several keys. Unarchived tasks lan
343
403
 
344
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)).
345
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
+
346
447
  ## Back up the database
347
448
 
348
449
  It is recommended to save a copy of the database before installing a new version:
@@ -351,21 +452,21 @@ It is recommended to save a copy of the database before installing a new version
351
452
  zinn backup
352
453
  ```
353
454
 
354
- The copy goes to the `backups/` folder next to `data/`, in a file named after the UTC time and the CLI version that made it, with an eight-character random suffix to distinguish backups made at the same time, like `2026-09-29T12-30-05Z-cli-0.32.0-b38178c0.sqlite`. It is a single file with every change made so far, and it is safe to take while Zinn is in use. Existing backups are never overwritten. With `--json`, the command prints `{ "path": "..." }`. It fails when there is no database yet.
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.
355
456
 
356
457
  ## Restore the database
357
458
 
358
- Put back the board from a backup file, such as one saved by `zinn backup` or by an upgrade:
459
+ Restore the whole database from a backup saved by `zinn backup` or an upgrade:
359
460
 
360
461
  ```sh
361
462
  zinn restore ~/.zinn/backups/2026-09-29T12-30-05Z-cli-0.32.0-b38178c0.sqlite
362
463
  ```
363
464
 
364
- The command asks for confirmation, unless `--yes` is used (see [Confirmations](#confirmations)). It saves the current board as a backup first, in the same folder as `zinn backup`, then replaces the board with the backup's, completely or not at all. Restoring onto a missing database creates it. With `--json`, it prints `{ "databasePath": "...", "previousVersion": 1, "restoredVersion": 1, "backupPath": "..." }`, where `backupPath` is the saved copy of the replaced board, or `null` when there was no board to save.
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.
365
466
 
366
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.
367
468
 
368
- The command fails without changing anything when the backup has a newer schema version than your Zinn (the error names the Zinn version that made the backup if its file name carries one), when it has no schema version, when it is **damaged**, or when it is not a Zinn database. If the restore fails after that, the database is unchanged, and any backup saved before the attempt stays in the `backups/` folder.
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.
369
470
 
370
471
  If the database being replaced is damaged, restore leaves it unchanged and prints recovery steps.
371
472
 
@@ -373,13 +474,13 @@ If the database being replaced is damaged, restore leaves it unchanged and print
373
474
 
374
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`.
375
476
 
376
- A published release of Zinn upgrades the database by itself the first time it opens it. Run `zinn migrate` to upgrade it yourself, for example right after installing a newer Zinn, or when Zinn refuses a change because the database is older. A build run from a source checkout upgrades only a `ZINN_DIR` database by itself, and refuses changes to any other older database until you do:
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:
377
478
 
378
479
  ```sh
379
480
  zinn migrate
380
481
  ```
381
482
 
382
- The command saves a backup, upgrades the database and reports the backup's path with the schema versions before and after. When the database is already up to date, it changes nothing and saves no backup. With `--json`, it prints `{ "databasePath": "...", "previousVersion": 1, "finalVersion": 2, "changed": true, "backupPath": "..." }`, where `backupPath` is `null` when nothing changed.
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.
383
484
 
384
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.
385
486
 
@@ -406,13 +507,13 @@ zinn task create MDR --title "Refine the numbers" --json
406
507
 
407
508
  - Read commands print what they list or show. Write commands print the entity they created, changed, or deleted.
408
509
  - 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.
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.
410
511
 
411
- Text output is mainly for _visual_ consumption. Colors appear only when the output goes to a terminal and [`NO_COLOR`](https://no-color.org/) is not set. In the case that [`FORCE_COLOR`](https://force-color.org/) is set, it overrides both. Note that `FORCE_COLOR=0` turns colors off, and any other value turns them on, even when piped. Piped text is plain otherwise, but its layout may change between versions. Scripts should use `--json` to get reliable output.
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.
412
513
 
413
514
  ### Confirmations
414
515
 
415
- Commands like `project delete`, `task delete`, etc. ask for confirmation before deleting, and `restore` asks before replacing the board. Use `--yes` to skip the prompt:
516
+ Project, task, label, and comment deletion ask for confirmation, as does restoring the database. Use `--yes` to skip the prompt:
416
517
 
417
518
  ```sh
418
519
  zinn task delete MDR-1 --yes
@@ -421,7 +522,7 @@ zinn task delete MDR-1 --yes --json
421
522
 
422
523
  - With `--json`, `--yes` is **required**. Without it, the command exits with an error and changes nothing.
423
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`.
424
- - `task relation delete` is consider a low consequence action, so it never asks for confirmation and does not accept `--yes`.
525
+ - `task relation delete` never asks for confirmation and does not accept `--yes`.
425
526
 
426
527
  ## Help
427
528
 
@@ -435,29 +536,6 @@ zinn task --help
435
536
  zinn task move --help
436
537
  ```
437
538
 
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.
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.
457
540
 
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.
462
-
463
- 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
@@ -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(`ZINN - A kanban workflow in the terminal
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.37.0",
3
+ "version": "0.38.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.26.0"
46
+ "@zinn-dev/core": "0.27.0"
47
47
  },
48
48
  "scripts": {}
49
49
  }
package/src/lib.test.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { OpenPolicy } from "@zinn-dev/core";
2
2
 
3
3
  import { expect, test } from "bun:test";
4
- import { ReadOnlyDatabaseError, UnmarkedDatabaseError } from "@zinn-dev/core";
4
+ import { ReadOnlyDatabaseError, TextEditMatchError, UnmarkedDatabaseError } from "@zinn-dev/core";
5
5
 
6
- import { failureMessage } from "./lib";
6
+ import { failureMessage, UsageError, validatePositionals } from "./lib";
7
7
 
8
8
  const FALLBACK = "Something went wrong";
9
9
  const POLICY: OpenPolicy = {
@@ -58,3 +58,29 @@ test("an unmarked database opened for reading refuses changes without pointing a
58
58
 
59
59
  expect(failureMessage(error, FALLBACK)).toBe(error.message);
60
60
  });
61
+
62
+ test("a text edit that matches several places points at --all, and one that matches none does not", () => {
63
+ const several = new TextEditMatchError(3, "ZINN-1's description");
64
+ const none = new TextEditMatchError(0, "ZINN-1's description");
65
+
66
+ expect(failureMessage(several, FALLBACK)).toBe(
67
+ `${several.message} Use --all to replace every match.`,
68
+ );
69
+ expect(failureMessage(none, FALLBACK)).toBe(none.message);
70
+ });
71
+
72
+ test("validatePositionals names the first missing word, or the first word past the most it takes", () => {
73
+ const words = ["<project-key>", "<column-name>"];
74
+
75
+ expect(() => validatePositionals(["SHOP", "Later"], words)).not.toThrow();
76
+ expect(() => validatePositionals(["SHOP"], words)).toThrow(UsageError);
77
+ expect(() => validatePositionals(["SHOP"], words)).toThrow("<column-name>");
78
+ expect(() => validatePositionals([], words)).toThrow("<project-key>");
79
+ expect(() => validatePositionals(["SHOP", "Needs", "Review", "Now"], words)).toThrow('"Review"');
80
+
81
+ // ? Written as in the usage lines: [...] marks an optional word and a trailing ... a word that repeats.
82
+ expect(() => validatePositionals([], ["[<project-key>]"])).not.toThrow();
83
+ expect(() => validatePositionals(["SHOP", "extra"], ["[<project-key>]"])).toThrow('"extra"');
84
+ expect(() => validatePositionals(["A-1", "A-2", "A-3"], ["<task-key>..."])).not.toThrow();
85
+ expect(() => validatePositionals(["A-1"], ["<task-key>...", "<target-column>"])).toThrow("<target-column>");
86
+ });