Skip to content

feat: a live home screen, one consistent terminal UI, faster and safer commands - #47

Merged
tushar-mahalya merged 4 commits into
mainfrom
feat/terminal-overhaul
Nov 16, 2026
Merged

tushar-mahalya merged 4 commits into
mainfrom
feat/terminal-overhaul

Conversation

@tushar-mahalya

Copy link
Copy Markdown
Member

What and why

The terminal UI felt inconsistent and slow. This rebuilds it as one system, fixes the bugs found along the way, and moves the README's diagrams to the website so the PyPI page renders cleanly.

Terminal UI

  • Bare kdev is a live home screen (an inline prompt_toolkit app, src/kdev/menu.py): usable immediately while the box and every account's quota load in the background. Every action has a key, arrows/j/k/Enter work, the highlighted item shows the exact command it runs, a running box counts down, and the active account's bar previews the next box's quota use. It folds for short terminals.
  • One-line headers everywhere except the front door; cards, spinners and prompts share one gutter; numbered prompts where a digit picks; kdev up progress drawn as a rail with live clocks and "usually Ns" from earlier runs; a time-left bar in status and the ready card.
  • Piped output is data: real tab-separated tables, no wrapping, advice on stderr. ASCII-only terminals degrade instead of crashing.
  • Usage errors in kdev's voice with did-you-mean; quota refill time in account and the home screen; branded --help with examples.

Speed (measured on real accounts): status 13.4s → ~5s, history 61s → 18s (1s cached), home screen draws at once instead of after ~20s.

Fixes: token re-minting that overwrote ~/.kaggle/credentials.json; offline crashes; safety.check treating any error as "empty notebook"; duplicate group bindings on share; stale/shadowed ~/.ssh/config blocks; pam_env dropping the notebook PATH over ssh; backup replacing a good copy with a partial box; 429 handling; missing ssh timeouts; broken-pipe exit status; tests that reached the network.

Docs: README without mermaid (PyPI-friendly); diagrams on a new /docs/how-it-works/ page and in docs/ARCHITECTURE.md. Note: the nav's "How it works" now links to that page instead of /#how.

How I checked it

  • 482 tests (new: menu, auth, sshcfg, api errors, hermetic guard, prefix paging, history cache, timings), basedpyright, all pre-commit hooks.
  • Every command driven in a real pty at 14–40 rows and 60–110 columns, with NO_COLOR, ASCII and piped output; colour renders checked on dark and light backgrounds.
  • Three full CPU-box cycles against real Kaggle (kdev up --gpu none): up, status, home menu, forward (HTTP 200 through the tunnel), ssh --, logs, reconnect, status as a second account, down → saved. PATH over non-interactive ssh verified on the box.

Checklist

  • A bug fix comes with a test that fails without it; new behaviour with a test that would catch it breaking
  • uv run pytest and uv run pre-commit run --all-files pass locally
  • What users will notice is under ## [Unreleased] in CHANGELOG.md
  • The README is updated if a command or its behaviour changed

…r commands

The terminal UI, rebuilt as one system:
- Bare `kdev` is a live menu: usable at once while the box and quota load,
  a key per action, the command each item runs shown as you move, a running
  box counting down, and the next box's quota use previewed. It folds for
  short terminals.
- One-line headers outside the front door; cards, spinners and prompts on
  one gutter; numbered prompts where a digit picks; `up` drawn as a rail
  with live clocks and remembered step timings; a time-left bar.
- Piped output is data: tab-separated tables, no wrapping, advice on stderr.
  ASCII-only terminals get ASCII stand-ins instead of crashing.
- Usage errors in kdev's voice, with did-you-mean for commands, settings
  and accelerators. Quota refill time in `account` and the home screen.

Speed: `status` 13s -> ~5s (state read without paging the whole listing),
`history` 61s -> 18s, ~1s when cached; keep-alive HTTP; parallel reads.

Fixes: tokens were re-minted on every call and written into the official
CLI's ~/.kaggle/credentials.json; offline commands crashed; a transient error
could let `up` overwrite notebook code; duplicate group bindings; stale or
shadowed ~/.ssh/config blocks; pam_env dropping the notebook PATH over ssh;
`backup` overwriting a good copy with a partial box; 429s not waited out;
ssh calls without timeouts; broken pipes exiting 1; tests that reached the
network.
The README no longer carries mermaid (PyPI cannot render it). The diagrams
and technical detail move to a new /docs/how-it-works/ page, drawn in the
site's own style, and to docs/ARCHITECTURE.md for contributors. The site's
`kdev up` replay, command reference and everyday-use page match the new
terminal UI, and the changelog records it all.
Comment thread tests/test_ui.py Fixed
Comment thread tests/test_ui.py Fixed
Comment thread website/src/lib/plain-markdown.ts Fixed
Rich keeps each parsed Style's ANSI codes from the first colour system it
rendered for. Under GITHUB_ACTIONS, Typer renders help through a 16-colour
console, so the logo test later saw cyan (36) instead of #00b8d4. The test
fixture now clears Rich's style caches.

The docs' plain-text outputs strip figure-caption markup until none is
left, which also clears CodeQL's multi-character sanitisation alert.
@tushar-mahalya
tushar-mahalya merged commit fd03fbd into main Nov 16, 2026
15 checks passed
@tushar-mahalya
tushar-mahalya deleted the feat/terminal-overhaul branch November 16, 2026 05:11

This branch was successfully deployed

1 active deployment
preview — 062600df Deployed Nov 16, 2026 by tushar-mahalya via preview URL #6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants