feat(config): follow XDG Base Directory spec for config location - #1503
Open
jared-outpost[bot] wants to merge 3 commits into
Open
feat(config): follow XDG Base Directory spec for config location#1503jared-outpost[bot] wants to merge 3 commits into
jared-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.
|
Contributor
Author
|
CI green on the feature branch (check_suite success). Self-review clean. Marking ready and requesting review from the issue author. |
Contributor
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.
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.

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.