From 9e26d74ddb369f33f738f2c85cc6ecc768bae7de Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:31:07 -0800 Subject: [PATCH] fix: add --prune and --json to KNOWN_FLAGS for spawn status (#2263) The status command (PR #2254) added --prune and --json flags but did not register them in KNOWN_FLAGS. This caused the CLI to reject them with "Unknown flag" errors before the command could even dispatch. Bump CLI version 0.15.4 -> 0.15.5. Agent: ux-engineer Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 --- packages/cli/package.json | 2 +- .../cli/src/__tests__/unknown-flags.test.ts | 18 +++++++++++------- packages/cli/src/flags.ts | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 7602ca28..a84ece0c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/spawn", - "version": "0.15.4", + "version": "0.15.5", "type": "module", "bin": { "spawn": "cli.js" diff --git a/packages/cli/src/__tests__/unknown-flags.test.ts b/packages/cli/src/__tests__/unknown-flags.test.ts index 6b909856..126ae8c1 100644 --- a/packages/cli/src/__tests__/unknown-flags.test.ts +++ b/packages/cli/src/__tests__/unknown-flags.test.ts @@ -10,13 +10,13 @@ import { expandEqualsFlags, findUnknownFlag, KNOWN_FLAGS } from "../flags"; describe("Unknown Flag Detection", () => { describe("detects unknown flags", () => { - it("should detect --json as unknown", () => { + it("should detect --foo as unknown", () => { expect( findUnknownFlag([ "list", - "--json", + "--foo", ]), - ).toBe("--json"); + ).toBe("--foo"); }); it("should detect --verbose as unknown (middle position)", () => { @@ -50,20 +50,20 @@ describe("Unknown Flag Detection", () => { it("should detect unknown flag at the beginning", () => { expect( findUnknownFlag([ - "--json", + "--foo", "list", ]), - ).toBe("--json"); + ).toBe("--foo"); }); it("should return first unknown when multiple unknown flags", () => { expect( findUnknownFlag([ - "--json", + "--foo", "--verbose", "list", ]), - ).toBe("--json"); + ).toBe("--foo"); }); }); @@ -87,6 +87,8 @@ describe("Unknown Flag Detection", () => { "--debug", "--name", "--reauth", + "--prune", + "--json", ]; for (const flag of knownFlagsToTest) { expect( @@ -211,6 +213,8 @@ describe("KNOWN_FLAGS completeness", () => { "--clear", "--custom", "--reauth", + "--prune", + "--json", ]; for (const flag of expected) { expect(KNOWN_FLAGS.has(flag)).toBe(true); diff --git a/packages/cli/src/flags.ts b/packages/cli/src/flags.ts index 9c992d66..a445a00f 100644 --- a/packages/cli/src/flags.ts +++ b/packages/cli/src/flags.ts @@ -28,6 +28,8 @@ export const KNOWN_FLAGS = new Set([ "--region", "--machine-type", "--size", + "--prune", + "--json", ]); /** Return the first unknown flag in args, or null if all are known/positional */