# Specification: GUI 2.py Cleanup & Structural Awareness ## Overview This track focuses on a comprehensive cleanup of `src/gui_2.py`, deriving best practices for maintaining the Python codebase, and updating the relevant guidelines. It also includes enhancing the MCP tools to better understand Python structural conventions such as annotations. ## Functional Requirements 1. **`gui_2.py` Cleanup**: - Reorganize the `__init__` method and object state. - Improve type hints and annotations throughout the file. - Refactor layout and rendering logic for better readability. - Improve general code structure and maintainability. 2. **Guidelines Update**: - Analyze the cleanup process to derive best practices. - Update `conductor/product-guidelines.md` with high-level maintenance strategies. - Update `conductor/code_styleguides/python.md` with specific coding conventions discovered during the cleanup. 3. **MCP Tools Enhancements**: - Improve parsing of Python type annotations. - Enhance the extraction of class and method outlines. - Add support for recognizing specific ImGui/Dear PyGui patterns to improve structural awareness. ## Non-Functional Requirements - Ensure changes do not break existing functionality or introduce regressions. - Maintain the "1-space indentation" rule as strictly defined in the Python code styleguide. - All refactoring should aim to reduce token consumption when analyzing the file with AI. ## Acceptance Criteria - `gui_2.py` is successfully refactored, specifically focusing on `__init__` declarations and type hints. - Both `conductor/product-guidelines.md` and `conductor/code_styleguides/python.md` are updated with the newly derived insights. - MCP tools (e.g., `py_get_skeleton`, `py_get_code_outline`) exhibit improved awareness of annotations and GUI patterns. - Automated tests pass and manual GUI verification confirms no regressions. ## Out of Scope - Major architectural changes to the underlying `AppController` or DAG Engine logic. - Rewriting `gui_2.py` in a different UI framework.