mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
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>
This commit is contained in:
parent
df0593fb21
commit
8bc45b4283
7 changed files with 2 additions and 92 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "0.14.3",
|
||||
"version": "0.14.4",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {
|
|||
getImplementedAgents,
|
||||
getImplementedClouds,
|
||||
getMissingClouds,
|
||||
getStatusDescription,
|
||||
getTerminalWidth,
|
||||
parseAuthEnvVars,
|
||||
} from "../commands";
|
||||
|
|
@ -27,7 +26,6 @@ import { createEmptyManifest, createMockManifest } from "./test-helpers";
|
|||
* - getImplementedAgents: returns agents implemented on a cloud
|
||||
* - getMissingClouds: returns clouds where an agent is NOT implemented
|
||||
* - getErrorMessage: duck-typed error message extraction
|
||||
* - getStatusDescription: HTTP status to human-readable string
|
||||
* - calculateColumnWidth: matrix display column sizing
|
||||
* - getTerminalWidth: terminal width with fallback
|
||||
*/
|
||||
|
|
@ -338,26 +336,6 @@ describe("getErrorMessage", () => {
|
|||
});
|
||||
});
|
||||
|
||||
// ── getStatusDescription ──────────────────────────────────────────────────────
|
||||
|
||||
describe("getStatusDescription", () => {
|
||||
it("should return 'not found' for 404", () => {
|
||||
expect(getStatusDescription(404)).toBe("not found");
|
||||
});
|
||||
|
||||
it("should return HTTP prefix for non-404 codes", () => {
|
||||
expect(getStatusDescription(200)).toBe("HTTP 200");
|
||||
expect(getStatusDescription(500)).toBe("HTTP 500");
|
||||
expect(getStatusDescription(403)).toBe("HTTP 403");
|
||||
expect(getStatusDescription(502)).toBe("HTTP 502");
|
||||
expect(getStatusDescription(503)).toBe("HTTP 503");
|
||||
});
|
||||
|
||||
it("should handle zero", () => {
|
||||
expect(getStatusDescription(0)).toBe("HTTP 0");
|
||||
});
|
||||
});
|
||||
|
||||
// ── calculateColumnWidth ──────────────────────────────────────────────────────
|
||||
|
||||
describe("calculateColumnWidth (actual export)", () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, it } from "bun:test";
|
||||
import * as v from "valibot";
|
||||
import { parseJsonRaw, parseJsonWith } from "../shared/parse";
|
||||
import { parseJsonWith } from "../shared/parse";
|
||||
|
||||
describe("parseJsonWith", () => {
|
||||
const NumberSchema = v.object({
|
||||
|
|
@ -70,38 +70,3 @@ describe("parseJsonWith", () => {
|
|||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseJsonRaw", () => {
|
||||
it("should parse valid JSON to unknown", () => {
|
||||
const result = parseJsonRaw('{"key": "value"}');
|
||||
expect(result).toEqual({
|
||||
key: "value",
|
||||
});
|
||||
});
|
||||
|
||||
it("should parse JSON arrays", () => {
|
||||
const result = parseJsonRaw("[1, 2, 3]");
|
||||
expect(result).toEqual([
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
]);
|
||||
});
|
||||
|
||||
it("should return null for invalid JSON", () => {
|
||||
const result = parseJsonRaw("not json");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("should return null for empty string", () => {
|
||||
const result = parseJsonRaw("");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("should parse primitive JSON values", () => {
|
||||
expect(parseJsonRaw("42")).toBe(42);
|
||||
expect(parseJsonRaw('"hello"')).toBe("hello");
|
||||
expect(parseJsonRaw("true")).toBe(true);
|
||||
expect(parseJsonRaw("null")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ export {
|
|||
getErrorMessage,
|
||||
getImplementedAgents,
|
||||
getImplementedClouds,
|
||||
getStatusDescription,
|
||||
hasCloudCli,
|
||||
hasCloudCredentials,
|
||||
isInteractiveTTY,
|
||||
|
|
|
|||
|
|
@ -747,10 +747,6 @@ export function getImplementedAgents(manifest: Manifest, cloud: string): string[
|
|||
return agentKeys(manifest).filter((a: string): boolean => matrixStatus(manifest, cloud, a) === "implemented");
|
||||
}
|
||||
|
||||
export function getStatusDescription(status: number): string {
|
||||
return status === 404 ? "not found" : `HTTP ${status}`;
|
||||
}
|
||||
|
||||
/** Resolve an agent/cloud key to its display name, or return the key as-is */
|
||||
export function resolveDisplayName(manifest: Manifest | null, key: string, kind: "agent" | "cloud"): string {
|
||||
if (!manifest) {
|
||||
|
|
|
|||
|
|
@ -17,19 +17,6 @@ export function parseJsonWith<T extends v.BaseSchema<unknown, unknown, v.BaseIss
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape hatch: parse JSON to `unknown` without schema validation.
|
||||
* Use for dynamic response formats where a fixed schema isn't practical
|
||||
* (e.g., cloud APIs with 5+ response shapes).
|
||||
*/
|
||||
export function parseJsonRaw(text: string): unknown {
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a JSON string and return it as a Record<string, unknown> or null.
|
||||
* Rejects non-object results (arrays, primitives).
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
# sh/e2e/aws-e2e.sh — Backwards-compatible wrapper for AWS E2E tests
|
||||
#
|
||||
# Usage:
|
||||
# ./sh/e2e/aws-e2e.sh # All agents, sequential
|
||||
# ./sh/e2e/aws-e2e.sh claude # Single agent
|
||||
# ./sh/e2e/aws-e2e.sh claude codex opencode # Specific agents
|
||||
# ./sh/e2e/aws-e2e.sh --parallel 2 # Parallel (2 at a time)
|
||||
# ./sh/e2e/aws-e2e.sh --skip-cleanup # Skip stale instance cleanup
|
||||
# ./sh/e2e/aws-e2e.sh --skip-input-test # Skip live input tests
|
||||
#
|
||||
# This is a thin wrapper that delegates to the unified e2e.sh orchestrator.
|
||||
set -eo pipefail
|
||||
|
||||
exec "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/e2e.sh" --cloud aws "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue