diff --git a/src/cost/pricing-fetcher.ts b/src/cost/pricing-fetcher.ts index 3f6e41870..a9f357125 100644 --- a/src/cost/pricing-fetcher.ts +++ b/src/cost/pricing-fetcher.ts @@ -162,10 +162,6 @@ export async function readPricingCache(cachePath = defaultPricingCachePath()): P } } -export function lookupModelReasoning(cache: PricingCache | null, modelId: string): boolean | undefined { - return cache?.reasoning?.[modelId]; -} - export async function writePricingCache(cache: PricingCache, cachePath = defaultPricingCachePath()): Promise { try { await mkdir(dirname(cachePath), { recursive: true }); diff --git a/src/pricing-fetcher.test.ts b/src/pricing-fetcher.test.ts index 4f451b21b..08b46e4f6 100644 --- a/src/pricing-fetcher.test.ts +++ b/src/pricing-fetcher.test.ts @@ -7,7 +7,6 @@ import { fetchPricing, loadPricing, lookupModelPricing, - lookupModelReasoning, readPricingCache, writePricingCache, startPricingRefresh, @@ -49,13 +48,6 @@ describe("parseModelsDevReasoning", () => { }; expect(parseModelsDevReasoning(payload)).toEqual({ "gpt-5.1": true, "gpt-4o": false }); }); - - test("lookupModelReasoning reads the cached flag, undefined when absent", () => { - const cache: PricingCache = { timestamp: 0, models: {}, reasoning: { "gpt-5.1": true } }; - expect(lookupModelReasoning(cache, "gpt-5.1")).toBe(true); - expect(lookupModelReasoning(cache, "unknown")).toBeUndefined(); - expect(lookupModelReasoning(null, "gpt-5.1")).toBeUndefined(); - }); }); // --------------------------------------------------------------------------- diff --git a/src/tui/tool-args.test.ts b/src/tui/tool-args.test.ts deleted file mode 100644 index aa4b9f9b1..000000000 --- a/src/tui/tool-args.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { parsePresentViewFromArgs } from "./tool-args.js"; - -describe("parsePresentViewFromArgs", () => { - test("extracts view from JSON args", () => { - const view = { type: "text", text: "hi" }; - expect(parsePresentViewFromArgs(JSON.stringify({ view }))).toEqual(view); - }); - - test("returns undefined on invalid JSON", () => { - expect(parsePresentViewFromArgs("{")).toBeUndefined(); - }); -}); \ No newline at end of file diff --git a/src/tui/tool-args.ts b/src/tui/tool-args.ts deleted file mode 100644 index 45fc3de6c..000000000 --- a/src/tui/tool-args.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function parsePresentViewFromArgs(rawArgs: string): unknown { - try { - return (JSON.parse(rawArgs) as { view?: unknown }).view; - } catch { - return undefined; - } -} \ No newline at end of file diff --git a/src/util/glob.ts b/src/util/glob.ts deleted file mode 100644 index 5ec359f65..000000000 --- a/src/util/glob.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Glob matching for relative file paths. The single-segment matcher mirrors -// interchange's @intx/tools-posix glob-match; it is reimplemented here rather -// than imported across the submodule source boundary (that import pulls files -// outside this package's rootDir and breaks the type build). This wrapper adds -// brace expansion (`{a,b}`) on top, which the base matcher intentionally rejects. - -function globToRegex(pattern: string): RegExp { - let regex = ""; - let i = 0; - - while (i < pattern.length) { - const c = pattern.charAt(i); - - if (c === "*" && pattern[i + 1] === "*") { - // `**` -- match zero or more path segments - i += 2; - if (pattern[i] === "/") { - i++; // consume trailing slash after ** - regex += "(?:.+/)?"; - } else { - regex += ".*"; - } - } else if (c === "*") { - regex += "[^/]*"; - i++; - } else if (c === "?") { - regex += "[^/]"; - i++; - } else if (".+^${}()|[]\\".includes(c)) { - regex += "\\" + c; - i++; - } else { - regex += c; - i++; - } - } - - return new RegExp("^" + regex + "$"); -} - -export function matchGlob(pattern: string, filePath: string): boolean { - const braceMatch = pattern.match(/^(.*)\{([^}]+)\}(.*)$/); - if (braceMatch) { - const [, prefix, alts, suffix] = braceMatch as [string, string, string, string]; - return alts.split(",").some((alt) => matchGlob(`${prefix}${alt}${suffix}`, filePath)); - } - return globToRegex(pattern).test(filePath); -} diff --git a/tests/unit/glob-brace.test.ts b/tests/unit/glob-brace.test.ts deleted file mode 100644 index 5af9fa350..000000000 --- a/tests/unit/glob-brace.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, test, expect } from "bun:test"; -import { matchGlob } from "../../src/util/glob.js"; - -describe("brace expansion in glob patterns", () => { - test("single brace group: *.{ts,tsx} matches .ts files", () => { - expect(matchGlob("*.{ts,tsx}", "foo.ts")).toBe(true); - }); - - test("single brace group: *.{ts,tsx} matches .tsx files", () => { - expect(matchGlob("*.{ts,tsx}", "foo.tsx")).toBe(true); - }); - - test("single brace group: *.{ts,tsx} does not match .js files", () => { - expect(matchGlob("*.{ts,tsx}", "foo.js")).toBe(false); - }); - - test("double-star with brace: **/*.{ts,tsx} matches nested .ts", () => { - expect(matchGlob("**/*.{ts,tsx}", "src/a/foo.ts")).toBe(true); - }); - - test("double-star with brace: **/*.{ts,tsx} matches nested .tsx", () => { - expect(matchGlob("**/*.{ts,tsx}", "src/a/bar.tsx")).toBe(true); - }); - - test("double-star with brace: **/*.{ts,tsx} does not match nested .js", () => { - expect(matchGlob("**/*.{ts,tsx}", "src/a/baz.js")).toBe(false); - }); -});