diff --git a/.opencode/tools/multi-model.test.ts b/.opencode/multi-model.test.ts similarity index 98% rename from .opencode/tools/multi-model.test.ts rename to .opencode/multi-model.test.ts index 7d58d99..6993907 100644 --- a/.opencode/tools/multi-model.test.ts +++ b/.opencode/multi-model.test.ts @@ -1,9 +1,9 @@ import { expect, test, mock, spyOn, beforeEach, afterEach, describe } from "bun:test"; import * as fs from "node:fs"; import * as os from "node:os"; -import multiModelTool from "./multi-model"; +import multiModelTool from "./tools/multi-model"; -let originalBun$: typeof Bun.$; +let originalBun$: typeof Bun.$ = (globalThis as any).Bun?.$; let mockCommandResponses: Record = {}; function setupMockBun$() { diff --git a/.opencode/package.json b/.opencode/package.json index f415a09..e87e407 100644 --- a/.opencode/package.json +++ b/.opencode/package.json @@ -9,6 +9,7 @@ "@opencode-ai/plugin": "1.2.24" }, "devDependencies": { + "@types/bun": "^1.3.10", "@types/node": "^25.5.0" } } diff --git a/.opencode/tools/multi-model.ts b/.opencode/tools/multi-model.ts index 46e48a4..b23316f 100644 --- a/.opencode/tools/multi-model.ts +++ b/.opencode/tools/multi-model.ts @@ -182,15 +182,15 @@ function levenshtein(left: string, right: string): number { const cost = left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1; row[rightIndex] = Math.min( - row[rightIndex] + 1, - row[rightIndex - 1] + 1, - previous + cost, + row[rightIndex]! + 1, + row[rightIndex - 1]! + 1, + previous! + cost, ); previous = current; } } - return row[right.length]; + return row[right.length]!; } /** @@ -242,7 +242,7 @@ function suggestModels(requested: string, allowlist: string[]): string[] { * ``` */ function formatInvalidModelError(invalidModels: string[], allowlist: string[]): string { - const [firstInvalidModel] = invalidModels; + const firstInvalidModel = invalidModels[0]!; const suggestions = suggestModels(firstInvalidModel, allowlist); const suggestionText = suggestions.length > 0 @@ -369,7 +369,7 @@ export default tool({ const failedModels: string[] = []; for (let i = 0; i < windowPlans.length; i++) { - const plan = windowPlans[i]; + const plan = windowPlans[i]!; const isFirst = i === 0; const worktreePath = getWorktreePath(safeSessionName, plan.windowName); diff --git a/.opencode/tsconfig.json b/.opencode/tsconfig.json new file mode 100644 index 0000000..05af1b4 --- /dev/null +++ b/.opencode/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + + "types": [ + "bun-types" + ] + }, + "include": ["**/*.ts", "**/*.tsx"] +} \ No newline at end of file