Commit Graph

18 Commits

Author SHA1 Message Date
a3aa2a7608 fix(console): arrow keys and layout in modern renderer
Two bugs fixed:

1. Arrow keys detected as ESC: sys.stdin.read(1) uses Python's internal
   buffer, so after reading ESC byte, the remaining escape sequence
   bytes ([A for up-arrow) were in Python's buffer but not visible to
   select.select() on the OS fd. Switched to os.read(fd, 1) which
   reads directly from the file descriptor, bypassing Python's buffer.

2. Footer positioned wrong: draw_footer() counted buffer items to
   calculate padding, but a Rich Table renders as multiple lines.
   Added _line_count tracker with _add_line() and _add_lines(n) so
   footer padding is calculated from actual rendered line count.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:29:32 +00:00
8c7caf3969 fix(console): rewrite modern renderer with buffered output
Major issues fixed:
- Rich printed directly to stdout causing visible flicker on every redraw
- get_key() toggled raw mode per keypress causing glitches and slowness
- No alternate screen buffer — output contaminated terminal scrollback

Rewrite approach:
- Use alternate screen buffer (ESC[?1049h) for clean enter/exit
- Persistent raw mode for entire session instead of per-keypress toggle
- Buffer all Rich renderables during render cycle, flush once in refresh()
- Render to StringIO then write entire frame in single sys.stdout.write()
- Reduced ESC sequence timeout from 50ms to 20ms for snappier response

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:25:35 +00:00
f5e0525dfc perf(console): reduce ESC key delay from 1000ms to 25ms
Curses waits up to 1 second after ESC to distinguish it from escape
sequences (arrow keys, F-keys). Set ESCDELAY=25 before curses.initscr()
so ESC responds near-instantly while still handling escape sequences.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:22:01 +00:00
274cf30e79 perf(console): persistent DB connection, query cache, PRAGMA tuning
- Reuse a single SQLite connection instead of open/close per query
- Add in-memory cache for frequently accessed data (brands, models,
  categories) — 1000x faster on repeated access
- Enable WAL journal mode, 8MB cache, 64MB mmap for faster reads
- Cache terminal size per render cycle to avoid repeated getmaxyx()
- Close DB connection on app exit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:19:50 +00:00
5444cf660a fix(console): deduplicate models and engines in vehicle navigation
Models and engines tables have many duplicate names (e.g. 24 ASTRA rows,
210 F-150 rows, 398 "5.7L 350CID V8" rows). Changed get_models() and
get_engines() to use GROUP BY UPPER(name) instead of DISTINCT on id+name
so each model/engine appears only once in the navigation lists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:12:36 +00:00
4af3a09b03 docs: add console system documentation and design docs
Console README with usage instructions, keybindings reference, architecture
overview, and test commands. Updated root README with console section, updated
architecture diagram, and installation instructions. Includes approved design
doc and implementation plan.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:03:22 +00:00
64503ca363 feat(console): add integration tests and polish error handling
Add MockRenderer-based integration tests that verify the full screen-to-
renderer pipeline without a real terminal. Update main.py with proper
--db flag handling, database existence check, startup banner, and
graceful error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:59:08 +00:00
7bf50a2c67 feat(console): add Rich-based modern renderer
Implement TextualRenderer in console/renderers/textual_renderer.py using
the Rich library for a modern dark-themed TUI with blue/cyan accents.
All 18 BaseRenderer methods are implemented: lifecycle (init_screen,
cleanup), primitives (clear, refresh, get_key, get_size), widgets
(draw_header, draw_footer, draw_menu, draw_table, draw_detail,
draw_form, draw_filter_list, draw_comparison, draw_text, draw_box),
and dialogs (show_message, show_input). Keyboard input uses raw
terminal mode via tty/termios with full escape sequence decoding
for arrow keys, F-keys, Page Up/Down, Home/End.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:57:25 +00:00
8194167c51 feat(console): add admin CRUD screens for parts, manufacturers, crossref, import
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:53:36 +00:00
15f3c9c9fe feat(console): add part detail and comparator screens
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:52:46 +00:00
b042853408 feat(console): add catalog, search, and VIN decoder screens
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:49:15 +00:00
69fb26723d feat(console): add vehicle drill-down navigation screen
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:47:23 +00:00
e3ad101d56 feat(console): add app controller, main menu and statistics screen
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:45:03 +00:00
269bb9030b feat(console): add curses VT220 renderer with full widget set
Implements BaseRenderer abstract interface and CursesRenderer with
green-on-black VT220 aesthetic. Includes all 18 widget methods: header,
footer, menu, table, detail, form, filter list, comparison view, box
drawing, message dialogs, and input prompts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:41:51 +00:00
211883393e feat(console): add formatting utils and VIN API client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:38:28 +00:00
ceacab789b feat(console): add core framework - keybindings, navigation, screen base
Add the three core modules that all screens depend on:
- keybindings.py: Key constants (curses codes) and KeyBindings registry
- navigation.py: Stack-based screen navigation with breadcrumbs
- screens.py: Screen base class with on_enter/on_key/render lifecycle

Includes 31 tests covering all public APIs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:38:02 +00:00
3b884e24d3 feat(console): add database abstraction layer with tests
Implement console/db.py with Database class providing all data access
methods for the console application, plus 36 passing tests in
console/tests/test_db.py covering vehicle navigation, parts catalog,
search, VIN cache, stats, manufacturers, and admin CRUD operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:34:22 +00:00
7cf3ddc758 feat(console): scaffold project structure and config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:29:54 +00:00