MCPcopy
hub / github.com/modelcontextprotocol/servers / createUnifiedDiff

Function createUnifiedDiff

src/filesystem/lib.ts:60–73  ·  view source on GitHub ↗
(originalContent: string, newContent: string, filepath: string = 'file')

Source from the content-addressed store, hash-verified

58}
59
60export function createUnifiedDiff(originalContent: string, newContent: string, filepath: string = 'file'): string {
61 // Ensure consistent line endings for diff
62 const normalizedOriginal = normalizeLineEndings(originalContent);
63 const normalizedNew = normalizeLineEndings(newContent);
64
65 return createTwoFilesPatch(
66 filepath,
67 filepath,
68 normalizedOriginal,
69 normalizedNew,
70 'original',
71 'modified'
72 );
73}
74
75// Helper function to resolve relative paths against allowed directories
76function resolveRelativePathAgainstAllowedDirectories(relativePath: string): string {

Callers 2

applyFileEditsFunction · 0.85
lib.test.tsFile · 0.85

Calls 1

normalizeLineEndingsFunction · 0.85

Tested by

no test coverage detected