At Omnigres [1] we also use libpg_query for programmatic query manipulations as libpg_query has a deparser and that allows one to manipulate AST and output the text representation back.
I'm trying to find time to contribute Postgres 16 support to it!
[1] Omnigres: https://github.com/omnigres/omnigres