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

Method handleTerminalAction

src/core/webview/ClineProvider.ts:746–782  ·  view source on GitHub ↗
(
		command: TerminalActionId,
		promptType: TerminalActionPromptType,
		params: Record<string, string | any[]>,
	)

Source from the content-addressed store, hash-verified

744 }
745
746 public static async handleTerminalAction(
747 command: TerminalActionId,
748 promptType: TerminalActionPromptType,
749 params: Record<string, string | any[]>,
750 ): Promise<void> {
751 TelemetryService.instance.captureCodeActionUsed(promptType)
752
753 const visibleProvider = await ClineProvider.getInstance()
754
755 if (!visibleProvider) {
756 return
757 }
758
759 const { customSupportPrompts } = await visibleProvider.getState()
760 const prompt = supportPrompt.create(promptType, params, customSupportPrompts)
761
762 if (command === "terminalAddToContext") {
763 await visibleProvider.postMessageToWebview({
764 type: "invoke",
765 invoke: "setChatBoxMessage",
766 text: `${prompt}\n\n`,
767 })
768 await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" })
769 return
770 }
771
772 try {
773 await visibleProvider.createTask(prompt)
774 } catch (error) {
775 if (error instanceof OrganizationAllowListViolationError) {
776 // Errors from terminal commands seem to get swallowed / ignored.
777 vscode.window.showErrorMessage(error.message)
778 }
779
780 throw error
781 }
782 }
783
784 async resolveWebviewView(webviewView: vscode.WebviewView | vscode.WebviewPanel) {
785 this.view = webviewView

Callers 1

registerTerminalActionFunction · 0.80

Calls 7

captureCodeActionUsedMethod · 0.80
postMessageToWebviewMethod · 0.80
getStateMethod · 0.65
createTaskMethod · 0.65
getInstanceMethod · 0.45
createMethod · 0.45
showErrorMessageMethod · 0.45

Tested by

no test coverage detected