fix(completions): stop -- from hijacking task argument completion - #11711
Conversation
The mounted task spec carried a hidden `[-- ARGS_LAST]` catch-all so that words forwarded past `--` would still complete instead of erroring with "unexpected word". jdx/usage#762 made an explicit `--` route the positional cursor onto whichever arg declared the separator, past earlier args — so that catch-all started swallowing the word being completed, and `mise run <task> -- <TAB>` offered filenames instead of the task's own choices. Spell the overflow arg as a plain trailing variadic instead. It still absorbs forwarded words, but no longer claims `--`, so completion reaches the task's declared args. Verified identical on usage 4.1.0 and 5.0.0 across the `run`, `tasks run`, and naked paths.
📝 WalkthroughWalkthroughThe change upgrades ChangesTask completion behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Greptile SummaryThe PR updates task completion specifications so a hidden trailing variadic absorbs forwarded arguments without claiming
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "chore(deps): update usage-lib and usage-..." | Re-trigger Greptile |
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
Bumps mise's own spec generation to usage-lib 5 and the pinned `usage` dev tool in mise.lock to 5.0.0. The generated `mise.usage.kdl` and `docs/cli` output are byte-identical, so `min_usage_version` stays at 4.0 — the spec makes no use of anything v5-only, and mise's completions work on both. Regenerated completions pick up jdx/usage#760: the bash/fish guard now uses `type -P` instead of `type -p`, so an environment defining a `usage` shell function (e.g. oh-my-bash) no longer passes the guard and then fails further down with an unrelated error. clap_usage (via aube) still pulls usage-lib 4.1.0 transitively.
|
Pushed a fix for the failing That diff is jdx/usage#760 coming along with the v5 bump — the generated completion guard switches from Amended into the bump commit rather than added on top, so AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.220. |
Problem
The
releasebranch is red on a single e2e test,tasks/test_task_completion_global_cd, in both thetestandreleaseworkflows. It is not a mise regression — jdx/usage v5.0.0 published today at 14:15Z, and that test pinsusage = "latest"withMISE_MINIMUM_RELEASE_AGE=0sspecifically so it picks up new releases immediately. The same release commit passed at 13:34 and failed at 14:33.Cause
mise tasks --usage(the spec mounted for task completion) appended a hidden[-- ARGS_LAST]catch-all, so words forwarded past--would complete instead of erroring withunexpected word.jdx/usage#762 made an explicit
--route the positional cursor onto whichever arg declared the separator, past earlier args. That catch-all then swallowed the word being completed, somise run <task> -- <TAB>fell back to filenames instead of offering the task's own choices — on therun,tasks run, and naked paths alike.Fix
Spell the overflow arg as a plain trailing variadic (
[ARGS]…) rather than a---gated one. It still absorbs forwarded words, but no longer claims--, so completion descends into the task's declared args.Simply deleting the catch-all was not enough — that fixed the choices but regressed the other direction, making
mise tasks run build -- -c <TAB>fail withunexpected word: -c(covered bytasks/test_task_completion). The plain variadic satisfies both.Verified byte-identical behavior on usage 4.1.0 and 5.0.0 across every path:
mise run sample:run -- <TAB>mise tasks run sample:run -- <TAB>mise sample:run -- <TAB>(naked)mise -C . run sample:run -- <TAB>mise run -r/--force sample:run -- <TAB>mise tasks run build -- -c <TAB>Because the fix is version-agnostic,
min_usage_versionstays at4.0and users on usage 4 are unaffected.v5 bump
Second commit moves
usage-libto 5 and the pinnedusagedev tool inmise.lockto 5.0.0. Regeneratedmise.usage.kdlanddocs/cliare byte-identical, so no spec or docs churn.clap_usage(viaaube) still pullsusage-lib4.1.0 transitively.This supersedes #11707, which bumps only
Cargo.toml/Cargo.lock— its green checks predate the 5.0.0 CLI existing, so they do not cover this failure.Testing
cargo clippy --workspace --all-features --all-targets -- -D warnings— cleanmise run test:unit— 2464 passedmise run test:e2eover 25 tests covering task completion, usage specs, double-dash, and arg/flag parsing — all pass, with the harness resolvingusage@latestto 5.0.0Ordered fix-then-bump so neither commit is red in isolation.
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.220.
Note
Low Risk
Targeted completion-spec and dependency bump with broad e2e coverage; behavior is intended to match usage 4 and 5.
Overview
Fixes task shell completion after usage v5 changed how an explicit
--routes the positional cursor (jdx/usage#762). The hidden overflow arg on mounted task specs is renamed from[-- ARGS_LAST]…to a plain trailing[ARGS]…indisplay_usage, somise run <task> -- <TAB>still offers the task’s declared choices instead of filenames, while extra forwarded args are still absorbed.Also bumps
usage-libto 5 and the pinnedusagedev tool inmise.lockto 5.0.0; bash/fish completions switchtype -ptotype -Pfor locating theusagebinary. E2e expectations and comments are updated accordingly.Reviewed by Cursor Bugbot for commit 20fc8a8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
--, preserving task-defined choices while supporting additional forwarded arguments.[ARGS]….usagecommand.