@@ -3,12 +3,13 @@ import {
3
3
markdownToRule ,
4
4
} from "@continuedev/config-yaml" ;
5
5
import { IDE , RuleWithSource } from "../.." ;
6
+ import { PROMPTS_DIR_NAME , RULES_DIR_NAME } from "../../promptFiles" ;
6
7
import { joinPathsToUri } from "../../util/uri" ;
7
8
import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants" ;
8
9
9
10
export const SUPPORTED_AGENT_FILES = [ "AGENTS.md" , "AGENT.md" , "CLAUDE.md" ] ;
10
11
/**
11
- * Loads rules from markdown files in the .continue/rules directory
12
+ * Loads rules from markdown files in the .continue/rules and .continue/prompts directories
12
13
* and agent files (AGENTS.md, AGENT.md, CLAUDE.md) at workspace root
13
14
*/
14
15
export async function loadMarkdownRules ( ide : IDE ) : Promise < {
@@ -53,37 +54,45 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
53
54
}
54
55
}
55
56
56
- try {
57
- // Get all .md files from .continue/rules
58
- const markdownFiles = await getAllDotContinueDefinitionFiles (
59
- ide ,
60
- { includeGlobal : true , includeWorkspace : true , fileExtType : "markdown" } ,
61
- "rules" ,
62
- ) ;
57
+ // Load markdown files from both .continue/rules and .continue/prompts
58
+ const dirsToCheck = [ RULES_DIR_NAME , PROMPTS_DIR_NAME ] ;
63
59
64
- // Filter to just .md files
65
- const mdFiles = markdownFiles . filter ( ( file ) => file . path . endsWith ( ".md" ) ) ;
60
+ for ( const dirName of dirsToCheck ) {
61
+ try {
62
+ const markdownFiles = await getAllDotContinueDefinitionFiles (
63
+ ide ,
64
+ {
65
+ includeGlobal : true ,
66
+ includeWorkspace : true ,
67
+ fileExtType : "markdown" ,
68
+ } ,
69
+ dirName ,
70
+ ) ;
66
71
67
- // Process each markdown file
68
- for ( const file of mdFiles ) {
69
- try {
70
- const rule = markdownToRule ( file . content , {
71
- uriType : "file" ,
72
- fileUri : file . path ,
73
- } ) ;
74
- rules . push ( { ...rule , source : "rules-block" , sourceFile : file . path } ) ;
75
- } catch ( e ) {
76
- errors . push ( {
77
- fatal : false ,
78
- message : `Failed to parse markdown rule file ${ file . path } : ${ e instanceof Error ? e . message : e } ` ,
79
- } ) ;
72
+ // Filter to just .md files
73
+ const mdFiles = markdownFiles . filter ( ( file ) => file . path . endsWith ( ".md" ) ) ;
74
+
75
+ // Process each markdown file
76
+ for ( const file of mdFiles ) {
77
+ try {
78
+ const rule = markdownToRule ( file . content , {
79
+ uriType : "file" ,
80
+ fileUri : file . path ,
81
+ } ) ;
82
+ rules . push ( { ...rule , source : "rules-block" , sourceFile : file . path } ) ;
83
+ } catch ( e ) {
84
+ errors . push ( {
85
+ fatal : false ,
86
+ message : `Failed to parse markdown rule file ${ file . path } : ${ e instanceof Error ? e . message : e } ` ,
87
+ } ) ;
88
+ }
80
89
}
90
+ } catch ( e ) {
91
+ errors . push ( {
92
+ fatal : false ,
93
+ message : `Error loading markdown rule files from ${ dirName } : ${ e instanceof Error ? e . message : e } ` ,
94
+ } ) ;
81
95
}
82
- } catch ( e ) {
83
- errors . push ( {
84
- fatal : false ,
85
- message : `Error loading markdown rule files: ${ e instanceof Error ? e . message : e } ` ,
86
- } ) ;
87
96
}
88
97
89
98
return { rules, errors } ;
0 commit comments