Configuration¶
uh keeps its settings in one TOML file, config.toml. The review queue, parse cache and
cloned repositories live in separate locations. This page covers config keys, file format,
every path uh reads or writes, environment variables, and cache clearing. For full flag
tables, see the CLI reference.
uh config¶
uh config reads and edits the config file.
| Subcommand | Does |
|---|---|
path |
Prints the resolved config file path. Works even if the file does not exist yet. |
list |
Prints every key as key=value, in a fixed order, with effective values. |
get <KEY> |
Prints the value of one key. Prints nothing if the key is unset. |
set <KEY> <VALUE> |
Checks the value, then saves it. Prints nothing on success. |
unset <KEY> |
Sets the key back to its default and saves. |
--config <PATH> is global and works before or after the subcommand. It overrides the
lookup order for one command.
$ uh config path
/Users/me/.config/uhdiff/config.toml
$ uh config list
default_gh_account=(unset)
theme=(unset)
repo_cache_dir=(default)
parse_cache_enabled=true
parse_cache_dir=(default)
progress=auto
$ uh config set theme dark
$ uh config set default_gh_account octocat
$ uh config set parse_cache_dir /var/tmp/uh-parse
$ uh config get theme
dark
$ uh config unset theme
$ uh config get theme
$
set and unset create the file and parent directories if missing. uh writes atomically:
it writes a temporary sibling file, then renames it. Keys uh config does not manage, such as
[ui_settings], stay unchanged.
Errors¶
An invalid key or value makes the command exit with status 1 and leaves the file unchanged:
$ uh config set nope 1
uhdiff: unknown config key 'nope'
$ uh config set theme sepia
uhdiff: invalid value 'sepia' for 'theme': expected 'light', 'dark', or 'auto'
$ uh config set progress maybe
uhdiff: invalid value 'maybe' for 'progress': expected 'true', 'false', or 'auto'
$ uh config set parse_cache_enabled yes
uhdiff: invalid value 'yes' for 'parse_cache_enabled': expected 'true' or 'false'
$ uh config set default_gh_account " "
uhdiff: invalid value for 'default_gh_account': must be non-empty (use 'unset' to clear)
repo_cache_dir and parse_cache_dir reject an empty value the same way:
invalid value for '<key>': must be a non-empty path (use 'unset' to clear).
A config file that does not parse fails any command that loads it:
uhdiff: invalid config at '<path>': <parser message>.
Keys¶
| Key | Type | Accepted values | Default | Read by |
|---|---|---|---|---|
default_gh_account |
string | Any non-empty gh login |
unset | uh review, uh queue, uh explore: picks the gh account for GitHub URLs when more than one is logged in. --gh-account overrides it. |
theme |
string | light, dark, auto |
unset | Web UI: sets the starting color theme. auto and unset both follow the browser's prefers-color-scheme. |
repo_cache_dir |
path | Any non-empty path | unset (see Repository clone cache) | uh review, uh queue, uh explore: where GitHub and remote repositories are cloned. |
parse_cache_enabled |
bool | true, false |
true |
uh graph: turns the on-disk incremental parse cache on or off. |
parse_cache_dir |
path | Any non-empty path | unset (see Parse cache) | uh graph: where the parse cache is stored. |
progress |
bool or auto |
true, false, auto |
auto |
uh graph, uh review, uh queue, uh explore: false turns off the stderr progress output. |
Notes on the keys:
- In
listoutput, unset path keys show as(default)and unset string keys show as(unset). progress:autoandtruebehave the same. Progress draws on stderr only when stderr is a terminal.set progress autoremoves the key. Foruh graph, the--progress auto|always|plain|offflag overrides this key.parse_cache_enabled:uh graph --no-cachedisables the cache for one run.--cacheor--cache-direnables it for one run, even when the key isfalse.--cache-diroverridesparse_cache_dir.default_gh_accountcan also be saved withuh review --set-default-gh-account <login>or from the web UI. See Who writes the file.
File format¶
The config file is TOML. Every key is optional. uh writes only keys whose values differ from
the default. Example with every key set:
default_gh_account = "octocat"
theme = "dark" # light | dark | auto
repo_cache_dir = "/var/tmp/uh-repos"
parse_cache_enabled = false # only written when false
parse_cache_dir = "/var/tmp/uh-parse"
progress = false # true | false; omit for auto
[ui_settings] # written by the web UI settings panel
scroll_align = "top"
auto_hide_topbar = false
If the path given with --config, --settings-path or UHDIFF_CONFIG ends in .json, uh
reads and writes that file as JSON with the same keys.
[ui_settings]¶
The review web UI saves settings to the [ui_settings] table of the same file. uh config
does not read or edit these keys. Change them in the UI settings panel or edit the file by hand.
A key is stored only when it differs from the default. Setting it back to the default removes
it.
| Key | Type | Default | Stored when |
|---|---|---|---|
scroll_align |
"center" or "top" |
"center" |
"top" |
auto_hide_topbar |
bool | true |
false |
dedent_symbols |
bool | true |
false |
show_place_strip |
bool | false |
true |
show_internals_bar |
bool | false |
true |
ast_diff |
bool | false |
true |
classic |
bool | false |
true |
inlay_diffs |
bool | true |
false |
uh review --ast-diff, --classic and --inlay-diffs enable the matching setting for one run.
They do not write to the file. See the web UI for what each setting does.
Who writes the file¶
| Writer | Keys written |
|---|---|
uh config set / unset |
The six keys in Keys |
uh review --set-default-gh-account <login> |
default_gh_account. An empty login ("") removes it. With no target, --diff or --base, uh saves the login, prints Saved default GitHub account '<login>' to <path>, and exits. |
| Web UI (account picker, theme toggle, settings panel) | default_gh_account, theme, [ui_settings] |
Each writer reads the file first and keeps the keys it does not manage.
settings.json and config.json¶
Older versions stored settings in settings.json and config.json in the same directory.
uh reads them only when the config path is the default config.toml and that file does not
exist. It then reads the first match:
config.tomlconfig.jsonsettings.json
The next write goes to config.toml and copies the legacy values. The legacy file stays in
place and is ignored afterward.
--settings-path is the config path
uh review, uh queue and uh explore take --settings-path <PATH>. It points at the same
file as uh config --config and resolves the same way. Some --help text still names
~/.config/uhdiff/settings.json, but uh reads and writes config.toml.
File locations¶
uh uses the first match in each column. An environment variable that is set but empty counts
as unset.
| File | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
Config (config.toml) |
--config / --settings-path |
$UHDIFF_CONFIG |
$XDG_CONFIG_HOME/uhdiff/config.toml |
$HOME/.config/uhdiff/config.toml |
|
Review queue (queue.json) |
--queue-file |
$UHDIFF_QUEUE_FILE |
$XDG_DATA_HOME/uhdiff/queue.json |
$HOME/.local/share/uhdiff/queue.json (%USERPROFILE% if HOME is unset) |
|
| Repository clone cache | config repo_cache_dir |
$UHDIFF_REPO_CACHE_DIR |
$XDG_CACHE_HOME/uhdiff/repos |
$HOME/.cache/uhdiff/repos |
|
| Parse cache | uh graph --cache-dir |
config parse_cache_dir |
$XDG_CACHE_HOME/uhdiff/parse |
$HOME/.cache/uhdiff/parse |
uh graph has no --config flag. It finds the config through UHDIFF_CONFIG,
XDG_CONFIG_HOME or HOME. If the file is missing or does not parse, uh graph uses defaults.
The queue file is described in Queue.
Repository clone cache¶
uh review, uh queue and uh explore keep one bare clone per remote repository:
Later runs fetch only missing refs. Each review checks out a temporary detached worktree from
the bare clone and removes it when the review ends. The .lock file stops two uh processes
from changing the same clone at once. A process waits up to 30
seconds for the lock, then fails with
timed out waiting for repository cache lock '<path>'. A lock older than 120 seconds is stale
and gets taken over.
Parse cache¶
uh graph stores parse results, so later runs re-parse only changed files. The cache has one
subdirectory per repository, named by a 16-digit hex hash of its canonical path. A file is
reused when its modification time and size match. Pass --cache-verify-hash to compare
content hashes instead. See Graph for cache flags.
Environment variables¶
| Variable | Effect |
|---|---|
UHDIFF_CONFIG |
Path of the config file. Used when no --config or --settings-path is given. |
XDG_CONFIG_HOME |
Config file is $XDG_CONFIG_HOME/uhdiff/config.toml. |
XDG_DATA_HOME |
Queue file is $XDG_DATA_HOME/uhdiff/queue.json. |
XDG_CACHE_HOME |
Cache root is $XDG_CACHE_HOME/uhdiff (repos/ and parse/). |
HOME |
Fallback base for all of the above. uh install also uses it to find harness directories. |
USERPROFILE |
Fallback for HOME when resolving the queue file only. |
UHDIFF_QUEUE_FILE |
Path of the queue file. Used when no --queue-file is given. |
UHDIFF_REPO_CACHE_DIR |
Root of the repository clone cache. Used when repo_cache_dir is not set in the config. |
GH_TOKEN, GITHUB_TOKEN |
GitHub token for github.com. The first non-empty one is used. |
GH_ENTERPRISE_TOKEN |
GitHub token for hosts other than github.com. Checked before GH_TOKEN and GITHUB_TOKEN. |
UHDIFF_PARSER |
tree-sitter or ts (any case) selects the upstream tree-sitter runtime. Any other value selects the default seated-tree runtime. Only read by builds made with --//crates/seated-tree:backend=runtime-switch (Bazel) or the seated-tree/runtime-switch Cargo feature. Release builds ignore it. |
For GitHub targets, uh calls the gh CLI. For a host other than github.com, it sets
GH_HOST for that gh process. See Review for account selection.
Clearing caches¶
Deleting either cache is safe. uh rebuilds it on the next run. Do not delete caches while
uh runs.
To skip the parse cache without deleting it, run uh graph --no-cache, or turn it off for all
runs:
To reset the config, delete the file that uh config path prints.