storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const StatusOrphan = "orphan"

StatusOrphan marks a worktree on disk that no run state claims. It is the only status here that does not come from runstate: everything else is the run's own word for itself.

Variables

This section is empty.

Functions

func Encode

func Encode(report Report) ([]byte, error)

func Validate

func Validate(report Report) error

Types

type Action

type Action struct {
	Owner  string `json:"owner"`
	Ref    string `json:"ref"`
	Reason string `json:"reason"`
	Bytes  int64  `json:"bytes"`
	// contains filtered or unexported fields
}

type Item

type Item struct {
	Owner            string `json:"owner"`
	State            string `json:"state"`
	Action           string `json:"action"`
	Count            int    `json:"count"`
	Bytes            int64  `json:"bytes"`
	OldestAgeSeconds int64  `json:"oldest_age_seconds"`
	NewestAgeSeconds int64  `json:"newest_age_seconds"`
	// BytesTruncated says the byte count above is a floor, not a total. A
	// report that stops early and stays silent about it is worse than no
	// report: it reads as an answer.
	BytesTruncated bool `json:"bytes_truncated,omitempty"`
	// contains filtered or unexported fields
}

type OpenRun

type OpenRun struct {
	RunID          string    `json:"run_id"`
	ProjectID      string    `json:"project_id"`
	Repo           string    `json:"repo,omitempty"`
	RepoName       string    `json:"repo_name,omitempty"`
	Status         string    `json:"status"`
	Objective      string    `json:"objective,omitempty"`
	Branch         string    `json:"branch,omitempty"`
	Worktree       string    `json:"worktree"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
	AgeSeconds     int64     `json:"age_seconds"`
	Bytes          int64     `json:"bytes"`
	BytesTruncated bool      `json:"bytes_truncated"`
}

OpenRun is one worktree that still exists on disk, with whatever the run state says about it. Disk presence is the entry condition, not run status — an `applied` run whose worktree survived is an anomaly, and hiding it is how gigabytes go unnoticed.

func (OpenRun) Terminal

func (r OpenRun) Terminal() bool

Terminal reports whether the run reached a state that should have removed its worktree. A true here on a run that still has one on disk is a leak.

type Options

type Options struct {
	Now          time.Time
	TelemetryDir string
	ToolchainDir string
	WorktreeDir  string
	// contains filtered or unexported fields
}

type Report

type Report struct {
	Items   []Item   `json:"items"`
	Actions []Action `json:"actions"`
	Skipped []string `json:"skipped"`
	DryRun  bool     `json:"dry_run"`
	Applied bool     `json:"applied"`
	Failed  []string `json:"failed"`
}

func Inspect

func Inspect(root string) Report

func InspectWithOptions

func InspectWithOptions(root string, options Options) Report

func Prune

func Prune(root string, apply bool) Report

func PruneWithOptions

func PruneWithOptions(root string, options Options, apply bool) Report

type StatusOptions

type StatusOptions struct {
	Now time.Time
	// WorktreesRoot defaults to ~/.jacu-harness/worktrees. Tests set it.
	WorktreesRoot string
}

type StatusReport

type StatusReport struct {
	Runs       []OpenRun `json:"runs"`
	TotalRuns  int       `json:"total_runs"`
	TotalBytes int64     `json:"total_bytes"`
	Truncated  bool      `json:"truncated"`
	Failed     []string  `json:"failed"`
}

func Status

func Status(options StatusOptions) StatusReport

Status walks every project's worktree directory and reports what is still on disk. It is deliberately global: a run parked in one repository is invisible from another, and invisible parked work is the failure this command exists to prevent.

Jump to

Keyboard shortcuts

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