gitfacts

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package gitfacts collects bounded local git history facts for diagnostic evidence.

Index

Constants

View Source
const (
	ShapeNonGit       = "non_git"
	ShapeUnavailable  = "unavailable"
	ShapeEmpty        = "empty"
	ShapeSingleCommit = "single_commit"
	ShapeShallow      = "shallow"
	ShapeFull         = "full"

	DefaultMaxCommits        = 200
	DefaultMaxFilesPerCommit = 32
	DefaultMaxBodyBytes      = 4096
	DefaultMaxBodyLines      = 40
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	SHA          string
	Branch       string
	Parents      []string
	AuthorName   string
	AuthorEmail  string
	Message      string
	BodyPreview  string
	CommittedAt  string
	FilesChanged int
	IsMerge      bool
	HistoryShape string
}

Commit is one local git commit fact.

type Diagnostics

type Diagnostics struct {
	Enabled             bool   `json:"enabled"`
	HistoryShape        string `json:"history_shape"`
	IsShallow           bool   `json:"is_shallow,omitempty"`
	Branch              string `json:"branch,omitempty"`
	MaxCommits          int    `json:"max_commits"`
	MaxFilesPerCommit   int    `json:"max_files_per_commit"`
	TotalCommits        int    `json:"total_commits,omitempty"`
	CommitsRead         int    `json:"commits_read,omitempty"`
	CommitsStored       int    `json:"commits_stored,omitempty"`
	FilesStored         int    `json:"files_stored,omitempty"`
	SkippedLargeCommits int    `json:"skipped_large_commits,omitempty"`
	BodiesTruncated     int    `json:"commit_bodies_truncated,omitempty"`
	GitError            string `json:"git_error,omitempty"`
}

Diagnostics summarizes collection and history shape.

type Facts

type Facts struct {
	Commits     []Commit
	Files       []FileChange
	Diagnostics Diagnostics
}

Facts is the collected local git history slice.

func Collect

func Collect(ctx context.Context, repoRoot string, opts Options) (Facts, error)

Collect gathers a bounded set of local git facts. Non-git or unavailable git states are reported as diagnostics rather than hard failures.

type FileChange

type FileChange struct {
	CommitSHA  string
	FilePath   string
	ChangeType string
	OldPath    string
}

FileChange is one file changed by a commit.

type Options

type Options struct {
	MaxCommits        int
	MaxFilesPerCommit int
}

Options controls bounded git history collection.

Jump to

Keyboard shortcuts

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