analyzer

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: 16 Imported by: 0

Documentation

Overview

Package analyzer implements the context analysis engine. It traverses the dependency graph, scores candidates, and produces a ranked context bundle per ADR-0007 and ADR-0009.

Index

Constants

View Source
const (
	// SchemaVersion is the current output schema version for analysis bundles.
	SchemaVersion = "3.2"
)

Schema and threshold constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer orchestrates graph traversal, scoring, categorization, and explanation.

func New

func New(idx *db.Index, cfg Config) *Analyzer

New creates an Analyzer.

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(filePath string) (*model.AnalysisOutput, error)

Analyze produces a context bundle for the given file path. The filePath must be repo-relative and present in the index.

func (*Analyzer) AnalyzeMulti

func (a *Analyzer) AnalyzeMulti(filePaths []string) (*model.AnalysisOutput, error)

AnalyzeMulti produces a merged context bundle for multiple files. It calls Analyze() for each file and merges the results: deduped must_read, combined likely_modify, tests, related, and conservative blast_radius.

type Caps

type Caps struct {
	MaxMustRead     int    // default 10
	MaxRelated      int    // default 10
	MaxLikelyModify int    // default 15
	MaxTests        int    // default 5
	Mode            string // workflow mode: plan, implement, review (adjusts defaults)
	TokenBudget     int    // target token budget (overrides caps to fit)
}

Caps controls the maximum number of entries in each output section. Zero values use defaults.

type Config

type Config struct {
	RepoConfig      *config.Config
	StableThreshold int    // Files with indegree >= this are marked stable. 0 = use adaptive default.
	OmitExternal    bool   // When true, omit external dependencies from output.
	Caps            Caps   // Output section caps. Zero values use defaults.
	Signatures      bool   // When true, include code signatures for must_read symbols.
	RepoRoot        string // Repository root path (required for signatures to read files).
}

Config configures the analyzer.

type MustReadEntryRef

type MustReadEntryRef struct {
	File        string
	Symbols     []string
	Definitions *[]string
}

MustReadEntryRef holds references to a MustReadEntry's fields for enrichment.

Jump to

Keyboard shortcuts

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