fix(cli): node <symbol> -f <file> includes the source body (#1314)

The CLI's bare-symbol branch passes includeCode=true to the
codegraph_node handler, but the symbol-pinned-to-file branch didn't —
so exactly when a user disambiguated an overloaded name to one file
(the point of -f), they got Location + trail with no code (#1284).

Fixes #1284

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-07-16 15:30:17 -05:00
committed by GitHub
co-authored by Claude Fable 5
parent 8dcf92f285
commit ce983a08fe
3 changed files with 48 additions and 1 deletions
+8 -1
View File
@@ -1414,7 +1414,14 @@ program
const args: Record<string, unknown> = {};
if (options.file) {
args.file = options.file;
if (name && name !== options.file) args.symbol = name;
if (name && name !== options.file) {
args.symbol = name;
// Symbol mode pinned to a file is still symbol mode — the CLI
// always wants the body, exactly like the bare-symbol branch
// below. Omitting this printed location + trail with no source
// (#1284).
args.includeCode = true;
}
} else if (name && (name.includes('/') || name.includes('\\'))) {
args.file = name.replace(/\\/g, '/');
} else if (name) {