Skip to content

The agent that turns websites into APIs!

fix: address pr coments

kalil032134b31a46c0a8
diff --git a/src/reverse_api/base_engineer.py b/src/reverse_api/base_engineer.py
index 2e5063b..08dba71 100644
--- a/src/reverse_api/base_engineer.py
+++ b/src/reverse_api/base_engineer.py
@@ -51,7 +51,7 @@ class BaseEngineer(ABC):
# Handle existing folder - append suffix if needed
counter = 2
- while local_dir.exists():
+ while local_dir.exists() and counter < 1000:
folder_name = f"{base_name}_{counter}"
local_dir = Path.cwd() / "scripts" / folder_name
counter += 1
@@ -196,8 +196,10 @@ After testing, provide your final response with:
Your final output should confirm that the files have been created and provide a brief summary of what was accomplished. Do not include the full code in your response - just confirm the files were saved and summarize the key findings.
"""
if self.additional_instructions:
- base_prompt += f"\n\nAdditional instructions:\n{self.additional_instructions}"
-
+ base_prompt += (
+ f"\n\nAdditional instructions:\n{self.additional_instructions}"
+ )
+
return base_prompt
@abstractmethod
diff --git a/src/reverse_api/sync.py b/src/reverse_api/sync.py
index 769f0da..f6a25a8 100644
--- a/src/reverse_api/sync.py
+++ b/src/reverse_api/sync.py
@@ -85,7 +85,8 @@ class SyncHandler(FileSystemEventHandler):
# Copy to destination
dest.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source, dest)
- self.file_count += 1
+ if dest.exists():
+ self.file_count += 1
# Update last sync time
self.last_sync_time = time.time()
@@ -187,4 +188,4 @@ def sync_directory_once(source_dir: Path, dest_dir: Path):
relative = item.relative_to(source_dir)
dest = dest_dir / relative
dest.parent.mkdir(parents=True, exist_ok=True)
- shutil.copy2(item, dest)
\ No newline at end of file
+ shutil.copy2(item, dest)