Documentation
¶
Index ¶
- func ExecuteAstGrep(pattern, lang, path string) string
- func ExecuteSearchCode(pattern string, path string) string
- func ExecuteSearchFile(pattern string, path string) string
- func ExecuteWebSearch(query string) string
- func RegisterTools(registry *tools.Registry)
- type AstGrepTool
- type FileReplaceResult
- type GrepReplaceResult
- type GrepReplaceTool
- type PatternSuggestion
- type SearchCodeTool
- type SearchFileTool
- type WebSearchTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteAstGrep ¶
ExecuteAstGrep executes ast-grep for structural code search ast-grep is a Tree-sitter based structural code search tool Pattern examples:
- 'func $NAME($ARGS)' - matches Go functions
- 'async function $NAME' - matches JS async functions
- 'def $NAME($ARGS):' - matches Python functions
func ExecuteSearchCode ¶
ExecuteSearchCode searches for a pattern in code files
func ExecuteSearchFile ¶
ExecuteSearchFile searches for files by name pattern
func ExecuteWebSearch ¶
ExecuteWebSearch executes web search using Serper API
func RegisterTools ¶
RegisterTools registers search tools with the registry
Types ¶
type AstGrepTool ¶
type AstGrepTool struct{}
AstGrepTool is the tool for ast-grep search
func (*AstGrepTool) Description ¶ added in v0.44.0
func (t *AstGrepTool) Description() string
func (*AstGrepTool) Parameters ¶ added in v0.44.0
func (t *AstGrepTool) Parameters() map[string]interface{}
func (*AstGrepTool) Run ¶
func (t *AstGrepTool) Run(args map[string]string) (string, *tools.FileChange, error)
Run executes the ast-grep tool
type FileReplaceResult ¶
FileReplaceResult is the result of single file replacement
func ExecuteGrepReplace ¶
func ExecuteGrepReplace(pattern, replacement, path, filePattern string, dryRun bool) (string, []FileReplaceResult, error)
ExecuteGrepReplace executes bulk replace across multiple files pattern: search pattern (regex) replacement: replacement string path: target directory (default: ".") filePattern: file name pattern (e.g., "*.go", default: all files) dryRun: if true, only preview without actual replacement
type GrepReplaceResult ¶
type GrepReplaceResult struct {
FilesModified int
TotalMatches int
FileResults []FileReplaceResult
BackupPaths map[string]string // filepath -> backupPath
}
GrepReplaceResult is the result of bulk replace
type GrepReplaceTool ¶
type GrepReplaceTool struct{}
GrepReplaceTool is the tool for bulk grep replace
func (*GrepReplaceTool) Description ¶ added in v0.44.0
func (t *GrepReplaceTool) Description() string
func (*GrepReplaceTool) Parameters ¶ added in v0.44.0
func (t *GrepReplaceTool) Parameters() map[string]interface{}
func (*GrepReplaceTool) Run ¶
func (t *GrepReplaceTool) Run(args map[string]string) (string, *tools.FileChange, error)
Run executes the grep replace tool
type PatternSuggestion ¶
PatternSuggestion is a pattern suggestion struct
func GetPatternSuggestion ¶
func GetPatternSuggestion(query string) PatternSuggestion
GetPatternSuggestion returns recommended pattern from natural language query (for LLM assistance) This function can be used as reference when LLM converts natural language to ast-grep patterns
type SearchCodeTool ¶
type SearchCodeTool struct{}
SearchCodeTool is the tool for code search
func (*SearchCodeTool) Description ¶ added in v0.44.0
func (t *SearchCodeTool) Description() string
func (*SearchCodeTool) Parameters ¶ added in v0.44.0
func (t *SearchCodeTool) Parameters() map[string]interface{}
func (*SearchCodeTool) Run ¶
func (t *SearchCodeTool) Run(args map[string]string) (string, *tools.FileChange, error)
Run executes the code search tool
type SearchFileTool ¶
type SearchFileTool struct{}
SearchFileTool is the tool for file search
func (*SearchFileTool) Description ¶ added in v0.44.0
func (t *SearchFileTool) Description() string
func (*SearchFileTool) Parameters ¶ added in v0.44.0
func (t *SearchFileTool) Parameters() map[string]interface{}
func (*SearchFileTool) Run ¶
func (t *SearchFileTool) Run(args map[string]string) (string, *tools.FileChange, error)
Run executes the file search tool
type WebSearchTool ¶
type WebSearchTool struct{}
WebSearchTool is the tool for web search
func (*WebSearchTool) Description ¶ added in v0.44.0
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Parameters ¶ added in v0.44.0
func (t *WebSearchTool) Parameters() map[string]interface{}
func (*WebSearchTool) Run ¶
func (t *WebSearchTool) Run(args map[string]string) (string, *tools.FileChange, error)
Run executes the web search tool