harn-glob 0.8.115

Glob pattern matching primitives for the Harn programming language
Documentation

The single glob-matching implementation for the Harn workspace.

Before this crate existed, seven near-identical glob_match functions lived in harn-ir, harn-vm (metadata scan, llm config, capabilities, merge-captain audit, runtime hooks, llm mock), and harn-cli (skills) — each with subtly different wildcard semantics. A pattern that matched in one subsystem silently behaved differently in another (hook routing honored ?/[...], model-override matching did not; the metadata scanner matched the * in **/*.rs literally). This crate is the one place those semantics are defined.

Three contracts, chosen per call site:

  • [match_path] — slash-aware file-path globs: */? never cross /, ** crosses directories. Use for path-shaped inputs (invariant globs, skill manifests, workspace paths).
  • [match_name] — full glob syntax (*, ?, [...], {a,b}) over flat identifiers where / has no special meaning (* crosses it). Use for tool names, model ids, hook patterns, event names.
  • [match_prose] — *-only ordered-segment matching where every other character is literal. Use when patterns target free text that routinely contains ?, [, or { as ordinary prose (e.g. llm-mock prompt matchers).