feat(context): get a function's source by name (closes #316)#317
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
context --check source --name X returns just function X's source plus its file:start-end range — the direct replacement for "Read the whole file to see one function", the most common manual step left in agent navigation (north-star #279). Found by dogfooding CodeLens on itself. Read-only compose, no new engine: locate X (via --file outline, or graph find_nodes_by_name from a prior scan), bound it by the next declaration in the file (or EOF), trim trailing blanks, slice. Same-name in N files returns N matches; an unscanned workspace with no --file returns an explicit no_graph error, never silent-empty (same discipline as #315). Boundary is a next-declaration heuristic, not the parser's end line, to stay read-only — exact for the common case, documented. Command count stays 12. Verified by dogfooding: retrieved _fn_of's 3-line body from a 105-line file without reading it. 7 tests (slice, boundary no-bleed, EOF, trim, not-found, missing-name, same-name-two-files, no-graph error). Full suite 19 = 19 on main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #316. Found by dogfooding CodeLens on itself (north-star #279 agent-ergonomics).
Yang dibangun
context --check source --name Xmengembalikan source satu fungsi + rangefile:start-end— pengganti langsung "Read file utuh cuma untuk lihat satu fungsi", langkah manual paling sering tersisa di navigasiku.Read-only compose
Locate X (via
--fileoutline, atau graphfind_nodes_by_namedari scan) → batas = deklarasi berikutnya di file (atau EOF) → trim blank → slice. Fungsi senama N file → N match; workspace belum di-scan tanpa--file→ errorno_grapheksplisit, bukan silent-empty (disiplin sama #315). Batas = heuristik next-declaration (bukan parser end-line) supaya tetap read-only — dokumentasikan.Verifikasi (dijalankan — dogfood)
_fn_ofdari file 105-baris tanpa membacanya.add_args→ 63 def).Ini north-star langsung: aku berhenti Read file utuh untuk satu fungsi. Berikutnya (beruntun): #315 (fix CLI silent-error).
🤖 Generated with Claude Code