Skip to content

feat(release): install shell completions on brew install (DX-5783)#39

Merged
johnpmitsch merged 2 commits into
mainfrom
dx-5783-install-shell-completions-on-brew-install-of-qn
Jun 17, 2026
Merged

feat(release): install shell completions on brew install (DX-5783)#39
johnpmitsch merged 2 commits into
mainfrom
dx-5783-install-shell-completions-on-brew-install-of-qn

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

brew install quicknode/tap/qn installed the binary but no shell completions, so brew users got no tab-completion out of the box. qn completions <shell> already generates working bash/zsh/fish completions (pure local generator — no key, no network), but the formula never invoked it.

The formula is generated by cargo-dist and copied verbatim into quicknode/homebrew-tap each release, so it can't be hand-edited durably; cargo-dist's template also dumps any bundled files into pkgshare, where shells don't read them. So this patches the generated formula in the release-update-homebrew-tap recipe (the one place that owns formula → tap), inserting generate_completions_from_executable(bin/"qn", "completions") after the binary install. At brew install time that runs qn completions bash|zsh|fish and drops each in the right dir.

The patch is idempotent (skips if already present) and fails loud if cargo-dist's install_binary_aliases! anchor disappears, so a future template change can't silently drop completions from a release.

This is Justfile-only — no src/ change.

Test plan

Verified the patch logic against the live Formula/qn.rb without doing a release:

  • Patch inserts the helper inside def install right after install_binary_aliases!; ruby -c on the result → Syntax OK.
  • Idempotent: running the patch twice leaves exactly one helper line.
  • Fail-loud: with the anchor removed, the recipe exits non-zero with a descriptive message and leaves the file (and no .tmp) untouched.
  • Anchor regex targets the call site, not the def install_binary_aliases! definition.
  • just parses the recipe; cargo fmt --check clean.

Post-merge, the next release's formula will carry the completion line; a fresh brew install/upgrade then yields qn <TAB> completion in zsh/bash/fish.

Closes DX-5783

The cargo-dist-generated homebrew formula installs the binary but not
shell completions, so brew users got no tab-completion out of the box.
The formula is generated upstream and copied verbatim into the tap each
release, so it can't be hand-edited durably; cargo-dist's template also
dumps any bundled files into pkgshare, where shells don't read them.

Patch the generated formula in release-update-homebrew-tap to run
`qn completions <shell>` at install time via
generate_completions_from_executable. `qn completions` is a pure local
generator (no key, no network), so it's safe during brew install. The
patch is idempotent and hard-fails if cargo-dist's install_binary_aliases!
anchor disappears, so a template change can't silently drop completions.
@johnpmitsch johnpmitsch merged commit 8997744 into main Jun 17, 2026
13 checks passed
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.

2 participants