| 1 | import { |
| 2 | RULE_FILE_EXTENSION, |
| 3 | sanitizeRuleName, |
| 4 | } from "@continuedev/config-yaml"; |
| 5 | import { joinPathsToUri } from "../../util/uri"; |
| 6 | |
| 7 | /** |
| 8 | * Creates the file path for a rule in the workspace .continue/rules directory |
| 9 | */ |
| 10 | export function createRuleFilePath( |
| 11 | workspaceDir: string, |
| 12 | ruleName: string, |
| 13 | ): string { |
| 14 | const safeRuleName = sanitizeRuleName(ruleName); |
| 15 | return joinPathsToUri( |
| 16 | workspaceDir, |
| 17 | ".continue", |
| 18 | "rules", |
| 19 | `${safeRuleName}.${RULE_FILE_EXTENSION}`, |
| 20 | ); |
| 21 | } |