MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / inferRelevantFolders

Function inferRelevantFolders

src/context/tree.ts:87–100  ·  view source on GitHub ↗

Derive the relevant-folder set from the user's prompt.

(promptHint: string | undefined)

Source from the content-addressed store, hash-verified

85
86/** Derive the relevant-folder set from the user's prompt. */
87function inferRelevantFolders(promptHint: string | undefined): Set<string> {
88 if (!promptHint) return new Set();
89 const lower = promptHint.toLowerCase();
90 const folders = new Set<string>();
91 for (const { keywords, folders: f } of TOPIC_FOLDER_HINTS) {
92 const hit = keywords.some(kw => {
93 // Word-boundary match on each side so "api" matches "api/" but not "rapid"
94 const re = new RegExp(`(^|[^a-z])${kw}([^a-z]|$)`);
95 return re.test(lower);
96 });
97 if (hit) for (const folder of f) folders.add(folder);
98 }
99 return folders;
100}
101
102export async function buildDirectoryTree(
103 rootDir: string,

Callers 1

buildDirectoryTreeFunction · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected