Applying one-time migrations for Neos upgrades in Surf

When upgrading from one version to another (e.g. 1.2 to 2.0) it’s necessary to run certain migrations only once on every Neos installation. What would be the best way to include that into a Surf deployment?

It should not be needed to adjust the actual deployment descriptor (MyApp.php) IMHO, since that might be versioned independent of the project. So what about a surf.json file, not unlike composer.json or beard.json that contains such things? Could be code migrations, node migrations or “callbacks” to external scripts or even Surf tasks.

Then Surf could keep track of things already done in a surf.lock file, allowing it to keep track of the deployed state. One could edit that file if needed to re-run certain things or check the state there. Q: where/how is that file “coming back” into the project? have Surf commit it to the project? Leave that to a CI job or the user?