Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
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
54 changes: 33 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
# Python files
__pycache__/
*.py[cod]
*$py.class

# Virtual environment
# Virtual environments
.venv
venv/
env/

# Poetry
# Package managers
poetry.lock
.python-version

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Dependency directories
.uv/

# Unit test / coverage reports
htmlcov/
Expand All @@ -33,10 +22,33 @@ htmlcov/
.coverage
.coverage.*
.cache
.pytest_cache/

# Environment variables
.env

# Generated files
output
logs
output/
logs/
test_output/
*_output/
output_test/
overleaf_output/
O/

# OS files
.DS_Store
Thumbs.db
.directory

# Temporary/backup files
*.swp
*.swo
*.bak
*~
.*.swp

# Local configuration
.idea/
.vscode/
*.sublime-*
76 changes: 76 additions & 0 deletions CODE_CHANGES_FOR_SPECS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Code Changes to Implement in Specs/Docs

## Addressing Repository Supervisor Feedback

As per the repository supervisor's feedback:

> "I cannot accept the changes to main.py and write_files.py because they are code-only changes and will be blown away the next time the code is generated. We need to have these changes captured and implemented as a spec/doc improvements that drive the generation of this code and there is a recipe to be written to assist in that in a desirable way."

This document captures the desired code changes that should be implemented through specs/docs rather than direct code modifications. Instead of modifying the generated code files directly, these improvements should be implemented by:

1. Updating the corresponding specs to include requirements for robust path handling
2. Enhancing the docs to document the expected path handling behavior
3. Ensuring the recipes that generate these files produce code with the desired functionality

This approach ensures changes persist through code regeneration cycles.

## Path Handling Improvements

### Changes needed in main.py:
1. Add support for tilde (~) expansion in file paths:
```python
# First expand any user path with tilde (~)
input_dir = os.path.expanduser(args["input_dir"])
```

2. Handle absolute vs. relative paths correctly:
```python
# If it's an absolute path, use it directly
# Otherwise, make it absolute relative to current directory
if not os.path.isabs(input_dir):
input_dir = os.path.abspath(input_dir)
```

### Changes needed in write_files.py:
1. Add path duplication prevention:
```python
# Check if the path is already absolute
if os.path.isabs(rel_path):
full_path = rel_path
else:
# Check if rel_path already contains the output directory name to avoid duplication
output_dir_name = os.path.basename(output_root)
path_parts = rel_path.split(os.path.sep)

if path_parts and path_parts[0] == output_dir_name:
# If the path already starts with the output directory name, avoid duplication
self.logger.info(f"Avoiding path duplication for {rel_path}")
# Remove the duplicated directory from the path
rel_path = os.path.sep.join(path_parts[1:]) if len(path_parts) > 1 else ""
```

2. Add special handling for recipe_executor paths:
```python
# Check if the output path includes a recipe_executor path segment
if 'recipe_executor' in rel_path:
# This is a special case where we want to preserve the recipe_executor folder structure
self.logger.info(f"Preserving recipe_executor path structure for {rel_path}")
# No changes needed
pass
```

## Implementation Strategy

These changes should be implemented in:

1. **Specs**: Update the component specs to include requirements for robust path handling
2. **Docs**: Update component docs to describe the path handling capabilities
3. **Recipe**: Create a recipe to make these improvements to the code that will be regenerated

## Testing Strategy

The changes should be tested with:
- Relative paths (`output`, `./output`)
- Absolute paths (`/Users/name/project/output`)
- Home directory paths (`~/project/output`)
- Paths that might cause duplication issues