trekoon 0.3.2 → 0.3.4

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,71 @@ 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 conflicts <list|show> [--mode pending|all]`
21
24
  - `trekoon skills install [--link --editor opencode|claude|pi] [--to <path>] [--allow-outside-repo]`
25
+ - `trekoon skills install -g|--global [--editor opencode|claude|pi]`
22
26
  - `trekoon skills update`
23
27
  - `trekoon wipe --yes`
24
28
 
25
- ## Global output modes
29
+ ## Global options
26
30
 
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
31
+ - `--json` structured JSON output
32
+ - `--toon` TOON-encoded output (preferred for agent loops)
33
+ - `--compact` strips contract metadata from TOON/JSON envelopes
34
+ - `--compat <mode>` explicit machine compatibility behavior
35
+ - `--help` root and command help
36
+ - `--version` CLI version
33
37
 
34
- Global options can be used before or after the command:
38
+ Global options work before or after the command:
35
39
 
36
40
  ```bash
37
41
  trekoon --toon quickstart
38
42
  trekoon quickstart --toon
39
- trekoon --json quickstart
40
- trekoon quickstart --json
41
43
  ```
42
44
 
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
45
+ Trekoon uses long-form flags for commands and subcommands. Root help and version
46
+ also accept `-h` and `-v`.
118
47
 
119
- Board API endpoints (all require token authentication):
48
+ ## Board commands
49
+
50
+ `trekoon board open` installs board assets (if needed), starts a loopback-only
51
+ server on `127.0.0.1` with a random port, opens the browser, and returns the
52
+ board URL plus a manual fallback URL.
53
+
54
+ `trekoon board update` refreshes board runtime assets without starting the
55
+ server or opening a browser. Use this when you need to update copied assets
56
+ before the next launch.
57
+
58
+ Security model:
59
+
60
+ - Every `board open` session gets a unique token
61
+ - Requests must include it as `Authorization: Bearer {token}`,
62
+ `x-trekoon-token` header, or `?token={token}` query parameter
63
+ - Invalid tokens return `401`
64
+ - Static responses use `cache-control: no-store`
120
65
 
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
66
+ The board is a self-hosted single-page app (vanilla JS, bundled CSS and fonts,
67
+ no framework or CDN dependencies) served from `.trekoon/board`. Works fully
68
+ offline once initialized.
130
69
 
131
- Token is sent as `Authorization: Bearer {token}` header or `x-trekoon-token`
132
- header or `?token={token}` query parameter. Invalid tokens return `401`.
70
+ Board API endpoints (all require token authentication):
71
+
72
+ | Method | Endpoint | Purpose |
73
+ | --- | --- | --- |
74
+ | `GET` | `/api/snapshot` | Full board state (epics, tasks, subtasks, deps, counts) |
75
+ | `PATCH` | `/api/epics/{id}` | Update epic title, description, or status |
76
+ | `PATCH` | `/api/tasks/{id}` | Update task title, description, status, or owner |
77
+ | `PATCH` | `/api/subtasks/{id}` | Update subtask title, description, status, or owner |
78
+ | `POST` | `/api/subtasks` | Create subtask (requires taskId, title) |
79
+ | `DELETE` | `/api/subtasks/{id}` | Delete subtask |
80
+ | `POST` | `/api/dependencies` | Add dependency edge (sourceId, dependsOnId) |
81
+ | `DELETE` | `/api/dependencies?sourceId=...&dependsOnId=...` | Remove dependency |
133
82
 
134
- Examples:
83
+ Board commands don't accept command-specific options yet. For tests and local
84
+ development, `TREKOON_BOARD_ASSET_ROOT` overrides the bundled asset source.
135
85
 
136
86
  ```bash
137
87
  trekoon init
@@ -142,14 +92,15 @@ trekoon board update
142
92
 
143
93
  ## Human views
