feat: Enhance file search with core plugin and Omnisearch integration

- Introduces a new match_search_files tool for fuzzy/keyword search, integrating with Obsidian's core search plugin and updating Omnisearch integration for improved file search capabilities.
- Adds settings for selecting search backends (core plugin, Omnisearch, ripgrep) for both regex and match searches.
- Updates language files, prompts, and types to support the new functionality.
- Restructures search-related files for better organization.
This commit is contained in:
travertexg
2025-06-09 15:15:16 +00:00
parent 350a49cef9
commit 9984527e85
18 changed files with 326 additions and 36 deletions

View File

@@ -1,7 +1,9 @@
import { ToolArgs } from "./types"
export function getSearchFilesDescription(args: ToolArgs): string {
if (args.searchTool === 'regex') {
if (args.searchTool === 'match') {
return getMatchSearchFilesDescription(args)
} else if (args.searchTool === 'regex') {
return getRegexSearchFilesDescription(args)
} else if (args.searchTool === 'semantic') {
return getSemanticSearchFilesDescription(args)
@@ -10,6 +12,26 @@ export function getSearchFilesDescription(args: ToolArgs): string {
}
}
export function getMatchSearchFilesDescription(args: ToolArgs): string {
return `## match_search_files
Description: Request to perform a match/fuzzy search across files in a specified directory, providing context-rich results. This tool searches for specific content across multiple files, displaying each match with encapsulating context.
Parameters:
- path: (required) The path of the directory to search in (relative to the current working directory ${args.cwd}). This directory will be recursively searched.
- query: (required) The keyword, phrase to search for. The system will find documents with similar keywords/phrases.
Usage:
<match_search_files>
<path>Directory path here</path>
<query>Your keyword/phrase here</query>
</match_search_files>
Example: Requesting to search for all Markdown files containing 'test' in the current directory
<match_search_files>
<path>.</path>
<query>test</query>
</match_search_files>`
}
export function getRegexSearchFilesDescription(args: ToolArgs): string {
return `## regex_search_files
Description: Request to perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.