I have a starter theme I use for most websites I built myself. Because each site has different plugin dependencies, I'm trying to create a script that essentially collates a list of all plugins currently active and store them in a JSON file.
Then, I want to use TGM Plugin activation to loop that list and install any plugins that are not already there.
We use git to host our theme directory. When we push the changes, they are deployed onto our staging server automatically. The issue is, we don't want to have to login to FTP or run WP-CLI commands in order to install missing plugins. We would rather want the dependencies to come from the theme itself to install the plugins automatically if we have a missing one on our localhost.
We also have a very forgetful developer, that can't be relied upon to add the plugin manually to the TGM file.
So, my problem here lies that I cannot seem to find any hooks that are called immediately upon a plugin activation or deactivation, at which point to re-collate the plugin list and spit it out to a JSON file to be used to activate or deactivate plugins from that list.
Any help on this would be very much appreciated.