MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / buildPatchAttempts

Function buildPatchAttempts

sdk/src/tools/apply-patch.ts:482–499  ·  view source on GitHub ↗
(oldContent: string, diff: string)

Source from the content-addressed store, hash-verified

480}
481
482function buildPatchAttempts(oldContent: string, diff: string): PatchAttempt[] {
483 const normalizedOld = normalizeLineEndings(oldContent)
484 const normalizedDiff = normalizeLineEndings(diff)
485
486 return [
487 { name: 'codex_like', source: normalizedOld, diff: normalizedDiff },
488 {
489 name: 'with_trailing_newline',
490 source: ensureTrailingNewline(normalizedOld),
491 diff: normalizedDiff,
492 },
493 {
494 name: 'without_trailing_newline',
495 source: stripTrailingNewline(normalizedOld),
496 diff: normalizedDiff,
497 },
498 ]
499}
500
501function tryApplyPatchWithFallbacks(params: {
502 oldContent: string

Callers 1

Calls 3

ensureTrailingNewlineFunction · 0.85
stripTrailingNewlineFunction · 0.85
normalizeLineEndingsFunction · 0.70

Tested by

no test coverage detected