Skip to content

Search JSON should include enclosing symbol metadata for each hit #2838

Description

@Widthdom

Summary

During code audit, a search hit often needs the surrounding method, class, or symbol range before the next decision is possible. search --json currently returns path, line span, content, and score, but not the enclosing symbol metadata that would let agents jump directly to the relevant owner.

Evidence

  • src/CodeIndex/Models/QueryResults.cs:10 defines SearchResult with path, language, start/end lines, content, and score only.
  • SymbolResult already carries richer fields such as Name, Kind, ContainerName, StartLine, EndLine, BodyStartLine, and BodyEndLine.

Requested behavior

Add optional enclosing-symbol fields to search JSON results, for example enclosing_symbol_name, enclosing_symbol_kind, enclosing_symbol_start_line, enclosing_symbol_end_line, and enclosing_container_name. This should be available for CLI JSON and MCP search responses without changing text output by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions