diff --git a/.changeset/blue-lobsters-sort.md b/.changeset/blue-lobsters-sort.md new file mode 100644 index 00000000..d817bb3a --- /dev/null +++ b/.changeset/blue-lobsters-sort.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +create clinerules folder if its currently a file and creating new rule diff --git a/src/core/context/instructions/user-instructions/cline-rules.ts b/src/core/context/instructions/user-instructions/cline-rules.ts index 8a2118d4..b66a1df9 100644 --- a/src/core/context/instructions/user-instructions/cline-rules.ts +++ b/src/core/context/instructions/user-instructions/cline-rules.ts @@ -221,7 +221,14 @@ export const createRuleFile = async (isGlobal: boolean, filename: string, cwd: s filePath = path.join(globalClineRulesFilePath, filename) } else { const localClineRulesFilePath = path.resolve(cwd, GlobalFileNames.clineRules) + + const hasError = await ensureLocalClinerulesDirExists(cwd) + if (hasError === true) { + return { filePath: null, fileExists: false } + } + await fs.mkdir(localClineRulesFilePath, { recursive: true }) + filePath = path.join(localClineRulesFilePath, filename) }