feat(completions): add PowerShell tab completion support#30929
Conversation
Add completions/bun.ps1 with Register-ArgumentCompleter for PowerShell. Supports all subcommands (run, test, build, install, add, remove, etc.), global flags, per-command flags, dynamic script/binary completion from package.json, and JavaScript file completion. Install by adding `. path/to/bun.ps1` to $PROFILE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughAdds ChangesPowerShell Completion for bun/bunx
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@completions/bun.ps1`:
- Around line 141-156: The dependency enumeration block duplicated in the
'remove' case should be extracted into a helper function (suggested name
_bun_get_dependencies) similar to _bun_get_scripts; implement
_bun_get_dependencies accepting a wordToComplete (or currentToken) that reads
package.json, iterates the four dependency keys, filters by the prefix and
returns CompletionResult items, then replace the inline block inside the
'remove' branch with a call to _bun_get_dependencies $currentToken (ensure
Register-ArgumentCompleter still references the new helper and reuse the same
error handling/try/catch semantics).
- Around line 34-42: The path-based completion fails because _bun_get_js_files
uses -Filter "*$wordToComplete*" against the current directory which doesn't
match paths with separators; change _bun_get_js_files to split $wordToComplete
into a directory part and a filename prefix (e.g. use [System.IO.Path] or -split
on '/'/'\'), set the Get-ChildItem -Path to that directory (fall back to $PWD
when empty) and apply the filename filter (or a Where-Object on Name) for the
filename portion, then build the relative path
($_.FullName.Substring($PWD.Path.Length + 1).Replace('\', '/')) and emit
CompletionResult as before so tab-completion works for files in subdirectories.
- Around line 109-129: The switch mapping incorrectly routes 'publish',
'outdated', 'link', 'unlink', 'patch', and 'info' to
_bun_complete_install_flags; update the switch in the
currentToken.StartsWith('-') block so each of those subcommands calls its own
completer (e.g. _bun_complete_publish_flags, _bun_complete_outdated_flags,
_bun_complete_link_flags, _bun_complete_unlink_flags, _bun_complete_patch_flags,
_bun_complete_info_flags) or falls back to _bun_complete_global_flags if
appropriate, and implement those new completer functions (or adjust existing
ones) to provide the correct flags (--access, --tag, etc. for publish; --save
for link; --commit/--patches-dir for patch; --json for info; no major flags for
outdated).
- Around line 157-163: The 'pm' case in completions/bun.ps1 currently generates
completions from an incomplete array; update that array in the 'pm' { ... }
block to include all 17 documented subcommands: bin, cache, default-trusted,
hash, hash-print, hash-string, migrate, pack, pkg, scan, trust, untrusted,
version, view, whoami, why, and ls so the Where-Object { $_ -like
"$currentToken*" } / ForEach-Object { [CompletionResult]::new($_, $_,
'ParameterValue', "pm $_") } pipeline will emit completions for the missing
items (scan, why, whoami, view, version, pkg) as well as the existing ones.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8a4a0852-6577-41ca-bdc5-47581e520997
📒 Files selected for processing (1)
completions/bun.ps1
| # Complete flags and args for known subcommands | ||
| if ($currentToken.StartsWith('-')) { | ||
| switch ($subcommand) { | ||
| 'test' { _bun_complete_test_flags $currentToken } | ||
| 'install' { _bun_complete_install_flags $currentToken } | ||
| 'add' { _bun_complete_install_flags $currentToken } | ||
| 'remove' { _bun_complete_install_flags $currentToken } | ||
| 'update' { _bun_complete_install_flags $currentToken } | ||
| 'build' { _bun_complete_build_flags $currentToken } | ||
| 'init' { _bun_complete_init_flags $currentToken } | ||
| 'publish' { _bun_complete_install_flags $currentToken } | ||
| 'outdated' { _bun_complete_install_flags $currentToken } | ||
| 'link' { _bun_complete_install_flags $currentToken } | ||
| 'unlink' { _bun_complete_install_flags $currentToken } | ||
| 'patch' { _bun_complete_install_flags $currentToken } | ||
| 'info' { _bun_complete_install_flags $currentToken } | ||
| 'audit' { _bun_complete_audit_flags $currentToken } | ||
| default { _bun_complete_global_flags $currentToken } | ||
| } | ||
| return | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if publish, outdated, link, unlink, patch, info support the same flags as install
for cmd in publish outdated link unlink patch info; do
echo "=== bun $cmd --help ==="
bun $cmd --help 2>&1 | head -50
echo ""
doneRepository: oven-sh/bun
Length of output: 467
🏁 Script executed:
# Search for documentation about bun commands
find . -type f \( -name "*.md" -o -name "*.txt" \) | head -20Repository: oven-sh/bun
Length of output: 739
🏁 Script executed:
# Look for bun CLI documentation or help text in the repo
rg "publish|outdated|link|unlink|patch|info" --type md -A 3 | head -100Repository: oven-sh/bun
Length of output: 7615
🏁 Script executed:
# Check if there's a bun source directory with CLI definitions
find . -type d -name "*cli*" -o -name "*command*" -o -name "*src*" | head -20Repository: oven-sh/bun
Length of output: 594
🏁 Script executed:
# Search in docs/pm/cli for command documentation
find ./docs/pm/cli -type f | head -20Repository: oven-sh/bun
Length of output: 343
🏁 Script executed:
# Look for documentation about these specific commands
rg "publish|outdated|link|unlink|patch|info" ./docs -A 2 -B 2 | head -150Repository: oven-sh/bun
Length of output: 11590
🏁 Script executed:
# Check the bun.ps1 file more broadly for context about flag handlers
cat -n completions/bun.ps1 | head -150Repository: oven-sh/bun
Length of output: 7569
🏁 Script executed:
# Check the documentation for install, publish, outdated, link, unlink, patch, info to compare their flags
for file in ./docs/pm/cli/install.mdx ./docs/pm/cli/publish.mdx ./docs/pm/cli/outdated.mdx ./docs/pm/cli/link.mdx ./docs/pm/cli/unlink.mdx ./docs/pm/cli/patch.mdx ./docs/pm/cli/info.mdx; do
echo "=== $(basename $file) ==="
head -100 "$file"
echo ""
doneRepository: oven-sh/bun
Length of output: 15345
🏁 Script executed:
# Let's verify that these commands indeed have different flag sets by searching the source
# Look for flag definitions in the bun source code
find ./src -name "*.ts" -o -name "*.js" | xargs grep -l "publish\|outdated\|link\|patch\|info" 2>/dev/null | head -10Repository: oven-sh/bun
Length of output: 339
🏁 Script executed:
# Check if there's any pattern showing these commands were intentionally mapped to install flags
rg "publish.*install|outdated.*install|link.*install|patch.*install|info.*install" completions/ -A 2 -B 2Repository: oven-sh/bun
Length of output: 928
Create separate flag handlers for publish, outdated, link, unlink, patch, and info subcommands.
Lines 119-124 incorrectly map publish, outdated, link, unlink, patch, and info to _bun_complete_install_flags. However, these commands have distinct purposes and flag sets:
publish: Uses--access,--tag,--dry-run,--tolerate-republish,--gzip-leveloutdated: Accepts package name/glob pattern arguments; no major flagslink: Uses--savefor dependency registrationpatch: Uses--commit,--patches-dirinfo: Uses--jsonfor metadata output
Each should have its own flag completer (_bun_complete_publish_flags, etc.) or fall back to _bun_complete_global_flags.
🤖 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 `@completions/bun.ps1` around lines 109 - 129, The switch mapping incorrectly
routes 'publish', 'outdated', 'link', 'unlink', 'patch', and 'info' to
_bun_complete_install_flags; update the switch in the
currentToken.StartsWith('-') block so each of those subcommands calls its own
completer (e.g. _bun_complete_publish_flags, _bun_complete_outdated_flags,
_bun_complete_link_flags, _bun_complete_unlink_flags, _bun_complete_patch_flags,
_bun_complete_info_flags) or falls back to _bun_complete_global_flags if
appropriate, and implement those new completer functions (or adjust existing
ones) to provide the correct flags (--access, --tag, etc. for publish; --save
for link; --commit/--patches-dir for patch; --json for info; no major flags for
outdated).
- Fix _bun_get_js_files to handle subdirectory paths (src/index<TAB>) - Extract _bun_get_dependencies helper for remove command - Add _bun_complete_publish_flags and _bun_complete_patch_flags - Complete pm subcommand list (add pkg, scan, version, view, whoami, why) - Route publish/patch to their own flag completers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@completions/bun.ps1`:
- Around line 360-370: The _bun_complete_publish_flags completer is missing
three options; update the $flags array inside the _bun_complete_publish_flags
function to include entries for '--dry-run' (Desc: 'Simulate publish without
actually publishing'), '--tolerate-republish' (Desc: 'Allow republishing an
already published version'), and '--gzip-level' (Desc: 'Set tarball compression
level (0-9)') so they are returned by the existing Where-Object / ForEach-Object
completion logic; keep the same hash structure (Name/Desc) so the
[CompletionResult] creation remains unchanged.
- Around line 169-171: Remove the invalid 'who' entry from the pm subcommand
suggestions array so only valid commands are listed; specifically edit the
string list that currently contains 'who' and 'whoami' (the array including
'bin', 'cache', ... 'who', 'whoami', 'why') and delete the 'who' element so only
'whoami' remains as the valid npm user command suggestion.
- Around line 143-148: The routing for several subcommands is incorrect: update
the case arms so that 'publish' calls only _bun_complete_publish_flags (remove
the _bun_complete_install_flags call), and change 'outdated', 'link', 'unlink',
and 'info' to fall back to _bun_complete_global_flags instead of
_bun_complete_install_flags; locate the switch/case handling these subcommands
(symbols: 'publish', 'outdated', 'link', 'unlink', 'info') and replace the
referenced helper functions accordingly.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8635dcc3-cd71-4a2f-842d-2b7b5c9e0182
📒 Files selected for processing (1)
completions/bun.ps1
| 'publish' { _bun_complete_install_flags $currentToken; _bun_complete_publish_flags $currentToken } | ||
| 'outdated' { _bun_complete_install_flags $currentToken } | ||
| 'link' { _bun_complete_install_flags $currentToken } | ||
| 'unlink' { _bun_complete_install_flags $currentToken } | ||
| 'patch' { _bun_complete_patch_flags $currentToken } | ||
| 'info' { _bun_complete_install_flags $currentToken } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify flags for outdated, link, unlink, info, publish commands
for cmd in outdated link unlink info publish; do
echo "=== bun $cmd --help ==="
bun $cmd --help 2>&1 | grep -A 30 "^Flags:" || echo "No flags section found"
echo ""
doneRepository: oven-sh/bun
Length of output: 304
🏁 Script executed:
# Check if bun is available and its version
bun --version 2>&1 || echo "Bun not available"
# Try getting raw help output for one command to see the actual format
bun publish --help 2>&1 | head -50Repository: oven-sh/bun
Length of output: 157
🏁 Script executed:
# Check the actual state of the bun.ps1 file at the specified lines
cat -n completions/bun.ps1 | sed -n '140,155p'Repository: oven-sh/bun
Length of output: 1034
🏁 Script executed:
# Search for existing completer functions in bun.ps1 to understand the pattern
rg "function _bun_complete_" completions/bun.ps1 -A 5Repository: oven-sh/bun
Length of output: 2563
🌐 Web query:
bun outdated link unlink info publish command flags documentation
💡 Result:
The Bun CLI provides several commands for managing dependencies, local package linking, and publishing. Below is a summary of the requested commands and their documentation details. bun outdated The bun outdated command checks for dependencies in your project that have newer versions available [1]. It displays a table comparing the current installed version, the version satisfying your package.json range, and the latest version on the registry [1]. - Key features: Supports dependency filters (package names or glob patterns) and workspace filters using the --filter flag [1]. - Execution: It can be run as bun outdated [1]. bun link and bun unlink These commands are used for local package development by creating symbolic links [2][3]. - bun link: When run in a package directory without arguments, it registers the current package in the global link registry [3][4]. When run with a package name (e.g., bun link ), it creates a symlink in the target project's node_modules pointing to the local directory [2][3]. - bun unlink: When run in a package directory without arguments, it unregisters the package from the global link registry [3][5]. It is also used to remove symlinks from a project [6]. - Note: To remove a linked package from a project's dependencies, use bun remove [5]. bun publish The bun publish command is used to publish packages to the npm registry [7]. While specific flag documentation for publish is often context-dependent, standard package manager publishing workflows in Bun generally follow npm-compatible patterns. For advanced package management utilities, such as creating tarballs, Bun provides the bun pm pack command, which supports flags like --dry-run, --destination, --filename, --ignore-scripts, and --gzip-level [8]. Important Distinctions - File System Unlink: Do not confuse the CLI command bun unlink with the API method Bun.file.delete (used for file system operations) [9] or the RedisClient.unlink method (used for non-blocking key deletion in Redis) [10]. - Documentation: Always refer to the official Bun documentation at bun.sh/docs for the most accurate and up-to-date CLI flag references [2][11].
Citations:
- 1: https://bun.com/docs/pm/cli/outdated
- 2: https://bun.com/docs/pm/cli/link
- 3: https://bun.sh/docs/pm/cli/link
- 4: https://mintlify.com/zhcndoc/bun/cli/link
- 5: https://mintlify.com/zhcndoc/bun/cli/unlink
- 6: https://linuxcommandlibrary.com/man/bun-unlink
- 7: Symbolic link for bun-generated singlefile executable fail to run on windows #18193
- 8: https://bun.sh/docs/pm/cli/pm
- 9: https://bun.com/docs/guides/write-file/unlink
- 10: https://bun.com/reference/bun/RedisClient/unlink
- 11: https://bun.com/docs
🏁 Script executed:
# Check if there's any documentation in the repo about these commands
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "*.ps1" \) -exec grep -l "outdated\|link.*flag\|unlink.*flag\|info.*flag" {} \; | head -20Repository: oven-sh/bun
Length of output: 220
🏁 Script executed:
# Look for any references to what these commands do in the source or docs
rg "(outdated|link|unlink|info|publish)" completions/bun.ps1 -B 2 -A 2 | head -50Repository: oven-sh/bun
Length of output: 2745
🏁 Script executed:
# Search for any bun PM documentation or examples in the repo
find . -type f -name "*.md" -exec grep -l "bun outdated\|bun link\|bun unlink\|bun info\|bun publish" {} \;Repository: oven-sh/bun
Length of output: 67
🏁 Script executed:
# Check the CONTRIBUTING.md or README for any flag documentation
grep -A 10 -B 2 "outdated\|link\|unlink\|info\|publish" ./README.md | head -100Repository: oven-sh/bun
Length of output: 3574
Fix incorrect flag routing for publish, outdated, link, unlink, and info subcommands.
These commands incorrectly route to _bun_complete_install_flags:
- Line 143:
publishcalls both_bun_complete_install_flagsand_bun_complete_publish_flags—it should call only_bun_complete_publish_flags(the install flags are redundant and incorrect). - Line 144:
outdatedchecks for dependency updates but routes to install flags. - Line 145:
linkcreates local package symlinks, not a package installation command. - Line 146:
unlinkremoves local package symlinks. - Line 148:
infodisplays package metadata.
Since these commands have distinct purposes from package installation, they should fall back to _bun_complete_global_flags:
- 'publish' { _bun_complete_install_flags $currentToken; _bun_complete_publish_flags $currentToken }
- 'outdated' { _bun_complete_install_flags $currentToken }
- 'link' { _bun_complete_install_flags $currentToken }
- 'unlink' { _bun_complete_install_flags $currentToken }
+ 'publish' { _bun_complete_publish_flags $currentToken }
+ 'outdated' { _bun_complete_global_flags $currentToken }
+ 'link' { _bun_complete_global_flags $currentToken }
+ 'unlink' { _bun_complete_global_flags $currentToken }
'patch' { _bun_complete_patch_flags $currentToken }
- 'info' { _bun_complete_install_flags $currentToken }
+ 'info' { _bun_complete_global_flags $currentToken }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'publish' { _bun_complete_install_flags $currentToken; _bun_complete_publish_flags $currentToken } | |
| 'outdated' { _bun_complete_install_flags $currentToken } | |
| 'link' { _bun_complete_install_flags $currentToken } | |
| 'unlink' { _bun_complete_install_flags $currentToken } | |
| 'patch' { _bun_complete_patch_flags $currentToken } | |
| 'info' { _bun_complete_install_flags $currentToken } | |
| 'publish' { _bun_complete_publish_flags $currentToken } | |
| 'outdated' { _bun_complete_global_flags $currentToken } | |
| 'link' { _bun_complete_global_flags $currentToken } | |
| 'unlink' { _bun_complete_global_flags $currentToken } | |
| 'patch' { _bun_complete_patch_flags $currentToken } | |
| 'info' { _bun_complete_global_flags $currentToken } |
🤖 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 `@completions/bun.ps1` around lines 143 - 148, The routing for several
subcommands is incorrect: update the case arms so that 'publish' calls only
_bun_complete_publish_flags (remove the _bun_complete_install_flags call), and
change 'outdated', 'link', 'unlink', and 'info' to fall back to
_bun_complete_global_flags instead of _bun_complete_install_flags; locate the
switch/case handling these subcommands (symbols: 'publish', 'outdated', 'link',
'unlink', 'info') and replace the referenced helper functions accordingly.
- Remove invalid 'who' from pm subcommands (not a real subcommand) - Add --dry-run and --auth-type to publish flags - Make patch fall through to install flags for shared options Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
completions/bun.ps1 (1)
143-148:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFix incorrect flag routing for publish, outdated, link, unlink, and info subcommands.
These commands incorrectly route to
_bun_complete_install_flags:
- Line 143:
publishcalls both_bun_complete_install_flagsand_bun_complete_publish_flags—the install flags are redundant and incorrect for a publishing operation.- Line 144:
outdatedchecks for dependency updates but does not install packages.- Lines 145-146:
linkandunlinkmanage local package symlinks, not package installation.- Line 148:
infodisplays package metadata without installing.Since these commands have distinct purposes from package installation, update the routing:
🔧 Proposed fix
- 'publish' { _bun_complete_publish_flags $currentToken; _bun_complete_install_flags $currentToken } - 'outdated' { _bun_complete_install_flags $currentToken } - 'link' { _bun_complete_install_flags $currentToken } - 'unlink' { _bun_complete_install_flags $currentToken } + 'publish' { _bun_complete_publish_flags $currentToken } + 'outdated' { _bun_complete_global_flags $currentToken } + 'link' { _bun_complete_global_flags $currentToken } + 'unlink' { _bun_complete_global_flags $currentToken } 'patch' { _bun_complete_patch_flags $currentToken } - 'info' { _bun_complete_install_flags $currentToken } + 'info' { _bun_complete_global_flags $currentToken }Run the following script to verify the flag sets for each command:
#!/bin/bash # Verify that publish, outdated, link, unlink, and info have distinct flag sets from install echo "=== Checking bun documentation for command-specific flags ===" # Search for publish command documentation echo -e "\n--- bun publish ---" rg -i "bun publish" docs/ -A 10 -B 2 | head -50 # Search for outdated command documentation echo -e "\n--- bun outdated ---" rg -i "bun outdated" docs/ -A 10 -B 2 | head -50 # Search for link/unlink command documentation echo -e "\n--- bun link/unlink ---" rg -i "bun (link|unlink)" docs/ -A 10 -B 2 | head -50 # Search for info command documentation echo -e "\n--- bun info ---" rg -i "bun info" docs/ -A 10 -B 2 | head -50
🤖 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 `@completions/bun.ps1`:
- Around line 360-373: The publish completer function
_bun_complete_publish_flags is missing the --tolerate-republish and --gzip-level
flags; update the $flags array in _bun_complete_publish_flags to include entries
for @{ Name = '--tolerate-republish'; Desc = 'Exit 0 if version already exists
(useful for CI/CD)' } and @{ Name = '--gzip-level'; Desc = 'Set tarball gzip
compression level' } using the same array/object shape as the other flag entries
so they are returned by the Where-Object/ForEach-Object completion pipeline.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 47fdd25f-9181-4da4-8f9d-552d8aa1f75b
📒 Files selected for processing (1)
completions/bun.ps1
| function _bun_complete_publish_flags { | ||
| param([string]$word) | ||
| # Publish-specific flags (in addition to shared install flags) | ||
| $flags = @( | ||
| @{ Name = '--access'; Desc = 'Set package access level (public|restricted)' } | ||
| @{ Name = '--tag'; Desc = 'Publish with a specific dist-tag' } | ||
| @{ Name = '--otp'; Desc = 'One-time password for 2FA' } | ||
| @{ Name = '--dry-run'; Desc = "Don't actually publish" } | ||
| @{ Name = '--auth-type'; Desc = 'Authentication type (legacy|web)' } | ||
| ) | ||
| $flags | Where-Object { $_.Name -like "$word*" } | ForEach-Object { | ||
| [CompletionResult]::new($_.Name, $_.Name, 'ParameterName', $_.Desc) | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
bun publish command flags official documentation
💡 Result:
The bun publish command is used to publish packages to the npm registry [1][2]. It automatically packs the package into a tarball, resolves workspace and catalog protocols in package.json, and publishes to the registry configured in your bunfig.toml or.npmrc files [1][3]. Commonly used flags for bun publish include: --access <public|restricted>: Sets the access level for the package. Required for scoped packages that should be public [1][2]. --tag : Publishes the package under a specific distribution tag (default is latest) [1][2]. --dry-run: Simulates the publish process without actually uploading the package, allowing you to verify the contents [1][2]. --otp : Provides a one-time password for accounts with 2FA enabled [2][3]. --auth-type <web|legacy>: Specifies the 2FA authentication method. web (default) opens a browser, while legacy prompts in the terminal [1][2]. --tolerate-republish: Exits with code 0 instead of 1 if the package version already exists, which is useful for CI/CD pipelines [2][3]. --gzip-level : Configures the compression level for the tarball [1][3]. For authentication in CI/CD environments, Bun uses the NPM_CONFIG_TOKEN environment variable [2][4]. You can set this variable to your npm auth token to enable automated publishing [2]. For more detailed information, you can refer to the official Bun documentation at https://bun.com/docs/pm/cli/publish [1].
Citations:
- 1: https://bun.com/docs/pm/cli/publish
- 2: https://www.mintlify.com/oven-sh/bun/pm/publish
- 3: https://www.bunjs.com.cn/es/pm/cli/publish.html
- 4: Publish a package using bun #5365
Add missing publish flags --tolerate-republish and --gzip-level to the publish completer.
According to the official Bun documentation, the bun publish command supports --tolerate-republish (exits with code 0 instead of 1 if the package version already exists, useful for CI/CD pipelines) and --gzip-level (configures the compression level for the tarball), but these are not included in the function.
🤖 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 `@completions/bun.ps1` around lines 360 - 373, The publish completer function
_bun_complete_publish_flags is missing the --tolerate-republish and --gzip-level
flags; update the $flags array in _bun_complete_publish_flags to include entries
for @{ Name = '--tolerate-republish'; Desc = 'Exit 0 if version already exists
(useful for CI/CD)' } and @{ Name = '--gzip-level'; Desc = 'Set tarball gzip
compression level' } using the same array/object shape as the other flag entries
so they are returned by the Where-Object/ForEach-Object completion pipeline.
Summary
completions/bun.ps1— PowerShell tab completion for thebunandbunxcommands (closes implement completions for powershell #8939)test,install/add/remove/update,build,init, andauditpackage.jsonscripts,node_modules/.binbinaries, and JS/TS files. path/to/bun.ps1to$PROFILETest plan
. completions/bun.ps1bun <TAB>— should show subcommands (run, test, build, install, etc.)bun test --<TAB>— should show test-specific flags (--timeout, --coverage, etc.)bun install --<TAB>— should show install flags (--frozen-lockfile, --global, etc.)bun run <TAB>in a project with package.json scripts — should show script namesbun build --<TAB>— should show build flags (--compile, --minify, --target, etc.)powershell -NoProfile -Command "[System.Management.Automation.Language.Parser]::ParseFile('completions/bun.ps1', [ref]$null, [ref]$null)"🤖 Generated with Claude Code