auto generate rules.js