diff --git a/.gitignore b/.gitignore index e838a2c..66d10ea 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ @@ -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-* \ No newline at end of file diff --git a/CODE_CHANGES_FOR_SPECS.md b/CODE_CHANGES_FOR_SPECS.md new file mode 100644 index 0000000..34d9b2f --- /dev/null +++ b/CODE_CHANGES_FOR_SPECS.md @@ -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 \ No newline at end of file