MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getCommandsMap

Function getCommandsMap

src/activate/registerCommands.ts:88–222  ·  view source on GitHub ↗
({
	context,
	outputChannel,
	provider,
}: RegisterCommandOptions)

Source from the content-addressed store, hash-verified

86// args dynamically.
87type CommandCallback = (...args: any[]) => unknown
88const getCommandsMap = ({
89 context,
90 outputChannel,
91 provider,
92}: RegisterCommandOptions): Record<Exclude<CommandId, "showRipgrepDiagnostic">, CommandCallback> => ({
93 activationCompleted: () => {},
94 plusButtonClicked: async () => {
95 const visibleProvider = getVisibleProviderOrLog(outputChannel)
96
97 if (!visibleProvider) {
98 return
99 }
100
101 TelemetryService.instance.captureTitleButtonClicked("plus")
102
103 await visibleProvider.removeClineFromStack()
104 await visibleProvider.refreshWorkspace()
105 await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
106 // Send focusInput action immediately after chatButtonClicked
107 // This ensures the focus happens after the view has switched
108 await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" })
109 },
110 popoutButtonClicked: () => {
111 TelemetryService.instance.captureTitleButtonClicked("popout")
112
113 return openClineInNewTab({ context, outputChannel })
114 },
115 openInNewTab: () => openClineInNewTab({ context, outputChannel }),
116 settingsButtonClicked: () => {
117 const visibleProvider = getVisibleProviderOrLog(outputChannel)
118
119 if (!visibleProvider) {
120 return
121 }
122
123 TelemetryService.instance.captureTitleButtonClicked("settings")
124
125 void visibleProvider
126 .postMessageToWebview({ type: "action", action: "settingsButtonClicked" })
127 .catch((error) => outputChannel.appendLine(`[settingsButtonClicked] postMessageToWebview failed: ${error}`))
128 // Also explicitly post the visibility message to trigger scroll reliably
129 void visibleProvider
130 .postMessageToWebview({ type: "action", action: "didBecomeVisible" })
131 .catch((error) => outputChannel.appendLine(`[settingsButtonClicked] postMessageToWebview failed: ${error}`))
132 },
133 historyButtonClicked: () => {
134 const visibleProvider = getVisibleProviderOrLog(outputChannel)
135
136 if (!visibleProvider) {
137 return
138 }
139
140 TelemetryService.instance.captureTitleButtonClicked("history")
141
142 void visibleProvider
143 .postMessageToWebview({ type: "action", action: "historyButtonClicked" })
144 .catch((error) => outputChannel.appendLine(`[historyButtonClicked] postMessageToWebview failed: ${error}`))
145 },

Callers 1

registerCommandsFunction · 0.85

Calls 11

focusPanelFunction · 0.90
getVisibleProviderOrLogFunction · 0.85
openClineInNewTabFunction · 0.85
getPanelFunction · 0.85
removeClineFromStackMethod · 0.80
refreshWorkspaceMethod · 0.80
postMessageToWebviewMethod · 0.80
appendLineMethod · 0.80

Tested by

no test coverage detected