Skip to main content

Module model

Module model 

Source
Expand description

Domain model: the worktree row and its JSON schema (spec §7), plus the sort and column enums used by list/status.

Worktree serializes to exactly the stable schema documented in §7. The Option fields encode the spec’s null semantics: ahead/behind are None (→ JSON null) when there is no upstream; the working-tree fields and commit are None for a missing worktree; branch/slug are None for a detached HEAD. None serializes as null (the fields are never omitted).

Structs§

Commit
Tip-commit metadata for display (spec §7).
Pr
A recorded pull request (spec §7).
RemovedResult
The remove result object: the worktree row plus a removed flag.
SortSpec
A sort field plus direction (spec §7; a - prefix means descending).
Worktree
One worktree row — the stable §7 JSON schema shared by list, status, and the new/pr/remove result objects.

Enums§

Column
A wt list display column (spec §11 list.columns).
MergeState
How a branch’s commits relate to the rest of the repo, for delete-safety messaging in the TUI. Computed offline (no fetch): from ancestry against the base/default branch, a recorded merged PR, and whether the configured upstream’s tracking ref is gone.
PrState
Pull-request state, mirroring gh (spec §7).
SortKey
A field to sort wt list by (spec §7 --sort).

Constants§

SCHEMA_VERSION
The current --json schema version (spec §7/§13). Bumped only on a breaking change so consumers can detect incompatibility.