Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export interface ExtensionMessage {
| "rules"
| "fileContent"
| "rooHistoryImportProgress"
| "diagnosticsRequest"
text?: string
/** For fileContent: { path, content, error? } */
fileContent?: { path: string; content: string | null; error?: string }
Expand Down Expand Up @@ -150,6 +151,7 @@ export interface ExtensionMessage {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
values?: Record<string, any>
requestId?: string
diagnostics?: WebviewDiagnosticsSnapshot
promptText?: string
results?:
| { path: string; type: "file" | "folder"; label?: string }[]
Expand Down Expand Up @@ -438,6 +440,40 @@ export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "message

export type AudioType = "notification" | "celebration" | "progress_loop"

export interface WebviewDiagnosticsSnapshot {
capturedAt: string
didHydrateState?: boolean
documentReadyState?: "loading" | "interactive" | "complete"
documentVisibilityState?: "hidden" | "visible" | "prerender"
activeView?: string
rootMounted?: boolean
rootChildCount?: number
lastReceivedStateSequence?: number
lastAppliedStateSequence?: number
staleStateRejectionCount?: number
unknownMessageUpdateCount?: number
currentTaskId?: string
chatMessageCount?: number
historyItemCount?: number
todoCount?: number
viewport?: { width: number; height: number; devicePixelRatio: number }
theme?: {
kind?: number
identifier?: string
bodyForeground?: string
bodyBackground?: string
rootForeground?: string
rootBackground?: string
variables?: Record<string, string>
}
error?: {
name?: string
message?: string
fingerprint?: string
stackLocations?: string[]
}
}

export interface UpdateTodoListPayload {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
todos: any[]
Expand Down Expand Up @@ -632,6 +668,7 @@ export interface WebviewMessage {
| "deleteRule"
| "openRuleFile"
| "openRulesDirectory"
| "diagnosticsResponse"
text?: string
taskId?: string
editedMessageContent?: string
Expand Down Expand Up @@ -678,6 +715,7 @@ export interface WebviewMessage {
/** Target mode slugs for updateSkillModes */
newSkillModeSlugs?: string[] // For updateSkillModes (new mode restrictions)
requestId?: string
diagnostics?: WebviewDiagnosticsSnapshot
ids?: string[]
terminalOperation?: "continue" | "abort"
messageTs?: number
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const commandIds = [
"toggleAutoApprove",

"showRipgrepDiagnostic",
"createDiagnosticsReport",
] as const

export type CommandId = (typeof commandIds)[number]
Expand Down
19 changes: 19 additions & 0 deletions src/activate/__tests__/registerCommands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ vi.mock("../../services/ripgrep/diagnostic", () => ({
registerRipgrepDiagnosticCommand: vi.fn().mockReturnValue({ dispose: vi.fn() }),
}))

vi.mock("../../services/diagnostics", () => ({
createDiagnosticsReport: vi.fn().mockResolvedValue(undefined),
}))

describe("getVisibleProviderOrLog", () => {
let mockOutputChannel: vscode.OutputChannel

Expand Down Expand Up @@ -192,6 +196,21 @@ describe("registerCommands handlers", () => {
expect(mockContext.subscriptions).toContain(disposable)
})

it("creates diagnostics from all provider instances without requiring a visible provider", async () => {
const { createDiagnosticsReport } = await import("../../services/diagnostics")
const providers = [{}, {}]
;(ClineProvider.getAllInstances as Mock).mockReturnValue(providers)
;(ClineProvider.getVisibleInstance as Mock).mockReturnValue(undefined)

await handlers["zoo-code.createDiagnosticsReport"]()

expect(createDiagnosticsReport).toHaveBeenCalledWith({
context: mockContext,
outputChannel: mockOutputChannel,
providers,
})
})

it("settingsButtonClicked posts both settingsButtonClicked and didBecomeVisible actions", () => {
handlers["zoo-code.settingsButtonClicked"]()

Expand Down
7 changes: 7 additions & 0 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CodeIndexManager } from "../services/code-index/manager"
import { importSettingsWithFeedback } from "../core/config/importExport"
import { MdmService } from "../services/mdm/MdmService"
import { registerRipgrepDiagnosticCommand } from "../services/ripgrep/diagnostic"
import { createDiagnosticsReport } from "../services/diagnostics"
import { t } from "../i18n"

/**
Expand Down Expand Up @@ -173,6 +174,12 @@ const getCommandsMap = ({
filePath,
)
},
createDiagnosticsReport: () =>
createDiagnosticsReport({
context,
outputChannel,
providers: ClineProvider.getAllInstances(),
}),
focusInput: async () => {
try {
await focusPanel(tabPanel, sidebarPanel)
Expand Down
Loading
Loading