AI coding assistants are fast, productive, and occasionally catastrophic. One misplaced rm -rf, one accidental git reset --hard, and hours of uncommitted work vanish. This post shows how to integrate Destructive Command Guard (dcg) with OpenCode using its plugin hook system, so destructive commands are intercepted before they run.
AI agents don't type commands into a terminal. They invoke tools programmatically -- and they don't always get it right:
- "Cleaning up build artifacts" becomes
rm -rf ./src(one-character typo) - "Resetting to last commit" becomes
git reset --hard(uncommitted work gone)