@zinn-dev/cli 0.39.0 → 0.41.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 (113) hide show
  1. package/README.md +171 -40
  2. package/index.d.ts +2 -0
  3. package/index.js +34 -0
  4. package/package.json +27 -18
  5. package/skills/zinn/SKILL.md +63 -0
  6. package/src/actor.d.ts +7 -0
  7. package/src/actor.js +129 -0
  8. package/src/capabilities-schema.d.ts +163 -0
  9. package/src/capabilities-schema.js +124 -0
  10. package/src/capabilities.d.ts +21 -0
  11. package/src/capabilities.js +22 -0
  12. package/src/database.d.ts +6 -0
  13. package/src/database.js +27 -0
  14. package/src/errors.d.ts +158 -0
  15. package/src/errors.js +224 -0
  16. package/src/input.d.ts +116 -0
  17. package/src/input.js +119 -0
  18. package/src/lib.d.ts +66 -0
  19. package/src/lib.js +333 -0
  20. package/src/presentation/activity-presentation.d.ts +23 -0
  21. package/src/presentation/activity-presentation.js +403 -0
  22. package/src/presentation/color.d.ts +9 -0
  23. package/src/presentation/color.js +21 -0
  24. package/src/presentation/column-presentation.d.ts +14 -0
  25. package/src/presentation/column-presentation.js +29 -0
  26. package/src/presentation/description-presentation.d.ts +3 -0
  27. package/src/presentation/description-presentation.js +11 -0
  28. package/src/presentation/info-presentation.d.ts +4 -0
  29. package/src/presentation/info-presentation.js +96 -0
  30. package/src/presentation/row-layout.d.ts +22 -0
  31. package/src/presentation/row-layout.js +58 -0
  32. package/src/presentation/section.d.ts +4 -0
  33. package/src/presentation/section.js +9 -0
  34. package/src/presentation/task-presentation.d.ts +9 -0
  35. package/src/presentation/task-presentation.js +62 -0
  36. package/src/presentation/time.d.ts +1 -0
  37. package/src/presentation/time.js +13 -0
  38. package/src/project.d.ts +12 -0
  39. package/src/project.js +44 -0
  40. package/src/release-identity.d.ts +2 -0
  41. package/src/release-identity.js +1 -0
  42. package/src/result-schemas.d.ts +987 -0
  43. package/src/result-schemas.js +220 -0
  44. package/src/results.d.ts +23 -0
  45. package/src/results.js +17 -0
  46. package/src/routes/activity-router.d.ts +81 -0
  47. package/src/routes/activity-router.js +119 -0
  48. package/src/routes/backup-router.d.ts +21 -0
  49. package/src/routes/backup-router.js +30 -0
  50. package/src/routes/capabilities-router.d.ts +21 -0
  51. package/src/routes/capabilities-router.js +28 -0
  52. package/src/routes/comment-router.d.ts +203 -0
  53. package/src/routes/comment-router.js +241 -0
  54. package/src/routes/info-router.d.ts +21 -0
  55. package/src/routes/info-router.js +29 -0
  56. package/src/routes/label-router.d.ts +183 -0
  57. package/src/routes/label-router.js +218 -0
  58. package/src/routes/migrate-router.d.ts +21 -0
  59. package/src/routes/migrate-router.js +49 -0
  60. package/src/routes/project-router.d.ts +389 -0
  61. package/src/routes/project-router.js +514 -0
  62. package/src/routes/reindex-router.d.ts +21 -0
  63. package/src/routes/reindex-router.js +33 -0
  64. package/src/routes/relation-router.d.ts +124 -0
  65. package/src/routes/relation-router.js +223 -0
  66. package/src/routes/restore-router.d.ts +33 -0
  67. package/src/routes/restore-router.js +88 -0
  68. package/src/routes/router.d.ts +6 -0
  69. package/src/routes/router.js +204 -0
  70. package/src/routes/routes.d.ts +1735 -0
  71. package/src/routes/routes.js +23 -0
  72. package/src/routes/task-router.d.ts +945 -0
  73. package/src/routes/task-router.js +789 -0
  74. package/src/text-edit.d.ts +43 -0
  75. package/src/text-edit.js +57 -0
  76. package/src/types.d.ts +24 -0
  77. package/src/types.js +1 -0
  78. package/index.ts +0 -26
  79. package/release-stamp.json +0 -1
  80. package/src/actor.test.ts +0 -41
  81. package/src/actor.ts +0 -78
  82. package/src/database.test.ts +0 -70
  83. package/src/database.ts +0 -41
  84. package/src/lib.test.ts +0 -86
  85. package/src/lib.ts +0 -159
  86. package/src/presentation/activity-presentation.test.ts +0 -112
  87. package/src/presentation/activity-presentation.ts +0 -490
  88. package/src/presentation/color.ts +0 -29
  89. package/src/presentation/column-presentation.ts +0 -48
  90. package/src/presentation/description-presentation.ts +0 -18
  91. package/src/presentation/row-layout.ts +0 -77
  92. package/src/presentation/section.ts +0 -16
  93. package/src/presentation/task-presentation.ts +0 -92
  94. package/src/presentation/time.ts +0 -17
  95. package/src/project.test.ts +0 -479
  96. package/src/project.ts +0 -53
  97. package/src/routes/activity-router.ts +0 -81
  98. package/src/routes/backup-router.ts +0 -24
  99. package/src/routes/comment-router.ts +0 -171
  100. package/src/routes/label-router.ts +0 -168
  101. package/src/routes/migrate-router.test.ts +0 -31
  102. package/src/routes/migrate-router.ts +0 -48
  103. package/src/routes/project-router.ts +0 -415
  104. package/src/routes/reindex-router.ts +0 -27
  105. package/src/routes/relation-router.ts +0 -194
  106. package/src/routes/restore-router.test.ts +0 -44
  107. package/src/routes/restore-router.ts +0 -90
  108. package/src/routes/router.test.ts +0 -136
  109. package/src/routes/router.ts +0 -248
  110. package/src/routes/routes.ts +0 -20
  111. package/src/routes/task-router.ts +0 -649
  112. package/src/text-edit.ts +0 -68
  113. package/src/types.ts +0 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @zinn-dev/cli
