@zinn-dev/cli 0.41.0 → 0.43.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.
Files changed (81) hide show
  1. package/README.md +11 -689
  2. package/index.js +2 -2
  3. package/package.json +4 -4
  4. package/skills/zinn/SKILL.md +1 -1
  5. package/src/capabilities-schema.d.ts +25 -26
  6. package/src/capabilities-schema.js +17 -82
  7. package/src/capabilities.d.ts +11 -3
  8. package/src/capabilities.js +12 -4
  9. package/src/column-hint.d.ts +3 -0
  10. package/src/column-hint.js +225 -0
  11. package/src/database.js +1 -4
  12. package/src/errors.d.ts +31 -3
  13. package/src/errors.js +77 -20
  14. package/src/input.d.ts +154 -43
  15. package/src/input.js +86 -13
  16. package/src/lib.d.ts +43 -6
  17. package/src/lib.js +134 -38
  18. package/src/list-continuation.d.ts +11 -0
  19. package/src/list-continuation.js +18 -0
  20. package/src/list-limit.d.ts +11 -0
  21. package/src/list-limit.js +17 -0
  22. package/src/presentation/activity-presentation.d.ts +9 -1
  23. package/src/presentation/activity-presentation.js +124 -28
  24. package/src/presentation/capabilities-presentation.d.ts +2 -0
  25. package/src/presentation/capabilities-presentation.js +3 -0
  26. package/src/presentation/column-presentation.d.ts +6 -0
  27. package/src/presentation/column-presentation.js +10 -0
  28. package/src/presentation/comment-presentation.d.ts +15 -0
  29. package/src/presentation/comment-presentation.js +29 -0
  30. package/src/presentation/description-presentation.d.ts +4 -0
  31. package/src/presentation/description-presentation.js +28 -5
  32. package/src/presentation/label-presentation.d.ts +8 -0
  33. package/src/presentation/label-presentation.js +28 -0
  34. package/src/presentation/project-presentation.d.ts +11 -0
  35. package/src/presentation/project-presentation.js +27 -0
  36. package/src/presentation/relation-presentation.d.ts +12 -0
  37. package/src/presentation/relation-presentation.js +87 -0
  38. package/src/presentation/row-layout.d.ts +1 -1
  39. package/src/presentation/row-layout.js +6 -5
  40. package/src/presentation/task-presentation.d.ts +3 -3
  41. package/src/presentation/task-presentation.js +29 -19
  42. package/src/presentation/text-width.d.ts +2 -0
  43. package/src/presentation/text-width.js +43 -0
  44. package/src/presentation/time.d.ts +3 -1
  45. package/src/presentation/time.js +5 -2
  46. package/src/project.d.ts +14 -5
  47. package/src/project.js +18 -6
  48. package/src/result-schemas.d.ts +279 -26
  49. package/src/result-schemas.js +72 -4
  50. package/src/results.d.ts +34 -17
  51. package/src/results.js +19 -0
  52. package/src/routes/activity-router.d.ts +79 -2
  53. package/src/routes/activity-router.js +209 -38
  54. package/src/routes/aliases.d.ts +2 -0
  55. package/src/routes/aliases.js +11 -0
  56. package/src/routes/capabilities-router.js +9 -3
  57. package/src/routes/comment-router.d.ts +41 -18
  58. package/src/routes/comment-router.js +65 -48
  59. package/src/routes/label-router.d.ts +57 -7
  60. package/src/routes/label-router.js +84 -39
  61. package/src/routes/project-router.d.ts +74 -12
  62. package/src/routes/project-router.js +131 -66
  63. package/src/routes/relation-router.d.ts +13 -9
  64. package/src/routes/relation-router.js +116 -116
  65. package/src/routes/restore-router.js +3 -6
  66. package/src/routes/router.d.ts +1 -1
  67. package/src/routes/router.js +88 -32
  68. package/src/routes/routes.d.ts +420 -50
  69. package/src/routes/routes.js +4 -0
  70. package/src/routes/task-router.d.ts +189 -30
  71. package/src/routes/task-router.js +254 -158
  72. package/src/routes/whoami-router.d.ts +21 -0
  73. package/src/routes/whoami-router.js +31 -0
  74. package/src/text-edit.d.ts +13 -9
  75. package/src/text-edit.js +23 -18
  76. package/src/text-input.d.ts +47 -0
  77. package/src/text-input.js +187 -0
  78. package/src/timestamp-input.d.ts +3 -0
  79. package/src/timestamp-input.js +31 -0
  80. package/src/types.d.ts +32 -9
  81. package/src/types.js +9 -1
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # @zinn-dev/cli
2
2
 
