Skip to content

fix(grep): make 'content' the explicit default output mode#33

Open
T0mSIlver wants to merge 1 commit into
microsoft:mainfrom
T0mSIlver:fix/grep-default-output-mode
Open

fix(grep): make 'content' the explicit default output mode#33
T0mSIlver wants to merge 1 commit into
microsoft:mainfrom
T0mSIlver:fix/grep-default-output-mode

Conversation

@T0mSIlver

Copy link
Copy Markdown

Problem

The default output_mode was advertised inconsistently:

  • The JSON schema description said Defaults to "files_with_matches".
  • grep.md said "content" ... (default).
  • The code did params.get("output_mode")None, which fell through every branch in run_rg to ripgrep's own content default — and skipped applying -n, so default searches had no line numbers.

Fix

Reconcile on content (matching grep.md and the chosen behavior): default output_mode to "content" explicitly so context/line-number handling applies, and correct the schema description. Adds tests/test_grep_default_mode.py asserting an omitted output_mode returns line-numbered matching lines and that the schema documents the content default.

Paper reference — judgment call

The paper lists output modes as "One of content, files_with_matches, or count" (FastContext paper (arXiv:2606.14066), Appendix E "FastContext Explorer: Tool Schemas", p. 19) but specifies no default. We chose content (the paper lists it first, and it matches grep.md) — a deliberate decision, not paper-mandated.

The schema description claimed output_mode defaults to
'files_with_matches', while grep.md said 'content' is the default and
the code fell through to ripgrep's content default without applying -n.
Reconcile on 'content' (matching grep.md): set it as the explicit
default so line numbers apply, fix the schema description, and add a
test asserting the default behavior and documentation.
@T0mSIlver T0mSIlver closed this Jun 27, 2026
@T0mSIlver T0mSIlver deleted the fix/grep-default-output-mode branch June 27, 2026 11:31
@T0mSIlver T0mSIlver restored the fix/grep-default-output-mode branch June 27, 2026 11:56
@T0mSIlver T0mSIlver reopened this Jun 27, 2026
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.

1 participant