diff --git a/src/strands_tools/editor.py b/src/strands_tools/editor.py index a70f86da..1f131241 100644 --- a/src/strands_tools/editor.py +++ b/src/strands_tools/editor.py @@ -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") @@ -805,3 +805,4 @@ def editor( "status": "error", "content": [{"text": f"Error: {str(e)}"}], } + diff --git a/src/strands_tools/file_read.py b/src/strands_tools/file_read.py index 094b5438..bb7fa8f0 100644 --- a/src/strands_tools/file_read.py +++ b/src/strands_tools/file_read.py @@ -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( diff --git a/src/strands_tools/generate_image.py b/src/strands_tools/generate_image.py index c9f50385..1bc926d4 100644 --- a/src/strands_tools/generate_image.py +++ b/src/strands_tools/generate_image.py @@ -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: