diff --git a/conductor/tracks.md b/conductor/tracks.md index 0a22fd2..4e9ac10 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -9,6 +9,9 @@ This file tracks all major tracks for the project. Each track has its own detail - [ ] **Track: Test Suite Stabilization & Consolidation** *Link: [./tracks/test_stabilization_20260302/](./tracks/test_stabilization_20260302/)* +- [ ] **Track: Codebase Migration to `src` & Cleanup** +*Link: [./tracks/codebase_migration_20260302/](./tracks/codebase_migration_20260302/)* + --- ## Completed / Archived diff --git a/conductor/tracks/codebase_migration_20260302/index.md b/conductor/tracks/codebase_migration_20260302/index.md new file mode 100644 index 0000000..aee7843 --- /dev/null +++ b/conductor/tracks/codebase_migration_20260302/index.md @@ -0,0 +1,5 @@ +# Track codebase_migration_20260302 Context + +- [Specification](./spec.md) +- [Implementation Plan](./plan.md) +- [Metadata](./metadata.json) \ No newline at end of file diff --git a/conductor/tracks/codebase_migration_20260302/metadata.json b/conductor/tracks/codebase_migration_20260302/metadata.json new file mode 100644 index 0000000..627cf32 --- /dev/null +++ b/conductor/tracks/codebase_migration_20260302/metadata.json @@ -0,0 +1,8 @@ +{ + "track_id": "codebase_migration_20260302", + "type": "chore", + "status": "new", + "created_at": "2026-03-02T22:28:00Z", + "updated_at": "2026-03-02T22:28:00Z", + "description": "Move the codebase from the main directory to a src directory. Alleviate clutter by doing so. Remove files that are not used at all by the current application's implementation." +} diff --git a/conductor/tracks/codebase_migration_20260302/plan.md b/conductor/tracks/codebase_migration_20260302/plan.md new file mode 100644 index 0000000..be4ca0f --- /dev/null +++ b/conductor/tracks/codebase_migration_20260302/plan.md @@ -0,0 +1,54 @@ +# Implementation Plan: Codebase Migration to `src` & Cleanup (codebase_migration_20260302) + +## Phase 1: Unused File Identification & Removal +- [ ] Task: Initialize MMA Environment `activate_skill mma-orchestrator` +- [ ] Task: Audit Codebase for Dead Files + - [ ] WHERE: Project root + - [ ] WHAT: Run `py_find_usages` or grep on suspected unused files to verify they are not referenced by `gui_2.py`, `tests/`, `simulation/`, or core config files. + - [ ] HOW: Gather a list of unused files. + - [ ] SAFETY: Do not delete files referenced in `.toml` files or Github action workflows. +- [ ] Task: Delete Unused Files + - [ ] WHERE: Project root + - [ ] WHAT: Use `run_powershell` with `Remove-Item` to delete the identified unused files. + - [ ] HOW: Explicitly list and delete them. + - [ ] SAFETY: Stage deletions to Git carefully. +- [ ] Task: Conductor - User Manual Verification 'Phase 1: Unused File Identification & Removal' (Protocol in workflow.md) + +## Phase 2: Directory Restructuring & Migration +- [ ] Task: Create `src/` Directory + - [ ] WHERE: Project root + - [ ] WHAT: Create the `src/` directory. Add an empty `__init__.py` to make it a package. + - [ ] HOW: `New-Item -ItemType Directory src; New-Item src/__init__.py`. + - [ ] SAFETY: None. +- [ ] Task: Move Application Files to `src/` + - [ ] WHERE: Project root + - [ ] WHAT: Move core `.py` files (`gui_2.py`, `ai_client.py`, `mcp_client.py`, `shell_runner.py`, `project_manager.py`, `events.py`, etc.) into `src/`. + - [ ] HOW: Use `git mv` via `run_powershell` or standard `Move-Item`. + - [ ] SAFETY: Preserve git history of these files. +- [ ] Task: Conductor - User Manual Verification 'Phase 2: Directory Restructuring & Migration' (Protocol in workflow.md) + +## Phase 3: Entry Point & Import Resolution +- [ ] Task: Create `sloppy.py` Entry Point + - [ ] WHERE: Project root (`sloppy.py`) + - [ ] WHAT: Create the script to act as the primary launch point. It should import `App` from `src.gui_2` and pass CLI args. + - [ ] HOW: Write a standard Python script wrapper. + - [ ] SAFETY: Ensure it correctly propagates `sys.argv`. +- [ ] Task: Resolve Absolute and Relative Imports + - [ ] WHERE: `src/*.py`, `tests/*.py`, `simulation/*.py` + - [ ] WHAT: Update import statements. E.g., `import gui_2` becomes `from src import gui_2` or adjust `sys.path.append` in tests. + - [ ] HOW: Surgical string replacements. Ensure `pytest` can still find fixtures and test modules. + - [ ] SAFETY: Run `uv run pytest` to aggressively check for `ModuleNotFoundError`s. +- [ ] Task: Conductor - User Manual Verification 'Phase 3: Entry Point & Import Resolution' (Protocol in workflow.md) + +## Phase 4: Final Validation & Documentation +- [ ] Task: Full Test Suite Validation + - [ ] WHERE: Project root + - [ ] WHAT: Run `uv run pytest`. Fix any remaining path resolution issues for logs, artifacts, and configs. + - [ ] HOW: Verify 100% pass rate. + - [ ] SAFETY: Artifacts must still be written to `tests/artifacts/`. +- [ ] Task: Update Core Documentation + - [ ] WHERE: `Readme.md`, `docs/`, `conductor/tech-stack.md` + - [ ] WHAT: Document `sloppy.py` as the new entry point. Document the `src/` directory layout. + - [ ] HOW: Surgical text replacement. + - [ ] SAFETY: Accurate representation of new structure. +- [ ] Task: Conductor - User Manual Verification 'Phase 4: Final Validation & Documentation' (Protocol in workflow.md) \ No newline at end of file diff --git a/conductor/tracks/codebase_migration_20260302/spec.md b/conductor/tracks/codebase_migration_20260302/spec.md new file mode 100644 index 0000000..a3eac3a --- /dev/null +++ b/conductor/tracks/codebase_migration_20260302/spec.md @@ -0,0 +1,33 @@ +# 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). \ No newline at end of file