Documentation
¶
Overview ¶
Package smart filters files that are unlikely to be useful LLM context: generated artifacts, lockfiles, minified bundles, and oversized files that .gitignore often misses. It relies on filename heuristics, generated-header sniffing, and a per-file token guardrail. The language-specific rules live in internal/lang.
Index ¶
Constants ¶
const DefaultMaxTokens = 15000
DefaultMaxTokens is the per-file guardrail used when no limit is given.
Variables ¶
This section is empty.
Functions ¶
func IsGeneratedHeader ¶
IsGeneratedHeader inspects the first 5 lines (bounded by 1KB) for generator comments.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator checks files against the token guardrail and generated headers, delegating language-specific rules to the central lang registry.
func New ¶
New returns an Evaluator using the given per-file token ceiling. A non-positive maxTokens falls back to DefaultMaxTokens.
func (*Evaluator) ExceedsTokenLimit ¶ added in v1.3.0
ExceedsTokenLimit reports whether tokens breaches the per-file guardrail. It lets callers that already ran the header and name checks skip straight to the count check without re-running them.
func (*Evaluator) ShouldSkip ¶
ShouldSkip reports whether a file should be excluded by the smart filter, along with a human-readable reason. Name-based rules run here too, but callers that already ran ShouldSkipPath can avoid the redundant check by only invoking ShouldSkip on surviving candidates.
func (*Evaluator) ShouldSkipMeta ¶
ShouldSkipMeta reports whether a file should be excluded using only its path and an approximate token count (e.g. size/4). It backs the picker's structure-first pass, letting the skeleton skip files that name rules or the token guardrail would drop, without reading any content.
func (*Evaluator) ShouldSkipPath ¶
ShouldSkipPath reports whether a file should be excluded based on its name alone, without reading or tokenizing its content. It lets callers drop lockfiles, generated artifacts, and bundles before any I/O or CPU work. Results are memoized per path: every pass that sees the same file (walker pre-read filter, content processor, skeleton) shares the first answer.