Auto create a compile_commands.json for multiple project envs and locating it

What are the correct steps to automate the recreation of a compile_commands.json when I build and also to get a fully qualified path name for it? I need to link the compile_commands.json into the root directory of my project, I can do this manually, but depending on which env I compile for the location of the compile_commands.json will vary. I could of course exec a bash script (maybe using dynamic build flags? I dont know any Python so “advanced scriptig” maybe a no no) to “pio run -t compiledb” and use “find” to symlink the compile_commands but I was wondering if there is a better way to automate this.

And yes, I’m pretty new to pio having returned to the scene :wink:

May be usefull to someone