Skip to content

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

Open
mst-mkt wants to merge 10 commits intovoidzero-dev:mainfrom
mst-mkt:fix/install-respect-shell-dir-settings
Open

fix(cli): respect ZDOTDIR and XDG_CONFIG_HOME in install, doctor, and implode#892
mst-mkt wants to merge 10 commits intovoidzero-dev:mainfrom
mst-mkt:fix/install-respect-shell-dir-settings

Conversation

@mst-mkt
Copy link

@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 35bf34b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69b71dc210ea7f0008536f87

@mst-mkt
Copy link
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.

fi
echo ""
echo " Note: Run \`source ~/$SHELL_CONFIG_UPDATED\` or restart your terminal."
echo " Note: Run \`source $display_config\` or restart your terminal."
Comment on lines +882 to +883
std::fs::write(fish_dir.join("vite-plus.fish"), "source \"$HOME/.vite-plus/env\"\n")
.unwrap();

#[test]
#[serial]
fn test_collect_affected_profiles() {
Copy link
Member

Choose a reason for hiding this comment

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

should ignore these tests on Windows too.

@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>
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