In cursor you can whitelist commands. So I white list npm run. Then tell cursor to upgrade a dependency and run npm run build and if there’s errors. Fix the first error and repeat. Once the build is successful, run npm test and fix 1 test at a time.
Takes some learning but once you figure it out it’s insanely powerful.