index

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Repos     map[string]*Repo `json:"repos"` // Key: absolute path
	UpdatedAt time.Time        `json:"updated_at"`
	// contains filtered or unexported fields
}

Index represents the repository index

func Load

func Load() (*Index, error)

Load loads the index from disk

func New

func New() *Index

New creates a new empty index

func (*Index) Count

func (idx *Index) Count() int

Count returns the number of repositories in the index

func (*Index) Delete

func (idx *Index) Delete(absPath string)

Delete removes a repository from the index

func (*Index) Get

func (idx *Index) Get(absPath string) (*Repo, bool)

Get retrieves a repository by absolute path

func (*Index) GetByName

func (idx *Index) GetByName(name string) []*Repo

GetByName retrieves repositories by name (can be multiple)

func (*Index) List

func (idx *Index) List() []*Repo

List returns all repositories as a slice

func (*Index) RemoveStale

func (idx *Index) RemoveStale() int

RemoveStale removes repositories that no longer exist on disk

func (*Index) Save

func (idx *Index) Save() error

Save saves the index to disk atomically

func (*Index) Upsert

func (idx *Index) Upsert(repo *Repo)

Upsert inserts or updates a repository in the index

type Repo

type Repo struct {
	// Identity
	ID        string `json:"id"`         // Hash of absolute path
	Name      string `json:"name"`       // Directory name
	Root      string `json:"root"`       // Root identifier
	RelPath   string `json:"rel_path"`   // Relative to root
	AbsPath   string `json:"abs_path"`   // Full resolved path
	IsWSL     bool   `json:"is_wsl"`     // True if repo is in WSL
	WSLDistro string `json:"wsl_distro"` // WSL distro name if IsWSL is true

	// Git Info
	RemoteURL        string    `json:"remote_url,omitempty"`
	Host             string    `json:"host,omitempty"`
	CurrentBranch    string    `json:"current_branch,omitempty"`
	LastCommitTime   time.Time `json:"last_commit_time,omitempty"`
	LastCommitAuthor string    `json:"last_commit_author,omitempty"`
	LastCommitHash   string    `json:"last_commit_hash,omitempty"`
	IsDirty          bool      `json:"is_dirty"`
	HasUntracked     bool      `json:"has_untracked"`
	Ahead            int       `json:"ahead"`
	Behind           int       `json:"behind"`
	LastGitCheckAt   time.Time `json:"last_git_check_at,omitempty"`

	// Metadata
	PrimaryLanguage string   `json:"primary_language,omitempty"`
	Description     string   `json:"description,omitempty"`
	Tags            []string `json:"tags,omitempty"`

	// Tracking
	FirstSeenAt time.Time `json:"first_seen_at"`
	LastScanAt  time.Time `json:"last_scan_at"`

	// Metadata source tracking
	DescriptionSource string `json:"description_source,omitempty"` // "manual", "global", "llm", "auto"
	TagsSource        string `json:"tags_source,omitempty"`
}

Repo represents a single repository entry

Jump to

Keyboard shortcuts

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