MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getDescription

Method getDescription

packages/core/src/tools/grep.ts:284–315  ·  view source on GitHub ↗

* Gets a description of the grep operation * @param params Parameters for the grep operation * @returns A string describing the grep

()

Source from the content-addressed store, hash-verified

282 * @returns A string describing the grep
283 */
284 getDescription(): string {
285 let description = `'${this.params.pattern}'`;
286 if (this.params.include) {
287 description += ` in ${this.params.include}`;
288 }
289 if (this.params.path) {
290 const resolvedPath = path.resolve(
291 this.config.getTargetDir(),
292 this.params.path,
293 );
294 if (
295 resolvedPath === this.config.getTargetDir() ||
296 this.params.path === '.'
297 ) {
298 description += ` within ./`;
299 } else {
300 const relativePath = makeRelative(
301 resolvedPath,
302 this.config.getTargetDir(),
303 );
304 description += ` within ${shortenPath(relativePath)}`;
305 }
306 } else {
307 // When no path is specified, indicate searching all workspace directories
308 const workspaceContext = this.config.getWorkspaceContext();
309 const directories = workspaceContext.getDirectories();
310 if (directories.length > 1) {
311 description += ` across all workspace directories`;
312 }
313 }
314 return description;
315 }
316
317 /**
318 * Performs the actual search using the prioritized strategies.

Callers

nothing calls this directly

Calls 5

makeRelativeFunction · 0.85
shortenPathFunction · 0.85
getTargetDirMethod · 0.80
getWorkspaceContextMethod · 0.80
getDirectoriesMethod · 0.80

Tested by

no test coverage detected