Skip to content

chore: enforce LF line endings repository-wide#900

Merged
rjmurillo merged 1 commit into
mainfrom
claude/issue-896-20260113-2126
Jan 13, 2026
Merged

chore: enforce LF line endings repository-wide#900
rjmurillo merged 1 commit into
mainfrom
claude/issue-896-20260113-2126

Conversation

@rjmurillo-bot

Copy link
Copy Markdown
Collaborator

Summary

Comprehensive fix for line ending issues across all platforms (Windows/Linux/macOS).

Changes

  1. Global LF enforcement in .gitattributes:

    • Added * text=auto eol=lf rule
    • Prevents YAML frontmatter parsing errors on Windows
    • Eliminates cross-platform diff noise
  2. Developer setup documentation in CONTRIBUTING.md:

    • Added "Git Configuration" section
    • Platform-specific core.autocrlf instructions
    • Windows: git config --global core.autocrlf true
    • Linux/macOS: git config --global core.autocrlf input
  3. Normalization script (scripts/Normalize-LineEndings.ps1):

    • One-command normalization of existing files
    • Audit trails (before/after)
    • Clear reporting and next steps

Current State

  • 393 files currently have CRLF line endings
  • .gitattributes rules are in place (policy established)
  • Normalization should be done in a follow-up commit

Next Steps

After merging this PR, run:

pwsh scripts/Normalize-LineEndings.ps1

Then commit the normalized files in a follow-up PR.

Rationale

Prevents YAML frontmatter parsing errors on Windows documented in:

Addresses feedback from @rjmurillo that PR #895 needs comprehensive line ending enforcement, not just pattern-specific rules.

Fixes #896


