diff options
| author | matt korwel <[email protected]> | 2025-06-09 12:19:42 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-09 12:19:42 -0700 |
| commit | 3b943c1582026bdf65feb13a73259ce0e034ab2f (patch) | |
| tree | 3368aa85053b8599fe1fb1349383736890ea73e0 /packages/core/src/tools/edit.ts | |
| parent | 2182a1cd2cb83071b9defad2314a689d773363e7 (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.ts | 4 |
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') { |
