Assigning an extension command to a context menu at install time

I don’t know whether tis topic is documentation or development related, or both.
So, here I go with documentation :wink: Feel free to point me to some other direction if this message is misplaced.

For some time now (can’t remember when this was first possible), there’s a possibility in the UI to customize context menus (Tools > Customize, Context menus tab).
This can also be made by code (ex: in BASIC).

I guess this could also be made when installing extensions so that an extension can be associated with a custom context menu entry. But I didn’t find any information about how do proceed.
I think the .xcu configuration syntax must be close to main menu addition, using the AddOnUI component as a top parent. Bur I wonder how can one identify the target context menu (aka popupmenu).

I had posted two questions on the ask website, to no avail (ex: Seems like nobody really knows :frowning:

I have explored the xml popupmenus settings in /share/config where I could get the UNO commands used by the context menu entries.
A kind soul gave me an opengrok file address as a response to the question referenced above where one may get some information as well. But I’m still stuck.

Thus the question at hand: who could give insights about that topic and provide some XML configuration code that could be used?

I’m ready to help here, if required.

Thanks for reading.