From cc2a6c3f166c235ce1ec1ac930873d31e9d40126 Mon Sep 17 00:00:00 2001 From: Aditya Mitra <61635505+uinstinct@users.noreply.github.com> Date: Tue, 28 Oct 2025 03:55:03 +0530 Subject: [PATCH] fix: show md rules and prompts in respective sections (#8178) * fix: show md rules and prompts in respective sections * Update core/config/markdown/loadMarkdownRules.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Revert "Update core/config/markdown/loadMarkdownRules.ts" This reverts commit cf0fabaf71eaf7f8c9456eb737dcb08c365c04c0. * Revert "fix: show md rules and prompts in respective sections" This reverts commit b19726baf78d35e9cf4c2fb5c1549127af66f868. * fix: skip invokable prompt files also read .md files from prompt folders * remove debug statements * simplify if block --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- core/config/markdown/loadMarkdownRules.ts | 8 +++++++- core/promptFiles/getPromptFiles.ts | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/config/markdown/loadMarkdownRules.ts b/core/config/markdown/loadMarkdownRules.ts index 91ed72164..d77313b92 100644 --- a/core/config/markdown/loadMarkdownRules.ts +++ b/core/config/markdown/loadMarkdownRules.ts @@ -79,7 +79,13 @@ export async function loadMarkdownRules(ide: IDE): Promise<{ uriType: "file", fileUri: file.path, }); - rules.push({ ...rule, source: "rules-block", sourceFile: file.path }); + if (!rule.invokable) { + rules.push({ + ...rule, + source: "rules-block", + sourceFile: file.path, + }); + } } catch (e) { errors.push({ fatal: false, diff --git a/core/promptFiles/getPromptFiles.ts b/core/promptFiles/getPromptFiles.ts index 6a3837e3a..da6628d2f 100644 --- a/core/promptFiles/getPromptFiles.ts +++ b/core/promptFiles/getPromptFiles.ts @@ -24,7 +24,9 @@ export async function getPromptFilesFromDir( const uris = await walkDir(dir, ide, { source: "get dir prompt files", }); - const promptFilePaths = uris.filter((p) => p.endsWith(".prompt")); + const promptFilePaths = uris.filter( + (p) => p.endsWith(".prompt") || p.endsWith(".md"), + ); const results = promptFilePaths.map(async (uri) => { const content = await ide.readFile(uri); // make a try catch return { path: uri, content }; @@ -68,10 +70,11 @@ export async function getAllPromptFiles( ); promptFiles.push(...promptFilesFromRulesDirectory); - return await Promise.all( + const result = await Promise.all( promptFiles.map(async (file) => { const content = await ide.readFile(file.path); return { path: file.path, content }; }), ); + return result; }