[Protobus] migrate executeQuickWin (#4088)

* protobuf executeQuickWin

* whitespaces

---------

Co-authored-by: Andrei Eternal <eternal@cline.bot>
This commit is contained in:
Andrei EternalandAndrei Eternal authored and GitHub committed 2025-06-06 18:46:31 -07:00
1 parent d7e1fff011
commit 4d7ced7e15
4 files changed
+44 -10

No files matched your search

@@ -0,0 +1,35 @@
import { ExecuteQuickWinRequest } from "@shared/proto/task"
import { Empty } from "@shared/proto/common"
import type { Controller } from "../index"
/**
* Executes a quick win task with command and title
* @param controller The controller instance
* @param request The execute quick win request
* @returns Empty response
*
* @example
* // Usage from webview:
* import { TaskServiceClient } from "@/services/grpc-client"
* import { ExecuteQuickWinRequest } from "@shared/proto/task"
*
* const request: ExecuteQuickWinRequest = {
* command: "npm install",
* title: "Install dependencies"
* }
*
* TaskServiceClient.executeQuickWin(request)
* .then(() => console.log("Quick win executed successfully"))
* .catch(error => console.error("Failed to execute quick win:", error))
*/
export async function executeQuickWin(controller: Controller, request: ExecuteQuickWinRequest): Promise<Empty> {
try {
const { command, title } = request
console.log(`Received executeQuickWin: command='${command}', title='${title}'`)
await controller.initTask(title)
return Empty.create({})
} catch (error) {
console.error("Failed to execute quick win:", error)
throw error
}
}