fix(setup): preserve consent and startup target kind

This commit is contained in:
morluto
2026-07-12 08:51:35 +08:00
parent 62ede515b7
commit a67054f815
7 changed files with 69 additions and 4 deletions
+16
View File
@@ -74,6 +74,22 @@ describe("binary target I/O", () => {
expect((await parseBinaryTarget("text", directory)).ok).toBe(false);
expect((await parseBinaryTarget("missing", directory)).ok).toBe(false);
});
it("honors an explicit database kind without relying on the file suffix", async () => {
directory = await mkdtemp(join(tmpdir(), "rea-target-"));
await writeFile(join(directory, "saved-analysis"), "database");
const result = await parseBinaryTarget(
"saved-analysis",
directory,
"arm64",
"database",
);
expect(result.ok && result.value).toMatchObject({
kind: "database",
format: "hopper",
loaderArgs: [],
});
});
});
const elf = (class_: number, endian: number, machine: number): Buffer => {
+25
View File
@@ -44,4 +44,29 @@ describe("production stdio runtime", () => {
}
expect(stderr).toBe("");
});
it("honors the configured kind for an initial database target", async () => {
const transport = new StdioClientTransport({
command: process.execPath,
args: [mainPath],
cwd: process.cwd(),
env: {
PATH: process.env.PATH ?? "",
HOPPER_LAUNCHER_PATH: process.execPath,
HOPPER_TARGET_PATH: new URL(import.meta.url).pathname,
HOPPER_TARGET_KIND: "database",
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fixturePath]),
},
stderr: "pipe",
});
const client = new Client({ name: "database-runtime", version: "1.0.0" });
try {
await client.connect(transport);
expect((await client.listTools()).tools).toHaveLength(42);
} finally {
await client.close();
await transport.close();
}
});
});
+9
View File
@@ -84,6 +84,15 @@ describe("setup workflow", () => {
expect(result.remediation).toContain("--yes");
});
it("requires --yes before installing Hopper", async () => {
const host = new FakeSetupHost();
host.brew = true;
const result = await runSetup(false, host);
expect(result.status).toBe("needs_human");
expect(host.hopperInstalls).toBe(0);
expect(result.remediation).toContain("--yes");
});
it("accepts existing Homebrew and manually installed Hopper", async () => {
const host = new FakeSetupHost();
host.brew = true;