144
94
 
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`.
95
+ List and show commands default to table output in human mode. Use
96
+ `--view compact` for pipe-friendly output.
97
+
98
+ - `epic list`, `task list`, `subtask list` support `--view table|compact`
99
+ - `epic show`, `task show` support `--view table|compact|tree|detail`
149
100
 
150
101
  ## List defaults and filters
151
102
 
152
- These defaults apply to `epic list`, `task list`, and `subtask list`:
103
+ These apply to `epic list`, `task list`, and `subtask list`:
153
104
 
154
105
  - Default scope: open work only (`in_progress`, `todo`)
155
106
  - Default limit: `10`
@@ -161,75 +112,51 @@ These defaults apply to `epic list`, `task list`, and `subtask list`:
161
112
 
162
113
  ## Update modes
163
114
 
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.
115
+ `epic update`, `task update`, and `subtask update` support two modes depending
116
+ on whether you pass a positional ID.
171
117
 
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.
118
+ ### Bulk mode (no positional ID)
174
119
 
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:
120
+ Target multiple rows directly with `--all` or `--ids`:
183
121
 
184
122
  ```bash
185
123
  trekoon task update --all --status in_progress
186
124
  trekoon task update --ids <task-1>,<task-2> --append "\nFollow-up note"
187
125
  trekoon subtask update --all --status done
188
- trekoon subtask update --ids <subtask-1>,<subtask-2> --append "\nFollow-up note"
189
126
  trekoon epic update --ids <epic-1>,<epic-2> --status done
190
127
  ```
191
128
 
192
- ### Descendant cascade mode
129
+ Rules:
193
130
 
194
- Use positional-ID `update <id> --all --status done|todo` when you want to close
195
- or reopen a whole tree from one root.
131
+ - `--all` and `--ids` are mutually exclusive
132
+ - Only `--append`, `--status`, or both are supported
133
+ - `--append` and `--description` are mutually exclusive
134
+ - Not one atomic transaction
196
135
 
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
136
+ ### Cascade mode (with positional ID)
211
137
 
212
- Examples:
138
+ Close or reopen a whole tree from one root:
213
139
 
214
140
  ```bash
215
141
  trekoon epic update <epic-id> --all --status done
216
142
  trekoon epic update <epic-id> --all --status todo
217
143
  trekoon task update <task-id> --all --status done
218
144
  trekoon task update <task-id> --all --status todo
219
- trekoon subtask update <subtask-id> --all --status done
220
145
  ```
221
146
 
222
- ## Status machine
147
+ Rules:
223
148
 
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.
149
+ - Updates the entity and all descendants atomically
150
+ - Only `--status done|todo` is supported
151
+ - Don't combine with `--ids`, `--append`, `--description`, or `--title`
152
+ - Unresolved external dependencies abort the whole update (`dependency_blocked`)
153
+ - Subtask cascade is accepted for consistency but just updates one subtask
154
+ - Success response includes `data.cascade` with changed/unchanged IDs and counts
227
155
 
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.
156
+ ## Status machine
231
157
 
232
- Valid transitions:
158
+ Statuses: `todo`, `in_progress`, `done`, `blocked`. The hyphenated `in-progress`
159
+ is no longer accepted.
233
160
 
234
161
  | From | Allowed targets |
235
162
  | --- | --- |
@@ -238,32 +165,32 @@ Valid transitions:
238
165
  | `blocked` | `in_progress`, `todo` |
239
166
  | `done` | `in_progress` |
240
167
 
241
- Invalid transitions return a `status_transition_invalid` error with the current
242
- status, target status, and allowed transitions.
168
+ Invalid transitions return `status_transition_invalid` with the current status,
169
+ target status, and allowed transitions.
170
+
171
+ **Upgrading from 0.3.0:** Entities with legacy statuses like `in-progress` can
172
+ transition to any valid status without error.
243
173
 
244
174
  ## Owner field
245
175
 
246
- Tasks and subtasks have an optional `owner` field. Set or clear it with the
247
- `--owner` flag on update commands:
176
+ Tasks and subtasks have an optional `owner` field:
248
177
 
249
178
  ```bash
