Skip to content

fix: proper XDG base dir support using rc9 - #465

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

fix: proper XDG base dir support using rc9#465
computed-fn wants to merge 4 commits into
nuxt:mainfrom
computed-fn:proper-xdg

Conversation

@computed-fn

Copy link
Copy Markdown

🔗 Linked issue

resolves #464

📚 Description

Change the API used to get user config

@computed-fn
computed-fn requested a review from danielroe as a code owner July 22, 2026 09:49
Comment thread src/cli.ts Outdated
}

if (disabledByConf(rc.readUser({ name: RC_FILENAME }))) {
if (disabledByConf(rc.readUserConfig({ name: RC_FILENAME }))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

will this still support ~/.nuxtrc (ie backwards compatibility)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ohh right, I forgot about that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think it should be backward compatible now. Just need to add the new config read is all instead of replacing the old one

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

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 Plus

Run ID: 7c0cf1cd-f3e1-4e81-b83c-2c31ef9ac9da

📥 Commits

Reviewing files that changed from the base of the PR and between 2b033c4 and 217bb47.

📒 Files selected for processing (1)
  • src/cli.ts

📝 Walkthrough

Walkthrough

The CLI checks both legacy and XDG-based user configuration locations for disabled telemetry and uses updateUserConfig for global telemetry settings. The Nuxt rc helper resolves and creates the XDG configuration directory before updating .nuxtrc.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving XDG base directory handling with rc9.
Description check ✅ Passed The description is related to the change and mentions updating the API used for user config.
Linked Issues check ✅ Passed The changes match #464 by using rc9 APIs with the proper XDG base directory and avoiding $HOME pollution.
Out of Scope Changes check ✅ Passed No clearly unrelated changes are present; the edits stay focused on rc9 config path handling and write setup.
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

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

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/cli.ts`:
- Around line 157-159: Update the disabledByConf branch in the CLI flow to
report the config path using the same XDG-aware base directory as
readUserConfig({ name: RC_FILENAME }). Replace the homedir-based resolve with
the existing configuration-directory resolution used by rc9, while preserving
the current message format and RC_FILENAME usage.
🪄 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: 2308ab85-5e0b-427f-b845-84480974a094

📥 Commits

Reviewing files that changed from the base of the PR and between 3d74bd5 and 1ab1c45.

📒 Files selected for processing (2)
  • src/cli.ts
  • src/utils/nuxtrc.ts

Comment thread src/cli.ts Outdated
@computed-fn
computed-fn marked this pull request as draft July 24, 2026 12:44
@computed-fn
computed-fn marked this pull request as ready for review July 24, 2026 13:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cli.ts (1)

182-182: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Create the XDG directory before the global rc9 write.

At src/cli.ts:182, rc.updateUserConfig(update, RC_FILENAME) resolves to ~/.config/.nuxtrc by default, and rc9’s write path does not create parent directories, so a first-time global enable/disable/consent can fail with ENOENT. Reuse the same mkdirSync(rc9Base, { recursive: true }) pattern already used by src/utils/nuxtrc.ts before calling rc.updateUserConfig.

🤖 Prompt for 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.

In `@src/cli.ts` at line 182, Before the global rc9 write in the CLI flow, create
the resolved rc9 base directory with mkdirSync(rc9Base, { recursive: true }),
matching the existing pattern in nuxtrc utilities. Ensure this directory
creation occurs before rc.updateUserConfig(update, RC_FILENAME) for first-time
enable, disable, and consent operations.

Source: MCP tools

🤖 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.

Outside diff comments:
In `@src/cli.ts`:
- Line 182: Before the global rc9 write in the CLI flow, create the resolved rc9
base directory with mkdirSync(rc9Base, { recursive: true }), matching the
existing pattern in nuxtrc utilities. Ensure this directory creation occurs
before rc.updateUserConfig(update, RC_FILENAME) for first-time enable, disable,
and consent operations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3102f2fa-90e3-4348-b523-b21ad35a49f3

📥 Commits

Reviewing files that changed from the base of the PR and between 7be9d13 and 2b033c4.

📒 Files selected for processing (2)
  • src/cli.ts
  • src/utils/nuxtrc.ts

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.

Update the rc9 API usage so it uses the proper XDG base directory

2 participants