Skip to main content

improv_gui/
main.rs

1//! Improv desktop GUI (`improv-gui`) — Phase 5.
2//!
3//! An `egui`/`eframe` front-end: a *view* over the engine (see
4//! `.agent/steering/AGENT_GUI_STEERING.md` §9). It loads a model from a store
5//! (a Mentat file or a `postgres://…?model=` URL), renders a measure as a pivot grid, and (Phase 5 increments) offers a
6//! model browser, formula editor, and Info panel.
7#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
8// The attribute is only used inside #[cfg(test)] modules, so non-test
9// coverage builds would otherwise warn that the feature is unused.
10#![cfg_attr(coverage_nightly, allow(unused_features))]
11
12mod app;
13mod chart;
14mod completion;
15mod csv_wizard;
16mod diagnostics;
17mod formula_highlight;
18mod function_help;
19mod menu;
20mod nxwin;
21mod theme;
22
23use app::ImprovApp;
24
25fn main() -> eframe::Result<()> {
26    // Model store path from argv[1]; "" is an in-memory scratch model.
27    let db = std::env::args().nth(1).unwrap_or_default();
28
29    let app = match ImprovApp::load(&db) {
30        Ok(a) => a,
31        Err(e) => {
32            eprintln!("improv-gui: {e}");
33            std::process::exit(1);
34        }
35    };
36
37    let native_options = eframe::NativeOptions {
38        viewport: egui::ViewportBuilder::default()
39            .with_inner_size(app::INITIAL_WINDOW)
40            .with_min_inner_size(app::MIN_WINDOW),
41        ..Default::default()
42    };
43    eframe::run_native(
44        "Improv",
45        native_options,
46        Box::new(|cc| {
47            // Apply the NeXTSTEP look-and-feel once at startup.
48            theme::apply(&cc.egui_ctx);
49            Ok(Box::new(app))
50        }),
51    )
52}