trekoon 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/commands.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Command reference
2
2
 
3
- Use this page when you already know what Trekoon does and just need the command
4
- surface, defaults, and flag rules.
3
+ Flags, defaults, and behavior for every Trekoon command. If you're looking for
4
+ the quickest way to get started, read [Quickstart](quickstart.md) first.
5
5
 
6
6
  ## Command surface
7
7
 
@@ -17,121 +17,72 @@ surface, defaults, and flag rules.
17
17
  - `trekoon dep <add|add-many|remove|list|reverse>`
18
18
  - `trekoon events prune [--dry-run] [--archive] [--retention-days <n>]`
19
19
  - `trekoon migrate <status|rollback> [--to-version <n>]`
20
- - `trekoon sync <status|pull|resolve|conflicts>`
20
+ - `trekoon sync status [--from <branch>]`
21
+ - `trekoon sync pull --from <branch>`
22
+ - `trekoon sync resolve <conflict-id> --use ours|theirs [--dry-run]`
23
+ - `trekoon sync resolve --all --use ours|theirs [--entity <id>] [--field <name>] [--dry-run]`
24
+ - `trekoon sync conflicts <list|show> [--mode pending|all]`
21
25
  - `trekoon skills install [--link --editor opencode|claude|pi] [--to <path>] [--allow-outside-repo]`
26
+ - `trekoon skills install -g|--global [--editor opencode|claude|pi]`
22
27
  - `trekoon skills update`
23
28
  - `trekoon wipe --yes`
24
29
 
25
- ## Global output modes
30
+ ## Global options
26
31
 
27
- - `--json` for structured JSON output
28
- - `--toon` for true TOON-encoded output
29
- - `--compact` strips contract metadata from TOON/JSON envelopes
30
- - `--compat <mode>` for explicit machine compatibility behavior
31
- - `--help` for root and command help
32
- - `--version` for CLI version
32
+ - `--json` structured JSON output
33
+ - `--toon` TOON-encoded output (preferred for agent loops)
34
+ - `--compact` strips contract metadata from TOON/JSON envelopes
35
+ - `--compat <mode>` explicit machine compatibility behavior
36
+ - `--help` root and command help
37
+ - `--version` CLI version
33
38
 
34
- Global options can be used before or after the command:
39
+ Global options work before or after the command:
35
40
 
36
41
  ```bash
37
42
  trekoon --toon quickstart
38
43
  trekoon quickstart --toon
39
- trekoon --json quickstart
40
- trekoon quickstart --json
41
44
  ```
42
45
 
