MCPcopy Index your code
hub / github.com/anus-dev/ANUS / stripShellWrapper

Function stripShellWrapper

packages/core/src/utils/shell-utils.ts:203–217  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

201}
202
203export function stripShellWrapper(command: string): string {
204 const pattern = /^\s*(?:sh|bash|zsh|cmd.exe)\s+(?:\/c|-c)\s+/;
205 const match = command.match(pattern);
206 if (match) {
207 let newCommand = command.substring(match[0].length).trim();
208 if (
209 (newCommand.startsWith('"') && newCommand.endsWith('"')) ||
210 (newCommand.startsWith("'") && newCommand.endsWith("'"))
211 ) {
212 newCommand = newCommand.substring(1, newCommand.length - 1);
213 }
214 return newCommand;
215 }
216 return command.trim();
217}
218
219/**
220 * Detects command substitution patterns in a shell command, following bash quoting rules:

Callers 3

shouldConfirmExecuteMethod · 0.85
executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected