Skip to content

fix(fish): pass multi-segment CLI paths as separate arguments#143

Merged
AmirSa12 merged 2 commits into
mainfrom
fix/fish-multi-segment-delegation
Jul 20, 2026
Merged

fix(fish): pass multi-segment CLI paths as separate arguments#143
AmirSa12 merged 2 commits into
mainfrom
fix/fish-multi-segment-delegation

Conversation

@AmirSa12

Copy link
Copy Markdown
Member

Summary

  • Fixes fish dropping multi-segment CLI paths when completing a package-manager-delegated CLI (pnpm <cli> <subcommand> --<TAB> returned nothing and fell back to the PM's own flags).
  • Root cause: the generated fish script built the request with string join ' ' + eval, and fish does not expand bare (...) command substitution inside double quotes, so the whole path collapsed into a single token on re-parse. zsh/bash quote each arg individually; PowerShell was audited and is unaffected.
  • Fix: invoke the backend directly with fish list expansion, so each segment reaches the completion backend as its own argument (no string join/eval).

Notes

  • Independent of the delegation performance work (that PR only touches bin/); this PR is purely src/fish.ts + tests.
  • Non-delegation routes (bare pnpm, PM-self flags) are unaffected — verified end-to-end.

Test plan

  • tests/fish-integration.test.ts — new e2e delegation test via a self-contained mycli fixture (pnpm mycli <sub> <TAB>), fails on old template, passes now.
  • tests/shell-empty-argv.test.ts — added multi-segment cases across shells.
  • tests/completion-exec.test.ts, tests/shell.test.ts — updated for the new fish template.
  • Full suite green on a base branched off main.

Made with Cursor

Completing a package-manager-delegated CLI in fish with more than one
path segment (e.g. `pnpm <cli> <subcommand> --<TAB>`) returned nothing
and fell back to the package manager's own flags. The generated fish
script built the request with `string join ' '` + `eval`, and since fish
does not expand bare `(...)` command substitution inside double quotes,
the whole path collapsed into a single token on re-parse.

Invoke the backend directly with fish list expansion so every segment
reaches the completion backend as its own argument. zsh/bash already
quote each argument individually; PowerShell was audited and is
unaffected.

Adds a fish delegation integration test (mycli fixture) plus
multi-segment cases in the cross-shell argv test to guard against
regressions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fb902a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bomb.sh/tab Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tab@143

commit: fb902a8

@AmirSa12
AmirSa12 merged commit 7462e1a into main Jul 20, 2026
12 checks passed
@AmirSa12
AmirSa12 deleted the fix/fish-multi-segment-delegation branch July 20, 2026 09:52
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.

1 participant