mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-09 16:38:19 +00:00
refactor: Restructure file search settings
This commit restructures the file search settings. The previously individual settings for file search method, regex search backend, match search backend, and ripgrep path have been grouped into a new filesSearchSettings object.
This commit is contained in:
@@ -3,6 +3,7 @@ import * as path from 'path'
|
||||
|
||||
import { App, normalizePath } from 'obsidian'
|
||||
|
||||
import { FilesSearchSettings } from "../../types/settings"
|
||||
import {
|
||||
CustomModePrompts,
|
||||
Mode,
|
||||
@@ -68,6 +69,7 @@ export class SystemPrompt {
|
||||
cwd: string,
|
||||
supportsComputerUse: boolean,
|
||||
mode: Mode,
|
||||
searchSettings: FilesSearchSettings,
|
||||
filesSearchMethod: string,
|
||||
mcpHub?: McpHub,
|
||||
diffStrategy?: DiffStrategy,
|
||||
@@ -105,6 +107,7 @@ ${getSharedToolUseSection()}
|
||||
${getToolDescriptionsForMode(
|
||||
mode,
|
||||
cwd,
|
||||
searchSettings,
|
||||
filesSearchMethod,
|
||||
supportsComputerUse,
|
||||
diffStrategy,
|
||||
@@ -148,6 +151,7 @@ ${await addCustomInstructions(this.app, promptComponent?.customInstructions || m
|
||||
cwd: string,
|
||||
supportsComputerUse: boolean,
|
||||
mode: Mode = defaultModeSlug,
|
||||
searchSettings: FilesSearchSettings,
|
||||
filesSearchMethod: string = 'regex',
|
||||
preferredLanguage?: string,
|
||||
diffStrategy?: DiffStrategy,
|
||||
@@ -203,6 +207,7 @@ ${customInstructions}`
|
||||
cwd,
|
||||
supportsComputerUse,
|
||||
currentMode.slug,
|
||||
searchSettings,
|
||||
filesSearchMethod,
|
||||
mcpHub,
|
||||
diffStrategy,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Mode, ModeConfig, getGroupName, getModeConfig, isToolAllowedForMode } from "../../../utils/modes"
|
||||
import { DiffStrategy } from "../../diff/DiffStrategy"
|
||||
import { McpHub } from "../../mcp/McpHub"
|
||||
import { FilesSearchSettings } from "../../../types/settings"
|
||||
|
||||
import { getAccessMcpResourceDescription } from "./access-mcp-resource"
|
||||
import { getAskFollowupQuestionDescription } from "./ask-followup-question"
|
||||
@@ -40,6 +41,7 @@ const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined>
|
||||
export function getToolDescriptionsForMode(
|
||||
mode: Mode,
|
||||
cwd: string,
|
||||
searchSettings: FilesSearchSettings,
|
||||
searchTool: string,
|
||||
supportsComputerUse: boolean,
|
||||
diffStrategy?: DiffStrategy,
|
||||
@@ -51,6 +53,7 @@ export function getToolDescriptionsForMode(
|
||||
const config = getModeConfig(mode, customModes)
|
||||
const args: ToolArgs = {
|
||||
cwd,
|
||||
searchSettings,
|
||||
searchTool,
|
||||
supportsComputerUse,
|
||||
diffStrategy,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ToolArgs } from "./types"
|
||||
import { useSettings } from '../../../contexts/SettingsContext'
|
||||
|
||||
export function getSearchFilesDescription(args: ToolArgs): string {
|
||||
if (args.searchTool === 'match') {
|
||||
@@ -34,9 +33,8 @@ Example: Requesting to search for all Markdown files containing 'test' in the cu
|
||||
}
|
||||
|
||||
export function getRegexSearchFilesDescription(args: ToolArgs): string {
|
||||
const { settings } = useSettings()
|
||||
let regex_syntax: string;
|
||||
switch (settings.regexSearchBackend) {
|
||||
switch (args.searchSettings.regexBackend) {
|
||||
case 'coreplugin':
|
||||
regex_syntax = "ECMAScript (JavaScript)";
|
||||
break;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { FilesSearchSettings } from "../../../types/settings"
|
||||
import { DiffStrategy } from "../../diff/DiffStrategy"
|
||||
import { McpHub } from "../../mcp/McpHub"
|
||||
|
||||
export type ToolArgs = {
|
||||
cwd: string
|
||||
searchSettings: FilesSearchSettings,
|
||||
searchTool?: string,
|
||||
supportsComputerUse: boolean
|
||||
diffStrategy?: DiffStrategy
|
||||
|
||||
Reference in New Issue
Block a user