Documentation
¶
Overview ¶
Package grep implements a generic, language-agnostic TOON-emitting search across a project tree, built on the same walker + matcher + enclosing infrastructure as this toolkit's other structural tools. Useful when the AI needs any substring or regex hit (class names, SQL fragments, magic strings) surfaced in a token-cheap, structured form.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIgnoreDirs = []string{
"vendor", "node_modules", "var", ".git", ".idea", ".vscode",
".svn", ".hg", "dist", "build", "target", "__pycache__",
}
DefaultIgnoreDirs are the directories every project's grep should skip by default (heavy, machine-managed). Extra entries can be added via Options.ExtraIgnore. Exported so `sf code`'s directory expansion walks the same tree grep does, rather than drifting with a second copy.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Root string
Patterns []string
Format string // "toon" | "md" | "json"
CaseSensitive bool
WordBound bool
Regex bool
Exts []string // file extensions to include (".php" etc.); empty = all
ExtraIgnore []string // extra directory names to skip in addition to defaults
MaxPerPattern int // 0 = unlimited
}
type PatternResult ¶
type Result ¶
type Result struct {
Patterns []*PatternResult `json:"patterns"`
Empty []string `json:"empty,omitempty"`
Skipped int `json:"skipped,omitempty"` // files skipped: binary or over-long lines
}
Click to show internal directories.
Click to hide internal directories.