@lvce-editor/chat-tool-worker 8.8.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatToolWorkerMain.js +21 -5
- package/package.json +1 -1
|
@@ -1787,16 +1787,23 @@ const isFileUri = value => {
|
|
|
1787
1787
|
return value.startsWith('file://');
|
|
1788
1788
|
};
|
|
1789
1789
|
|
|
1790
|
+
const defaultExcludeGlobs = ['!**/node_modules/**', '!**/.git/**'];
|
|
1790
1791
|
const getRipGrepArgs = ({
|
|
1791
1792
|
includeIgnoredFiles,
|
|
1792
1793
|
includePattern,
|
|
1793
1794
|
isRegexp,
|
|
1794
|
-
query
|
|
1795
|
+
query,
|
|
1796
|
+
useDefaultExcludes
|
|
1795
1797
|
}) => {
|
|
1796
1798
|
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', '1', '--ignore-case'];
|
|
1797
1799
|
if (includeIgnoredFiles) {
|
|
1798
1800
|
ripGrepArgs.push('--no-ignore');
|
|
1799
1801
|
}
|
|
1802
|
+
if (useDefaultExcludes) {
|
|
1803
|
+
for (const glob of defaultExcludeGlobs) {
|
|
1804
|
+
ripGrepArgs.push('--glob', glob);
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1800
1807
|
if (includePattern && !isFileUri(includePattern) && !isAbsoluteFileSystemPath(includePattern)) {
|
|
1801
1808
|
ripGrepArgs.push('--glob', includePattern);
|
|
1802
1809
|
}
|
|
@@ -1921,7 +1928,8 @@ const getGrepSearchArgs = args => {
|
|
|
1921
1928
|
isRegexp,
|
|
1922
1929
|
maxResults,
|
|
1923
1930
|
outputFormat,
|
|
1924
|
-
query
|
|
1931
|
+
query,
|
|
1932
|
+
useDefaultExcludes
|
|
1925
1933
|
} = args;
|
|
1926
1934
|
if (typeof query !== 'string' || typeof isRegexp !== 'boolean') {
|
|
1927
1935
|
return undefined;
|
|
@@ -1935,6 +1943,9 @@ const getGrepSearchArgs = args => {
|
|
|
1935
1943
|
if (includeIgnoredFiles !== undefined && typeof includeIgnoredFiles !== 'boolean') {
|
|
1936
1944
|
return undefined;
|
|
1937
1945
|
}
|
|
1946
|
+
if (useDefaultExcludes !== undefined && typeof useDefaultExcludes !== 'boolean') {
|
|
1947
|
+
return undefined;
|
|
1948
|
+
}
|
|
1938
1949
|
if (outputFormat !== undefined && outputFormat !== 'xml' && outputFormat !== 'json') {
|
|
1939
1950
|
return undefined;
|
|
1940
1951
|
}
|
|
@@ -1952,11 +1963,12 @@ const getGrepSearchArgs = args => {
|
|
|
1952
1963
|
outputFormat
|
|
1953
1964
|
}),
|
|
1954
1965
|
isRegexp,
|
|
1955
|
-
query
|
|
1966
|
+
query,
|
|
1967
|
+
useDefaultExcludes: useDefaultExcludes === undefined ? true : useDefaultExcludes
|
|
1956
1968
|
};
|
|
1957
1969
|
};
|
|
1958
1970
|
|
|
1959
|
-
const grepSearchArgumentError = 'Invalid argument: grep_search requires query (string), isRegexp (boolean), optional includePattern (string), optional maxResults (number), optional includeIgnoredFiles (boolean), and optional outputFormat ("xml" | "json").';
|
|
1971
|
+
const grepSearchArgumentError = 'Invalid argument: grep_search requires query (string), isRegexp (boolean), optional includePattern (string), optional maxResults (number), optional includeIgnoredFiles (boolean), optional useDefaultExcludes (boolean), and optional outputFormat ("xml" | "json").';
|
|
1960
1972
|
|
|
1961
1973
|
const executeGrepSearchTool = async (args, options) => {
|
|
1962
1974
|
const grepSearchArgs = getGrepSearchArgs(args);
|
|
@@ -2619,7 +2631,7 @@ const getGlobTool = () => {
|
|
|
2619
2631
|
const getGrepSearchTool = () => {
|
|
2620
2632
|
return {
|
|
2621
2633
|
function: {
|
|
2622
|
-
description: "Do a fast text search in the workspace. Use this tool when you want to search with an exact string or regex. If you are not sure what words will appear in the workspace, prefer using regex patterns with alternation (|) or character classes to search for multiple potential words at once instead of making separate searches. For example, use 'function|method|procedure' to look for all of those words at once. Use includePattern to search within files matching a specific pattern, or in a specific file, using a relative path. Use 'includeIgnoredFiles' to include files normally ignored by .gitignore, other ignore files
|
|
2634
|
+
description: "Do a fast text search in the workspace. Use this tool when you want to search with an exact string or regex. If you are not sure what words will appear in the workspace, prefer using regex patterns with alternation (|) or character classes to search for multiple potential words at once instead of making separate searches. For example, use 'function|method|procedure' to look for all of those words at once. Use includePattern to search within files matching a specific pattern, or in a specific file, using a relative path. Use 'includeIgnoredFiles' to include files normally ignored by .gitignore, other ignore files and `files.exclude` and `search.exclude` settings. Warning: using this may cause the search to be slower, only set it when you want to search in ignored folders like node_modules or build outputs. By default, grep_search also excludes node_modules and .git via ripgrep globs; set useDefaultExcludes to false if you need to search those directories. Use this tool when you want to see an overview of a particular file, instead of using read_file many times to look for code within a file.\n\nIn a multi-root workspace, you can scope the search to a specific workspace folder by using the absolute path to the folder as the includePattern, e.g. /path/to/folder.",
|
|
2623
2635
|
name: 'grep_search',
|
|
2624
2636
|
parameters: {
|
|
2625
2637
|
additionalProperties: false,
|
|
@@ -2648,6 +2660,10 @@ const getGrepSearchTool = () => {
|
|
|
2648
2660
|
query: {
|
|
2649
2661
|
description: "The pattern to search for in files in the workspace. Use regex with alternation (e.g., 'word1|word2|word3') or character classes to find multiple potential words in a single search. Be sure to set the isRegexp property properly to declare whether it's a regex or plain text pattern. Is case-insensitive.",
|
|
2650
2662
|
type: 'string'
|
|
2663
|
+
},
|
|
2664
|
+
useDefaultExcludes: {
|
|
2665
|
+
description: 'Whether to exclude node_modules and .git with built-in ripgrep globs. Defaults to true. Set to false when you explicitly need to search those directories.',
|
|
2666
|
+
type: 'boolean'
|
|
2651
2667
|
}
|
|
2652
2668
|
},
|
|
2653
2669
|
required: ['query', 'isRegexp'],
|