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

Method getDescription

packages/core/src/tools/edit.ts:287–307  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285 }
286
287 getDescription(): string {
288 const relativePath = makeRelative(
289 this.params.file_path,
290 this.config.getTargetDir(),
291 );
292 if (this.params.old_string === '') {
293 return `Create ${shortenPath(relativePath)}`;
294 }
295
296 const oldStringSnippet =
297 this.params.old_string.split('\n')[0].substring(0, 30) +
298 (this.params.old_string.length > 30 ? '...' : '');
299 const newStringSnippet =
300 this.params.new_string.split('\n')[0].substring(0, 30) +
301 (this.params.new_string.length > 30 ? '...' : '');
302
303 if (this.params.old_string === this.params.new_string) {
304 return `No file changes to ${shortenPath(relativePath)}`;
305 }
306 return `${shortenPath(relativePath)}: ${oldStringSnippet} => ${newStringSnippet}`;
307 }
308
309 /**
310 * Executes the edit operation with the given parameters.

Callers

nothing calls this directly

Calls 3

makeRelativeFunction · 0.85
shortenPathFunction · 0.85
getTargetDirMethod · 0.80

Tested by

no test coverage detected