Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-git/README.md

facett-git

A facett git repository facet — browse branches, the commit log, the file tree, and syntax-coloured source, all clickable, in any egui app.

facett-git implements the facett Facet contract, so a consumer (e.g. nornir's viz) drops it into a FacetDeck and gets a live git browser plus headless robot-testing for free.

┌── Branches ──┬── Tree / Log ──┬──────── Source ────────────┐
│ ● main a1b2c │ 📁 src         │ fn main() {                │   ← fn/let = keyword
│   feature 0f │ 📄 Cargo.toml  │     let x = 42;  // hi     │   ← 42 = number
│              │ 📄 README.md   │ }                          │   ← // hi = comment
└──────────────┴────────────────┴────────────────────────────┘

What it does

Two data paths

Path Needs git? Use
GitView::new(snapshot) no host supplies a RepoSnapshot (+ a Blob)
GitView::open(path, max) yes — gix feature read a repo live off disk

The pure RepoSnapshot model is always available and serde-serializable, so the crate builds and tests with no git dependency. The live reader is gated behind the optional gix feature (matching the sibling nornir's gix 0.84).

use facett_git::GitView;

// host-supplied data (no git dependency)
let view = GitView::demo();

// or read a repo live (requires `features = ["gix"]`)
# #[cfg(feature = "gix")]
let view = GitView::open("/path/to/repo", 100)?;
# #[cfg(feature = "gix")] Ok::<(), String>(())

Render coloured code anywhere with the same highlighter:

use facett_git::GitView;
let job = GitView::highlight_job("fn x() -> u32 { 7 }", &Default::default(),
                                 egui::FontId::monospace(12.0));
// ui.label(job);

Contract & determinism

Implements Facet — title / ui / state_json — and advertises scalable · selectable · themeable caps. Everything visible (branch/commit/tree counts, selection, open path, pane) is in state_json for headless assertions (LAW 6), and the highlighter is deterministic (FC-7): identical source → identical spans.

Features

Tests

cargo test -p facett-git           # pure facet + highlighter (9 tests)
cargo test -p facett-git --features gix

Covered: the highlighter tiles every byte / classifies each token kind / is deterministic / empty-is-empty; the snapshot model is well-formed and serde round-trips; the Facet state_json exposes counts + selection, scale clamps, and the highlight job actually colours the fn keyword differently from plain text.

License

MIT OR Apache-2.0.