Documentation
¶
Overview ¶
Package walker walks a directory tree yielding file paths that pass ignore rules (.gitignore and .caignore) and include/exclude glob filters from config.Config.
Walker.Walk returns an iter.Seq2 iterator so callers process files one at a time without holding the full list in memory. Context cancellation stops the walk early. walker imports only config; it knows nothing about chunking, embedding, or storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Walker)
Option configures a Walker at construction time.
func WithFileFilter ¶
WithFileFilter attaches a path predicate to the Walker. fn receives the file path relative to the walker root and must return true for the file to be yielded. A nil fn (or omitting this option) preserves the existing behaviour: all paths that pass gitignore and include/exclude rules are yielded.
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
Walker walks a directory tree, yielding file paths that pass all configured filters.
func New ¶
New creates a Walker rooted at root using filter configuration from cfg. The caller should call Close when done to release the underlying file descriptor.
func (*Walker) FS ¶
FS returns an fs.FS scoped to the walker's root directory. The returned FS prevents path traversal via symlinks or ../ escapes.
func (*Walker) IsIgnored ¶
IsIgnored reports whether the absolute path should be ignored based on gitignore rules. Safe for concurrent use — builds a local ignore stack without locking ignoreMu.
func (*Walker) Match ¶
Match reports whether the file at the given absolute path would be yielded by Walk. Safe for concurrent use — builds a local ignore stack without locking ignoreMu.