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

Function matchesPathPattern

hooks_src/organize-enforce.js:163–171  ·  view source on GitHub ↗
(filePath, pattern)

Source from the content-addressed store, hash-verified

161}
162
163function matchesPathPattern(filePath, pattern) {
164 if (!pattern) return false;
165 const normalized = String(pattern).replace(/\\/g, '/');
166 if (normalized.endsWith('/')) return filePath.startsWith(normalized);
167 if (normalized.includes('*') || normalized.includes('?') || normalized.includes('{')) {
168 return globToRegex(normalized).test(filePath);
169 }
170 return filePath === normalized || filePath.startsWith(normalized.replace(/\/$/, '') + '/');
171}
172
173function shouldBlockViolation(org, relativePath) {
174 if (org.locked !== true) return false;

Callers 1

shouldBlockViolationFunction · 0.85

Calls 1

globToRegexFunction · 0.70

Tested by

no test coverage detected