Commit d2551ba
fix(scripts): --check reports real divergence instead of calling all 46 components "modified" (#3049)
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: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent b1d02ec commit d2551ba
1 file changed
Lines changed: 61 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
245 | 268 | | |
246 | 269 | | |
247 | | - | |
| 270 | + | |
248 | 271 | | |
249 | 272 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
254 | 276 | | |
255 | 277 | | |
256 | 278 | | |
| |||
280 | 302 | | |
281 | 303 | | |
282 | 304 | | |
| 305 | + | |
283 | 306 | | |
284 | 307 | | |
285 | 308 | | |
286 | 309 | | |
287 | | - | |
| 310 | + | |
288 | 311 | | |
289 | 312 | | |
290 | 313 | | |
291 | | - | |
| 314 | + | |
292 | 315 | | |
293 | 316 | | |
| 317 | + | |
294 | 318 | | |
295 | 319 | | |
296 | 320 | | |
297 | 321 | | |
298 | | - | |
| 322 | + | |
299 | 323 | | |
300 | 324 | | |
| 325 | + | |
301 | 326 | | |
302 | 327 | | |
303 | 328 | | |
304 | 329 | | |
305 | | - | |
| 330 | + | |
306 | 331 | | |
307 | 332 | | |
308 | | - | |
| 333 | + | |
309 | 334 | | |
310 | 335 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
316 | 351 | | |
317 | | - | |
318 | | - | |
319 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
320 | 356 | | |
321 | | - | |
| 357 | + | |
322 | 358 | | |
323 | 359 | | |
324 | 360 | | |
| |||
0 commit comments