Skip to main content

code-search

Structural code search using tree-sitter queries — find AST patterns like specific function calls, composite literals, or node shapes across the workspace or in a single file. More precise than regex. Use when grep is too imprecise for the pattern. Activated by runectl syntax search/query.

설치로 이동

소스 정보

저장소
unstablebuild/rune
최근 소스 활동
2026년 3월 26일 19:53
감지된 SKILL.md 언어
영어
스타
1,035
포크
80

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
code-search
description
Structural code search using tree-sitter queries — find AST patterns like specific function calls, composite literals, or node shapes across the workspace or in a single file. More precise than regex. Use when grep is too imprecise for the pattern. Activated by runectl syntax search/query.
allowed-tools
Bash(runectl:*)
# Code Search Tree-sitter structural search via `runectl syntax`. ## runectl syntax search Search workspace using a tree-sitter query. ``` Usage: runectl syntax search <query> [flags] Flags: -c, --capture stringArray Capture name filter (repeatable) -F, --format string Output format: table, json, or Go template -L, --lang stringArray Language filter (repeatable, e.g. go, python) ``` For simple "find all functions" queries, prefer `runectl syntax searchnode` from the code-structure skill instead. Example — find all struct type definitions in Go files: ```bash $ runectl syntax search '(type_declaration (type_spec name: (type_identifier) @name type: (struct_type)))' -L go file:///src/rune-agent/agent/agent.go Config 44:5-44:11 name file:///src/rune-agent/agent/agent.go Agent 72:5-72:10 name file:///src/rune-agent/dialogue/dialoguetui/cell_grid.go cellGrid 62:5-62:13 name ... ``` Each line shows `file text line:col-endLine:endCol capture_name`. The `@name` capture matched the type identifier. ## runectl syntax query Query a single file using a tree-sitter query. ``` Usage: runectl syntax query <file> <query> [flags] Flags: -c, --capture stringArray Capture name filter (repeatable) -F, --format string Output format: table, json, or Go template ``` Example — find all function calls in `bash.go`: ```bash $ runectl syntax query agent/agentools/bash.go '(call_expression function: (selector_expression) @fn)' file:///src/rune-agent/agent/agentools/bash.go json.Unmarshal 108:11-108:25 fn file:///src/rune-agent/agent/agentools/bash.go fmt.Sprintf 117:35-117:46 fn file:///src/rune-agent/agent/agentools/bash.go context.WithTimeout 133:16-133:35 fn file:///src/rune-agent/agent/agentools/bash.go t.exec.Start 149:11-149:23 fn ... ``` ## Tree-sitter query syntax Queries are S-expressions matching syntax tree nodes. Each pattern is parentheses containing the node type and optional child matchers. ```bash # All function declarations '(function_declaration name: (identifier) @name)' # Calls to a specific function '(call_expression function: (identifier) @fn (#eq? @fn "Println"))' # Composite literals of a specific type '(composite_literal type: (type_identifier) @type (#eq? @type "Config"))' # Binary expressions with two number literals '(binary_expression (number_literal) (number_literal))' ```
GitHub에서 보기