43
- Trekoon uses long-form options for command and subcommand flags. Root help and
44
- version aliases `-h` and `-v` are also supported.
45
-
46
- ## Board lifecycle commands
47
-
48
- Board terminology in docs matches `trekoon help board`:
49
-
50
- - `trekoon board open`
51
- - ensures board assets are installed in the repo-shared runtime directory
52
- - starts a local board server on `127.0.0.1`
53
- - launches the browser and returns the board URL, fallback URL, and launch
54
- metadata in machine output
55
- - `trekoon board update`
56
- - refreshes board runtime assets only
57
- - does not start the server or open a browser
58
-
59
- Operator guidance:
60
-
61
- - use `trekoon board open` as the normal one-command startup path
62
- - use `trekoon board update` when you specifically need to refresh copied assets
63
- before the next launch
64
-
65
- Board commands do not accept command-specific options yet. For tests and local
66
- development only, `TREKOON_BOARD_ASSET_ROOT` can override the bundled asset
67
- source used by `init`, `board open`, and `board update`.
68
-
69
- Runtime layout and security model:
70
-
71
- - `trekoon init` installs or refreshes the board runtime under `.trekoon/board`
72
- - `board open` serves those bundled files over a loopback-only server instead of
73
- opening a raw file directly
74
- - the server binds to `127.0.0.1` on a random port
75
- - every session gets a per-session token; browser/API requests must present that
76
- token
77
- - static responses use `cache-control: no-store`, and CLI output always includes
78
- a manual fallback URL
79
-
80
- Current shell/runtime notes:
81
-
82
- - the runtime copied into `.trekoon/board` includes the HTML shell, local app
83
- modules, and shared styles
84
- - all assets are self-hosted: the board ships its own CSS, fonts (Inter,
85
- Material Symbols), and vanilla JS with no framework or CDN dependencies
86
- - the board works fully offline once the runtime assets are copied into
87
- `.trekoon/board`
88
-
89
- Board UI architecture:
90
-
91
- - the board is a single-page application served from `.trekoon/board` using a
92
- zero-dependency vanilla JS component runtime with locally bundled CSS and fonts
93
- - the backend is a Bun HTTP server exposing a REST API at `/api/*` with
94
- token-based authentication; every mutation response includes an updated
95
- snapshot so the client always has fresh state
96
- - the frontend uses optimistic updates: the UI changes immediately on user
97
- action, then rolls back if the server rejects the mutation
98
-
99
- Board layout behavior:
100
-
101
- - the topbar is a compact flex-row navbar with workspace identity, Epics and
102
- Board navigation pills, a debounced search input, theme toggle, and a
103
- workspace info popover
104
- - the board toggles between an epics overview and a task workspace view; task
105
- detail opens as a modal overlay
106
- - responsive breakpoints adjust kanban column counts and component spacing
107
- - task cards show truncated descriptions; clicking anywhere on a card opens the
108
- task detail modal
109
-
110
- Scroll and overlay behavior:
111
-
112
- - the page scrolls naturally as a single document; there are no internal scroll
113
- containers trapping wheel events in the main content area
114
- - when a modal overlay opens (task detail, subtask editor), body scroll is
115
- locked and the modal surface becomes the scroll container
116
- - close overlays from the top down: subtask modal → task detail → broader board
117
- context; each close unlocks body scroll and returns to the previous context
46
+ Trekoon uses long-form flags for commands and subcommands. Root help and version
47
+ also accept `-h` and `-v`.
118
48
 
119
- Board API endpoints (all require token authentication):
49
+ ## Board commands
50
+
51
+ `trekoon board open` installs board assets (if needed), starts a loopback-only
52
+ server on `127.0.0.1` with a random port, opens the browser, and returns the
53
+ board URL plus a manual fallback URL.
54
+
55
+ `trekoon board update` refreshes board runtime assets without starting the
56
+ server or opening a browser. Use this when you need to update copied assets
57
+ before the next launch.
58
+
59
+ Security model:
60
+
61
+ - Every `board open` session gets a unique token
62
+ - Requests must include it as `Authorization: Bearer {token}`,
63
+ `x-trekoon-token` header, or `?token={token}` query parameter
64
+ - Invalid tokens return `401`
65
+ - Static responses use `cache-control: no-store`
120
66
 
121
- - `GET /api/snapshot` full board state (epics, tasks, subtasks, dependencies,
122
- counts)
123
- - `PATCH /api/epics/{id}` — update epic title, description, or status
124
- - `PATCH /api/tasks/{id}` — update task title, description, status, or owner
125
- - `PATCH /api/subtasks/{id}` — update subtask title, description, status, or owner
126
- - `POST /api/subtasks` — create subtask (requires taskId, title)
127
- - `DELETE /api/subtasks/{id}` — delete subtask
128
- - `POST /api/dependencies` — add dependency edge (sourceId, dependsOnId)
129
- - `DELETE /api/dependencies?sourceId=...&dependsOnId=...` — remove dependency
67
+ The board is a self-hosted single-page app (vanilla JS, bundled CSS and fonts,
68
+ no framework or CDN dependencies) served from `.trekoon/board`. Works fully
69
+ offline once initialized.
130
70
 
