trekoon 0.4.1 → 0.4.2
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/.agents/skills/trekoon/SKILL.md +20 -577
- package/.agents/skills/trekoon/reference/execution-with-team.md +21 -9
- package/.agents/skills/trekoon/reference/execution.md +246 -7
- package/.agents/skills/trekoon/reference/planning.md +138 -1
- package/.agents/skills/trekoon/reference/status-machine.md +21 -0
- package/.agents/skills/trekoon/reference/sync.md +129 -0
- package/README.md +8 -1
- package/docs/ai-agents.md +17 -2
- package/docs/commands.md +147 -3
- package/docs/machine-contracts.md +123 -0
- package/docs/quickstart.md +52 -0
- package/package.json +1 -1
- package/src/board/assets/app.js +45 -13
- package/src/board/assets/components/Component.js +22 -8
- package/src/board/assets/components/Workspace.js +9 -3
- package/src/board/assets/components/helpers.js +4 -0
- package/src/board/assets/runtime/delegation.js +8 -0
- package/src/board/assets/runtime/focus-trap.js +48 -0
- package/src/board/assets/state/actions.js +42 -4
- package/src/board/assets/state/api.js +284 -11
- package/src/board/assets/state/store.js +79 -11
- package/src/board/assets/state/url.js +10 -0
- package/src/board/assets/state/utils.js +2 -1
- package/src/board/event-bus.ts +72 -0
- package/src/board/routes.ts +412 -33
- package/src/board/server.ts +77 -8
- package/src/board/wal-watcher.ts +302 -0
- package/src/commands/board.ts +52 -17
- package/src/commands/epic.ts +7 -9
- package/src/commands/error-utils.ts +54 -1
- package/src/commands/help.ts +69 -4
- package/src/commands/migrate.ts +153 -24
- package/src/commands/quickstart.ts +7 -0
- package/src/commands/subtask.ts +71 -10
- package/src/commands/suggest.ts +6 -13
- package/src/commands/task.ts +137 -88
- package/src/domain/batch-validation.ts +329 -0
- package/src/domain/cascade-planner.ts +412 -0
- package/src/domain/dependency-rules.ts +15 -0
- package/src/domain/mutation-service.ts +828 -192
- package/src/domain/search.ts +113 -0
- package/src/domain/tracker-domain.ts +150 -680
- package/src/domain/types.ts +53 -2
- package/src/index.ts +37 -0
- package/src/runtime/cli-shell.ts +44 -0
- package/src/runtime/daemon.ts +639 -0
- package/src/storage/backup.ts +166 -0
- package/src/storage/database.ts +261 -4
- package/src/storage/migrations.ts +422 -20
- package/src/storage/path.ts +8 -0
- package/src/storage/schema.ts +5 -1
- package/src/sync/event-writes.ts +38 -11
- package/src/sync/git-context.ts +226 -8
- package/src/sync/service.ts +650 -147
|
@@ -63,7 +63,7 @@ TaskCreate:
|
|
|
63
63
|
|
|
64
64
|
Before starting each task:
|
|
65
65
|
- claim and assign owner:
|
|
66
|
-
trekoon --toon task
|
|
66
|
+
trekoon --toon task claim <id> --owner <lane-name>
|
|
67
67
|
- append a short start note:
|
|
68
68
|
trekoon --toon task update <id> --append "Starting implementation"
|
|
69
69
|
|
|
@@ -110,6 +110,9 @@ Agent:
|
|
|
110
110
|
Use TaskUpdate to claim tasks (set owner to your name) and mark
|
|
111
111
|
them completed.
|
|
112
112
|
|
|
113
|
+
Before starting each Trekoon task, claim it in Trekoon:
|
|
114
|
+
trekoon --toon task claim <trekoon-task-id> --owner <your-name>
|
|
115
|
+
|
|
113
116
|
Status machine rules:
|
|
114
117
|
- todo -> in_progress -> done (valid)
|
|
115
118
|
- todo -> done (INVALID — use task done which auto-transitions)
|
|
@@ -160,14 +163,23 @@ Your job as team lead:
|
|
|
160
163
|
|
|
161
164
|
## Auto-recovery
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
Teammate attempts to fix failures. If can't fix, teammate reports failure with
|
|
167
|
+
error output via SendMessage; dispatch fix instructions in response.
|
|
168
|
+
|
|
169
|
+
**`status_transition_invalid`** — exact recovery sequence:
|
|
170
|
+
1. Run `trekoon --toon --compact task show <id>` to read the current status.
|
|
171
|
+
2. Append a blocker note: `trekoon --toon task update <id> --append "Blocked: status_transition_invalid from <attempted transition>; current status is <actual>"`.
|
|
172
|
+
3. Identify the valid intermediate transition (see `reference/status-machine.md`).
|
|
173
|
+
4. Apply the correct intermediate step, then retry the intended transition.
|
|
174
|
+
5. Only move on to the next task after the target task reaches the intended status or is explicitly marked `blocked`.
|
|
175
|
+
6. Report resolution via SendMessage.
|
|
176
|
+
|
|
177
|
+
**`dependency_blocked`** — exact recovery sequence:
|
|
178
|
+
1. Run `trekoon --toon --compact task show <id>` to identify which dependency is unmet.
|
|
179
|
+
2. Append a blocker note: `trekoon --toon task update <id> --append "Blocked: dependency_blocked; depends on <dep-id>"`.
|
|
180
|
+
3. Run `trekoon --toon task ready --epic <epic-id>` to get a ready candidate.
|
|
181
|
+
4. Only then continue with the ready candidate — do not retry the blocked task.
|
|
182
|
+
5. Notify team lead via SendMessage with blocker details.
|
|
171
183
|
|
|
172
184
|
## Verify and close
|
|
173
185
|
|
|
@@ -90,8 +90,8 @@ subtasks:
|
|
|
90
90
|
- Task <id>: <title>
|
|
91
91
|
|
|
92
92
|
Before starting each task:
|
|
93
|
-
-
|
|
94
|
-
trekoon --toon task
|
|
93
|
+
- claim and assign owner:
|
|
94
|
+
trekoon --toon task claim <id> --owner <lane-name>
|
|
95
95
|
- append a short start note:
|
|
96
96
|
trekoon --toon task update <id> --append "Starting implementation"
|
|
97
97
|
|
|
@@ -141,13 +141,19 @@ When a sub-agent calls `task done`, the response includes:
|
|
|
141
141
|
1. Agent attempts to fix failures (has context).
|
|
142
142
|
2. If can't fix, report failure with error output.
|
|
143
143
|
3. Dispatch fix agent with context.
|
|
144
|
-
4. Same error twice -> stop and ask user.
|
|
145
144
|
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
**`status_transition_invalid`** — exact recovery sequence:
|
|
146
|
+
1. Run `trekoon --toon --compact task show <id>` to read the current status.
|
|
147
|
+
2. Append a blocker note: `trekoon --toon task update <id> --append "Blocked: status_transition_invalid from <attempted transition>; current status is <actual>"`.
|
|
148
|
+
3. Identify the valid intermediate transition (see `reference/status-machine.md`).
|
|
149
|
+
4. Apply the correct intermediate step, then retry the intended transition.
|
|
150
|
+
5. Only move on to the next task after the target task reaches the intended status or is explicitly marked `blocked`.
|
|
148
151
|
|
|
149
|
-
|
|
150
|
-
`
|
|
152
|
+
**`dependency_blocked`** — exact recovery sequence:
|
|
153
|
+
1. Run `trekoon --toon --compact task show <id>` to identify which dependency is unmet.
|
|
154
|
+
2. Append a blocker note: `trekoon --toon task update <id> --append "Blocked: dependency_blocked; depends on <dep-id>"`.
|
|
155
|
+
3. Run `trekoon --toon task ready --epic <epic-id>` to get a ready candidate.
|
|
156
|
+
4. Only then continue with the ready candidate — do not retry the blocked task.
|
|
151
157
|
|
|
152
158
|
## Verify before closing
|
|
153
159
|
|
|
@@ -225,3 +231,236 @@ After verification is complete:
|
|
|
225
231
|
|
|
226
232
|
Changes should integrate cleanly with existing patterns. If a change fights the
|
|
227
233
|
architecture, refactor first rather than bolt on. The goal is zero tech debt.
|
|
234
|
+
|
|
235
|
+
## Single-agent execution loop
|
|
236
|
+
|
|
237
|
+
Use this loop when one agent should continue the work directly. The primary loop
|
|
238
|
+
is: **session → claim → work → task done → repeat**.
|
|
239
|
+
|
|
240
|
+
### 1. Orient with a single call
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
trekoon --toon session
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
If you already know which epic you are working on, scope the session:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
trekoon --toon session --epic <epic-id>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`session` returns diagnostics, sync status, the next ready task with subtrees,
|
|
253
|
+
blocker list, and readiness counts in one envelope. Use `--compact` to reduce
|
|
254
|
+
output size when you do not need contract metadata:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
trekoon --toon --compact session
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**After session returns, follow this decision tree in order:**
|
|
261
|
+
|
|
262
|
+
1. **`recoveryRequired` is true?** → Stop. Run `trekoon --toon init` and
|
|
263
|
+
re-check.
|
|
264
|
+
2. **`behind > 0`?** → Sync first: `trekoon --toon sync pull --from main`.
|
|
265
|
+
This pulls tracker events (not git commits) so task states are current.
|
|
266
|
+
3. **`pendingConflicts > 0`?** → Resolve before claiming work:
|
|
267
|
+
`trekoon --toon sync conflicts list`. For uniform conflicts, batch resolve:
|
|
268
|
+
`trekoon --toon sync resolve --all --use ours` (or `--use theirs`). For
|
|
269
|
+
mixed conflicts, inspect individually with `sync conflicts show <id>` and
|
|
270
|
+
resolve per-conflict. See `reference/sync.md` for full conflict guidance.
|
|
271
|
+
4. **Session returned a next task?** → Proceed to step 2 (claim work).
|
|
272
|
+
5. **No next task and unsure what to do?** → Run `trekoon --toon suggest` for
|
|
273
|
+
priority-ranked recommendations (see step 1b below).
|
|
274
|
+
|
|
275
|
+
### 1b. Get suggestions when stuck
|
|
276
|
+
|
|
277
|
+
When the session has no clear next task, or you are unsure what action to take:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
trekoon --toon suggest
|
|
281
|
+
trekoon --toon suggest --epic <epic-id>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`suggest` inspects recovery state, sync status, readiness, and epic progress,
|
|
285
|
+
then returns up to 3 suggestions ranked by priority. Each suggestion includes a
|
|
286
|
+
category (`recovery`, `sync`, `execution`, `planning`), a reason, and a
|
|
287
|
+
ready-to-run command you can execute directly.
|
|
288
|
+
|
|
289
|
+
Suggest respects the status machine — it will never recommend an invalid
|
|
290
|
+
transition. Use it:
|
|
291
|
+
- At session start when `readyCount` is 0 and you need guidance.
|
|
292
|
+
- Mid-loop when all tasks are blocked and you need to decide what to unblock.
|
|
293
|
+
- Before closing an epic to confirm the right next step.
|
|
294
|
+
|
|
295
|
+
### 1c. Check epic progress
|
|
296
|
+
|
|
297
|
+
When you need a quick dashboard before or during work on an epic:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
trekoon --toon epic progress <epic-id>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Returns done/in_progress/blocked/todo counts, ready task count, and the next
|
|
304
|
+
candidate. Use this:
|
|
305
|
+
- Before starting a work session to gauge how much remains.
|
|
306
|
+
- After completing several tasks to report progress to the user.
|
|
307
|
+
- To decide whether an epic is ready to be marked done.
|
|
308
|
+
|
|
309
|
+
### 2. Claim work explicitly
|
|
310
|
+
|
|
311
|
+
Once you know which task to work on, claim it atomically with `task claim`.
|
|
312
|
+
`--owner` is required:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
trekoon --toon task claim <task-id> --owner <name>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`task claim` sets `status=in_progress` and `owner=<name>` in a single
|
|
319
|
+
compare-and-swap. It succeeds only when the task is in `todo` or `blocked`
|
|
320
|
+
and is not already claimed by a different owner.
|
|
321
|
+
|
|
322
|
+
For other (non-claim) status transitions such as moving to `blocked`, use
|
|
323
|
+
`task update --status`:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
trekoon --toon task update <task-id> --status blocked
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
To update ownership separately (e.g. reassign without claiming):
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
trekoon --toon task update <task-id> --owner alice
|
|
333
|
+
trekoon --toon subtask update <subtask-id> --owner bob
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 3. Work on the task
|
|
337
|
+
|
|
338
|
+
While working, append progress notes:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
trekoon --toon task update <task-id> --append "Started implementation"
|
|
342
|
+
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### 3b. Work on subtasks explicitly when they matter
|
|
346
|
+
|
|
347
|
+
Use the same status discipline for subtasks when a task depends on concrete
|
|
348
|
+
subtask progress:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
trekoon --toon subtask claim <subtask-id> --owner <name>
|
|
352
|
+
trekoon --toon subtask update <subtask-id> --append "Implemented parser branch"
|
|
353
|
+
trekoon --toon subtask update <subtask-id> --append "Verified with fixture set" --status done
|
|
354
|
+
trekoon --toon subtask update <subtask-id> --append "Blocked by <reason>" --status blocked
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Use subtasks for real execution units, not filler. If a task has open subtasks
|
|
358
|
+
when `task done` is called, treat the warning as a prompt to consciously decide
|
|
359
|
+
whether the task is genuinely complete.
|
|
360
|
+
|
|
361
|
+
### 4. Finish or report a block
|
|
362
|
+
|
|
363
|
+
When done, append a completion note then mark done:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
trekoon --toon task update <task-id> --append "Completed implementation and checks"
|
|
367
|
+
trekoon --toon task done <task-id>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
`task done` works from any non-done status (`todo`, `in_progress`, `blocked`).
|
|
371
|
+
It auto-transitions through `in_progress` when needed. The response includes:
|
|
372
|
+
|
|
373
|
+
- **Next candidate**: the next ready task with its full tree and blockers.
|
|
374
|
+
- **Unblocked tasks**: downstream tasks that became ready after this completion.
|
|
375
|
+
Use this to decide what to claim next or to launch parallel work.
|
|
376
|
+
- **Open subtask warning**: if subtasks remain incomplete (completion still
|
|
377
|
+
proceeds, but the warning is surfaced so you can decide whether to go back).
|
|
378
|
+
|
|
379
|
+
If blocked instead of done:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### 5. Repeat
|
|
386
|
+
|
|
387
|
+
After `task done`, the returned next-task envelope is sufficient to continue
|
|
388
|
+
the loop from step 2. A fresh `session` call is not required mid-loop unless
|
|
389
|
+
you need updated diagnostics, sync status, or want to switch epics.
|
|
390
|
+
|
|
391
|
+
Run `session` again at the start of each new conversation session.
|
|
392
|
+
|
|
393
|
+
**When to use each command during the loop:**
|
|
394
|
+
|
|
395
|
+
| Situation | Command |
|
|
396
|
+
|---|---|
|
|
397
|
+
| Start of session | `session` or `session --epic <id>` |
|
|
398
|
+
| Unsure what to do next | `suggest` or `suggest --epic <id>` |
|
|
399
|
+
| Quick progress check | `epic progress <epic-id>` |
|
|
400
|
+
| Claim a task | `task claim <id> --owner <name>` |
|
|
401
|
+
| Assign ownership | `task update <id> --owner <name>` |
|
|
402
|
+
| Log progress | `task update <id> --append "..."` |
|
|
403
|
+
| Mark done | `task done <id>` |
|
|
404
|
+
| Report blocker | `task update <id> --append "..." --status blocked` |
|
|
405
|
+
| Reduce output noise | Add `--compact` to any command |
|
|
406
|
+
|
|
407
|
+
## Update policy: prefer append-based progress logging
|
|
408
|
+
|
|
409
|
+
Use descriptions as the durable work log. For progress updates, append instead
|
|
410
|
+
of rewriting full descriptions.
|
|
411
|
+
|
|
412
|
+
Status transitions must follow the status machine. Use `in_progress` as the
|
|
413
|
+
intermediate step to reach `done`. Direct `todo → done` is invalid via
|
|
414
|
+
`task update`; use `task done` instead, which auto-transitions.
|
|
415
|
+
|
|
416
|
+
### Preferred patterns
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
trekoon --toon task claim <task-id> --owner <name>
|
|
420
|
+
trekoon --toon task update <task-id> --append "Started implementation"
|
|
421
|
+
trekoon --toon task update <task-id> --append "Completed implementation and checks"
|
|
422
|
+
trekoon --toon task done <task-id>
|
|
423
|
+
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
424
|
+
trekoon --toon task update <task-id> --owner alice
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Bulk update rules
|
|
428
|
+
|
|
429
|
+
- Bulk update is available for `epic update`, `task update`, and
|
|
430
|
+
`subtask update`.
|
|
431
|
+
- Bulk mode uses `--ids <csv>` or `--all`.
|
|
432
|
+
- Bulk mode supports only `--append` and/or `--status`.
|
|
433
|
+
- Do not pass a positional ID in bulk mode.
|
|
434
|
+
- `--append` and `--description` are mutually exclusive.
|
|
435
|
+
- Prefer `--ids` for narrow, explicit updates.
|
|
436
|
+
- Use `--all` only for clear maintenance sweeps or when the user explicitly wants
|
|
437
|
+
a broad update.
|
|
438
|
+
|
|
439
|
+
Examples:
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
trekoon --toon task update --ids id1,id2 --append "Waiting on release" --status blocked
|
|
443
|
+
trekoon --toon epic update --ids epic1,epic2 --append "Sprint planning refreshed" --status in_progress
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Read policy: use the smallest sufficient read
|
|
447
|
+
|
|
448
|
+
Use the narrowest command that answers the question.
|
|
449
|
+
|
|
450
|
+
| Need | Preferred command |
|
|
451
|
+
|---|---|
|
|
452
|
+
| Session startup (diagnostics + sync + next task) | `trekoon --toon session` |
|
|
453
|
+
| Session scoped to one epic | `trekoon --toon session --epic <epic-id>` |
|
|
454
|
+
| Next-action suggestions | `trekoon --toon suggest` |
|
|
455
|
+
| Epic progress dashboard | `trekoon --toon epic progress <epic-id>` |
|
|
456
|
+
| Next task only | `trekoon --toon task next` |
|
|
457
|
+
| A few ready options | `trekoon --toon task ready --limit 5` |
|
|
458
|
+
| Direct blockers for one task | `trekoon --toon dep list <task-id>` |
|
|
459
|
+
| What this item unblocks | `trekoon --toon dep reverse <task-or-subtask-id>` |
|
|
460
|
+
| One full task payload | `trekoon --toon task show <task-id> --all` |
|
|
461
|
+
| One full epic tree | `trekoon --toon epic show <epic-id> --all` |
|
|
462
|
+
| Repeated text in one scope | `trekoon --toon epic\|task\|subtask search ...` |
|
|
463
|
+
|
|
464
|
+
Avoid broad scans such as `task list --all` or `epic show --all` when
|
|
465
|
+
`task next`, `task ready`, `dep list`, `dep reverse`, `suggest`, or `search`
|
|
466
|
+
can answer the question more cheaply.
|
|
@@ -58,7 +58,8 @@ creating the graph.
|
|
|
58
58
|
- **Dependency edge** = strict prerequisite only (do not add "nice to have"
|
|
59
59
|
dependencies).
|
|
60
60
|
|
|
61
|
-
All entities start in `todo`. See
|
|
61
|
+
All entities start in `todo`. See `reference/status-machine.md` for the
|
|
62
|
+
canonical transition table.
|
|
62
63
|
|
|
63
64
|
Plan implications:
|
|
64
65
|
- Never set initial status to anything other than `todo` in create commands.
|
|
@@ -290,3 +291,139 @@ in task descriptions:
|
|
|
290
291
|
|
|
291
292
|
For large scope, create multiple epics with explicit cross-epic boundaries. Use
|
|
292
293
|
dependencies within each epic DAG and keep each epic executable in bounded time.
|
|
294
|
+
|
|
295
|
+
## Creation policy: prefer bulk planning workflows
|
|
296
|
+
|
|
297
|
+
When creating multiple related records, do not loop through repeated single-item
|
|
298
|
+
creates unless only one record is needed.
|
|
299
|
+
|
|
300
|
+
### Which command to use
|
|
301
|
+
|
|
302
|
+
| Situation | Preferred command |
|
|
303
|
+
|---|---|
|
|
304
|
+
| New epic and full graph already known | `trekoon --toon epic create ... --task ... --subtask ... --dep ...` |
|
|
305
|
+
| Existing epic needs linked additions | `trekoon --toon epic expand <epic-id> ...` |
|
|
306
|
+
| Multiple sibling tasks under one epic | `trekoon --toon task create-many --epic <epic-id> --task ...` |
|
|
307
|
+
| Multiple sibling subtasks under one task | `trekoon --toon subtask create-many <task-id> --subtask ...` |
|
|
308
|
+
| Multiple dependency edges across existing IDs | `trekoon --toon dep add-many --dep ...` |
|
|
309
|
+
| One record only | `epic create`, `task create`, or `subtask create` |
|
|
310
|
+
|
|
311
|
+
### Compact spec escaping rules
|
|
312
|
+
|
|
313
|
+
Compact specs (pipe-delimited `--task`, `--subtask`, `--dep` values) use `\` as
|
|
314
|
+
the escape character. Only these sequences are valid:
|
|
315
|
+
|
|
316
|
+
| Sequence | Produces |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `\|` | literal `\|` (not a field separator) |
|
|
319
|
+
| `\\` | literal `\` |
|
|
320
|
+
| `\n` | newline |
|
|
321
|
+
| `\r` | carriage return |
|
|
322
|
+
| `\t` | tab |
|
|
323
|
+
|
|
324
|
+
Any other `\X` combination (e.g., `\!`, `\=`, `\$`) is rejected with
|
|
325
|
+
`Invalid escape sequence`. To avoid accidental escapes:
|
|
326
|
+
|
|
327
|
+
- Do not use `!=` or similar operators in description text; rephrase instead
|
|
328
|
+
(e.g., "null does not equal sourceBranch" instead of "null !== sourceBranch").
|
|
329
|
+
- If a literal backslash is needed, double it: `\\`.
|
|
330
|
+
- When using shell line continuations (`\` at end of line), ensure the next
|
|
331
|
+
line's first character is not one that forms an invalid escape with `\`.
|
|
332
|
+
|
|
333
|
+
### Critical temp-key rule
|
|
334
|
+
|
|
335
|
+
- Use plain temp keys when declaring records in compact specs, for example
|
|
336
|
+
`task-api` or `sub-tests`.
|
|
337
|
+
- Refer to those records later in the same invocation as `@task-api` or
|
|
338
|
+
`@sub-tests`.
|
|
339
|
+
- `@temp-key` references work in same-invocation graph workflows such as
|
|
340
|
+
one-shot `epic create` and `epic expand`.
|
|
341
|
+
- `dep add-many` does **not** resolve temp keys from earlier commands. Use real
|
|
342
|
+
persisted IDs there.
|
|
343
|
+
|
|
344
|
+
### Compact examples
|
|
345
|
+
|
|
346
|
+
#### One-shot epic creation
|
|
347
|
+
|
|
348
|
+
Use this when the epic does not exist yet and you already know the tree.
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
trekoon --toon epic create \
|
|
352
|
+
--title "Batch command rollout" \
|
|
353
|
+
--description "Ship linked planning in one transaction" \
|
|
354
|
+
--task "task-api|Design API|Define compact grammar|todo" \
|
|
355
|
+
--task "task-cli|Wire CLI|Hook parser and output|todo" \
|
|
356
|
+
--subtask "@task-api|sub-tests|Write tests|Cover parser cases|todo" \
|
|
357
|
+
--dep "@task-cli|@task-api"
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### Expand an existing epic
|
|
361
|
+
|
|
362
|
+
Use this when the epic already exists and the new batch needs internal links.
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
trekoon --toon epic expand <epic-id> \
|
|
366
|
+
--task "task-docs|Document workflow|Write operator guide|todo" \
|
|
367
|
+
--subtask "@task-docs|sub-examples|Add examples|Show canonical flows|todo" \
|
|
368
|
+
--dep "@sub-examples|@task-docs"
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Create sibling tasks or subtasks
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
trekoon --toon task create-many --epic <epic-id> \
|
|
375
|
+
--task "seed-api|Design API|Define grammar|todo" \
|
|
376
|
+
--task "seed-cli|Wire CLI|Hook output|todo"
|
|
377
|
+
|
|
378
|
+
trekoon --toon subtask create-many <task-id> \
|
|
379
|
+
--subtask "seed-tests|Write tests|Cover happy path|todo" \
|
|
380
|
+
--subtask "seed-docs|Document flow|Add notes|todo"
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
#### Add dependencies after records already exist
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
trekoon --toon dep add-many \
|
|
387
|
+
--dep "<task-b>|<task-a>" \
|
|
388
|
+
--dep "<subtask-c>|<task-b>"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Search and replace policy
|
|
392
|
+
|
|
393
|
+
Use scoped search before manual tree reads when you need to locate repeated
|
|
394
|
+
paths, labels, owners, or migration targets.
|
|
395
|
+
|
|
396
|
+
### Scope choice
|
|
397
|
+
|
|
398
|
+
Prefer the narrowest valid root:
|
|
399
|
+
|
|
400
|
+
1. `subtask search` or `subtask replace`
|
|
401
|
+
2. `task search` or `task replace`
|
|
402
|
+
3. `epic search` or `epic replace`
|
|
403
|
+
|
|
404
|
+
Scope behavior:
|
|
405
|
+
|
|
406
|
+
- `subtask` scope scans only that subtask.
|
|
407
|
+
- `task` scope scans the task plus descendant subtasks.
|
|
408
|
+
- `epic` scope scans the epic plus descendant tasks and subtasks.
|
|
409
|
+
|
|
410
|
+
### Safe replace workflow
|
|
411
|
+
|
|
412
|
+
1. Search first.
|
|
413
|
+
2. Preview replace.
|
|
414
|
+
3. Apply only after preview matches the intended scope.
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
trekoon --toon epic search <epic-id> "path/to/somewhere"
|
|
418
|
+
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path"
|
|
419
|
+
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path" --apply
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Guardrails:
|
|
423
|
+
|
|
424
|
+
- Use literal, explicit search text.
|
|
425
|
+
- Narrow fields when useful: `--fields title`, `--fields description`, or
|
|
426
|
+
`--fields title,description`.
|
|
427
|
+
- Do not jump straight to `--apply`.
|
|
428
|
+
- Prefer scoped search/replace over manually reading a whole tree and editing
|
|
429
|
+
many records one by one.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Status Machine Reference
|
|
2
|
+
|
|
3
|
+
Trekoon enforces a status transition graph. Only these transitions are valid:
|
|
4
|
+
|
|
5
|
+
| From | Allowed targets |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `todo` | `in_progress`, `blocked` |
|
|
8
|
+
| `in_progress` | `done`, `blocked` |
|
|
9
|
+
| `blocked` | `in_progress`, `todo` |
|
|
10
|
+
| `done` | `in_progress` |
|
|
11
|
+
|
|
12
|
+
Invalid transitions (e.g. `todo → done`) return error code
|
|
13
|
+
`status_transition_invalid`. Always transition through `in_progress` to reach
|
|
14
|
+
`done`.
|
|
15
|
+
|
|
16
|
+
**Exception:** `task done` auto-transitions through `in_progress` when the task
|
|
17
|
+
is in `todo` or `blocked` status, so you can call `task done` from any
|
|
18
|
+
non-done status.
|
|
19
|
+
|
|
20
|
+
Recommended statuses for consistent workflows: `todo`, `in_progress`, `done`.
|
|
21
|
+
Use `blocked` with an appended reason when work is stuck.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Sync Reference
|
|
2
|
+
|
|
3
|
+
## Sync reminders
|
|
4
|
+
|
|
5
|
+
Same-branch sync is a no-op: `sync pull --from main` while on `main` produces
|
|
6
|
+
zero conflicts and simply advances the cursor. `sync status` returns `behind=0`
|
|
7
|
+
on the source branch. No action is needed.
|
|
8
|
+
|
|
9
|
+
Cross-branch sync matters before merging a feature branch back:
|
|
10
|
+
|
|
11
|
+
- Before merge, pull tracker events from the base branch:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
trekoon --toon sync pull --from main
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- If conflicts exist, inspect and resolve them explicitly:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
trekoon --toon sync conflicts list
|
|
21
|
+
trekoon --toon sync conflicts show <conflict-id>
|
|
22
|
+
trekoon --toon sync resolve <conflict-id> --use theirs --dry-run
|
|
23
|
+
trekoon --toon sync resolve <conflict-id> --use ours
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Conflict resolution: ours vs theirs
|
|
27
|
+
|
|
28
|
+
Conflicts are **field-level**, not whole-record. Each conflict targets one field
|
|
29
|
+
(e.g., `status`, `title`, `description`) on one entity.
|
|
30
|
+
|
|
31
|
+
- `--use ours` — keep the current entity field value in the shared DB. The
|
|
32
|
+
entity is not written, but the conflict record is marked resolved and a
|
|
33
|
+
resolution event is appended.
|
|
34
|
+
- `--use theirs` — overwrite the shared DB entity field with the source-branch
|
|
35
|
+
value. The conflict record is marked resolved and a resolution event is
|
|
36
|
+
appended.
|
|
37
|
+
- `--dry-run` — preview the resolution without mutating the database. Returns
|
|
38
|
+
`oursValue`, `theirsValue`, `wouldWrite`, and `dryRun: true`. Use this before
|
|
39
|
+
committing to a resolution.
|
|
40
|
+
|
|
41
|
+
**Example:** after `sync pull --from main`, a conflict appears on epic `abc123`,
|
|
42
|
+
field `status`:
|
|
43
|
+
- ours (current DB): `in_progress`
|
|
44
|
+
- theirs (source branch): `done`
|
|
45
|
+
- `--use ours` keeps status as `in_progress`
|
|
46
|
+
- `--use theirs` changes status to `done` in the live shared DB
|
|
47
|
+
|
|
48
|
+
Always inspect conflicts with `sync conflicts show` before resolving. Choosing
|
|
49
|
+
`theirs` without inspection can overwrite in-progress work in the shared DB.
|
|
50
|
+
|
|
51
|
+
### Understanding why conflicts happen
|
|
52
|
+
|
|
53
|
+
| Scenario | Typical resolution | Why |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| Completed work vs stale main state | ours | Your branch has the latest progress |
|
|
56
|
+
| Enriched descriptions vs original | ours | Your descriptions are more detailed |
|
|
57
|
+
| Upstream updates from another agent | theirs | Accept the newer upstream state |
|
|
58
|
+
| User-intentional reset | theirs | Respect the user's explicit action |
|
|
59
|
+
|
|
60
|
+
### Agent decision framework
|
|
61
|
+
|
|
62
|
+
1. List conflicts: `trekoon --toon sync conflicts list`
|
|
63
|
+
2. Group by pattern — are conflicts on the same field or direction?
|
|
64
|
+
3. If uniform pattern, batch resolve: `trekoon --toon sync resolve --all --use ours`
|
|
65
|
+
4. If mixed, narrow by entity or field, or inspect individually
|
|
66
|
+
5. When unsure, ask the user
|
|
67
|
+
|
|
68
|
+
### Batch resolve patterns
|
|
69
|
+
|
|
70
|
+
Common scenarios:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Resolve all conflicts at once (most common after completing work)
|
|
74
|
+
trekoon --toon sync resolve --all --use ours
|
|
75
|
+
|
|
76
|
+
# Preview before resolving
|
|
77
|
+
trekoon --toon sync resolve --all --use ours --dry-run
|
|
78
|
+
|
|
79
|
+
# Narrow to status field conflicts only
|
|
80
|
+
trekoon --toon sync resolve --all --use ours --field status
|
|
81
|
+
|
|
82
|
+
# Narrow to a specific entity
|
|
83
|
+
trekoon --toon sync resolve --all --use theirs --entity <id>
|
|
84
|
+
|
|
85
|
+
# Combine filters
|
|
86
|
+
trekoon --toon sync resolve --all --use ours --entity <id> --field description
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Shared-database model
|
|
90
|
+
|
|
91
|
+
Trekoon uses **one live SQLite database per repository**. The file lives at
|
|
92
|
+
`<sharedStorageRoot>/.trekoon/trekoon.db`, where `sharedStorageRoot` is the
|
|
93
|
+
parent of `git rev-parse --git-common-dir` (i.e., the main worktree root).
|
|
94
|
+
|
|
95
|
+
Key consequences:
|
|
96
|
+
|
|
97
|
+
- **All linked worktrees share the same database.** A status change in one
|
|
98
|
+
worktree is immediately visible in every other worktree.
|
|
99
|
+
- **`git checkout` / `git switch` does not change tracker state.** The database
|
|
100
|
+
is outside the git object store, so switching branches does not roll back or
|
|
101
|
+
swap task data.
|
|
102
|
+
- **Sync operates on tracker events, not on the database file itself.** Use
|
|
103
|
+
`sync pull` to import events between branches — never copy or commit the
|
|
104
|
+
`.db` file.
|
|
105
|
+
|
|
106
|
+
Treat every write as a mutation of shared repo-wide state, not branch-scoped
|
|
107
|
+
state.
|
|
108
|
+
|
|
109
|
+
**Conflicts are scoped per worktree + branch.** `sync_conflicts` rows are
|
|
110
|
+
recorded with the originating worktree path and current branch, so resolving a
|
|
111
|
+
conflict in one worktree never erases a peer worktree's conflict on the same
|
|
112
|
+
entity. `sync conflicts list` and `sync resolve` from a given worktree only
|
|
113
|
+
see and act on rows scoped to that worktree's branch.
|
|
114
|
+
|
|
115
|
+
## Worktree diagnostics and destructive scope
|
|
116
|
+
|
|
117
|
+
- Inspect machine-readable storage fields when debugging worktrees:
|
|
118
|
+
`storageMode`, `repoCommonDir`, `worktreeRoot`, `sharedStorageRoot`, and
|
|
119
|
+
`databaseFile`.
|
|
120
|
+
- `sharedStorageRoot` is the repo-scoped source of truth for `.trekoon` in git
|
|
121
|
+
worktrees.
|
|
122
|
+
- If `trekoon wipe --yes --toon` is explicitly requested, warn that it deletes
|
|
123
|
+
shared storage for the entire repository and every linked worktree.
|
|
124
|
+
- Wipe is destructive recovery only; it is never the right fix for a tracked DB
|
|
125
|
+
or gitignore mistake.
|
|
126
|
+
|
|
127
|
+
Trekoon stores local state in `.trekoon/trekoon.db`. In git repos and
|
|
128
|
+
worktrees, storage resolves from the shared repository root rather than each
|
|
129
|
+
worktree independently.
|
package/README.md
CHANGED
|
@@ -191,7 +191,9 @@ trekoon board update # refresh assets only
|
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
Binds to `127.0.0.1` only with a per-session token. Gives you an epics
|
|
194
|
-
overview, kanban workspace per epic, task detail modals, and search.
|
|
194
|
+
overview, kanban workspace per epic, task detail modals, and search. The board
|
|
195
|
+
client subscribes to `/api/snapshot/stream` (SSE), so mutations from another
|
|
196
|
+
shell, worktree, or browser tab show up live without a manual refresh.
|
|
195
197
|
|
|
196
198
|
## Commands
|
|
197
199
|
|
|
@@ -206,8 +208,13 @@ overview, kanban workspace per epic, task detail modals, and search.
|
|
|
206
208
|
| Get next-action suggestions | `trekoon suggest --epic <id>` |
|
|
207
209
|
| Check epic progress | `trekoon epic progress <id>` |
|
|
208
210
|
| Export epic to Markdown | `trekoon epic export <id>` |
|
|
211
|
+
| Claim a task atomically | `trekoon task claim <id> --owner <owner>` |
|
|
212
|
+
| Claim a subtask atomically | `trekoon subtask claim <id> --owner <owner>` |
|
|
209
213
|
| Mark a task done | `trekoon task done <id>` |
|
|
210
214
|
| Sync across worktrees | `trekoon sync pull --from main` |
|
|
215
|
+
| Back up the DB before migrations | `trekoon migrate backup` |
|
|
216
|
+
| Reveal full board token | `trekoon board open --reveal-token` |
|
|
217
|
+
| Run experimental daemon | `trekoon serve` (experimental) |
|
|
211
218
|
| Get help | `trekoon [command] -h` |
|
|
212
219
|
|
|
213
220
|
Every command supports `--toon`, `--json`, `--compact` for structured output.
|