Comment by rixed
1 hour ago
One hour ago, while looking casually at a package.json, I saw this and was horrified:
rm -rf pkg/snippets & rmdir pkg\\snippets /s /q & wasm-pack build --target bundler && node prepare-web.js
Looked like a strange mix of unix shell and msdos batch that would, on my box, try to rmdir "/s" and "/q". I asked Claude about this, and he replied something like "Yes that's a standard and clever hack to delete a directory that works both on linux and windows!".
Poor Claude has been trained on so much awful human code that it required several prompts for it to admit that there was indeed a problem.
The industry is the process by which convenient crap like this gets standardized.
To meekly defend the indefensible here: it's not like rmdir on Linux (I won't speak for all Unixen) can cause loss of data, since it only removes empty directories.
In this case, the rm -rf before that does. The rmdir is the Windows command in this example and with /s /q, it will quietly delete everything.
Yikes. I would never approve a PR with that in it.
Your agent might!
I hope the "standard" part is as much of a hallucination as "clever" is
> Poor Claude has been trained on so much awful human code that it required several prompts for it to admit that there was indeed a problem.
Claude probably birthed this abomination in the first place