Documentation
¶
Overview ¶
Package state reads the run state bin/f10-state.sh writes: one small `key value` file per session under ~/.claude/f10/state, keyed by session rather than by repo because two sessions over one checkout are two runs.
The script is the writer and the semantics oracle. This package only reads, with the script's own tolerances - unknown keys ignored, a non-numeric timestamp read as stale - so `f10 status` and `f10-state.sh show` describe one run the same way. The parity test pins that.
Index ¶
Constants ¶
const DefaultTTL = 24 * time.Hour
DefaultTTL is how long a run counts as live with nothing reporting: the script's default, and the point past which the badge stops rendering.
Variables ¶
var Phases = []string{"capture", "plan", "ship"}
Phases in the order the badge draws them.
Functions ¶
func Dir ¶
func Dir() string
Dir is where state files live: the script's variable, else its default.
func Path ¶
Path is the state file for a session: the id sanitized the way the script sanitizes it, since it names a file.
func Session ¶
func Session() string
Session is the session this process runs in, in the order the script resolves it: the explicit override, then the id Claude Code exports into every Bash tool call. Empty from a plain terminal.
Types ¶
type Run ¶
type Run struct {
Session string `json:"session"`
Task string `json:"task,omitempty"`
URL string `json:"url,omitempty"`
Root string `json:"root,omitempty"` // checkout root the run is about
Capture string `json:"capture"`
Plan string `json:"plan"`
Ship string `json:"ship"`
Leaf string `json:"leaf,omitempty"` // the pipeline step running, or stopped on
Final string `json:"final,omitempty"` // the ship pipeline's declared last step
Note string `json:"note,omitempty"` // why the run stopped
Next string `json:"next,omitempty"` // what unblocks it
Updated time.Time `json:"updated"`
}
A Run is one session's state file, read back. Every phase holds one of the script's statuses: pending, running, done, failed, partial, skipped, prior, blocked.
func List ¶
List reads every live run in dir, newest first. A missing directory is an empty list: no run has ever reported on this machine.
func Load ¶
Load reads one state file. A missing file is os.ErrNotExist, unwrapped enough for errors.Is.