Skip to content

fix(devtools): proper XDG base dir support#1033

Open
computed-fn wants to merge 3 commits into
nuxt:mainfrom
computed-fn:proper-xdg
Open

fix(devtools): proper XDG base dir support#1033
computed-fn wants to merge 3 commits into
nuxt:mainfrom
computed-fn:proper-xdg

Conversation

@computed-fn

Copy link
Copy Markdown

🔗 Linked issue

resolves #915

📚 Description

The problem with the current implementation is it fallback to the wrong place. Per the XDG specfication:

If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

Also since the directory is now correctly set, we can remove the dot prefix following other convention

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 02ccf2aa-3abe-4347-8cf9-0d44b6a35d95

📥 Commits

Reviewing files that changed from the base of the PR and between fb46d67 and 1fd8475.

📒 Files selected for processing (1)
  • packages/devtools/src/utils/local-options.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/devtools/src/utils/local-options.ts

📝 Walkthrough

Walkthrough

Devtools now exports getOptionsDir() to resolve storage locations by operating system and XDG configuration settings. Local option JSON files and development authentication tokens use this resolver, with the JSON paths stored under nuxt/devtools. The previous getHomeDir()-based path construction was removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: improving XDG base directory handling for devtools.
Description check ✅ Passed The description matches the XDG config directory fix and the removal of the leading dot.
Linked Issues check ✅ Passed The changes address #915 by moving devtools paths under the XDG config base and dropping the hidden .nuxt prefix.
Out of Scope Changes check ✅ Passed The diff appears limited to XDG path handling and related option/token file path updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/devtools/src/utils/local-options.ts`:
- Around line 58-59: Update the filePath construction near getOptionsDir in the
local options utility to append only the hashed JSON filename, using the
directory returned by getOptionsDir directly. Keep the storage location
consistent with dev-auth.ts and avoid adding another .nuxt/devtools suffix.
- Around line 22-25: Update getOptionsDir so XDG_CONFIG_HOME values that are
empty strings use the existing $HOME/.config fallback; preserve configured
non-empty values and the final nuxt/devtools path construction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 15ecbdea-386b-4f57-9c6a-6f86f8f80f15

📥 Commits

Reviewing files that changed from the base of the PR and between c081250 and fb46d67.

📒 Files selected for processing (2)
  • packages/devtools/src/dev-auth.ts
  • packages/devtools/src/utils/local-options.ts

Comment thread packages/devtools/src/utils/local-options.ts
Comment thread packages/devtools/src/utils/local-options.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: follow common conventions on folder naming in $XDG_CONFIG_HOME

1 participant