(input)
| 539 | } |
| 540 | |
| 541 | function detectAndClean(input) { |
| 542 | if (!input.trim()) { |
| 543 | return ''; |
| 544 | } |
| 545 | |
| 546 | if (/^\s*\d+\s*[+-]\s/m.test(input)) { |
| 547 | return cleanGitDiff(input); |
| 548 | } |
| 549 | |
| 550 | if (/[│┃╏╎▌]/.test(input) || /\|/.test(input)) { |
| 551 | return cleanClaudeDump(input); |
| 552 | } |
| 553 | |
| 554 | const codeScore = (input.match(/[{}();=]/g) || []).length; |
| 555 | const lineCount = input.split('\n').length; |
| 556 | if (lineCount > 0 && codeScore / lineCount > 0.5) { |
| 557 | return input.trim(); // leave code mostly untouched |
| 558 | } |
| 559 | |
| 560 | return cleanLLMText(input); |
| 561 | } |
| 562 | |
| 563 | cleanBtn.addEventListener('click', performCleanup); |
| 564 |
no test coverage detected