Open Policy Agent (OPA) shell completion

The cursor blinks. You type opa and the world slows down, waiting for you to remember the flag you need. Shell completion ends that pause.

Open Policy Agent (OPA) shell completion lets you hit Tab and get instant, accurate command suggestions. No guessing. No digging through docs. Just a fluent CLI that moves as fast as you do. Whether you use Bash, Zsh, or Fish, OPA ships built-in support for generating completion scripts that make your workflow seamless.

To set up Bash completion:

opa completion bash > /etc/bash_completion.d/opa

Reload your shell and OPA commands now autocomplete in real time.

For Zsh:

opa completion zsh > "${fpath[1]}/_opa"

Restart or reload your terminal session and every OPA subcommand and flag is right under your fingertips.

For Fish:

opa completion fish > ~/.config/fish/completions/opa.fish

The next Tab you press will feel like muscle memory.

Shell completion is more than a convenience. It enforces accuracy, teaches the CLI as you type, and reduces mental load when switching between policy projects. In large environments, it eliminates costly typos and saves seconds that add up to days.

Open Policy Agent integrates shell completion using its native command, so there’s no need for external tools or scripts. Once installed, completions are automatically updated with each OPA upgrade. If you script or automate OPA, completion works in tandem with predictable, stable CLI behavior.

Hit Tab. See the command appear. Move. Push faster with OPA shell completion enabled.

Want to see OPA command completion in action inside a real policy pipeline? Visit hoop.dev and spin it up in minutes.