I like that this space is being explored more! It’s something I’ve given a lot of thought to, and there is still much work to be done.
The Rust crate clap can generate shell completions for you automatically at compile time (in Bash, Fish, Zsh, PowerShell, and Elvish).
For an interesting real-world example rustup uses this feature to generate completions via the CLI (so at runtime as well as compile time). Ripgrep also uses this feature for completions (minus Zsh which are hand written).
Full disclosure, I’m biased as I’m the clap author ;)
See my comment here, which the author of this project responded positively to:
tl;dr the API has a common correctness issue which Oil has fixed (and I have a draft of a blog post explaining). And I’m still pushing the idea of shell-agnostic autocomplete, since I think a few groups of people are motivated to work on it.