Skip to content

Commit cc2a6c3

Browse files
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 cf0faba. * Revert "fix: show md rules and prompts in respective sections" This reverts commit b19726b. * 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>
1 parent f638f8b commit cc2a6c3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

core/config/markdown/loadMarkdownRules.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
7979
uriType: "file",
8080
fileUri: file.path,
8181
});
82-
rules.push({ ...rule, source: "rules-block", sourceFile: file.path });
82+
if (!rule.invokable) {
83+
rules.push({
84+
...rule,
85+
source: "rules-block",
86+
sourceFile: file.path,
87+
});
88+
}
8389
} catch (e) {
8490
errors.push({
8591
fatal: false,

core/promptFiles/getPromptFiles.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export async function getPromptFilesFromDir(
2424
const uris = await walkDir(dir, ide, {
2525
source: "get dir prompt files",
2626
});
27-
const promptFilePaths = uris.filter((p) => p.endsWith(".prompt"));
27+
const promptFilePaths = uris.filter(
28+
(p) => p.endsWith(".prompt") || p.endsWith(".md"),
29+
);
2830
const results = promptFilePaths.map(async (uri) => {
2931
const content = await ide.readFile(uri); // make a try catch
3032
return { path: uri, content };
@@ -68,10 +70,11 @@ export async function getAllPromptFiles(
6870
);
6971
promptFiles.push(...promptFilesFromRulesDirectory);
7072

71-
return await Promise.all(
73+
const result = await Promise.all(
7274
promptFiles.map(async (file) => {
7375
const content = await ide.readFile(file.path);
7476
return { path: file.path, content };
7577
}),
7678
);
79+
return result;
7780
}

0 commit comments

Comments
 (0)