131
- Token is sent as `Authorization: Bearer {token}` header or `x-trekoon-token`
132
- header or `?token={token}` query parameter. Invalid tokens return `401`.
71
+ Board API endpoints (all require token authentication):
72
+
73
+ | Method | Endpoint | Purpose |
74
+ | --- | --- | --- |
75
+ | `GET` | `/api/snapshot` | Full board state (epics, tasks, subtasks, deps, counts) |
76
+ | `PATCH` | `/api/epics/{id}` | Update epic title, description, or status |
77
+ | `PATCH` | `/api/tasks/{id}` | Update task title, description, status, or owner |
78
+ | `PATCH` | `/api/subtasks/{id}` | Update subtask title, description, status, or owner |
79
+ | `POST` | `/api/subtasks` | Create subtask (requires taskId, title) |
80
+ | `DELETE` | `/api/subtasks/{id}` | Delete subtask |
81
+ | `POST` | `/api/dependencies` | Add dependency edge (sourceId, dependsOnId) |
82
+ | `DELETE` | `/api/dependencies?sourceId=...&dependsOnId=...` | Remove dependency |
133
83
 
134
- Examples:
84
+ Board commands don't accept command-specific options yet. For tests and local
85
+ development, `TREKOON_BOARD_ASSET_ROOT` overrides the bundled asset source.
135
86
 
136
87
  ```bash
137
88
  trekoon init
@@ -142,14 +93,15 @@ trekoon board update
142
93
 
143
94
  ## Human views
144
95
 
145
- - List and show commands default to table output in human mode.
146
- - Use `--view compact` to restore compact pipe output.
147
- - `epic list`, `task list`, and `subtask list` support `--view table|compact`.
148
- - `epic show` and `task show` support `--view table|compact|tree|detail`.
96
+ List and show commands default to table output in human mode. Use
97
+ `--view compact` for pipe-friendly output.
98
+
99
+ - `epic list`, `task list`, `subtask list` support `--view table|compact`
100
+ - `epic show`, `task show` support `--view table|compact|tree|detail`
149
101
 
150
102
  ## List defaults and filters
151
103
 
152
- These defaults apply to `epic list`, `task list`, and `subtask list`:
104
+ These apply to `epic list`, `task list`, and `subtask list`:
153
105
 
154
106
  - Default scope: open work only (`in_progress`, `todo`)
155
107
  - Default limit: `10`
@@ -161,75 +113,51 @@ These defaults apply to `epic list`, `task list`, and `subtask list`:
161
113
 
162
114
  ## Update modes
163
115
 
164
- `epic update`, `task update`, and `subtask update` now have two meanings for
165
- `--all`, depending on whether you also pass a positional ID.
166
-
167
- ### Repo-wide bulk mode
168
-
169
- Use `update --all` or `update --ids <csv>` when you want to target multiple
170
- top-level rows directly.
116
+ `epic update`, `task update`, and `subtask update` support two modes depending
117
+ on whether you pass a positional ID.
171
118
 
172
- This mode preserves the existing per-row update behavior. It is **not** the same
173
- as descendant cascade mode and is not one atomic multi-row transaction.
119
+ ### Bulk mode (no positional ID)
174
120
 
175
- - Target all rows: `--all`
176
- - Target specific rows: `--ids <id1,id2,...>`
177
- - Bulk mode supports only `--append <text>`, `--status <status>`, or both
178
- - In bulk mode, do not pass a positional ID
179
- - `--all` and `--ids` are mutually exclusive
180
- - `--append` and `--description` are mutually exclusive
181
-
182
- Examples:
121
+ Target multiple rows directly with `--all` or `--ids`:
183
122
 
184
123
  ```bash
185
124
  trekoon task update --all --status in_progress
186
125
  trekoon task update --ids <task-1>,<task-2> --append "\nFollow-up note"
187
126
  trekoon subtask update --all --status done
188
- trekoon subtask update --ids <subtask-1>,<subtask-2> --append "\nFollow-up note"
189
127
  trekoon epic update --ids <epic-1>,<epic-2> --status done
