I have a Ruby on Rails project where I want Cursor to run bin/rails test
and bundle exec rubocop -a -f GitHub
after each command/prompt the agent runs for me. And to fix occurring errors.
This seems to be such a simple thing but I can’t get it working. I want it to as a project rule so every developer in the project has the same setup.
But even I can’t even get it run with a fixed rule.
When I ask cursor to solve this for me it comes up with this:
cursor.json
{
"projectRules": {
"beforeCodeChange": {
"commands": [
{
"command": "bin/rails test",
"onError": "fix"
},
{
"command": "bundle exec rubocop -a -f github",
"onError": "fix"
}
]
}
}
}
This results in this:
So the agent says that it is running the tests but it actually isn’t (never mind the typo - old screenshot).
How can I achieve this?