MCPcopy Create free account
hub / github.com/Noumena-Network/code / ruleMatches

Function ruleMatches

src/tools/SkillTool/SkillTool.ts:452–468  ·  view source on GitHub ↗
(ruleContent: string)

Source from the content-addressed store, hash-verified

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

Callers 1

checkPermissionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected