audit

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package audit provides workspace auditing operations such as detecting non-git directories in the projects directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchSummary added in v0.11.0

type BranchSummary struct {
	MergedBranches int
	MergedRepos    int
	StaleBranches  int
	StaleRepos     int
	MergedByRepo   []RepoBranchCount // sorted by count desc
	StaleByRepo    []RepoBranchCount // sorted by count desc
}

BranchSummary holds counts of merged and stale branches.

type DashboardResult added in v0.11.0

type DashboardResult struct {
	ProjectsDir   string
	RepoCount     int
	RepoHealth    RepoHealthSummary
	HealthDetails []RepoHealth
	Branches      BranchSummary
	NonGitDirs    []NonRepoDir
	StaleDays     int
}

DashboardResult holds the complete audit dashboard data.

type HealthBuckets added in v0.11.0

type HealthBuckets struct {
	Conflicted []RepoHealth
	Dirty      []RepoHealth
	NonDefault []RepoHealth
	Behind     []RepoHealth
	Clean      []RepoHealth
}

HealthBuckets holds repos partitioned into mutually exclusive health categories.

func ReposByBucket added in v0.11.0

func ReposByBucket(repos []RepoHealth) HealthBuckets

ReposByBucket partitions repos using the same priority as SummarizeHealth.

type NonRepoDir

type NonRepoDir struct {
	Path         string
	Name         string
	Size         int64     // Total size in bytes
	LastModified time.Time // Most recent modification time
	FileCount    int       // Number of files
	Summary      string    // Brief contents summary (e.g., "12 .go, 5 .yaml, 3 .md, 2 others")
}

NonRepoDir represents a directory that is not a git repository.

func FindNonRepoDirs

func FindNonRepoDirs(rootPath string, opts Options, workers int) ([]NonRepoDir, error)

FindNonRepoDirs finds directories under rootPath that are not git repositories. It reads immediate children (respecting .katazuke index files) and returns information about each directory that is not a git repo. Work is parallelized across the given number of workers.

type Options

type Options struct {
	ExcludePatterns []string
}

Options controls non-repo detection behavior.

type RepoBranchCount added in v0.11.0

type RepoBranchCount struct {
	RepoName string
	Count    int
}

RepoBranchCount holds a per-repo branch count for detail lines.

type RepoHealth added in v0.11.0

type RepoHealth struct {
	Path            string
	IsClean         bool
	OnDefaultBranch bool
	CurrentBranch   string
	BehindRemote    int // commits behind origin, -1 if unknown
	HasRemote       bool
	ConflictState   string // "rebase", "merge", "cherry-pick", or ""
	IsMergedBranch  bool   // non-default branch merged into origin/default
}

RepoHealth captures the health status of a single repository.

func AnalyzeRepoHealth added in v0.11.0

func AnalyzeRepoHealth(repos []string, workers int) []RepoHealth

AnalyzeRepoHealth inspects repos in parallel and returns per-repo health data.

type RepoHealthSummary added in v0.11.0

type RepoHealthSummary struct {
	Total              int
	CleanUpToDate      int
	NeedsManualFix     int
	BehindRemote       int
	UncommittedChanges int
	OnNonDefaultBranch int
}

RepoHealthSummary aggregates repo health into mutually exclusive buckets. Priority: conflicted > dirty > non-default branch > behind remote > clean.

func SummarizeHealth added in v0.11.0

func SummarizeHealth(repos []RepoHealth) RepoHealthSummary

SummarizeHealth partitions repos into mutually exclusive health buckets.

Jump to

Keyboard shortcuts

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