Documentation
¶
Overview ¶
@index Git diff 기반 변경 감지 및 리스크 점수 산출. 변경된 함수의 영향 범위를 분석한다.
Index ¶
Constants ¶
const ( DefaultGitCommandTimeout = 30 * time.Second MaxGitOutputSize = 100 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecGitClient ¶
type ExecGitClient struct{}
ExecGitClient shells out to git for change detection. @intent provide GitClient behavior using the local git executable
func NewExecGitClient ¶
func NewExecGitClient() *ExecGitClient
NewExecGitClient creates an exec-backed git client. @intent construct a GitClient that reads diffs from the local repository
func (*ExecGitClient) ChangedFiles ¶
func (g *ExecGitClient) ChangedFiles(ctx context.Context, repoDir, baseRef string) ([]string, error)
ChangedFiles lists files changed from the given base ref. @intent identify which repository paths changed since a base revision @param repoDir repository root where git commands are executed @param baseRef git revision used as the diff baseline @return changed file paths reported by git diff --name-only @sideEffect executes git diff in the target repository @requires repoDir points to a valid git working tree @ensures returned file paths are trimmed and exclude blank lines
func (*ExecGitClient) DiffHunks ¶
func (g *ExecGitClient) DiffHunks(ctx context.Context, repoDir, baseRef string, paths []string) ([]Hunk, error)
DiffHunks extracts changed line ranges for the given paths. @intent map git diff output into file-level hunk ranges for overlap analysis @param repoDir repository root where git commands are executed @param baseRef git revision used as the diff baseline @param paths repository-relative paths to limit hunk extraction @return unified diff hunks with inclusive line ranges in new files @sideEffect executes git diff with zero-context output @requires repoDir points to a valid git working tree @ensures each returned hunk has a file path and inclusive start/end lines
type GitClient ¶
type GitClient interface {
ChangedFiles(ctx context.Context, repoDir, baseRef string) ([]string, error)
DiffHunks(ctx context.Context, repoDir, baseRef string, paths []string) ([]Hunk, error)
}
GitClient provides git diff data needed for change analysis. @intent abstract git operations so risk analysis can consume changed files and hunks
type Hunk ¶
Hunk describes a changed line range within one file. @intent represent a diff segment that can be matched against graph nodes
type Result ¶
Result carries one bounded page of risk entries plus pagination metadata. @intent expose paged change-risk results while keeping legacy callers working with []RiskEntry.
type RiskEntry ¶
RiskEntry captures risk metrics for one changed node. @intent return the changed node together with overlap count and computed risk
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates git-based change detection and graph-backed scoring. @intent identify changed nodes and score how risky they are to modify
func New ¶
New creates a change analysis service. @intent wire database and git dependencies into a reusable analyzer
func (*Service) AnalyzePage ¶
func (s *Service) AnalyzePage(ctx context.Context, repoDir, baseRef string, req paging.Request) (Result, error)
AnalyzePage detects changed functions and returns one bounded page of risk entries. @intent bound handler response allocation while preserving the same sorted risk window that legacy Analyze would expose. @domainRule pagination limits returned items, but compute cost still scales with scoring every changed node to preserve legacy ordering. @domainRule entries are sorted by descending risk_score, then file_path, then qualified_name for stable ordering.
func (*Service) ChangedNodeIDs ¶
ChangedNodeIDs returns the unique graph node IDs touched by the current diff. @intent let downstream analyzers reuse change detection without paying risk-score or AnalyzePage pagination-loop costs. @sideEffect executes git diff via GitClient. @ensures returned IDs are deterministic by file path, start line, qualified name, then node ID.