Console command to Copying Unpublished variables

We copied bunch of variables and components to a new file and make it as our base file.

I know Figma prompts us to copy over unpublished variables to the new file: https://help.figma.com/hc/en-us/articles/15343107263511-Apply-variables-to-designs#h_01HQKMTQVD3249HHA4ER3TGHT0

But unfortunately i missed the notification to copy over the unpublished variables. Now this is what happening:

There are bunch of ghost variables that are not existing on my Variables Table and yet still attached to components:

Like the component-colors / form / and all the stuff under it.

I dont want to fireup the Detach Deleted Variables and redo things manually as there could be hundreds of variables involved, our component library is pretty big.

Do we have a console command that we can just fire up and recreate this?