3
- The `zinn` command-line interface.
3
+ The `zinn` command-line interface for Zinn.
4
4
 
5
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).
6
+ > **Experimental.** Commands, output, and the database schema may change between releases. Save a backup with `zinn backup` before upgrading.
8
7
 
9
8
  ## Install
10
9
 
@@ -12,696 +11,19 @@ The `zinn` command-line interface.
12
11
  npm i -g @zinn-dev/cli
13
12
  ```
14
13
 
15
- Requires [Node.js](https://nodejs.org/) 24.15.0 or newer.
14
+ Requires [Node.js](https://nodejs.org/) 24.15.0 or newer. See [Install](https://zinn.sh/docs/installation) for package setup and upgrade instructions.
16
15
 
17
- For a first project and task, see the [quick start](../../README.md#quick-start).
16
+ ## Use
18
17
 
19
- Zinn stores projects and tasks in the shared local database at `~/.zinn/data/zinn.sqlite`.
20
- 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)).
21
-
22
- ## Settings files
23
-
24
- 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.
25
-
26
- Without `ZINN_DIR`, Zinn reads two optional settings files:
27
-
28
- - `settings.json` in `~/.zinn` holds the global settings.
29
- - `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.
30
-
31
- `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.
32
-
33
- The files are plain JSON, without comments:
34
-
35
- ```json
36
- {
37
- "$schema": "https://zinn.sh/schemas/settings/v1.json",
38
- "defaultProject": "MDR",
39
- "storage": {
40
- "directory": "~/work/zinn-data"
41
- }
42
- }
43
- ```
44
-
45
- `$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 and is bumped only when changes that would make existing files invalid. An unknown key, a value of the wrong type or invalid JSON in a selected settings file stops commands with an error that names the file, except for the inspection report below. Zinn _does not fall back to the defaults_.
46
-
47
- `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.
48
-
49
- `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.
50
-
51
- 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.
52
-
53
- 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.
54
-
55
- ### Inspection
56
-
57
- ```sh
58
- zinn info
59
- zinn info --json
60
- ```
61
-
62
- `info` reports the selected store and database path, the settings files and their sources, the configured default project, the database schema state, and CLI, core and runtime versions. Local settings discovery stops at the nearest `zinn.local.json`. With `ZINN_DIR`, home and codebase settings are marked as not read.
63
-
64
- An unusable settings file displays errors, and a missing store or database and database read errors are reported with exit code 0. Note that SQLite may perform normal file housekeeping and crash recovery when this command is called.
65
-
66
- With `--json`, the report is one object that always has the same keys:
67
-
68
- - `settingsFiles` lists each settings file with its `path`, its `source` (`env` for `ZINN_DIR/settings.json`, `global` or `local`) and its `state`: `found` (with the file's `settings`), `missing`, `error` (with an `error` string) or `not-read` (with `reason: "ZINN_DIR"`). With `ZINN_DIR`, the list holds `ZINN_DIR/settings.json` and the home and codebase files marked `not-read`.
69
- - `storage` holds the store `directory`, its `source` (`env`, `local`, `global` or `default`), the `settingsPath` of the file that chose it (`null` for `env` and `default`), whether the directory `exists`, and an `error`.
70
- - `defaultProject` holds the `key`, the `settingsPath` of the file that set it, and an `error`. `key` and `settingsPath` are `null` when no default is configured.
71
- - `database` holds its `path`, its `state`, the schema `version` it has, and the `latestVersion` this CLI reaches. `state` is `absent` (no file), `empty` (a file with no tables), `unmarked` (tables but no schema version), `current`, `older` or `newer` (compared with `latestVersion`), or `unavailable`. `version` is `0` for `absent`, `empty` and `unmarked`.
72
- - `versions` holds `cli`, `core` and `runtime` (`name` and `version`).
73
-
74
- `unavailable` means the database could not be inspected: an unusable settings file left the store undecided (`path` and `version` are `null`), or the file could not be read as a database (`path` is set, `version` is `null`, and `error` says why). Every `error` is `null` when there is no problem. A settings file's error is carried on `storage`, `defaultProject` and `database` as well as on its `settingsFiles` entry, so the same string can appear on several fields. With `ZINN_DIR`, an unusable `ZINN_DIR/settings.json` sets only `defaultProject.error`, since the store is already chosen.
75
-
76
- ```json
77
- {
78
- "settingsFiles": [
79
- {
80
- "path": "/home/me/.zinn/settings.json",
81
- "source": "global",
82
- "state": "found",
83
- "settings": { "defaultProject": "DEMO" }
84
- },
85
- { "path": "/work/app/zinn.local.json", "source": "local", "state": "missing" }
86
- ],
87
- "storage": {
88
- "directory": "/home/me/.zinn",
89
- "source": "default",
90
- "settingsPath": null,
91
- "exists": true,
92
- "error": null
93
- },
94
- "defaultProject": { "key": "DEMO", "settingsPath": "/home/me/.zinn/settings.json", "error": null },
95
- "database": {
96
- "path": "/home/me/.zinn/data/zinn.sqlite",
97
- "state": "current",
98
- "version": 2,
99
- "latestVersion": 2,
100
- "error": null
101
- },
102
- "versions": { "cli": "0.41.0", "core": "0.30.0", "runtime": { "name": "Node", "version": "22.0.0" } }
103
- }
104
- ```
105
-
106
- ## Editing conventions
107
-
108
- 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.
109
-
110
- 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.
111
-
112
- Names and titles are trimmed and cannot be blank or contain line breaks or control characters, such as tabs.
113
-
114
- 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`.
115
-
116
- 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:
117
-
118
- ```sh
119
- zinn task edit MDR-1 --description 'Bring waffles.' --append
120
- zinn task edit MDR-1 --description 'new sentence' --replacing 'old sentence'
121
- zinn project edit MDR --description database --replacing board --all
122
- ```
123
-
124
- Flags:
125
-
126
- - `--append` adds the text as a new paragraph,
127
- - `--replacing <old>` replaces the one place where `<old>` appears, matching exactly and respecting case.
128
- - `--all` replaces every match.
129
-
130
- A command with no match, or with several matches and no `--all`, fails without changing anything.
131
- An empty text with `--replacing` deletes the match. `--append` and `--replacing` cannot be combined.
132
-
133
- ## Text values
134
-
135
- 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:
136
-
137
- ```sh
138
- zinn task edit MDR-1 --description='- Bring waffles.' --append
139
- ```
140
-
141
- 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:
142
-
143
- ```sh
144
- zinn task edit MDR-1 --description="$(cat <<'EOF'
145
- - Bring waffles.
146
- - Count the `numbers` for $5 and "Kier".
147
- EOF
148
- )"
149
- ```
150
-
151
- `$(...)` drops trailing line breaks, so the stored text ends with the last character of the last line.
152
-
153
- ## Words and repeated flags
154
-
155
- `--` 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:
156
-
157
- ```sh
158
- zinn project column create MDR -- -later
159
- zinn task search -- -flag
160
- ```
161
-
162
- A flag can be given once.
163
- Only these flags repeat:
164
-
165
- - `--label` on `task create`, `task list` and `task search`,
166
- - `--depends-on` and `--related` on `task create`,
167
- - `--add-label` and `--remove-label` on `task edit`.
168
-
169
- Any other flag given twice, `--json` and `--yes` included, **fails** without changing anything.
170
- 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!
171
-
172
- ## Changing tasks in bulk
173
-
174
- `task move`, `task archive` and `task unarchive` accept multiple task keys, so several tasks can be changed in one command:
175
-
176
- - Tasks are changed in the order given.
177
- - If any task fails, for example because of an unknown key, none change.
178
- - 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.
179
- - 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.
180
-
181
- ## Concurrent access
182
-
183
- 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.
184
-
185
- ## Start a project
186
-
187
- Create a project with a key and optionally provide a name and description:
188
-
189
- ```sh
190
- zinn project create MDR --name 'Macrodata Refinement' --description 'Refine macrodata'
191
- ```
192
-
193
- Project keys are stored in uppercase. An omitted name defaults to the key.
194
-
195
- Descriptions print in full with `project view`. See [Editing conventions](#editing-conventions) for name validation and description storage and clearing.
196
-
197
- Each project starts with _Backlog_, _TODO_, _In Progress_, _Review_, and _Done_ columns.
198
-
199
- You can list projects or inspect a project's columns with:
200
-
201
- ```sh
202
- zinn project list
203
- zinn project view MDR
204
- zinn project column list MDR
205
- ```
206
-
207
- `project view` shows the project's description and task counts. Use `zinn task list <project-key>` to read its tasks.
208
-
209
- `project view` and `project column list` accept an omitted project key when [defaultProject](#settings-files) is configured.
210
-
211
- `project column list` counts unarchived tasks. With `--json`, it returns `[{ "name": "Backlog", "taskCount": 3 }, ...]`.
212
-
213
- Edit a project:
214
-
215
- ```sh
216
- zinn project edit MDR --name 'Macrodata Refinement (Morning Shift)'
217
- zinn project edit MDR --description 'Meet the quarterly quota'
218
- zinn project edit MDR --description ''
219
- ```
220
-
221
- Provide `--name`, `--description`, or both.
222
- The project key can be omitted when [defaultProject](#settings-files) is configured.
223
- See [Text values](#text-values) for values that begin with a dash and multi-line text.
224
-
225
- Add another column at the end of the board:
226
-
227
- ```sh
228
- zinn project column create MDR Boardlog
229
- ```
230
-
231
- Rename a column:
232
-
233
- ```sh
234
- zinn project column edit MDR 'In Progress' --name Refining
235
- ```
236
-
237
- 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.
238
-
239
- Change a column's position on the board:
240
-
241
- ```sh
242
- zinn project column order MDR Review first
243
- zinn project column order MDR Review previous
244
- zinn project column order MDR Review next
245
- zinn project column order MDR Review last
246
- zinn project column order MDR Review before 'In Progress'
247
- zinn project column order MDR Review after Done
248
- ```
249
-
250
- Directions follow board order: `first` is the start of the board and `last` is its end.
251
- Moving a column to the position it already has, or before or after itself, does nothing. Tasks stay in their columns.
252
-
253
- `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)).
254
-
255
- ## Create and read tasks
256
-
257
- 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:
258
-
259
- ```sh
260
- zinn task create MDR --title 'Refine 75% of the numbers'
261
- zinn task create MDR --title 'Review the employee handbook' --description 'Prepare for a 75% Dance Experience'
262
- ```
263
-
264
- The project key can be omitted when [defaultProject](#settings-files) is configured.
265
-
266
- `--column <name>` starts the task at the bottom of a specific column. The column name matching is case insensitive:
267
-
268
- ```sh
269
- zinn task create MDR --title 'Compile the Lexington letters' --column 'In Progress'
270
- ```
271
-
272
- 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:
273
-
274
- ```sh
275
- zinn task list
276
- zinn task list MDR
277
- zinn task list --all-projects
278
- zinn task list MDR --label CLI --label Groom
279
- zinn task list MDR --column 'In Progress'
280
- zinn task list --column Done --all
281
- zinn task view MDR-1
282
- zinn task view MDR-1 --history
283
- ```
284
-
285
- Task lists are previews, so they _omit_ descriptions, but `task view` prints the full description.
286
-
287
- An omitted project key uses [defaultProject](#settings-files), or every project when none is configured. `--all-projects` overrides the default.
288
-
289
- `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.
290
-
291
- 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_.
292
-
293
- 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.
294
-
295
- Repeat `--label <name>` to require every specified label. Matching ignores case.
296
-
297
- 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`).
298
-
299
- ## Search tasks
300
-
301
- Search task titles, descriptions, and comments, optionally in one project:
302
-
303
- ```sh
304
- zinn task search refine
305
- zinn task search refine --all-projects
306
- zinn task search 'quarterly quota' MDR
307
- zinn task search MDR-1
308
- zinn task search auth --all --limit 5
309
- zinn task search auth MDR --label cli
310
- ```
311
-
312
- 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.
313
-
314
- 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.
315
-
316
- 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.
317
-
318
- An exact task-key query overrides the configured default project. A project key supplied after the query still filters the search.
319
-
320
- Search defaults to active tasks. `--archived` searches archived tasks and `--all` searches both. A note on stderr reports hidden archived matches. `--limit <n>` caps the results.
321
-
322
- `--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.
323
-
324
- 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)).
325
-
326
- 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:
327
-
328
- ```sh
329
- zinn reindex
330
- ```
331
-
332
- 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)).
333
-
334
- ## Labels
335
-
336
- Labels are global and reusable across projects.
337
-
338
- ```sh
339
- zinn label create urgent --color red --description 'Needs attention soon'
340
- zinn label create review
341
- zinn label edit review --name ready --color green
342
- zinn label list
343
- ```
344
-
345
- ### Adding to tasks
346
-
347
- ```sh
348
- zinn task create MDR --title 'Check the numbers' --label urgent --label review
349
- zinn task label add MDR-1 urgent review
350
- zinn task label remove MDR-1 review
351
- zinn task edit MDR-1 --add-label review --remove-label urgent
352
- ```
353
-
354
- 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'`.
355
-
356
- 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.
357
-
358
- Label colors default to white. Available colors are _red_, _green_, _yellow_, _blue_, _magenta_, _cyan_, _white_, and _gray_.
359
-
360
- `--json` includes each label's color as a value.
361
-
362
- `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.
363
-
364
- Task creation and edits apply content and label changes together, or roll back together on failure.
365
- Changing a task's label attachments updates that task's modification timestamp. Archived tasks can also have their labels edited.
366
-
367
- `--json` lists a task's labels as names.
368
-
369
- `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)).
370
- 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.
371
-
372
- ## Task relations
373
-
374
- ```sh
375
- zinn task relation create MDR-1 MDR-2 --type dependency
376
- zinn task relation create MDR-1 MDR-2 --type duplicate
377
- zinn task relation create MDR-1 OTHER-1 --type related
378
- zinn task relation list MDR-1
379
- ```
380
-
381
- `dependency` means the first task depends on the second; `duplicate` means the first is a duplicate of the second. `related` is symmetric.
382
-
383
- Relations do not automatically move, complete, or archive tasks.
384
- Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
385
-
386
- JSON relation arrays from `task relation list` and `task view` are ordered by creation timestamp ascending, then relation ID ascending for ties.
387
-
388
- 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.
389
-
390
- 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.
391
-
392
- `task create` can relate the new task with `--parent`, `--depends-on`, `--duplicate-of` and `--related`. Repeat `--depends-on` and `--related` to relate several tasks:
393
-
394
- ```sh
395
- zinn task create MDR --title 'Sort the files' --parent MDR-1 --depends-on MDR-2
396
- ```
397
-
398
- 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.
399
- Relation deletion requires no confirmation.
400
-
401
- ## Task comments
402
-
403
- Add and list comments on a task:
404
-
405
- ```sh
406
- zinn task comment create MDR-1 --text 'Ready for review'
407
- zinn task comment list MDR-1
408
- ```
409
-
410
- Comments receive keys per task like `MDR-1#1`.
411
-
412
- View, edit or delete a comment using its key:
413
-
414
- ```sh
415
- zinn task comment view 'MDR-1#1'
416
- zinn task comment edit 'MDR-1#1' --text Approved
417
- zinn task comment delete 'MDR-1#1'
418
- ```
419
-
420
- `task comment view` shows the current text in full, keeping its line breaks, including on archived tasks. With `--json`, it returns one object with `key`, `text`, `created_at` and `updated_at`.
421
-
422
- Deletion asks for confirmation, unless `--yes` is used (see [Confirmations](#confirmations)). Comments can be added to archived tasks. Comment mutations are recorded in the activity log without changing the task's modification timestamp.
423
-
424
- ## Edit tasks
425
-
426
- Edit a task's title, description, priority, or labels:
427
-
428
- ```sh
429
- zinn task edit MDR-1 --title 'Meet the quarterly refinement quota'
430
- zinn task edit MDR-1 --description 'Complete refinement before the waffle party'
431
- zinn task edit MDR-1 --title 'Meet the quarterly refinement quota' --description ''
432
- ```
433
-
434
- See [Editing conventions](#editing-conventions) for title validation, partial edits and clearing descriptions.
435
-
436
- Archived tasks can be edited without unarchiving them.
437
- See [Text values](#text-values) for values that begin with a dash and multi-line text.
438
-
439
- ## Move and order tasks
440
-
441
- Move a task to another column in its project:
442
-
443
- ```sh
444
- zinn task move MDR-1 'In Progress'
445
- ```
446
-
447
- 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.
448
-
449
- 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:
450
-
451
- ```sh
452
- zinn task move MDR-1 MDR-2 APP-4 'In Progress'
453
- ```
454
-
455
- See [Changing tasks in bulk](#changing-tasks-in-bulk).
456
-
457
- Change a task's position within its current column:
458
-
459
- ```sh
460
- zinn task order MDR-2 top
461
- zinn task order MDR-2 up
462
- zinn task order MDR-2 down
463
- zinn task order MDR-2 bottom
464
- zinn task order MDR-2 before MDR-1
465
- zinn task order MDR-2 after MDR-1
466
- ```
467
-
468
- The task being reordered and the target of `before` or `after` must be active tasks in the same column.
469
-
470
- ## Archive and delete tasks
471
-
472
- Active tasks are shown by default. Archive one or more tasks to hide them from active lists, then list archived tasks or all tasks:
473
-
474
- ```sh
475
- zinn task archive MDR-1
476
- zinn task archive MDR-2 MDR-3
477
- zinn task list MDR --archived
478
- zinn task list MDR --all
479
- ```
480
-
481
- `--archived` and `--all` cannot be used together.
482
-
483
- Unarchiving puts a task at the bottom of its previous column:
484
-
485
- ```sh
486
- zinn task unarchive MDR-1
487
- zinn task unarchive MDR-2 MDR-3
488
- ```
489
-
490
- 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).
491
-
492
- 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)).
493
-
494
- 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.
495
-
496
- ## Task priority
497
-
498
- Priority is optional: `low`, `medium`, `high`, or `urgent`. Priority values, including `none`, are case-insensitive. Stored values and JSON use lowercase. New tasks have no assigned priority by default.
499
-
500
- ```sh
501
- zinn task create MDR --title 'Review the numbers' --priority high
502
- zinn task edit MDR-1 --priority urgent
503
- zinn task edit MDR-1 --priority none
504
- ```
505
-
506
- Use `none` to clear priority. Priority does not affect board ordering.
507
-
508
- ## Activity
509
-
510
- Zinn records changes to tasks, projects, columns, labels, relations, and comments, including who made them.
511
-
512
- Deleting a project records one project deletion rather than separate deletion activity for every cascaded row.
513
-
514
- ```sh
515
- zinn activity list
516
- zinn activity list --limit 10
517
- zinn activity list --task MDR-1
518
- zinn activity list --session conversation-id
519
- zinn activity list --session conversation-id --thread child-thread-id
520
- zinn activity view 019abcdf-1234-7
521
- ```
522
-
523
- `--limit` caps the newest matching events and must be a positive safe integer. Reorders and both affected-task events from relation changes are included.
524
-
525
- `--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.
526
-
527
- `--session` and `--thread` match the complete stored IDs exactly, including case and whitespace. All supplied filters must match, and `--limit` applies after filtering. Rows without the requested identity do not match. No matches return empty output, or `[]` with `--json`, and exit successfully. Session activity records committed changes.
528
-
529
- `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.
530
-
531
- `activity view` preserves full recorded text and line breaks, including unknown change fields.
532
-
533
- 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`, `actor_source`, `actor_session_id`, `actor_thread_id`, `actor_agent`, `actor_model`, `actor_effort`, `entity_type`, `entity_id`, `action`, and `changes` (parsed JSON or `null`). `actor_name` can be `null` for an unnamed agent. The six additional actor fields are `null` when absent, including on events recorded before schema version 2. Payloads and IDs are preserved in full, including after deletion.
534
-
535
- > [!WARNING]
536
- > 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`.
537
-
538
- When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
539
-
540
- Zinn recognizes Claude Code, Codex, OpenCode, Gemini CLI, Cline, Cursor, Copilot's coding agent, Crush, Amp, and any tool that sets `AI_AGENT`.
541
-
542
- It checks `AI_AGENT`, then `AGENT`, then tool markers, taking the first identifying value. You can declare a name through that tool's environment settings, for example `AI_AGENT=hermes`.
543
-
544
- With no marker, Zinn uses your git `user.name` and `user.email`, then your system username. `actor_source` records the deciding `env:<VARIABLE>`, `git-config` or `os-user`.
545
-
546
- Integrations can supply `ZINN_SESSION_ID` for the top-level conversation and `ZINN_THREAD_ID` for the execution thread running the command. When either is provided, Zinn uses that pair. Otherwise it uses the first available _native_ pair: `CLAUDE_CODE_SESSION_ID` with a `null` thread, then `CODEX_SESSION_ID` and `CODEX_THREAD_ID`, then OpenCode's `OPENCODE_SESSION_ID` as the thread with a `null` session. If a member is missing, it stays `null` because Zinn never combines pairs. Inherited IDs associate the command with their declared conversation or thread.
547
-
548
- `ZINN_AGENT`, `ZINN_MODEL` and `ZINN_EFFORT` declare the host agent name, running model and effort for the execution making the change. Zinn trims surrounding whitespace, treats blank declarations as _unset_ and preserves other text. These values are declarations rather than authenticated identities. New changes retain them in activity JSON and earlier events keep their recorded attribution.
549
-
550
- ## Back up the database
551
-
552
- It is recommended to save a copy of the database before installing a new version:
553
-
554
- ```sh
555
- zinn backup
556
- ```
557
-
558
- 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.
559
-
560
- ## Restore the database
561
-
562
- Restore the whole database from a backup saved by `zinn backup` or an upgrade:
563
-
564
- ```sh
565
- zinn restore ~/.zinn/backups/2026-09-29T12-30-05Z-cli-0.32.0-b38178c0.sqlite
566
- ```
567
-
568
- 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.
569
-
570
- 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.
571
-
572
- 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.
573
-
574
- If the database being replaced is damaged, restore leaves it unchanged and prints recovery steps.
575
-
576
- ## Upgrade the database
577
-
578
- 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`.
579
-
580
- 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:
581
-
582
- ```sh
583
- zinn migrate
584
- ```
585
-
586
- 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.
587
-
588
- 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.
589
-
590
- A database with a newer schema version than your Zinn can be read, but changes are refused. Use a newer Zinn to change it.
591
-
592
- ### Databases without a schema version
593
-
594
- 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:
595
-
596
- ```sh
597
- zinn task list MDR --allow-legacy-read
598
- ```
599
-
600
- 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.
601
-
602
- ## Scripting and JSON output
603
-
604
- Add `--json` to any command to get JSON instead of text. The flag can go anywhere in the command, except after `--`, where it is treated as a regular argument such as searching literally for `--json` in text.
605
-
606
- ```sh
607
- zinn task list MDR --json
608
- zinn task create MDR --title 'Refine the numbers' --json
609
- ```
610
-
611
- - Read commands print what they list or show. Write commands print the entity they created, changed, or deleted.
612
- - Output is a single JSON document on stdout. Empty lists print `[]`.
613
- - Handled errors go to stderr as one JSON document, stdout stays empty, and the command exits with code 1: `{ "error": { "code": "not_found", "message": "...", "details": { "entity": "task", "key": "MDR-999", "source": "explicit" } } }`.
614
- - `error.code` is `invalid_input` for invalid invocation or settings, `not_found` for an absent required entity or requested file, `conflict` for a request blocked by current state or database compatibility, `storage` for filesystem or SQLite operational failures, and `internal` for an unexpected failure.
615
- - Optional `error.details` carries known facts: `argument`, `field` (a string/number path), `entity`, `key`, `source` (`explicit` or `defaultProject`), `settingsPath`, `reason`, `matchCount`, `candidateIds`, `path`, `databasePath`, `backupDirectory`, `backupPath`, `schemaVersion`, `supportedSchemaVersion`, and `cause` (`message` and optional native `code`/`errcode`). Unknown facts are omitted.
616
- - Optional `error.help` retains usage guidance. Prior notices are collected in optional `error.diagnostics`, an array of strings. On success, notices print as text on stderr after the command completes. Text-mode notices print immediately. This includes lock waits; JSON commands report their wait only at completion.
617
-
618
- Check the exit status before parsing stdout for success or stderr for failure. Message, help and diagnostic wording is for people; scripts use the code and details. Signals, runtime loading failures and broken output channels are outside this handled-error contract.
619
-
620
- 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.
621
-
622
- `ZINN_DEBUG=1` prints routing details on stderr. Other values do nothing. Stdout, including `--json` output, is unchanged.
623
-
624
- ### Command discovery
625
-
626
- ```sh
627
- zinn capabilities --json
628
- ```
629
-
630
- `capabilities` describes the installed CLI without reading settings, opening a database, prompting, or using the network. It works with missing stores and invalid settings. Without `--json`, it prints a compact summary and the full-contract command.
631
-
632
- The JSON document contains `manifestVersion`, `cli` (package `name` and `version`), `invocation`, `commands`, `error`, and `schemas`. Commands follow route order and include capabilities itself. Each command has a token-array `path`, `summary`, `input`, `effects`, `confirmation`, and finite `results`.
633
-
634
- - `input.options` is keyed by option name. Each option declares its `type`; omitted `required` and `multiple` mean false. String values can carry named placeholders, choices, patterns and descriptions. Positional `forms` declare ordered names, minimum and maximum occurrences (`null` means no upper bound), and value facts. Choose the form that matches the supplied values. `constraints` describes mutual exclusion, requirements and requests needing at least one input. Optional `notes` explain resolver and domain behavior.
635
- - `invocation` describes router options, help/version precedence and literal values. Build argv from the command path, command options (`--name=value` for strings), `--json`, then `--` and the positional words. Repeat an option only when `multiple` is true. Tokens after `--` are literal words.
636
- - `results` selects a JSON success schema: `always`, `booleanOption` (an absent boolean is false), or `positionalCount` (inclusive bounds, counting supplied occurrences, including repeated keys). Each result declares its `mode`, `stream` and `exitCode`.
637
- - A descriptor's `schemaRef`, such as `#/schemas/definitions/TaskList`, resolves against the whole manifest. JSON Schema `$ref` values resolve against the extracted `schemas` document, which uses draft-07. All references are local. The finite `Capabilities` definition describes the manifest without embedding another manifest value.
638
- - `effects.domain` describes the domain operation. `effects.storage: "normal-open"` can create or upgrade storage under the normal open policy, including for reads. `"none"` performs no storage access. Administrative commands declare their own storage operation. `confirmation` describes the existing prompt and project-deletion rules; see [Confirmations](#confirmations).
639
-
640
- Check the process exit status before selecting a stream. Successful JSON goes to stdout, and notices may appear as text on stderr. A handled failure exits `1` and emits one error document on stderr, described by root `error.schemaRef`, with no success stdout.
641
-
642
- See [Scripting and JSON output](#scripting-and-json-output) for error codes, details and exceptions. Help remains text even with `--json`.
643
-
644
- For example, this Node.js consumer discovers task-list syntax and its result reference, then lists a project in the selected store:
645
-
646
- ```js
647
- import { spawnSync } from "node:child_process";
648
-
649
- function json(args) {
650
- const result = spawnSync("zinn", args, { encoding: "utf8" });
651
- if (result.error) {
652
- throw result.error;
653
- }
654
-
655
- if (result.status !== 0) {
656
- throw new Error(result.stderr);
657
- }
658
-
659
- return JSON.parse(result.stdout);
660
- }
661
-
662
- const manifest = json(["capabilities", "--json"]);
663
- const command = manifest.commands.find(({ path }) => path.join(" ") === "task list");
664
- const form = command.input.forms[0];
665
- const values = { "project-key": "APP" };
666
- const words = form.positionals.flatMap(({ name }) => (values[name] === undefined ? [] : [values[name]]));
667
- const tasks = json([...command.path, "--json", manifest.invocation.optionSeparator, ...words]);
668
- const result = command.results.find(({ selector }) => selector.kind === "always");
669
-
670
- console.log({ schemaRef: result.schemaRef, tasks });
671
- ```
672
-
673
- Use a JSON Schema validator with `manifest.schemas` to validate successful values against the selected definition. Task lists are arrays, including `[]`. Task details are objects. History selects a detail schema with a required `activity` array. Single and bulk mutations can select different schemas, so select the result before validating it.
674
-
675
- The CLI release version identifies the command contract. `manifestVersion: 1` identifies how to interpret descriptors and changes only when that interpretation becomes incompatible; it is separate from database and settings versions. Mutable `-dev` builds can change their contract without changing their version, so use the emitted content rather than the version alone as a cache key.
676
-
677
- ### Confirmations
678
-
679
- Project, task, label, and comment deletion ask for confirmation, as does restoring the database. Use `--yes` to skip the prompt:
680
-
681
- ```sh
682
- zinn task delete MDR-1 --yes
683
- zinn task delete MDR-1 --yes --json
684
- ```
685
-
686
- - With `--json`, `--yes` is **required**. Without it, the command exits with an error and changes nothing.
687
- - Project deletion also requires a typed project key to skip confirmation; a configured default always needs confirmation and cannot be deleted with `--json`.
688
- - 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`.
689
- - Declining the prompt in a terminal changes nothing and exits with code 0.
690
- - Confirmation prompts are written to stderr. Press Enter to decline; only `y` or `Y` confirms.
691
- - `task relation delete` never asks for confirmation and does not accept `--yes`.
692
-
693
- ## Help
694
-
695
- Use root or namespace help to discover commands, then open a command's help for its arguments and behavior:
18
+ Create a project and a task, then read the task:
696
19
 
697
20
  ```sh
698
- zinn --help
699
- zinn project --help
700
- zinn project column --help
701
- zinn task --help
702
- zinn task move --help
21
+ zinn project create APP --name 'My project'
22
+ zinn task create APP --title 'Ship the first feature'
23
+ zinn task list APP
24
+ zinn task view APP-1
703
25
  ```
704
26
 
705
- 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.
27
+ Run `zinn --help` to discover commands and `zinn <command> --help` to see usage. See the website's [Quick start](https://zinn.sh/docs/quick-start) for a guided workflow and the [CLI reference](https://zinn.sh/docs/cli) for command behavior.
706
28
 
707
- Running `zinn` without a command shows help. Use `zinn --version` (or `-v`) to print the CLI version.
29
+ For related topics, see [Settings](https://zinn.sh/docs/settings), [Scripting and JSON output](https://zinn.sh/docs/scripting), and [Data and backups](https://zinn.sh/docs/data).