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)!: keep a selected JSON null in --filter-output output (#2333)
Jack Liang1ca5fd38b483
diff --git a/src/cli/cliResultOutput.ts b/src/cli/cliResultOutput.tsindex 67e745b0b..5efde8b33 100644--- a/src/cli/cliResultOutput.ts+++ b/src/cli/cliResultOutput.ts@@ -216,8 +216,9 @@ export const createCliResultOutput = (: filtered === undefined? { ok: true, meta }: { ok: true, data: filtered, meta }- : filtered === undefined ||- filtered === null ||+ : // A selected null is a value; only a selection with no JSON value+ // falls back to the empty document.+ filtered === undefined ||typeof filtered === "function" ||typeof filtered === "symbol"? {}diff --git a/tests/boundary/cli/jsonOutput.test.ts b/tests/boundary/cli/jsonOutput.test.tsindex 5e8e86e7f..0d1ee5a59 100644--- a/tests/boundary/cli/jsonOutput.test.ts+++ b/tests/boundary/cli/jsonOutput.test.ts@@ -561,3 +561,35 @@ describe("CLI result output surface", () => {});}, 60_000);});++describe("streamed CLI filtered selections", () => {+ it.each([+ ["raw_result", "json", "null\n"],+ ["raw_result", "jsonl", "null\n"],+ ["nested.value", "json", '{"nested":{"value":null}}\n'],+ ["missing", "json", "{}\n"],+ ["count", "json", "0\n"],+ ["enabled", "json", "false\n"],+ ] as const)(+ "keeps the selected value of --filter-output %s in %s",+ async (filter, format, expected) => {+ const chunks: Buffer[] = [];+ const destination = new Writable({+ write(chunk: Buffer, _encoding, callback) {+ chunks.push(chunk);+ callback();+ },+ });+ const output = createCliResultOutput(+ ["--format", format, "--filter-output", filter],+ destination,+ );+ if (output === undefined) throw new Error("Missing JSON output surface");+ await output.write(+ { raw_result: null, nested: { value: null }, count: 0, enabled: false },+ { command: "fixture", duration: "1ms", format },+ );+ expect(Buffer.concat(chunks).toString("utf8")).toBe(expected);+ },+ );+});