Documentation
¶
Index ¶
- Constants
- Variables
- func AnalyzeInterfaceImplementations(prog *ssa.Program) map[string][]string
- func AnonymizeNode(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language, ...) string
- func ApplyPipeline(ctx context.Context, f *filter.Filter, input string, ...) (string, error)
- func BatchLoadPackages(dir string) (map[string]*ParsedPackageData, error)
- func EncodeZON(slice interface{}) (string, error)
- func EncodeZONImpact(res *types.ImpactResult) string
- func EncodeZONLSPHover(hover *lsp.Hover) (string, error)
- func EncodeZONLSPLocation(locs []lsp.Location) (string, error)
- func EncodeZONNeighborhood(filePath string, imports []string, exports []store.Symbol, calls []store.Call) string
- func EncodeZONPredict(tests []types.TestTarget) string
- func EncodeZONVerify(diff *ChronosDiff) string
- func ExtractImports(ctx context.Context, filePath string) ([]string, error)
- func GetLogicHash(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language) string
- func GetStructuralHash(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language) string
- func ParseFile(ctx context.Context, filePath string, lspMgr *lsp.Manager) ([]types.ASTPointer, []types.ASTCall, []types.DataFlow, error)
- func ParseGoMod(ctx context.Context, filePath string) ([]types.Dependency, error)
- func ParsePackageJSON(ctx context.Context, filePath string) ([]types.Dependency, error)
- func Passthrough(ctx context.Context, command string, args []string) (int, error)
- func ReadFragment(ctx context.Context, filePath string, r types.Range) (string, error)
- func SSACallGraph(ctx context.Context, dir string) ([]types.ASTCall, error)
- func StreamSymbols(ctx context.Context, filePath string) (iter.Seq[types.ASTPointer], iter.Seq[types.ASTCall], iter.Seq[types.DataFlow], ...)
- func StreamSymbolsFromAST(ctx context.Context, fset *token.FileSet, astFile *ast.File, ...) (iter.Seq[types.ASTPointer], iter.Seq[types.ASTCall], iter.Seq[types.DataFlow], ...)
- func StreamWithTreeSitter(ctx context.Context, filePath string) (iter.Seq[types.ASTPointer], iter.Seq[types.ASTCall], iter.Seq[types.DataFlow], ...)
- func StructuralRefactor(ctx context.Context, filePath, pattern, template, ext string) (string, error)
- type ASTRuleEngine
- type AnalysisEngine
- func (a *AnalysisEngine) BuildTypeUniverse() (map[string]*types.Package, error)
- func (a *AnalysisEngine) GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
- func (a *AnalysisEngine) GetNeighborhood(ctx context.Context, filePath string) (string, error)
- func (a *AnalysisEngine) ResolveCentrality(ctx context.Context) error
- func (a *AnalysisEngine) ResolveInterfaces(ctx context.Context) error
- func (a *AnalysisEngine) ResolvePagerank(ctx context.Context, opts ...PagerankOption) error
- type AnalysisStore
- type AnalyzeOption
- type AnalyzeOptions
- type BFSPropagationStrategy
- type BuildValidator
- type CentralityValidator
- type ChronosDiff
- type ChronosEngine
- type ChronosSnapshot
- type ChurnEngine
- type ChurnStore
- type CompactionEngine
- type DiagnosticEngine
- func (e *DiagnosticEngine) AssessRisk(ctx context.Context, symbol, path string) (*RiskAssessment, error)
- func (e *DiagnosticEngine) Diagnose(ctx context.Context, errorLog string) (*DiagnosticReport, error)
- func (e *DiagnosticEngine) Heal(ctx context.Context, report *DiagnosticReport, messenger Messenger) (*types.HealResult, error)
- type DiagnosticHUD
- type DiagnosticProvider
- type DiagnosticReport
- type DiscoveryService
- type Enricher
- type EnricherStore
- type EvolutionService
- type GraphStore
- type HealerEngine
- type HealerService
- type HealthEngine
- type HybridSearcher
- type ImpactAnalyzer
- type ImpactEngine
- func (e *ImpactEngine) Analyze(ctx context.Context, symbol string, path string, maxDepth int, ...) (*types.ImpactResult, error)
- func (e *ImpactEngine) GetDeterministicCallers(ctx context.Context, symbolName string) ([]store.Call, error)
- func (e *ImpactEngine) IdentifyCriticalContext(ctx context.Context, diff string) ([]types.ImpactEntity, error)
- func (e *ImpactEngine) PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
- type IndexerConfig
- type IndexerPipeline
- type IndexerService
- type IntelligenceService
- type LSPProvider
- type LSPValidator
- type LanguageConfig
- type Ledger
- func (l *Ledger) AffectedFiles() []string
- func (l *Ledger) CommitStaged(ctx context.Context) error
- func (l *Ledger) GetStaged() []Patch
- func (l *Ledger) IncrementTurn()
- func (l *Ledger) Load() error
- func (l *Ledger) Rollback(ctx context.Context) error
- func (l *Ledger) Save() error
- func (l *Ledger) SetBudget(kiLimit int64, turnLimit int)
- func (l *Ledger) SetLedgerPath(path string)
- func (l *Ledger) Stage(path string, patch Patch) error
- func (l *Ledger) StagedFiles() []string
- func (l *Ledger) Summary() string
- func (l *Ledger) Unstage(path string)
- type LineProvenance
- type Linker
- type LocalFileResolver
- type MCPTransformer
- type Messenger
- type MissionStats
- type PagerankOption
- type PagerankOptions
- type ParsedPackageData
- type Patch
- type Pipeline
- type PropagationStrategy
- type PropagationTask
- type Result
- type RippleEngine
- type RiskAssessment
- type SDDEngine
- type SDDRoadmap
- type SDDService
- type SDDTask
- type SearchEngine
- type SemanticEngine
- type SovereignBoundary
- type SpecResult
- type StructuralMatch
- type StructuralTransformer
- type TestResultStore
- type TestValidator
- type TransactionalStore
- type Transformer
- type TruthEngine
- func (e *TruthEngine) AnalyzeImpact(ctx context.Context, symbol, path string, verbose bool, messenger Messenger) (*types.ImpactResult, error)
- func (e *TruthEngine) CommitLedger(ctx context.Context) (string, error)
- func (e *TruthEngine) Compact() *CompactionEngine
- func (e *TruthEngine) CompactSession(ctx context.Context, log string) (*types.CompactionResult, error)
- func (e *TruthEngine) DiagnoseHUD(ctx context.Context, errorLog string) (*DiagnosticHUD, error)
- func (e *TruthEngine) FindLogicalTwins(ctx context.Context, symbolName, path string) ([]types.Symbol, error)
- func (e *TruthEngine) Fix(ctx context.Context, errorLog string, messenger Messenger) (string, error)
- func (e *TruthEngine) GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
- func (e *TruthEngine) GetLedgerDiff(ctx context.Context) (string, error)
- func (e *TruthEngine) GetLedgerSummary(ctx context.Context) string
- func (e *TruthEngine) GetNeighborhood(ctx context.Context, filePath string) (string, error)
- func (e *TruthEngine) GetSDDRoadmap(ctx context.Context) (*SDDRoadmap, error)
- func (e *TruthEngine) GetSDDTasks(ctx context.Context) ([]SDDTask, error)
- func (e *TruthEngine) Healer() *HealerEngine
- func (e *TruthEngine) HybridSearch(ctx context.Context, query string, limit, offset int) (*types.HybridSearchResult, error)
- func (e *TruthEngine) IdentifyCriticalContext(ctx context.Context, diff string) ([]types.ImpactEntity, error)
- func (e *TruthEngine) Index(ctx context.Context, path string) error
- func (e *TruthEngine) MemoryProvider() memory.MemoryProvider
- func (e *TruthEngine) PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
- func (e *TruthEngine) Propagate(ctx context.Context, symbol, transformation string, messenger Messenger) (string, error)
- func (e *TruthEngine) RollbackLedger(ctx context.Context) (string, error)
- func (e *TruthEngine) SearchSDDSpecs(ctx context.Context, query string, limit, offset int) ([]SpecResult, error)
- func (e *TruthEngine) SemanticSearch(ctx context.Context, query string, limit int) ([]types.Symbol, error)
- func (e *TruthEngine) StageMutation(ctx context.Context, filePath, newContent string) error
- type TruthOption
- func WithASTRules(a *ASTRuleEngine) TruthOption
- func WithAnalyzer(a *AnalysisEngine) TruthOption
- func WithCompact(c *CompactionEngine) TruthOption
- func WithDiagnostic(d *DiagnosticEngine) TruthOption
- func WithHealer(h *HealerEngine) TruthOption
- func WithImpact(i *ImpactEngine) TruthOption
- func WithLSP(l *lsp.Manager) TruthOption
- func WithLedger(l *Ledger) TruthOption
- func WithMemory(m memory.MemoryProvider) TruthOption
- func WithMessenger(m Messenger) TruthOption
- func WithRipple(r *RippleEngine) TruthOption
- func WithSDD(s *SDDEngine) TruthOption
- func WithSearch(s *SearchEngine) TruthOption
- func WithSemantic(s *SemanticEngine) TruthOption
- type ValidationResult
- type Validator
Constants ¶
const MaxFragmentSize = 100 * 1024
MaxFragmentSize is the limit for a surgical read (100KB)
const MaxParseSize = 5 * 1024 * 1024
MaxParseSize is the limit for indexing a file (5MB)
Variables ¶
var ( BlockedDirs = map[string]bool{ ".git": true, ".scouter": true, "node_modules": true, "vendor": true, } SupportedExts = map[string]bool{ ".go": true, ".ts": true, ".tsx": true, ".js": true, ".jsx": true, ".py": true, } )
var ErrEmptySource = errors.New("source file is empty")
ErrEmptySource indicates the resolved file contains no data.
Functions ¶
func AnalyzeInterfaceImplementations ¶
AnalyzeInterfaceImplementations finds all concrete implementations of interfaces.
func AnonymizeNode ¶
func AnonymizeNode(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language, includeBody bool) string
AnonymizeNode traverses the tree from the given node and returns an anonymized S-Expression. It masks identifiers and literals to preserve only the structural logic. When includeBody is false, function/method bodies are skipped (signature-only hash). When includeBody is true, bodies are included (full logic hash).
func ApplyPipeline ¶
func ApplyPipeline(ctx context.Context, f *filter.Filter, input string, resolver filter.SourceResolver) (string, error)
ApplyPipeline executes filter actions sequentially.
func BatchLoadPackages ¶
func BatchLoadPackages(dir string) (map[string]*ParsedPackageData, error)
func EncodeZON ¶
EncodeZON implements a minimal ZON (Zero Overhead Notation) table encoder. It converts slices of structs into a token-efficient tabular format for LLMs, saving 35-70% of tokens compared to JSON.
func EncodeZONImpact ¶
func EncodeZONImpact(res *types.ImpactResult) string
func EncodeZONNeighborhood ¶
func EncodeZONNeighborhood(filePath string, imports []string, exports []store.Symbol, calls []store.Call) string
EncodeZONNeighborhood formats a 1-hop structural neighborhood (imports, exports, calls) into ZON format.
func EncodeZONPredict ¶
func EncodeZONPredict(tests []types.TestTarget) string
func EncodeZONVerify ¶
func EncodeZONVerify(diff *ChronosDiff) string
func GetLogicHash ¶
func GetLogicHash(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language) string
GetLogicHash generates a SHA-256 hash including the function body for detecting internal logic changes.
func GetStructuralHash ¶
func GetStructuralHash(node *gotreesitter.Node, source []byte, lang *gotreesitter.Language) string
GetStructuralHash generates a SHA-256 hash of the anonymized structural representation (signature only).
func ParseFile ¶
func ParseFile(ctx context.Context, filePath string, lspMgr *lsp.Manager) ([]types.ASTPointer, []types.ASTCall, []types.DataFlow, error)
ParseFile analyzes a file using the AST engine to index its structure and call graph. It is now a wrapper around StreamSymbols for backward compatibility.
func ParseGoMod ¶
ParseGoMod reads a go.mod file and extracts its dependencies.
func ParsePackageJSON ¶
ParsePackageJSON reads a package.json file and extracts its dependencies.
func Passthrough ¶
Passthrough runs a command with inherited stdio (no capture).
func ReadFragment ¶
ReadFragment reads a specific code fragment from a file within the given range.
func SSACallGraph ¶
SSACallGraph generates a high-precision call graph using SSA and CHA.
func StreamSymbols ¶
func StreamSymbols(ctx context.Context, filePath string) (iter.Seq[types.ASTPointer], iter.Seq[types.ASTCall], iter.Seq[types.DataFlow], error)
StreamSymbols analyzes a file and returns iterators for symbols, calls and data flows. Optimized for Go 1.25 to avoid large slice allocations.
func StreamSymbolsFromAST ¶
func StreamWithTreeSitter ¶
Types ¶
type ASTRuleEngine ¶
type ASTRuleEngine struct {
// contains filtered or unexported fields
}
ASTRuleEngine executes architectural rules using ast-grep.
func NewASTRuleEngine ¶
func NewASTRuleEngine(rulesDir string) *ASTRuleEngine
NewASTRuleEngine creates a new engine pointing to the rules directory.
func (*ASTRuleEngine) Audit ¶
func (e *ASTRuleEngine) Audit(ctx context.Context, targetPath string) ([]types.ASTRuleMatch, error)
Audit runs all rules in the rules directory against a specific file or directory.
func (*ASTRuleEngine) GetRules ¶
func (e *ASTRuleEngine) GetRules() ([]string, error)
GetRules returns a list of available rule files.
type AnalysisEngine ¶
type AnalysisEngine struct {
ProjectRoot string
// contains filtered or unexported fields
}
func NewAnalysisEngine ¶
func NewAnalysisEngine(store AnalysisStore) *AnalysisEngine
func (*AnalysisEngine) BuildTypeUniverse ¶
func (a *AnalysisEngine) BuildTypeUniverse() (map[string]*types.Package, error)
func (*AnalysisEngine) GetCriticalSymbols ¶
func (a *AnalysisEngine) GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
func (*AnalysisEngine) GetNeighborhood ¶
func (*AnalysisEngine) ResolveCentrality ¶
func (a *AnalysisEngine) ResolveCentrality(ctx context.Context) error
func (*AnalysisEngine) ResolveInterfaces ¶
func (a *AnalysisEngine) ResolveInterfaces(ctx context.Context) error
func (*AnalysisEngine) ResolvePagerank ¶
func (a *AnalysisEngine) ResolvePagerank(ctx context.Context, opts ...PagerankOption) error
type AnalysisStore ¶
type AnalysisStore interface {
store.SymbolRegistry
store.StructuralGraph
store.DiagnosticStore
store.TransactionManager
}
AnalysisStore defines the data requirements for the AnalysisEngine.
type AnalyzeOption ¶
type AnalyzeOption func(*AnalyzeOptions)
func WithSSA ¶
func WithSSA(targetPkg, varName string) AnalyzeOption
type AnalyzeOptions ¶
type BFSPropagationStrategy ¶
type BFSPropagationStrategy struct {
ImpactEngine ImpactAnalyzer
// contains filtered or unexported fields
}
BFSPropagationStrategy implements PropagationStrategy using BFS traversal.
func NewBFSPropagationStrategy ¶
func NewBFSPropagationStrategy(s GraphStore, ie ImpactAnalyzer) *BFSPropagationStrategy
NewBFSPropagationStrategy creates a new breadth-first propagation strategy.
type BuildValidator ¶
type BuildValidator struct{}
BuildValidator ensures the project still builds after changes.
func (*BuildValidator) Validate ¶
func (v *BuildValidator) Validate(ctx context.Context, ledger *Ledger) (ValidationResult, error)
type CentralityValidator ¶
type CentralityValidator struct {
// contains filtered or unexported fields
}
CentralityValidator detects architectural regressions via centrality spikes.
func NewCentralityValidator ¶
func NewCentralityValidator(a *AnalysisEngine) *CentralityValidator
func (*CentralityValidator) Validate ¶
func (v *CentralityValidator) Validate(ctx context.Context, ledger *Ledger) (ValidationResult, error)
type ChronosDiff ¶
type ChronosDiff struct {
MissingSymbols []string // Symbols that existed before but were deleted
MangledSymbols []string // Symbols whose structural hash changed (broken syntax/logic)
AddedSymbols []string // New symbols added
Unchanged int // Number of symbols that remained perfectly intact
}
ChronosDiff represents the structural differences found after an edit.
type ChronosEngine ¶
type ChronosEngine struct{}
func NewChronosEngine ¶
func NewChronosEngine() *ChronosEngine
func (*ChronosEngine) CompareSnapshot ¶
func (e *ChronosEngine) CompareSnapshot(ctx context.Context, snapshot *ChronosSnapshot, currentFilePath string) (*ChronosDiff, error)
CompareSnapshot verifies a file against a previously taken snapshot.
func (*ChronosEngine) TakeSnapshot ¶
func (e *ChronosEngine) TakeSnapshot(ctx context.Context, filePath string) (*ChronosSnapshot, error)
TakeSnapshot reads a file and captures its structural AST hashes.
type ChronosSnapshot ¶
type ChronosSnapshot struct {
ID string
FilePath string
Symbols map[string]types.ASTPointer // Key: Symbol Name
Timestamp time.Time
}
ChronosSnapshot represents a point-in-time structural map of a file.
type ChurnEngine ¶
type ChurnEngine struct {
// contains filtered or unexported fields
}
ChurnEngine analyzes the git history to identify tectonic plates (co-changing files).
func NewChurnEngine ¶
func NewChurnEngine(s ChurnStore) *ChurnEngine
func (*ChurnEngine) AnalyzeChurn ¶
AnalyzeChurn calculates the co-change metrics and updates the store.
type ChurnStore ¶
type ChurnStore interface {
store.SymbolRegistry
store.TransactionManager
}
ChurnStore defines the data requirements for the ChurnEngine.
type CompactionEngine ¶
type CompactionEngine struct {
Ledger *Ledger
// contains filtered or unexported fields
}
CompactionEngine handles context hygiene and latent memory anchoring.
func NewCompactionEngine ¶
func NewCompactionEngine(s store.Store, l *Ledger) *CompactionEngine
func (*CompactionEngine) CompactSession ¶
func (e *CompactionEngine) CompactSession(ctx context.Context, truthKernel string) (*types.CompactionResult, error)
CompactSession persists a boundary and provides the resumption prompt.
func (*CompactionEngine) CreateBoundary ¶
func (e *CompactionEngine) CreateBoundary(ctx context.Context, truthKernel string) (*SovereignBoundary, error)
CreateBoundary generates a dense checkpoint of the current engine state.
func (*CompactionEngine) PruneHistory ¶
func (e *CompactionEngine) PruneHistory(toolResults []string) []string
PruneHistory reduces the token weight of tool results while preserving signal.
type DiagnosticEngine ¶
type DiagnosticEngine struct {
// contains filtered or unexported fields
}
DiagnosticEngine implements DiagnosticProvider by orchestrating specialized engines.
func NewDiagnosticEngine ¶
func NewDiagnosticEngine( s store.DiagnosticStore, a *AnalysisEngine, i *ImpactEngine, h *HealerEngine, l *lsp.Manager, ) *DiagnosticEngine
func (*DiagnosticEngine) AssessRisk ¶
func (e *DiagnosticEngine) AssessRisk(ctx context.Context, symbol, path string) (*RiskAssessment, error)
AssessRisk provides a unified risk assessment.
func (*DiagnosticEngine) Diagnose ¶
func (e *DiagnosticEngine) Diagnose(ctx context.Context, errorLog string) (*DiagnosticReport, error)
Diagnose parses logs and enriches the failure context.
func (*DiagnosticEngine) Heal ¶
func (e *DiagnosticEngine) Heal(ctx context.Context, report *DiagnosticReport, messenger Messenger) (*types.HealResult, error)
Heal delegates the actual fix to the HealerEngine using the enriched report.
type DiagnosticHUD ¶
type DiagnosticHUD struct {
FailingSymbol string
LastCommit string
RiskLevel string
RiskScore float64
BlastRadius int
SimilarPatternPath string
}
DiagnosticHUD representa la visión térmica/estructural del motor de diagnóstico.
type DiagnosticProvider ¶
type DiagnosticProvider interface {
Diagnose(ctx context.Context, errorLog string) (*DiagnosticReport, error)
Heal(ctx context.Context, report *DiagnosticReport, messenger Messenger) (*types.HealResult, error)
AssessRisk(ctx context.Context, symbol, path string) (*RiskAssessment, error)
}
DiagnosticProvider defines the deep interface for technical quality operations.
type DiagnosticReport ¶
type DiagnosticReport struct {
FailingSymbol string
FailingFile string
Line int
ErrorLog string
Context string
Risk *types.ImpactResult
Insights []string // Historical insights from Engram
}
DiagnosticReport represents the "Technical Truth" kernel of a failure.
type DiscoveryService ¶ added in v1.1.0
type Enricher ¶
type Enricher struct {
// contains filtered or unexported fields
}
Enricher coordinates semantic enrichment of the call graph using LSP.
func NewEnricher ¶
func NewEnricher(s EnricherStore, lp LSPProvider) *Enricher
type EnricherStore ¶
type EnricherStore interface {
store.SymbolRegistry
store.StructuralGraph
store.TransactionManager
}
EnricherStore defines the data requirements for the Enricher.
type EvolutionService ¶ added in v1.1.0
type EvolutionService interface {
Propagate(ctx context.Context, symbol, transformation string, messenger Messenger) (string, error)
CommitLedger(ctx context.Context) (string, error)
RollbackLedger(ctx context.Context) (string, error)
GetLedgerDiff(ctx context.Context) (string, error)
GetLedgerSummary(ctx context.Context) string
StageMutation(ctx context.Context, filePath, newContent string) error
}
type GraphStore ¶
type GraphStore interface {
store.SymbolRegistry
store.StructuralGraph
}
GraphStore defines the core read-only graph traversal capabilities.
type HealerEngine ¶
type HealerEngine struct {
Ledger *Ledger
// Bridge to MCP sampling
DoFixRequest func(ctx context.Context, prompt string) (string, error)
Search *SearchEngine
// contains filtered or unexported fields
}
HealerEngine manages the autonomous RCA -> Fix -> Verify loop using the Shinigami Protocol.
func NewHealerEngine ¶
func NewHealerEngine(s TransactionalStore, l *lsp.Manager, a *AnalysisEngine, i *ImpactEngine, search *SearchEngine, mem memory.MemoryProvider) *HealerEngine
func (*HealerEngine) DiagnoseHUD ¶
func (e *HealerEngine) DiagnoseHUD(ctx context.Context, errorLog string) (*DiagnosticHUD, error)
DiagnoseHUD ejecuta la visión de diagnóstico combinando Git, AST, Impacto y Bleve. Retorna la representación del HUD en formato ZON.
func (*HealerEngine) Fix ¶
func (e *HealerEngine) Fix(ctx context.Context, errorLog string) (*types.HealResult, error)
Fix attempts to repair a test failure using the Shinigami Protocol (Solver-Verifier).
type HealerService ¶ added in v1.1.0
type HealthEngine ¶
type HealthEngine struct {
// contains filtered or unexported fields
}
func NewHealthEngine ¶
func NewHealthEngine(store TestResultStore) *HealthEngine
type HybridSearcher ¶
type HybridSearcher struct {
// contains filtered or unexported fields
}
HybridSearcher wraps Bleve to provide BM25 + Vector ranking (RRF) capabilities.
func NewHybridSearcher ¶
func NewHybridSearcher() (*HybridSearcher, error)
NewHybridSearcher initializes a new in-memory Bleve index for fast, session-based hybrid searching.
func (*HybridSearcher) IndexSymbol ¶
func (s *HybridSearcher) IndexSymbol(id string, data map[string]interface{}) error
IndexSymbol adds a structural symbol to the search engine.
func (*HybridSearcher) SearchBM25 ¶
func (s *HybridSearcher) SearchBM25(queryStr string, limit int) (*bleve.SearchResult, error)
SearchBM25 executes a fast text-relevance search.
type ImpactAnalyzer ¶
type ImpactAnalyzer interface {
GetDeterministicCallers(ctx context.Context, symbolName string) ([]store.Call, error)
}
ImpactAnalyzer abstracts the capabilities of the ImpactEngine required by other engines.
type ImpactEngine ¶
func NewImpactEngine ¶
func NewImpactEngine(s GraphStore, lm *lsp.Manager, mem memory.MemoryProvider) *ImpactEngine
func (*ImpactEngine) Analyze ¶
func (e *ImpactEngine) Analyze(ctx context.Context, symbol string, path string, maxDepth int, opts ...AnalyzeOption) (*types.ImpactResult, error)
Analyze performs a deep impact analysis for a given symbol.
func (*ImpactEngine) GetDeterministicCallers ¶
func (*ImpactEngine) IdentifyCriticalContext ¶
func (e *ImpactEngine) IdentifyCriticalContext(ctx context.Context, diff string) ([]types.ImpactEntity, error)
IdentifyCriticalContext finds high-risk symbols affected by the current diff.
func (*ImpactEngine) PredictTests ¶
func (e *ImpactEngine) PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
PredictTests identifies tests affected by changes described in the diff string.
type IndexerConfig ¶ added in v1.1.0
type IndexerConfig struct {
Store store.Store
Semantic *SemanticEngine
Analyzer *AnalysisEngine
Search *SearchEngine
ASTRules *ASTRuleEngine
Logger *slog.Logger
}
type IndexerPipeline ¶ added in v1.1.0
type IndexerPipeline struct {
// contains filtered or unexported fields
}
func NewIndexerPipeline ¶ added in v1.1.0
func NewIndexerPipeline(cfg IndexerConfig) *IndexerPipeline
type IndexerService ¶ added in v1.1.0
type IntelligenceService ¶ added in v1.1.0
type IntelligenceService interface {
AnalyzeImpact(ctx context.Context, symbol, path string, verbose bool, messenger Messenger) (*types.ImpactResult, error)
GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
}
type LSPProvider ¶
type LSPProvider interface {
GetClient(ctx context.Context, filePath string) (lsp.LSPClient, error)
}
LSPProvider defines the requirement for retrieving an LSP client.
type LSPValidator ¶
type LSPValidator struct {
ProjectRoot string
}
LSPValidator uses go/packages with Overlays to perform zero-disk verification of interface implementations across the entire workspace.
func NewLSPValidator ¶
func NewLSPValidator(root string) *LSPValidator
func (*LSPValidator) Validate ¶
func (v *LSPValidator) Validate(ctx context.Context, ledger *Ledger) (ValidationResult, error)
type LanguageConfig ¶
type LanguageConfig struct {
Language *gotreesitter.Language
Query *gotreesitter.Query
CallQuery *gotreesitter.Query
ImportQuery *gotreesitter.Query
FlowQuery *gotreesitter.Query
}
type Ledger ¶
type Ledger struct {
Staged map[string]Patch `json:"staged"`
Stats MissionStats `json:"stats"`
KiLimit int64 `json:"ki_limit"`
TurnLimit int `json:"turn_limit"`
Project string `json:"project"`
// contains filtered or unexported fields
}
Ledger holds staged changes and mission metrics.
func (*Ledger) AffectedFiles ¶
AffectedFiles is an alias for StagedFiles.
func (*Ledger) CommitStaged ¶
CommitStaged applies all staged changes to the filesystem atomically using a two-phase commit.
func (*Ledger) IncrementTurn ¶
func (l *Ledger) IncrementTurn()
IncrementTurn advances the mission turn counter.
func (*Ledger) SetLedgerPath ¶
SetLedgerPath updates the persistence path and attempts to load it.
func (*Ledger) StagedFiles ¶
StagedFiles returns the list of paths in the ledger.
type LineProvenance ¶
LineProvenance tracks the origin of a specific line.
func GetFileProvenance ¶
func GetFileProvenance(ctx context.Context, repoPath, filePath string) ([]LineProvenance, error)
GetFileProvenance performs a deep blame analysis using go-git to reconstruct the evolutionary narrative of a file.
type LocalFileResolver ¶
type LocalFileResolver struct{}
LocalFileResolver implements filter.SourceResolver for local filesystem reads.
func (*LocalFileResolver) ResolveSource ¶
func (r *LocalFileResolver) ResolveSource(ctx context.Context, file string, line int) (string, error)
ResolveSource fetches a context window around a specific line in a file. It returns a 5-line window (2 before, 2 after the target line).
type MCPTransformer ¶
type MCPTransformer struct {
DoTransform func(ctx context.Context, file, symbol, transformation string) (string, error)
// contains filtered or unexported fields
}
MCPTransformer implements Transformer using MCP Sampling.
func NewMCPTransformer ¶
func NewMCPTransformer(s GraphStore, bridge func(context.Context, string, string, string) (string, error)) *MCPTransformer
type Messenger ¶
type Messenger interface {
Ask(ctx context.Context, systemPrompt string, userPrompt string) (string, error)
}
Messenger defines the interface for the TruthEngine to communicate with the user via the underlying protocol (e.g., MCP Sampling).
type MissionStats ¶
type MissionStats struct {
StartTime time.Time `json:"start_time"`
TotalKi int64 `json:"total_ki"` // Token usage (approximated)
TurnCount int `json:"turn_count"` // Number of iterations
FilesCount int `json:"files_count"`
}
MissionStats tracks the resource consumption of the current operation.
type PagerankOption ¶
type PagerankOption func(*PagerankOptions)
func WithTaskSeeds ¶
func WithTaskSeeds(seeds []string) PagerankOption
type PagerankOptions ¶
type PagerankOptions struct {
TaskSeeds []string
}
type ParsedPackageData ¶
type Patch ¶
type Patch struct {
FilePath string `json:"file_path"`
Original string `json:"original,omitempty"`
NewContent string `json:"new_content"`
Diff string `json:"diff,omitempty"`
}
Patch represents a pending file modification.
type Pipeline ¶
type Pipeline struct {
Registry *filter.Registry
Tracker *telemetry.Tracker
LSPManager *lsp.Manager
TeeConfig tee.Config
Verbose int
GainLevel int // 0: compact, 1: signal (SNR), 2: raw
UltraCompact bool
Enrich bool
// contains filtered or unexported fields
}
Pipeline orchestrates command execution, filtering, tracking, and tee.
func (*Pipeline) PassiveHealthIngest ¶
PassiveHealthIngest parses test results from stdout and updates the risk map.
func (*Pipeline) Passthrough ¶
Passthrough runs a command directly without filtering.
func (*Pipeline) ShadowIndex ¶
ShadowIndex re-indexes files modified by the current execution.
type PropagationStrategy ¶
type PropagationStrategy interface {
Discover(ctx context.Context, startSymbol string, depth int) iter.Seq2[PropagationTask, error]
}
PropagationStrategy defines the traversal logic for symbol discovery.
type PropagationTask ¶
type PropagationTask struct {
SymbolName string // Local name for matching (e.g., "Greet")
ImpactedSymbol string // FQN of the impacted symbol (e.g., "tests.S1.Greet")
FilePath string
Action string
}
PropagationTask represents a single unit of work in the ripple propagation.
type RippleEngine ¶
type RippleEngine struct {
Transformer Transformer
ImpactEngine ImpactAnalyzer
Strategy PropagationStrategy
Validators []Validator
// contains filtered or unexported fields
}
func NewRippleEngine ¶
func NewRippleEngine(s GraphStore, t Transformer, ie ImpactAnalyzer) *RippleEngine
type RiskAssessment ¶
type RiskAssessment struct {
Symbol string
Path string
RiskScore float64
Centrality int
Callers int
RiskLevel string
}
RiskAssessment consolidates centrality and blast radius metrics.
type SDDEngine ¶
type SDDEngine struct {
// contains filtered or unexported fields
}
SDDEngine handles parsing and searching of SDD artifacts.
func NewSDDEngine ¶
NewSDDEngine creates a new instance of SDDEngine.
func (*SDDEngine) ParseRoadmap ¶
func (e *SDDEngine) ParseRoadmap(ctx context.Context) (*SDDRoadmap, error)
ParseRoadmap reads and parses the openspec/state.yaml file.
func (*SDDEngine) ParseTasks ¶
ParseTasks reads and parses tasks from openspec/tasks.md.
func (*SDDEngine) SearchSpecs ¶
func (e *SDDEngine) SearchSpecs(ctx context.Context, query string, limit, offset int) ([]SpecResult, error)
SearchSpecs searches for specifications in openspec/specs/ matching the query.
type SDDRoadmap ¶
type SDDRoadmap struct {
Phase string `yaml:"phase" json:"phase"`
Trajectory []string `yaml:"trajectory" json:"trajectory"`
ActiveChanges []string `yaml:"active_changes" json:"active_changes"`
}
SDDRoadmap represents the project trajectory and current phase.
type SDDService ¶ added in v1.1.0
type SearchEngine ¶
type SearchEngine struct {
Bleve *HybridSearcher
// contains filtered or unexported fields
}
SearchEngine unifies AST structural search with Engram historical insights.
func NewSearchEngine ¶
func NewSearchEngine(s store.SymbolRegistry, m memory.MemoryProvider) *SearchEngine
func (*SearchEngine) HybridSearch ¶
func (e *SearchEngine) HybridSearch(ctx context.Context, query string, limit, offset int) (*types.HybridSearchResult, error)
HybridSearch executes parallel lookups in the AST, Bleve, and Engram databases.
func (*SearchEngine) IndexSymbol ¶
func (e *SearchEngine) IndexSymbol(docID string, data map[string]interface{}) error
type SemanticEngine ¶
type SemanticEngine struct {
// contains filtered or unexported fields
}
func (*SemanticEngine) GenerateEmbedding ¶
type SovereignBoundary ¶
type SovereignBoundary struct {
ID string `json:"boundary_id"`
TruthKernel string `json:"truth_kernel"` // Dense summary of discoveries
StagingArea map[string]Patch `json:"staging_area"` // Current Ledger state
Budget MissionStats `json:"budget"` // Ki/Turns consumption
Timestamp string `json:"timestamp"`
}
SovereignBoundary represents a technical checkpoint in the conversation.
type SpecResult ¶
SpecResult represents a search result for a specification.
type StructuralMatch ¶
type StructuralMatch struct {
Path string `json:"path"`
Range types.Range `json:"range"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Content string `json:"content"`
Captures map[string]string `json:"captures"`
}
func StructuralSearch ¶
func StructuralSearch(ctx context.Context, rootPath, pattern, ext string) ([]StructuralMatch, error)
func StructuralSearchWithRule ¶
func StructuralSearchWithRule(ctx context.Context, rootPath string, rule types.StructuralRule, ext string) ([]StructuralMatch, error)
type StructuralTransformer ¶
type StructuralTransformer struct {
Pattern string
}
StructuralTransformer implements Transformer using structural search and replace.
type TestResultStore ¶
type TestResultStore interface {
SaveTestResult(ctx context.Context, res *types.TestResult) error
}
type TestValidator ¶
type TestValidator struct {
SpecificTests []string
}
TestValidator ensures relevant tests still pass.
func (*TestValidator) Validate ¶
func (v *TestValidator) Validate(ctx context.Context, ledger *Ledger) (ValidationResult, error)
type TransactionalStore ¶
type TransactionalStore interface {
GraphStore
store.DiagnosticStore
store.TransactionManager
}
TransactionalStore defines the complete contract required by HealerEngine.
type Transformer ¶
type Transformer interface {
Transform(ctx context.Context, file string, symbolName string, transformation string) (string, error)
}
Transformer defines how to modify a file based on a symbolic change.
type TruthEngine ¶
type TruthEngine struct {
// contains filtered or unexported fields
}
TruthEngine is the central orchestrator for all "truth-seeking" operations. It decouples the MCP handlers from the core logic and manages the coordination between different specialized engines.
func NewTruthEngine ¶
func NewTruthEngine(store store.Store, opts ...TruthOption) *TruthEngine
NewTruthEngine initializes a new TruthEngine with its dependencies.
func (*TruthEngine) AnalyzeImpact ¶
func (e *TruthEngine) AnalyzeImpact(ctx context.Context, symbol, path string, verbose bool, messenger Messenger) (*types.ImpactResult, error)
func (*TruthEngine) CommitLedger ¶
func (e *TruthEngine) CommitLedger(ctx context.Context) (string, error)
func (*TruthEngine) Compact ¶
func (e *TruthEngine) Compact() *CompactionEngine
func (*TruthEngine) CompactSession ¶
func (e *TruthEngine) CompactSession(ctx context.Context, log string) (*types.CompactionResult, error)
func (*TruthEngine) DiagnoseHUD ¶ added in v1.1.0
func (e *TruthEngine) DiagnoseHUD(ctx context.Context, errorLog string) (*DiagnosticHUD, error)
func (*TruthEngine) FindLogicalTwins ¶
func (*TruthEngine) GetCriticalSymbols ¶
func (e *TruthEngine) GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
func (*TruthEngine) GetLedgerDiff ¶
func (e *TruthEngine) GetLedgerDiff(ctx context.Context) (string, error)
func (*TruthEngine) GetLedgerSummary ¶
func (e *TruthEngine) GetLedgerSummary(ctx context.Context) string
func (*TruthEngine) GetNeighborhood ¶
func (*TruthEngine) GetSDDRoadmap ¶
func (e *TruthEngine) GetSDDRoadmap(ctx context.Context) (*SDDRoadmap, error)
func (*TruthEngine) GetSDDTasks ¶
func (e *TruthEngine) GetSDDTasks(ctx context.Context) ([]SDDTask, error)
func (*TruthEngine) Healer ¶
func (e *TruthEngine) Healer() *HealerEngine
func (*TruthEngine) HybridSearch ¶
func (e *TruthEngine) HybridSearch(ctx context.Context, query string, limit, offset int) (*types.HybridSearchResult, error)
func (*TruthEngine) IdentifyCriticalContext ¶
func (e *TruthEngine) IdentifyCriticalContext(ctx context.Context, diff string) ([]types.ImpactEntity, error)
func (*TruthEngine) MemoryProvider ¶
func (e *TruthEngine) MemoryProvider() memory.MemoryProvider
func (*TruthEngine) PredictTests ¶
func (e *TruthEngine) PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
func (*TruthEngine) RollbackLedger ¶
func (e *TruthEngine) RollbackLedger(ctx context.Context) (string, error)
func (*TruthEngine) SearchSDDSpecs ¶
func (e *TruthEngine) SearchSDDSpecs(ctx context.Context, query string, limit, offset int) ([]SpecResult, error)
func (*TruthEngine) SemanticSearch ¶
func (*TruthEngine) StageMutation ¶
func (e *TruthEngine) StageMutation(ctx context.Context, filePath, newContent string) error
type TruthOption ¶
type TruthOption func(*TruthEngine)
TruthOption defines a functional option for configuring a TruthEngine.
func WithASTRules ¶
func WithASTRules(a *ASTRuleEngine) TruthOption
func WithAnalyzer ¶
func WithAnalyzer(a *AnalysisEngine) TruthOption
func WithCompact ¶
func WithCompact(c *CompactionEngine) TruthOption
func WithDiagnostic ¶
func WithDiagnostic(d *DiagnosticEngine) TruthOption
func WithHealer ¶
func WithHealer(h *HealerEngine) TruthOption
func WithImpact ¶
func WithImpact(i *ImpactEngine) TruthOption
func WithLSP ¶
func WithLSP(l *lsp.Manager) TruthOption
func WithLedger ¶
func WithLedger(l *Ledger) TruthOption
func WithMemory ¶
func WithMemory(m memory.MemoryProvider) TruthOption
func WithMessenger ¶
func WithMessenger(m Messenger) TruthOption
func WithRipple ¶
func WithRipple(r *RippleEngine) TruthOption
func WithSDD ¶
func WithSDD(s *SDDEngine) TruthOption
func WithSearch ¶
func WithSearch(s *SearchEngine) TruthOption
func WithSemantic ¶
func WithSemantic(s *SemanticEngine) TruthOption
type ValidationResult ¶
ValidationResult carries the outcome of a validation stage.
Source Files
¶
- analyzer.go
- anonymizer.go
- bleve_search.go
- chronos.go
- churn.go
- compaction.go
- diagnostic.go
- enricher.go
- executor.go
- healer.go
- health.go
- impact.go
- indexer.go
- interfaces.go
- ledger.go
- linker.go
- manifest.go
- parser.go
- pipeline.go
- provenance.go
- resolver.go
- ripple.go
- rules_engine.go
- sdd.go
- search.go
- semantic.go
- ssa.go
- structural.go
- treesitter.go
- truth.go
- zon.go