MCPcopy Create free account
hub / github.com/Dizzy-K/AutoPT / _looks_like_shell_command

Method _looks_like_shell_command

tools/terminal.py:210–222  ·  view source on GitHub ↗
(command: str)

Source from the content-addressed store, hash-verified

208
209 @staticmethod
210 def _looks_like_shell_command(command: str) -> bool:
211 if not command:
212 return False
213
214 if re.search(r"[|&;<>]", command):
215 return True
216
217 first_token = command.split()[0].strip().strip("`\"&#x27;")
218 if first_token in COMMON_SHELL_COMMANDS:
219 return True
220 if first_token.startswith(("./", "../", "/")):
221 return True
222 return False
223
224 @classmethod
225 def _strip_natural_language_prefixes(cls, command: str) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected