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 の言語
英語
スター
591
フォーク
34

インストール方法

デフォルトでは、最初にソースを確認する 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で見る