Documentation
¶
Index ¶
- func CombinedExtensions(adapters []Adapter) []string
- func CombinedIgnoreDirs(adapters []Adapter) []string
- func CombinedIgnoreGlobs(adapters []Adapter) []string
- func Decrypt(data []byte, password string) ([]byte, error)
- func DecryptFromFile(inputPath string, password string) ([]byte, error)
- func IsEncrypted(data []byte) bool
- type Adapter
- type AdapterOverride
- type ChangeSet
- type Config
- type DiffResult
- type DirNode
- type FileEntry
- type FileMetadata
- type FlutterAdapter
- func (a *FlutterAdapter) ConfigPatterns() []string
- func (a *FlutterAdapter) DetectionFiles() []string
- func (a *FlutterAdapter) EntrypointPatterns() []string
- func (a *FlutterAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
- func (a *FlutterAdapter) FileExtensions() []string
- func (a *FlutterAdapter) IgnoreDirs() []string
- func (a *FlutterAdapter) IgnoreGlobs() []string
- func (a *FlutterAdapter) Name() string
- func (a *FlutterAdapter) ScoreFile(path string, depth int, isEntrypoint, isConfig bool) int
- type FunctionInfo
- type GoAdapter
- func (a *GoAdapter) ConfigPatterns() []string
- func (a *GoAdapter) DetectionFiles() []string
- func (a *GoAdapter) EntrypointPatterns() []string
- func (a *GoAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
- func (a *GoAdapter) FileExtensions() []string
- func (a *GoAdapter) IgnoreDirs() []string
- func (a *GoAdapter) IgnoreGlobs() []string
- func (a *GoAdapter) Name() string
- func (a *GoAdapter) ScoreFile(path string, depth int, isEntrypoint, isConfig bool) int
- type HashAlgorithm
- type IndexMetadata
- type Manager
- type OutputFormat
- type PythonAdapter
- func (a *PythonAdapter) ConfigPatterns() []string
- func (a *PythonAdapter) DetectionFiles() []string
- func (a *PythonAdapter) EntrypointPatterns() []string
- func (a *PythonAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
- func (a *PythonAdapter) FileExtensions() []string
- func (a *PythonAdapter) IgnoreDirs() []string
- func (a *PythonAdapter) IgnoreGlobs() []string
- func (a *PythonAdapter) Name() string
- func (a *PythonAdapter) ScoreFile(path string, depth int, isEntrypoint, isConfig bool) int
- type QmdConfig
- type Registry
- type Result
- type ScanResult
- type StoreLocation
- type SymbolInfo
- type TypeInfo
- type TypeScriptAdapter
- func (a *TypeScriptAdapter) ConfigPatterns() []string
- func (a *TypeScriptAdapter) DetectionFiles() []string
- func (a *TypeScriptAdapter) EntrypointPatterns() []string
- func (a *TypeScriptAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
- func (a *TypeScriptAdapter) FileExtensions() []string
- func (a *TypeScriptAdapter) IgnoreDirs() []string
- func (a *TypeScriptAdapter) IgnoreGlobs() []string
- func (a *TypeScriptAdapter) Name() string
- func (a *TypeScriptAdapter) ScoreFile(path string, depth int, isEntrypoint, isConfig bool) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedExtensions ¶
CombinedExtensions returns all file extensions from the given adapters
func CombinedIgnoreDirs ¶
CombinedIgnoreDirs returns all ignore dirs from the given adapters
func CombinedIgnoreGlobs ¶
CombinedIgnoreGlobs returns all ignore globs from the given adapters
func DecryptFromFile ¶
DecryptFromFile decrypts content from an encrypted file
func IsEncrypted ¶
IsEncrypted checks if data appears to be encrypted
Types ¶
type Adapter ¶
type Adapter interface {
// Name returns the adapter identifier (e.g., "go", "python")
Name() string
// DetectionFiles returns files that indicate this language is used
// (e.g., "go.mod", "requirements.txt")
DetectionFiles() []string
// FileExtensions returns file extensions this adapter handles
// (e.g., ".go", ".py")
FileExtensions() []string
// IgnoreDirs returns directories to ignore for this language
// (e.g., "vendor", "node_modules")
IgnoreDirs() []string
// IgnoreGlobs returns glob patterns to ignore
// (e.g., "*.generated.go", "*.min.js")
IgnoreGlobs() []string
// EntrypointPatterns returns file patterns that indicate entrypoints
// (e.g., "main.go", "index.ts")
EntrypointPatterns() []string
// ConfigPatterns returns file patterns that indicate config files
// (e.g., "go.mod", "package.json")
ConfigPatterns() []string
// ExtractSymbols extracts symbols from file content
// Only first maxBytes of content is provided for performance
ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
// ScoreFile returns a score modifier for file prioritization
// Higher scores = more important files
ScoreFile(path string, depth int, isEntrypoint, isConfig bool) int
}
Adapter defines the interface for language-specific indexing adapters
type AdapterOverride ¶
type AdapterOverride struct {
IgnoreDirs []string
IgnoreGlobs []string
PriorityFiles []string
ReplaceDefaults bool
}
AdapterOverride allows customization of adapter behavior
type Config ¶
type Config struct {
// Root path to scan (defaults to current directory)
Root string
// Output configuration
OutputPath string
OutputFormat OutputFormat // summary, structured, or full
Store StoreLocation
Encrypt bool
EncryptionKey string
// Expose configuration
ExposeVariable bool
MemoryEnabled bool
MemoryKey string
// Adapter overrides per language
AdapterOverrides map[string]*AdapterOverride
// Processing options
MaxOutputKB int
HashAlgorithm HashAlgorithm
Incremental bool
Verbose bool
// qmd integration (optional)
Qmd *QmdConfig
// Derived values (computed at runtime)
RepoFileSlug string // lowercase slug for filenames
RepoVarSlug string // uppercase slug for variables
}
Config represents the parsed configuration for codebase indexing
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible defaults
type DiffResult ¶ added in v0.0.143
type DiffResult struct {
Added []string
Modified []string
Deleted []string
Unchanged int
StoredAt time.Time
StoredHash string
}
DiffResult contains the results of comparing current state to stored index
type DirNode ¶
type DirNode struct {
Name string
Path string
Children []*DirNode
Files []string // File names only (not full entries)
Depth int
}
DirNode represents a directory in the tree structure
type FileEntry ¶
type FileEntry struct {
// Relative path from repo root
Path string
// File metadata
Size int64
ModTime time.Time
Hash string // xxhash or sha256 depending on config
// Token estimation (Size / 4 as rough approximation)
EstimatedTokens int
// Scoring
Score int
Depth int
IsEntrypoint bool
IsConfig bool
IsGenerated bool
// Language association
Language string
// Extracted symbols (populated during extraction phase)
Symbols *SymbolInfo
}
FileEntry represents a single file in the repository
func (*FileEntry) TokenBudgetCategory ¶ added in v0.0.111
TokenBudgetCategory returns the token budget category for a file Uses shared thresholds from filescan package
type FileMetadata ¶ added in v0.0.143
type FileMetadata struct {
Path string `json:"path"`
Hash string `json:"hash"`
Size int64 `json:"size"`
ModTime int64 `json:"mod_time"` // Unix timestamp
}
FileMetadata stores per-file metadata for diffing
type FlutterAdapter ¶
type FlutterAdapter struct{}
FlutterAdapter handles Flutter/Dart codebases
func (*FlutterAdapter) ConfigPatterns ¶
func (a *FlutterAdapter) ConfigPatterns() []string
func (*FlutterAdapter) DetectionFiles ¶
func (a *FlutterAdapter) DetectionFiles() []string
func (*FlutterAdapter) EntrypointPatterns ¶
func (a *FlutterAdapter) EntrypointPatterns() []string
func (*FlutterAdapter) ExtractSymbols ¶
func (a *FlutterAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
func (*FlutterAdapter) FileExtensions ¶
func (a *FlutterAdapter) FileExtensions() []string
func (*FlutterAdapter) IgnoreDirs ¶
func (a *FlutterAdapter) IgnoreDirs() []string
func (*FlutterAdapter) IgnoreGlobs ¶
func (a *FlutterAdapter) IgnoreGlobs() []string
func (*FlutterAdapter) Name ¶
func (a *FlutterAdapter) Name() string
type FunctionInfo ¶
type FunctionInfo struct {
Name string
Signature string
IsExported bool
IsMethod bool
Receiver string // For methods
Comments string
}
FunctionInfo describes a function or method
type GoAdapter ¶
type GoAdapter struct{}
GoAdapter handles Go codebases
func (*GoAdapter) ConfigPatterns ¶
func (*GoAdapter) DetectionFiles ¶
func (*GoAdapter) EntrypointPatterns ¶
func (*GoAdapter) ExtractSymbols ¶
func (a *GoAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
func (*GoAdapter) FileExtensions ¶
func (*GoAdapter) IgnoreDirs ¶
func (*GoAdapter) IgnoreGlobs ¶
type HashAlgorithm ¶
type HashAlgorithm string
HashAlgorithm specifies the hashing algorithm to use
const ( HashXXHash HashAlgorithm = "xxhash" HashSHA256 HashAlgorithm = "sha256" DefaultHash HashAlgorithm = HashXXHash )
type IndexMetadata ¶ added in v0.0.143
type IndexMetadata struct {
GeneratedAt time.Time `json:"generated_at"`
RepoName string `json:"repo_name"`
ContentHash string `json:"content_hash"`
FileCount int `json:"file_count"`
Files []FileMetadata `json:"files"`
Languages []string `json:"languages"`
}
IndexMetadata stores metadata about an index for diffing
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates the codebase indexing process
func NewManager ¶
NewManager creates a new index manager with the given configuration
func (*Manager) ComputeChangeSet ¶ added in v0.0.143
func (m *Manager) ComputeChangeSet(diff *DiffResult) *ChangeSet
ComputeChangeSet builds a ChangeSet from diff result for incremental updates
func (*Manager) Diff ¶ added in v0.0.143
func (m *Manager) Diff(storedIndexPath string) (*DiffResult, error)
Diff compares the current state of the repository against a stored index
type OutputFormat ¶ added in v0.0.135
type OutputFormat string
OutputFormat specifies the format/verbosity of the generated index
const ( // FormatSummary generates a compact overview (1-2KB) // Contains: repo purpose, main areas, key entry points // Best for: quick context, agent system prompts FormatSummary OutputFormat = "summary" // FormatStructured generates a categorized index (10-50KB) // Contains: files grouped by domain/purpose, semantic sections // Best for: agentic loops that need to understand codebase areas FormatStructured OutputFormat = "structured" // FormatFull generates the complete index (50-200KB) // Contains: all files, symbols, detailed tree structure // Best for: comprehensive analysis, initial exploration FormatFull OutputFormat = "full" // DefaultFormat is the default output format DefaultFormat OutputFormat = FormatStructured )
type PythonAdapter ¶
type PythonAdapter struct{}
PythonAdapter handles Python codebases
func (*PythonAdapter) ConfigPatterns ¶
func (a *PythonAdapter) ConfigPatterns() []string
func (*PythonAdapter) DetectionFiles ¶
func (a *PythonAdapter) DetectionFiles() []string
func (*PythonAdapter) EntrypointPatterns ¶
func (a *PythonAdapter) EntrypointPatterns() []string
func (*PythonAdapter) ExtractSymbols ¶
func (a *PythonAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
func (*PythonAdapter) FileExtensions ¶
func (a *PythonAdapter) FileExtensions() []string
func (*PythonAdapter) IgnoreDirs ¶
func (a *PythonAdapter) IgnoreDirs() []string
func (*PythonAdapter) IgnoreGlobs ¶
func (a *PythonAdapter) IgnoreGlobs() []string
func (*PythonAdapter) Name ¶
func (a *PythonAdapter) Name() string
type QmdConfig ¶ added in v0.0.129
type QmdConfig struct {
// Collection name to register with qmd
Collection string `yaml:"collection"`
// Whether to run qmd embed after registration
Embed bool `yaml:"embed"`
// Context description for the collection
Context string `yaml:"context"`
// File mask for indexing (default: "**/*.md")
Mask string `yaml:"mask"`
}
QmdConfig holds configuration for qmd integration
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages available adapters and language detection
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new adapter registry with default adapters
func (*Registry) GetByNames ¶
GetByNames retrieves adapters by name, returning only those found
type Result ¶
type Result struct {
// The generated markdown content (primary format)
Content string
// Additional format outputs (generated on demand)
Summary string // Always generated - compact overview for agents
Structured string // Categorized index if format != summary
Full string // Complete index if format == full
// Path where the index was written
OutputPath string
// Hash of the plaintext content
ContentHash string
// Whether the index was updated (for incremental mode)
Updated bool
// Format used for Content
Format OutputFormat
// Metadata
GeneratedAt time.Time
RepoName string
Languages []string
FileCount int
Duration time.Duration
// Categorization (populated during structured/full generation)
Categories map[string][]string // category -> file paths
}
Result represents the output of index generation
type ScanResult ¶
type ScanResult struct {
// All files found (before candidate selection)
Files []*FileEntry
// Selected candidate files for indexing
Candidates []*FileEntry
// Directory structure summary
DirTree *DirNode
// Statistics
TotalFiles int
TotalDirs int
IgnoredFiles int
IgnoredDirs int
TotalBytes int64
ProcessedTime time.Duration
}
ScanResult holds the results of repository scanning
type StoreLocation ¶
type StoreLocation string
StoreLocation specifies where to store the index
const ( StoreRepo StoreLocation = "repo" StoreConfig StoreLocation = "config" StoreBoth StoreLocation = "both" )
type SymbolInfo ¶
type SymbolInfo struct {
// Package/module declaration
Package string
// Imports/dependencies
Imports []string
// Functions and methods
Functions []FunctionInfo
// Types (structs, classes, interfaces)
Types []TypeInfo
// Constants and variables
Constants []string
Variables []string
// Framework/library indicators
Frameworks []string
// Risk indicators (auth, crypto, db, concurrency)
RiskTags []string
}
SymbolInfo holds extracted symbols from a file
type TypeInfo ¶
type TypeInfo struct {
Name string
Kind string // struct, interface, class, enum, etc.
IsExported bool
Fields []string
Methods []string
Comments string
}
TypeInfo describes a type definition
type TypeScriptAdapter ¶
type TypeScriptAdapter struct{}
TypeScriptAdapter handles TypeScript/JavaScript codebases
func (*TypeScriptAdapter) ConfigPatterns ¶
func (a *TypeScriptAdapter) ConfigPatterns() []string
func (*TypeScriptAdapter) DetectionFiles ¶
func (a *TypeScriptAdapter) DetectionFiles() []string
func (*TypeScriptAdapter) EntrypointPatterns ¶
func (a *TypeScriptAdapter) EntrypointPatterns() []string
func (*TypeScriptAdapter) ExtractSymbols ¶
func (a *TypeScriptAdapter) ExtractSymbols(path string, content []byte) (*SymbolInfo, error)
func (*TypeScriptAdapter) FileExtensions ¶
func (a *TypeScriptAdapter) FileExtensions() []string
func (*TypeScriptAdapter) IgnoreDirs ¶
func (a *TypeScriptAdapter) IgnoreDirs() []string
func (*TypeScriptAdapter) IgnoreGlobs ¶
func (a *TypeScriptAdapter) IgnoreGlobs() []string
func (*TypeScriptAdapter) Name ¶
func (a *TypeScriptAdapter) Name() string