fix(cli): honor --dry-run when updating and removing core files

This commit is contained in:
kj
2026-10-08 08:34:54 -03:00
parent 8168865f3a
commit c82e095b75
2 changed files with 53 additions and 0 deletions
@@ -284,6 +284,13 @@ final class Installer
}
$absolute = $this->root . '/' . $relative;
if ($options['dryRun'] ?? false) {
$actions[$relative] = 'planned';
$installed[$relative] = 'sha256:' . hash('sha256', $provider->read($relative));
continue;
}
$action = $this->sync->write($absolute, $provider->read($relative), $expected[$relative] ?? null, $options);
$actions[$relative] = $action;
@@ -300,6 +307,10 @@ final class Installer
if (isset($installed[$relative]) || isset($protected[$relative]) || in_array($relative, $files, true)) {
continue;
}
if ($options['dryRun'] ?? false) {
$actions[$relative] = 'remove-planned';
continue;
}
$action = $this->sync->remove($this->root . '/' . $relative, $hash, $options);
if ($action === FileSync::ABORTED) {
$aborted[] = $relative;