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:
@@ -75,6 +75,10 @@ interface ClientDefinition {
|
||||
) => NonNullable<SetupClient["geminiSettings"]>;
|
||||
}
|
||||
|
||||
/** XDG treats an empty config-home value as unset. */
|
||||
const xdgConfigHome = ({ home, env }: ClientPathContext): string =>
|
||||
env.XDG_CONFIG_HOME || join(home, ".config");
|
||||
|
||||
const vscodeUserDirectory = ({
|
||||
home,
|
||||
platform,
|
||||
@@ -88,7 +92,7 @@ const vscodeUserDirectory = ({
|
||||
);
|
||||
if (platform === "darwin")
|
||||
return join(home, "Library", "Application Support", "Code", "User");
|
||||
return join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "Code", "User");
|
||||
return join(xdgConfigHome({ home, platform, env }), "Code", "User");
|
||||
};
|
||||
|
||||
const traeUserDirectory = ({
|
||||
@@ -104,7 +108,7 @@ const traeUserDirectory = ({
|
||||
);
|
||||
if (platform === "darwin")
|
||||
return join(home, "Library", "Application Support", "Trae", "User");
|
||||
return join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "Trae", "User");
|
||||
return join(xdgConfigHome({ home, platform, env }), "Trae", "User");
|
||||
};
|
||||
|
||||
const claudeDesktopDirectory = ({
|
||||
@@ -115,7 +119,7 @@ const claudeDesktopDirectory = ({
|
||||
if (platform === "win32")
|
||||
return join(env.APPDATA ?? join(home, "AppData", "Roaming"), "Claude");
|
||||
if (platform === "linux")
|
||||
return join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "Claude");
|
||||
return join(xdgConfigHome({ home, platform, env }), "Claude");
|
||||
return join(home, "Library", "Application Support", "Claude");
|
||||
};
|
||||
|
||||
@@ -268,19 +272,13 @@ const openCodeOverrideDirectory = (
|
||||
|
||||
const opencodeDirectory = (context: ClientPathContext): string =>
|
||||
openCodeOverrideDirectory(context.env) ??
|
||||
join(
|
||||
context.env.XDG_CONFIG_HOME ?? join(context.home, ".config"),
|
||||
"opencode",
|
||||
);
|
||||
join(xdgConfigHome(context), "opencode");
|
||||
|
||||
/** OpenCode loads global JSON before JSONC, then explicit file and directory overrides. */
|
||||
const openCodeConfigurationPaths = (
|
||||
context: ClientPathContext,
|
||||
): readonly string[] => {
|
||||
const directory = join(
|
||||
context.env.XDG_CONFIG_HOME ?? join(context.home, ".config"),
|
||||
"opencode",
|
||||
);
|
||||
const directory = join(xdgConfigHome(context), "opencode");
|
||||
const overrideDirectory = openCodeOverrideDirectory(context.env);
|
||||
const paths = [
|
||||
join(directory, "config.json"),
|
||||
|
||||
Reference in New Issue
Block a user