feat(config-settings): curses prototype front-end

Add scripts/config-settings-tui.py, a stdlib-curses prototype of the
config-settings interface, plus a gate that runs its --self-test.

The backend is stubbed: values live in an in-memory dict and nothing is
read from or written to fish variables. This is here to evaluate the
render engine and the interaction model before committing to a rewrite.

Why curses rather than more ANSI arithmetic:

  - No flicker, structurally. curses diffs its virtual screen against the
    physical one and emits only the changed cells, which is what
    __config_settings_diff_redraw.fish reimplements by hand.
  - Alternate screen plus absolute addressing. Stray output cannot desync
    the display, so the bug class behind 608b022 (fish's read prompt),
    4210f3b (a shadow warning on stderr), 93fc5e0 and 3c4f720 (line wrap
    breaking the erase height) cannot occur at all.
  - Resize is a repaint rather than wrap-factor arithmetic.
  - Overlays, panes, live filtering and mouse input cost a few lines each.

The layout departs from the current single panel: a page sidebar with a
live filter on the left, a scrolling detail pane on the right, a help
overlay on '?', and mouse selection. Sub-category drill-down, the
tri-state badges and the Sponge/Paths value rows all carry over.

Dependency note: python3 with the curses module. That is stdlib on Arch,
Fedora and a full Debian/Ubuntu python3; python3-minimal alone does not
carry _curses, so the test asserts the import.

The prototype is not wired into config-settings and nothing existing
changed.
This commit is contained in:
2026-09-09 14:29:40 -04:00
parent 69de224cbf
commit c5d2624a06
2 changed files with 665 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env fish
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Gate for the curses config-settings PROTOTYPE (scripts/config-settings-tui.py).
#
# Runs isolated (no `# MODE:` marker). Two things are checked, and only two:
#
# 1. python3 can import `curses`. On Arch, Fedora and a full Debian/Ubuntu
# python3 this is stdlib and always true, but python3-minimal alone does
# not carry _curses -- the one portability claim the prototype makes.
# 2. The prototype's own --self-test passes. That covers the pure state
# machine (value cycling, filtering, sub-category lookup, badge and
# ellipsis rendering) with no TTY, which is all a test runner has.
#
# The drawing code is deliberately NOT golden-tested. That is the whole
# argument for the prototype: curses owns the cell arithmetic, so there is no
# hand-tuned width/pad/dash math to pin down the way
# test-config-settings-render.fish has to pin the fish renderer's.
source (dirname (status filename))/lib.fish
set -l tui $repo_root/scripts/config-settings-tui.py
section "config-settings-tui: prerequisites"
check "scripts/config-settings-tui.py is executable" true (test -x $tui; and echo true; or echo false)
check "python3 is available" true (type -q python3; and echo true; or echo false)
check "python3 ships the curses module" 0 (python3 -c 'import curses' >/dev/null 2>&1; echo $status)
section "config-settings-tui: self-test"
check "--self-test passes" 0 (python3 $tui --self-test >/dev/null 2>&1; echo $status)
report