From 760ea38fed35ed12b431faa538f4ed6269a1c174 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 17 Aug 2024 12:40:32 +0800 Subject: refactor: improve `fs_*` (#99) improve `_guard_path` to use `realpath -m ` to get absolute path --- agents/coder/tools.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'agents') diff --git a/agents/coder/tools.sh b/agents/coder/tools.sh index 15a3208..0001c46 100755 --- a/agents/coder/tools.sh +++ b/agents/coder/tools.sh @@ -6,6 +6,7 @@ set -e # @option --contents! The contents of the file fs_create() { _guard_path "$argc_path" Create + mkdir -p "$(dirname "$argc_path")" printf "%s" "$argc_contents" > "$argc_path" echo "File created: $argc_path" >> "$LLM_OUTPUT" } @@ -44,7 +45,7 @@ fs_edit() { } _guard_path() { - path="$(realpath "$1")" + path="$(realpath -m "$1")" action="$2" if [[ ! "$path" == "$(pwd)"* ]]; then if [ -t 1 ]; then -- cgit v1.2.3