feat: add symbols tool — file symbol tree with line numbers (#546)
* feat: add symbols tool — file symbol tree with line numbers Add a new `symbols` command that lists all symbols (functions, structs, classes, constants, enums, traits, impl blocks, type aliases, etc.) in files as a table of contents with line numbers and nesting. Rust implementation uses tree-sitter AST parsing with a new `is_symbol_node()` trait method (broader than `is_acceptable_parent`) and recursive descent for nested symbols (methods inside impl/class). Full pipeline: CLI subcommand → Node.js wrapper → Vercel AI SDK tool → agent registration (schema, system prompt, predefined prompts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address symbols tool review feedback - Refactor processor.rs extract_all_symbols_from_file to delegate to symbols::extract_symbols, eliminating duplicate AST traversal logic - Fix Vercel tool to return full result array instead of only first element - Add escapeString for file paths in symbols.js matching extract.js pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address Visor review feedback on symbols tool - Extract depth limit to named constant MAX_SYMBOL_DEPTH with docs - Pre-allocate Vec capacity in collect_symbols and format_symbols_text - Simplify Vercel tool return: always result[0] (schema takes single file) - Return consistent JSON for empty results instead of plain string - Improve symbolsSchema description to mention hierarchical nesting - Include stdout preview in JSON parse error messages - Clarify processor.rs legacy wrapper documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
L
Leonid Bugaev committed
5653a5c19e3bb65b87e93412b7f15780a263c984
Parent: 5df01c7
Committed by GitHub <noreply@github.com>
on 3/21/2026, 3:45:05 PM