Skip to content

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]

Tools: Remove cursors editing

Kilian Lieret012c7567896e
diff --git a/tools/cursors_defaults/bin/_read_env b/tools/cursors_defaults/bin/_read_env
deleted file mode 100644
index e43868ad..00000000
--- a/tools/cursors_defaults/bin/_read_env
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-
-import json
-import os
-import sys
-
-SWE_AGENT_ENV_FILE = os.environ.get("SWE_AGENT_ENV_FILE", "/root/.swe-agent-env")
-
-def read_env(var_name, default_value=None):
- if not os.path.exists(SWE_AGENT_ENV_FILE):
- with open(SWE_AGENT_ENV_FILE, "w") as f:
- json.dump({}, f)
- return default_value
- with open(SWE_AGENT_ENV_FILE, "r") as f:
- env = json.load(f)
- return env.get(var_name, default_value)
-
-if __name__ == "__main__":
- var_name = sys.argv[1]
- default_value = sys.argv[2] if len(sys.argv) > 2 else ""
- print(read_env(var_name, default_value))
diff --git a/tools/cursors_defaults/bin/_write_env b/tools/cursors_defaults/bin/_write_env
deleted file mode 100644
index 27e7c1b7..00000000
--- a/tools/cursors_defaults/bin/_write_env
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-
-import json
-import os
-import sys
-
-SWE_AGENT_ENV_FILE = os.environ.get("SWE_AGENT_ENV_FILE", "/root/.swe-agent-env")
-
-def write_env(var_name, var_value):
- if not os.path.exists(SWE_AGENT_ENV_FILE):
- with open(SWE_AGENT_ENV_FILE, "w") as f:
- json.dump({}, f)
- with open(SWE_AGENT_ENV_FILE, "r") as f:
- env = json.load(f)
- env[var_name] = var_value
- with open(SWE_AGENT_ENV_FILE, "w") as f:
- json.dump(env, f)
-
-if __name__ == "__main__":
- var_name = sys.argv[1]
- var_value = sys.argv[2] if len(sys.argv) > 2 else ""
- write_env(var_name, var_value)
diff --git a/tools/cursors_defaults/bin/create b/tools/cursors_defaults/bin/create
deleted file mode 100644
index 3df63e90..00000000
--- a/tools/cursors_defaults/bin/create
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
-
-main() {
- if [ -z "$1" ]; then
- echo "Usage: create <filename>"
- exit 1
- fi
-
- # Check if the file already exists
- if [ -e "$1" ]; then
- echo "Error: File '$1' already exists."
- open "$1" || exit 1
- exit 1
- fi
-
- # Create the file an empty new line
- printf "\n" > "$1"
- # Use the existing open command to open the created file
- open "$1" || exit 1
-}
-
-main "$@"
diff --git a/tools/cursors_defaults/bin/goto b/tools/cursors_defaults/bin/goto
deleted file mode 100644
index 8a9329ce..00000000
--- a/tools/cursors_defaults/bin/goto
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
-
-main() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local WINDOW=$(_read_env WINDOW)
-
- if [ $# -gt 1 ]; then
- echo "goto allows only one line number at a time."
- exit 1
- fi
- if [ -z "$CURRENT_FILE" ]
- then
- echo "No file open. Use the open command first."
- exit 1
- fi
- if [ -z "$1" ]
- then
- echo "Usage: goto <line>"
- exit 1
- fi
- if ! [[ $1 =~ ^[0-9]+$ ]]
- then
- echo "Usage: goto <line>"
- echo "Error: <line> must be a number"
- exit 1
- fi
- local max_line=$(awk 'END {print NR}' "$CURRENT_FILE")
- if [ $1 -gt $max_line ]
- then
- echo "Error: <line> must be less than or equal to $max_line"
- exit 1
- fi
- local OFFSET=$(jq -n "$WINDOW/6" | jq 'floor')
- _write_env CURRENT_LINE $(jq -n "[$1 + $WINDOW/2 - $OFFSET, 1] | max | floor") || exit 1
- _constrain_line || exit 1
- _print || exit 1
-}
-
-main "$@"
\ No newline at end of file
diff --git a/tools/cursors_defaults/bin/open b/tools/cursors_defaults/bin/open
deleted file mode 100644
index a8b0d198..00000000
--- a/tools/cursors_defaults/bin/open
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
-
-main() {
- local WINDOW=$(_read_env WINDOW)
-
- if [ -z "$1" ]
- then
- echo "Usage: open \"<file>\""
- exit 1
- fi
- if [ -d "$1" ]; then
- echo "Error: $1 is a directory. You can only open files. Use cd or ls to navigate directories."
- exit 1
- elif [ ! -f "$1" ]; then
- echo "File $1 not found"
- exit 1
- fi
-
- # Check if the second argument is provided
- if [ -n "$2" ]; then
- # Check if the provided argument is a valid number
- if ! [[ $2 =~ ^[0-9]+$ ]]; then
- echo "Usage: open \"<file>\" [<line_number>]"
- echo "Error: <line_number> must be a number"
- exit 1
- fi
- local max_line=$(awk 'END {print NR}' "$1")
- if [ $2 -gt $max_line ]; then
- echo "Warning: <line_number> ($2) is greater than the number of lines in the file ($max_line)"
- echo "Warning: Setting <line_number> to $max_line"
- local line_number=$(jq -n "$max_line") # Set line number to max if greater than max
- elif [ $2 -lt 1 ]; then
- echo "Warning: <line_number> ($2) is less than 1"
- echo "Warning: Setting <line_number> to 1"
- local line_number=$(jq -n "1") # Set line number to 1 if less than 1
- else
- local OFFSET=$(jq -n "$WINDOW/6" | jq 'floor')
- local line_number=$(jq -n "[$2 + $WINDOW/2 - $OFFSET, 1] | max | floor")
- fi
- else
- local line_number=$(jq -n "$WINDOW/2") # Set default line number if not provided
- fi
-
- _write_env CURRENT_FILE $(realpath "$1") || exit 1
- _write_env CURRENT_LINE $line_number || exit 1
- _constrain_line || exit 1
- _print || exit 1
-}
-
-main "$@"
diff --git a/tools/cursors_defaults/bin/scroll_down b/tools/cursors_defaults/bin/scroll_down
deleted file mode 100644
index 934a7980..00000000
--- a/tools/cursors_defaults/bin/scroll_down
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
-
-main() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local CURRENT_LINE=$(_read_env CURRENT_LINE)
- local WINDOW=$(_read_env WINDOW)
- local OVERLAP=$(_read_env OVERLAP)
-
- if [ -z "$CURRENT_FILE" ]
- then
- echo "No file open. Use the open command first."
- exit 1
- fi
- _write_env CURRENT_LINE $(jq -n "$CURRENT_LINE + $WINDOW - $OVERLAP") || exit 1
- _constrain_line || exit 1
- _print || exit 1
- _scroll_warning_message || exit 1
-}
-
-main "$@"
diff --git a/tools/cursors_defaults/bin/scroll_up b/tools/cursors_defaults/bin/scroll_up
deleted file mode 100644
index 779d4c35..00000000
--- a/tools/cursors_defaults/bin/scroll_up
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
-
-main() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local CURRENT_LINE=$(_read_env CURRENT_LINE)
- local WINDOW=$(_read_env WINDOW)
- local OVERLAP=$(_read_env OVERLAP)
-
- if [ -z "$CURRENT_FILE" ]
- then
- echo "No file open. Use the open command first."
- exit 1
- fi
- _write_env CURRENT_LINE $(jq -n "$CURRENT_LINE - $WINDOW + $OVERLAP") || exit 1
- _constrain_line || exit 1
- _print || exit 1
- _scroll_warning_message || exit 1
-}
-
-main "$@"
diff --git a/tools/cursors_defaults/config.yaml b/tools/cursors_defaults/config.yaml
deleted file mode 100644
index 2d3cffd2..00000000
--- a/tools/cursors_defaults/config.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-tools:
- goto:
- signature: "goto <line_number>"
- docstring: "moves the window to show <line_number>"
- arguments:
- - name: line_number
- type: integer
- description: "the line number to move the window to"
- required: true
- open:
- signature: "open <path> [<line_number>]"
- docstring: "opens the file at the given path in the editor. If line_number is provided, the window will be centered on that line"
- arguments:
- - name: path
- type: string
- description: "the path to the file to open"
- required: true
- - name: line_number
- type: integer
- description: "the line number to move the window to (if not provided, the window will start at the top of the file)"
- required: false
- create:
- signature: "create <filename>"
- docstring: "creates and opens a new file with the given name"
- arguments:
- - name: filename
- type: string
- description: "the name of the file to create"
- required: true
- scroll_up:
- signature: "scroll_up"
- docstring: "moves the window up {WINDOW} lines"
- arguments: []
- scroll_down:
- signature: "scroll_down"
- docstring: "moves the window down {WINDOW} lines"
- arguments: []
- set_cursors:
- signature: "set_cursors <start_line> <end_line>"
- docstring: "sets the start and end cursors to the given line numbers"
- arguments:
- - name: start_line
- type: integer
- description: "the line number to set the start cursor to"
- required: true
- - name: end_line
- type: integer
- description: "the line number to set the end cursor to"
- required: true
diff --git a/tools/cursors_defaults/install.sh b/tools/cursors_defaults/install.sh
deleted file mode 100644
index 2978db4e..00000000
--- a/tools/cursors_defaults/install.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-source /root/tools/cursors_defaults/lib/utils.sh
-
-# raise error ir any env variables not set
-if [ -z "$WINDOW" ]; then
- echo "Error: WINDOW not set"
- exit 1
-fi
-if [ -z "$OVERLAP" ]; then
- echo "Error: OVERLAP not set"
- exit 1
-fi
-if [ -z "$CURRENT_LINE" ]; then
- echo "Error: CURRENT_LINE not set"
- exit 1
-fi
-if [ -z "$CURRENT_FILE" ]; then
- echo "Error: CURRENT_FILE not set"
- exit 1
-fi
-
-_write_env "WINDOW" "$WINDOW"
-_write_env "OVERLAP" "$OVERLAP"
-_write_env "CURRENT_LINE" "$CURRENT_LINE"
-_write_env "CURRENT_FILE" "$CURRENT_FILE"
diff --git a/tools/cursors_defaults/lib/cursors_defaults_utils.sh b/tools/cursors_defaults/lib/cursors_defaults_utils.sh
deleted file mode 100644
index 5b2e83e3..00000000
--- a/tools/cursors_defaults/lib/cursors_defaults_utils.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env bash
-
-_reset_cursors() {
- _write_env START_CURSOR 1
- _write_env END_CURSOR 1
-}
-
-_constrain_cursors() {
- # constrain the cursors to be within the bounds of the file [0, total_lines+1]
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local CURRENT_LINE=$(_read_env CURRENT_LINE)
- local WINDOW=$(_read_env WINDOW)
- local OVERLAP=$(_read_env OVERLAP)
- local START_CURSOR=$(_read_env START_CURSOR)
- local END_CURSOR=$(_read_env END_CURSOR)
-
- local total_lines=$(awk 'END {print NR}' "$CURRENT_FILE")
- total_lines=$((total_lines < 1 ? 1 : total_lines)) # if the file is empty, set total_lines to 1
- local start_line=$((CURRENT_LINE - WINDOW / 2))
- local end_line=$((CURRENT_LINE + WINDOW / 2))
- start_line=$((start_line < 1 ? 1 : start_line))
- end_line=$((end_line > total_lines ? total_lines : end_line))
- local warning_string=""
- if [ "$START_CURSOR" -lt "$start_line" ]; then
- warning_string+="START_CURSOR moved to $start_line\n"
- START_CURSOR=$start_line
- elif [ "$START_CURSOR" -gt "$end_line" ]; then
- START_CURSOR=$end_line
- warning_string+="START_CURSOR moved to $end_line\n"
- fi
- if [ "$END_CURSOR" -lt "$start_line" ]; then
- warning_string+="END_CURSOR moved to $start_line\n"
- END_CURSOR=$start_line
- elif [ "$END_CURSOR" -gt "$end_line" ]; then
- warning_string+="END_CURSOR moved to $end_line\n"
- END_CURSOR=$end_line
- fi
- echo "$warning_string"
- echo $START_CURSOR $END_CURSOR
- _write_env START_CURSOR $START_CURSOR
- _write_env END_CURSOR $END_CURSOR
-}
-
-_print() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local CURRENT_LINE=$(_read_env CURRENT_LINE)
- local WINDOW=$(_read_env WINDOW)
- local OVERLAP=$(_read_env OVERLAP)
- local START_CURSOR=$(_read_env START_CURSOR)
- local END_CURSOR=$(_read_env END_CURSOR)
-
- local cursor_warning=$(_constrain_cursors)
- local cursor_values=$(echo "$cursor_warning" | tail -n 1)
- cursor_warning=$(echo "$cursor_warning" | head -n -1)
- _write_env START_CURSOR $(echo "$cursor_values" | awk '{print $1}')
- _write_env END_CURSOR $(echo "$cursor_values" | awk '{print $2}')
- local total_lines=$(awk 'END {print NR}' $CURRENT_FILE)
- echo "[File: $(realpath "$CURRENT_FILE") ($total_lines lines total)]"
- local start_line=$((CURRENT_LINE - WINDOW / 2))
- local end_line=$((CURRENT_LINE + WINDOW / 2))
- start_line=$((start_line < 1 ? 1 : start_line))
- end_line=$((end_line > total_lines ? total_lines : end_line))
- local lines=()
- local i=0
- while IFS= read -r line; do
- lines[i++]="$line"
- done < <(awk -v start="$start_line" -v end="$end_line" 'NR>=start && NR<=end {print}' "$CURRENT_FILE")
- local num_lines=${#lines[@]}
- if [ $start_line -gt 1 ]; then
- echo "($((start_line - 1)) more lines above)"
- fi
- for ((i=0; i<num_lines+1; i++)) do
- local line_number=$((start_line + i))
- if [ $line_number -eq $START_CURSOR ]
- then
- echo $START_CURSOR_MARK
- fi
- # if i in [0, num_lines-1] then print the line number and the line
- if [ $i -ge 0 ] && [ $i -lt $num_lines ]
- then
- echo "$line_number:${lines[i]}"
- fi
- if [ $line_number -eq $END_CURSOR ]
- then
- echo $END_CURSOR_MARK
- fi
- done
- lines_below=$((total_lines - start_line - num_lines))
- lines_below=$((lines_below > 0 ? lines_below : 0))
- if [ $lines_below -gt 0 ]; then
- echo "($lines_below more lines below)"
- fi
- if [ -n "$cursor_warning" ]; then
- echo -e "$cursor_warning"
- fi
-}
-
-_constrain_line() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local CURRENT_LINE=$(_read_env CURRENT_LINE)
- local WINDOW=$(_read_env WINDOW)
-
- if [ -z "$CURRENT_FILE" ]
- then
- echo "No file open. Use the open command first."
- return
- fi
- local max_line=$(awk 'END {print NR}' "$CURRENT_FILE")
- local half_window=$((WINDOW / 2))
- # First ensure line number isn't too large (min of current_line and max_line - half_window)
- if ((CURRENT_LINE > max_line - half_window)); then
- CURRENT_LINE=$((max_line - half_window))
- fi
- # Then ensure line number isn't too small (max of current_line and half_window)
- if ((CURRENT_LINE < half_window)); then
- CURRENT_LINE=$((half_window))
- fi
- _write_env CURRENT_LINE $CURRENT_LINE
-}
\ No newline at end of file
diff --git a/tools/cursors_edit_linting/bin/_split_string b/tools/cursors_edit_linting/bin/_split_string
deleted file mode 100644
index b4a4a780..00000000
--- a/tools/cursors_edit_linting/bin/_split_string
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env python3
-
-"""This helper command is used to print flake8 output
-
-Usage:
- python _split_string.py <flake8_output>
- python _split_string.py <flake8_output> <previous_errors> <edit_window_start> <edit_window_end> <n_lines>
-
-Where:
- <flake8_output> is the output of flake8
- <previous_errors> is the previous errors as a string
- <edit_window_start> is the start of the edit window
- <edit_window_end> is the end of the edit window
- <n_lines> is the number of lines added in the edit
-"""
-
-# ruff: noqa: UP007 UP006 UP035
-
-import sys
-from dataclasses import dataclass
-from typing import List, Optional, Tuple
-
-
-@dataclass
-class Flake8Error:
- """A class to represent a single flake8 error"""
-
- filename: str
- line_number: int
- col_number: int
- problem: str
-
- @classmethod
- def from_line(cls, line: str):
- try:
- prefix, _sep, problem = line.partition(": ")
- filename, line_number, col_number = prefix.split(":")
- except (ValueError, IndexError) as e:
- msg = f"Invalid flake8 error line: {line}"
- raise ValueError(msg) from e
- return cls(filename, int(line_number), int(col_number), problem)
-
-
-def _update_previous_errors(
- previous_errors: List[Flake8Error], replacement_window: Tuple[int, int], replacement_n_lines: int
-) -> List[Flake8Error]:
- """Update the line numbers of the previous errors to what they would be after the edit window.
- This is a helper function for `_filter_previous_errors`.
-
- All previous errors that are inside of the edit window should not be ignored,
- so they are removed from the previous errors list.
-
- Args:
- previous_errors: list of errors with old line numbers
- replacement_window: the window of the edit/lines that will be replaced
- replacement_n_lines: the number of lines that will be used to replace the text
-
- Returns:
- list of errors with updated line numbers
- """
- updated = []
- lines_added = replacement_n_lines - (replacement_window[1] - replacement_window[0] + 1)
- for error in previous_errors:
- if error.line_number < replacement_window[0]:
- # no need to adjust the line number
- updated.append(error)
- continue
- if replacement_window[0] <= error.line_number <= replacement_window[1]:
- # The error is within the edit window, so let's not ignore it
- # either way (we wouldn't know how to adjust the line number anyway)
- continue
- # We're out of the edit window, so we need to adjust the line number
- updated.append(Flake8Error(error.filename, error.line_number + lines_added, error.col_number, error.problem))
- return updated
-
-
-def format_flake8_output(
- input_string: str,
- show_line_numbers: bool = False,
- *,
- previous_errors_string: str = "",
- replacement_window: Optional[Tuple[int, int]] = None,
- replacement_n_lines: Optional[int] = None,
-) -> str:
- """Filter flake8 output for previous errors and print it for a given file.
-
- Args:
- input_string: The flake8 output as a string
- show_line_numbers: Whether to show line numbers in the output
- previous_errors_string: The previous errors as a string
- replacement_window: The window of the edit (lines that will be replaced)
- replacement_n_lines: The number of lines used to replace the text
-
- Returns:
- The filtered flake8 output as a string
- """
- errors = [Flake8Error.from_line(line.strip()) for line in input_string.split("\n") if line.strip()]
- lines = []
- if previous_errors_string:
- assert replacement_window is not None
- assert replacement_n_lines is not None
- previous_errors = [
- Flake8Error.from_line(line.strip()) for line in previous_errors_string.split("\n") if line.strip()
- ]
- previous_errors = _update_previous_errors(previous_errors, replacement_window, replacement_n_lines)
- errors = [error for error in errors if error not in previous_errors]
- for error in errors:
- if not show_line_numbers:
- lines.append(f"- {error.problem}")
- else:
- lines.append(f"- {error.line_number}:{error.col_number} {error.problem}")
- return "\n".join(lines)
-
-
-if __name__ == "__main__":
- if len(sys.argv) == 2:
- print(format_flake8_output(sys.argv[1]))
- elif len(sys.argv) == 6:
- window = (int(sys.argv[3]), int(sys.argv[4]))
- n_lines = int(sys.argv[5])
- print(
- format_flake8_output(
- sys.argv[1], previous_errors_string=sys.argv[2], replacement_window=window, replacement_n_lines=n_lines
- )
- )
- else:
- msg = "Invalid number of arguments. Must be 1 or 5."
- raise ValueError(msg)
diff --git a/tools/cursors_edit_linting/bin/edit b/tools/cursors_edit_linting/bin/edit
deleted file mode 100644
index a81cf050..00000000
--- a/tools/cursors_edit_linting/bin/edit
+++ /dev/null
@@ -1,97 +0,0 @@
-source /root/tools/cursors_defaults/lib/utils.sh
-
-main() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- local START_CURSOR=$(_read_env START_CURSOR)
- local END_CURSOR=$(_read_env END_CURSOR)
-
- if [ -z "$CURRENT_FILE" ]
- then
- echo 'No file open. Use the `open` command first.'
- return
- fi
- local start_line=$((START_CURSOR - 1))
- start_line=$((start_line < 0 ? 0 : start_line))
- local end_line=$((END_CURSOR))
- end_line=$((end_line < 0 ? 0 : end_line))
-
- local replacement=()
- while IFS= read -r line
- do
- replacement+=("$line")
- done
-
- local num_lines=${#replacement[@]}
- # Create a backup of the current file
- cp "$CURRENT_FILE" "/root/$(basename "$CURRENT_FILE")_backup"
- # Read the file line by line into an array
- mapfile -t lines < "$CURRENT_FILE"
- local new_lines=("${lines[@]:0:$start_line}" "${replacement[@]}" "${lines[@]:$((end_line))}")
- # Write the new stuff directly back into the original file
- printf "%s\n" "${new_lines[@]}" >| "$CURRENT_FILE"
- # Run linter
- if [[ $CURRENT_FILE == *.py ]]; then
- lint_output=$(flake8 --isolated --select=F821,F822,F831,E111,E112,E113,E999,E902 "$CURRENT_FILE" 2>&1)
- else
- # do nothing
- lint_output=""
- fi
- # if there is no output, then the file is good
- if [ -z "$lint_output" ]; then
- _constrain_line
- # set to START + num_lines - 1, unless num_lines is 0, then set to START
- _write_env END_CURSOR $((num_lines == 0 ? START_CURSOR : START_CURSOR + num_lines - 1))
- _write_env START_CURSOR $START_CURSOR
- _print
- echo "File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary."
- else
- echo "Your proposed edit has introduced new syntax error(s). Please read this error message carefully and then retry editing the file."
- echo ""
- echo "ERRORS:"
- _split_string "$lint_output"
- echo ""
-
- # Save original values
- original_current_line=$CURRENT_LINE
- original_window=$WINDOW
- original_end_cursor=$END_CURSOR
-
- # Update values
- _write_env CURRENT_LINE $(( (num_lines / 2) + start_line )) # Set to "center" of edit
- _write_env WINDOW $((num_lines + 10)) # Show +/- 5 lines around edit
- _write_env END_CURSOR $((num_lines == 0 ? START_CURSOR : START_CURSOR + num_lines - 1))
-
- echo "This is how your edit would have looked if applied"
- echo "-------------------------------------------------"
- _constrain_line
- _print
- echo "-------------------------------------------------"
- echo ""
-
- # Restoring CURRENT_FILE to original contents.
- cp "/root/$(basename "$CURRENT_FILE")_backup" "$CURRENT_FILE"
-
- _write_env CURRENT_LINE=$(( ((end_line - start_line) / 2) + start_line )) # Set to "center" of edit
- _write_env WINDOW=$((end_line - start_line + 10))
- _write_env END_CURSOR=$original_end_cursor
-
- echo "This is the original code before your edit"
- echo "-------------------------------------------------"
- _constrain_line
- _print
- echo "-------------------------------------------------"
-
- # Restore original values
- _write_env CURRENT_LINE $original_current_line
- _write_env WINDOW $original_window
- _write_env END_CURSOR $original_end_cursor
-
- echo "Your changes have NOT been applied. Please fix your edit command and try again."
- echo "You either need to 1) Specify the correct start/end line arguments or 2) Correct your edit code."
- echo "DO NOT re-run the same failed edit command. Running it again will lead to the same error."
- fi
- # Remove backup file
- rm -f "/root/$(basename "$CURRENT_FILE")_backup"
-}
-
-main "$@"
diff --git a/tools/cursors_edit_linting/config.yaml b/tools/cursors_edit_linting/config.yaml
deleted file mode 100644
index 383dc38d..00000000
--- a/tools/cursors_edit_linting/config.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-tools:
- edit:
- signature: |
- edit
- <replacement_text>
- end_of_edit
- docstring: >
- replaces *all* of the text between the START CURSOR and the END CURSOR with the replacement_text. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement_text> will be entered, so make sure your indentation is formatted properly. To enter text at the beginning of the file, set START CURSOR and END CURSOR to 0. Use set_cursors to move the cursors around. Python files will be checked for syntax errors after the edit.
- arguments:
- - name: replacement_text
- type: string
- description: "the text to replace the current selection with"
- required: true
diff --git a/tools/cursors_edit_linting/install.sh b/tools/cursors_edit_linting/install.sh
deleted file mode 100644
index 49ef0fc7..00000000
--- a/tools/cursors_edit_linting/install.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-source /root/tools/cursors_defaults/lib/utils.sh
-
-if [ -z "$WINDOW" ]; then
- echo "Error: WINDOW not set"
- exit 1
-fi
-if [ -z "$OVERLAP" ]; then
- echo "Error: OVERLAP not set"
- exit 1
-fi
-
-_write_env CURRENT_FILE "${CURRENT_FILE:-}"
-_write_env CURRENT_LINE "${CURRENT_LINE:-0}"
-_write_env WINDOW "$WINDOW"
-_write_env OVERLAP "$OVERLAP"
diff --git a/tools/cursors_state/bin/_state b/tools/cursors_state/bin/_state
deleted file mode 100644
index fc68aa83..00000000
--- a/tools/cursors_state/bin/_state
+++ /dev/null
@@ -1,12 +0,0 @@
-source /root/tools/cursors_defaults/lib/utils.sh
-
-main() {
- local CURRENT_FILE=$(_read_env CURRENT_FILE)
- if [ -z "$CURRENT_FILE" ]; then
- echo '{"open_file": "n/a", "working_dir": "'$PWD'"}';
- else
- echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$PWD'"}';
- fi
-}
-
-main "$@"
\ No newline at end of file
diff --git a/tools/cursors_state/config.yaml b/tools/cursors_state/config.yaml
deleted file mode 100644
index a2fa2036..00000000
--- a/tools/cursors_state/config.yaml
+++ /dev/null
@@ -1 +0,0 @@
-tools: {}
\ No newline at end of file