Add interactive snapshot comparison, CLI tests and treegen

--compare opens the TUI with growth/shrink colouring unless a report is
requested. treegen builds deterministic synthetic trees (Unicode,
hostile names, sparse files). MAPSIZE_DEBUG_PANIC verifies terminal
restoration on UI and scanner panics.
This commit is contained in:
Andy Dixon
2026-10-02 08:28:52 +01:00
parent df8b10c6dd
commit 0e5b9f7cc3
10 changed files with 288 additions and 20 deletions
+13
View File
@@ -4,6 +4,8 @@ import (
"context"
"fmt"
"os"
"runtime/debug"
"time"
tea "charm.land/bubbletea/v2"
"github.com/charmbracelet/colorprofile"
@@ -47,6 +49,17 @@ func Run(opts Options) error {
select {} // park the broken goroutine; the program is quitting
}
defer func() { scan.OnPanic = prev }()
if debugPanic == "scanner" {
go func() {
time.Sleep(500 * time.Millisecond)
defer func() {
if v := recover(); v != nil {
scan.OnPanic(v, debug.Stack())
}
}()
panic("MAPSIZE_DEBUG_PANIC=scanner: deliberate panic to test terminal restoration")
}()
}
_, err = p.Run()
cancel()