You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: return minimal code search results with text match snippets (#2476)
* feat: return minimal code search results with text match snippets
Return a MinimalCodeSearchResult type from search_code instead of the
raw GitHub API CodeSearchResult. This reduces token usage by ~4x by:
- Projecting the repository object to just the full_name string instead
of the full ~3KB repository payload repeated per result
- Enabling the text-match Accept header so code snippets (fragments)
are included in results, which were previously missing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: drop html_url from MinimalCodeResult
The URL is derivable from repository + path + sha, so it's redundant
token cost per result.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add minimal_output opt-out and Accept header test for code search
Address PR review feedback:
1. Add minimal_output parameter (default: true) to search_code, matching
the pattern from search_repositories. When false, returns the full
GitHub API CodeSearchResult for backward compatibility.
2. Add Accept header assertion to tests via a new withHeaders() helper
on partialMock, verifying the text-match Accept header is actually
requested (not just mocked in the response).
3. Add test case for minimal_output=false path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: remove minimal_output opt-out from search_code
The full CodeResult only adds a bloated Repository object (~3KB of
template URLs) and a derivable HTMLURL. Nothing in the full output is
useful beyond what the minimal type already provides, so always return
the compact form.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments