Documentation
¶
Overview ¶
Package worktree captures deterministic fingerprints of a workspace's uncommitted state and derives the set of paths produced by a task run.
Index ¶
- func WriteScope(path string, scope Scope) error
- type Scope
- type Snapshot
- func (s Snapshot) Branch() string
- func (s Snapshot) Digest() string
- func (s Snapshot) Document() SnapshotDocument
- func (s Snapshot) Entries() []StatusEntry
- func (s Snapshot) Equal(other Snapshot) bool
- func (s Snapshot) GitAvailable() bool
- func (s Snapshot) HasCommits() bool
- func (s Snapshot) Head() string
- func (s Snapshot) IsGitRepo() bool
- func (s Snapshot) IsSupported() bool
- func (s Snapshot) Porcelain() []byte
- func (s Snapshot) UnsupportedReason() UnsupportedReason
- type SnapshotDocument
- type StatusEntry
- type UnsupportedReason
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteScope ¶
WriteScope writes a scope artifact as indented JSON.
Types ¶
type Scope ¶
type Scope struct {
SchemaVersion string `json:"schema_version"`
Supported bool `json:"supported"`
ProducedPaths []string `json:"produced_paths"`
PreExistingPaths []string `json:"pre_existing_paths,omitempty"`
PreExistingChangedPaths []string `json:"pre_existing_changed_paths,omitempty"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
Error string `json:"error,omitempty"`
Baseline SnapshotDocument `json:"baseline"`
Final SnapshotDocument `json:"final"`
}
Scope describes which dirty paths were produced by a task relative to a pre-agent baseline snapshot.
func BuildScope ¶
BuildScope captures the final workspace state and compares it to baseline.
func CompareSnapshots ¶
CompareSnapshots derives the task-produced scope from two snapshots.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is a deterministic fingerprint of a working tree.
func (Snapshot) Document ¶
func (s Snapshot) Document() SnapshotDocument
Document returns a JSON-safe representation of the snapshot.
func (Snapshot) Entries ¶
func (s Snapshot) Entries() []StatusEntry
Entries returns parsed porcelain entries with per-path fingerprints.
func (Snapshot) GitAvailable ¶
func (Snapshot) HasCommits ¶
func (Snapshot) IsSupported ¶
func (Snapshot) UnsupportedReason ¶
func (s Snapshot) UnsupportedReason() UnsupportedReason
type SnapshotDocument ¶
type SnapshotDocument struct {
SchemaVersion string `json:"schema_version"`
Supported bool `json:"supported"`
GitAvailable bool `json:"git_available"`
IsGitRepo bool `json:"is_git_repo"`
HasCommits bool `json:"has_commits"`
Head string `json:"head,omitempty"`
Branch string `json:"branch,omitempty"`
Digest string `json:"digest,omitempty"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
RawPorcelainZHex string `json:"raw_porcelain_z_hex,omitempty"`
Entries []StatusEntry `json:"entries,omitempty"`
TrackedSymlinks map[string]string `json:"tracked_symlinks,omitempty"`
}
SnapshotDocument is the JSON-safe representation used in scope artifacts.
type StatusEntry ¶
type StatusEntry struct {
Path string `json:"path"`
OriginalPath string `json:"original_path,omitempty"`
Kind string `json:"kind"`
IndexStatus string `json:"index_status"`
WorktreeStatus string `json:"worktree_status"`
Fingerprint string `json:"fingerprint,omitempty"`
}
StatusEntry is one git porcelain v1 -z status entry captured in a snapshot.
func ParsePorcelain ¶
func ParsePorcelain(raw []byte) ([]StatusEntry, error)
ParsePorcelain parses git status --porcelain=v1 -z output.
type UnsupportedReason ¶
type UnsupportedReason string
UnsupportedReason describes why a working-tree snapshot could not be captured.
const ( // UnsupportedReasonBlankRoot means the caller did not provide a workspace root. UnsupportedReasonBlankRoot UnsupportedReason = "blank_root" // UnsupportedReasonNonGit means the workspace root does not contain git metadata. UnsupportedReasonNonGit UnsupportedReason = "non_git" // UnsupportedReasonGitMissing means the git executable could not be found. UnsupportedReasonGitMissing UnsupportedReason = "git_missing" // UnsupportedReasonNoCommits means HEAD could not be resolved. UnsupportedReasonNoCommits UnsupportedReason = "no_commits" )