Fix: protected files skip entirely before stale token check

Protected files (like updates.xml) were being overwritten because
the stale-token check ran AFTER the canOverwrite gate. Now protected
files continue (skip) immediately, even with --force.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-04-19 14:10:14 -05:00
parent 2b9bfb032e
commit c00a04087f
+6 -1
View File
@@ -598,7 +598,12 @@ HCL;
$isReadme = $basename === 'readme.md';
$isChangelog = in_array($basename, ['changelog.md', 'changelog'], true);
$isProtected = $isReadme || $isChangelog;
$canOverwrite = !$isProtected && ($force || $entry['always_overwrite']) && !($entry['protected'] ?? false);
// Protected files are NEVER overwritten, even with --force
if ($entry['protected'] ?? false) {
$summary['skipped'][] = ['file' => $targetPath, 'reason' => 'Protected — never overwritten'];
continue;
}
$canOverwrite = !$isProtected && ($force || $entry['always_overwrite']);
if ($isReadme) {
$summary['skipped'][] = ['file' => $targetPath, 'reason' => 'README — never overwritten'];