jouet search
- Usage:
jouet search [FLAGS] <PATTERN> [PATHS]…
Search files like rg, within a budget, grouped by symbol
Embeds ripgrep's walker and searcher, so it respects .gitignore, skips hidden and binary files, and is about as fast as rg. Patterns are rg's regular expressions (-F for a literal). Beyond rg:
- Matches are grouped by file, then by the function, method, class or module they are in (for Rust, Python, JavaScript, TypeScript, Go, Ruby, Java, C, C++ and Luau).
- Output stops at a byte budget, in total and per file, and says what it left out:
... 4 more in src/x.rs, and a closing line naming the files it never reached. Nothing is cut silently; --budget 0 removes a limit. - Inside an agent session (JOUET_SESSION_ID, CLAUDE_CODE_SESSION_ID or CODEX_THREAD_ID), a match this session was already shown, in a file that has not changed since, collapses to one line (
src/x.rs: 3 already shown, unchanged). --again shows them anyway.
With --structural, PATTERN is code in --lang, matched by ast-grep: $X is one node, $$$X any number, and only files in that language are searched. Quote it in single quotes, or the shell expands $X (jouet agent-help edit has more on patterns).
Exits 0 with matches, 1 with none, 2 for a bad pattern or glob, and 3 for a path that does not exist.
Examples: jouet search 'fn download' src/ jouet search -F 'client.get(' -g '*.rs' jouet search -i timeout --budget 2000 --file-budget 400 jouet search -l TODO jouet search --structural --lang rust '$X.unwrap()' jouet search --structural --lang go 'if err != nil { return $$$ }' jouet search --structural --lang typescript 'useEffect($FN, [])' jouet search --structural --lang rust '$F($$$A)' --callers-of src/config.rs#load
Arguments
<PATTERN>— The regular expression to search for (a literal with -F)[PATHS]…— Files and directories to search (default .)
Flags
-F --fixed-strings— Treat the pattern as a literal string-i --ignore-case— Match case-insensitively-w --word-regexp— Match whole words only-g --glob <GLOB>— Include or exclude files, as rg's -g:*.rs,!*_test.go. Repeatable--hidden— Search hidden files and directories too-l --files-with-matches— List the matching files with their match counts, not the lines--budget <BYTES>— The most bytes to print in total (default 6000; 0 is no limit)-m --max-count <NUM>— Show at most NUM matches from each file, as rg's -m-n --line-number— Accepted for rg's sake: line numbers are always shown-A --after-context <NUM>— Accepted for rg's sake: matches are shown in the symbol they are in, without context lines (jouet readreads around one)-B --before-context <NUM>— Accepted for rg's sake, as -A-C --context <NUM>— Accepted for rg's sake, as -A--file-budget <BYTES>— The most bytes to print from one file (default 1500; 0 is no limit)--again— Show matches this session was already shown, too--structural— Match PATTERN as code, with ast-grep:$Xis one node,$$$Xany number. Needs --lang--lang <LANG>— The language of a --structural pattern: rust, python, javascript, typescript, tsx, go, ruby, java, c, cpp or luau--callers-of <PATH#SYMBOL>— With --structural, only the calls the code graph attributes to this symbol, given as PATH#NAME (or #ID fromjouet graph symbols)--impact <PATH#SYMBOL>— With --structural, only matches inside this symbol and the code the graph says depends on it, three hops back-h --help— Print help