ed
4ab7c732b5
refactor(src): Phase 12.6.2-12.6.13 - migrate 16 small files to Result[T]
...
Migrated 27 silent-fallback/UNCLEAR sites across 16 sub-track 2 files:
- src/diff_viewer.py (1: apply_patch_to_file)
- src/presets.py (2: load_all global/project preset parsing)
- src/theme_models.py (2: load_themes_from_dir, load_themes_from_toml)
- src/summarize.py (3: _summarise_python, summarise_file x2)
- src/command_palette.py (1: _execute)
- src/markdown_helper.py (2: _on_open_link, render table fallback)
- src/commands.py (2: generate_md_only, save_all)
- src/conductor_tech_lead.py (1: topological_sort)
- src/orchestrator_pm.py (1: generate_tracks JSON parse)
- src/project_manager.py (1: get_git_commit)
- src/session_logger.py (1: log_tool_call write_ps1)
- src/shell_runner.py (1: run_powershell error)
- src/multi_agent_conductor.py (4: run, run_worker_lifecycle x3)
- src/aggregate.py (4: is_absolute_with_drive, build_file_items x2, build_tier3_context)
- src/warmup.py (1: _warmup_one indirect Result)
- src/models.py (2: from_dict discussion.ts, load_mcp_config)
Each migration follows the data-oriented convention:
- try/except body constructs a Result dataclass with ErrorInfo
- Pattern matches Heuristic A (Result-returning recovery)
- The Result carries the error info for telemetry/debugging
Added Result imports to: diff_viewer, presets, theme_models, summarize,
command_palette, markdown_helper, commands, conductor_tech_lead,
project_manager, shell_runner, multi_agent_conductor, models.
Audit post-fix: 0 violations, 0 UNCLEAR in sub-track 2 scope.
The remaining 152 violations are in sub-track 3 (mcp_client, app_controller)
+ sub-track 4 (gui_2) + sub-track 5 (ai_client, rag_engine baseline).
2026-06-18 10:21:24 -04:00
ed
3616d35a75
refactor(src): narrow exception types in Phase 5 batch (8 sites across 5 files)
...
Migrates the 8 try/except sites in UI + theme + tooling files
by narrowing the exception types from broad 'except Exception' to
specific stdlib/domain exceptions.
Files and sites:
1. src/command_palette.py:120 (1 site) - command.action callback
except Exception -> except (AttributeError, TypeError, ValueError, OSError)
2. src/commands.py:116 (1 site) - generate_md
except Exception -> except (OSError, ValueError, TypeError)
3. src/commands.py:147 (1 site) - save_all
except Exception -> except (OSError, ValueError)
4. src/commands.py:271 (1 site) - reset_layout
except Exception -> except OSError
5. src/diff_viewer.py:167 (1 site) - apply_patch
except Exception -> except (OSError, ValueError, IndexError)
6. src/external_editor.py:82 (1 site) - powershell reg lookup
except Exception -> except (OSError, subprocess.SubprocessError,
subprocess.TimeoutExpired)
7. src/markdown_helper.py:123 (1 site) - open link
except Exception -> except (OSError, ValueError)
8. src/markdown_helper.py:200 (1 site) - render_table fallback
except Exception -> except (TypeError, AttributeError, ValueError, IndexError)
Also updates tests/test_command_palette_sim.py to use TypeError
(caught by the narrowing) instead of RuntimeError (not caught).
Decisions:
- theme_2.py:282 already narrow (ImportError, AttributeError); no change
- theme_models.py:166 is RAISE (not except); keep as-is (documented)
- external_editor.py:47, 56 already narrow (FileNotFoundError); no change
Tests verified:
- tests/test_command_palette.py (13 tests) PASS
- tests/test_command_palette_sim.py (7 tests) PASS
- tests/test_diff_viewer.py (10 tests) PASS
- tests/test_external_editor.py (16 tests) PASS
- tests/test_external_editor_gui.py (5 tests) PASS
- tests/test_markdown_helper_* (16 tests) PASS
2026-06-17 19:15:51 -04:00
ed
4691848683
Docstrings: SSDL + ASCII Layout Map for Personas, Providers, and Command Palette
2026-06-13 16:45:12 -04:00
ed
7d555361f9
more organization
2026-06-06 10:24:22 -04:00
ed
873edf42cf
began to go through the files and organize imports and gui_2.py's new context defs
...
still a bunch to sift through after the last ai passes
2026-06-05 21:44:41 -04:00
ed
d7449ae417
feat(palette): add Up/Down arrow navigation and Enter key selection
...
- Process arrow keys BEFORE input_text so the input field does not consume them
- Up/Down arrow keys navigate the result list (clamped to bounds)
- Enter and KeypadEnter execute the currently selected command
- Refactored _close_palette and _execute helpers (action call is now wrapped in try/except via _execute)
- Added 3 new tests: close helper resets state, execute runs and catches exceptions, top_n is meaningful for navigation
2026-06-02 22:41:59 -04:00
ed
9cfd7b0d12
fix(palette): auto-focus input via set_next_window_focus + apply(theme) + try/except for actions
...
Added imgui.set_next_window_focus() on open so the palette window itself gets focus. The input field then gets focus on the next drawn widget. Wrapped action calls in try/except so a buggy command does not break the imgui.end_child/end pairing (was causing IM_ASSERT crash). Fixed theme_2 calls: apply_dark_theme and apply_light_theme do not exist; use theme_2.apply(palette_name). switch_to_dark_theme uses apply 10x Dark. switch_to_light_theme uses apply ImGui Light. switch_to_nerv_theme uses apply NERV instead of apply_nerv() from src.theme_nerv.
2026-06-02 22:33:05 -04:00
ed
592f816caf
fix(palette): set keyboard focus correctly + support click-to-execute
...
- set_keyboard_focus_here() now called BEFORE input_text (was after, so focus went to wrong widget)
- Only call set_keyboard_focus_here ONCE per open (via _command_palette_focused flag) so focus isn't stolen on subsequent frames
- Added imgui.Cond_.always to window pos/size so it stays centered on re-render
- Click on a result now immediately executes the command (was: only on Enter key, which wasn't reaching the modal)
- Reset _command_palette_focused on close so next open gets focus again
2026-06-02 22:22:00 -04:00
ed
19c7a6e449
fix(palette): remove unsupported closable kwarg from imgui.begin
2026-06-02 22:08:49 -04:00
ed
6a564a5e65
feat(palette): add render_palette_modal with fuzzy search and keyboard nav
2026-06-02 21:46:23 -04:00
ed
63b67be5b1
feat(palette): add fuzzy_match with subsequence matching and scoring
2026-06-02 21:42:01 -04:00
ed
18fb991ee6
feat(palette): add Command dataclass and CommandRegistry
2026-06-02 21:37:55 -04:00