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

Method buildCommand

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

* 构建 Git add 命令

(params: Record<string, any>)

Source from the content-addressed store, hash-verified

91 * 构建 Git add 命令
92 */
93 protected async buildCommand(params: Record<string, any>): Promise<string> {
94 const { files, all, update, dryRun } = params;
95
96 let command = 'git add';
97
98 // 添加选项
99 if (dryRun) {
100 command += ' --dry-run';
101 }
102
103 if (all) {
104 command += ' -A';
105 } else if (update) {
106 command += ' -u';
107 } else if (files) {
108 const fileList = files.split(/\s+/).filter((f: string) => f.trim());
109 command += ` ${fileList.join(' ')}`;
110 } else {
111 // 默认添加当前目录下所有文件
112 command += ' .';
113 }
114
115 return command;
116 }
117
118 /**
119 * 获取确认选项

Callers 1

executeFunction · 0.45

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected