Skip to content

feat(cli): more Nushell support#1305

Open
XiNiHa wants to merge 1 commit intovoidzero-dev:mainfrom
XiNiHa:nushell
Open

feat(cli): more Nushell support#1305
XiNiHa wants to merge 1 commit intovoidzero-dev:mainfrom
XiNiHa:nushell

Conversation

@XiNiHa
Copy link
Copy Markdown

@XiNiHa XiNiHa commented Apr 5, 2026

This PR adds more Nushell support to the Vite+ global CLI setup and environment commands.

It introduces:

  • Nushell profile detection in vp env doctor
  • Nushell cleanup support in uninstall-related flows
  • Installer updates so Nushell can be configured automatically when available

It also refactors shared shell/profile handling to keep setup, doctor, and cleanup behavior consistent across shells and platforms.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 5, 2026

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 7e2243b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69e23b68a36f150008492e45
😎 Deploy Preview https://deploy-preview-1305--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@XiNiHa XiNiHa force-pushed the nushell branch 7 times, most recently from 27ed9cc to 259b9e6 Compare April 9, 2026 18:19
fengmk2 pushed a commit that referenced this pull request Apr 10, 2026
resolves #1144

While comprehensive support for Nushell seems to be under development in
#1305, that pull request has a large impact. Therefore, I have limited
the scope of this change to env support to align with the existing
issue.

```nushell
# nushell

# 1. Setup
vp env setup
source ~/.vite-plus/env.nu  # or restart Nushell

# 2. Set a specific version
vp env use 20
# Using Node.js v20.20.2 (resolved from 20)
$env.VP_NODE_VERSION
# 20.20.2

# 3. Resolve from .node-version
vp env use
# Using Node.js v22.18.0 (resolved from .node-version)
$env.VP_NODE_VERSION
# 22.18.0

# 4. Completion (requires Fish)
vp <Tab>
# add        Add packages to dependencies
# build      Build application
# cache      Manage the task cache
# check      Run format, lint, and type checks
# ... (all subcommands shown)

# 5. False detection regression (bash launched from Nushell)
# NU_VERSION is inherited by child processes, but VP_SHELL_NU is not set,
# so vp correctly uses POSIX eval mode inside bash.
bash -c 'vp env use 20 && echo $VP_NODE_VERSION'
```
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Apr 16, 2026

I think it support by #1312

@fengmk2 fengmk2 closed this Apr 16, 2026
@XiNiHa
Copy link
Copy Markdown
Author

XiNiHa commented Apr 16, 2026

This PR has broader scope than the one you mentioned, so I believe it'd be worth enough to keep this active. I'm just not having enough spare time to rebase over 😅

@fengmk2 fengmk2 reopened this Apr 16, 2026
@XiNiHa XiNiHa changed the title feat(cli): add Nushell support feat(cli): more Nushell support Apr 17, 2026
@XiNiHa XiNiHa marked this pull request as ready for review April 17, 2026 13:55
@fengmk2 fengmk2 requested a review from naokihaba April 20, 2026 13:23
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Apr 20, 2026

@codex review

@fengmk2 fengmk2 requested a review from nekomoyi April 20, 2026 13:29
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e2243ba7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +105 to +109
#[cfg(windows)]
pub const ALL_SHELL_PROFILES: &[ShellProfile] = &[
ShellProfile {
root: ShellProfileRoot::NushellConfig,
path: "nushell/config.nu",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include POSIX profiles in Windows cleanup list

This Windows-specific ALL_SHELL_PROFILES list drops .bashrc/.bash_profile/.zsh*/fish paths, so vp implode will no longer clean those files on Windows. In this same commit, packages/cli/install.sh still supports MINGW/MSYS/CYGWIN as win32 and runs bash/zsh/fish profile configuration, which means Git Bash/MSYS installs can add source .../.vite-plus/env lines that now persist after uninstall. That leaves stale startup entries and a partially reverted uninstall for a supported install path.

Useful? React with 👍 / 👎.

Comment thread packages/cli/install.ps1

$autoloadFile = Join-Path $autoloadDir "vite-plus.nu"
$nuEnvRef= (Join-Path $InstallDir "env.nu") -replace [regex]::Escape($env:USERPROFILE), '~'
$content = "# Vite+ bin (https://viteplus.dev)`n" + ('source `'+ $nuEnvRef +'`') + "`n"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The Configure-Nushell function writes out the Nushell autoload file in the format "source ...". However, on the implode.rs side, it does not recognize the line as a Vite+ source line unless the path (.vite-plus/.../env.nu) is enclosed in double quotes.

Due to this inconsistency, I suspect that when running "vp implode" in a Windows environment, it fails to correctly detect and delete the written vite-plus.nu file, potentially leaving behind old Nushell settings. What do you think about this?

https://github.com/voidzero-dev/vite-plus/pull/1305/changes#diff-a4ce256627563966ee7f3bd4e62a7a2f1fa7702b3b24b0c4d9137b51c73bace4R267-R273

println!();
println!(" {}", "Then restart your terminal.".dimmed());
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we add Nushell guidance here as well?

@naokihaba naokihaba self-requested a review April 20, 2026 17:52
Copy link
Copy Markdown
Collaborator

@naokihaba naokihaba left a comment

Choose a reason for hiding this comment

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

I'm approving this, assuming the GitHub issues are resolved and all CI checks pass.

https://www.githubstatus.com/incidents/m7pgzw1wlfq7

Comment thread packages/cli/install.sh
echo " - Zsh: ~/.zshrc"
echo " - Fish: source \"$INSTALL_DIR_REF/env.fish\" in ~/.config/fish/config.fish"
echo " Manual setup instructions:"
echo " - Bash/Zsh: add \"$INSTALL_DIR_REF_POSIX/env\" to your shell config (~/.bashrc, ~/.zshrc, etc.)"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should be . "$INSTALL_DIR_REF_POSIX/env"

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.

4 participants