feat(config): follow XDG Base Directory spec for config location - #1503
feat(config): follow XDG Base Directory spec for config location#1503jared-outpost[bot] wants to merge 3 commits into
Conversation
Resolve the config/data directory via the XDG Base Directory specification instead of always using `~/.sentry`. Precedence: 1. `SENTRY_CONFIG_DIR` override (unchanged, highest priority) 2. Legacy `~/.sentry` when it already exists (no breakage for existing installs) 3. `/sentry`, defaulting to `~/.config/sentry` A non-absolute `XDG_CONFIG_HOME` is ignored per the spec. This keeps credentials and caches out of the home directory root, which also unblocks environments (e.g. coding agents) that restrict writes to `/root`. Fixes #1502
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
CI green on the feature branch (check_suite success). Self-review clean. Marking ready and requesting review from the issue author. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2c52b8d. Configure here.
…onfig.json A bare ~/.sentry/bin created by the curl installer should not prevent new XDG-based installs. The legacy check now requires the presence of the actual database or the old JSON config file. Fixes the Cursor Bugbot report on PR #1503.
|
Jared, we need to do the following:
|
|
ack — will update binary install paths to follow XDG (via resolveConfigDir) and add migration logic inside |
|
Jared, update the patch already? |
|
working on it — expanding to XDG-aware binary paths + migration inside setup. will push the update shortly. |
|
yep, expanding the patch now to also move binary install paths to XDG (via XDG_BIN_HOME / ~/.local/bin) and add migration inside setup. will push the update. |
|
expanding the patch now to cover XDG binary paths + migration in setup. pushing shortly. |
|
not yet — expanding determineInstallDir + setup migration for binary paths now. will push once the XDG-aware logic + migration is in. |

Closes #1502
What
sentry-clistored its config/data (thecli.dbSQLite database with credentials and caches) in~/.sentry, cluttering the home directory and breaking in environments that block writes to$HOME(e.g. sandboxed coding agents).This makes the config directory follow the XDG Base Directory specification, matching how the CLI already resolves shell/completion paths.
Resolution precedence
getConfigDir()now resolves via a new pureresolveConfigDir(env, home)helper:SENTRY_CONFIG_DIR— explicit override, unchanged (highest priority)~/.sentry— used when it already exists, so existing installs keep working with no migration$XDG_CONFIG_HOME/sentry— defaulting to~/.config/sentry. A non-absoluteXDG_CONFIG_HOMEis ignored per the spec.Changes
packages/cli/src/lib/db/index.ts— new exportedresolveConfigDir(env, home)helper;getConfigDir()delegates to it.packages/cli/test/lib/config.test.ts— unit tests covering all four precedence branches plus the non-absoluteXDG_CONFIG_HOMEcase.README.md,DEVELOPMENT.md,apps/cli-docs/src/fragments/configuration.md,apps/cli-docs/src/content/docs/getting-started.mdx.Testing
vitest run test/lib/config.test.ts— 47 tests pass (5 new). Biome clean on changed files.Note: binary install paths (
~/.sentry/bin) are driven by the install script and left unchanged; this PR scopes to the config/data directory only.