Generated with Claude Code) • View job run • [Branch: claude/issue-896-20260113-2126](https://github.com/rjmurillo/ai-agents/tree/claude/issue-896-20260113-2126

- Add global `* text=auto eol=lf` rule to .gitattributes
- Document cross-platform Git configuration in CONTRIBUTING.md
- Add developer setup instructions for core.autocrlf
- Create Normalize-LineEndings.ps1 script for one-time normalization
- Audit shows 393 files currently have CRLF (need normalization)

This prevents YAML frontmatter parsing errors on Windows documented in:
- GitHub Copilot CLI issue #694
- GitHub Copilot CLI issue #673

Users should run the normalization script after pulling:
  pwsh scripts/Normalize-LineEndings.ps1

Then commit the normalized files in a follow-up commit.

Fixes #896

Co-authored-by: Richard Murillo <rjmurillo@users.noreply.github.com>
@github-actions github-actions Bot added the automation Automated workflows and processes label Jan 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Validation Report

Note

Status: PASS

Description Validation

Check Status
Description matches diff PASS

QA Validation

Check Status
Code changes detected True
QA report exists false

⚡ Warnings

  • QA report not found for code changes (recommended before merge)

Powered by PR Validation workflow

Comment thread .agents/analysis/line-endings-before.txt

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a repository-wide policy to enforce LF line endings, which is a great step for improving cross-platform development consistency and preventing common issues with tools that are sensitive to line endings. The changes are well-documented in both .gitattributes and CONTRIBUTING.md, providing clear guidance for all contributors. The inclusion of the Normalize-LineEndings.ps1 script is a thoughtful addition to handle the one-time migration of existing files.

My review focuses on the new PowerShell script, where I've identified a few areas for improvement regarding correctness and adherence to PowerShell best practices, particularly in its main conditional logic, normalization steps, and error handling. These suggestions aim to make the script more robust and align it with standard procedures.

Overall, this is a solid and much-needed change for the repository.

Comment thread scripts/Normalize-LineEndings.ps1
Comment thread scripts/Normalize-LineEndings.ps1
Comment thread scripts/Normalize-LineEndings.ps1
@github-actions

Copy link
Copy Markdown
Contributor

AI Quality Gate Review

Warning

⚠️ Final Verdict: WARN

Walkthrough

This PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:

  • Security Agent: Scans for vulnerabilities, secrets exposure, and security anti-patterns
  • QA Agent: Evaluates test coverage, error handling, and code quality
  • Analyst Agent: Assesses code quality, impact analysis, and maintainability
  • Architect Agent: Reviews design patterns, system boundaries, and architectural concerns
  • DevOps Agent: Evaluates CI/CD, build pipelines, and infrastructure changes
  • Roadmap Agent: Assesses strategic alignment, feature scope, and user value

Review Summary

Agent Verdict Category Status
Security PASS N/A
QA WARN N/A ⚠️
Analyst PASS N/A
Architect PASS N/A
DevOps PASS N/A
Roadmap PASS N/A

💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries.

Security Review Details

Let me also check the analysis file to complete the review.

Security Review: PR #900

PR Type Classification

File Category Security Scrutiny
.agents/analysis/line-endings-before.txt DOCS None required
.gitattributes CONFIG Schema and secrets only
CONTRIBUTING.md DOCS None required
scripts/Normalize-LineEndings.ps1 CODE Full OWASP review

Findings

Severity Category Finding Location CWE
None - No security issues identified - -

Analysis Summary

PowerShell Script (Normalize-LineEndings.ps1):

  • [PASS] No user input accepted (only -WhatIf switch)
  • [PASS] No shell injection vectors (commands use static arguments)
  • [PASS] No secrets or credentials
  • [PASS] File paths are relative and sanitized through Git commands
  • [PASS] Uses $ErrorActionPreference = 'Stop' for fail-safe execution
  • [PASS] git rm --cached and git add --renormalize are safe repository operations

.gitattributes:

  • [PASS] Standard Git configuration for line endings
  • [PASS] No secrets or sensitive data
  • [PASS] merge=ours strategy for HANDOFF.md is a documented architectural decision (ADR-014)

CONTRIBUTING.md:

  • [PASS] Documentation only with example Git commands
  • [PASS] No real credentials (only example configuration commands)

Recommendations

None required. The PR implements standard Git line ending normalization with no security implications.

Verdict

VERDICT: PASS
MESSAGE: PR contains configuration and utility script for line ending normalization. No security vulnerabilities identified. PowerShell script uses safe Git commands with no user-controlled input. Documentation changes only describe developer setup procedures.
QA Review Details

Let me check the line-endings-before.txt file structure and verify there are tests for the new script:

Based on my analysis, I have all the information needed to provide the QA verdict.


QA Review: PR #900 - chore: enforce LF line endings repository-wide

PR TYPE: MIXED

Files by category:

Category Files
CODE scripts/Normalize-LineEndings.ps1 (new, 174 lines)
CONFIG .gitattributes (modified)
DOCS CONTRIBUTING.md (modified)
DATA .agents/analysis/line-endings-before.txt (audit artifact)

Test Coverage Assessment

Area Status Evidence Files Checked
Unit tests Missing No Normalize-LineEndings.Tests.ps1 in scripts/tests/ scripts/Normalize-LineEndings.ps1
Edge cases Not applicable Script is operational tool, not business logic N/A
Error paths Tested manually in script Try-catch at lines 170-173, exit codes scripts/Normalize-LineEndings.ps1:105-173
Assertions Not applicable No unit tests exist N/A

Quality Concerns

Severity Issue Location Evidence Required Fix
HIGH New PowerShell script (174 lines) has no unit tests scripts/Normalize-LineEndings.ps1 No corresponding .Tests.ps1 file exists Create scripts/tests/Normalize-LineEndings.Tests.ps1
LOW Unicode BOM handling not explicit scripts/Normalize-LineEndings.ps1:100 Out-File -Encoding utf8 behavior varies by PS version Document PS7 requirement (already done in #Requires -Version 7.0)

Fail-Safe Pattern Verification

Pattern Status Evidence
Input validation [PASS] Test-GitRepository check at line 107-109
Error handling [PASS] Try-catch block lines 105-173, meaningful error messages
Timeout handling [N/A] Git commands, no network I/O
Fallback behavior [PASS] Early return if no normalization needed (lines 125-128)

Regression Risk Assessment

  • Risk Level: Low
  • Affected Components: New script only, no existing functionality modified
  • Breaking Changes: None - .gitattributes changes are additive
  • Required Testing: Manual execution of Normalize-LineEndings.ps1 on Windows/Linux

Code Quality

Metric Value Status
Function length Max 25 lines [PASS]
Cyclomatic complexity ≤5 per function [PASS]
Code duplication None detected [PASS]
Magic numbers None [PASS]
Documentation Comprehensive comment-based help [PASS]

Evidence Summary

VERDICT: WARN
MESSAGE: New 174-line PowerShell script lacks unit tests, but is operational tooling with good error handling.

PR TYPE: MIXED (CODE + CONFIG + DOCS)

EVIDENCE:
- Tests found: 0 for 1 new script (Normalize-LineEndings.ps1)
- Edge cases: N/A - operational script, not business logic
- Error handling: Tested - try-catch with exit codes, input validation
- Blocking issues: 0
- High severity issues: 1 (missing tests)

Rationale

This PR adds a well-structured PowerShell utility script with:

  1. Proper error handling (try-catch, meaningful messages)
  2. Input validation (Git repository check)
  3. WhatIf support for dry-run execution
  4. Comprehensive inline documentation
  5. Clear audit trail (before/after snapshots)

However, the script lacks unit tests. Per repository patterns, other scripts in scripts/ have corresponding .Tests.ps1 files. The missing tests are a HIGH severity concern but not BLOCKING because:

  1. This is an operational/maintenance script, not business logic
  2. The script is well-documented and follows defensive coding patterns
  3. The primary purpose is one-time normalization with clear rollback (git operations)

Recommendation: Create scripts/tests/Normalize-LineEndings.Tests.ps1 in a follow-up PR to test:

  • Test-GitRepository function
  • Get-LineEndingStats output parsing
  • Save-LineEndingAudit file creation
  • WhatIf behavior (no changes made)
Analyst Review Details

I have gathered sufficient information to complete the analysis.


Analyst Review: PR #900

Code Quality Score

Criterion Score (1-5) Notes
Readability 5 Extensive inline comments explain rationale, HOW, and WHY
Maintainability 5 Single point of truth for line endings; script is modular with helper functions
Consistency 5 Follows existing patterns: PowerShell 7, comment-block headers, ADR references
Simplicity 4 Global * text=auto eol=lf is simpler than file-specific rules; script has minor redundancy (see findings)

Overall: 4.75/5

Impact Assessment

  • Scope: Repository-wide (all 2674 tracked files affected by policy)
  • Risk Level: Low (policy change only; actual normalization deferred to follow-up PR)
  • Affected Components: .gitattributes, CONTRIBUTING.md, new script in scripts/, new audit file in .agents/analysis/

Findings

Priority Category Finding Location
Low Redundancy Script saves audit to hardcoded path .agents/analysis/line-endings-before.txt; this file is also committed in the PR. Script will overwrite it on next run. scripts/Normalize-LineEndings.ps1:121
Low Docs Windows guidance recommends core.autocrlf true, but with eol=lf in .gitattributes, checkout still delivers LF. The autocrlf setting becomes irrelevant for this repo. CONTRIBUTING.md:35, .gitattributes:35
Low Scope Original issue #896 requested rules for *.agent.md, *.prompt.md, *.shared.md. PR implements broader * text=auto eol=lf. This is acceptable but exceeds original scope. .gitattributes:59

Recommendations

  1. Clarify autocrlf guidance: The eol=lf directive overrides core.autocrlf. Consider simplifying CONTRIBUTING.md to state that no special Git config is required because .gitattributes enforces LF universally.
  2. Consider removing committed audit file: The line-endings-before.txt file (2674 lines) is a snapshot that will become stale. Either remove from PR or rename to indicate it was a one-time baseline.
  3. Add tests for script: The script lacks Pester tests. Consider adding scripts/tests/Normalize-LineEndings.Tests.ps1 in a follow-up.

Verdict

VERDICT: PASS
MESSAGE: Well-documented, low-risk policy change. Documentation exceeds typical standards. Minor scope expansion is an improvement over original request.
Architect Review Details

Design Quality Assessment

Aspect Rating (1-5) Notes
Pattern Adherence 5 Configuration-as-code pattern, single source of truth in .gitattributes
Boundary Respect 5 Changes constrained to git config, docs, and utility script
Coupling 5 No dependencies introduced; uses only git primitives
Cohesion 5 Each component (.gitattributes, docs, script) has single responsibility
Extensibility 4 Exception patterns documented; script supports -WhatIf

Overall Design Score: 4.8/5

Architectural Concerns

Severity Concern Location Recommendation
Low Script deletes index then re-adds Normalize-LineEndings.ps1:136-140 Add warning about uncommitted changes at script start

Breaking Change Assessment

  • Breaking Changes: No
  • Impact Scope: None
  • Migration Required: No
  • Migration Path: N/A

Technical Debt Analysis

  • Debt Added: Low (new script to maintain)
  • Debt Reduced: Medium (eliminates recurring CRLF parsing failures)
  • Net Impact: Improved

ADR Assessment

  • ADR Required: No
  • Decisions Identified: LF line ending enforcement is operational infrastructure, not architectural pattern
  • Existing ADR: None required; .gitattributes itself documents the decision with rationale
  • Recommendation: N/A - The .gitattributes file contains comprehensive inline documentation that serves the same purpose as an ADR for this infrastructure configuration

Recommendations

  1. Add uncommitted changes check to Normalize-LineEndings.ps1 before removing files from index
  2. Consider adding the script to pre-commit hook or CI to auto-detect regressions
VERDICT: PASS
MESSAGE: Sound infrastructure change. Configuration-as-code approach with inline documentation provides traceability. No architectural patterns affected.
DevOps Review Details

Let me also check the analysis file that was added:

The analysis file is a large audit log of line endings. This is an expected artifact from the normalization script. Now I have all the information needed to complete the DevOps review.

Pipeline Impact Assessment

Area Impact Notes
Build None No build system changes
Test None No test configuration changes
Deploy None No deployment changes
Cost None No CI/CD cost impact

CI/CD Quality Checks

Check Status Location
YAML syntax valid N/A No workflow files changed
Actions pinned N/A No actions changed
Secrets secure N/A No secrets affected
Permissions minimal N/A No permissions changed
Shell scripts robust scripts/Normalize-LineEndings.ps1

Findings

Severity Category Finding Location Fix
- Shell Script Well-structured PowerShell with proper error handling Normalize-LineEndings.ps1 None needed

Shell Script Quality Assessment

The Normalize-LineEndings.ps1 script demonstrates good practices:

  1. Error handling: Uses Set-StrictMode -Version Latest and $ErrorActionPreference = 'Stop' with try/catch blocks
  2. WhatIf support: Implements [CmdletBinding(SupportsShouldProcess)] for safe preview mode
  3. Input validation: Checks if running in a Git repository before proceeding
  4. Documentation: Complete comment-based help with synopsis, description, examples
  5. Audit trail: Saves before/after snapshots for verification
  6. PowerShell 7 requirement: #Requires -Version 7.0 ensures compatibility

.gitattributes Review

The .gitattributes configuration is comprehensive and well-documented:

  1. Global LF enforcement: * text=auto eol=lf correctly enforces LF line endings
  2. Merge strategy for HANDOFF.md: Uses merge=ours to prevent conflicts (per ADR-014)
  3. Future-proofing: Declares handoff-aggregate merge driver for future implementation
  4. Clear comments: Explains the "why" and "how" for each rule

CONTRIBUTING.md Review

The Git Configuration section provides clear, platform-specific instructions for developers on Windows, Linux, and macOS.

Recommendations

  1. None required. The PR follows DevOps best practices.

Verdict

VERDICT: PASS
MESSAGE: CONFIG PR with well-structured .gitattributes enforcement, robust PowerShell normalization script with WhatIf support and proper error handling, and clear developer documentation. No CI/CD or security concerns.
Roadmap Review Details

Strategic Alignment Assessment

Criterion Rating Notes
Aligns with project goals High Fixes documented YAML parsing errors affecting Windows developers (Issues #694, #673, #896)
Priority appropriate High Cross-platform stability is infrastructure-critical; blocking developers is P0
User value clear High Eliminates "Unexpected scalar at node end" errors for Windows contributors
Investment justified High One-time policy + script investment prevents recurring friction

Feature Completeness

  • Scope Assessment: Right-sized
  • Ship Ready: Yes (policy established, normalization deferred to follow-up)
  • MVP Complete: Yes
  • Enhancement Opportunities: None identified

Impact Analysis

Dimension Assessment Notes
User Value High Windows developers can now contribute without YAML parsing failures
Business Impact Medium Removes onboarding friction, reduces support burden
Technical Leverage High .gitattributes rule applies to all future files automatically
Competitive Position Neutral Standard cross-platform hygiene

Concerns

Priority Concern Recommendation
Low 393 files need normalization in follow-up PR Proceed as planned; normalization script is ready

Recommendations

  1. Merge this PR to establish the policy immediately
  2. Run normalization script as documented in "Next Steps" section
  3. Commit normalized files in a separate PR for clean history

Verdict

VERDICT: PASS
MESSAGE: Infrastructure change directly addresses documented user pain (YAML parsing errors). Scope is appropriate, investment is minimal, and the two-step approach (policy now, normalization later) reduces risk.

Run Details
Property Value
Run ID 20973436926
Triggered by pull_request on 900/merge
Commit 95a35bb1ffd9d05b6a6a570a93a9232fc26037a5

Powered by AI Quality Gate workflow

@rjmurillo rjmurillo added the triage:approved Human has triaged and approved bot responses for this PR label Jan 13, 2026
@rjmurillo rjmurillo marked this pull request as ready for review January 13, 2026 21:39
Copilot AI review requested due to automatic review settings January 13, 2026 21:39
@rjmurillo rjmurillo enabled auto-merge (squash) January 13, 2026 21:39
@rjmurillo rjmurillo merged commit 682a363 into main Jan 13, 2026
92 of 93 checks passed
@rjmurillo rjmurillo deleted the claude/issue-896-20260113-2126 branch January 13, 2026 21:41
@github-actions github-actions Bot added this to the 0.2.0 milestone Jan 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements comprehensive line ending enforcement to prevent YAML frontmatter parsing errors on Windows. The changes establish LF as the standard line ending across all files through .gitattributes configuration, provide developer setup guidance, and offer a normalization script for existing files.

Changes:

  • Added global * text=auto eol=lf rule in .gitattributes to enforce LF line endings repository-wide
  • Added "Git Configuration" section in CONTRIBUTING.md with platform-specific core.autocrlf instructions
  • Created scripts/Normalize-LineEndings.ps1 PowerShell script for one-command normalization of existing files with audit trails

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 10 comments.

File Description
.gitattributes Added comprehensive line ending normalization section with * text=auto eol=lf rule and extensive documentation explaining the rationale, Git behavior, and developer configuration requirements
CONTRIBUTING.md Added "Git Configuration" section with platform-specific instructions for Windows (core.autocrlf=true) and Linux/macOS (core.autocrlf=input), plus explanation of why line ending consistency matters
scripts/Normalize-LineEndings.ps1 New PowerShell script to normalize existing files to LF, with before/after statistics, audit file generation, and clear reporting of changes

Comment thread .gitattributes
Comment on lines +31 to +46
# In addition to this .gitattributes file, developers should configure their
# global Git settings based on their operating system:
#
# Windows:
# git config --global core.autocrlf true
# (Converts LF → CRLF on checkout, CRLF → LF on commit)
#
# Linux/macOS:
# git config --global core.autocrlf input
# (Accepts LF as-is, converts CRLF → LF on commit)
#
# This combination ensures:
# - Repository always has LF (.gitattributes enforces it)
# - Windows users get native CRLF for text editors (core.autocrlf=true)
# - Unix users get native LF (core.autocrlf=input)
# - No line ending conflicts or parsing errors

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation in .gitattributes states that with eol=lf, Git checks out files with LF line endings in the working directory, which overrides platform defaults. However, the guidance recommends Windows users set core.autocrlf=true, which would convert LF to CRLF on checkout. This creates a conflict:

  • .gitattributes with eol=lf forces LF in working directory
  • core.autocrlf=true tries to convert LF to CRLF on checkout

When eol=lf is set in .gitattributes, it takes precedence over core.autocrlf, meaning Windows users will get LF in their working directory regardless of their core.autocrlf setting. This contradicts the documentation claim at lines 44-45 that "Windows users get native CRLF for text editors."

Consider either:

  1. Removing the core.autocrlf recommendations entirely (since eol=lf overrides it)
  2. Changing to * text=auto without eol=lf and relying on core.autocrlf settings
  3. Clarifying that Windows users will have LF in working directory despite core.autocrlf=true
Suggested change
# In addition to this .gitattributes file, developers should configure their
# global Git settings based on their operating system:
#
# Windows:
# git config --global core.autocrlf true
# (Converts LF → CRLF on checkout, CRLF → LF on commit)
#
# Linux/macOS:
# git config --global core.autocrlf input
# (Accepts LF as-is, converts CRLF → LF on commit)
#
# This combination ensures:
# - Repository always has LF (.gitattributes enforces it)
# - Windows users get native CRLF for text editors (core.autocrlf=true)
# - Unix users get native LF (core.autocrlf=input)
# - No line ending conflicts or parsing errors
# .gitattributes with "eol=lf" takes precedence over core.autocrlf:
# - Git stores and checks out all files with LF line endings
# - This happens on ALL platforms, regardless of core.autocrlf
#
# Recommended global Git settings:
#
# Windows:
# git config --global core.autocrlf false
# # or, if you sometimes commit from tools that may introduce CRLF:
# # git config --global core.autocrlf input
#
# Linux/macOS:
# git config --global core.autocrlf input
#
# This combination ensures:
# - Repository and working directory always use LF (.gitattributes enforces it)
# - All platforms see consistent LF line endings in editors
# - Avoids conflicts between core.autocrlf and .gitattributes
# - Prevents line ending–related parsing errors (e.g., YAML frontmatter issues)

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md
Comment on lines +40 to +42
- **On checkout:** Git converts LF → CRLF for your text editors (Windows native)
- **On commit:** Git converts CRLF → LF for the repository
- **Result:** Repository always has LF, your editor always shows CRLF

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same issue exists in CONTRIBUTING.md - the documentation states that Windows users with core.autocrlf=true will get CRLF in their working directory ("your editor always shows CRLF"), but this is incorrect when .gitattributes contains * text=auto eol=lf.

The eol=lf directive in .gitattributes takes precedence over core.autocrlf, meaning all users (including Windows) will have LF line endings in their working directory. This makes the recommendation to set core.autocrlf=true ineffective and the documentation misleading.

The documentation should accurately reflect that with the current .gitattributes configuration, all developers will work with LF line endings in their working directory, regardless of platform or core.autocrlf setting.

Suggested change
- **On checkout:** Git converts LF → CRLF for your text editors (Windows native)
- **On commit:** Git converts CRLF → LF for the repository
- **Result:** Repository always has LF, your editor always shows CRLF
- **On checkout (in general):** Git converts LF → CRLF for your text editors (Windows native)
- **On checkout (in this repo):** `.gitattributes` with `* text=auto eol=lf` forces LF in your working directory, overriding the usual CRLF conversion
- **On commit:** Git converts any CRLF → LF for the repository
- **Result (this repo):** Both the repository and your working directory use LF line endings, regardless of platform or `core.autocrlf` setting

Copilot uses AI. Check for mistakes.
Comment on lines +136 to +140
git rm --cached -r . 2>&1 | Out-Null

# Step 2: Re-add all files, applying new .gitattributes rules
Write-Host " [2/3] Re-adding files with normalized line endings..." -ForegroundColor Gray
git add --renormalize . 2>&1 | Out-Null

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling suppresses git command output but doesn't check for command failures. If git rm --cached -r . or git add --renormalize . fail, the script continues silently and may report misleading success.

Consider capturing command exit codes and handling failures appropriately. For example:

$result = git rm --cached -r . 2>&1
if ($LASTEXITCODE -ne 0) {
    throw "Failed to remove files from index: $result"
}

This ensures the script fails fast if git operations encounter errors rather than proceeding with potentially incomplete normalization.

Suggested change
git rm --cached -r . 2>&1 | Out-Null
# Step 2: Re-add all files, applying new .gitattributes rules
Write-Host " [2/3] Re-adding files with normalized line endings..." -ForegroundColor Gray
git add --renormalize . 2>&1 | Out-Null
$gitRmOutput = git rm --cached -r . 2>&1
if ($LASTEXITCODE -ne 0) {
throw "Failed to remove files from index: $gitRmOutput"
}
# Step 2: Re-add all files, applying new .gitattributes rules
Write-Host " [2/3] Re-adding files with normalized line endings..." -ForegroundColor Gray
$gitAddOutput = git add --renormalize . 2>&1
if ($LASTEXITCODE -ne 0) {
throw "Failed to add files with normalized line endings: $gitAddOutput"
}

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md
Comment on lines +67 to +69
- `.gitattributes` enforces LF in the repository (`* text=auto eol=lf`)
- `core.autocrlf` gives you native line endings in your working directory
- Together, they ensure consistency without sacrificing developer experience

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that .gitattributes enforces LF in the repository and core.autocrlf gives native line endings in the working directory, working together to ensure consistency. However, this is inaccurate because eol=lf in .gitattributes forces LF in both the repository AND the working directory, overriding core.autocrlf.

The actual behavior is that .gitattributes with eol=lf enforces LF everywhere, making core.autocrlf settings irrelevant for this repository. The documentation should clarify this to avoid confusion.

Copilot uses AI. Check for mistakes.
Comment thread .gitattributes
# add specific exceptions below. Currently, no exceptions are known in this repository.
#
# Evidence: https://github.com/github/copilot-cli/issues/694
# https://github.com/github/copilot-cli/issues/673

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to "GitHub Copilot CLI Issue #673" in the Evidence section appears to be incorrect. According to the PR metadata, issue #673 is about standardizing skill output formats, not line ending issues.

Only issue #694 should be referenced as evidence since it's the one that specifically documents CRLF line ending YAML parsing errors.

Suggested change
# https://github.com/github/copilot-cli/issues/673

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +49
try {
git rev-parse --is-inside-work-tree 2>$null | Out-Null
return $true
}
catch {
return $false
}

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Test-GitRepository function catches all exceptions and returns false, which will mask the actual error from git rev-parse. If git is not installed or there's another error, the generic message at line 108 won't help users diagnose the problem.

Consider letting the exception propagate or providing more specific error messages. The calling code at line 107-110 already has error handling that could provide context about the actual failure.

Suggested change
try {
git rev-parse --is-inside-work-tree 2>$null | Out-Null
return $true
}
catch {
return $false
}
git rev-parse --is-inside-work-tree 2>$null | Out-Null
return $LASTEXITCODE -eq 0

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md
Comment on lines +52 to +54
- **On checkout:** Git leaves LF as-is (Unix native)
- **On commit:** Git converts any CRLF → LF for the repository
- **Result:** Repository always has LF, your editor always shows LF

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same documentation issue extends to the explanation of Linux/macOS behavior. The statement "your editor always shows LF" is technically correct, but it's misleading to imply this is due to core.autocrlf=input when the .gitattributes file's eol=lf setting is what actually enforces LF in the working directory for all platforms.

The core.autocrlf=input setting is effectively redundant with * text=auto eol=lf in .gitattributes.

Suggested change
- **On checkout:** Git leaves LF as-is (Unix native)
- **On commit:** Git converts any CRLF → LF for the repository
- **Result:** Repository always has LF, your editor always shows LF
- **On checkout:** `.gitattributes` with `* text=auto eol=lf` ensures files are written with LF line endings in your working directory
- **On commit:** With `core.autocrlf=input`, Git converts any CRLF you might have introduced back to LF before storing changes in the repository
- **Result:** Both the repository and your working directory use LF; your editor shows LF because files are checked out with LF, not because of `core.autocrlf`
- **Note:** Given the `.gitattributes` setting, `core.autocrlf=input` mainly acts as a safety net and is largely redundant in typical workflows

Copilot uses AI. Check for mistakes.
Comment thread .gitattributes
#
# Problem: Cross-platform development (Windows/Linux/macOS) with inconsistent line endings
# - Windows Git defaults to CRLF, causing YAML frontmatter parsing failures
# - GitHub Copilot CLI issues #694 and #673: "Unexpected scalar at node end"

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to "GitHub Copilot CLI Issue #673" appears to be incorrect. According to the PR metadata, the external GitHub Copilot CLI issue #673 is about standardizing skill output formats, not line ending issues.

The comment should only reference issue #694, which is specifically about CRLF line ending YAML parsing errors. The internal issue reference (#896) is correct and should be kept.

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md
**References:**

- [GitHub Copilot CLI Issue #694](https://github.com/github/copilot-cli/issues/694)
- [GitHub Copilot CLI Issue #673](https://github.com/github/copilot-cli/issues/673)

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to "GitHub Copilot CLI Issue #673" appears to be incorrect. According to the PR metadata, issue #673 is about standardizing skill output formats, not line ending issues.

Only issue #694 should be referenced here as it specifically documents CRLF line ending YAML parsing errors. Issue #896 is correctly referenced as it's the internal issue for this PR.

Suggested change
- [GitHub Copilot CLI Issue #673](https://github.com/github/copilot-cli/issues/673)

Copilot uses AI. Check for mistakes.
# Perform normalization
Write-Host "`nNormalizing line endings..." -ForegroundColor Yellow

if ($PSCmdlet.ShouldProcess("Repository files", "Normalize line endings to LF")) {

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -WhatIf parameter is declared via [CmdletBinding(SupportsShouldProcess)] but there's no confirmation prompt implemented. The ShouldProcess check at line 133 will always return true in normal execution and false with -WhatIf, but users might expect to see what would change before normalization occurs.

Consider adding output when -WhatIf is specified to show users what files would be modified, or remove the SupportsShouldProcess attribute if no confirmation/preview is intended.

Copilot uses AI. Check for mistakes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7a4aaded5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +136 to +140
git rm --cached -r . 2>&1 | Out-Null

# Step 2: Re-add all files, applying new .gitattributes rules
Write-Host " [2/3] Re-adding files with normalized line endings..." -ForegroundColor Gray
git add --renormalize . 2>&1 | Out-Null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add clean-tree guard before resetting index

The script unconditionally runs git rm --cached -r . followed by git add --renormalize ., which clears the index and then restages every tracked file. If a contributor runs this with any staged hunks or in-progress changes, their partial staging is destroyed and unrelated changes become staged, making accidental commits likely. Consider aborting when git status --porcelain or git diff --cached is non-empty (or require an explicit -Force) before resetting the index.

Useful? React with 👍 / 👎.

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

Labels

automation Automated workflows and processes triage:approved Human has triaged and approved bot responses for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: enforce LF line endings for agent files in .gitattributes

3 participants