Skip to content

feat(cli): add shell completion support#974

Merged
fengmk2 merged 11 commits into
voidzero-dev:mainfrom
nekomoyi:feat/cli-completion
Mar 22, 2026
Merged

feat(cli): add shell completion support#974
fengmk2 merged 11 commits into
voidzero-dev:mainfrom
nekomoyi:feat/cli-completion

Conversation

@nekomoyi

@nekomoyi nekomoyi commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements shell completion for the vp CLI.

Changes

Completion scripts for bash, zsh, fish, and PowerShell are generated in ~/.vite-plus/completion/ when running vp env setup, and automatically sourced in the respective env files.

Fixes

Fixed mixed path separators in env files on Windows to use forward slashes consistently for $HOME-relative paths

# Before
__vp_bin="$HOME/.vite-plus\bin"
# After
__vp_bin="$HOME/.vite-plus/bin"

Increased stack size to 8MB to handle deep recursion in clap_complete::generate() which exceeds Windows' default stack size.

Closes #950

@netlify

netlify Bot commented Mar 16, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 7026d5a
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69bfa38fa3bfbf00098f0ae9

@fengmk2 fengmk2 self-requested a review March 17, 2026 03:39
@nekomoyi

Copy link
Copy Markdown
Collaborator Author

Looking into the CI failure.

@nekomoyi nekomoyi marked this pull request as draft March 17, 2026 07:22
@nekomoyi nekomoyi marked this pull request as ready for review March 17, 2026 08:32

@fengmk2 fengmk2 left a comment

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.

@nekomoyi Thanks! I will merge after successful local verification.

Comment thread .cargo/config.toml
@wtto00

wtto00 commented Mar 19, 2026

Copy link
Copy Markdown

There is a bug in the __vp_bin path configuration. Please see #1039.

@fengmk2

fengmk2 commented Mar 19, 2026

Copy link
Copy Markdown
Member

@nekomoyi can you rebase and fix conflicts?

…ive paths

Fix mixed path separators in env files on Windows
- Before: $HOME/.vite-plus\bin (mixed)
- After: $HOME/.vite-plus/bin (consistent)
Simplify completion generation with loop-based approach
…dows

- Increase stack size to 8MB on Windows
- Set RUST_MIN_STACK to 8MB in CI test jobs

Cargo test default (2MB) are insufficient for deep recursion in clap_complete::generate(). This causes stack overflow when generating shell completion scripts during tests.
@nekomoyi nekomoyi force-pushed the feat/cli-completion branch from 0d02ce0 to 9fb37ec Compare March 19, 2026 05:21
@fengmk2 fengmk2 self-assigned this Mar 19, 2026
@nekomoyi

nekomoyi commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator Author

There is a bug in the __vp_bin path configuration. Please see #1039.

The forward/backward slash path issue in __vp_bin has been addressed in this PR.

# .vite-plus/env
__vp_bin="$HOME/.vite-plus/bin"
# .vite-plus/env.ps1
$__vp_bin = "C:\Users\nekomoyi\.vite-plus\bin"

@fengmk2

fengmk2 commented Mar 19, 2026

Copy link
Copy Markdown
Member

@codex review

@fengmk2 fengmk2 linked an issue Mar 19, 2026 that may be closed by this pull request
4 tasks

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 444eabb7bd

ℹ️ 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 thread crates/vite_global_cli/src/commands/env/setup.rs
Comment thread crates/vite_global_cli/src/commands/env/setup.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 444eabb7bd

ℹ️ 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 thread crates/vite_global_cli/src/commands/env/setup.rs
Comment thread crates/vite_global_cli/src/commands/env/setup.rs Outdated
@fengmk2

fengmk2 commented Mar 19, 2026

Copy link
Copy Markdown
Member

@nekomoyi There is a problem with the automatic suggestions for subcommands, for example, vp build prompts thousands of possibilities.

vp build                                                                                                              
zsh: do you wish to see all 3976 possibilities (1999 lines)? 

@nekomoyi

Copy link
Copy Markdown
Collaborator Author

@fengmk2 I tried to reproduce the problem on my side but couldn't replicate it. When I type vp build and press Tab to trigger completion, it only lists the files in the current directory.

@nekomoyi

Copy link
Copy Markdown
Collaborator Author

showcase:
completion

@fengmk2 fengmk2 merged commit 5122cc6 into voidzero-dev:main Mar 22, 2026
24 of 25 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.

Add Git Bash (Windows) support to the CLI Shell completion support

3 participants