@lvce-editor/chat-tool-worker 9.25.0 → 9.27.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.
@@ -1484,15 +1484,15 @@ const executeGetWorkspaceUriTool = async (_args, _options) => {
1484
1484
  };
1485
1485
 
1486
1486
  /**
1487
- * Matches a string against a glob pattern
1488
- * Supported patterns:
1489
- * - * matches any characters except /
1490
- * - ? matches a single character except /
1491
- * - ** matches any characters including /
1492
- * - [abc] matches a, b, or c
1493
- * - [!abc] matches any character except a, b, c
1494
- * - [a-z] matches any character between a and z
1495
- */
1487
+ Matches a string against a glob pattern
1488
+ Supported patterns:
1489
+ - * matches any characters except /
1490
+ - ? matches a single character except /
1491
+ - ** matches any characters including /
1492
+ - [abc] matches a, b, or c
1493
+ - [!abc] matches any character except a, b, c
1494
+ - [a-z] matches any character between a and z
1495
+ */
1496
1496
 
1497
1497
  const REGEX_SPECIAL_CHARS_REGEX = /[.*+?^${}()|[\]\\]/g;
1498
1498
  const LEADING_DOT_SLASH_REGEX$1 = /^\.\//g;
@@ -2039,22 +2039,7 @@ const getGrepSearchArgs = args => {
2039
2039
  query,
2040
2040
  useDefaultExcludes
2041
2041
  } = args;
2042
- if (!isString(query) || !isBoolean(isRegexp)) {
2043
- return undefined;
2044
- }
2045
- if (!isOptional(includePattern, isString)) {
2046
- return undefined;
2047
- }
2048
- if (!isOptional(maxResults, isNumber)) {
2049
- return undefined;
2050
- }
2051
- if (!isOptional(includeIgnoredFiles, isBoolean)) {
2052
- return undefined;
2053
- }
2054
- if (!isOptional(useDefaultExcludes, isBoolean)) {
2055
- return undefined;
2056
- }
2057
- if (!isOptional(outputFormat, isOutputFormat)) {
2042
+ if (!isString(query) || !isBoolean(isRegexp) || !isOptional(includePattern, isString) || !isOptional(maxResults, isNumber) || !isOptional(includeIgnoredFiles, isBoolean) || !isOptional(useDefaultExcludes, isBoolean) || !isOptional(outputFormat, isOutputFormat)) {
2058
2043
  return undefined;
2059
2044
  }
2060
2045
  return {
@@ -2072,7 +2057,7 @@ const getGrepSearchArgs = args => {
2072
2057
  }),
2073
2058
  isRegexp,
2074
2059
  query,
2075
- useDefaultExcludes: useDefaultExcludes === undefined ? true : useDefaultExcludes
2060
+ useDefaultExcludes: useDefaultExcludes ?? true
2076
2061
  };
2077
2062
  };
2078
2063
 
@@ -2242,6 +2227,8 @@ const executeRenderHtmlTool = async (args, _options) => {
2242
2227
  };
2243
2228
  };
2244
2229
 
2230
+ const outputModes = ['content', 'files_with_matches', 'count'];
2231
+ const isOutputMode = mode => outputModes.includes(mode);
2245
2232
  const getRgArgs = args => {
2246
2233
  const {
2247
2234
  '-n': lineNumbers,
@@ -2255,7 +2242,7 @@ const getRgArgs = args => {
2255
2242
  if (path !== undefined && typeof path !== 'string') {
2256
2243
  return undefined;
2257
2244
  }
2258
- if (output_mode !== undefined && output_mode !== 'content' && output_mode !== 'files_with_matches' && output_mode !== 'count') {
2245
+ if (output_mode !== undefined && !isOutputMode(output_mode)) {
2259
2246
  return undefined;
2260
2247
  }
2261
2248
  if (lineNumbers !== undefined && typeof lineNumbers !== 'boolean') {
@@ -2294,13 +2281,12 @@ const getRunInTerminalOptions = args => {
2294
2281
  if (!options || typeof options !== 'object') {
2295
2282
  return undefined;
2296
2283
  }
2297
- const candidate = options;
2298
2284
  const {
2299
2285
  command,
2300
2286
  explanation,
2301
2287
  goal,
2302
2288
  shell
2303
- } = candidate;
2289
+ } = options;
2304
2290
  if (typeof command !== 'string' || typeof explanation !== 'string' || typeof goal !== 'string' || typeof shell !== 'string') {
2305
2291
  return undefined;
2306
2292
  }
@@ -2484,18 +2470,14 @@ const getSearchOptions = args => {
2484
2470
  if (!options || typeof options !== 'object') {
2485
2471
  return undefined;
2486
2472
  }
2487
- const candidate = options;
2488
2473
  const {
2489
2474
  exclude,
2490
2475
  isRegex,
2491
2476
  matchCase,
2492
2477
  matchWholeWord,
2493
2478
  value
2494
- } = candidate;
2495
- if (typeof value !== 'string' || typeof isRegex !== 'boolean' || typeof matchCase !== 'boolean' || typeof matchWholeWord !== 'boolean') {
2496
- return undefined;
2497
- }
2498
- if (!Array.isArray(exclude) || exclude.some(item => typeof item !== 'string')) {
2479
+ } = options;
2480
+ if (typeof value !== 'string' || typeof isRegex !== 'boolean' || typeof matchCase !== 'boolean' || typeof matchWholeWord !== 'boolean' || !Array.isArray(exclude) || exclude.some(item => typeof item !== 'string')) {
2499
2481
  return undefined;
2500
2482
  }
2501
2483
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-tool-worker",
3
- "version": "9.25.0",
3
+ "version": "9.27.0",
4
4
  "description": "Chat Tool Worker",
5
5
  "repository": {
6
6
  "type": "git",