model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

internal/model/repo.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffStats

type DiffStats struct {
	// Unstaged diff (working tree vs index)
	UnstagedFiles   []FileDiffStat
	UnstagedAdded   int
	UnstagedDeleted int

	// Staged diff (index vs HEAD)
	StagedFiles   []FileDiffStat
	StagedAdded   int
	StagedDeleted int

	// Aggregate totals
	TotalAdded   int // UnstagedAdded + StagedAdded
	TotalDeleted int // UnstagedDeleted + StagedDeleted
	NetDelta     int // TotalAdded - TotalDeleted

	// Commit activity (7-day history, index 0 = 6 days ago, index 6 = today)
	DailyCommits [7]int

	// File churn (7-day history, key = file path, value = number of commits)
	FileChurn map[string]int

	// Timestamp
	CollectedAt time.Time
}

func (*DiffStats) TopChurnFiles

func (d *DiffStats) TopChurnFiles(n int) []FileChurnEntry

func (*DiffStats) TotalDiffVolume

func (d *DiffStats) TotalDiffVolume() int

type FileChurnEntry

type FileChurnEntry struct {
	Path  string
	Count int
}

type FileDiffStat

type FileDiffStat struct {
	Path    string // Relative file path
	Added   int    // Lines added
	Deleted int    // Lines deleted
	Binary  bool   // True if binary file
}

type RepoStatus

type RepoStatus struct {
	Branch       string // Current branch name (empty if detached)
	DetachedHead bool   // True if HEAD is detached
	CommitHash   string // Short hash of HEAD

	// Working tree state
	Staged    int // Number of staged files
	Modified  int // Number of modified files
	Untracked int // Number of untracked files

	// Remote state
	Remote string // Tracking remote (e.g., "origin/main")
	Owner  string // Owner/org from remote URL (e.g., "jackchuka")
	Ahead  int    // Commits ahead of remote
	Behind int    // Commits behind remote

	// Special states
	Stashes    int  // Number of stashes
	MergeHead  bool // Merge in progress
	RebaseHead bool // Rebase in progress
	CherryPick bool // Cherry-pick in progress
	Reverting  bool // Revert in progress
	Bisecting  bool // Bisect in progress

	// Timestamps
	LastCommit   time.Time // Time of last commit
	LastModified time.Time // Last working tree modification

	// Custom command outputs
	Aliases map[string]string // alias name -> output
}

func (*RepoStatus) HasSpecialState

func (s *RepoStatus) HasSpecialState() bool

func (*RepoStatus) IsDirty

func (s *RepoStatus) IsDirty() bool

type Repository

type Repository struct {
	Path         string      // Absolute path to repo root
	Name         string      // Display name (derived from path or config)
	IsWorktree   bool        // True if this is a linked worktree
	MainWorktree string      // If IsWorktree, path to main repo
	Status       *RepoStatus // Current status (nil if not yet scanned)
	Diff         *DiffStats  // Line-level diff and activity data (nil if not loaded)
	LastScanned  time.Time   // When status was last refreshed
}

func (*Repository) DisplayName

func (r *Repository) DisplayName() string

Jump to

Keyboard shortcuts

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