analyzer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 16 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 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