Skip to content

chore: normalize line endings to LF via .gitattributes#224

Open
zbl1998-sdjn wants to merge 1 commit into
MoonshotAI:mainfrom
zbl1998-sdjn:chore/gitattributes-eol-lf
Open

chore: normalize line endings to LF via .gitattributes#224
zbl1998-sdjn wants to merge 1 commit into
MoonshotAI:mainfrom
zbl1998-sdjn:chore/gitattributes-eol-lf

Conversation

@zbl1998-sdjn
Copy link
Copy Markdown

Related Issue

No linked issue. Per CONTRIBUTING this is a small build/repo-hygiene fix that can be opened directly; the problem is explained below.

Problem

The repository has no .gitattributes. With Git for Windows' default core.autocrlf=true, text files are checked out as CRLF on Windows. This includes the raw-text prompt/skill .md files that are imported as model input — e.g. packages/agent-core/src/tools/builtin/file/read.ts:

import readDescriptionTemplate from './read.md';

Two concrete consequences on Windows checkouts:

  1. A contributor who edits and commits one of these .md files can silently introduce CRLF, changing the shipped prompt's byte/token footprint.
  2. Byte/line-ending–sensitive tests are not reproducible locally (e.g. token-count snapshots differ because the loaded .md content carries \r).

What changed

Add a .gitattributes that pins line endings to LF for all text files (with explicit binary types), so the repository stores and checks out LF on every platform regardless of a contributor's local core.autocrlf setting:

* text=auto eol=lf
# explicit binary types (never normalized): *.png, *.jpg, *.woff2, *.pdf, …

The repository's existing blobs are already LF, so this change is declarative — it adds one file with no content churn to existing files. Verified after the change on Node 24.16.0 + pnpm 10.33.0:

  • pnpm lint → 0 errors
  • pnpm typecheck → passes

This approach is standard repo hygiene and fits Kimi Code because the prompt/skill .md files are part of the shipped artifact; guaranteeing LF in the repo prevents accidental CRLF from a Windows contributor altering them.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. — N/A (line-ending policy; no runtime code changed)
  • Ran gen-changesets skill, or this PR needs no changeset. — No changeset: no publishable package code/behavior changes.
  • Ran gen-docs skill, or this PR needs no doc update. — No user-facing behavior change.

The repository has no `.gitattributes`, so with Git for Windows' default
`core.autocrlf=true`, source files check out as CRLF on Windows. This
includes the raw-text prompt/skill `.md` files imported as model input
(e.g. `packages/agent-core/src/tools/builtin/file/read.ts` does
`import readDescriptionTemplate from './read.md'`). A contributor editing
and committing such a file on Windows can silently introduce CRLF, which
changes the shipped prompt's byte/token footprint.

Add `* text=auto eol=lf` (plus explicit `binary` types) so the repository
stores and checks out LF on every platform, regardless of a contributor's
local `core.autocrlf`. Existing blobs are already LF, so this is a
declarative change with no content churn.
Copilot AI review requested due to automatic review settings May 29, 2026 14:17
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

⚠️ No Changeset found

Latest commit: cfe2ce6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant