fix(vscode): resolve lint caps in sidebar worktree flow

This commit is contained in:
kirillk
2026-04-24 16:35:56 -04:00
parent 26987f04d4
commit f1409354cf
3 changed files with 82 additions and 32 deletions
+15 -30
View File
@@ -45,7 +45,7 @@ import { resolveProjectDirectory } from "./project-directory"
import { getBusySessionCount, seedSessionStatuses } from "./session-status"
import { retry } from "./services/cli-backend/retry"
import { slimPart, slimParts } from "./kilo-provider/slim-metadata"
import { handleContinueInWorktree } from "./kilo-provider/continue-worktree"
import { handleSidebarWorktreeMessage } from "./kilo-provider/sidebar-worktree"
import { parseMessageFiles, type MessageFile } from "./kilo-provider/message-files"
import { handleFileSearch } from "./kilo-provider/file-search"
import { getTerminalContents } from "./services/terminal/context"
@@ -586,6 +586,20 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
await routeSuggestionWebviewMessage(this.questionCtx, message)
if (await ModelState.handleMessage(message.type, message, this.client, (msg) => this.postMessage(msg))) return
if (await routeAutocompleteMessage(message, (msg) => this.postMessage(msg))) return
if (
await handleSidebarWorktreeMessage(message, {
post: (msg) => this.postMessage(msg),
openAgentManager: () => vscode.commands.executeCommand("kilo-code.new.agentManagerOpen"),
openAdvancedWorktree: () => vscode.commands.executeCommand("kilo-code.new.agentManager.advancedWorktree"),
openChanges: () => vscode.commands.executeCommand("kilo-code.new.showChanges"),
createWorktree: async (baseBranch, branchName) => {
await this.createWorktreeHandler?.(baseBranch, branchName)
},
continueInWorktree: this.continueInWorktreeHandler ?? undefined,
})
) {
return
}
switch (message.type) {
case "webviewReady":
console.log("[Kilo New] KiloProvider: ✅ webviewReady received")
@@ -707,38 +721,9 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
case "openMarketplacePanel":
vscode.commands.executeCommand("kilo-code.new.marketplaceButtonClicked", this.projectDirectory)
break
case "openAgentManager":
vscode.commands.executeCommand("kilo-code.new.agentManagerOpen")
break
case "openAdvancedWorktree":
vscode.commands.executeCommand("kilo-code.new.agentManager.advancedWorktree")
break
case "agentManager.requestRepoInfo": {
const root = getWorkspaceRoot()
if (!root) break
const git = new GitOps({ log: () => {} })
const branch = await git.currentBranch(root).catch(() => "")
git.dispose()
if (!branch || branch === "HEAD") break
this.postMessage({ type: "agentManager.repoInfo", branch })
break
}
case "agentManager.createWorktree":
await this.createWorktreeHandler?.(message.baseBranch, message.branchName)
break
case "openChanges":
vscode.commands.executeCommand("kilo-code.new.showChanges")
break
case "openDiffVirtual":
this.openDiffVirtual(message.diff)
break
case "continueInWorktree":
handleContinueInWorktree({
sessionId: message.sessionId,
handler: this.continueInWorktreeHandler ?? undefined,
post: (msg) => this.postMessage(msg),
})
break
case "forkSession":
handleForkSession(this.forkCtx, message.sessionId, message.messageId).catch((e) =>
console.error("[Kilo New] handleForkSession failed:", e),
@@ -0,0 +1,67 @@
import { GitOps } from "../agent-manager/GitOps"
import { getWorkspaceRoot } from "../review-utils"
import { handleContinueInWorktree } from "./continue-worktree"
interface Msg {
type: string
baseBranch?: string
branchName?: string
sessionId?: string
}
interface Ctx {
post: (msg: unknown) => void
openAgentManager: () => Thenable<unknown>
openAdvancedWorktree: () => Thenable<unknown>
openChanges: () => Thenable<unknown>
createWorktree?: (baseBranch?: string, branchName?: string) => Promise<void>
continueInWorktree?: (
sessionId: string,
progress: (status: string, detail?: string, error?: string) => void,
) => Promise<void>
}
async function repo(post: Ctx["post"]) {
const root = getWorkspaceRoot()
if (!root) return
const git = new GitOps({ log: () => {} })
const branch = await git.currentBranch(root).catch(() => "")
git.dispose()
if (!branch || branch === "HEAD") return
post({ type: "agentManager.repoInfo", branch })
}
export async function handleSidebarWorktreeMessage(message: Msg, ctx: Ctx) {
if (message.type === "openAgentManager") {
await ctx.openAgentManager()
return true
}
if (message.type === "openAdvancedWorktree") {
await ctx.openAdvancedWorktree()
return true
}
if (message.type === "agentManager.requestRepoInfo") {
await repo(ctx.post)
return true
}
if (message.type === "agentManager.createWorktree") {
await ctx.createWorktree?.(message.baseBranch, message.branchName)
return true
}
if (message.type === "openChanges") {
await ctx.openChanges()
return true
}
if (message.type !== "continueInWorktree") return false
handleContinueInWorktree({
sessionId: message.sessionId,
handler: ctx.continueInWorktree,
post: ctx.post,
})
return true
}
@@ -1,5 +1,3 @@
// Agent Manager root component
/** @jsxImportSource solid-js */
import {