change

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package change provides reusable logic for building PR-level change reports. Extracted from the analyze-change CLI command so the GitHub App worker can call the same pipeline programmatically.

Index

Constants

View Source
const ChangeSchemaVersion = "1.0"

ChangeSchemaVersion is the current schema version for change reports.

Variables

This section is empty.

Functions

func BuildReport

func BuildReport(idx *db.Index, cfg Config, base, head string) (*model.ChangeReport, error)

BuildReport produces a ChangeReport by diffing base..head, analyzing each changed file, and aggregating the results.

func BuildSummary

func BuildSummary(files []model.ChangedFile, perFileBlast map[string]*model.BlastRadius) model.ChangeSummary

BuildSummary creates aggregate statistics from the changed files.

func DetectCoupling

func DetectCoupling(idx *db.Index, files []string) []model.CouplingPair

DetectCoupling finds structural connections between changed files.

func DetectTestGaps

func DetectTestGaps(analyzable []string, analysis *model.AnalysisOutput) []string

DetectTestGaps finds changed files that have no direct test coverage.

func ExtractHiddenCoupling

func ExtractHiddenCoupling(analysis *model.AnalysisOutput, changedFiles map[string]bool) []model.HiddenCouplingEntry

ExtractHiddenCoupling parses hidden_coupling signals from AnalysisOutput.Related and returns entries for partners not in the changed file set.

func HasTestForFile

func HasTestForFile(file string, analysis *model.AnalysisOutput) bool

HasTestForFile checks if any test file appears to test the given file. Uses stem matching first, then falls back to same-directory matching for Go files (where any _test.go in the same package tests all files in that package).

func ParseGitStatus

func ParseGitStatus(s string) string

ParseGitStatus converts git's single-letter status code to a human-readable string. Handles: A (added), D (deleted), M (modified), R### (renamed). Defaults to "modified".

Types

type Config

type Config struct {
	RepoRoot    string
	RepoCfg     *config.Config
	AnalyzerCfg analyzer.Config
}

Config holds parameters for building a change report.

type DiffEntry

type DiffEntry struct {
	Path   string
	Status string // "added", "modified", "deleted", "renamed"
}

DiffEntry represents a file changed in a git diff.

func GitDiffFiles

func GitDiffFiles(repoRoot, base, head string) ([]DiffEntry, error)

GitDiffFiles returns the list of changed files between two refs.

func GitDiffWorkingTree added in v1.0.7

func GitDiffWorkingTree(repoRoot, base string) ([]DiffEntry, error)

GitDiffWorkingTree returns files changed in the working tree vs a base ref. This includes both staged and unstaged changes — everything that differs from base.

Jump to

Keyboard shortcuts

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