From 451194bdbe1244511f2275b7beb2386912273453 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Mar 2026 22:13:28 -0700 Subject: [PATCH] Code quality: remove dead code, deduplicate padRight, clean exports - Remove extractRunNumber (always returned -1, dead code) (#130) - Import padRight from display.ts instead of duplicating in evaluate.ts (#132) - Make CleanOptions, CompareOptions, StatsOptions non-exported (unused externally) (#133) - Keep ApplyOptions exported (used in tests) Closes #130 Closes #132 Closes #133 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/clean.ts | 2 +- src/commands/compare.ts | 2 +- src/commands/evaluate.ts | 8 +------- src/commands/list.test.ts | 9 +-------- src/commands/list.ts | 5 ----- src/commands/stats.ts | 2 +- 6 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/commands/clean.ts b/src/commands/clean.ts index 79db903..114b131 100644 --- a/src/commands/clean.ts +++ b/src/commands/clean.ts @@ -6,7 +6,7 @@ import { cleanupBranches, getRepoRoot, removeWorktree } from "../utils/git.js"; const exec = promisify(execFile); -export interface CleanOptions { +interface CleanOptions { all?: boolean; } diff --git a/src/commands/compare.ts b/src/commands/compare.ts index 08590e1..d9a4c5a 100644 --- a/src/commands/compare.ts +++ b/src/commands/compare.ts @@ -4,7 +4,7 @@ import pc from "picocolors"; import { diffSimilarity, parseDiff } from "../scoring/diff-parser.js"; import type { AgentResult, EnsembleResult } from "../types.js"; -export interface CompareOptions { +interface CompareOptions { agentA: number; agentB: number; } diff --git a/src/commands/evaluate.ts b/src/commands/evaluate.ts index 74e360e..4a8296c 100644 --- a/src/commands/evaluate.ts +++ b/src/commands/evaluate.ts @@ -3,6 +3,7 @@ import { join } from "node:path"; import pc from "picocolors"; import { analyzeConvergence, copelandRecommend, recommend } from "../scoring/convergence.js"; import type { EnsembleResult } from "../types.js"; +import { padRight } from "../utils/display.js"; import { parseAndValidateResult } from "../utils/schema.js"; interface RunEvaluation { @@ -207,13 +208,6 @@ export async function evaluate(): Promise { console.log(); } -function padRight(str: string, len: number): string { - // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional ANSI escape sequence matching - const stripped = str.replace(/\x1b\[[0-9;]*m/g, ""); - const padding = Math.max(0, len - stripped.length); - return str + " ".repeat(padding); -} - function pct(n: number, total: number): string { return `${n}/${total} (${Math.round((n / total) * 100)}%)`; } diff --git a/src/commands/list.test.ts b/src/commands/list.test.ts index f0b9dae..f97e96a 100644 --- a/src/commands/list.test.ts +++ b/src/commands/list.test.ts @@ -1,14 +1,7 @@ import assert from "node:assert/strict"; import { describe, it } from "node:test"; import type { EnsembleResult } from "../types.js"; -import { buildRunSummary, extractRunNumber } from "./list.js"; - -describe("extractRunNumber", () => { - it("returns -1 (run numbers assigned by load order, not filename)", () => { - assert.equal(extractRunNumber("run-2026-03-28T05-58-48-564Z.json"), -1); - assert.equal(extractRunNumber("latest.json"), -1); - }); -}); +import { buildRunSummary } from "./list.js"; function makeResult(overrides: Partial = {}): EnsembleResult { return { diff --git a/src/commands/list.ts b/src/commands/list.ts index b18f9c9..9060832 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -14,11 +14,6 @@ export interface RunSummary { avgConvergence: number | null; } -/** Run numbers are assigned by sort order (chronological), not embedded in filename */ -export function extractRunNumber(_filename: string): number { - return -1; // Assigned by loadAllRuns based on sort position -} - export function buildRunSummary(runNumber: number, result: EnsembleResult): RunSummary { const testPassRate = result.tests.length > 0 diff --git a/src/commands/stats.ts b/src/commands/stats.ts index 6d60a77..de58b2b 100644 --- a/src/commands/stats.ts +++ b/src/commands/stats.ts @@ -4,7 +4,7 @@ import pc from "picocolors"; import type { EnsembleResult } from "../types.js"; import { parseAndValidateResult } from "../utils/schema.js"; -export interface StatsOptions { +interface StatsOptions { model?: string; since?: string; until?: string;