@@ -3,12 +3,13 @@ import {
33 markdownToRule ,
44} from "@continuedev/config-yaml" ;
55import { IDE , RuleWithSource } from "../.." ;
6+ import { PROMPTS_DIR_NAME , RULES_DIR_NAME } from "../../promptFiles" ;
67import { joinPathsToUri } from "../../util/uri" ;
78import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants" ;
89
910export const SUPPORTED_AGENT_FILES = [ "AGENTS.md" , "AGENT.md" , "CLAUDE.md" ] ;
1011/**
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
1213 * and agent files (AGENTS.md, AGENT.md, CLAUDE.md) at workspace root
1314 */
1415export async function loadMarkdownRules ( ide : IDE ) : Promise < {
@@ -53,37 +54,45 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
5354 }
5455 }
5556
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 ] ;
6359
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+ ) ;
6671
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+ }
8089 }
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+ } ) ;
8195 }
82- } catch ( e ) {
83- errors . push ( {
84- fatal : false ,
85- message : `Error loading markdown rule files: ${ e instanceof Error ? e . message : e } ` ,
86- } ) ;
8796 }
8897
8998 return { rules, errors } ;
0 commit comments