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(cli): reject empty analyze and artifact target paths (#2687)
LouisChen2b98fc5f518f
diff --git a/src/cli/artifactCommands.ts b/src/cli/artifactCommands.tsindex 6b6b452e4..af2eab068 100644--- a/src/cli/artifactCommands.ts+++ b/src/cli/artifactCommands.ts@@ -225,7 +225,7 @@ const registerInspectionCommand = (description:"Inspect one artifact and return all available observations and next probes",args: z.object({- path: z.string().describe("Application or package path"),+ path: z.string().min(1).describe("Application or package path"),}),options: z.object({integrityPolicy: zdiff --git a/src/cli/coreBinaryCommands.ts b/src/cli/coreBinaryCommands.tsindex 710b39181..8902cf4e9 100644--- a/src/cli/coreBinaryCommands.ts+++ b/src/cli/coreBinaryCommands.ts@@ -48,7 +48,10 @@ const registerOverviewCommands = (cli.command(CLI_COMMANDS.analyze, {description: "Get an overview of an app",args: z.object({- path: z.string().describe("App, program, or analysis database path"),+ path: z+ .string()+ .min(1)+ .describe("App, program, or analysis database path"),}),options: overviewOptions.extend({integrityPolicy: javascriptApplicationOptions.shape.integrityPolicy,diff --git a/tests/acceptance/emptyTargetPathCli.test.ts b/tests/acceptance/emptyTargetPathCli.test.tsnew file mode 100644index 000000000..6f6210d31--- /dev/null+++ b/tests/acceptance/emptyTargetPathCli.test.ts@@ -0,0 +1,35 @@+import { expect } from "vitest";++import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";+import { cliTest } from "../support/cli/cliFixture.js";++cliTest.for(["analyze", "inspect-artifact"])(+ "%s rejects an explicitly empty target before resolving it against cwd",+ async (command, { cli }) => {+ const cwd = await createTestTempDirectory("rea-empty-target-");+ const result = await cli.run({+ arguments: [command, "", "--json"],+ cwd,+ });+ expect(result.exitCode).toBe(1);+ expect(result.json).toMatchObject({ code: "VALIDATION_ERROR" });+ expect(result.stdout).toContain("path");+ expect(result.stdout).not.toContain("directory_requires_file");+ },+);++cliTest(+ "inspect-artifact still admits an explicitly selected current directory",+ async ({ cli }) => {+ const cwd = await createTestTempDirectory("rea-explicit-target-");+ const result = await cli.run({+ arguments: ["inspect-artifact", ".", "--json"],+ cwd,+ });+ expect(result.exitCode).toBe(1);+ expect(result.json).toMatchObject({+ code: "target_unavailable",+ details: { path: cwd, constraint: "directory_requires_file" },+ });+ },+);