fix(hashline-edit): align autocorrect, BOM/CRLF, and tool description with oh-my-pi

- Rewrite restoreOldWrappedLines to use oh-my-pi's span-scanning algorithm
- Add stripTrailingContinuationTokens and stripMergeOperatorChars helpers
- Fix detectLineEnding to use first-occurrence logic instead of any-match
- Fix applyAppend/applyPrepend to replace empty-line placeholder in empty files
- Enhance tool description with 7 critical rules, tag guidance, and anti-patterns
This commit is contained in:
YeonGyu-Kim
2026-02-22 14:40:18 +09:00
parent 3ba84d2107
commit 6ab3dc35b0
6 changed files with 207 additions and 29 deletions
@@ -134,6 +134,9 @@ export function applyAppend(lines: string[], text: string | string[]): string[]
if (normalized.length === 0) {
throw new Error("append requires non-empty text")
}
if (lines.length === 1 && lines[0] === "") {
return [...normalized]
}
return [...lines, ...normalized]
}
@@ -142,6 +145,9 @@ export function applyPrepend(lines: string[], text: string | string[]): string[]
if (normalized.length === 0) {
throw new Error("prepend requires non-empty text")
}
if (lines.length === 1 && lines[0] === "") {
return [...normalized]
}
return [...normalized, ...lines]
}