f2b0db4d9a
- .claude/rules/search-tools.md — матрица: ast-index (символы/usages/callers/outline), vex (semantic/similar/pattern/duplicates/show) - usages/callers по JS — только ast-index (vex пропускает) - CLAUDE.md и ast-index.md ссылаются на новое правило Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.9 KiB
1.9 KiB
ast-index Rules
Семантический поиск / AST-паттерны / дубликаты — это vex, см.
search-tools.md. Это правило — про ast-index (дефолт для символов, usages, callers, outline).
Mandatory Search Rules
- ALWAYS use ast-index FIRST for any code search task
- NEVER duplicate results — if ast-index found usages/implementations, that IS the complete answer
- DO NOT run grep "for completeness" after ast-index returns results
- Use grep/Search ONLY when:
- ast-index returns empty results
- Searching for regex patterns (ast-index uses literal match)
- Searching for string literals inside code (
"some text") - Searching in comments content
Why ast-index
ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.
Command Reference
| Task | Command | Time |
|---|---|---|
| Universal search | ast-index search "query" |
~10ms |
| Find class/component | ast-index class "ComponentName" |
~1ms |
| Find symbol | ast-index symbol "SymbolName" |
~1ms |
| Find usages | ast-index usages "SymbolName" |
~8ms |
| Find implementations | ast-index implementations "Interface" |
~5ms |
| Call hierarchy | ast-index call-tree "function" --depth 3 |
~1s |
| Find callers | ast-index callers "functionName" |
~1s |
| Module deps | ast-index deps "module-name" |
~10ms |
| File outline | ast-index outline "File.tsx" |
~1ms |
JavaScript-Specific Commands
| Task | Command |
|---|---|
| Find classes | ast-index class "ClassName" |
| Find functions | ast-index symbol "functionName" |
| Find Express routes | ast-index search "router.get" |
| File structure | ast-index outline "path/to/file.js" |
Index Management
ast-index rebuild— Full reindex (run once after clone)ast-index update— After git pull/mergeast-index stats— Show index statistics