### Run ftui-harness examples Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/tutorials/agent-harness.md Execute the minimal and streaming examples for the ftui-harness. ```bash cargo run -p ftui-harness --example minimal ``` ```bash cargo run -p ftui-harness --example streaming ``` -------------------------------- ### Run Harness Examples Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Execute harness examples to test and reference behavior. Use these to verify specific functionalities. ```bash cargo run -p ftui-harness --example minimal ``` ```bash cargo run -p ftui-harness --example streaming ``` -------------------------------- ### Run Streaming Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/getting-started.md Command to run the streaming example from the ftui-harness crate. ```bash cargo run -p ftui-harness --example streaming ``` -------------------------------- ### Install FrankenTUI from Source Tarball Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Use this method to quickly install FrankenTUI by downloading and building the source tarball. Ensure you have Rust and Cargo installed. ```bash curl -fsSL https://codeload.github.com/Dicklesworthstone/frankentui/tar.gz/main | tar -xz cd frankentui-main cargo build --release ``` -------------------------------- ### bv Scoping and Filtering Examples Source: https://github.com/dicklesworthstone/frankentui/blob/main/AGENTS.md Examples demonstrating how to scope bv analysis to specific labels, historical points, or pre-filtered recipes. ```bash bv --robot-plan --label backend # Scope to label's subgraph ``` ```bash bv --robot-insights --as-of HEAD~30 # Historical point-in-time ``` ```bash bv --recipe actionable --robot-plan # Pre-filter: ready to work ``` ```bash bv --recipe high-impact --robot-triage # Pre-filter: top PageRank ``` ```bash bv --robot-triage --robot-triage-by-track # Group by parallel work streams ``` ```bash bv --robot-triage --robot-triage-by-label # Group by domain ``` -------------------------------- ### Install Nightly Rust Toolchain Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md FrankenTUI requires the nightly Rust compiler. Install it using rustup. ```bash rustup toolchain install nightly ``` -------------------------------- ### Minimal FrankenTUI Application Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md This example demonstrates a basic FrankenTUI application that displays a tick counter and quits when 'q' is pressed. It requires the `ftui_core`, `ftui_render`, `ftui_runtime`, and `ftui_widgets` crates. ```rust use ftui_core::event::Event; use ftui_core::geometry::Rect; use ftui_render::frame::Frame; use ftui_runtime::{App, Cmd, Model, ScreenMode}; use ftui_widgets::paragraph::Paragraph; struct TickApp { ticks: u64, } #[derive(Debug, Clone)] enum Msg { Tick, Quit, } impl From for Msg { fn from(e: Event) -> Self { match e { Event::Key(k) if k.is_char('q') => Msg::Quit, _ => Msg::Tick, } } } impl Model for TickApp { type Message = Msg; fn update(&mut self, msg: Msg) -> Cmd { match msg { Msg::Tick => { self.ticks += 1; Cmd::none() } Msg::Quit => Cmd::quit(), } } fn view(&self, frame: &mut Frame) { let text = format!("Ticks: {} (press 'q' to quit)", self.ticks); let area = Rect::new(0, 0, frame.width(), 1); Paragraph::new(text).render(area, frame); } } fn main() -> std::io::Result<()> { App::new(TickApp { ticks: 0 }) .screen_mode(ScreenMode::Inline { ui_height: 1 }) .run() } ``` -------------------------------- ### Run Minimal Inline App Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/getting-started.md Command to compile and run the minimal inline application example. ```bash cargo run ``` -------------------------------- ### Preset Backdrop Configurations Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/concepts/visual-fx.md Provides examples of using the `subtle()` and `vibrant()` presets for common backdrop configurations, offering quick setup for legibility-first or visually impactful designs. ```rust // Subtle: 15% opacity, no scrim (prioritizes legibility) Backdrop::new(Box::new(fx), theme).subtle().over(&child); // Vibrant: 50% opacity, vignette scrim (visual impact) Backdrop::new(Box::new(fx), theme).vibrant().over(&child); ``` -------------------------------- ### Canonical Entrypoint for FrankenTUI Application Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/planning/plan-to-create-frankentui-codex.md This example demonstrates the primary way to create and run a FrankenTUI application. It shows the basic structure of a `Model` implementation and how to initialize and launch the `App` with specific screen mode settings. ```APIDOC ## Canonical entrypoint ```rust use ftui::{App, Cmd, Event, Frame, Model, ScreenMode, Result}; struct State { count: u64 } impl Model for State { type Message = Event; fn update(&mut self, msg: Event) -> Cmd { match msg { Event::Key(k) if k.is_char('q') => Cmd::quit(), Event::Key(k) if k.is_char('+') => { self.count += 1; Cmd::none() } _ => Cmd::none(), } } fn view(&self, frame: &mut Frame) { // draw into frame } } fn main() -> Result<()> { App::new(State { count: 0 }) .screen_mode(ScreenMode::Inline { ui_height: 6 }) .run() } ``` ``` -------------------------------- ### Configure Evidence Logging in Rust Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Example of configuring and enabling structured evidence logs for FrankenTUI. This setup directs logs to a file named 'evidence.jsonl' and flushes them immediately after writing. ```rust use ftui_runtime::{EvidenceSinkConfig, EvidenceSinkDestination, Program, ProgramConfig}; let config = ProgramConfig::default().with_evidence_sink( EvidenceSinkConfig::enabled_file("evidence.jsonl") .with_destination(EvidenceSinkDestination::file("evidence.jsonl")) .with_flush_on_write(true), ); let mut program = Program::with_config(model, config)?; program.run()?; ``` -------------------------------- ### Install cargo-llvm-cov Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/testing/coverage-playbook.md Installs the `cargo-llvm-cov` tool if it is not already present. ```bash cargo install cargo-llvm-cov ``` -------------------------------- ### Clone and Run Demo Showcase with Git Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Clone the FrankenTUI repository using git, navigate into the project directory, and then run the demo showcase. ```bash git clone https://github.com/dicklesworthstone/frankentui.git cd frankentui cargo run -p ftui-demo-showcase ``` -------------------------------- ### Command Examples Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Demonstrates various ways to create and use Commands for handling side effects and asynchronous operations. ```rust Cmd::none() // No side effect Cmd::perform(future, mapper) // Async operation → Message Cmd::quit() // Exit program Cmd::batch(vec![...]) // Multiple commands ``` -------------------------------- ### Subscription Examples Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Shows how to define subscriptions for declarative, long-running event sources like timers and file watchers. ```rust fn subscriptions(&self) -> Vec>> { vec![ tick_every(Duration::from_millis(16)), // 60fps timer file_watcher("/path/to/watch"), // FS events ] } ``` -------------------------------- ### Run Demo with Pre-recorded Scenario Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/macro-recorder.md Executes the FrankenTUI demo showcase using a pre-recorded macro scenario specified by the FTUI_DEMO_MACRO environment variable. ```bash # Run demo with a pre-recorded scenario FTUI_DEMO_MACRO=scenarios/quick-tour.json cargo run -p ftui-demo-showcase ``` -------------------------------- ### E2E Event JSONL Example Fixture Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/testing/e2e-summary-schema.md This file serves as a handy example fixture for local verification of E2E Event JSONL. ```json tests/e2e/lib/e2e_jsonl_examples.jsonl ``` -------------------------------- ### Run Performance HUD Demo Showcase Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/performance-hud.md Launches the demo showcase and directly navigates to the Performance screen. Toggle the HUD with Ctrl+P. ```bash cargo run -p ftui-demo-showcase -- --screen=10 ``` -------------------------------- ### Confidence Ledger Entry Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/spec/telemetry-perf.md An example of a confidence ledger entry in JSONL format, detailing benchmark results and confidence metrics. ```json { "run_id": "20260208T202350-2604979", "benchmark": "web/frame_harness_stats/heavy_50pct/80x24", "status": "PASS", "actual_ns": 10000, "budget_ns": 30000, "ci_low_ns": 9900, "ci_high_ns": 10100, "ci_width_ns": 200, "relative_ci_width": 0.006667, "sigma_ns": 150.0, "variance_ns2": 22500.0, "posterior_prob_regression": 0.0, "e_value": 1.0, "bayes_factor_10": 0.196116, "decision": "allow", "confidence_hint": "pass", "loss_matrix": { "false_positive": 1, "false_negative": 5 }, "hardware": { "os": "Linux", "arch": "x86_64", "cpu_model": "AMD EPYC 7B13", "cpu_cores": 16 } } ``` -------------------------------- ### Download and Run Demo Showcase with Curl Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Download the FrankenTUI source code using curl, extract it, navigate to the directory, and then run the demo showcase. ```bash # Download source with curl (no installer yet) curl -fsSL https://codeload.github.com/dicklesworthstone/frankentui/tar.gz/main | tar -xz cd frankentui-main # Run the demo showcase (primary way to see what FrankenTUI can do) cargo run -p ftui-demo-showcase ``` -------------------------------- ### Diff Decision Event Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/spec/telemetry-events.md Example JSON log for a 'diff_decision' event. This event captures details about the diffing strategy and its performance metrics. ```json {"event":"diff_decision","run_id":"diff-4242","event_idx":12,"strategy":"DirtyRows","cost_full":4800.000000,"cost_dirty":1200.000000,"cost_redraw":0.000000,"posterior_mean":0.036000,"posterior_variance":0.000340,"alpha":3.500000,"beta":92.500000,"dirty_rows":10,"total_rows":40,"total_cells":4800,"span_count":6,"span_coverage_pct":12.500000,"max_span_len":18,"fallback_reason":"none","scan_cost_estimate":600,"tile_used":true,"tile_fallback":"none","tile_w":16,"tile_h":16,"tile_size":256,"tiles_x":5,"tiles_y":3,"dirty_tiles":2,"dirty_tile_count":2,"dirty_cells":40,"dirty_tile_ratio":0.133333,"dirty_cell_ratio":0.008333,"scanned_tiles":2,"skipped_tiles":13,"skipped_tile_count":13,"tile_scan_cells_estimate":512,"sat_build_cost_est":4800,"bayesian_enabled":true,"dirty_rows_enabled":true} ``` -------------------------------- ### FrankenTUI Environment Variables Configuration Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Example .env file showing available environment variables for configuring FrankenTUI's harness behavior, including screen mode, UI height, view selection, mouse and focus support, and logging options. ```bash # .env (example) FTUI_HARNESS_SCREEN_MODE=inline # inline | alt FTUI_HARNESS_UI_HEIGHT=12 # rows reserved for UI FTUI_HARNESS_VIEW=layout-grid # view selector FTUI_HARNESS_ENABLE_MOUSE=true FTUI_HARNESS_ENABLE_FOCUS=true FTUI_HARNESS_LOG_LINES=25 FTUI_HARNESS_LOG_MARKUP=true FTUI_HARNESS_LOG_FILE=/path/to/log.txt FTUI_HARNESS_EXIT_AFTER_MS=0 # 0 disables auto-exit ``` -------------------------------- ### Example Pane Monitor Explanation Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/perf/pane_assumption_monitors.md An example of an operator-readable explanation for a violated pane monitor assumption, detailing the observed value, budget, and the impact. ```text > Checkpointed replay walks 40 step(s), 2.5x the 16-step checkpoint interval > (checkpoint_hit=false) — undo/redo will feel sluggish; the checkpoint-spacing > assumption is violated. ``` -------------------------------- ### Install Nightly Rust Compiler Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/getting-started.md If you encounter errors related to the nightly compiler, install it using rustup. This ensures compatibility with features required by FrankenTUI. ```bash rustup toolchain install nightly ``` -------------------------------- ### Canonical Entrypoint: ftui::App Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/planning/plan-to-create-frankentui-opus.md Demonstrates the basic structure of an application using `ftui::App`. It defines a `State` model and implements the `Model` trait to handle events and render UI. This serves as the default path for inline, scrollback, and stable UI regions. ```rust use ftui::{App, Cmd, Event, Frame, Model, ScreenMode, Result}; struct State { count: u64 } impl Model for State { type Message = Event; fn update(&mut self, msg: Event) -> Cmd { match msg { Event::Key(k) if k.is_char('q') => Cmd::quit(), Event::Key(k) if k.is_char('+') => { self.count += 1; Cmd::none() } _ => Cmd::none(), } } fn view(&self, frame: &mut Frame) { // draw into frame.buffer using text/style/layout helpers } } fn main() -> Result<()> { App::new(State { count: 0 }) .screen_mode(ScreenMode::Inline { ui_height: 6 }) .run() } ``` -------------------------------- ### JSONL Log Format Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/spec/wasm-showcase-runner-contract.md Example of host-side JSONL log lines generated from WASM runner data. These are used for end-to-end testing and CI. ```jsonl {"event":"step","frame_idx":1,"ts_ns":16000000,"rendered":true,"events_processed":3} {"event":"patch_stats","frame_idx":1,"dirty_cells":42,"patch_count":3,"bytes_uploaded":672} {"event":"frame","frame_idx":1,"patch_hash":"fnv1a64:a1b2c3d4e5f6a7b8"} ``` -------------------------------- ### BOCPD Event Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/spec/telemetry-events.md Example JSON log for a 'bocpd' event, which is schema-versioned. This event captures Bayesian Online Change Point Detection information. ```json {"schema_version":"bocpd-v1","event":"bocpd","p_burst":0.7321,"log_bf":1.204,"obs_ms":18.0,"regime":"burst","ll_steady":0.001234,"ll_burst":0.056789,"runlen_mean":12.4,"runlen_var":9.100,"runlen_mode":9,"runlen_p95":21,"runlen_tail":0.0420,"delay_ms":40,"forced_deadline":false,"n_obs":64} ``` -------------------------------- ### Run FrankenTUI Demo Showcase Source: https://github.com/dicklesworthstone/frankentui/blob/main/README.md Execute the primary demo showcase for FrankenTUI. You can also specify a particular view to load using the FTUI_HARNESS_VIEW environment variable. ```bash # Demo showcase (primary) cargo run -p ftui-demo-showcase ``` ```bash # Pick a specific demo view FTUI_HARNESS_VIEW=dashboard cargo run -p ftui-demo-showcase FTUI_HARNESS_VIEW=visual_effects cargo run -p ftui-demo-showcase ``` -------------------------------- ### Input Event Record Example Source: https://github.com/dicklesworthstone/frankentui/blob/main/docs/spec/frankenterm-golden-trace-format.md Input records capture effective input semantics for replay. For web/remote, prefer post-normalization. This example shows a key input. ```json {"schema_version":"golden-trace-v1","event":"input","ts_ns":16000000,"kind":"key", ...} ```