models

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package models defines the data objects shared across lazyworktree packages.

Index

Constants

View Source
const (
	// LastSelectedFilename stores the last worktree selection for a repo.
	LastSelectedFilename = ".last-selected"
	// CacheFilename stores cached worktree metadata for faster loads.
	CacheFilename = ".worktree-cache.json"
	// CommandHistoryFilename stores the command history for the ! command.
	CommandHistoryFilename = ".command-history.json"
	// AccessHistoryFilename stores worktree access timestamps for sorting.
	AccessHistoryFilename = ".worktree-access.json"
	// CommandPaletteHistoryFilename stores command palette usage history for MRU sorting.
	CommandPaletteHistoryFilename = ".command-palette-history.json"
)
View Source
const (
	PRFetchStatusNotFetched = "not_fetched" // PR data has not been fetched yet
	PRFetchStatusFetching   = "fetching"    // PR data is currently being fetched
	PRFetchStatusLoaded     = "loaded"      // PR data was successfully loaded
	PRFetchStatusError      = "error"       // PR fetch encountered an error
	PRFetchStatusNoPR       = "no_pr"       // No PR exists for this branch
)

PR fetch status values for WorktreeInfo.PRFetchStatus field.

Variables

This section is empty.

Functions

This section is empty.

Types

type CICheck

type CICheck struct {
	Name       string    // Name of the check/job
	Status     string    // Status: "completed", "in_progress", "queued", "pending"
	Conclusion string    // Conclusion: "success", "failure", "skipped", "cancelled", etc.
	Link       string    // URL to the check details page
	StartedAt  time.Time // When the check started (zero if not available)
}

CICheck represents a single CI check/job status.

type CommitFile added in v1.17.0

type CommitFile struct {
	Filename   string
	ChangeType string // A=Added, M=Modified, D=Deleted, R=Renamed, C=Copied
	OldPath    string // For renames: the original path
}

CommitFile represents a file changed in a commit.

type IssueInfo added in v1.20.0

type IssueInfo struct {
	Number      int
	State       string
	Title       string
	Body        string // For branch_name_script input
	URL         string
	Author      string // Issue author username
	AuthorName  string // Issue author full name
	AuthorIsBot bool   // Whether the author is a bot
}

IssueInfo captures the relevant metadata for an issue.

type PRInfo

type PRInfo struct {
	Number      int
	State       string
	Title       string
	Body        string // For branch_name_script input
	URL         string
	Branch      string // Branch name (headRefName for GitHub, source_branch for GitLab)
	BaseBranch  string // Base branch name (baseRefName for GitHub, target_branch for GitLab)
	Author      string // PR/MR author username
	AuthorName  string // PR/MR author full name
	AuthorIsBot bool   // Whether the author is a bot
	IsDraft     bool   // Whether the PR is a draft
	CIStatus    string // Computed CI status: "success", "failure", "pending", "none"
}

PRInfo captures the relevant metadata for a pull request.

type StatusFile added in v1.29.0

type StatusFile struct {
	Filename    string
	Status      string // XY status code (e.g., ".M", "M.", " ?")
	IsUntracked bool
}

StatusFile represents a file entry from git status.

type WorktreeInfo

type WorktreeInfo struct {
	Path           string
	Branch         string
	IsMain         bool
	Dirty          bool
	Ahead          int
	Behind         int
	Unpushed       int // Commits not on any remote (for branches without upstream)
	HasUpstream    bool
	UpstreamBranch string // The upstream branch name (e.g., "origin/main" or "chmouel/feature-branch")
	LastActive     string
	LastActiveTS   int64
	LastSwitchedTS int64 // Unix timestamp of last UI access/switch
	PR             *PRInfo
	PRFetchError   string // Stores error message if PR fetch failed
	PRFetchStatus  string // "not_fetched", "fetching", "loaded", "error", "no_pr"
	Untracked      int
	Modified       int
	Staged         int
	Divergence     string
}

WorktreeInfo summarizes the information for a git worktree.

Jump to

Keyboard shortcuts

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