feat(config-settings): four-page TUI (Universal · Session · Sponge · Paths) #66

Merged
rootiest merged 14 commits from feat/config-settings-pages into main 2026-07-04 05:26:11 +00:00
Owner

Summary

Extends the config-settings TUI from a two-scope toggle table into a four-page interface, surfacing non-boolean settings (sponge tuning, scrollback/path variables) that previously required editing files by hand.

Pages cycle with Tab / Shift-Tab:

Page Contents Scope
Universal the 6 opinionated-category toggles + master set -U
Session same toggles, this shell only set -g
Sponge sponge_delay, sponge_purge_only_on_exit, sponge_allow_previously_successful, sponge_successful_exit_codes, __fish_sponge_extra_sensitive universal
Paths __fish_scrollback_history_dir, __fish_scrollback_history_max_files, __fish_user_dots_path (moved off the toggle table) universal

Toggle rows use ←/→ (OFF ← DEFAULT → ON); value rows (path/int/list) edit inline with Enter and clear with .

New row-type model

Each row is typed (toggle / bool / path / int / list); draw and event-handling dispatch on the type. New helpers: __config_settings_pagetab, __config_settings_draw_value, __config_settings_get_raw, __config_settings_set_value. Every page renders exactly 16 lines, preserving the existing wrap-aware redraw geometry.

Scrollback variables

__fish_scrollback_history_dir / _max_files are now the fish-style source of truth; config.fish exports the SCROLLBACK_HISTORY_* mirrors the POSIX wrappers (paru/yay/tmux/zellij logging, _prune_terminal_logs) read. It deliberately avoids creating a global source var, which would shadow the universal and break live edits.

