MCPcopy Create free account
hub / github.com/echoVic/blade-code / execute

Method execute

src/tools/builtin/git/git-smart-commit.ts:253–286  ·  view source on GitHub ↗

* 重写执行方法,处理特殊的 need_llm_analysis 错误

(params: Record<string, any>)

Source from the content-addressed store, hash-verified

251 * 重写执行方法,处理特殊的 need_llm_analysis 错误
252 */
253 async execute(params: Record<string, any>): Promise<any> {
254 const { llmAnalysis, path = '.' } = params;
255
256 // 如果没有LLM分析结果,返回需要分析的信号
257 if (!llmAnalysis) {
258 try {
259 const analysisPrompt = await this.generateGitAnalysisPrompt(path);
260 return {
261 success: false,
262 error: 'need_llm_analysis',
263 data: {
264 needsLLMAnalysis: true,
265 analysisPrompt,
266 },
267 };
268 } catch (error) {
269 return {
270 success: false,
271 error: `生成分析提示失败: ${(error as Error).message}`,
272 };
273 }
274 }
275
276 // 有LLM分析结果,继续执行正常流程
277 try {
278 const result = await super.execute(params);
279 return result;
280 } catch (error: any) {
281 return {
282 success: false,
283 error: `Git smart commit failed: ${(error as Error).message}`,
284 };
285 }
286 }
287
288 protected async executeCommand(
289 command: string,

Callers 1

Calls 1

Tested by

no test coverage detected