feat: add read-only repository tui
Rust CI Epoch Forge passed all CI checks.
Gitea/epoch_forge/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-09-21 01:25:25 +02:00
parent ee40a29987
commit 3f7db618b2
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
7 changed files with 1195 additions and 31 deletions

View File

@ -19,8 +19,9 @@ portable release gates.
default and portable test, Clippy, and release gates on 2026-09-21. Format 2 is
explicitly migratable, transactional, staged, immutable, and recoverable.
**Milestone 5 — first TUI checkpoint: in progress.** Its read-only scope,
terminal lifecycle, keyboard contract, and accessibility gate are approved in
**Milestone 5 — first TUI checkpoint: complete.** Its read-only scope,
terminal lifecycle, keyboard contract, and accessibility gate passed default
and portable release gates on 2026-09-21. See
[`docs/tui-design.md`](docs/tui-design.md).
## Phase 0 — audit and guardrails
@ -134,16 +135,16 @@ terminal lifecycle, keyboard contract, and accessibility gate are approved in
- [x] Approve the separate-binary architecture and read-only first-pass scope.
- [x] Define keyboard navigation, compact-layout, accessibility, and terminal
restoration requirements.
- [ ] Add the `efo-tui` workspace binary without coupling `lib_efo` to a
- [x] Add the `efo-tui` workspace binary without coupling `lib_efo` to a
terminal framework.
- [ ] Render format-2 HEAD/index/worktree status and all entity collections.
- [ ] Provide collection, entity, and detail navigation with contextual help.
- [ ] Report legacy, corrupt, locked, and interrupted repositories with the
- [x] Render format-2 HEAD/index/worktree status and all entity collections.
- [x] Provide collection, entity, and detail navigation with contextual help.
- [x] Report legacy, corrupt, locked, and interrupted repositories with the
next useful CLI command.
- [ ] Unit test state transitions and deterministic rendering with a test
- [x] Unit test state transitions and deterministic rendering with a test
backend.
- [ ] Document installation, startup, keys, scope, and CLI fallback paths.
- [ ] Pass default and portable formatting, test, strict Clippy, and release
- [x] Document installation, startup, keys, scope, and CLI fallback paths.
- [x] Pass default and portable formatting, test, strict Clippy, and release
gates without running release-only badge tooling.
## Stretch goals — proposal only
@ -180,8 +181,11 @@ These require user approval and are not part of the current implementation:
- The binary now has thirteen integration workflows; format-2 library coverage
includes clean/dirty layers, commits, conflict refusal, time advancement,
migration rollback, lock exclusion, and interrupted-journal refusal.
- All 73 default-feature tests, 69 portable-output tests, strict Clippy, and both
release builds passed on 2026-09-20.
- The separate read-only `efo-tui` binary browses status and all entity
collections with semantic labels, guarded terminal restoration, reload,
contextual help, compact-layout fallback, and three focused unit tests.
- All 96 default-feature tests, 92 portable-output tests, strict Clippy, and
both release builds passed on 2026-09-21.
- The milestone-only `rust_autobadges` run was attempted, but this installed
version misreported passing tests as failing and coverage as unavailable.
Its false generated badges were discarded; the prior badges were preserved.

613
Cargo.lock generated
View File

