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

Aperta
#20,934 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
shell
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Shell
Stelle
22
Fork
2
Merge medio
3h 20m
PR unite (30g)
956

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di melodic-software/claude-code-plugins

Tutte le issue di melodic-software/claude-code-plugins

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.