change

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 12 Imported by: 0

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.

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.

Jump to

Keyboard shortcuts

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