@ -26,6 +26,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "allocator-api2"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "anstream"
version = "0.6.21"
@ -76,6 +82,21 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
dependencies = [
"num-traits",
]
[[package]]
name = "autocfg"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "backtrace"
version = "0.3.76"
@ -102,9 +123,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "2.10.0"
version = "2.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
[[package]]
name = "bumpalo"
@ -112,6 +133,21 @@ version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]]
name = "by_address"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
[[package]]
name = "castaway"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
dependencies = [
"rustversion",
]
[[package]]
name = "cfg-if"
version = "1.0.4"
@ -149,7 +185,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
@ -178,7 +214,7 @@ checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
@ -196,6 +232,20 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "compact_str"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab"
dependencies = [
"castaway",
"cfg-if",
"itoa",
"rustversion",
"ryu",
"static_assertions",
]
[[package]]
name = "console"
version = "0.15.11"
@ -217,6 +267,33 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "crossterm"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
dependencies = [
"bitflags",
"crossterm_winapi",
"derive_more",
"document-features",
"mio",
"parking_lot",
"rustix",
"signal-hook",
"signal-hook-mio",
"winapi",
]
[[package]]
name = "crossterm_winapi"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi",
]
[[package]]
name = "csv"
version = "1.4.0"
@ -238,6 +315,46 @@ dependencies = [
"memchr",
]
[[package]]
name = "darling"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff"
dependencies = [
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 3.0.6",
]
[[package]]
name = "darling_macro"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"
dependencies = [
"darling_core",
"quote",
"syn 3.0.6",
]
[[package]]
name = "deranged"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
[[package]]
name = "derive_more"
version = "2.1.0"
@ -257,10 +374,19 @@ dependencies = [
"proc-macro2",
"quote",
"rustc_version",
"syn",
"syn 2.0.111",
"unicode-xid",
]
[[package]]
name = "document-features"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
dependencies = [
"litrs",
]
[[package]]
name = "efo"
version = "0.1.0"
@ -278,6 +404,26 @@ dependencies = [
"uuid",
]
[[package]]
name = "efo-tui"
version = "0.1.0"
dependencies = [
"clap",
"crossterm",
"lib_efo",
"ratatui",
"serde_json",
"tempfile",
"thiserror",
"uuid",
]
[[package]]
name = "either"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
[[package]]
name = "encode_unicode"
version = "1.0.0"
@ -307,6 +453,12 @@ dependencies = [
"log",
]
[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "errno"
version = "0.3.14"
@ -323,6 +475,12 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "foldhash"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "getrandom"
version = "0.3.4"
@ -341,12 +499,49 @@ version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
[[package]]
name = "hashbrown"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
]
[[package]]
name = "hashbrown"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
]
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "indoc"
version = "2.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
dependencies = [
"rustversion",
]
[[package]]
name = "insta"
version = "1.44.3"
@ -358,6 +553,19 @@ dependencies = [
"similar",
]
[[package]]
name = "instability"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf84e73fa6f27f299dec58e13223cf70db80da872eb921d4f6138342a0eabc8"
dependencies = [
"darling",
"indoc",
"proc-macro2",
"quote",
"syn 3.0.6",
]
[[package]]
name = "is_ci"
version = "1.2.0"
@ -370,6 +578,15 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"
@ -397,7 +614,7 @@ checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
@ -410,6 +627,17 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kasuari"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899"
dependencies = [
"hashbrown 0.16.1",
"portable-atomic",
"thiserror",
]
[[package]]
name = "lib_efo"
version = "0.1.0"
@ -432,9 +660,24 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.178"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "libm"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "line-clipping"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e752191d037c44ad111a8caa762921926658402f01cc1253f7bef2020ece4f5e"
dependencies = [
"bitflags",
]
[[package]]
name = "linux-raw-sys"
@ -442,12 +685,36 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
[[package]]
name = "litrs"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
[[package]]
name = "lock_api"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
[[package]]
name = "lru"
version = "0.18.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff9840bcc50b71349309900da0ce7279aa336ae71d73250b07998932c7d97c25"
dependencies = [
"hashbrown 0.17.1",
]
[[package]]
name = "memchr"
version = "2.7.6"
@ -481,7 +748,7 @@ checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
@ -493,6 +760,42 @@ dependencies = [
"adler2",
]
[[package]]
name = "mio"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.61.2",
]
[[package]]
name = "num-conv"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "num_threads"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
dependencies = [
"libc",
]
[[package]]
name = "object"
version = "0.37.3"
@ -521,10 +824,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52"
[[package]]
name = "portable-atomic"
version = "1.11.1"
name = "palette"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64"
dependencies = [
"approx",
"libm",
"palette_derive",
"palette_math",
]
[[package]]
name = "palette_derive"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be"
dependencies = [
"by_address",
"proc-macro2",
"quote",
"syn 2.0.111",
]
[[package]]
name = "palette_math"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12"
dependencies = [
"libm",
]
[[package]]
name = "parking_lot"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-link",
]
[[package]]
name = "portable-atomic"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
[[package]]
name = "portable-atomic-util"
@ -535,6 +894,12 @@ dependencies = [
"portable-atomic",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.21"
@ -597,6 +962,81 @@ dependencies = [
"getrandom",
]
[[package]]
name = "ratatui"
version = "0.30.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3274ba0a2c5e1bcad2a2005d20f4dc59dad26b2eb0940fb094500dba4099d57d"
dependencies = [
"instability",
"ratatui-core",
"ratatui-crossterm",
"ratatui-widgets",
"serde",
]
[[package]]
name = "ratatui-core"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbb175c433c8e28a809d1f5773a2ae96e68c0ce40db865cbab1020bf33ae479c"
dependencies = [
"bitflags",
"compact_str",
"hashbrown 0.17.1",
"itertools",
"kasuari",
"lru",
"palette",
"serde",
"strum",
"thiserror",
"unicode-segmentation",
"unicode-truncate",
"unicode-width 0.2.2",
]
[[package]]
name = "ratatui-crossterm"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0"
dependencies = [
"cfg-if",
"crossterm",
"instability",
"ratatui-core",
]
[[package]]
name = "ratatui-widgets"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66e3d19bcc9130ca376277d93b60767ff121ace3be06f5f95f81dd68956407d1"
dependencies = [
"bitflags",
"hashbrown 0.17.1",
"indoc",
"instability",
"itertools",
"line-clipping",
"ratatui-core",
"serde",
"strum",
"time",
"unicode-segmentation",
"unicode-width 0.2.2",
]
[[package]]
name = "redox_syscall"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
"bitflags",
]
[[package]]
name = "regex"
version = "1.12.2"
@ -666,6 +1106,12 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.27"
@ -699,7 +1145,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
@ -715,18 +1161,82 @@ dependencies = [
"serde_core",
]
[[package]]
name = "signal-hook"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-mio"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc"
dependencies = [
"libc",
"mio",
"signal-hook",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
dependencies = [
"errno",
"libc",
]
[[package]]
name = "similar"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
[[package]]
name = "smallvec"
version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.111",
]
[[package]]
name = "supports-color"
version = "3.0.2"
@ -759,6 +1269,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.23.0"
@ -818,9 +1339,30 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]
[[package]]
name = "time"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"
dependencies = [
"deranged",
"libc",
"num-conv",
"num_threads",
"powerfmt",
"serde_core",
"time-core",
]
[[package]]
name = "time-core"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
[[package]]
name = "unicode-ident"
version = "1.0.22"
@ -839,6 +1381,17 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]]
name = "unicode-truncate"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"
dependencies = [
"itertools",
"unicode-segmentation",
"unicode-width 0.2.2",
]
[[package]]
name = "unicode-width"
version = "0.1.14"
@ -875,6 +1428,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
version = "1.0.1+wasi-0.2.4"
@ -916,7 +1475,7 @@ dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
"wasm-bindgen-shared",
]
@ -929,6 +1488,22 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.11"
@ -938,6 +1513,12 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-link"
version = "0.2.1"
@ -1123,5 +1704,5 @@ checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.111",
]

