-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: prefix folder path for colocated rules #6394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👷 Deploy request for continuedev pending review.Visit the deploys page to approve it
|
@@ -69,6 +70,30 @@ export function getRuleName( | |||
return displayName; | |||
} | |||
|
|||
function getGlobPattern( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't prepend the directory if the rule is inside of .continue/rules
const dir = path.dirname(id.filePath); | ||
const prependDirAndApplyGlobstar = (glob: string) => { | ||
// skip if glob is a directory | ||
if (glob.includes("/")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think would still want to prepend the dir and globstar if it is a directory pattern. For example subdir/
should become path/to/subdir/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. We can prepend **
in that case as well which would become path/to/**/subdir
(thus matching path/to/subdir
and also path/to/my/nested/subdir
)
Implemented!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uinstinct I'm not sure path.join will work on systems that use backward slash paths, since globs only use forward slash, but path.join might add backwards slashes. is this tested?
Yes, |
@uinstinct what I mean is path.join will "work" in windows but would result in e.g. path\to\file which will not work with globs, even in windows Node.js |
Makes sense. Implemented! |
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Prepend the folder path in the glob match for the corresponding
rules.md
file. We want to apply the particular rule for the specific folder only.getGlobPattern
method for modifying the frontmatter globsResolves CON-2516
Checklist
Screenshots
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Summary by cubic
Updated rule glob patterns to automatically include the folder path of each colocated rules.md file, so rules only apply to files in their specific folder.