( ide: IDE, baseFilename?: string, )
| 184 | } |
| 185 | |
| 186 | export async function createNewGlobalRuleFile( |
| 187 | ide: IDE, |
| 188 | baseFilename?: string, |
| 189 | ): Promise<void> { |
| 190 | try { |
| 191 | const globalDir = localPathToUri(getContinueGlobalPath()); |
| 192 | |
| 193 | // Create the rules subdirectory within the global directory |
| 194 | const rulesDir = joinPathsToUri(globalDir, "rules"); |
| 195 | |
| 196 | const fileUri = await findAvailableFilename( |
| 197 | rulesDir, |
| 198 | "rules", |
| 199 | ide.fileExists.bind(ide), |
| 200 | undefined, |
| 201 | true, // isGlobal = true for global rules |
| 202 | baseFilename, |
| 203 | ); |
| 204 | |
| 205 | const fileContent = getFileContent("rules"); |
| 206 | |
| 207 | await ide.writeFile(fileUri, fileContent); |
| 208 | |
| 209 | await ide.openFile(fileUri); |
| 210 | } catch (error) { |
| 211 | throw error; |
| 212 | } |
| 213 | } |
no test coverage detected