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>
This commit is contained in:
parent
f638f8b48e
commit
cc2a6c3f16
2 changed files with 12 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue