base

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalCache = &ASTCache{
	maxAge: 5 * time.Minute,
}

GlobalCache is the singleton cache instance shared across all providers

Functions

This section is empty.

Types

type ASTCache

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

ASTCache is a lock-free cache for parsed ASTs (shared across all providers)

func (*ASTCache) GetOrParse

func (c *ASTCache) GetOrParse(parser *sitter.Parser, source []byte) (*sitter.Tree, bool)

GetOrParse returns cached AST or parses new one

func (*ASTCache) Stats

func (c *ASTCache) Stats() map[string]int64

Stats returns cache statistics

type CachedAST

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

CachedAST holds parsed tree with metadata

type LanguageConfig

type LanguageConfig interface {
	// Metadata
	Language() string
	Extensions() []string
	GetLanguage() *sitter.Language

	// Language-specific AST mapping
	MapQueryTypeToNodeTypes(queryType string) []string
	ExtractNodeName(node *sitter.Node, source string) string
	IsExported(name string) bool // For confidence calculation
}

LanguageConfig defines language-specific behavior that must be implemented

type Provider

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

Provider provides common functionality for all language providers

func New

func New(config LanguageConfig) *Provider

New creates a base provider with language-specific config

func (*Provider) Extensions

func (p *Provider) Extensions() []string

Extensions returns supported file extensions

func (*Provider) Language

func (p *Provider) Language() string

Language returns language identifier

func (*Provider) Query

func (p *Provider) Query(source string, query core.AgentQuery) core.QueryResult

Query finds code elements matching the query

func (*Provider) Transform

func (p *Provider) Transform(source string, op core.TransformOp) core.TransformResult

Transform applies a transformation operation

func (*Provider) Validate

func (p *Provider) Validate(source string) providers.ValidationResult

Validate checks syntax

Jump to

Keyboard shortcuts

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