SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Fix create signature format
carlosejimenezb019f63df532
diff --git a/sweagent/tools/commands.py b/sweagent/tools/commands.pyindex d5033daa..ea70e45f 100644--- a/sweagent/tools/commands.py+++ b/sweagent/tools/commands.py@@ -98,6 +98,20 @@ class Command(BaseModel):or a default format of "command arg1 arg2 ..."."""if self.signature:+ # First validate that all arguments are present in the original signature+ if not all(+ f"<{arg.name}>" in self.signature+ or f"[<{arg.name}>]" in self.signature+ or f"{{{arg.name}}}" in self.signature+ for arg in self.arguments+ ):+ msg = (+ f"Missing arguments in signature: {self.signature}. Did you format the signature correctly? "+ "You must include all argument names in the signature with <name>, [<name>], or {name} notation."+ )+ raise ValueError(msg)++ # Then do the replacementreturn re.sub(rf"\[?<({ARGUMENT_NAME_PATTERN})>\]?", r"{\1}", self.signature)else:# cmd arg_format_1 arg_format_2 ...diff --git a/tools/defaults/bin/open b/tools/defaults/bin/openindex 23593d1a..e879afe0 100644--- a/tools/defaults/bin/open+++ b/tools/defaults/bin/open@@ -34,12 +34,11 @@ def main(path: Optional[str] = None, line_number: Optional[str] = None) -> None:print(f"Warning: <line_number> ({line_num}) is less than 1")print("Warning: Setting <line_number> to 1")line_num = 1-else:# Default to middle of window if no line number provided- line_num = wf.window // 2+ line_num = wf.first_line- wf.current_line = line_num - 1+ wf.goto(line_num - 1, mode="top")wf.print_window()diff --git a/tools/edit_replace/config.yaml b/tools/edit_replace/config.yamlindex 72768f4b..8a7d2e65 100644--- a/tools/edit_replace/config.yaml+++ b/tools/edit_replace/config.yaml@@ -20,7 +20,7 @@ tools:required: falseinsert:signature: |- insert <text> [--line <line>]+ insert <text> [<line>]docstring: >Insert <text> at the end of the currently opened file or after <line> if specified.arguments:@@ -31,4 +31,4 @@ tools:- name: linetype: integerdescription: "the line number to insert the text as new lines after"- required: false\ No newline at end of file+ required: false