Commit Graph

6 Commits

Author SHA1 Message Date
ruohki b81b893661 fix(terminal): switch to alternate screen buffer for clean exit
TUI frame was left in terminal after exit. Use EnterAlternateScreen/
LeaveAlternateScreen so exiting restores the original terminal content.
2026-02-28 21:35:01 +01:00
ruohki 771c9a8561 feat(01-03): wire complete startup-to-shutdown pipeline in main.rs
- All four modules declared: mod app, config, signals, terminal
- Pre-terminal phase: login shell detection, CLI parse, config load
- Terminal phase: panic hook installed first, then signals, then terminal init
- Event loop: App::new receives is_login_shell and app_config; run_event_loop runs
- Shutdown: restore_terminal() called before show_goodbye() in all exit paths
- BrokenPipe from event loop exits silently (LIFE-04)
- Unexpected I/O errors logged to stderr after terminal restore
2026-02-28 21:17:56 +01:00
ruohki bad8fba5aa feat(01-03): implement App struct and event loop with exit behavior
- App struct with is_login_shell, double-press Ctrl+C state machine, show_quit_prompt
- run_event_loop() polls SignalFlags first, then draws, then polls key events
- handle_key() suppresses 'q' in login shell mode; double Ctrl+C within 2s quits
- draw() renders Phase 1 placeholder TUI with title, welcome text, quit prompt
- show_goodbye() prints BBS-style goodbye with 500ms delay after terminal restore
- DOUBLE_PRESS_WINDOW const = 2 seconds
- mod app added to main.rs
2026-02-28 21:17:10 +01:00
ruohki 966b47edbc feat(01-02): implement signal handling and logging stub
- SignalFlags struct wraps Arc<AtomicBool> for SIGHUP/SIGTERM
- register_signals() registers SIGHUP and SIGTERM only (not SIGINT)
- SIGINT deliberately excluded — handled via crossterm key events for double-press Ctrl+C
- should_terminate() polls flag with Ordering::Relaxed for event loop use
- init_logging() is a Phase 1 no-op stub with LIFE-03 documentation
2026-02-28 21:12:45 +01:00
ruohki 65313eac31 feat(01-01): add Phase 1 deps and implement config/CLI loading
- Add signal-hook 0.4.3, toml 1.0.3, serde 1.0, clap 4.5 to Cargo.toml
- Create src/config.rs with Config struct (deny_unknown_fields, serde defaults)
- Implement load_config() with vault_path resolution relative to config file dir
- Implement resolve_config_path() using binary-adjacent bbs.toml as default
- Implement print_config_error() with BBS-themed error messages
- Implement detect_login_shell() and parse_cli() with argv[0] dash stripping
- Create src/terminal.rs with init_terminal(), restore_terminal(), install_panic_hook()
- Wire early startup path in src/main.rs before terminal initialization
2026-02-28 21:12:29 +01:00
ruohki b258b6d262 feat(01-02): implement terminal init/restore and panic hook
- init_terminal() enables raw mode and clears main screen via Viewport::Fullscreen
- No alternate screen buffer used (deliberate BBS immersive approach)
- restore_terminal() disables raw mode and shows cursor using let _ for all calls
- install_panic_hook() restores terminal, prints BBS-themed message, delegates to original hook
- Use ratatui::crossterm re-export (crossterm is transitive dep only)
- All panic hook operations use let _ or eprintln! — no unwrap() or ? inside hook
2026-02-28 21:12:04 +01:00