1. Be a gruff asshole who just doesn’t engage with the community or give a shit what they say or want or think
2. Don’t publish your code, or publish it anonymously and never interact with users
3. Luck into having your project be in such a niche that the only users are likeminded people who aren’t assholes
None of these are amazing, but otherwise you’re basically guaranteed to run into this eventually.
The project maintainer needs to reinvent themselves as an anonymous avatar and release software/hardware as Acme Corp. P.Midi or somebody.
("All that is necessary for evil to triumph is for good people to do nothing" - the effective number of "good people" is often zero)
... and even more, if it were universally applied, the lack of opportunities for toxic ideas to fester in anonymous fora would reduce the incidence of them crossing over towards reality.
People should be able to produce and publish content without being harassed.
I don't disagree. (Assuming the content isn't of a nature that deserves a lot of criticism though that's in the eye of the beholder and is a matter of degree of course.)
But there's also the real world where putting yourself out in public can have consequences, especially if you become particularly popular. You take the good with the bad and decide if the tradeoff is worth it.
The fact that people think there are kinds of content that warrant harassment is kinda the root of this whole problem.
None of that sounds like a gray area to me.
Another person may well just see it as a cost of doing business, a cost of operating in the world. There will be detractors, some of those will be malevolent snakes. We can mostly just ignore those as they very rarely represent a real and immanent threat.
If you've got nothing better to do with your time than waste it trying to antagonise a situation, you're probably wasting your life. And maybe the recipient can come to understand they can choose to be flattered by the attention - if many people are exerting effort to put you down, more power to you - you might actually be doing something important, and people hate that.