* Normalizes a match string by applying specific replacements * This helps handle when exact matches fail due to formatting differences * @returns The normalized string and which replacements were applied
(matchString: string)
| 555 | * @returns The normalized string and which replacements were applied |
| 556 | */ |
| 557 | function desanitizeMatchString(matchString: string): { |
| 558 | result: string |
| 559 | appliedReplacements: Array<{ from: string; to: string }> |
| 560 | } { |
| 561 | let result = matchString |
| 562 | const appliedReplacements: Array<{ from: string; to: string }> = [] |
| 563 | |
| 564 | for (const [from, to] of Object.entries(DESANITIZATIONS)) { |
| 565 | const beforeReplace = result |
| 566 | result = result.replaceAll(from, to) |
| 567 | |
| 568 | if (beforeReplace !== result) { |
| 569 | appliedReplacements.push({ from, to }) |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | return { result, appliedReplacements } |
| 574 | } |
| 575 | |
| 576 | /** |
| 577 | * Normalize the input for the FileEditTool |
no test coverage detected