When building CLI tools, shell completion usually treats each option in isolation. But sometimes valid values for one option depend on another—like branch names depending on which repository you're targeting.

Wrote about how I solved this in Optique, a type-safe CLI parser for TypeScript.

https://hackers.pub/@hongminhee/2026/optique-context-aware-cli-completion

1

If you have a fediverse account, you can quote this note from your own instance. Search https://hollo.social/@hongminhee/019bb5cb-1246-74e7-a9b3-9d7a94ed23ba on your instance and quote it. (Note that quoting is not supported in Mastodon.)