Skip to content

fix(cli): respect ZDOTDIR and XDG_CONFIG_HOME in install, doctor, and implode#892

Merged
fengmk2 merged 13 commits intovoidzero-dev:mainfrom
mst-mkt:fix/install-respect-shell-dir-settings
Mar 16, 2026
Merged

fix(cli): respect ZDOTDIR and XDG_CONFIG_HOME in install, doctor, and implode#892
fengmk2 merged 13 commits intovoidzero-dev:mainfrom
mst-mkt:fix/install-respect-shell-dir-settings

Conversation

@mst-mkt
Copy link
Contributor

@mst-mkt mst-mkt commented Mar 14, 2026

issue

resolves #890

details

install.sh hardcodes $HOME for shell config paths, ignoring ZDOTDIR (zsh) and XDG_CONFIG_HOME (fish). This PR respects these variables across install, doctor, and implode.

changes

  • install.sh
    Use ${ZDOTDIR:-$HOME} for zsh and ${XDG_CONFIG_HOME:-$HOME/.config} for fish. SHELL_CONFIG_UPDATED is now an absolute path, and the source hint displays ~/... or the absolute path accordingly.
  • doctor.rs
    Also check $ZDOTDIR and $XDG_CONFIG_HOME locations when detecting profile configuration.
  • implode.rs
    Also collect and clean profiles from these custom locations during uninstall.

@netlify
Copy link

netlify bot commented Mar 14, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 7c281f3
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69b78894fc17db000844463a

@mst-mkt
Copy link
Contributor Author

mst-mkt commented Mar 14, 2026

Tested on deploy preview with ZDOTDIR set to a non-default location. Works as expected.

$ ls ~/.zshenv ~/.zshrc
"/home/mst-mkt/.zshenv": No such file or directory (os error 2)
"/home/mst-mkt/.zshrc": No such file or directory (os error 2)

$ echo $ZDOTDIR
/home/mst-mkt/.config/zsh

$ vp
zsh: command not found: vp

$ curl -fsSL https://deploy-preview-892--viteplus-preview.netlify.app/install.sh | bash

Setting up VITE+...

Would you want Vite+ to manage Node.js versions?
Press Enter to accept (Y/n):

✔ VITE+ successfully installed!

  The Unified Toolchain for the Web.

  Get started:
    vp create       Create a new project
    vp env          Manage Node.js versions
    vp install      Install dependencies
    vp migrate      Migrate to Vite+

  Vite+ is now managing Node.js via vp env.
  Run vp env doctor to verify your setup, or vp env off to opt out.

  Run vp help to see available commands.

  Note: Run `source ~/.config/zsh/.zshrc` or restart your terminal.


$ source ~/.config/zsh/.zshrc

$ vp --version
VITE+ - The Unified Toolchain for the Web

vp v0.1.11

Local vite-plus:
  vite-plus  Not found

Tools:
  vite             Not found
  rolldown         Not found
  vitest           Not found
  oxfmt            Not found
  oxlint           Not found
  oxlint-tsgolint  Not found
  tsdown           Not found

$ cat ~/.config/zsh/.zshrc | tail -n 2
# Vite+ bin (https://viteplus.dev)
. "$HOME/.vite-plus/env"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@fengmk2
Copy link
Member

fengmk2 commented Mar 15, 2026

Nice work! The install.sh and implode.rs changes look good. One issue I noticed in doctor.rs:

The new XDG_CONFIG_HOME block in check_profile_files only fires when XDG_CONFIG_HOME differs from the default ~/.config. But the base code never checks ~/.config/fish/conf.d/vite-plus.fish either — so doctor will never detect a fish shell configuration at the default location. Only users with a custom XDG_CONFIG_HOME will get their fish config detected, which is backwards.

Suggested fix — add a default fish config check before the new ZDOTDIR/XDG blocks (around line 477):

// Also check the default fish conf.d location
let fish_path = format!("{home_dir}/.config/fish/conf.d/vite-plus.fish");
if let Ok(content) = std::fs::read_to_string(&fish_path) {
    if search_strings.iter().any(|s| content.contains(s)) {
        return Some(abbreviate_home(&fish_path));
    }
}

This way doctor detects fish configs regardless of whether XDG_CONFIG_HOME is customized. (This is a pre-existing gap, so could also be addressed as a follow-up.)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 mentioned this pull request Mar 15, 2026
3 tasks
@fengmk2 fengmk2 linked an issue Mar 15, 2026 that may be closed by this pull request
3 tasks
mst-mkt and others added 4 commits March 16, 2026 03:51
Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
@mst-mkt mst-mkt force-pushed the fix/install-respect-shell-dir-settings branch from 35bf34b to 6e79a60 Compare March 15, 2026 21:17
@mst-mkt
Copy link
Contributor Author

mst-mkt commented Mar 15, 2026

Thanks for the review, @fengmk2!

The fish default ~/.config detection gap is a pre-existing issue and outside the scope of this PR, so I've opened a separate PR for it: #920.

Copilot's suggestions and your inline comment have been fixed in the latest commits.

@fengmk2
Copy link
Member

fengmk2 commented Mar 16, 2026

@mst-mkt Can you help fix the Windows CI error? I will merge after the CI passes. And I will release a new version today.

@mst-mkt
Copy link
Contributor Author

mst-mkt commented Mar 16, 2026

@fengmk2
Thanks for approving. The Windows CI error has been resolved.

However, there's a different failure now: CLI E2E test (macos-latest) is failing due to a snapshot diff in create-from-monorepo-subdir, which appears unrelated to this PR. Is there anything I should do on my end?

@fengmk2 fengmk2 merged commit 3782ae1 into voidzero-dev:main Mar 16, 2026
28 checks passed
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.

install.sh doesn't respect shell config directory settings (ZDOTDIR, XDG_CONFIG_HOME) use xdg config

3 participants