MCPcopy Create free account
hub / github.com/SethGammon/Citadel / sourceExistsInDir

Function sourceExistsInDir

hooks_src/organize-enforce.js:154–161  ·  view source on GitHub ↗

* Check if a source file exists in a given directory for a base name. * Tries common source extensions.

(dir, baseName)

Source from the content-addressed store, hash-verified

152 * Tries common source extensions.
153 */
154function sourceExistsInDir(dir, baseName) {
155 const extensions = ['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs', '.java', '.rb'];
156 const absDir = path.isAbsolute(dir) ? dir : path.join(PROJECT_ROOT, dir);
157 for (const ext of extensions) {
158 if (fs.existsSync(path.join(absDir, baseName + ext))) return true;
159 }
160 return false;
161}
162
163function matchesPathPattern(filePath, pattern) {
164 if (!pattern) return false;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected