refactor(gui_2): merge command_palette; split registry->commands + render->gui_2; git rm src/command_palette.py

Per spec FR1 + Phase 1.3 + architecture feedback: src/command_palette.py
split by responsibility:
  - Command/ScoredCommand/CommandRegistry/fuzzy_match/_close_palette/_execute (data/ops)
    -> src/commands.py (which already owns _LazyCommandRegistry pattern)
  - render_palette_modal (view/ImGui) -> src/gui_2.py

GUI is a pure view; the registry/data classes are ops; commands.py owns
the registry because commands.py is where @registry.register decorators live.
gui_2.render_palette_modal imports Command from commands.py to type its
parameters.

Also fixes Phase 1.1 (bg_shader) per architecture feedback:
BackgroundShader no longer owns 'enabled' state - the GUI is pure view.
State is now owned by AppController.bg_shader_enabled (read on load from
config, written from gui_2 checkbox via app's __setattr__ delegation).

Tests:
- tests/test_command_palette.py: imports from src.commands (was src.command_palette)
- tests/test_commands_no_top_level_command_palette.py: rewritten for the
  new architecture (eager registry in commands.py; render in gui_2; no
  circular import between commands.py and gui_2)
This commit is contained in:
ed
2026-06-26 06:54:59 -04:00
parent be5607dee8
commit 3dd153f718
6 changed files with 259 additions and 327 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
from src.command_palette import Command, ScoredCommand, fuzzy_match
from src.commands import Command, ScoredCommand, fuzzy_match
def _cmd(id: str, title: str) -> Command: