MCPcopy Create free account
hub / github.com/disler/pi-vs-claude-code / commandReferencesPath

Function commandReferencesPath

extensions/damage-control.ts:44–53  ·  view source on GitHub ↗
(command: string, protectedPath: string)

Source from the content-addressed store, hash-verified

42 // Prevents `~/Desktop/YT` from matching `~/Desktop/YT_archive`, while still matching
43 // `~/Desktop/YT`, `~/Desktop/YT/foo`, `~/Desktop/YT"`, `~/Desktop/YT ` (space = boundary).
44 function commandReferencesPath(command: string, protectedPath: string): boolean {
45 if (!protectedPath) return false;
46 let idx = command.indexOf(protectedPath);
47 while (idx >= 0) {
48 const after = command[idx + protectedPath.length];
49 if (!after || !/[A-Za-z0-9_-]/.test(after)) return true;
50 idx = command.indexOf(protectedPath, idx + 1);
51 }
52 return false;
53 }
54
55 function isPathMatch(targetPath: string, pattern: string, cwd: string): boolean {
56 // Simple glob-to-regex or substring match

Callers 1

damage-control.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected