diff --git a/packages/kilo-vscode/src/extension.ts b/packages/kilo-vscode/src/extension.ts index e221f755d..efb8725bb 100644 --- a/packages/kilo-vscode/src/extension.ts +++ b/packages/kilo-vscode/src/extension.ts @@ -1,4 +1,6 @@ import * as vscode from "vscode" +import * as fs from "fs" +import * as path from "path" import { KiloProvider } from "./KiloProvider" import { AgentManagerProvider } from "./AgentManagerProvider" import { EXTENSION_DISPLAY_NAME } from "./constants" @@ -9,6 +11,24 @@ import { BrowserAutomationService } from "./services/browser-automation" export function activate(context: vscode.ExtensionContext) { console.log("Kilo Code extension is now active") + // kilocode_change - ensure VS Code directories exist to prevent ENOENT errors during webview hot reload + // VS Code 1.109+ checks for these directories during webview initialization + try { + const userConfigPath = path.join(context.globalStorageUri.fsPath, "..", "..", "..", "User") + fs.mkdirSync(path.join(userConfigPath, "prompts"), { recursive: true }) + + // Also create .github/agents in workspace roots to prevent workspace-specific ENOENT + const workspaceFolders = vscode.workspace.workspaceFolders + if (workspaceFolders) { + for (const folder of workspaceFolders) { + const agentsPath = path.join(folder.uri.fsPath, ".github", "agents") + fs.mkdirSync(agentsPath, { recursive: true }) + } + } + } catch { + // Ignore errors (e.g., permissions, already exists) + } + // Create shared connection service (one server for all webviews) const connectionService = new KiloConnectionService(context)