gitmeta

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 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 CommitInfo

type CommitInfo struct {
	Hash         string
	AuthorName   string
	AuthorEmail  string
	AuthorTime   time.Time
	Subject      string
	Body         string
	TrailersJSON string // JSON-encoded trailers
	IsMerge      bool
	FirstParent  string
}

CommitInfo holds normalized commit metadata

type Config

type Config struct {
	HistoryDepth     int
	PerFileCommitCap int
	MaxMessageBytes  int
	MaxIntentBytes   int
}

Config holds Cold Start configuration limits

type Extractor

type Extractor struct {
	// contains filtered or unexported fields
}

Extractor extracts Git metadata from a repository

func NewExtractor

func NewExtractor(repoRoot string, cfg Config) (*Extractor, error)

NewExtractor opens a git repository at the given path. Returns nil, nil if the path is not a git repository (graceful degradation). Returns an error if config values are invalid (HistoryDepth or MaxMessageBytes <= 0).

func (*Extractor) CompactFileIntents

func (e *Extractor) CompactFileIntents(changes []FileChange) []FileIntent

CompactFileIntents generates compressed intent summaries per file from file changes. Groups changes by file, prioritizes recent and meaningful commits, and produces bounded text.

func (*Extractor) FileHistory

func (e *Extractor) FileHistory(ctx context.Context, filePaths map[string]bool) ([]FileChange, error)

FileHistory returns commit associations for the given file paths. Walks up to config.HistoryDepth commits and maps file changes. If filePaths is nil, returns history for all files encountered.

func (*Extractor) RecentCommits

func (e *Extractor) RecentCommits(ctx context.Context, maxCount int) ([]CommitInfo, error)

RecentCommits returns the last N commits from HEAD (bounded by config.HistoryDepth). If maxCount <= 0, uses config.HistoryDepth.

func (*Extractor) RecentCommitsSummary

func (e *Extractor) RecentCommitsSummary(ctx context.Context, count int) (string, error)

RecentCommitsSummary returns a bounded human-readable summary of recent commits.

func (*Extractor) Snapshot

func (e *Extractor) Snapshot() (*RepoSnapshot, error)

Snapshot captures the current repository state.

type FileChange

type FileChange struct {
	FilePath   string
	CommitHash string
	ChangeType string // added, modified, deleted, renamed
	CommitTime time.Time
	Summary    string // commit subject
}

FileChange represents a file's association with a commit

type FileIntent

type FileIntent struct {
	FilePath       string
	IntentText     string
	SourceHash     string // hash of inputs used to generate this intent
	CommitCount    int
	LastCommitHash string
	LastUpdatedAt  time.Time
}

FileIntent is a compacted, retrieval-ready intent summary per file

type RepoSnapshot

type RepoSnapshot struct {
	RepoRoot       string
	HeadRef        string // branch name or "HEAD"
	HeadCommit     string // commit hash
	IsDetached     bool
	IsDirty        bool
	AheadCount     int // 0 for now (no remote comparison in v1)
	BehindCount    int // 0 for now
	StagedFiles    int
	ModifiedFiles  int
	UntrackedFiles int
	Summary        string // human-readable summary
	UpdatedAt      time.Time
}

RepoSnapshot captures current repository state

Jump to

Keyboard shortcuts

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