Documentation
¶
Overview ¶
Package areamatch answers whether a repo-relative path matches an area's path glob. It is the single source of truth for glob semantics across the area-path checks (dead-glob and overlap; M-0180) and the Tier-2 consumers that reuse it (mistag M-0181, auto-derive M-0182).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Derive ¶
Derive classifies which declared areas' path-claims a repo-relative path hint falls under. areas maps each area name to its path globs — the config-agnostic shape that keeps areamatch a dependency leaf below config (which imports areamatch for Validate, so the reverse import would cycle). It returns the area names whose globs the path matches, sorted and deduped per area: a path matching two globs of the same area yields that name once. The length is the caller's signal — exactly one is an unambiguous derive, zero is "no area claims this path", two or more is ambiguous. A malformed glob returns an error wrapping doublestar.ErrBadPattern, naming the offending area and glob. Same doublestar ('**') semantics as Match; it is the SSOT primitive `aiwf add --path-hint` (M-0182) consumes.
func Match ¶
Match reports whether the repo-relative path matches the area path glob. Both arguments are '/'-separated and repo-relative (no leading or trailing slash); the glob may use doublestar ('**') semantics that the standard library's filepath.Match cannot evaluate. A malformed glob returns an error wrapping doublestar.ErrBadPattern.
func MatchFS ¶
MatchFS returns the repo-relative paths under fsys that the glob matches — files and directories alike. An empty result means the glob locates nothing (a dead glob). The glob uses the same doublestar ('**') semantics as Match; a malformed glob returns an error wrapping doublestar.ErrBadPattern, and a filesystem walk error is returned as-is. Callers that must never fail on IO (the check rules) treat any error as "indeterminate" and skip.
func MatchesAny ¶
MatchesAny reports whether the glob matches at least one real path under fsys, short-circuiting on the first match. It is the boolean-any primitive the dead-glob check uses: unlike MatchFS it does not enumerate the entire subtree of a '**' glob, so it stays cheap on the large monorepo trees the areas feature targets. (The M-0185 scoped-coverage check does NOT use this — it has a concrete child path already and tests it with the pure-predicate Match.) Same '**' semantics as Match. A malformed glob or a filesystem walk error is returned; callers that must never fail on IO (the check rules) treat any error as "indeterminate" and skip.
func Validate ¶
Validate reports whether the glob is syntactically well-formed. It is the Tier-1 (config-load) gate: config.Areas.validate calls it so a malformed area path glob is a hard error at load — naming the bad glob — rather than being silently skipped by the path-axis checks at runtime. Routing the syntax check through the SSOT keeps config-load from importing doublestar directly. Returns an error wrapping doublestar.ErrBadPattern for a malformed glob, nil otherwise.
Types ¶
This section is empty.