Fix tsconfig and test folder

This commit is contained in:
2026-03-13 00:28:48 +05:30
parent e913bff33c
commit 814bbc41a7
4 changed files with 35 additions and 8 deletions
@@ -1,9 +1,9 @@
import { expect, test, mock, spyOn, beforeEach, afterEach, describe } from "bun:test"; import { expect, test, mock, spyOn, beforeEach, afterEach, describe } from "bun:test";
import * as fs from "node:fs"; import * as fs from "node:fs";
import * as os from "node:os"; 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<string, { ok: boolean; stdout: string; stderr: string }> = {}; let mockCommandResponses: Record<string, { ok: boolean; stdout: string; stderr: string }> = {};
function setupMockBun$() { function setupMockBun$() {
+1
View File
@@ -9,6 +9,7 @@
"@opencode-ai/plugin": "1.2.24" "@opencode-ai/plugin": "1.2.24"
}, },
"devDependencies": { "devDependencies": {
"@types/bun": "^1.3.10",
"@types/node": "^25.5.0" "@types/node": "^25.5.0"
} }
} }
+6 -6
View File
@@ -182,15 +182,15 @@ function levenshtein(left: string, right: string): number {
const cost = left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1; const cost = left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1;
row[rightIndex] = Math.min( row[rightIndex] = Math.min(
row[rightIndex] + 1, row[rightIndex]! + 1,
row[rightIndex - 1] + 1, row[rightIndex - 1]! + 1,
previous + cost, previous! + cost,
); );
previous = current; 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 { function formatInvalidModelError(invalidModels: string[], allowlist: string[]): string {
const [firstInvalidModel] = invalidModels; const firstInvalidModel = invalidModels[0]!;
const suggestions = suggestModels(firstInvalidModel, allowlist); const suggestions = suggestModels(firstInvalidModel, allowlist);
const suggestionText = const suggestionText =
suggestions.length > 0 suggestions.length > 0
@@ -369,7 +369,7 @@ export default tool({
const failedModels: string[] = []; const failedModels: string[] = [];
for (let i = 0; i < windowPlans.length; i++) { for (let i = 0; i < windowPlans.length; i++) {
const plan = windowPlans[i]; const plan = windowPlans[i]!;
const isFirst = i === 0; const isFirst = i === 0;
const worktreePath = getWorktreePath(safeSessionName, plan.windowName); const worktreePath = getWorktreePath(safeSessionName, plan.windowName);
+26
View File
@@ -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"]
}