190
128
  ```
191
129
 
192
- ### Descendant cascade mode
130
+ Rules:
193
131
 
194
- Use positional-ID `update <id> --all --status done|todo` when you want to close
195
- or reopen a whole tree from one root.
132
+ - `--all` and `--ids` are mutually exclusive
133
+ - Only `--append`, `--status`, or both are supported
134
+ - `--append` and `--description` are mutually exclusive
135
+ - Not one atomic transaction
196
136
 
197
- - `trekoon epic update <epic-id> --all --status done|todo`
198
- - updates the epic and all descendant tasks/subtasks in one atomic operation
199
- - `trekoon task update <task-id> --all --status done|todo`
200
- - updates the task and all descendant subtasks in one atomic operation
201
- - `trekoon subtask update <subtask-id> --all --status done|todo`
202
- - accepts the same syntax for consistency, but behaves like a normal
203
- single-subtask status update because there are no descendants
204
- - Positional-ID cascade mode supports only `--status done|todo`
205
- - Do not combine positional ID + `--all` with `--ids`, `--append`,
206
- `--description`, or `--title`
207
- - For epic/task cascades, unresolved external dependencies abort the whole
208
- update with `dependency_blocked`; no partial writes are committed
209
- - Successful machine output includes `data.cascade` with the root, target
210
- status, atomic flag, changed IDs, unchanged IDs, and per-kind counts
137
+ ### Cascade mode (with positional ID)
211
138
 
212
- Examples:
139
+ Close or reopen a whole tree from one root:
213
140
 
214
141
  ```bash
215
142
  trekoon epic update <epic-id> --all --status done
216
143
  trekoon epic update <epic-id> --all --status todo
217
144
  trekoon task update <task-id> --all --status done
218
145
  trekoon task update <task-id> --all --status todo
219
- trekoon subtask update <subtask-id> --all --status done
220
146
  ```
221
147
 
222
- ## Status machine
148
+ Rules:
223
149
 
224
- Trekoon enforces a status machine for all entities. The canonical statuses are
225
- `todo`, `in_progress`, `done`, and `blocked`. The hyphenated `in-progress`
226
- variant is no longer accepted.
150
+ - Updates the entity and all descendants atomically
151
+ - Only `--status done|todo` is supported
152
+ - Don't combine with `--ids`, `--append`, `--description`, or `--title`
153
+ - Unresolved external dependencies abort the whole update (`dependency_blocked`)
154
+ - Subtask cascade is accepted for consistency but just updates one subtask
155
+ - Success response includes `data.cascade` with changed/unchanged IDs and counts
227
156
 
228
- **Upgrading from 0.3.0:** Existing entities with `in-progress` or other custom
229
- statuses are handled gracefully — transitions from non-canonical statuses to any
230
- valid status are allowed, so you can update them to `in_progress` without error.
157
+ ## Status machine
231
158
 
232
- Valid transitions:
159
+ Statuses: `todo`, `in_progress`, `done`, `blocked`. The hyphenated `in-progress`
160
+ is no longer accepted.
233
161
 
234
162
  | From | Allowed targets |
235
163
  | --- | --- |
@@ -238,32 +166,32 @@ Valid transitions:
238
166
  | `blocked` | `in_progress`, `todo` |
239
167
  | `done` | `in_progress` |
240
168
 
241
- Invalid transitions return a `status_transition_invalid` error with the current
242
- status, target status, and allowed transitions.
169
+ Invalid transitions return `status_transition_invalid` with the current status,
170
+ target status, and allowed transitions.
171
+
172
+ **Upgrading from 0.3.0:** Entities with legacy statuses like `in-progress` can
173
+ transition to any valid status without error.
243
174
 
244
175
  ## Owner field
245
176
 
246
- Tasks and subtasks have an optional `owner` field. Set or clear it with the
247
- `--owner` flag on update commands:
177
+ Tasks and subtasks have an optional `owner` field:
248
178
 
249
179
  ```bash
250
180
  trekoon task update <task-id> --owner "agent-1"
251
181
  trekoon subtask update <subtask-id> --owner "agent-2"
