analyzer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitRepo

func IsGitRepo(path string) bool

func LoadGitConfig

func LoadGitConfig() error

LoadGitConfig loads required git config values. Returns an error if required values are missing.

We use the git command rather than go-git's config API because go-git does not support [include] or [includeIf] directives (see https://github.com/go-git/go-git/issues/395). The git command properly handles all config levels (system, global, local) and includes.

func ResetTestConfig

func ResetTestConfig()

ResetTestConfig resets the configuration to unloaded state.

func SetTestConfig

func SetTestConfig(email, github string)

SetTestConfig sets test configuration values. Call ResetTestConfig after tests.

Types

type BranchInfo

type BranchInfo struct {
	Name           string `json:"name"`
	IsCurrent      bool   `json:"is_current"`
	CommitCount    int    `json:"commit_count"`
	LastCommitDate string `json:"last_commit_date,omitempty"`
}

type CommitInfo

type CommitInfo struct {
	Hash    string `json:"hash"`
	Message string `json:"message"`
	Date    string `json:"date,omitempty"`
}

type CommitStats added in v0.1.6

type CommitStats struct {
	UserTotal      int    `json:"user_total"`
	LastUserCommit string `json:"last_user_commit,omitempty"`
	LastRepoCommit string `json:"last_repo_commit,omitempty"`
}

CommitStats holds commit statistics for JSON output.

type DirtyDetails

type DirtyDetails struct {
	Untracked          int      `json:"untracked,omitempty"`
	UntrackedNames     []string `json:"untracked_names,omitempty"`
	StagedFiles        int      `json:"staged,omitempty"`
	StagedNames        []string `json:"staged_names,omitempty"`
	StagedInsertions   int      `json:"staged_insertions,omitempty"`
	StagedDeletions    int      `json:"staged_deletions,omitempty"`
	UnstagedFiles      int      `json:"unstaged,omitempty"`
	UnstagedNames      []string `json:"unstaged_names,omitempty"`
	UnstagedInsertions int      `json:"unstaged_insertions,omitempty"`
	UnstagedDeletions  int      `json:"unstaged_deletions,omitempty"`
}

func (*DirtyDetails) String

func (d *DirtyDetails) String() string

func (*DirtyDetails) TotalFiles

func (d *DirtyDetails) TotalFiles() int

type Options

type Options struct {
	Verbose bool
}

type RemoteInfo

type RemoteInfo struct {
	Name   string `json:"name"`
	URL    string `json:"url"`
	IsMine bool   `json:"is_mine"`
}

type RepoInfo

type RepoInfo struct {
	Path                string        `json:"path"`
	Name                string        `json:"name"`
	IsGitRepo           bool          `json:"is_git_repo"`
	Error               string        `json:"error,omitempty"`
	CurrentBranch       string        `json:"current_branch,omitempty"`
	DefaultBranch       string        `json:"default_branch,omitempty"`
	IsFork              bool          `json:"is_fork,omitempty"`
	UpstreamURL         string        `json:"upstream_url,omitempty"`
	Commits             *CommitStats  `json:"commits,omitempty"`
	DirtyDetails        *DirtyDetails `json:"dirty,omitempty"`
	Ahead               int           `json:"ahead,omitempty"`
	Behind              int           `json:"behind,omitempty"`
	StashCount          int           `json:"stash_count,omitempty"`
	Stashes             []StashInfo   `json:"stashes,omitempty"`
	RecentCommits       []CommitInfo  `json:"recent_commits,omitempty"`
	AllRemotes          []RemoteInfo  `json:"remotes,omitempty"`
	BranchesWithCommits []BranchInfo  `json:"branches,omitempty"`

	// Internal/render-only fields excluded from JSON output:
	HasUserRemote         bool     `json:"-"`
	UserRemotes           []string `json:"-"`
	HasUncommittedChanges bool     `json:"-"`
	TotalUserCommits      int      `json:"-"`
	LastCommitDate        string   `json:"-"` // Last commit by user
	LastRepoCommitDate    string   `json:"-"` // Last commit by anyone
}

func AnalyzeDirectory

func AnalyzeDirectory(path string, opts Options, showProgress bool) []RepoInfo

func AnalyzeRepo

func AnalyzeRepo(path string, opts Options) RepoInfo

type StashInfo

type StashInfo struct {
	Index   int    `json:"index"`
	Message string `json:"message"`
	Date    string `json:"date,omitempty"`
}

Jump to

Keyboard shortcuts

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