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
@@ -37,6 +37,22 @@ const getClients = (home: string) =>
);
describe("additional client configuration dialects", () => {
it("treats an empty XDG config home as unset for OpenCode setup", async () => {
const home = await createTestTempDirectory("rea-opencode-empty-xdg-");
const client = supportedClients(home, "linux", {
XDG_CONFIG_HOME: "",
}).find(({ name }) => name === "opencode");
const expectedPath = join(home, ".config/opencode/opencode.json");
if (client === undefined) throw new Error("missing opencode client");
expect(client.configPath).toBe(expectedPath);
expect(client.configPaths).toContain(expectedPath);
expect(
await configureClientConfiguration(client, {}, command),
).toMatchObject({ status: "configured" });
expect(await readFile(expectedPath, "utf8")).toContain('"mcp"');
});
it.each([
"opencode",
"antigravity",