Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
ActionType represents the type of action to perform
const ( ActionSearch ActionType = "search" ActionIndex ActionType = "index" ActionStatus ActionType = "status" ActionClear ActionType = "clear" )
type ClearResponse ¶
type ClearResponse struct {
Cleared bool `json:"cleared"`
FilesCleared int `json:"files_cleared"`
ItemsCleared int `json:"items_cleared"`
}
ClearResponse represents the response from a clear action
type CodeSearchTool ¶
type CodeSearchTool struct {
// contains filtered or unexported fields
}
CodeSearchTool implements the tools.Tool interface for semantic code search
func (*CodeSearchTool) Definition ¶
func (t *CodeSearchTool) Definition() mcp.Tool
Definition returns the tool's definition for MCP registration
func (*CodeSearchTool) Execute ¶
func (t *CodeSearchTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcp.CallToolResult, error)
Execute executes the code search tool
func (*CodeSearchTool) ProvideExtendedInfo ¶
func (t *CodeSearchTool) ProvideExtendedInfo() *tools.ExtendedHelp
ProvideExtendedInfo implements the ExtendedHelpProvider interface
type EmbeddingConfig ¶
type EmbeddingConfig struct {
ModelPath string // Path to model files
RuntimePath string // Path to ONNX runtime library
BatchSize int // Batch size for embedding generation
MaxSeqLength int // Maximum sequence length
}
EmbeddingConfig holds configuration for the embedding engine
func DefaultEmbeddingConfig ¶
func DefaultEmbeddingConfig() EmbeddingConfig
DefaultEmbeddingConfig returns the default embedding configuration
type EmbeddingEngine ¶
EmbeddingEngine wraps the embedding package
func NewEmbeddingEngine ¶
func NewEmbeddingEngine(config EmbeddingConfig, logger *logrus.Logger) (*EmbeddingEngine, error)
NewEmbeddingEngine creates a new embedding engine
type FileTracker ¶
type FileTracker = filetracker.Tracker
FileTracker wraps the filetracker package
func NewFileTracker ¶
func NewFileTracker(storePath string, logger *logrus.Logger) (*FileTracker, error)
NewFileTracker creates a new file tracker
type IndexResponse ¶
type IndexResponse struct {
IndexedFiles int `json:"indexed_files"`
IndexedItems int `json:"indexed_items"`
SkippedFiles int `json:"skipped_files,omitempty"`
}
IndexResponse represents the response from an index action
type IndexedItem ¶
type IndexedItem struct {
ID string `json:"id"` // Unique identifier
Path string `json:"path"` // File path
Name string `json:"name"` // Function/class name
Type string `json:"type"` // "function", "method", "class"
Signature string `json:"signature"` // Full signature
Line int `json:"line"` // Line number
Embedding []float32 `json:"embedding"` // Vector embedding
}
IndexedItem represents an item stored in the vector database
type Indexer ¶
Indexer wraps the index package
func NewIndexer ¶
func NewIndexer(embedder *EmbeddingEngine, store *VectorStore, tracker *FileTracker, logger *logrus.Logger) *Indexer
NewIndexer creates a new indexer
func (*Indexer) IndexFiles ¶
IndexFiles indexes specific files (used for reindexing stale files)
type SearchRequest ¶
type SearchRequest struct {
Action ActionType `json:"action"`
Source []string `json:"source,omitempty"` // Paths for index/search/status/clear
Query string `json:"query,omitempty"` // Natural language query for search
Limit int `json:"limit,omitempty"` // Max results (default: 10)
Threshold float64 `json:"threshold,omitempty"` // Similarity threshold (default: 0.5)
}
SearchRequest represents a request to the code_search tool
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult `json:"results,omitempty"`
TotalIndexed int `json:"total_indexed,omitempty"`
}
SearchResponse represents the response from a search action
type SearchResult ¶
type SearchResult struct {
Path string `json:"path"`
Name string `json:"name"`
Type string `json:"type"` // "function", "method", "class"
Signature string `json:"signature"`
Similarity float64 `json:"similarity"`
Line int `json:"line,omitempty"`
}
SearchResult represents a single search result
type StatusResponse ¶
type StatusResponse struct {
Indexed bool `json:"indexed"`
TotalFiles int `json:"total_files"`
TotalItems int `json:"total_items"`
ModelLoaded bool `json:"model_loaded"`
RuntimeLoaded bool `json:"runtime_loaded"`
RuntimeVersion string `json:"runtime_version,omitempty"`
}
StatusResponse represents the response from a status action
type VectorStore ¶
type VectorStore struct {
*vectorstore.Store
}
VectorStore wraps the vectorstore package
func NewVectorStore ¶
func NewVectorStore(logger *logrus.Logger) (*VectorStore, error)
NewVectorStore creates a new vector store
func (*VectorStore) Clear ¶
func (v *VectorStore) Clear(filterPaths []string) (*ClearResponse, error)
Clear clears the store
func (*VectorStore) Search ¶
func (v *VectorStore) Search(ctx context.Context, queryEmbedding []float32, limit int, threshold float64, filterPaths []string) ([]SearchResult, error)
Search performs similarity search and returns SearchResult slice
func (*VectorStore) Status ¶
func (v *VectorStore) Status() *StatusResponse
Status returns the store status
func (*VectorStore) StorePath ¶
func (v *VectorStore) StorePath() string
StorePath returns the path to the store directory