Bugs fixed along the way

  • Sponge Layer-2 privacy (pre-existing): string match -r returned token substrings, so secret values were never actually scrubbed for non-exact var names (e.g. GITHUB_TOKEN matched as TOKEN → unset deref → skipped). Fixed with --entire. __fish_sponge_extra_sensitive lets users add their own credential name tokens.
  • Sponge booleans now write true/false (sponge's convention), not on/off.
  • Two command-substitution-in-quoted-index runtime errors in the event loop; a box-width overflow; set -- input hardening.

Variables added / surfaced

  • __fish_scrollback_history_dir, __fish_scrollback_history_max_files (new source-of-truth; mirror exported)
  • __fish_sponge_extra_sensitive (new; extra credential name tokens)
  • Existing sponge tuning vars now editable via the TUI

Docs: docs/fish-config.md (§ Scrollback History, § Sponge History Filtering, config-settings reference), docs/fish-config.index, and README.md updated. The man page / HTML / wiki are CI-regenerated.

Manual Verification

  • Run config-settings; Tab cycles Universal → Session → Sponge → Paths, Shift-Tab reverses.
  • Panel stays aligned (no stacked/ragged borders) on redraw at a narrow (<82 col) and wide (≥90 col) terminal, and after resizing live.
  • Universal/Session: ←/→ move a category toggle OFF ← DEFAULT → ON; the value persists (set -U vs set -g per page).
  • Sponge: Delay, OK codes, Extra secret edit via Enter; Purge@exit and Allow prev toggle via ←/→ and show ON/OFF correctly.
  • Toggle Allow prev and confirm set -U sponge_allow_previously_successful holds true/false (not on/off): set -S sponge_allow_previously_successful.
  • Add a token on Extra secret (e.g. ACME_API); in a fresh shell, set -gx ACME_API_KEY hunter2hunter2 then run it — the command's value is scrubbed from history (history | grep hunter2 returns nothing).
  • Paths: edit Log dir via Enter; after exiting, echo $SCROLLBACK_HISTORY_DIR reflects the new path in the same session; on the row clears it back to default.
  • Dots path edits and clears on the Paths page (no longer on the toggle table).
  • config-toggle still prints its deprecation notice and delegates.
  • q / Esc exit cleanly with the cursor restored.
## Summary Extends the `config-settings` TUI from a two-scope toggle table into a **four-page** interface, surfacing non-boolean settings (sponge tuning, scrollback/path variables) that previously required editing files by hand. Pages cycle with `Tab` / `Shift-Tab`: | Page | Contents | Scope | |---|---|---| | **Universal** | the 6 opinionated-category toggles + master | `set -U` | | **Session** | same toggles, this shell only | `set -g` | | **Sponge** | `sponge_delay`, `sponge_purge_only_on_exit`, `sponge_allow_previously_successful`, `sponge_successful_exit_codes`, `__fish_sponge_extra_sensitive` | universal | | **Paths** | `__fish_scrollback_history_dir`, `__fish_scrollback_history_max_files`, `__fish_user_dots_path` (moved off the toggle table) | universal | Toggle rows use `←/→` (OFF ← DEFAULT → ON); value rows (path/int/list) edit inline with `Enter` and clear with `←`. ### New row-type model Each row is typed (`toggle` / `bool` / `path` / `int` / `list`); draw and event-handling dispatch on the type. New helpers: `__config_settings_pagetab`, `__config_settings_draw_value`, `__config_settings_get_raw`, `__config_settings_set_value`. Every page renders exactly 16 lines, preserving the existing wrap-aware redraw geometry. ### Scrollback variables `__fish_scrollback_history_dir` / `_max_files` are now the fish-style source of truth; `config.fish` exports the `SCROLLBACK_HISTORY_*` mirrors the POSIX wrappers (paru/yay/tmux/zellij logging, `_prune_terminal_logs`) read. It deliberately avoids creating a global source var, which would shadow the universal and break live edits. ### Bugs fixed along the way - **Sponge Layer-2 privacy (pre-existing):** `string match -r` returned token *substrings*, so secret **values** were never actually scrubbed for non-exact var names (e.g. `GITHUB_TOKEN` matched as `TOKEN` → unset deref → skipped). Fixed with `--entire`. `__fish_sponge_extra_sensitive` lets users add their own credential name tokens. - **Sponge booleans** now write `true`/`false` (sponge's convention), not `on`/`off`. - Two command-substitution-in-quoted-index runtime errors in the event loop; a box-width overflow; `set --` input hardening. ## Variables added / surfaced - `__fish_scrollback_history_dir`, `__fish_scrollback_history_max_files` (new source-of-truth; mirror exported) - `__fish_sponge_extra_sensitive` (new; extra credential name tokens) - Existing sponge tuning vars now editable via the TUI Docs: `docs/fish-config.md` (§ Scrollback History, § Sponge History Filtering, config-settings reference), `docs/fish-config.index`, and `README.md` updated. The man page / HTML / wiki are CI-regenerated. ## Manual Verification - [x] Run `config-settings`; `Tab` cycles Universal → Session → Sponge → Paths, `Shift-Tab` reverses. - [x] Panel stays aligned (no stacked/ragged borders) on redraw at a **narrow** (<82 col) and **wide** (≥90 col) terminal, and after resizing live. - [x] **Universal/Session:** `←/→` move a category toggle OFF ← DEFAULT → ON; the value persists (`set -U` vs `set -g` per page). - [x] **Sponge:** `Delay`, `OK codes`, `Extra secret` edit via `Enter`; `Purge@exit` and `Allow prev` toggle via `←/→` and show ON/OFF correctly. - [x] Toggle `Allow prev` and confirm `set -U sponge_allow_previously_successful` holds **`true`/`false`** (not `on`/`off`): `set -S sponge_allow_previously_successful`. - [x] Add a token on `Extra secret` (e.g. `ACME_API`); in a fresh shell, `set -gx ACME_API_KEY hunter2hunter2` then run it — the command's value is scrubbed from history (`history | grep hunter2` returns nothing). - [x] **Paths:** edit `Log dir` via `Enter`; after exiting, `echo $SCROLLBACK_HISTORY_DIR` reflects the new path in the **same** session; `←` on the row clears it back to default. - [x] `Dots path` edits and clears on the Paths page (no longer on the toggle table). - [x] `config-toggle` still prints its deprecation notice and delegates. - [x] `q` / `Esc` exit cleanly with the cursor restored.
rootiest added 11 commits 2026-06-24 04:51:30 +00:00
A global __fish_scrollback_history_dir/_max_files would shadow the universal
that config-settings writes, defeating live mirror updates and stale-displaying
the value until restart. Export the default, override from the universal only
if set.
- §1 Scrollback History: __fish_scrollback_history_* source-of-truth + exported
  mirror, and the no-global-shadow rationale
- §Sponge History Filtering: __fish_sponge_extra_sensitive name tokens (--entire
  match) and the tuning vars surfaced on the Sponge page
- config-settings function reference: four-page model, Tab/Shift-Tab, value rows
- index + README updated
- C1: sponge_purge_only_on_exit / sponge_allow_previously_successful are 'bool'
  rows that write true/false (sponge's convention), not on/off; badge maps
  true->ON, false->OFF, unset->DEFAULT
- I1: shorten value-page hint to 49 cols so it fits the 50-wide tier
- M1: set -U -- before the var name guards typed values beginning with a dash
rootiest added 1 commit 2026-06-24 14:47:11 +00:00
A blank or escaped inline edit, and the ← clear, previously erased the variable.
sponge reads sponge_delay / sponge_purge_only_on_exit / sponge_allow_previously_
successful with no fallback, so an unset value crashed the prompt
('test: Missing argument'). Fixes:

- Value rows reset to a per-row default value (sponge_delay→2, exit_codes→0) or
  erase only when the var tolerates unset (paths, extra-sensitive list).
- Blank/escaped Enter reverts to that default instead of writing empty.
- Sponge booleans are now a 2-state true/false (sponge's convention), never unset.
- Defensive set -q;or set -l fallbacks added to the sponge consumer functions so
  a transiently-unset var can never error the prompt.
rootiest added 1 commit 2026-06-24 15:14:07 +00:00
Replace the fish `read` prompt (which showed an unstyled `read>` and left the
prompt line behind on redraw) with an in-place editor built on the raw key
reader. The value is edited directly in its UI field with a block caret; the
panel redraws each keystroke and cleans up on exit. Pre-fills the current value;
Backspace deletes, Enter saves (empty reverts to default), Esc cancels.

- __config_settings_read_key: decode Backspace (bytes 8/127)
- __config_settings_draw_value: edit-mode field with caret + edit hint line
- config-settings: inline edit loop replaces the read-based prompt block
rootiest added 1 commit 2026-06-24 15:17:50 +00:00
Previously list rows (Extra secret, OK codes) split on spaces only, so
'KOPIA, TEST' produced the malformed token 'KOPIA,'. Collapse any run of
commas/whitespace to a single space before splitting, so 'A,B', 'A, B' and
'A B' all yield the same entries.
rootiest merged commit 83d5bd2d40 into main 2026-07-04 05:26:11 +00:00
rootiest deleted branch feat/config-settings-pages 2026-07-04 05:26:12 +00:00
Sign in to join this conversation.