# Track Specification: Codebase Migration to `src` & Cleanup (codebase_migration_20260302) ## Overview This track focuses on restructuring the codebase to alleviate clutter by moving the main implementation files from the project root into a dedicated `src/` directory. Additionally, files that are completely unused by the current implementation will be automatically identified and removed. A new clean entry point (`sloppy.py`) will be created in the root directory. ## Functional Requirements - **Directory Restructuring**: - Move all active Python implementation files (e.g., `gui_2.py`, `ai_client.py`, `mcp_client.py`, `shell_runner.py`, `project_manager.py`, `events.py`, etc.) into a new `src/` directory. - Update internal imports within all moved files to reflect their new locations or ensure the Python path resolves them correctly. - **Root Directory Retention**: - Keep configuration files (e.g., `config.toml`, `pyproject.toml`, `requirements.txt`, `.gitignore`) in the project root. - Keep documentation files and directories (e.g., `Readme.md`, `BUILD.md`, `docs/`) in the project root. - Keep the `tests/` and `simulation/` directories at the root level. - **New Entry Point**: - Create a new file `sloppy.py` in the root directory. - `sloppy.py` will serve as the primary entry point to launch the application (jumpstarting the underlying `gui_2.py` logic which will be moved into `src/`). - **Dead Code/File Removal**: - Automatically identify completely unused files and scripts in the project root (e.g., legacy files, unreferenced tools). - Delete the identified unused files to clean up the repository. ## Non-Functional Requirements - Ensure all automated tests (`tests/`) and simulations (`simulation/`) continue to function perfectly without `ModuleNotFoundError`s. - `sloppy.py` must support existing CLI arguments (e.g., `--enable-test-hooks`). ## Acceptance Criteria - [ ] A `src/` directory exists and contains the main application logic. - [ ] The root directory is clean, containing mainly configs, docs, `tests/`, `simulation/`, and `sloppy.py`. - [ ] `sloppy.py` successfully launches the application. - [ ] The full test suite runs and passes (i.e. all imports are correctly resolved). - [ ] Obsolete/unused files have been successfully deleted from the repository. ## Out of Scope - Complete refactoring of `gui_2.py` into a fully modular system (this track only moves it, though preparing it for future non-monolithic structure is conceptually aligned).