Code search
/{owner}/{repo}/search searches the files of one branch or tag for a
pattern. Open it from the Search tab in the repository header.
Type a pattern into the search box; results update as you type. The ref switcher picks the branch or tag to search (the default branch until you change it). Two toggles sit beside the box:
- Aa — case-insensitive matching.
- .* — treat the pattern as a JavaScript regular expression instead of literal text. Invalid expressions show guidance beside the search controls; correct the expression or turn off regex to search for literal text.
Results are grouped by file in the order they were found, with a per-file match count. Each block shows the matched lines with three lines of context on either side, highlighted like the file view, with the match itself marked. Collapsed gaps between runs can be expanded in place once the file's content has loaded. Click the file name to open it, or a line number to jump to that line in the file view.
The address preserves your query and selected branch or tag, so you can share or bookmark the results.
Limits:
- At most 100 matches are returned. When more exist the page says "Results truncated"; narrow the pattern or search a smaller ref.
- A literal search across the whole repository fails with "too large" if a matched line is longer than 64 KiB.
- Regular-expression searches read files one by one: up to 5,000 tree entries, 1 MiB per file, 32 MiB in total and 4 seconds of work; anything beyond that is reported as truncated. Binary files and files over 1 MiB are skipped.
- Context lines come from the first 50 matched files; matches in further files are listed without context.
- Only the visible files of the selected ref are searched; history, commit messages, issues and pull requests are not.
CLI path scope
cafe repo code search TODO --repo owner/repo --path src searches an exact
repository-relative file or a directory subtree. --path src includes
src/main.ts and deeper descendants, but excludes src-other/main.ts;
--path src/main.ts selects that file only. Paths cannot contain empty, .
or .. components. Omit --path to search the whole repository.
Path scope works with literal matching, --regex, and --ignore-case and is
applied before the match limit. Scoped searches have the file-size, total-size, time and entry limits described
above in both modes. The entry limit also counts directories and skipped entries
in the parent directory, so a search can be truncated even with no matches.
Check that the parent directory exists if the search reports source not found.
Matched paths remain repository-relative.