fix: replace 'as any' with proper type assertion for git tool args

The git tool handler in ipc.ts was using 'args as any' to bypass type
checking. Replaced with the explicit typed params interface matching
handleGit's signature to maintain type safety.
This commit is contained in:
thzxx
2026-04-24 13:56:30 +08:00
parent e4dc7f945f
commit 15b4895351
+1 -1
View File
@@ -187,7 +187,7 @@ export async function setupIPC(): Promise<void> {
case 'diff_files': result = await handleDiffFiles(args as { file1: string; file2: string; context_lines?: number }); break; case 'diff_files': result = await handleDiffFiles(args as { file1: string; file2: string; context_lines?: number }); break;
case 'replace_in_files': result = await handleReplaceInFiles(args as { path: string; glob: string; old_text: string; new_text: string }); break; case 'replace_in_files': result = await handleReplaceInFiles(args as { path: string; glob: string; old_text: string; new_text: string }); break;
case 'read_multiple_files':result = await handleReadMultipleFiles(args as { paths: string[]; max_chars_per_file?: number }); break; case 'read_multiple_files':result = await handleReadMultipleFiles(args as { paths: string[]; max_chars_per_file?: number }); break;
case 'git': result = await handleGit(args as any); break; case 'git': result = await handleGit(args as { action: string; path?: string; files?: string[]; message?: string; branch?: string; remote?: string; remote_url?: string; count?: number; all?: boolean; staged?: boolean; new_branch?: boolean; delete_branch?: boolean; force?: boolean; url?: string }); break;
case 'compress': result = await handleCompress(args as { action: string; path: string; destination?: string; format?: string }); break; case 'compress': result = await handleCompress(args as { action: string; path: string; destination?: string; format?: string }); break;
// v5.0 Browser 控制 // v5.0 Browser 控制
case 'browser_open': result = await browserOpen(args.url as string); break; case 'browser_open': result = await browserOpen(args.url as string); break;