Skip to content

Function: detectOverlaps()

ts
function detectOverlaps(policies): readonly OverlapWarning[];

Defined in: packages/core/src/state-sync/PolicyValidator.ts:163

Detect potentially overlapping glob policies.

Checks if a broader policy at index i could shadow a more-specific policy at index j > i. Uses GlobMatcher to test if the earlier pattern matches the later pattern's literal segments.

This is a heuristic: it only catches cases where the later policy's match string (treated as a literal tool name) would match the earlier policy's glob. It does NOT do full set-intersection analysis.

Parameters

ParameterTypeDescription
policiesreadonly SyncPolicy[]The policies array to analyze

Returns

readonly OverlapWarning[]

Array of overlap warnings (empty if no overlaps detected)