fix(completions): update zsh completions for usage v3.1.0#8715
Conversation
Usage v3.1.0 changed zsh complete-word output from quoted ('val') to
unquoted (val) format and switched the generated completion template
from _arguments to _describe. Update the prerendered zsh completion
script and e2e test to match.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the Zsh completion logic and associated end-to-end tests to accommodate breaking changes introduced in Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Greptile SummaryThis PR adapts the Zsh completion wrapper and its e2e test to usage-cli v3.1.0, which changed
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Zsh as Zsh Completion Engine
participant Wrapper as _mise wrapper
participant Cache as Spec Cache File
participant UsageCLI as usage complete-word v3.1.0
participant Describe as _describe
Zsh->>Wrapper: trigger completion for mise
Wrapper->>Cache: check spec file exists?
alt spec file missing
Wrapper->>Cache: mise usage store spec
end
Wrapper->>UsageCLI: complete-word --shell zsh -f spec_file
UsageCLI-->>Wrapper: unquoted newline-separated completions
Note over Wrapper: read each line into completions array
Wrapper->>Describe: _describe completions array -S ''
Describe-->>Zsh: present completion candidates
Reviews (3): Last reviewed commit: "fix(completions): bump usage-cli to 3.1...." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request updates the zsh completion script to support changes in usage v3.1.0, which now produces unquoted completion values and uses a different completion function. The changes in the completion script and the corresponding test update are correct. I've provided one suggestion to make the zsh script more idiomatic and concise.
| local -a completions=() | ||
| while IFS= read -r line; do | ||
| completions+=("$line") | ||
| done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${words[@]}") |
There was a problem hiding this comment.
While the while read loop is correct, you can use a more idiomatic and concise zsh feature to populate the completions array. The (f) parameter expansion flag is designed for splitting command output by newlines, which simplifies this block of code significantly.
local -a completions=("${(@f)$(command usage complete-word --shell zsh -f "$spec_file" -- "${words[@]}")}")
| assert "mise exec -- usage complete-word --shell zsh -f ./mise.usage.kdl -- mise tasks run build -- -c ''" "mise.toml | ||
| mise.usage.kdl" |
There was a problem hiding this comment.
completions/_mise fix reverted by autofix.ci
The autofix.ci bot (commit a087196) reverted the completions/_mise change that was introduced in the first commit (dd0e2ad). As a result, the net diff across this entire PR leaves completions/_mise identical to the base branch — still using the old _arguments inline-expansion pattern:
_arguments "*: :(($(command usage complete-word --shell zsh -f "$spec_file" -- "${words[@]}" )))"This contradicts the PR's stated goal. The intended fix — replacing _arguments with a loop + _describe -S '' — was never shipped:
local -a completions=()
while IFS= read -r line; do
completions+=("$line")
done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${words[@]}")
_describe 'completions' completions -S ''With usage v3.1.0 outputting one entry per line (unquoted), the old _arguments pattern uses $() substitution, which collapses newlines into spaces. For completions that include spaces in their values or colon-separated value:description pairs, this will silently mangle the output. The e2e test here passes because mise.toml and mise.usage.kdl happen to be single tokens without spaces, so the broken path is not exercised.
The autofix.ci bot appears to have regenerated completions/_mise using an older installed version of usage (pre-v3.1.0), effectively undoing the manual fix. You likely need to prevent autofix.ci from regenerating this file, or re-apply the _describe change after the bot runs.
The autofix.ci bot reverted the _describe completion fix because mise.lock still pinned usage-cli at 2.18.2. Bump the lock to 3.1.0 so the generated completions use the new _describe pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.10 x -- echo |
24.5 ± 0.5 | 23.7 | 30.9 | 1.00 |
mise x -- echo |
25.1 ± 0.9 | 23.8 | 31.1 | 1.03 ± 0.04 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.10 env |
24.2 ± 0.4 | 23.3 | 26.5 | 1.00 |
mise env |
24.3 ± 1.9 | 23.2 | 64.5 | 1.00 ± 0.08 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.10 hook-env |
24.7 ± 0.4 | 23.9 | 26.6 | 1.00 |
mise hook-env |
24.8 ± 0.6 | 23.6 | 30.5 | 1.00 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.10 ls |
24.5 ± 0.4 | 23.7 | 27.4 | 1.00 |
mise ls |
24.8 ± 0.4 | 23.7 | 26.3 | 1.01 ± 0.02 |
xtasks/test/perf
| Command | mise-2026.3.10 | mise | Variance |
|---|---|---|---|
| install (cached) | 155ms | 156ms | +0% |
| ls (cached) | 85ms | 86ms | -1% |
| bin-paths (cached) | 88ms | 88ms | +0% |
| task-ls (cached) | 855ms | 823ms | +3% |
|
Did this actually fix anything? |
|
I’m also getting a similar error when I run a completion after
I don’t get this error when running |
Summary
complete-wordoutput from quoted ('val') to unquoted (val) format and switched the generated completion template from_argumentsto_describe -S ''completions/_miseto use the new_describepatterne2e/tasks/test_task_completionexpected output to matchTest plan
tasks/test_task_completionpasses with usage v3.1.0_describeapproach🤖 Generated with Claude Code
Note
Low Risk
Low risk: updates only shell completion generation/formatting and the associated e2e assertion; impact is limited to zsh completions output/behavior.
Overview
Updates the generated zsh completion script
completions/_miseto matchusage complete-wordoutput in usage-cli v3.1.0 by switching from_argumentsto_describeand reading completion lines into an array.Adjusts the
e2e/tasks/test_task_completionexpected output to reflect the new unquoted completion formatting, and bumpscargo:usage-cliinmise.lockfrom2.18.2to3.1.0.Written by Cursor Bugbot for commit 508afbe. This will update automatically on new commits. Configure here.