Skip to content

Add completion specs for yay and paru AUR helpers - #333

Closed
warp-agent-staging[bot] wants to merge 2 commits into
mainfrom
factory/yay-paru-aur-completions
Closed

Add completion specs for yay and paru AUR helpers#333
warp-agent-staging[bot] wants to merge 2 commits into
mainfrom
factory/yay-paru-aur-completions

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes warpdotdev/warp#5177: yay -S <partial> (and paru -S <partial>) produce no package completions in Warp, unlike pacman -S. Also requested by APP-5382 (Linear).

Root cause: Warp's pacman -S completions come from this repo's own json/pacman.json spec + list_all_packages generator (pacman -Slq), not from shell-native completion. yay/paru have no equivalent spec or generator registered, so they fall back to plain path completion.

This PR is the actual fix. It's referenced from a companion draft PR, warpdotdev/warp#15112, that bumps the warp-command-signatures pin to this branch's head commit, purely so the change can be reviewed/tested end-to-end before this PR merges; that pin must be re-pointed at this PR's merged main commit before warpdotdev/warp#15112 lands.

Changes

  • Added json/yay.json and json/paru.json, modeled directly on json/pacman.json. Both cover -U/--upgrade, -D/--database, -Q/--query, -R/--remove, -S/--sync, -T/--deptest, -F/--files, and the shared root options — not just -S — plus each tool's own AUR-related flags (-a/--aur, --repo, yay's -N/--repo).
  • Refactored src/generators/pacman.rs to expose its package-list parsing and the installed-package / .pkg.tar-file generators as reusable functions (list_packages, list_installed_packages_generator, list_pkg_tar_files_in_cwd_generator), following the same "one file, multiple *_generators() functions" pattern this repo already uses for apt.rs (apt-get/aptitude) and npm.rs (npm/yarn/pnpm).
  • Added src/generators/yay.rs and src/generators/paru.rs, which reuse that shared logic for -Q/-R/-U (installed packages and local .pkg.tar files don't depend on which frontend is used — they always come from the shared pacman database), and register yay_generators()/paru_generators() in generators/mod.rs.

Generator command choice for -S/--sync (the actual bug)

pacman -Slq only lists official repo packages, so reusing it for yay/paru would reproduce the exact reported bug (no AUR completions).

Instead, both yay -Pc (yay --show --complete) and paru -Pc (paru --show --complete) are used. Per each tool's own man page: "Print a list of all AUR and repo packages. This allows shell completion and is not intended to be used directly by the user." This is also exactly what yay's and paru's own bundled bash/zsh completion scripts (_yay_pkg/_paru_pkg) shell out to for the same purpose — so this mirrors upstream's own approach rather than inventing a new one.

Tradeoff considered: the AUR has 100k+ packages, so a live query (e.g. hitting the AUR RPC) on every keystroke would be far too slow for interactive completion. -Pc avoids that by reading from each tool's local, periodically-refreshed completion cache (--completioninterval, default 7 days) instead of re-enumerating the AUR on every call. The cost is that the very first invocation (before any cache exists) can be slow while it's built — every completion after that is fast. This was a deliberate choice, not a blind copy of pacman's command.

Verification

  • cargo test --workspace: 141 tests pass, including the repo's own invariants (all_referenced_generators_exist, all_command_specs_succeed_deserialization, all_command_specs_have_no_newlines) — both new JSON specs deserialize correctly and every generatorName they reference resolves to a real generator.
  • cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings: clean.
  • npm run format:check (prettier): clean for the new JSON files.
  • Ran the repo's own script/presubmit end-to-end: all green.
  • Not exercised: an actual Arch Linux + yay/paru + fish environment, since none was available in the sandbox this was built in. The generator commands (yay -Pc, paru -Pc, pacman -Q) are taken directly from each tool's man page and their own bundled completion scripts, not guessed, but I could not run them against a live pacman/AUR install.

Co-Authored-By: Warp Agent agent@warp.dev

Revision (review findings)

  • Added -a/--aur to paru's -T/--deptest, which paru documents as filtering the given package list down to ones that appear in the AUR (-Ta) — the entries covered -T but were missing that flag.
  • Added yay_and_paru_bind_list_all_packages_to_their_own_completion_command in src/lib.rs, a regression test that resolves yay's/paru's own dynamic completion data and asserts their list_all_packages generator runs yay -Pc/paru -Pc, not pacman's -Slq. The existing all_referenced_generators_exist test only checks that a referenced generator name exists somewhere in the global union of every command's generators, so it would still pass even if the yay/paru map registrations in generators/mod.rs were dropped entirely (their generator name collides with pacman's). Verified the new test fails with "no dynamic completion data registered for command "yay"" when those registrations are removed, and passes once restored.
  • Corrected a doc-comment (and this description, above) that claimed the completion cache refreshes about daily — yay's and paru's own default CompletionInterval/--completioninterval is 7 days.

pacman -S completions work because Warp ships its own command
signature/generator for pacman (json/pacman.json +
src/generators/pacman.rs), not because of shell-native completion.
yay and paru had no such signature or generator registration, so
`yay -S <partial>` fell back to plain path completion with no package
suggestions at all (warpdotdev/warp#5177).

- Add json/yay.json and json/paru.json, modeled on json/pacman.json,
  covering -U/--upgrade, -D/--database, -Q/--query, -R/--remove,
  -S/--sync, -T/--deptest, and -F/--files (plus root options), instead
  of wiring up -S alone.
- Refactor src/generators/pacman.rs to expose its parsing/generator
  logic (list_packages, list_installed_packages_generator,
  list_pkg_tar_files_in_cwd_generator) so it can be shared, and add
  src/generators/yay.rs and src/generators/paru.rs which reuse it for
  -Q/-R/-U (installed packages and local .pkg.tar files are identical
  regardless of frontend), while using each tool's own `-Pc`
  (`--show --complete`) for -S/--sync. `-Pc` is yay/paru's own
  purpose-built, cache-backed completion command for enumerating AUR
  + repo packages, and is what their own bundled completion scripts
  use; it avoids querying the >100k-package AUR live on every
  keystroke, at the cost of a slower first invocation while the local
  cache is built.
- Register yay_generators()/paru_generators() in generators/mod.rs.

Co-Authored-By: Warp Agent <agent@warp.dev>
@warp-agent-staging

Copy link
Copy Markdown
Contributor Author

This PR was generated with Warp.

View run View conversation

- json/paru.json: add -a/--aur to -T/--deptest. paru documents -Ta as
  filtering a package list down to ones that appear in the AUR, and
  the entries were missing that option despite otherwise covering -T.
- src/lib.rs: add a regression test
  (yay_and_paru_bind_list_all_packages_to_their_own_completion_command)
  that resolves yay's/paru's own dynamic completion data and asserts
  their list_all_packages generator runs `yay -Pc`/`paru -Pc`, not
  pacman's `-Slq`. all_referenced_generators_exist only checks that a
  JSON-referenced generator name exists somewhere in the global
  union of every command's generators, so it would still pass even
  if the yay/paru map registrations were dropped entirely (their
  generator name collides with pacman's). Verified this new test
  fails with "no dynamic completion data registered for command
  \"yay\"" when the yay::yay_generators()/paru::paru_generators() map
  entries are removed, and passes once they're restored.
- src/generators/yay.rs, src/generators/paru.rs: correct the doc
  comment's claim about the completion cache refresh interval - both
  tools default --completioninterval to 7 days, not "once a day".

Co-Authored-By: Warp Agent <agent@warp.dev>
@warp-agent-staging

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate. This and #334 were opened by the same automated run about 80 seconds apart, both implementing yay/paru completion specs for warpdotdev/warp#5177. #334 is the one that landed (79e45eb), so this branch is now stale against main.

Two defects in what landed — -Pc output parsed as bare package names, and -i/--install modeled under -U instead of -B — are fixed in #336. Nothing has reached users yet: warp still pins warp-command-signatures to 32a7fd5.

Responding as wilson: Open session · View factory task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yay doesn't get the autocompletions packages while typing TAB like pacman does

1 participant