Documentation
¶
Overview ¶
Package treeman is the treeman daemon client: worktree health as a status snapshot from the `treeman status` CLI, refreshed whenever the daemon's event socket signals activity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SocketPath ¶
SocketPath mirrors treeman's own lookup order: $TREEMAN_SOCKET → $XDG_RUNTIME_DIR/treeman.sock → $XDG_DATA_HOME/treeman/treeman.sock → ~/.local/share/treeman/treeman.sock.
Types ¶
type Action ¶
type Action int
Action is a worktree mutation (service.rs's Action).
type Bucket ¶
type Bucket int
Bucket is the coarse worktree state, mirroring treeman's bucket strings.
Buckets, most severe last for the comparison in WorstBucket.
func ParseBucket ¶
ParseBucket is Bucket::parse: up, down, failed, anything else stable.
type Repo ¶
type Repo struct {
Repo string `json:"repo"`
Total uint32 `json:"total"`
Worktrees []Worktree `json:"worktrees"`
}
Repo is one registered repo and its active worktrees.
type Source ¶
type Source interface {
// Status is the latest snapshot (the Rust service's status
// property): nil until treeman reported one, and for good when
// treeman is not installed.
Status() *Status
// Subscribe ticks when Status changes. The channel closes when the
// source stops; stop unsubscribes.
Subscribe(ctx context.Context) (<-chan struct{}, func(), error)
// RunAction queues an action with the treeman daemon; the status
// subscription reports its progress. A failure carries the
// command's stderr.
RunAction(ctx context.Context, action Action, path string) error
}
Source is the module's seam.
type Status ¶
type Status struct {
Total uint32 `json:"total"`
Stable uint32 `json:"stable"`
Up uint32 `json:"up"`
Down uint32 `json:"down"`
Failed uint32 `json:"failed"`
Class string `json:"class"`
Repos []Repo `json:"repos"`
}
Status is the aggregated worktree health across every registered repo (treeman status's JSON).
func (Status) FindWorktree ¶
FindWorktree is find_worktree: the worktree at path and its repo.
func (Status) WorstBucket ¶
WorstBucket is model.rs's worst_bucket: failed > down > up > stable.
type System ¶
type System struct {
// contains filtered or unexported fields
}
System is the real client, built by New.
func (*System) RunAction ¶
RunAction implements Source (run_action): the CLI's stderr is the error on a non-zero exit.
type Worktree ¶
type Worktree struct {
// Branch is the branch name ("-" when detached or unknown).
Branch string `json:"branch"`
Slug string `json:"slug"`
// State is the fine lifecycle state (ready, preparing, error, …);
// Bucket the coarse one it maps to.
State string `json:"state"`
Bucket string `json:"bucket"`
IsMain bool `json:"is_main"`
// Path is the absolute worktree path.
Path string `json:"path"`
}
Worktree is one active worktree (model.rs's TreemanWorktree).