Spaces:
Sleeping
Sleeping
| # Scripts Directory | |
| This directory contains organized scripts for various development, deployment, and maintenance tasks. | |
| ## Directory Structure | |
| ### `utilities/` | |
| Development and maintenance utility scripts: | |
| - **`backup_and_analyze.py`** - Creates timestamped backups and analyzes codebase structure | |
| - **`view_analysis.py`** - Views and filters analysis results | |
| - **`cleanup_cache.py`** - Removes Python cache files and temporary artifacts | |
| - **`validate_gitignore.py`** - Validates and updates .gitignore rules | |
| - **`archive_migration_files.py`** - Archives completed migration files | |
| ### `deployment/` | |
| Deployment and production setup scripts: | |
| - **`create_user_indexes.py`** - Creates necessary database indexes for user authentication | |
| - **`start.sh`** - Application startup script for deployment environments | |
| ### `maintenance/` | |
| Ongoing maintenance and analysis scripts: | |
| - **`run_analysis.sh`** - Wrapper script for running backup and analysis processes | |
| ## Usage | |
| ### Running Full Analysis | |
| ```bash | |
| # Run complete backup and analysis | |
| ./scripts/maintenance/run_analysis.sh | |
| # Or run directly with Python | |
| python3 scripts/utilities/backup_and_analyze.py | |
| ``` | |
| ### Viewing Results | |
| ```bash | |
| # Show analysis summary | |
| python3 scripts/utilities/view_analysis.py summary | |
| # Show files of specific type | |
| python3 scripts/utilities/view_analysis.py type migration | |
| python3 scripts/utilities/view_analysis.py type python_cache | |
| # Show files with specific suggested action | |
| python3 scripts/utilities/view_analysis.py action archive | |
| python3 scripts/utilities/view_analysis.py action delete | |
| # Show dependency information | |
| python3 scripts/utilities/view_analysis.py deps | |
| python3 scripts/utilities/view_analysis.py deps app.py | |
| ``` | |
| ## File Types Detected | |
| - **python_source**: Regular Python source files | |
| - **python_test**: Python test files (test_*.py, *_test.py) | |
| - **python_cache**: Cache files (__pycache__, *.pyc) | |
| - **documentation**: Markdown, text, and documentation files | |
| - **configuration**: JSON, YAML, config files | |
| - **migration**: Migration and rollback scripts | |
| - **backup**: Backup files | |
| - **deployment**: Deployment-related files | |
| - **data**: Database and data files | |
| - **unknown**: Unrecognized file types | |
| ## Suggested Actions | |
| - **keep**: File should be retained as-is | |
| - **move**: File should be moved to different location | |
| - **archive**: File should be moved to archive directory | |
| - **delete**: File can be safely deleted | |
| - **consolidate**: File may be redundant and should be merged | |
| - **rename**: File should be renamed for consistency | |
| ## Output Files | |
| - **`analysis_report.json`**: Complete analysis results in JSON format | |
| - **`backups/codebase_backup_YYYYMMDD_HHMMSS/`**: Timestamped backup directory | |
| - **`backups/codebase_backup_YYYYMMDD_HHMMSS/backup_manifest.json`**: Backup metadata | |
| ## Requirements Addressed | |
| This infrastructure addresses the following requirements from the codebase cleanup specification: | |
| - **Requirement 1.1**: Clean and organized codebase structure analysis | |
| - **Requirement 1.2**: File organization and Python project conventions analysis | |
| ## Safety Features | |
| - **Automatic backups**: Complete codebase backup before any analysis | |
| - **Exclusion patterns**: Excludes virtual environments, git, and cache directories from backup | |
| - **Dependency tracking**: Maps import relationships to prevent breaking changes | |
| - **Rollback capability**: Backup manifest enables easy restoration if needed |