diff --git a/src/core/tools/applyDiffTool.ts b/src/core/tools/applyDiffTool.ts index 4c575174..98ecabe1 100644 --- a/src/core/tools/applyDiffTool.ts +++ b/src/core/tools/applyDiffTool.ts @@ -77,8 +77,8 @@ export async function applyDiffTool( const diffResult = (await theaTask.diffStrategy?.applyDiff( originalContent, diffContent, - parseInt(block.params.start_line ?? ""), - parseInt(block.params.end_line ?? ""), + parseInt(block.params.start_line ?? "", 10), + parseInt(block.params.end_line ?? "", 10), )) ?? { success: false, error: "No diff strategy available", diff --git a/src/core/tools/readFileTool.ts b/src/core/tools/readFileTool.ts index 1d91f2e9..3711dfd5 100644 --- a/src/core/tools/readFileTool.ts +++ b/src/core/tools/readFileTool.ts @@ -62,7 +62,7 @@ export async function readFileTool( // Parse start_line if provided if (startLineStr) { - startLine = parseInt(startLineStr) + startLine = parseInt(startLineStr, 10) if (isNaN(startLine)) { // Invalid start_line theaTask.consecutiveMistakeCount++ @@ -75,7 +75,7 @@ export async function readFileTool( // Parse end_line if provided if (endLineStr) { - endLine = parseInt(endLineStr) + endLine = parseInt(endLineStr, 10) if (isNaN(endLine)) { // Invalid end_line diff --git a/src/core/tools/writeToFileTool.ts b/src/core/tools/writeToFileTool.ts index 0eae5fec..d7596900 100644 --- a/src/core/tools/writeToFileTool.ts +++ b/src/core/tools/writeToFileTool.ts @@ -24,7 +24,7 @@ export async function writeToFileTool( ) { const relPath: string | undefined = block.params.path let newContent: string | undefined = block.params.content - let predictedLineCount: number | undefined = parseInt(block.params.line_count ?? "0") + let predictedLineCount: number | undefined = parseInt(block.params.line_count ?? "0", 10) if (!relPath || !newContent) { // checking for newContent ensure relPath is complete // wait so we can determine if it's a new file or editing an existing file diff --git a/src/core/webview/TheaProvider.ts b/src/core/webview/TheaProvider.ts index 02d308c5..db246b2e 100644 --- a/src/core/webview/TheaProvider.ts +++ b/src/core/webview/TheaProvider.ts @@ -332,7 +332,7 @@ export class TheaProvider extends EventEmitter implements vs // Ensure messageHandler is properly set up this.messageHandler = webviewMessageHandler - // Initialize out-of-scope variables that need to recieve persistent global state values + // Initialize out-of-scope variables that need to receive persistent global state values void this.theaStateManager.getState().then(({ soundEnabled, terminalShellIntegrationTimeout }) => { // Renamed property setSoundEnabled(soundEnabled ?? false) @@ -364,7 +364,7 @@ export class TheaProvider extends EventEmitter implements vs : this.getHtmlContent(webviewView.webview) // Sets up an event listener to listen for messages passed from the webview view context - // and executes code based on the message that is recieved + // and executes code based on the message that is received this.setWebviewMessageListener(webviewView.webview) // Logs show up in bottom panel > Debug Console @@ -723,7 +723,7 @@ export class TheaProvider extends EventEmitter implements vs /** * Sets up an event listener to listen for messages passed from the webview context and - * executes code based on the message that is recieved. + * executes code based on the message that is received. * * @param webview A reference to the extension webview */ @@ -771,8 +771,6 @@ export class TheaProvider extends EventEmitter implements vs return } - console.log(`[subtasks] cancelling task ${theaTask.taskId}.${theaTask.instanceId}`) // Use renamed variable - const { historyItem } = await this.theaTaskHistoryManager.getTaskWithId(theaTask.taskId) // Renamed property // Preserve parent and root task information for history item. const rootTask = theaTask.rootTask // Use renamed variable @@ -877,7 +875,6 @@ export class TheaProvider extends EventEmitter implements vs async postStateToWebview() { const state = await this.getStateToPostToWebview() - console.log("Posting state to webview:", state) await this.postMessageToWebview({ type: "state", state }) } diff --git a/src/e2e/src/suite/modes.test.ts b/src/e2e/src/suite/modes.test.ts index 08568906..7ac299d1 100644 --- a/src/e2e/src/suite/modes.test.ts +++ b/src/e2e/src/suite/modes.test.ts @@ -36,7 +36,7 @@ suite("Thea Code Modes", () => { const completion = getCompletion({ api, taskId: gradeTaskId }) const match = completion?.text?.match(/Grade: (\d+)/) - const score = parseInt(match?.[1] ?? "0") + const score = parseInt(match?.[1] ?? "0", 10) assert.ok(score >= 7 && score <= 10, `Grade must be between 7 and 10 - ${completion?.text}`) await api.cancelCurrentTask() diff --git a/src/e2e/src/suite/services/mcp/providers/EmbeddedMcpProvider.lifecycle.test.ts b/src/e2e/src/suite/services/mcp/providers/EmbeddedMcpProvider.lifecycle.test.ts index ca2dbb9b..0854d2d8 100644 --- a/src/e2e/src/suite/services/mcp/providers/EmbeddedMcpProvider.lifecycle.test.ts +++ b/src/e2e/src/suite/services/mcp/providers/EmbeddedMcpProvider.lifecycle.test.ts @@ -42,7 +42,7 @@ suite("EmbeddedMcpProvider Lifecycle Tests", () => { assert.notStrictEqual(serverUrl, undefined) assert.notStrictEqual(serverUrl?.port, undefined) - const port = parseInt(serverUrl!.port) + const port = parseInt(serverUrl!.port, 10) assert.ok(port > 0) assert.notStrictEqual(port, 0) }) @@ -58,7 +58,7 @@ suite("EmbeddedMcpProvider Lifecycle Tests", () => { // First start await provider.start() const firstUrl = provider.getServerUrl() - const firstPort = firstUrl ? parseInt(firstUrl.port) : 0 + const firstPort = firstUrl ? parseInt(firstUrl.port, 10) : 0 // Stop await provider.stop() @@ -66,7 +66,7 @@ suite("EmbeddedMcpProvider Lifecycle Tests", () => { // Restart await provider.start() const secondUrl = provider.getServerUrl() - const secondPort = secondUrl ? parseInt(secondUrl.port) : 0 + const secondPort = secondUrl ? parseInt(secondUrl.port, 10) : 0 // Should have valid ports assert.ok(firstPort > 0) diff --git a/src/services/mcp/providers/__tests__/EmbeddedMcpProvider.lifecycle.test.ts b/src/services/mcp/providers/__tests__/EmbeddedMcpProvider.lifecycle.test.ts index 1e174b48..b066bdb6 100644 --- a/src/services/mcp/providers/__tests__/EmbeddedMcpProvider.lifecycle.test.ts +++ b/src/services/mcp/providers/__tests__/EmbeddedMcpProvider.lifecycle.test.ts @@ -35,7 +35,7 @@ describe("EmbeddedMcpProvider Lifecycle Tests", () => { expect(serverUrl).toBeDefined() expect(serverUrl?.port).toBeDefined() - const port = parseInt(serverUrl!.port) + const port = parseInt(serverUrl!.port, 10) expect(port).toBeGreaterThan(0) expect(port).not.toBe(0) }) @@ -51,7 +51,7 @@ describe("EmbeddedMcpProvider Lifecycle Tests", () => { // First start await provider.start() const firstUrl = provider.getServerUrl() - const firstPort = firstUrl ? parseInt(firstUrl.port) : 0 + const firstPort = firstUrl ? parseInt(firstUrl.port, 10) : 0 // Stop await provider.stop() @@ -59,7 +59,7 @@ describe("EmbeddedMcpProvider Lifecycle Tests", () => { // Restart await provider.start() const secondUrl = provider.getServerUrl() - const secondPort = secondUrl ? parseInt(secondUrl.port) : 0 + const secondPort = secondUrl ? parseInt(secondUrl.port, 10) : 0 // Should have valid ports expect(firstPort).toBeGreaterThan(0)