That sounds quite interesting as a future direction.
One thing I've also been wondering about is if we could add support for configure scripts. Essentially recycling my idea for edit-scripts from the manifest editing commands proposal. Unfortunately, scripts are not a good fit for that particular proposal, since they would lead to a loss of non-code information such as comments - but they'd be great for making tweaks to a package manifest at build time, or even generating them entirely at build-time.
The output of the configure script would still be a Package
object, which could be serialised and available for inspection by the user, but it would be a better solution for a lot of the automation use-cases that the new CLI commands attempt to help with.