| Crates.io | detect |
| lib.rs | detect |
| version | 0.2.0 |
| created_at | 2024-07-09 18:04:42.920929+00 |
| updated_at | 2025-08-15 20:45:37.753155+00 |
| description | Detect files on your filesystem using arbitrary expression language criteria |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1297366 |
| size | 205,309 |
A fast, powerful tool for finding files by name, content, and metadata using an expressive query language. Drop-in replacement for complex find/grep pipelines.
➜ detect 'path.extension == rs && contents ~= async'
./src/main.rs
./src/lib.rs
./src/eval/fs.rs
➜ detect 'size > 50kb && modified > -7d && contents contains TODO'
./docs/planning.md
./src/experimental.rs
cargo install detect
# Find files by name pattern (name without extension)
detect 'path.name == README && path.ext == md'
# Find files by exact filename
detect 'path.filename == README.md'
# Search file contents
detect 'contents contains TODO'
# Complex queries with boolean logic
detect 'path.ext == ts AND contents ~= @Injectable AND NOT path.full contains test'
Traditional Unix tools require chaining multiple commands with complex syntax:
# Old way: find TypeScript files >5KB modified in last week containing TODO
find . -name "*.ts" -type f -size +5k -mtime -7 -exec grep -l "TODO" {} \;
# New way: same query, readable syntax
detect 'path.ext == ts AND size > 5kb AND modified > -7d AND contents contains TODO'
# Security audit: find config files with secrets
detect 'path.ext in [env,json,yml] AND contents ~= (password|secret|api_key)'
# Code quality: large files without tests or docs
detect 'size > 10kb AND NOT contents contains test AND NOT contents contains TODO'
# Angular components with specific decorators
detect 'path.ext == ts AND contents ~= @(Component|Injectable|Directive)'
# Recent changes to build files
detect 'modified > -7d AND path.filename ~= (Makefile|.*\.mk|build\.)'
# Complex boolean logic with grouping
detect '(path.ext == js OR path.ext == ts) AND (contents contains import OR contents contains require) AND size > 1kb'
Full syntax reference and advanced features: detect --help
detect optimizes query execution automatically:
.gitignore by default (override with -i)