Skip to content

Commit 77c9863

Browse files
authored
Create .clinerules directory when adding new cline rule in ui and .clinerules is currently a file (RooCodeInc#3217)
* create clinerules dir * change default * changeset * md
1 parent 03d4410 commit 77c9863

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.changeset/blue-lobsters-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": minor
3+
---
4+
5+
create clinerules folder if its currently a file and creating new rule

src/core/context/instructions/user-instructions/cline-rules.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,14 @@ export const createRuleFile = async (isGlobal: boolean, filename: string, cwd: s
221221
filePath = path.join(globalClineRulesFilePath, filename)
222222
} else {
223223
const localClineRulesFilePath = path.resolve(cwd, GlobalFileNames.clineRules)
224+
225+
const hasError = await ensureLocalClinerulesDirExists(cwd)
226+
if (hasError === true) {
227+
return { filePath: null, fileExists: false }
228+
}
229+
224230
await fs.mkdir(localClineRulesFilePath, { recursive: true })
231+
225232
filePath = path.join(localClineRulesFilePath, filename)
226233
}
227234

0 commit comments

Comments
 (0)