Skip eol-normalizer's work on edits that already have the right line endings

未关闭
#20,934 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
shell
领域
tooling

调研方向

Read the eol-normalizer hook and the hook-budget contract referenced by the acceptance criteria; inspect how the PostToolUse payload supplies the edited file. Start by tracing when normalization work begins and how the existing fixtures verify output bytes. Done means unchanged line endings take no normalization work beyond one process start, wrong line endings still produce the existing fixture output, and the budget contract matches.

由索引模型根据 Issue 内容生成。

描述

Context

With the formatter rows on PostToolUse (#20551), eol-normalizer runs one Write|Edit row with no if, so its full script runs on every Write and Edit, whatever the file type. Measured on Windows (Claude Code 2.1.335, 3 runs, CPU 38 to 74%): about 1 s per edit, which sets the per-edit hook wait even for a .txt edit no formatter matches. On PostToolBatch it skipped most batches, so its median there was about 170 ms.

Proposed work

  • Skip the normalization work when the edited file already has the line endings the repository expects, before any slower step runs.
  • Or run the row with async: true if nothing downstream needs the normalized bytes before the next tool call. Record which and why.

Acceptance criteria

  • An Edit of a file that already has the expected line endings costs eol-normalizer no more than one process start and no normalization work, shown by a test that feeds the PostToolUse payload.
  • An Edit that introduces wrong line endings is still normalized, with output byte-identical to today on the existing fixtures.
  • The hook-budget contract's eol-normalizer row matches.

References

  • #20551 (PR #20927), #20549
主要语言
Shell
星标
22
派生
2
平均合并
3 小时 20 分钟
30 天内合并 PR
956

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

melodic-software/claude-code-plugins 的其他 Issue

查看 melodic-software/claude-code-plugins 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。