Documentation
¶
Overview ¶
Package archiveprune audits and, only under explicit apply, deletes local clones of repositories confirmed archived on GitHub.
Deleting a clone is destructive. What makes it acceptable here is narrow: an archived repository still exists on GitHub, so a deleted clone is re-clonable. That argument collapses the moment the clone holds something GitHub does not — an uncommitted edit, a stash, a commit or branch or tag that was never pushed, or a linked worktree or WB Work Log claim that still needs the clone to exist. Every check in Evaluate exists to protect that one argument; a check that cannot be completed (GitHub unreachable, a ref that cannot be resolved) makes the clone not deletable, never "probably fine" — failing closed is the only correct default for an operation this destructive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
ProjectsRoot string
// Filter restricts to repositories whose "org/name" slug contains this
// substring, matching the fleet-wide --filter convention used elsewhere.
Filter string
// Apply performs deletions. Without it, Clean only plans: it runs the
// exact same evaluation and reports the exact same eligibility, but never
// calls os.RemoveAll.
Apply bool
// Progress, when set, receives one "[n/N] org/repo" line per repository as
// it is evaluated, so a long fleet sweep is distinguishable from a hang.
Progress io.Writer
}
Options selects and drives one clean run.
type Outcome ¶
type Outcome struct {
Apply bool `json:"apply" yaml:"apply"`
Results []Result `json:"results" yaml:"results"`
}
Outcome is a whole clean run.
type Result ¶
type Result struct {
Repository string `json:"repository" yaml:"repository"`
Path string `json:"path" yaml:"path"`
// Eligible reports whether the clone satisfies every safety check,
// independent of whether Apply was requested.
Eligible bool `json:"eligible" yaml:"eligible"`
// Applied is true only when Apply was requested, the clone was eligible,
// and the deletion itself succeeded.
Applied bool `json:"applied" yaml:"applied"`
// Reason names, for an eligible clone, why it is safe; for an ineligible
// one, every failing check, joined so the report is self-explanatory
// without cross-referencing anything else.
Reason string `json:"reason" yaml:"reason"`
// Error is set only when the deletion itself failed after the clone was
// judged eligible.
Error string `json:"error,omitempty" yaml:"error,omitempty"`
}
Result is the plan or outcome for one local clone.