state

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendEvent

func AppendEvent(root string, event Event) error

func ClearLock

func ClearLock(root string) error

func Path

func Path(root string) string

func Save

func Save(root string, store Store) error

func WithLock

func WithLock(root, command string, fn func() error) error

Types

type Activity

type Activity struct {
	Phase      string    `json:"phase"`
	Agent      string    `json:"agent,omitempty"`
	Note       string    `json:"note,omitempty"`
	LastSeenAt time.Time `json:"lastSeenAt"`
}

type Actor

type Actor struct {
	Kind string `json:"kind"`
	Name string `json:"name,omitempty"`
}

type Event

type Event struct {
	Time   time.Time `json:"time"`
	Type   string    `json:"type"`
	ID     string    `json:"id"`
	Detail string    `json:"detail,omitempty"`
}

type Lock

type Lock struct {
	PID       int       `json:"pid"`
	Hostname  string    `json:"hostname"`
	Command   string    `json:"command"`
	CreatedAt time.Time `json:"createdAt"`
}

type LockError added in v0.2.0

type LockError struct {
	Status LockStatus
}

func (*LockError) Error added in v0.2.0

func (e *LockError) Error() string

type LockStatus

type LockStatus struct {
	Exists bool   `json:"exists"`
	Stale  bool   `json:"stale"`
	Reason string `json:"reason"`
	Lock   Lock   `json:"lock"`
}

func ClearStaleLock added in v0.2.0

func ClearStaleLock(root string) (LockStatus, bool, error)

func InspectLock

func InspectLock(root string) (LockStatus, error)

type Status

type Status struct {
	LastKnown     string    `json:"lastKnown"`
	LastCheckedAt time.Time `json:"lastCheckedAt"`
}

type Store

type Store struct {
	Version     int        `json:"version"`
	RepoRoot    string     `json:"repoRoot"`
	DefaultBase string     `json:"defaultBase"`
	Worktrees   []Worktree `json:"worktrees"`
}

func Load

func Load(root string) (Store, error)

func NewStore

func NewStore(root string) Store

func (Store) Find

func (s Store) Find(id string) (Worktree, int, bool)

type Worktree

type Worktree struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Branch    string    `json:"branch"`
	Path      string    `json:"path"`
	Base      string    `json:"base"`
	CreatedAt time.Time `json:"createdAt"`
	CreatedBy Actor     `json:"createdBy"`
	Activity  Activity  `json:"activity"`
	Status    Status    `json:"status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL