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

Method preprocessParameters

src/tools/builtin/git/git-add.ts:70–88  ·  view source on GitHub ↗

* 预处理参数

(params: Record<string, any>)

Source from the content-addressed store, hash-verified

68 * 预处理参数
69 */
70 protected async preprocessParameters(params: Record<string, any>): Promise<Record<string, any>> {
71 const { files } = params;
72
73 // 验证文件路径安全性
74 if (files) {
75 const fileList = files.split(/\s+/).filter((f: string) => f.trim());
76 for (const file of fileList) {
77 if (file.includes('..') || file.startsWith('/')) {
78 throw new Error(`不安全的文件路径: ${file}`);
79 }
80 }
81
82 if (fileList.length === 0) {
83 throw new Error('没有指定有效的文件路径');
84 }
85 }
86
87 return params;
88 }
89
90 /**
91 * 构建 Git add 命令

Callers 1

executeFunction · 0.45

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected