Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/strands_tools/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def editor(
console = console_util.create()

try:
path = os.path.expanduser(path)
path = os.path.abspath(os.path.expanduser(path))

if not command:
raise ValueError("Command is required")
Expand Down Expand Up @@ -805,3 +805,4 @@ def editor(
"status": "error",
"content": [{"text": f"Error: {str(e)}"}],
}

2 changes: 2 additions & 0 deletions src/strands_tools/file_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ def find_files(console: Console, pattern: str, recursive: bool = True) -> List[s

try:
matching_files = glob.glob(pattern, recursive=recursive)
# Filter out files in hidden directories
matching_files = [f for f in matching_files if not any(part.startswith(".") for part in f.split(os.sep))]
return sorted(matching_files)
except Exception as e:
console.print(
Expand Down
5 changes: 3 additions & 2 deletions src/strands_tools/generate_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
os.makedirs(output_dir)

i = 1
base_image_path = os.path.join(output_dir, f"{filename}.png")
ext = "jpg" if output_format == "jpeg" else output_format
base_image_path = os.path.join(output_dir, f"{filename}.{ext}")
image_path = base_image_path
while os.path.exists(image_path):
image_path = os.path.join(output_dir, f"{filename}_{i}.png")
image_path = os.path.join(output_dir, f"{filename}_{i}.{ext}")
i += 1

with open(image_path, "wb") as file:
Expand Down
Loading