Skip to content

fix(tools): use LF line endings in generate_tool_specs.py on Windows#4888

Open
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
NIK-TIGER-BILL:fix/tool-specs-crlf-windows
Open

fix(tools): use LF line endings in generate_tool_specs.py on Windows#4888
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
NIK-TIGER-BILL:fix/tool-specs-crlf-windows

Conversation

@NIK-TIGER-BILL
Copy link
Copy Markdown

@NIK-TIGER-BILL NIK-TIGER-BILL commented Mar 15, 2026

Problem

On Windows, Python's open() in text mode uses CRLF (\r\n) line endings by default. Running generate_tool_specs.py on Windows regenerates tool.specs.json with CRLF, causing every line to appear modified in git diff even though content is unchanged.

Fix

Pass newline="\n" to open() in save_to_json() to force LF line endings regardless of the operating system:

# Before
with open(output_path, "w", encoding="utf-8") as f:

# After
with open(output_path, "w", encoding="utf-8", newline="\n") as f:

Fixes #4737


Note

Low Risk
Low risk: a single file-write option change that only affects newline normalization in generated JSON output.

Overview
Ensures ToolSpecExtractor.save_to_json() opens the output file with newline="\n", so regenerating tool.specs.json on Windows uses LF instead of CRLF and avoids whole-file diff churn.

Written by Cursor Bugbot for commit 8e936f9. This will update automatically on new commits. Configure here.

On Windows, Python's text mode uses CRLF line endings by default.
This causes generate_tool_specs.py to regenerate tool.specs.json with
CRLF, making every line appear as modified in git diff.

Pass newline='\n' to open() to force LF line endings regardless of OS.

Fixes crewAIInc#4737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] generate_tool_specs.py writes CRLF on Windows, causing spurious diffs

1 participant