MCPcopy Index your code
hub / github.com/continuedev/continue / getAllPromptFiles

Function getAllPromptFiles

core/promptFiles/getPromptFiles.ts:41–80  ·  view source on GitHub ↗
(
  ide: IDE,
  overridePromptFolder?: string,
  checkV1DefaultFolder: boolean = false,
)

Source from the content-addressed store, hash-verified

39}
40
41export async function getAllPromptFiles(
42 ide: IDE,
43 overridePromptFolder?: string,
44 checkV1DefaultFolder: boolean = false,
45): Promise<{ path: string; content: string }[]> {
46 const workspaceDirs = await ide.getWorkspaceDirs();
47 let promptFiles: { path: string; content: string }[] = [];
48
49 let dirsToCheck = [DEFAULT_PROMPTS_FOLDER_V2, DEFAULT_RULES_FOLDER];
50 if (checkV1DefaultFolder) {
51 dirsToCheck.push(DEFAULT_PROMPTS_FOLDER_V1);
52 }
53 if (overridePromptFolder) {
54 dirsToCheck = [overridePromptFolder];
55 }
56
57 const fullDirs = workspaceDirs
58 .map((dir) => dirsToCheck.map((d) => joinPathsToUri(dir, d)))
59 .flat();
60
61 promptFiles = (
62 await Promise.all(fullDirs.map((dir) => getPromptFilesFromDir(ide, dir)))
63 ).flat();
64
65 // Also read from ~/.continue/prompts and ~/.continue/rules
66 promptFiles.push(...readAllGlobalPromptFiles());
67
68 const promptFilesFromRulesDirectory = readAllGlobalPromptFiles(
69 path.join(getContinueGlobalPath(), RULES_DIR_NAME),
70 );
71 promptFiles.push(...promptFilesFromRulesDirectory);
72
73 const result = await Promise.all(
74 promptFiles.map(async (file) => {
75 const content = await ide.readFile(file.path);
76 return { path: file.path, content };
77 }),
78 );
79 return result;
80}

Callers 2

Calls 7

joinPathsToUriFunction · 0.90
readAllGlobalPromptFilesFunction · 0.90
getContinueGlobalPathFunction · 0.90
getPromptFilesFromDirFunction · 0.85
getWorkspaceDirsMethod · 0.65
pushMethod · 0.65
readFileMethod · 0.65

Tested by

no test coverage detected