fix(setup): honor config roots and display terminal dry-run plans

Normalize empty XDG config homes once for configuration writers and registration readers. Render the resolved plan for terminal dry runs while preserving structured output. Cover registration placement and a real PTY dry run, including absence of configuration writes.
This commit is contained in:
morluto
2026-10-13 03:22:53 +08:00
parent cecc6ecbff
commit 2397137615
5 changed files with 95 additions and 12 deletions
+6
View File
@@ -11,6 +11,7 @@ import { homeDirectoryFromEnvironment } from "../config/homeDirectory.js";
import { isUpdateFailure } from "../application/UpdateFailure.js";
import {
confirmInteractiveSetup,
renderSetupDryRun,
renderInteractiveSetupResult,
renderSetupProgress,
} from "./interactiveSetup.js";
@@ -225,6 +226,8 @@ const runSetupCommand = async (
: undefined,
);
if (interactive) renderInteractiveSetupResult(result, environment);
else if (options.dryRun && !input.formatExplicit && hasInteractiveTerminal())
renderSetupDryRun(result.plannedActions);
return result;
};
@@ -282,6 +285,9 @@ const setupIsInteractive = (
!options.yes &&
!options.dryRun &&
!formatExplicit &&
hasInteractiveTerminal();
const hasInteractiveTerminal = (): boolean =>
process.stdin.isTTY === true &&
process.stdout.isTTY === true &&
process.stderr.isTTY === true;