Skip to content

Commit 8bc45b4

Browse files
la14-1spawn-qa-botclaude
authored
refactor: Remove dead code and stale references (#2238)
- Remove sh/e2e/aws-e2e.sh: dead backwards-compat wrapper with no references (superseded by unified e2e.sh --cloud aws) - Remove getStatusDescription from commands/shared.ts: defined and tested but never called in production code - Remove parseJsonRaw from packages/cli/src/shared/parse.ts: zero production usages (still available in packages/shared if needed) - Update corresponding test files to remove dead code tests - Bump CLI version to 0.14.4 Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent df0593f commit 8bc45b4

7 files changed

Lines changed: 2 additions & 92 deletions

File tree

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openrouter/spawn",
3-
"version": "0.14.3",
3+
"version": "0.14.4",
44
"type": "module",
55
"bin": {
66
"spawn": "cli.js"

packages/cli/src/__tests__/commands-exported-utils.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
getImplementedAgents,
77
getImplementedClouds,
88
getMissingClouds,
9-
getStatusDescription,
109
getTerminalWidth,
1110
parseAuthEnvVars,
1211
} from "../commands";
@@ -27,7 +26,6 @@ import { createEmptyManifest, createMockManifest } from "./test-helpers";
2726
* - getImplementedAgents: returns agents implemented on a cloud
2827
* - getMissingClouds: returns clouds where an agent is NOT implemented
2928
* - getErrorMessage: duck-typed error message extraction
30-
* - getStatusDescription: HTTP status to human-readable string
3129
* - calculateColumnWidth: matrix display column sizing
3230
* - getTerminalWidth: terminal width with fallback
3331
*/
@@ -338,26 +336,6 @@ describe("getErrorMessage", () => {
338336
});
339337
});
340338

341-
// ── getStatusDescription ──────────────────────────────────────────────────────
342-
343-
describe("getStatusDescription", () => {
344-
it("should return 'not found' for 404", () => {
345-
expect(getStatusDescription(404)).toBe("not found");
346-
});
347-
348-
it("should return HTTP prefix for non-404 codes", () => {
349-
expect(getStatusDescription(200)).toBe("HTTP 200");
350-
expect(getStatusDescription(500)).toBe("HTTP 500");
351-
expect(getStatusDescription(403)).toBe("HTTP 403");
352-
expect(getStatusDescription(502)).toBe("HTTP 502");
353-
expect(getStatusDescription(503)).toBe("HTTP 503");
354-
});
355-
356-
it("should handle zero", () => {
357-
expect(getStatusDescription(0)).toBe("HTTP 0");
358-
});
359-
});
360-
361339
// ── calculateColumnWidth ──────────────────────────────────────────────────────
362340

363341
describe("calculateColumnWidth (actual export)", () => {

packages/cli/src/__tests__/parse.test.ts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from "bun:test";
22
import * as v from "valibot";
3-
import { parseJsonRaw, parseJsonWith } from "../shared/parse";
3+
import { parseJsonWith } from "../shared/parse";
44

55
describe("parseJsonWith", () => {
66
const NumberSchema = v.object({
@@ -70,38 +70,3 @@ describe("parseJsonWith", () => {
7070
expect(result).toBeNull();
7171
});
7272
});
73-
74-
describe("parseJsonRaw", () => {
75-
it("should parse valid JSON to unknown", () => {
76-
const result = parseJsonRaw('{"key": "value"}');
77-
expect(result).toEqual({
78-
key: "value",
79-
});
80-
});
81-
82-
it("should parse JSON arrays", () => {
83-
const result = parseJsonRaw("[1, 2, 3]");
84-
expect(result).toEqual([
85-
1,
86-
2,
87-
3,
88-
]);
89-
});
90-
91-
it("should return null for invalid JSON", () => {
92-
const result = parseJsonRaw("not json");
93-
expect(result).toBeNull();
94-
});
95-
96-
it("should return null for empty string", () => {
97-
const result = parseJsonRaw("");
98-
expect(result).toBeNull();
99-
});
100-
101-
it("should parse primitive JSON values", () => {
102-
expect(parseJsonRaw("42")).toBe(42);
103-
expect(parseJsonRaw('"hello"')).toBe("hello");
104-
expect(parseJsonRaw("true")).toBe(true);
105-
expect(parseJsonRaw("null")).toBeNull();
106-
});
107-
});

packages/cli/src/commands/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export {
5050
getErrorMessage,
5151
getImplementedAgents,
5252
getImplementedClouds,
53-
getStatusDescription,
5453
hasCloudCli,
5554
hasCloudCredentials,
5655
isInteractiveTTY,

packages/cli/src/commands/shared.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,6 @@ export function getImplementedAgents(manifest: Manifest, cloud: string): string[
747747
return agentKeys(manifest).filter((a: string): boolean => matrixStatus(manifest, cloud, a) === "implemented");
748748
}
749749

750-
export function getStatusDescription(status: number): string {
751-
return status === 404 ? "not found" : `HTTP ${status}`;
752-
}
753-
754750
/** Resolve an agent/cloud key to its display name, or return the key as-is */
755751
export function resolveDisplayName(manifest: Manifest | null, key: string, kind: "agent" | "cloud"): string {
756752
if (!manifest) {

packages/cli/src/shared/parse.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ export function parseJsonWith<T extends v.BaseSchema<unknown, unknown, v.BaseIss
1717
}
1818
}
1919

20-
/**
21-
* Escape hatch: parse JSON to `unknown` without schema validation.
22-
* Use for dynamic response formats where a fixed schema isn't practical
23-
* (e.g., cloud APIs with 5+ response shapes).
24-
*/
25-
export function parseJsonRaw(text: string): unknown {
26-
try {
27-
return JSON.parse(text);
28-
} catch {
29-
return null;
30-
}
31-
}
32-
3320
/**
3421
* Parse a JSON string and return it as a Record<string, unknown> or null.
3522
* Rejects non-object results (arrays, primitives).

sh/e2e/aws-e2e.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)