MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / ruleMatches

Function ruleMatches

source code/tools/SkillTool/SkillTool.ts:453–469  ·  view source on GitHub ↗
(ruleContent: string)

Source from the content-addressed store, hash-verified

451 // Helper function to check if a rule matches the skill
452 // Normalizes both inputs by stripping leading slashes for consistent matching
453 const ruleMatches = (ruleContent: string): boolean => {
454 // Normalize rule content by stripping leading slash
455 const normalizedRule = ruleContent.startsWith('/')
456 ? ruleContent.substring(1)
457 : ruleContent
458
459 // Check exact match (using normalized commandName)
460 if (normalizedRule === commandName) {
461 return true
462 }
463 // Check prefix match (e.g., "review:*" matches "review-pr 123")
464 if (normalizedRule.endsWith(':*')) {
465 const prefix = normalizedRule.slice(0, -2) // Remove ':*'
466 return commandName.startsWith(prefix)
467 }
468 return false
469 }
470
471 // Check for deny rules
472 const denyRules = getRuleByContentsForTool(

Callers 1

checkPermissionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected