Add resolve-and-apply to main and use it
Fixes #1120