For various reasons, I prefer to have short physical lines in my latex documents, so that the various editors I switch among don't need to soft-wrap the display. But many GUI editors have terrible support for "hard" line-wrapping. The "hard wrap" option in TeXShop, for example, is not comment-aware and is therefore extremely dangerous. Texcenter 2 breaks lines in places that can insert spaces in the output; etc. (Emacs handles all this well, but I can't always use it.)
So the question: What external tools or (non-interactive) command-line scripts can reliably hard-wrap latex documents, in a way that does not change the output? For the purposes of this question I am interested in any and all platforms (though OS X-compatible or portable solutions would be most useful to me).
A good tool should also respect newlines in places that are important to human authors; e.g., a good heuristic is not to remove a newline that is immediately followed by a command sequence or comment (perhaps: even if indented).
Obviously, only TeX can handle unusual documents that change the comment character, etc.; but anything else can in principle be handled quite robustly. What tools are there that do so?
Related: This answer suggests that TextWrangler is one possibility; haven't tried it yet.