feat: support XDG Base Directory Specification for config location#208
Merged
Conversation
Resolves config directory using XDG Base Directory spec: 1. CONFLUENCE_CONFIG_DIR env var (explicit override) 2. ~/.confluence-cli/ if it already exists (backwards compat) 3. $XDG_CONFIG_HOME/confluence-cli/ (defaults to ~/.config/confluence-cli/) New installs go to XDG path. Existing users at legacy path are unaffected. Exports getConfigDir(), getConfigFile(), and _resetConfigDirCache() for downstream consumers and testing. Updated analytics module to use getConfigDir() instead of its own hardcoded path, so stats.json follows config resolution.
pchuri
approved these changes
Jun 25, 2026
pchuri
left a comment
Owner
There was a problem hiding this comment.
Thanks for the well-crafted contribution! The XDG resolution logic is clean, the backwards-compatibility fallback is handled correctly, and the test coverage covers all the branching paths. Approving.
Owner
|
The CI is failing due to an ESLint |
Contributor
Author
|
Thanks a million, fixed an issue. |
github-actions Bot
pushed a commit
that referenced
this pull request
Jun 26, 2026
# [2.15.0](v2.14.1...v2.15.0) (2026-06-26) ### Features * support XDG Base Directory Specification for config location ([#208](#208)) ([b8d63fd](b8d63fd))
|
🎉 This PR is included in version 2.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
Replaces the hardcoded
~/.confluence-cli/config path with XDG-aware resolution.Resolution precedence
CONFLUENCE_CONFIG_DIRenv var — explicit override~/.confluence-cli/— if it already exists and XDG doesn't (backwards compat)$XDG_CONFIG_HOME/confluence-cli/— defaults to~/.config/confluence-cli/New installs go to
~/.config/confluence-cli/. Existing users at~/.confluence-cli/are unaffected — the CLI continues using the legacy location until migrated.Changes
lib/config.jsresolveConfigDir(),getConfigDir(),getConfigFile()with memoized resolution. Exported new functions +_resetConfigDirCache().lib/analytics.jsgetConfigDir()instead of its own hardcoded pathtests/config.test.jstests/analytics.test.jstests/with-client.test.jsgetConfigDir/getConfigFileto config mockREADME.mdTesting
All 761 tests pass (752 original + 9 new). Manual testing confirmed: CONFLUENCE_CONFIG_DIR override, legacy fallback, XDG_CONFIG_HOME support, and new-install XDG default all work correctly.