Skip to content

Conversation

@cramforce
Copy link
Contributor

@cramforce cramforce commented Jan 14, 2026

…and lots of tests to ensure compatibility imported from ripgrep

Fixes #48

…n type

  This PR adds several missing ripgrep flags and improves compatibility with the real rg command.

  New Features

  --files - List files that would be searched without requiring a pattern
  rg --files              # List all searchable files
  rg --files -t js        # List only JavaScript files
  rg --files -g '*.txt'   # List files matching glob
  rg --files -d 2         # List files up to depth 2

  -d NUM - Short alias for --max-depth
  rg -d 2 pattern         # Same as rg --max-depth 2 pattern

  --stats - Print search statistics after results
  rg --stats pattern
  # Output includes: matches, matched lines, files with matches, files searched, bytes searched

  -P/--pcre2 - Returns helpful error message (PCRE2 not supported)
  rg -P pattern
  # Error: rg: PCRE2 is not supported. Use standard regex syntax instead.

  -t markdown - Added markdown as alias for md file type
  rg -t markdown pattern  # Search .md, .markdown, .mdown, .mkd files

  Changes

  - rg-search.ts: Added listFiles() function for --files mode, stats output
  - rg-parser.ts: Added -d alias, --files/--stats flags, -P error handling
  - rg-options.ts: Added files and stats boolean options
  - file-types.ts: Added markdown type alias
  - rg.ts: Updated help text with new flags

  Tests

  Added 22 new tests covering:
  - --files with various filters (type, glob, depth, hidden)
  - -d at various depths and combined with filters
  - --stats output format and edge cases
  - markdown type matching all extensions
  - -P/--pcre2 error messages

  Test count: 417 rg tests (up from 395)
@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
just-bash Ignored Ignored Jan 15, 2026 0:28am

@cramforce cramforce merged commit 456567e into main Jan 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent surprises when using the new rg

2 participants