MCPcopy Index your code
hub / github.com/codeaashu/claude-code / validateBindings

Function validateBindings

src/keybindings/validate.ts:425–451  ·  view source on GitHub ↗
(
  userBlocks: unknown,
  _parsedBindings: ParsedBinding[],
)

Source from the content-addressed store, hash-verified

423 * Run all validations and return combined warnings.
424 */
425export function validateBindings(
426 userBlocks: unknown,
427 _parsedBindings: ParsedBinding[],
428): KeybindingWarning[] {
429 const warnings: KeybindingWarning[] = []
430
431 // Validate user config structure
432 warnings.push(...validateUserConfig(userBlocks))
433
434 // Check for duplicates in user config
435 if (isKeybindingBlockArray(userBlocks)) {
436 warnings.push(...checkDuplicates(userBlocks))
437
438 // Check for reserved/conflicting shortcuts - only check USER bindings
439 const userBindings = getUserBindingsForValidation(userBlocks)
440 warnings.push(...checkReservedShortcuts(userBindings))
441 }
442
443 // Deduplicate warnings (same key+context+type)
444 const seen = new Set<string>()
445 return warnings.filter(w => {
446 const key = `${w.type}:${w.key}:${w.context}`
447 if (seen.has(key)) return false
448 seen.add(key)
449 return true
450 })
451}
452
453/**
454 * Format a warning for display to the user.

Callers 2

loadKeybindingsFunction · 0.85

Calls 8

checkDuplicatesFunction · 0.85
checkReservedShortcutsFunction · 0.85
validateUserConfigFunction · 0.70
isKeybindingBlockArrayFunction · 0.70
pushMethod · 0.45
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected