fix: single-key TTY menu UX for the Gitea config menu (#36) #37
Reference in New Issue
Block a user
Delete Branch "fix/issue-36-config-menu-ux"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #36. Refs #31, #34.
What
Make the interactive profile menu (
./scripts/gitea-config-menu) feel like a real terminal menu, via a new injectableMenuIO. No menu logic, no MCP runtime, no auth/secret-storage changes.UX
termios/ttyraw read) — no Enter. Non-TTY/test runs fall back to line input.0) on the main menu quits; Enter cancels any submenu / profile prompt and returns.1–9, explicitm) type a name manually, Enter cancels; empty config handled gracefully.Press any key to continuein a TTY; non-TTY never blocks.Helpers:
read_key(viadefault_io),choose_menu_option,choose_profile,clear_screen,pause_for_key, andMenuIO(is_tty, clear_enabled). TTY detected viasys.stdin.isatty()+sys.stdout.isatty(); stdlib only.Safety (unchanged)
No tokens/passwords printed; no raw config dumps; no
.env.personal; no change to auth behavior or secret storage. Secret scan of changed files: clean.Tests
Rewrote menu tests around a scripted
_FakeIO(no real terminal/keychain/network): single-key select + clear-called, main-menu Enter/0quit, submenu Enter cancel leaves config unchanged, chooser lists/selects-by-key/no-profiles/manual-entry/out-of-range, non-TTY line fallback (default_io), clear-only-when-enabled, pause never hangs in non-TTY, and an add-flow asserting the token value never reaches disk or stdout.Checks
py_compileclean.printf '0\n' | ./scripts/gitea-config-menu→ renders menu, quits cleanly, no hang, no clear codes.Files changed
gitea_config_menu.py,tests/test_config_menu.py,docs/llm-workflow-runbooks.md.scripts/gitea-config-menuunchanged.⚠️ Authored by me — do not self-merge. Needs review by another author.
Pull request closed