250
179
  trekoon task update <task-id> --owner "agent-1"
251
180
  trekoon subtask update <subtask-id> --owner "agent-2"
252
181
  ```
253
182
 
254
- The board API also accepts `owner` on `PATCH /api/tasks/{id}` and
255
- `PATCH /api/subtasks/{id}`.
183
+ Also accepted on `PATCH /api/tasks/{id}` and `PATCH /api/subtasks/{id}`.
256
184
 
257
- ## Task done behavior
185
+ ## Task done
258
186
 
259
187
  `trekoon task done <task-id>` marks a task complete and returns the next ready
260
- candidate. Additional behavior:
188
+ candidate.
261
189
 
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`).
190
+ - Auto-transitions through `in_progress` when current status is `todo` or
191
+ `blocked`, emitting two sync events for the intermediate step
192
+ - Reports newly unblocked downstream tasks (`data.unblocked`)
193
+ - Warns about incomplete subtasks (`data.warning`, `data.openSubtaskCount`)
267
194
 
268
195
  ## Epic progress
269
196
 
@@ -272,7 +199,7 @@ trekoon epic progress <epic-id>
272
199
  ```
273
200
 
274
201
  Returns status counts (`total`, `doneCount`, `inProgressCount`, `blockedCount`,
275
- `todoCount`), `readyCount`, and `nextCandidate` for the given epic.
202
+ `todoCount`), `readyCount`, and `nextCandidate`.
276
203
 
277
204
  ## Session scoping
278
205
 
@@ -282,7 +209,7 @@ trekoon session --epic <epic-id>
282
209
 
283
210
  Scopes session readiness to a specific epic instead of the full tracker.
284
211
 
285
- ## Suggest command
212
+ ## Suggest
286
213
 
287
214
  ```bash
288
215
  trekoon suggest [--epic <epic-id>]
@@ -290,9 +217,52 @@ trekoon suggest [--epic <epic-id>]
290
217
 
291
218
  Returns up to 3 priority-ranked next-action suggestions based on recovery state,
292
219
  sync status, task readiness, and epic progress. Categories: `recovery`, `sync`,
293
- `execution`, `planning`. Each suggestion includes an `action`, `command`, and
220
+ `execution`, `planning`. Each suggestion includes `action`, `command`, and
294
221
  `reason`.
295
222
 
223
+ ## Sync commands
224
+
225
+ ### `sync status`
226
+
227
+ ```bash
228
+ trekoon --toon sync status [--from <branch>]
229
+ ```
230
+
231
+ Reports ahead/behind counts and pending conflicts against a source branch.
232
+ Defaults to `--from main`.
233
+
234
+ ### `sync pull`
235
+
236
+ ```bash
237
+ trekoon --toon sync pull --from <branch>
238
+ ```
239
+
240
+ Pulls tracker events from the source branch into the current worktree. Creates
241
+ conflicts when the same field was modified on both sides. `--from` is required.
242
+
243
+ ### `sync resolve`
244
+
245
+ ```bash
246
+ trekoon --toon sync resolve <conflict-id> --use ours|theirs [--dry-run]
247
+ ```
248
+
249
+ Resolves a pending conflict. `--use ours` keeps the current DB value.
250
+ `--use theirs` overwrites with the source-branch value.
251
+
252
+ - `--dry-run` previews the resolution without mutating the database
253
+ - In human mode, `--use theirs` shows a 30-second confirmation prompt (defaults
254
+ to rejection). Toon mode skips the prompt.
255
+
256
+ ### `sync conflicts`
257
+
258
+ ```bash
259
+ trekoon --toon sync conflicts list [--mode pending|all]
260
+ trekoon --toon sync conflicts show <conflict-id>
261
+ ```
262
+
263
+ `list` defaults to `--mode pending`. Use `--mode all` to include resolved
264
+ conflicts.
265
+
296
266
  ## Related docs
297
267
 
298
268
  - [Quickstart](quickstart.md)