View File

@ -1,6 +1,6 @@
[workspace]
resolver = "3"
members = ["bin_efo", "lib_efo"]
members = ["bin_efo", "lib_efo", "tui_efo"]
[workspace.dependencies]
serde = { version = "1.0.228", features = ["derive"] }
@ -14,3 +14,5 @@ derive_more = { version = "2.0.1", features = ["display", "add", "mul"] }
uuid = { version = "1.18.1", features = ["serde", "v4"] }
colored = "3.0.0"
insta = "1.44.3"
ratatui = { version = "0.30.2", default-features = false, features = ["crossterm"] }
crossterm = "0.29.0"

View File

@ -11,8 +11,9 @@ future timeline when needed.
The current release manages organisations, characters, towns, events,
calamities, and blockers with statistics and relationships. After explicit
migration, format 2 provides worktree/index staging, immutable commits, restore,
conflict-safe revert, switching, and recoverable future pruning. Custom fields
and a TUI remain planned. There is no GUI or web interface.
conflict-safe revert, switching, and recoverable future pruning. A separate
read-only TUI browses format-2 status and entities. Custom fields and TUI write
workflows remain planned. There is no GUI or web interface.
> Epoch Forge is not yet suitable as the only copy of important campaign data.
> Keep the repository in Git or make a directory backup before destructive
@ -26,6 +27,7 @@ The project currently requires Rust 1.92 or newer:
git clone https://proxy.dandaedre.com/gitea/idle-org/epoch_forge.git
cd epoch_forge
cargo install --locked --path bin_efo
cargo install --locked --path tui_efo
```
Nerd Font icons are enabled by default. Build a portable-Unicode variant for
@ -72,11 +74,15 @@ Run `efo --help`, `efo <command> --help`, or see the
| Timeline | Advance legacy epochs; format-2 commit, switch, log, tag, summarise, diff, restore, revert, and backed-up future pruning | Branching and merging |
| Entities | Add, edit, list, inspect, diff, and delete six built-in types | Custom types and custom fields; bulk operations |
| Generation | Generate character, town, event, calamity, blocker, and exotic names | Deterministic seed controls and template packs |
| Interfaces | CLI | TUI (possible stretch goal); GUI/web (out of scope) |
| Interfaces | Complete CLI; read-only `efo-tui` format-2 browser | TUI write workflows; GUI/web (out of scope) |
`efo show all` gives a world overview; per-type commands such as
`efo chr show Aria` provide targeted or detailed inspection.
After migrating a repository to format 2, run `efo-tui` in its root. The TUI
uses ordinary Unicode and text labels, so no meaning depends on Nerd Font
glyphs. Press `?` for its complete keyboard reference.
## Documentation
- [Documentation index](docs/README.md)
@ -84,6 +90,7 @@ Run `efo --help`, `efo <command> --help`, or see the
- [Repository, persistence, and recovery](docs/repository.md)
- [Reversing changes](docs/recovery.md)
- [Architecture and development](docs/architecture.md)
- [TUI scope and keyboard guide](docs/tui-design.md)
- [Roadmap and proposed stretch goals](docs/roadmap.md)
- [Contributor/agent rules](AGENTS.md) and [working task list](AGENTS-TASKS.md)

View File

@ -86,3 +86,21 @@ The checkpoint is complete when `efo-tui --help` is self-documenting, startup
and repository failures are actionable, navigation and rendering have tests,
the terminal lifecycle is guarded, and the full workspace passes formatting,
tests, strict Clippy, and release builds with default and portable features.
## Running the first checkpoint
Install both interfaces, migrate the target repository to format 2 if needed,
then start the browser from that repository or name its path explicitly:
```bash
cargo install --locked --path bin_efo
cargo install --locked --path tui_efo
efo migrate --to 2 --apply
efo-tui
# or: efo-tui --repository /path/to/world
```
The header reports HEAD, staged and unstaged state, and any active writer lock.
The browser reloads only when `r` is pressed; it never writes or silently
refreshes underneath a selection. Use `efo status`, `efo lock status`, or
`efo recover` when its diagnostic recommends that CLI recovery path.

17
tui_efo/Cargo.toml Normal file
View File

@ -0,0 +1,17 @@
[package]
name = "efo-tui"
version = "0.1.0"
edition = "2024"
repository = "https://proxy.dandaedre.com/gitea/idle-org/epoch_forge"
[dependencies]
clap = { workspace = true }
crossterm = { workspace = true }
lib_efo = { path = "../lib_efo", default-features = false }
ratatui = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
[dev-dependencies]
tempfile = "3.23.0"
uuid = { workspace = true }

535
tui_efo/src/main.rs Normal file
View File

@ -0,0 +1,535 @@
//! Interactive, read-only Epoch Forge repository browser.
#![deny(clippy::unwrap_used)]
use clap::Parser;
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
execute,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
};
use lib_efo::{entity::Entity, epoch::EpochInfo, workspace::Workspace};
use ratatui::{
Frame, Terminal,
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style, Stylize},
text::{Line, Text},
widgets::{Block, Borders, Clear, List, ListItem, ListState, Paragraph, Wrap},
};
use std::{
io::{self, Stdout},
path::PathBuf,
process::ExitCode,
time::Duration,
};
#[derive(Debug, Parser)]
#[command(
name = "efo-tui",
version,
about = "Browse an Epoch Forge repository interactively"
)]
#[command(
after_long_help = "KEYS:\n Tab / Shift-Tab Move focus\n Arrows or h/j/k/l Navigate\n ? Toggle help\n r Reload repository\n q or Esc Quit\n\nThis first release is read-only. Use `efo` for mutations and recovery."
)]
struct Args {
/// Repository directory to browse.
#[arg(short, long, default_value = ".", value_name = "PATH")]
repository: PathBuf,
}
#[derive(Debug, thiserror::Error)]
enum AppError {
#[error("could not open the terminal: {0}")]
Terminal(#[from] io::Error),
#[error("could not open `{path}`: {source}")]
Repository {
path: PathBuf,
source: lib_efo::workspace::WorkspaceError,
},
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Focus {
Collections,
Entities,
Details,
}
impl Focus {
fn next(self) -> Self {
match self {
Self::Collections => Self::Entities,
Self::Entities => Self::Details,
Self::Details => Self::Collections,
}
}
fn previous(self) -> Self {
match self {
Self::Collections => Self::Details,
Self::Entities => Self::Collections,
Self::Details => Self::Entities,
}
}
}
#[derive(Clone, Copy, Debug)]
enum Collection {
Characters,
Towns,
Events,
Calamities,
Organisations,
Blockers,
}
impl Collection {
const ALL: [Self; 6] = [
Self::Characters,
Self::Towns,
Self::Events,
Self::Calamities,
Self::Organisations,
Self::Blockers,
];
fn name(self) -> &'static str {
match self {
Self::Characters => "Characters",
Self::Towns => "Towns",
Self::Events => "Events",
Self::Calamities => "Calamities",
Self::Organisations => "Organisations",
Self::Blockers => "Blockers",
}
}
fn entities(self, world: &EpochInfo) -> &[Entity] {
match self {
Self::Characters => &world.characters,
Self::Towns => &world.towns,
Self::Events => &world.events,
Self::Calamities => &world.calamities,
Self::Organisations => &world.organizations,
Self::Blockers => &world.blockers,
}
}
}
struct App {
repository: PathBuf,
workspace: Workspace,
focus: Focus,
collection: usize,
entity: usize,
details_offset: u16,
help: bool,
message: String,
writer: String,
}
impl App {
fn open(repository: PathBuf) -> Result<Self, AppError> {
let workspace = Workspace::open(&repository).map_err(|source| AppError::Repository {
path: repository.clone(),
source,
})?;
let writer = writer_status(workspace.root());
Ok(Self {
repository,
workspace,
focus: Focus::Collections,
collection: 0,
entity: 0,
details_offset: 0,
help: false,
message: "Read-only mode · press ? for help".into(),
writer,
})
}
fn world(&self) -> &EpochInfo {
&self.workspace.worktree.world
}
fn entities(&self) -> &[Entity] {
Collection::ALL[self.collection].entities(self.world())
}
fn selected_entity(&self) -> Option<&Entity> {
self.entities().get(self.entity)
}
fn reload(&mut self) {
match Workspace::open(&self.repository) {
Ok(workspace) => {
self.writer = writer_status(workspace.root());
self.workspace = workspace;
self.clamp_entity();
self.message = "Repository reloaded from disk".into();
}
Err(error) => self.message = format!("Reload failed: {error}"),
}
}
fn clamp_entity(&mut self) {
self.entity = self.entity.min(self.entities().len().saturating_sub(1));
self.details_offset = 0;
}
fn move_selection(&mut self, down: bool) {
match self.focus {
Focus::Collections => {
self.collection = if down {
(self.collection + 1).min(Collection::ALL.len() - 1)
} else {
self.collection.saturating_sub(1)
};
self.entity = 0;
self.details_offset = 0;
}
Focus::Entities => {
self.entity = if down {
(self.entity + 1).min(self.entities().len().saturating_sub(1))
} else {
self.entity.saturating_sub(1)
};
self.details_offset = 0;
}
Focus::Details => {
self.details_offset = if down {
self.details_offset.saturating_add(1)
} else {
self.details_offset.saturating_sub(1)
}
}
}
}
fn handle_key(&mut self, key: KeyEvent) -> bool {
if self.help {
if matches!(
key.code,
KeyCode::Char('?') | KeyCode::Esc | KeyCode::Char('q')
) {
self.help = false;
}
return false;
}
match key.code {
KeyCode::Char('q') | KeyCode::Esc => return true,
KeyCode::Char('?') => self.help = true,
KeyCode::Char('r') => self.reload(),
KeyCode::Tab if key.modifiers.contains(KeyModifiers::SHIFT) => {
self.focus = self.focus.previous()
}
KeyCode::BackTab => self.focus = self.focus.previous(),
KeyCode::Tab | KeyCode::Right | KeyCode::Char('l') => self.focus = self.focus.next(),
KeyCode::Left | KeyCode::Char('h') => self.focus = self.focus.previous(),
KeyCode::Down | KeyCode::Char('j') => self.move_selection(true),
KeyCode::Up | KeyCode::Char('k') => self.move_selection(false),
_ => {}
}
false
}
}
struct TerminalGuard {
terminal: Terminal<CrosstermBackend<Stdout>>,
}
impl TerminalGuard {
fn enter() -> io::Result<Self> {
enable_raw_mode()?;
let mut stdout = io::stdout();
if let Err(error) = execute!(stdout, EnterAlternateScreen) {
let _ = disable_raw_mode();
return Err(error);
}
match Terminal::new(CrosstermBackend::new(stdout)) {
Ok(terminal) => Ok(Self { terminal }),
Err(error) => {
Self::restore();
Err(error)
}
}
}
fn restore() {
let _ = disable_raw_mode();
let _ = execute!(io::stdout(), LeaveAlternateScreen);
}
}
impl Drop for TerminalGuard {
fn drop(&mut self) {
Self::restore();
let _ = self.terminal.show_cursor();
}
}
fn main() -> ExitCode {
let args = Args::parse();
install_panic_hook();
match run(args) {
Ok(()) => ExitCode::SUCCESS,
Err(error) => {
eprintln!("error: {error}");
match &error {
AppError::Repository { source, .. } => {
eprintln!("help: {source}");
eprintln!("help: run `efo status` for the scriptable repository view");
}
AppError::Terminal(_) => {
eprintln!("help: run this command in an interactive terminal")
}
}
ExitCode::FAILURE
}
}
}
fn install_panic_hook() {
let previous = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| {
TerminalGuard::restore();
previous(info);
}));
}
fn run(args: Args) -> Result<(), AppError> {
let mut app = App::open(args.repository)?;
let mut terminal = TerminalGuard::enter()?;
loop {
terminal.terminal.draw(|frame| render(frame, &app))?;
if event::poll(Duration::from_millis(250))?
&& let Event::Key(key) = event::read()?
&& key.kind == KeyEventKind::Press
&& app.handle_key(key)
{
break;
}
}
Ok(())
}
fn render(frame: &mut Frame<'_>, app: &App) {
let area = frame.area();
if area.width < 54 || area.height < 14 {
frame.render_widget(Paragraph::new(format!("Epoch Forge needs at least 54×14 cells.\nCurrent terminal: {}×{}\n\nPress q to quit.", area.width, area.height)).block(Block::bordered().title(" Terminal too small ")).wrap(Wrap { trim: true }), area);
return;
}
let rows = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(4),
Constraint::Min(6),
Constraint::Length(2),
])
.split(area);
render_status(frame, app, rows[0]);
let columns = Layout::default()
.direction(Direction::Horizontal)
.constraints([
Constraint::Percentage(25),
Constraint::Percentage(30),
Constraint::Percentage(45),
])
.split(rows[1]);
render_collections(frame, app, columns[0]);
render_entities(frame, app, columns[1]);
render_details(frame, app, columns[2]);
frame.render_widget(
Paragraph::new(format!(" {}", app.message)).style(Style::default().fg(Color::DarkGray)),
rows[2],
);
if app.help {
render_help(frame, area);
}
}
fn panel(title: &str, focused: bool) -> Block<'_> {
let style = if focused {
Style::default()
.fg(Color::Cyan)
.add_modifier(Modifier::BOLD)
} else {
Style::default()
};
Block::default()
.borders(Borders::ALL)
.title(format!(
" {title}{} ",
if focused { " · focused" } else { "" }
))
.border_style(style)
}
fn render_status(frame: &mut Frame<'_>, app: &App, area: Rect) {
let staged = if app.workspace.has_staged_changes() {
"changes"
} else {
"clean"
};
let worktree = if app.workspace.has_unstaged_changes() {
"changes"
} else {
"clean"
};
let text = format!(
"HEAD epoch {} · staged: {staged} · worktree: {worktree} · {}\nSummary: {}",
app.workspace.manifest.epoch_id,
app.writer,
value_or_dash(&app.world().summary)
);
frame.render_widget(
Paragraph::new(text).block(Block::bordered().title(" Epoch Forge · read-only browser ")),
area,
);
}
fn render_collections(frame: &mut Frame<'_>, app: &App, area: Rect) {
let items = Collection::ALL
.iter()
.map(|c| ListItem::new(format!("{} ({})", c.name(), c.entities(app.world()).len())));
let mut state = ListState::default().with_selected(Some(app.collection));
frame.render_stateful_widget(
List::new(items)
.block(panel("Collections", app.focus == Focus::Collections))
.highlight_symbol("› ")
.highlight_style(Style::default().add_modifier(Modifier::REVERSED)),
area,
&mut state,
);
}
fn render_entities(frame: &mut Frame<'_>, app: &App, area: Rect) {
let entities = app.entities();
let items: Vec<ListItem<'_>> = if entities.is_empty() {
vec![ListItem::new("No entities")]
} else {
entities
.iter()
.map(|e| ListItem::new(e.name.as_str()))
.collect()
};
let mut state =
ListState::default().with_selected((!entities.is_empty()).then_some(app.entity));
frame.render_stateful_widget(
List::new(items)
.block(panel("Entities", app.focus == Focus::Entities))
.highlight_symbol("› ")
.highlight_style(Style::default().add_modifier(Modifier::REVERSED)),
area,
&mut state,
);
}
fn render_details(frame: &mut Frame<'_>, app: &App, area: Rect) {
let text = app.selected_entity().map_or_else(
|| Text::from("No entity selected."),
|entity| {
let json = serde_json::to_string_pretty(entity)
.unwrap_or_else(|error| format!("Could not display details: {error}"));
Text::from(vec![
Line::from(entity.name.clone()).bold(),
Line::from(format!("@{}", entity.id)),
Line::from(value_or_dash(&entity.description).to_owned()),
Line::from(""),
Line::from(json),
])
},
);
frame.render_widget(
Paragraph::new(text)
.block(panel("Details", app.focus == Focus::Details))
.scroll((app.details_offset, 0))
.wrap(Wrap { trim: false }),
area,
);
}
fn render_help(frame: &mut Frame<'_>, area: Rect) {
let popup = centered_rect(62, 14, area);
frame.render_widget(Clear, popup);
frame.render_widget(Paragraph::new("Tab / Shift-Tab Move focus\narrows, h/j/k/l Navigate\nr Reload from disk\n? Close this help\nq, Esc Close help; then quit\n\nThis checkpoint is read-only. Use efo for changes,\nmigration, recovery, and other repository operations.").block(Block::bordered().title(" Help ")).wrap(Wrap { trim: true }), popup);
}
fn centered_rect(width: u16, height: u16, area: Rect) -> Rect {
let width = width.min(area.width);
let height = height.min(area.height);
Rect::new(
area.x + area.width.saturating_sub(width) / 2,
area.y + area.height.saturating_sub(height) / 2,
width,
height,
)
}
fn value_or_dash(value: &str) -> &str {
if value.trim().is_empty() {
"—"
} else {
value
}
}
fn writer_status(root: &std::path::Path) -> String {
if !root.join(".efo/lock").exists() {
return "writer: unlocked".to_owned();
}
match lib_efo::transaction::inspect_lock(root) {
Ok(lock) => format!("writer: PID {} running {}", lock.pid, lock.command),
Err(error) => format!("writer lock unreadable: {error}"),
}
}
#[cfg(test)]
mod tests {
use super::*;
use lib_efo::{
epoch::EpochId,
repository_format::{RepositoryManifest, RepositorySnapshot},
};
use ratatui::backend::TestBackend;
use std::{collections::BTreeMap, fs};
use uuid::Uuid;
fn app() -> (tempfile::TempDir, App) {
let temp = tempfile::tempdir().expect("temporary repository");
let world = EpochInfo::default();
let repository_id = Uuid::nil();
let manifest = RepositoryManifest::new(
repository_id,
EpochId::new(0),
EpochId::new(1),
"test".into(),
BTreeMap::new(),
);
let transient = RepositorySnapshot::new(repository_id, EpochId::new(0), world.clone());
fs::create_dir_all(temp.path().join("epoch/0")).expect("history directory");
fs::create_dir_all(temp.path().join(".efo")).expect("state directory");
fs::write(
temp.path().join(".epoch"),
serde_json::to_vec(&manifest).expect("manifest"),
)
.expect("write manifest");
fs::write(
temp.path().join("epoch/0/epochinfo.json"),
serde_json::to_vec(&world).expect("world"),
)
.expect("write world");
let bytes = serde_json::to_vec(&transient).expect("transient state");
fs::write(temp.path().join(".efo/index.json"), &bytes).expect("write index");
fs::write(temp.path().join(".efo/worktree.json"), bytes).expect("write worktree");
let app = App::open(temp.path().to_owned()).expect("open test repository");
(temp, app)
}
#[test]
fn focus_and_help_navigation_are_predictable() {
let (_temp, mut app) = app();
assert!(!app.handle_key(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE)));
assert_eq!(app.focus, Focus::Entities);
app.handle_key(KeyEvent::new(KeyCode::Char('?'), KeyModifiers::NONE));
assert!(app.help);
assert!(!app.handle_key(KeyEvent::new(KeyCode::Char('q'), KeyModifiers::NONE)));
assert!(!app.help);
assert!(app.handle_key(KeyEvent::new(KeyCode::Char('q'), KeyModifiers::NONE)));
}
#[test]
fn empty_repository_render_has_semantic_labels() {
let mut terminal = Terminal::new(TestBackend::new(80, 20)).expect("test terminal");
let (_temp, app) = app();
terminal.draw(|f| render(f, &app)).expect("draw");
let text = terminal.backend().to_string();
assert!(text.contains("HEAD epoch 0"));
assert!(text.contains("staged: clean"));
assert!(text.contains("Characters (0)"));
assert!(text.contains("No entities"));
}
#[test]
fn compact_terminal_explains_minimum_size() {
let mut terminal = Terminal::new(TestBackend::new(40, 10)).expect("test terminal");
let (_temp, app) = app();
terminal.draw(|f| render(f, &app)).expect("draw");
let text = terminal.backend().to_string();
assert!(text.contains("needs at least"));
assert!(text.contains("54×14"));
assert!(text.contains("Press q to quit"));
}
}