fix(scripts): --check reports real divergence instead of calling all 46 components "modified" - #3049
Merged
Merged
Conversation
…46 components "modified"
The heuristic was `lineDiff > 10 || localContent.includes('ObjectUI') ||
localContent.includes('data-slot')`. Every synced file carries the
ObjectUI header this script prepends, so the second clause was true for
all 46 of them: `--check` reported the entire tracked set as "modified",
every time, which is the same as reporting nothing.
#3035 added `localOnlyLines` for the pre-write guard. It is directional —
lines in the first argument the second lacks — so calling it both ways
answers the two questions that actually decide whether to sync: what
would a sync DESTROY, and what would it GAIN. That replaces the
heuristic, and splits the old "modified" bucket in two:
↑ outdated upstream moved, no local edits → safe to sync
⚠ modified local edits present → --update refuses
Each line now carries counts, and the summary names the components in
each bucket so the next step is obvious without running --diff 46 times.
What it says about this repo right now:
✓ Identical: 29 ↑ Outdated: 0 ⚠ Modified: 17 ● Custom: 2
Zero outdated is the headline. Every component where upstream has moved
also carries local edits, so there is currently no component
`--update-all` could touch without deleting something — it has no safe
work to do at all. That was invisible before.
The per-component counts line up with the guard that enforces them
(`command` 35, `select` 32, `sidebar` 24, `table` 17 …), because both
sides call the same function.
`--check` stays exit 0: it is a status report, and 17 locally-modified
components is the steady state here, not a failure.
Verified against the live registry. The `outdated` bucket is the one real
traffic never exercises, so it was tested by deleting a line from an
identical component (`separator`): it flips to `↑ … 1 upstream line(s) to
pick up — safe to sync` and the summary offers the exact --update
command. Restored after. `--list`, `--diff`, `--update` and both #3033 /
#3035 guards regression-checked; no component file changes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
--checkwas structurally incapable of telling you anything. The heuristic:Every synced file carries the ObjectUI header this script prepends, so the second clause was true for all 46 tracked components.
--checkreported the entire set as "modified", every run. That is the same as reporting nothing.Using the primitive #3035 already built
localOnlyLinesis directional — lines in the first argument the second lacks. Calling it both ways answers the two questions that actually decide whether to sync:localOnlyLines(local, upstream)localOnlyLines(upstream, local)That replaces the heuristic and splits the old "modified" bucket into the two states that need different actions:
↑ outdated⚠ modified--updaterefusesBecause
--checkand the write guard now call the same function, the counts--checkshows are exactly the counts that will stop a write.What it says about this repo right now
Zero outdated is the headline. Every component where upstream has moved also carries local edits — so there is currently no component
--update-allcould touch without deleting something. It has no safe work to do at all. That was completely invisible under the old output.The summary also names the components per bucket with their counts, so triage doesn't need 46
--diffruns:Verification
Against the live registry:
command35,select32,sidebar24 …) — same function, both sidesoutdatedbucket is the one real traffic never exercises (it's 0), so I tested it by deleting a line from an identical component (separator). It flips to↑ 1 upstream line(s) to pick up — safe to syncand the summary offers the exact--update separatorcommand. Restored after.lineDiffhad no consumers outside the function that produced it--list,--diff,--update, and both the fix(scripts): shadcn-sync rewrites the registry paths Shadcn actually serves, and refuses to write a file when it cannot #3033 unmapped-path guard and fix(scripts): shadcn-sync refuses to silently delete local edits, and compiles the package after it writes #3035 local-edit guard regression-checked--checkstays exit 0 — it's a status report, and 17 locally-modified components is the steady state here, not a failureeslintclean; no component file changesNo changeset — tooling only.
🤖 Generated with Claude Code