Skip to content

fix(completions): update zsh completions for usage v3.1.0#8715

Merged
jdx merged 3 commits intomainfrom
fix/usage-3.1-zsh-completions
Mar 22, 2026
Merged

fix(completions): update zsh completions for usage v3.1.0#8715
jdx merged 3 commits intomainfrom
fix/usage-3.1-zsh-completions

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Mar 22, 2026

Summary

  • 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 -S ''
  • Updates the prerendered completions/_mise to use the new _describe pattern
  • Updates e2e/tasks/test_task_completion expected output to match

Test plan

  • e2e tasks/test_task_completion passes with usage v3.1.0
  • Zsh completions work correctly with the new _describe approach

🤖 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/_mise to match usage complete-word output in usage-cli v3.1.0 by switching from _arguments to _describe and reading completion lines into an array.

Adjusts the e2e/tasks/test_task_completion expected output to reflect the new unquoted completion formatting, and bumps cargo:usage-cli in mise.lock from 2.18.2 to 3.1.0.

Written by Cursor Bugbot for commit 508afbe. This will update automatically on new commits. Configure here.

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>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 usage tool version 3.1.0. The changes primarily involve adapting to a new unquoted output format for completion words and a revised completion template, ensuring mise's Zsh completions continue to function correctly.

Highlights

  • Zsh Completion Output Format Change: The usage tool v3.1.0 now outputs complete-word results without quotes, changing from 'val' to val.
  • Zsh Completion Template Update: The usage tool v3.1.0 has switched its generated completion template from _arguments to _describe -S ''.
  • Completion Script Adaptation: The completions/_mise script has been updated to adopt the new _describe pattern for Zsh completions.
  • E2E Test Adjustment: The expected output in the e2e/tasks/test_task_completion test has been modified to reflect the new unquoted format from usage v3.1.0.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jdx jdx enabled auto-merge (squash) March 22, 2026 18:35
@jdx jdx disabled auto-merge March 22, 2026 18:35
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 22, 2026

Greptile Summary

This PR adapts the Zsh completion wrapper and its e2e test to usage-cli v3.1.0, which changed complete-word output from single-quoted space-separated tokens to bare unquoted newline-separated entries and switched the recommended completion pattern from _arguments to _describe.

  • completions/_mise: Replaces the old _arguments "*: :(($(command usage complete-word ...)))" one-liner — which collapsed newlines to spaces via $() substitution — with a while IFS= read -r line loop that correctly populates a zsh array, then passes it to _describe 'completions' completions -S ''.
  • e2e/tasks/test_task_completion: Updates the expected assertion output from quoted ('mise.toml', 'mise.usage.kdl') to bare unquoted values to match the v3.1.0 format.
  • mise.lock: Bumps cargo:usage-cli from 2.18.2 to 3.1.0.
  • The initial commit's fix was inadvertently reverted by autofix.ci; a follow-up commit (508afbe) correctly re-applied the _describe change alongside the lock bump, so the current HEAD is in the intended state.

Confidence Score: 5/5

  • Safe to merge — minimal, well-targeted changes with no logic risk.
  • All three files are updated consistently: the completion script correctly uses the loop + _describe pattern, the e2e assertion matches the new unquoted output format, and the lock file pins the required usage-cli version. The previous concern about the autofix.ci revert has been fully resolved by the final commit.
  • No files require special attention.

Important Files Changed

Filename Overview
completions/_mise Replaces the old _arguments + $() inline-expansion with a while read loop populating an array fed to _describe -S '', correctly adapting to usage v3.1.0's unquoted newline-per-entry output format.
e2e/tasks/test_task_completion Updates expected assertion output from single-quoted values ('mise.toml') to bare unquoted values (mise.toml) to match the new usage v3.1.0 output format.
mise.lock Bumps cargo:usage-cli from 2.18.2 to 3.1.0, the version that introduced unquoted newline-separated complete-word output.

Sequence Diagram

sequenceDiagram
    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
Loading

Reviews (3): Last reviewed commit: "fix(completions): bump usage-cli to 3.1...." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread completions/_mise
Comment on lines +30 to +33
local -a completions=()
while IFS= read -r line; do
completions+=("$line")
done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${words[@]}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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[@]}")}")

Comment on lines +12 to +13
assert "mise exec -- usage complete-word --shell zsh -f ./mise.usage.kdl -- mise tasks run build -- -c ''" "mise.toml
mise.usage.kdl"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 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.

Fix in Claude Code

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>
@jdx jdx merged commit a7e280b into main Mar 22, 2026
25 checks passed
@jdx jdx deleted the fix/usage-3.1-zsh-completions branch March 22, 2026 18:59
@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

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%

jdx pushed a commit that referenced this pull request Mar 22, 2026
### 🐛 Bug Fixes

- **(completions)** update zsh completions for usage v3.1.0 by @jdx in
[#8715](#8715)

### Security

- **(lock)** block github tool upgrade when provenance is lost by @jdx
in [#8706](#8706)
@iamkroot
Copy link
Copy Markdown
Contributor

Did this actually fix anything?
I'm on v2026.3.13 and getting the following on trying to complete tasks-

$ mise run <TAB>
(eval):37: parse error near `<'

@naoki-mizuno
Copy link
Copy Markdown

I’m also getting a similar error when I run a completion after mise completion zsh > ~/.local/share/zsh/completions/_mise:

$ mise <TAB>
(eval):73: unmatched '
Name Version
macOS 26.3.1
zsh 5.9
mise 2026.4.18
usage 3.2.0

I don’t get this error when running eval "$( mise completion zsh )"... not sure what the difference is.

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.

3 participants