feat: switch between named GitHub profiles from the TUI#12
Open
sashml wants to merge 2 commits into
Open
Conversation
added 2 commits
July 17, 2026 09:51
Add a profile switcher so you can juggle multiple contexts (work vs. personal, public github.com vs. a GitHub Enterprise host) without editing config or restarting. - Config: optional [[profiles]] array, each a named body of the existing github/dashboard/cache/ui fields, plus an optional active_profile. When no profiles are defined, the top-level config is treated as a single "default" profile, so existing configs are unchanged. - Per-profile token resolution, never persisted: token_env (env var NAME) -> GITHUB_TOKEN -> `gh auth token --hostname <host>` -> GH_TOKEN. Per-profile api_url supports Enterprise hosts; api.github.com maps to github.com for gh. - Per-profile cache namespace (cache dir / <profile-name>) so switching never shows another profile's cached data. - Modal picker on `p`: centered, type-to-filter, arrow-key navigation, Enter switches, Esc cancels; the active profile is marked and always shown as a status-bar chip. Switching drops the old client, rebuilds it for the new profile's token + api_url, clears the PR set, and re-fetches. - Help overlay and README document the `p` binding, the chip, and the profiles config + token handling. Tokens are never logged, rendered, cached, or serialized. Adds tests covering the config schema and back-compat, host mapping, token resolution order, cache isolation, the picker reducer, and secret hygiene (no token in serialized or rendered output). Signed-off-by: sashml <ml.den@disruptinc.io>
… github.com A profile api_url that doesn't end in /graphql previously fell back to api.github.com for REST (diff) calls — sending that profile's token to the wrong host (incorrect + a token-leak risk for Enterprise). Derive the REST base from the api_url's host instead, warn once, and keep public github.com behavior. Adds rest_base tests incl. the Enterprise no-github-fallback case. Signed-off-by: sashml <ml.den@disruptinc.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Profile switcher: switch GitHub contexts from inside the TUI
Adds named profiles so you can juggle multiple contexts — work vs. personal, public github.com vs. a GitHub Enterprise host — and switch between them from the TUI with a keypress, no restart or config editing.
Config (
[[profiles]], back-compatible)Each profile is a named body of the existing
github/dashboard/cache/uifields, plus an optional top-levelactive_profile. If no profiles are defined, the top-level config is treated as a singledefaultprofile — existing configs work unchanged.Behavior
popens a centered, type-to-filter modal picker (arrows navigate, Enter switches, Esc cancels). The active profile is marked and always shown as a status-bar chip.api_url, clears the PR set, and re-fetches.token_env→GITHUB_TOKEN→gh auth token --hostname <host>→GH_TOKEN.api.github.commaps togithub.comforgh; Enterprise hosts are used as-is.<cache-dir>/<profile-name>/) so switching never shows another profile's cached data.gh— never written to config, cache, logs, or the UI.Tests
Adds coverage for the config schema and back-compat, host mapping, token resolution order, cache isolation, the picker reducer, and a check that no token value appears in serialized config or rendered output.
cargo test,cargo clippy --all-targets -- -D warnings, andcargo fmt --checkall pass.