Hi everyone
Is it possible to selectively apply Cursor rules to some directories and exclude them from nested subdirectories?
Okay so here’s my directory setup, slimmed down for example purposes:
packages
client
components
button.vue
assets
main.css
special
a-file.ts
I created two Cursor rules, with .mdc
extensions in .cursor/rules/*
. Here they are:
rule-1.mdc
---
description:
globs: packages/client/**/*,!packages/client/special/**/*
alwaysApply: false
---
Apply rule to client dir but not to special dir
rule-2.mdc
---
description:
globs: packages/special/**/*
alwaysApply: false
---
Only apply rule to special dir
–
Expected behaviour
- Opening any file in the
client
dir and all of its subdirs/files (excludingspecial
) would only attachrule-1.mdc
- Opening any file in
special
dir and all of its subdirs/files would only attachrule-2.mdc
What actually happens
rule-2.mdc
for thespecial
dir and files is attached as expectedrule-1.mdc
is never attached anywhere
–
I also tried the following syntax and it didn’t work:
rule-1.mdc
---
description:
globs:
- packages/client/**/*
- !packages/client/special/**/*
alwaysApply: false
---
Always do this and that
Thanks in advance for the help