search

package
v0.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteAstGrep

func ExecuteAstGrep(pattern, lang, path string) string

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

func ExecuteSearchCode(pattern string, path string) string

ExecuteSearchCode searches for a pattern in code files

func ExecuteSearchFile

func ExecuteSearchFile(pattern string, path string) string

ExecuteSearchFile searches for files by name pattern

func ExecuteWebSearch

func ExecuteWebSearch(query string) string

ExecuteWebSearch executes web search using Serper API

func RegisterTools

func RegisterTools(registry *tools.Registry)

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) Name

func (t *AstGrepTool) Name() string

Name returns the tool name

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

type FileReplaceResult struct {
	FilePath   string
	MatchCount int
	BackupPath string
}

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) Name

func (t *GrepReplaceTool) Name() string

Name returns the tool name

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

type PatternSuggestion struct {
	Pattern string
	Lang    string
	Hint    string
}

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) Name

func (t *SearchCodeTool) Name() string

Name returns the tool name

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) Name

func (t *SearchFileTool) Name() string

Name returns the tool name

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) Name

func (t *WebSearchTool) Name() string

Name returns the tool name

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL