checkfor
Non-recursive multi-directory search
Search files across multiple directories with compact JSON output. Designed for AI-optimized, token-efficient verification during refactoring workflows.
Features
- Multi-directory search in single-depth scans
- Compact JSON output - 41% smaller than pretty-printed
- Per-directory results with relative paths
- Exclude filtering with statistics
- File extension, case-insensitive, and whole-word matching
- Context lines before/after matches
- Multi-line search via \n in search string
Install
go install github.com/hegner123/checkfor@latestThe Problem: Verifying a refactor across packages
# Using grep - verbose, unstructured, token-heavy
$ grep -rn "oldFunctionName" ./pkg/handlers ./pkg/models ./pkg/services
./pkg/handlers/user.go:42: result := oldFunctionName()
./pkg/handlers/user.go:87: // calls oldFunctionName for processing
./pkg/handlers/auth.go:15: oldFunctionName(ctx)
./pkg/models/user.go:23: return oldFunctionName(db)
./pkg/services/notify.go:56: oldFunctionName(msg)Solution
$ checkfor --cli --dir "./pkg/handlers,./pkg/models,./pkg/services" --search "oldFunctionName" --ext .goOutput
{"directories":[{"dir":"./pkg/handlers","matches_found":3,"files":[{"path":"user.go","matches":[{"line":42,"content":" result := oldFunctionName()"},{"line":87,"content":" // calls oldFunctionName for processing"}]},{"path":"auth.go","matches":[{"line":15,"content":" oldFunctionName(ctx)"}]}]},{"dir":"./pkg/models","matches_found":1,"files":[{"path":"user.go","matches":[{"line":23,"content":" return oldFunctionName(db)"}]}]},{"dir":"./pkg/services","matches_found":1,"files":[{"path":"notify.go","matches":[{"line":56,"content":" oldFunctionName(msg)"}]}]}]}Comparison
| Metric | Value |
|---|---|
| Token reduction vs Read tool | 95% |
| Token reduction vs Grep tool | 77% |
| Compact JSON savings | 41% |
| Path data reduction (relative paths) | 68% |
| Response time improvement | 3-5x faster |