fix(scripts): make bring_up_to_date produce minimal, surgical diffs#9
Merged
Conversation
The previous task prompt said only 'apply any new or changed files from the template' without specifying *how*. Claude was reading template files and rewriting them via the Write tool, which subtly reformats content (whitespace, trailing newlines, EOL) and produces PRs whose diffs look like full-file rewrites even when the upstream change was a single line. Rewrite the prompt to: - Explicitly clone the upstream template into a tempdir as the source of truth - For each candidate, run 'diff -u' before touching anything - Propagate by 'cp' (byte-for-byte) by default; only use surgical Edit hunks when project-specific edits must be preserved - Forbid using Write to rewrite template-tracked files - Verify with 'git diff' afterwards that the resulting diff is minimal, with explicit guidance on diagnosing CRLF/whitespace issues - Exit cleanly with no PR if there are no real changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the issue where `bring_up_to_date` PRs look like entire files are being replaced even when the upstream change was tiny.
Root cause: the previous `scripts/bring_up_to_date/task.md` only said "Apply any new or changed files from the template" without specifying how. Claude was reading template files and rewriting them via the `Write` tool — and any subtle formatting drift (whitespace, trailing newline, EOL) makes git see every line as changed.
Fix: rewrite the prompt to require an explicit upstream clone, byte-for-byte propagation via `cp`, and a post-copy `git diff` verification step:
Test plan