Skip to content

Commit cd4d8a3

Browse files
committed
Update patterns
1 parent e0c5db1 commit cd4d8a3

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

src/core/protect/RooProtectedController.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ export class RooProtectedController {
1414
// Predefined list of protected Roo configuration patterns
1515
private static readonly PROTECTED_PATTERNS = [
1616
".rooignore",
17+
".roomodes",
18+
".roorules*",
19+
".clinerules*",
1720
".roo/**",
1821
".rooprotected", // For future use
19-
".roo*", // Any file starting with .roo
2022
]
2123

2224
constructor(cwd: string) {

src/core/protect/__tests__/RooProtectedController.spec.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,23 @@ describe("RooProtectedController", () => {
2424
expect(controller.isWriteProtected(".rooprotected")).toBe(true)
2525
})
2626

27-
it("should protect files starting with .roo", () => {
28-
expect(controller.isWriteProtected(".roosettings")).toBe(true)
29-
expect(controller.isWriteProtected(".rooconfig")).toBe(true)
27+
it("should protect .roomodes files", () => {
28+
expect(controller.isWriteProtected(".roomodes")).toBe(true)
29+
})
30+
31+
it("should protect .roorules* files", () => {
32+
expect(controller.isWriteProtected(".roorules")).toBe(true)
33+
expect(controller.isWriteProtected(".roorules.md")).toBe(true)
34+
})
35+
36+
it("should protect .clinerules* files", () => {
37+
expect(controller.isWriteProtected(".clinerules")).toBe(true)
38+
expect(controller.isWriteProtected(".clinerules.md")).toBe(true)
39+
})
40+
41+
it("should not protect other files starting with .roo", () => {
42+
expect(controller.isWriteProtected(".roosettings")).toBe(false)
43+
expect(controller.isWriteProtected(".rooconfig")).toBe(false)
3044
})
3145

3246
it("should not protect regular files", () => {
@@ -41,8 +55,10 @@ describe("RooProtectedController", () => {
4155
})
4256

4357
it("should handle nested paths correctly", () => {
44-
expect(controller.isWriteProtected("src/.roo/config.json")).toBe(true) // .roo/** matches anywhere
58+
expect(controller.isWriteProtected(".roo/config.json")).toBe(true) // .roo/** matches at root
4559
expect(controller.isWriteProtected("nested/.rooignore")).toBe(true) // .rooignore matches anywhere by default
60+
expect(controller.isWriteProtected("nested/.roomodes")).toBe(true) // .roomodes matches anywhere by default
61+
expect(controller.isWriteProtected("nested/.roorules.md")).toBe(true) // .roorules* matches anywhere by default
4662
})
4763

4864
it("should handle absolute paths by converting to relative", () => {
@@ -112,7 +128,14 @@ describe("RooProtectedController", () => {
112128
it("should return the list of protected patterns", () => {
113129
const patterns = RooProtectedController.getProtectedPatterns()
114130

115-
expect(patterns).toEqual([".rooignore", ".roo/**", ".rooprotected", ".roo*"])
131+
expect(patterns).toEqual([
132+
".rooignore",
133+
".roomodes",
134+
".roorules*",
135+
".clinerules*",
136+
".roo/**",
137+
".rooprotected",
138+
])
116139
})
117140
})
118141
})

0 commit comments

Comments
 (0)