summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/edit.ts
diff options
context:
space:
mode:
authormatt korwel <[email protected]>2025-06-09 12:19:42 -0700
committerGitHub <[email protected]>2025-06-09 12:19:42 -0700
commit3b943c1582026bdf65feb13a73259ce0e034ab2f (patch)
tree3368aa85053b8599fe1fb1349383736890ea73e0 /packages/core/src/tools/edit.ts
parent2182a1cd2cb83071b9defad2314a689d773363e7 (diff)
Windows: Refactor Shell Scripts to Node.js for Cross-Platform Compatibility (#784)
Diffstat (limited to 'packages/core/src/tools/edit.ts')
-rw-r--r--packages/core/src/tools/edit.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts
index 3240fa30..fdabc5b6 100644
--- a/packages/core/src/tools/edit.ts
+++ b/packages/core/src/tools/edit.ts
@@ -206,6 +206,8 @@ Expectation for required parameters:
try {
currentContent = fs.readFileSync(params.file_path, 'utf8');
+ // Normalize line endings to LF for consistent processing.
+ currentContent = currentContent.replace(/\r\n/g, '\n');
fileExists = true;
} catch (err: unknown) {
if (!isNodeError(err) || err.code !== 'ENOENT') {
@@ -303,6 +305,8 @@ Expectation for required parameters:
try {
currentContent = fs.readFileSync(params.file_path, 'utf8');
+ // Normalize line endings to LF for consistent processing.
+ currentContent = currentContent.replace(/\r\n/g, '\n');
fileExists = true;
} catch (err: unknown) {
if (isNodeError(err) && err.code === 'ENOENT') {