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

Method getModifyContext

packages/core/src/tools/write-file.ts:468–505  ·  view source on GitHub ↗
(
    abortSignal: AbortSignal,
  )

Source from the content-addressed store, hash-verified

466 }
467
468 getModifyContext(
469 abortSignal: AbortSignal,
470 ): ModifyContext<WriteFileToolParams> {
471 return {
472 getFilePath: (params: WriteFileToolParams) => params.file_path,
473 getCurrentContent: async (params: WriteFileToolParams) => {
474 const correctedContentResult = await getCorrectedFileContent(
475 this.config,
476 params.file_path,
477 params.content,
478 abortSignal,
479 );
480 return correctedContentResult.originalContent;
481 },
482 getProposedContent: async (params: WriteFileToolParams) => {
483 const correctedContentResult = await getCorrectedFileContent(
484 this.config,
485 params.file_path,
486 params.content,
487 abortSignal,
488 );
489 return correctedContentResult.correctedContent;
490 },
491 createUpdatedParams: (
492 _oldContent: string,
493 modifiedProposedContent: string,
494 originalParams: WriteFileToolParams,
495 ) => {
496 const content = originalParams.content;
497 return {
498 ...originalParams,
499 ai_proposed_content: content,
500 content: modifiedProposedContent,
501 modified_by_user: true,
502 };
503 },
504 };
505 }
506}

Callers

nothing calls this directly

Calls 1

getCorrectedFileContentFunction · 0.85

Tested by

no test coverage detected