Documentation
¶
Overview ¶
Package model defines the core domain types for scry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOversized = errors.New("patch exceeds size threshold") ErrBinaryFile = errors.New("binary file") ErrSubmodule = errors.New("submodule change") )
Sentinel errors for PatchService edge cases.
Functions ¶
This section is empty.
Types ¶
type AppState ¶
type AppState struct {
Compare ResolvedCompare
Files []FileSummary
SelectedFile int // Index into Files. -1 when Files is empty.
Patches map[string]PatchLoadState
CacheGeneration int
IgnoreWhitespace bool
SearchQuery string
FocusPane Pane
}
AppState is the top-level UI state threaded through the Bubble Tea model.
type CompareMode ¶
type CompareMode string
const ( CompareThreeDot CompareMode = "three-dot" CompareTwoDot CompareMode = "two-dot" )
type CompareRequest ¶
type CompareRequest struct {
Repo RepoContext
BaseRef string
HeadRef string
Mode CompareMode
IgnoreWhitespace bool
}
type FilePatch ¶
type FilePatch struct {
Summary FileSummary
Hunks []Hunk
}
type FileStatus ¶
type FileStatus string
const ( StatusAdded FileStatus = "A" StatusModified FileStatus = "M" StatusDeleted FileStatus = "D" StatusRenamed FileStatus = "R" StatusCopied FileStatus = "C" StatusTypeChg FileStatus = "T" StatusUnmerged FileStatus = "U" )
type FileSummary ¶
type LoadStatus ¶
type LoadStatus string
LoadStatus tracks the lifecycle of an async patch load.
const ( LoadIdle LoadStatus = "idle" LoadLoading LoadStatus = "loading" LoadLoaded LoadStatus = "loaded" LoadFailed LoadStatus = "failed" )
type PatchLoadState ¶
type PatchLoadState struct {
Status LoadStatus
Patch *FilePatch
Err error
Generation int
}
PatchLoadState holds the result of loading a single file's patch.
type RepoContext ¶
type RepoContext struct {
WorktreeRoot string // git rev-parse --show-toplevel
GitDir string // git rev-parse --absolute-git-dir (per-worktree)
GitCommonDir string // git rev-parse --git-common-dir (shared across worktrees)
IsLinkedWorktree bool // GitDir != GitCommonDir after path canonicalization
}
RepoContext is resolved once at startup via git rev-parse. In a linked worktree, .git is a file (not a directory), so code must NEVER construct paths via WorktreeRoot + ".git" + "...".
type ResolvedCompare ¶
type ResolvedCompare struct {
Repo RepoContext
BaseRef string
HeadRef string
MergeBase string // SHA of merge-base in three-dot mode; empty string in two-dot mode.
DiffRange string // Range string passed to git diff: "base...head" or "base..head".
}
Click to show internal directories.
Click to hide internal directories.