/** * A small, bounded glob matcher. * * Trazum has zero runtime dependencies and that is a security property, not a * preference: a prompt optimiser reads your prompts, and every dependency is * someone else's code doing that too. So the config file's budget patterns are * matched here rather than by pulling in a glob library. * * **It is deliberately not a regex translation.** Turning `**` into * `(?:[^/]*\/)*` produces exactly the nested-quantifier shape that makes a * pattern take exponential time on the wrong input, and these patterns come * from a file in a repository — which on a pull request means from whoever * opened it. A segment-wise dynamic program has no such shape: it is O(pattern * segments x path segments), and each segment match is O(pattern chars x path * chars) with no backtracking beyond a single remembered star. * * Supported, and nothing else: * `*` any run of characters within one path segment * `**` any number of whole path segments, including none * `?` exactly one character within one path segment */ /** * True when `path` matches `pattern`. * * Both sides are treated as relative paths with `/` separators; a leading `./` * and duplicate separators are ignored, and backslashes are read as separators * so a Windows-shaped path still matches a pattern written with slashes. */ export declare function matchGlob(pattern: string, path: string): boolean; /** * How specific a pattern is, for deciding which of two matching patterns wins. * * "Most specific" needs a definition that is stated rather than felt, because * a budget silently resolved from the wrong pattern is a budget nobody can * debug. The rule: **more literal characters wins**, and a longer pattern * breaks a tie. So `prompts/system.txt` beats `prompts/*.txt`, which beats * `prompts/**`, which beats `**`. */ export declare function specificity(pattern: string): number; /** * The most specific pattern in `patterns` that matches `path`, or null. * * Ties on specificity are broken by lexical order rather than by insertion * order: object key order is easy to reorder by accident, and a budget that * changes because two keys swapped places is the kind of bug that gets blamed * on the tool. */ export declare function mostSpecificMatch(patterns: readonly string[], path: string): string | null; //# sourceMappingURL=glob.d.ts.map