Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(setup): advertise only providers with passing readiness checks
morlutof5d1012fabfe
diff --git a/src/application/Setup.fixture.ts b/src/application/Setup.fixture.tsindex ec986cf18..07adf87cc 100644--- a/src/application/Setup.fixture.ts+++ b/src/application/Setup.fixture.ts@@ -10,7 +10,12 @@ import type { SetupClient } from "./SupportedClients.js";import type { SetupHopperInstallResult } from "./SetupInstallFailure.js";import { err, ok, type Result } from "../domain/result.js";import { SetupSkillInstallError } from "./SetupSkill.js";-import type { DoctorCheck, DoctorReport, DoctorScope } from "./Doctor.js";+import type {+ DoctorCheck,+ DoctorProviderInspection,+ DoctorReport,+ DoctorScope,+} from "./Doctor.js";import type { LinuxDistribution } from "./LinuxHopper.js";import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../identity.js";import { CATALOG_IDENTITY } from "../catalogIdentity.js";@@ -52,6 +57,8 @@ export class FakeSetupHost implements SetupHost {configuredCommands: Array<readonly string[]> = [];doctorHealthy: boolean | undefined;scopedDoctorHealthy: boolean | undefined;+ providerInspections: readonly DoctorProviderInspection[] | undefined =+ undefined;linuxDemoRuntimeMissing = false;unsupportedHopperVersion = false;hopperLauncherConfigured = false;@@ -213,6 +220,9 @@ export class FakeSetupHost implements SetupHost {scope_checks: checks,informational_checks: [],...(this.hopper === undefined ? {} : { hopperPath: this.hopper }),+ ...(this.providerInspections === undefined+ ? {}+ : { providerInspections: this.providerInspections }),checks,identity: {cli_package_version: PRODUCT_IDENTITY.packageVersion,diff --git a/src/application/Setup.ts b/src/application/Setup.tsindex 117238fa2..b1b674737 100644--- a/src/application/Setup.ts+++ b/src/application/Setup.ts@@ -584,7 +584,9 @@ const summarizeDoctor = (report: DoctorReport): SetupDoctorSummary => ({? ["hopper"]: []),...(report.providerInspections ?? [])- .filter(({ available }) => available)+ .filter(+ ({ available, checks }) => available && checks.every(({ ok }) => ok),+ ).map(({ id }) => id),],...(report.hopperPath === undefined ? {} : { hopperPath: report.hopperPath }),diff --git a/tests/boundary/cli/setupProviderReadiness.test.ts b/tests/boundary/cli/setupProviderReadiness.test.tsnew file mode 100644index 000000000..88f215735--- /dev/null+++ b/tests/boundary/cli/setupProviderReadiness.test.ts@@ -0,0 +1,63 @@+import { access, mkdir, writeFile } from "node:fs/promises";+import { join } from "node:path";+import { expect } from "vitest";+import { z } from "zod";++import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";+import { cliTest } from "../../support/cli/cliFixture.js";+import { writeFakeKuna } from "../providers/kuna/fakeKuna.js";++cliTest.skipIf(process.platform === "win32").for(["blocked", "ready"] as const)(+ "setup dry-run advertises Kuna only with a %s cache",+ async (cache, { cli }) => {+ const root = await createTestTempDirectory("rea-setup-provider-readiness-");+ const home = join(root, "home");+ await mkdir(home);+ const command = await writeFakeKuna(root);+ const cachePath = join(root, "cache");+ if (cache === "blocked") await writeFile(cachePath, "not a directory");+ else await mkdir(cachePath);++ const result = await cli.run({+ arguments: ["setup", "--client", "claude_code", "--dry-run", "--json"],+ environment: {+ HOME: home,+ USERPROFILE: home,+ HOPPER_LAUNCHER_PATH: join(root, "missing-hopper"),+ GHIDRA_INSTALL_DIR: join(root, "missing-ghidra"),+ REA_KUNA_COMMAND: command,+ REA_KUNA_CACHE_DIR: cachePath,+ },+ timeoutMs: 20_000,+ });+ expect(result.exitCode, result.stderr).toBe(0);+ expect(result.json).toMatchObject({+ status: "planned",+ doctor: {+ providerInspections: expect.arrayContaining([+ expect.objectContaining({+ id: "kuna",+ available: true,+ checks: expect.arrayContaining([+ expect.objectContaining({+ name: "cache",+ ok: cache === "ready",+ }),+ ]),+ }),+ ]),+ },+ });+ const summary = z+ .object({+ doctor: z.object({ availableProviders: z.array(z.string()) }),+ })+ .parse(result.json);+ expect(summary.doctor.availableProviders.includes("kuna")).toBe(+ cache === "ready",+ );+ await expect(access(join(home, ".claude.json"))).rejects.toMatchObject({+ code: "ENOENT",+ });+ },+);diff --git a/tests/boundary/providers/kuna/kunaSetupReadiness.test.ts b/tests/boundary/providers/kuna/kunaSetupReadiness.test.tsnew file mode 100644index 000000000..81898a1e7--- /dev/null+++ b/tests/boundary/providers/kuna/kunaSetupReadiness.test.ts@@ -0,0 +1,77 @@+import { mkdir, writeFile } from "node:fs/promises";+import { join } from "node:path";+import { expect, it } from "vitest";+import {+ FakeSetupHost,+ options,+} from "../../../../src/application/Setup.fixture.js";+import { runSetup } from "../../../../src/application/Setup.js";+import { inspectKunaProviderOwned } from "./kunaFileCloseOwner.js";+import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";+import { writeFakeKuna } from "./fakeKuna.js";++const test = it.skipIf(process.platform === "win32");++test.each([+ { cache: "blocked", version: "kuna 1.833\n", expected: ["ghidra"] },+ {+ cache: "ready",+ version: "kuna 1.950\n",+ expected: ["kuna", "ghidra"],+ },+])(+ "projects installation separately from $cache cache readiness",+ async ({ cache, version, expected }) => {+ const root = await createTestTempDirectory("rea-kuna-setup-readiness-");+ const command = await writeFakeKuna(root, {+ version: { stdout: version },+ });+ const cachePath = join(root, "cache");+ if (cache === "blocked") await writeFile(cachePath, "not a directory");+ else await mkdir(cachePath);++ const inspection = await inspectKunaProviderOwned({+ REA_KUNA_COMMAND: command,+ REA_KUNA_CACHE_DIR: cachePath,+ });+ expect(inspection.available).toBe(true);+ expect(inspection.checks[1]).toMatchObject({+ name: "cache",+ ok: cache === "ready",+ });+ if (version === "kuna 1.950\n")+ expect(inspection.checks[0]).toMatchObject({+ ok: true,+ detail: expect.stringContaining("project layout is unverified"),+ });++ const host = new FakeSetupHost();+ host.providerInspections = [+ inspection,+ {+ id: "ghidra",+ configured: true,+ available: true,+ providerVersion: "12.1.4",+ registrationEnvironment: { GHIDRA_INSTALL_DIR: "/tools/ghidra" },+ checks: [+ {+ name: "installation",+ ok: true,+ code: null,+ detail: "Ghidra installation passed its required checks.",+ remediation: null,+ classification: "config_drift",+ },+ ],+ },+ ];+ host.doctorHealthy = cache === "ready";+ host.scopedDoctorHealthy = true;++ const result = await runSetup(options(true), host);++ expect(result.status).toBe("ready");+ expect(result.doctor.availableProviders).toEqual(expected);+ },+);