252
182
  ```
253
183
 
254
- The board API also accepts `owner` on `PATCH /api/tasks/{id}` and
255
- `PATCH /api/subtasks/{id}`.
184
+ Also accepted on `PATCH /api/tasks/{id}` and `PATCH /api/subtasks/{id}`.
256
185
 
257
- ## Task done behavior
186
+ ## Task done
258
187
 
259
188
  `trekoon task done <task-id>` marks a task complete and returns the next ready
260
- candidate. Additional behavior:
189
+ candidate.
261
190
 
262
- - Auto-transitions through `in_progress` when the current status is `todo` or
263
- `blocked`, emitting two sync events for the intermediate step.
264
- - Reports newly unblocked downstream tasks in the response (`data.unblocked`).
265
- - Warns when subtasks remain incomplete (`data.warning`,
266
- `data.openSubtaskCount`, `data.openSubtaskIds`).
191
+ - Auto-transitions through `in_progress` when current status is `todo` or
192
+ `blocked`, emitting two sync events for the intermediate step
193
+ - Reports newly unblocked downstream tasks (`data.unblocked`)
194
+ - Warns about incomplete subtasks (`data.warning`, `data.openSubtaskCount`)
267
195
 
268
196
  ## Epic progress
269
197
 
@@ -272,7 +200,7 @@ trekoon epic progress <epic-id>
272
200
  ```
273
201
 
274
202
  Returns status counts (`total`, `doneCount`, `inProgressCount`, `blockedCount`,
275
- `todoCount`), `readyCount`, and `nextCandidate` for the given epic.
203
+ `todoCount`), `readyCount`, and `nextCandidate`.
276
204
 
277
205
  ## Session scoping
278
206
 
@@ -282,7 +210,7 @@ trekoon session --epic <epic-id>
282
210
 
283
211
  Scopes session readiness to a specific epic instead of the full tracker.
284
212
 
285
- ## Suggest command
213
+ ## Suggest
286
214
 
287
215
  ```bash
288
216
  trekoon suggest [--epic <epic-id>]
@@ -290,9 +218,59 @@ trekoon suggest [--epic <epic-id>]
290
218
 
291
219
  Returns up to 3 priority-ranked next-action suggestions based on recovery state,
292
220
  sync status, task readiness, and epic progress. Categories: `recovery`, `sync`,
293
- `execution`, `planning`. Each suggestion includes an `action`, `command`, and
221
+ `execution`, `planning`. Each suggestion includes `action`, `command`, and
294
222
  `reason`.
295
223
 
224
+ ## Sync commands
225
+
226
+ ### `sync status`
227
+
228
+ ```bash
229
+ trekoon --toon sync status [--from <branch>]
230
+ ```
231
+
232
+ Reports ahead/behind counts and pending conflicts against a source branch.
233
+ Defaults to `--from main`.
234
+
235
+ ### `sync pull`
236
+
237
+ ```bash
238
+ trekoon --toon sync pull --from <branch>
239
+ ```
240
+
241
+ Pulls tracker events from the source branch into the current worktree. Creates
242
+ conflicts when the same field was modified on both sides. `--from` is required.
243
+
244
+ ### `sync resolve`
245
+
246
+ ```bash
247
+ trekoon --toon sync resolve <conflict-id> --use ours|theirs [--dry-run]
248
+ trekoon --toon sync resolve --all --use ours|theirs [--entity <id>] [--field <name>] [--dry-run]
249
+ ```
250
+
251
+ Resolves a pending conflict. `--use ours` keeps the current DB value.
252
+ `--use theirs` applies the source-branch value (or deletes the entity for
253
+ delete conflicts).
254
+
255
+ - `--dry-run` previews the resolution without mutating the database
256
+ - In human mode, `--use theirs` shows a 30-second confirmation prompt. Single-
257
+ conflict prompts include the field, current value, and incoming value.
258
+ - In human mode, batch `sync resolve --all --use theirs` shows a count-only
259
+ confirmation prompt (`Resolve N conflict(s) using ...? [y/N]`). `--use ours`
260
+ does not prompt. Toon mode skips all confirmation prompts.
261
+ - `--all` batch-resolves all pending conflicts. `--entity` and `--field` narrow
262
+ the batch. `--all` and a positional conflict ID are mutually exclusive.
263
+
264
+ ### `sync conflicts`
265
+
266
+ ```bash
267
+ trekoon --toon sync conflicts list [--mode pending|all]
268
+ trekoon --toon sync conflicts show <conflict-id>
269
+ ```
270
+
271
+ `list` defaults to `--mode pending`. Use `--mode all` to include resolved
272
+ conflicts.
273
+
296
274
  ## Related docs
297
275
 
298
276
  - [Quickstart](quickstart.md)