2
2
 
3
- The `zinn` command-line interface. Requires [Bun](https://bun.sh).
3
+ The `zinn` command-line interface.
4
4
 
5
5
  > [!IMPORTANT]
6
6
  > **Experimental.** Commands, output, and the database schema will likely change often between releases until stable.
@@ -9,9 +9,11 @@ The `zinn` command-line interface. Requires [Bun](https://bun.sh).
9
9
  ## Install
10
10
 
11
11
  ```sh
12
- bun add --global @zinn-dev/cli
12
+ npm i -g @zinn-dev/cli
13
13
  ```
14
14
 
15
+ Requires [Node.js](https://nodejs.org/) 24.15.0 or newer.
16
+
15
17
  For a first project and task, see the [quick start](../../README.md#quick-start).
16
18
 
17
19
  Zinn stores projects and tasks in the shared local database at `~/.zinn/data/zinn.sqlite`.
@@ -40,7 +42,7 @@ The files are plain JSON, without comments:
40
42
  }
41
43
  ```
42
44
 
43
- `$schema` is optional and lets editors handle autocomplete and check the file, but Zinn itself ignores it. New settings are added to the same number; only a change that would make existing files invalid gets a new number. An unknown key, a value of the wrong type or invalid JSON in a selected settings file stops every command with an error that names the file. Zinn _does not fall back to the defaults_.
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_.
44
46
 
45
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.
46
48
 
@@ -50,6 +52,57 @@ Without a default, `task list` and `task search` cover every project, and the ot
50
52
 
51
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.
52
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
+
53
106
  ## Editing conventions
54
107
 
55
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.
@@ -58,14 +111,14 @@ Move, order, archive, unarchive, and task-label attachment commands also succeed
58
111
 
59
112
  Names and titles are trimmed and cannot be blank or contain line breaks or control characters, such as tabs.
60
113
 
61
- Project, task, and label descriptions may contain multiple lines. Omitted descriptions on creation, empty strings, and whitespace-only strings are stored as `null`. Text containing a non-whitespace character is preserved exactly, including leading and trailing whitespace. Use `--description ""` on an edit to clear a description. JSON returns the full text or `null`.
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`.
62
115
 
63
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:
64
117
 
65
118
  ```sh
66
- zinn task edit MDR-1 --description "Bring waffles." --append
67
- zinn task edit MDR-1 --description "new sentence" --replacing "old sentence"
68
- zinn project edit MDR --description "database" --replacing "board" --all
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
69
122
  ```
70
123
 
71
124
  Flags:
@@ -82,7 +135,7 @@ An empty text with `--replacing` deletes the match. `--append` and `--replacing`
82
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:
83
136
 
84
137
  ```sh
85
- zinn task edit MDR-1 --description="- Bring waffles." --append
138
+ zinn task edit MDR-1 --description='- Bring waffles.' --append
86
139
  ```
87
140
 
88
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:
@@ -134,7 +187,7 @@ Commands on the same machine can share a database on a local filesystem. Zinn wa
134
187
  Create a project with a key and optionally provide a name and description:
135
188
 
136
189
  ```sh
137
- zinn project create MDR --name "Macrodata Refinement" --description "Refine macrodata"
190
+ zinn project create MDR --name 'Macrodata Refinement' --description 'Refine macrodata'
138
191
  ```
139
192
 
140
193
  Project keys are stored in uppercase. An omitted name defaults to the key.
@@ -160,9 +213,9 @@ zinn project column list MDR
160
213
  Edit a project:
161
214
 
162
215
  ```sh
163
- zinn project edit MDR --name "Macrodata Refinement (Morning Shift)"
164
- zinn project edit MDR --description "Meet the quarterly quota"
165
- zinn project edit MDR --description ""
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 ''
166
219
  ```
167
220
 
168
221
  Provide `--name`, `--description`, or both.
@@ -172,13 +225,13 @@ See [Text values](#text-values) for values that begin with a dash and multi-line
172
225
  Add another column at the end of the board:
173
226
 
174
227
  ```sh
175
- zinn project column create MDR "Boardlog"
228
+ zinn project column create MDR Boardlog
176
229
  ```
177
230
 
178
231
  Rename a column:
179
232
 
180
233
  ```sh
181
- zinn project column edit MDR "In Progress" --name "Refining"
234
+ zinn project column edit MDR 'In Progress' --name Refining
182
235
  ```
183
236
 
184
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.
@@ -190,7 +243,7 @@ zinn project column order MDR Review first
190
243
  zinn project column order MDR Review previous
191
244
  zinn project column order MDR Review next
192
245
  zinn project column order MDR Review last
193
- zinn project column order MDR Review before "In Progress"
246
+ zinn project column order MDR Review before 'In Progress'
194
247
  zinn project column order MDR Review after Done
195
248
  ```
196
249
 
@@ -204,8 +257,8 @@ Moving a column to the position it already has, or before or after itself, does
204
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:
205
258
 
206
259
  ```sh
207
- zinn task create MDR --title "Refine 75% of the numbers"
208
- zinn task create MDR --title "Review the employee handbook" --description "Prepare for a 75% Dance Experience"
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'
209
262
  ```
210
263
 
211
264
  The project key can be omitted when [defaultProject](#settings-files) is configured.
@@ -213,7 +266,7 @@ The project key can be omitted when [defaultProject](#settings-files) is configu
213
266
  `--column <name>` starts the task at the bottom of a specific column. The column name matching is case insensitive:
214
267
 
215
268
  ```sh
216
- zinn task create MDR --title "Compile the Lexington letters" --column "In Progress"
269
+ zinn task create MDR --title 'Compile the Lexington letters' --column 'In Progress'
217
270
  ```
218
271
 
219
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:
@@ -223,7 +276,7 @@ zinn task list
223
276
  zinn task list MDR
224
277
  zinn task list --all-projects
225
278
  zinn task list MDR --label CLI --label Groom
226
- zinn task list MDR --column "In Progress"
279
+ zinn task list MDR --column 'In Progress'
227
280
  zinn task list --column Done --all
228
281
  zinn task view MDR-1
229
282
  zinn task view MDR-1 --history
@@ -250,7 +303,7 @@ Search task titles, descriptions, and comments, optionally in one project:
250
303
  ```sh
251
304
  zinn task search refine
252
305
  zinn task search refine --all-projects
253
- zinn task search "quarterly quota" MDR
306
+ zinn task search 'quarterly quota' MDR
254
307
  zinn task search MDR-1
255
308
  zinn task search auth --all --limit 5
256
309
  zinn task search auth MDR --label cli
@@ -264,7 +317,7 @@ If the whole query is an existing task key, such as `mdr-1`, that task comes fir
264
317
 
265
318
  An exact task-key query overrides the configured default project. A project key supplied after the query still filters the search.
266
319
 
267
- Search defaults to active tasks. `--archived` searches archived tasks and `--all` searches both. A note on stderr reports hidden archived matches. This is purely a convenience hint and it is _omitted_ from JSON. `--limit <n>` caps the results.
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.
268
321
 
269
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.
270
323
 
@@ -283,7 +336,7 @@ Only the index changes, completely or not at all, so no backup is saved. With `-
283
336
  Labels are global and reusable across projects.
284
337
 
285
338
  ```sh
286
- zinn label create urgent --color red --description "Needs attention soon"
339
+ zinn label create urgent --color red --description 'Needs attention soon'
287
340
  zinn label create review
288
341
  zinn label edit review --name ready --color green
289
342
  zinn label list
@@ -292,13 +345,13 @@ zinn label list
292
345
  ### Adding to tasks
293
346
 
294
347
  ```sh
295
- zinn task create MDR --title "Check the numbers" --label urgent --label review
348
+ zinn task create MDR --title 'Check the numbers' --label urgent --label review
296
349
  zinn task label add MDR-1 urgent review
297
350
  zinn task label remove MDR-1 review
298
351
  zinn task edit MDR-1 --add-label review --remove-label urgent
299
352
  ```
300
353
 
301
- Repeat `--label`, `--add-label`, or `--remove-label` for several labels. Each value is one name, so commas are part of the name. Quote names containing spaces: `--label "needs review"`.
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'`.
302
355
 
303
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.
304
357
 
@@ -330,6 +383,8 @@ zinn task relation list MDR-1
330
383
  Relations do not automatically move, complete, or archive tasks.
331
384
  Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
332
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
+
333
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.
334
389
 
335
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.
@@ -337,7 +392,7 @@ Remove the existing subtask relation before assigning a different parent. Moving
337
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:
338
393
 
339
394
  ```sh
340
- zinn task create MDR --title "Sort the files" --parent MDR-1 --depends-on MDR-2
395
+ zinn task create MDR --title 'Sort the files' --parent MDR-1 --depends-on MDR-2
341
396
  ```
342
397
 
343
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.
@@ -348,19 +403,22 @@ Relation deletion requires no confirmation.
348
403
  Add and list comments on a task:
349
404
 
350
405
  ```sh
351
- zinn task comment create MDR-1 --text "Ready for review"
406
+ zinn task comment create MDR-1 --text 'Ready for review'
352
407
  zinn task comment list MDR-1
353
408
  ```
354
409
 
355
410
  Comments receive keys per task like `MDR-1#1`.
356
411
 
357
- Edit or delete a comment using its key:
412
+ View, edit or delete a comment using its key:
358
413
 
359
414
  ```sh
360
- zinn task comment edit MDR-1#1 --text "Approved"
361
- zinn task comment delete MDR-1#1
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'
362
418
  ```
363
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
+
364
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.
365
423
 
366
424
  ## Edit tasks
@@ -368,9 +426,9 @@ Deletion asks for confirmation, unless `--yes` is used (see [Confirmations](#con
368
426
  Edit a task's title, description, priority, or labels:
369
427
 
370
428
  ```sh
371
- zinn task edit MDR-1 --title "Meet the quarterly refinement quota"
372
- zinn task edit MDR-1 --description "Complete refinement before the waffle party"
373
- zinn task edit MDR-1 --title "Meet the quarterly refinement quota" --description ""
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 ''
374
432
  ```
375
433
 
376
434
  See [Editing conventions](#editing-conventions) for title validation, partial edits and clearing descriptions.
@@ -383,7 +441,7 @@ See [Text values](#text-values) for values that begin with a dash and multi-line
383
441
  Move a task to another column in its project:
384
442
 
385
443
  ```sh
386
- zinn task move MDR-1 "In Progress"
444
+ zinn task move MDR-1 'In Progress'
387
445
  ```
388
446
 
389
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.
@@ -391,7 +449,7 @@ A moved task appears at the bottom of its destination column. Moving it to its c
391
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:
392
450
 
393
451
  ```sh
394
- zinn task move MDR-1 MDR-2 APP-4 "In Progress"
452
+ zinn task move MDR-1 MDR-2 APP-4 'In Progress'
395
453
  ```
396
454
 
397
455
  See [Changing tasks in bulk](#changing-tasks-in-bulk).
@@ -437,10 +495,10 @@ Deleting a task does not make its number available again within that project. De
437
495
 
438
496
  ## Task priority
439
497
 
440
- Priority is optional: `low`, `medium`, `high`, or `urgent`. New tasks have no assigned priority by default.
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.
441
499
 
442
500
  ```sh
443
- zinn task create MDR --title "Review the numbers" --priority high
501
+ zinn task create MDR --title 'Review the numbers' --priority high
444
502
  zinn task edit MDR-1 --priority urgent
445
503
  zinn task edit MDR-1 --priority none
446
504
  ```
@@ -457,6 +515,8 @@ Deleting a project records one project deletion rather than separate deletion ac
457
515
  zinn activity list
458
516
  zinn activity list --limit 10
459
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
460
520
  zinn activity view 019abcdf-1234-7
461
521
  ```
462
522
 
@@ -464,18 +524,28 @@ zinn activity view 019abcdf-1234-7
464
524
 
465
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.
466
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
+
467
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.
468
530
 
469
531
  `activity view` preserves full recorded text and line breaks, including unknown change fields.
470
532
 
471
- With `--json`, list returns an array and view returns one event object. Both include `id`, `created_at` (epoch milliseconds), `actor_name`, `actor_email`, `actor_kind`, `entity_type`, `entity_id`, `action`, and `changes` (parsed JSON or `null`). Payloads and IDs are preserved in full, including after deletion.
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.
472
534
 
473
535
  > [!WARNING]
474
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`.
475
537
 
476
538
  When a coding agent performs a mutation with `zinn`, the change is recorded under that agent's name.
477
539
 
478
- Zinn recognizes Claude Code, Codex, OpenCode, Gemini CLI, Cline, Cursor, Copilot's coding agent, Crush, Amp, and any tool that sets `AI_AGENT`. If you are using a tool that Zinn does not recognize, you can set `AI_AGENT` in that tool's environment settings, for example `AI_AGENT=hermes`. Otherwise, Zinn uses your git `user.name` and `user.email`, and if that's also not set, it falls to your system username.
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.
479
549
 
480
550
  ## Back up the database
481
551
 
@@ -535,15 +605,75 @@ Add `--json` to any command to get JSON instead of text. The flag can go anywher
535
605
 
536
606
  ```sh
537
607
  zinn task list MDR --json
538
- zinn task create MDR --title "Refine the numbers" --json
608
+ zinn task create MDR --title 'Refine the numbers' --json
539
609
  ```
540
610
 
541
611
  - Read commands print what they list or show. Write commands print the entity they created, changed, or deleted.
542
612
  - Output is a single JSON document on stdout. Empty lists print `[]`.
543
- - Errors go to stderr as `{ "error": { "message": "..." } }`, stdout stays empty, and the command exits with code 1. An error can also carry `"help"`: the command's usage line for a missing or extra word, or the namespace help for a missing command.
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.
544
619
 
545
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.
546
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
+
547
677
  ### Confirmations
548
678
 
549
679
  Project, task, label, and comment deletion ask for confirmation, as does restoring the database. Use `--yes` to skip the prompt:
@@ -557,6 +687,7 @@ zinn task delete MDR-1 --yes --json
557
687
  - Project deletion also requires a typed project key to skip confirmation; a configured default always needs confirmation and cannot be deleted with `--json`.
558
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`.
559
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.
560
691
  - `task relation delete` never asks for confirmation and does not accept `--yes`.
561
692
 
562
693
  ## Help
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import packageJson from "./package.json" with { type: "json" };
3
+ import { versionSpellings } from "./src/input.js";
4
+ const args = process.argv.slice(2);
5
+ const isVersionRequest = args.length === 1 && versionSpellings.includes(args[0]);
6
+ if (isVersionRequest) {
7
+ console.info(packageJson.version);
8
+ }
9
+ else {
10
+ const { isHelpFlag, prepareOutput, flushDiagnostics, renderFailure } = await import("./src/lib.js");
11
+ prepareOutput(args);
12
+ try {
13
+ const { createRouter } = await import("./src/routes/router.js");
14
+ const { routes } = await import("./src/routes/routes.js");
15
+ const router = createRouter(routes, async (command) => {
16
+ if (command.effects.storage === "none") {
17
+ return;
18
+ }
19
+ const { configureDatabase } = await import("@zinn-dev/core");
20
+ const { getCliOpenPolicy } = await import("./src/database.js");
21
+ configureDatabase(getCliOpenPolicy());
22
+ });
23
+ if (args.length === 0 || isHelpFlag(args[0])) {
24
+ console.info(router.help);
25
+ flushDiagnostics();
26
+ }
27
+ else {
28
+ await router.route(args);
29
+ }
30
+ }
31
+ catch (error) {
32
+ renderFailure(error);
33
+ }
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zinn-dev/cli",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "A kanban workflow in the terminal. Experimental.",
5
5
  "license": "MIT",
6
6
  "bugs": {
@@ -22,28 +22,37 @@
22
22
  "terminal",
23
23
  "bun"
24
24
  ],
25
- "module": "index.ts",
26
- "exports": {
27
- ".": {
28
- "types": "./index.ts",
29
- "import": "./index.ts"
30
- }
31
- },
32
25
  "files": [
33
- "index.ts",
34
- "src",
35
- "LICENSE",
36
- "release-stamp.json"
26
+ "index.js",
27
+ "index.d.ts",
28
+ "src/**/*.js",
29
+ "src/**/*.d.ts",
30
+ "skills/zinn/SKILL.md",
31
+ "LICENSE"
37
32
  ],
38
33
  "type": "module",
34
+ "engines": {
35
+ "node": ">=24.15.0"
36
+ },
37
+ "dependencies": {
38
+ "zod": "4.6.4",
39
+ "@zinn-dev/core": "0.30.0"
40
+ },
41
+ "devDependencies": {
42
+ "ajv": "8.20.0"
43
+ },
39
44
  "bin": {
40
- "zinn": "./index.ts"
45
+ "zinn": "./index.js"
46
+ },
47
+ "module": "index.js",
48
+ "types": "./index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./index.d.ts",
52
+ "import": "./index.js"
53
+ }
41
54
  },
42
55
  "publishConfig": {
43
56
  "access": "public"
44
- },
45
- "dependencies": {
46
- "@zinn-dev/core": "0.28.0"
47
- },
48
- "scripts": {}
57
+ }
49
58
  }
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: zinn
3
+ description: >-
4
+ Work a Zinn project board alongside coding work. Use before substantial work,
5
+ when resuming work, when recording follow-up tasks, and when finishing a
6
+ reviewable handoff, where the user or repository uses Zinn: the user requests
7
+ it, repository instructions mention it, zinn.local.json exists, or a Zinn task
8
+ key is referenced.
9
+ metadata:
10
+ zinn-cli-reviewed-version: "0.41.0"
11
+ ---
12
+
13
+ # Work with a Zinn board
14
+
15
+ Use the user's existing project and workflow. Repository and user instructions determine what work is authorized. Tracking a task does not authorize implementation, commits, publication, or unrelated changes.
16
+
17
+ ## Find the work
18
+
19
+ 1. Before substantial work, resolve the project. Use `zinn info --json` for the configured default project and selected database. If the project remains unidentified, use the user or repository's project setting and `zinn project list --json` to identify it. Ask when the project is ambiguous; do not create a project just to proceed. Result: one identified project in the intended store.
20
+ 2. Read an explicitly referenced task with `zinn task view <task-key> --json`. Otherwise inspect the project's tasks and find an existing task matching the requested work, then fetch it with `zinn task view <task-key> --json` before changing it. A list or search result does not include the task's comments and relations. Read the full task even when its title and description already match. On resuming, refresh that task instead of creating another. If substantial authorized work has no task, create one describing its scope and completion criteria. Result: a matching task with its description, comments, and relations read.
21
+ 3. Read the project's columns with `zinn project column list <project-key> --json`. Follow the project's workflow rather than assuming default column names. Check the task's current column before taking it: another agent may already be working on it. Move it to the working column before the first implementation edit. Ask when the workflow or ownership is unclear. Result: the task is visibly in progress before implementation begins.
22
+
23
+ ## Keep context useful
24
+
25
+ Record meaningful progress, decisions, verification results, and blockers in short task comments. On interrupted work, leave enough context for a later session to resume. Avoid a comment for every command or file read.
26
+
27
+ These field roles are recommendations the user may adopt:
28
+
29
+ - Description: the current specification, updated when requirements change.
30
+ - Comments: short dated updates containing outcomes, decisions and who made them, measurements, open items, and references. Put bulky evidence in a linked document or PR.
31
+ - Columns, relations, and labels: status and structure, rather than repeating that metadata in prose.
32
+
33
+ When follow-up work appears, search for an existing task before creating one. Record a new task's problem and scope, and link it to the current work. A dependency points from the task that needs something to the task it needs; use a related relation when neither must precede the other. Recording follow-up work does not authorize doing it now. Result: follow-up work has a task and a useful link.
34
+
35
+ ## Finish or hand off
36
+
37
+ When implementation and appropriate verification are complete, add a concise outcome comment with checks and any remaining limitations, move the task to the project's review column, and report its key with the reviewable result. Follow explicit user or repository completion rules when they differ. If work remains incomplete or blocked, record that state and the next step rather than moving it to review. Result: the board and final report agree about what is ready.
38
+
39
+ ## Use the installed CLI
40
+
41
+ Discover exact commands and flags with `zinn --help` and `zinn <command> --help`. Follow the installed help if it differs from this skill; the skill and CLI can be updated separately. Use `--json` when consuming results programmatically. Check command exit status: errors go to stderr, and empty stdout from a failed command is not an empty successful result.
42
+
43
+ If a command or option required by this skill is unavailable, or installed help or command results contradict these instructions, check both the CLI and this skill for drift. Do this once per session, and repeat only if either installation changes. Ordinary input, missing-item, permission, and database errors do not trigger this check.
44
+
45
+ Compare `zinn --version` with the latest published `@zinn-dev/cli` version in the npm registry, and compare the skill file loaded by this session with its installation source, respecting any pinned revision. The unpinned source is [Zinn's workflow skill](https://github.com/yethranayeh/zinn/blob/main/packages/cli/skills/zinn/SKILL.md). Use read-only metadata and file reads. A newer release or changed skill is evidence of a difference, not proof that it caused the problem. Report relevant differences or checks you could not complete. If the intended operation remains unclear, ask before proceeding. Update either installation only when authorized; after updating the skill, reload it or use a fresh session.
46
+
47
+ `ZINN_AGENT`, `ZINN_MODEL`, and `ZINN_EFFORT` can declare the agent, model, and effort of the execution making a change when automatic detection or host integration does not provide them. Use only known values; leave unknown values unset.
48
+
49
+ Checking and moving a task is not an atomic claim. Coordinate parallel work with the user or host; task coordination does not isolate a shared working tree.
50
+
51
+ For example, substitute the actual project, task, and observed column names:
52
+
53
+ ```sh
54
+ zinn --help
55
+ zinn info --json
56
+ zinn project list --json
57
+ zinn task list APP --json
58
+ zinn task view APP-1 --json
59
+ zinn project column list APP --json
60
+ zinn task move APP-1 'In Progress' --json
61
+ zinn task comment create APP-1 --text 'Implementation verified; ready for review.' --json
62
+ zinn task move APP-1 Review --json
63
+ ```
package/src/actor.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { Actor } from "@zinn-dev/core";
2
+ type Env = Record<string, string | undefined>;
3
+ /** Generic flags establish an unnamed agent only when no identifying marker follows. */
4
+ export declare function detectAgent(env: Env): Actor | null;
5
+ export declare function resolveActor(env: Env): Actor;
6
+ export declare function currentActor(): Actor;
7
+ export {};