We don't know if GPL works in court. It roughly seems like whatever you write in a license is an effective deterrent though. So your repository could take an existing permissive license like MIT, and add a clause like I mentioned. Set a procedure for your terms for others to use your open-source project commercially. An example of this is the Big Time Public License.[2]
[1] https://wonko.com/post/jsmin-isnt-welcome-on-google-code/
[2] https://bigtimelicense.com/versions/2.0.2#big-business
If lacking precedent is your main concern, there are no software licenses that are likely to fill your criterion.