From 8f7889de979dcd5d4e201fa925ba4389fb552058 Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 2 Feb 2026 03:51:13 +0000 Subject: [PATCH] Checkpoint: File edits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic checkpoint created by Claude Code - Branch: claude/guidance-control-plane-uhmR3 - Timestamp: 2026-02-02T03:51:13Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- v3/@claude-flow/guidance/src/retriever.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/v3/@claude-flow/guidance/src/retriever.ts b/v3/@claude-flow/guidance/src/retriever.ts index 46e615bb58..7c31606e46 100644 --- a/v3/@claude-flow/guidance/src/retriever.ts +++ b/v3/@claude-flow/guidance/src/retriever.ts @@ -426,15 +426,21 @@ export class ShardRetriever { } /** - * Simple glob matching (supports * and **) + * Simple glob matching (supports * and **). + * Compiled regexes are cached per glob to avoid re-compiling on every call. */ private matchGlob(path: string, glob: string): boolean { - const regex = glob - .replace(/\*\*/g, '{{GLOBSTAR}}') - .replace(/\*/g, '[^/]*') - .replace(/{{GLOBSTAR}}/g, '.*') - .replace(/\//g, '\\/'); - return new RegExp(`^${regex}$`).test(path); + let re = this.globCache.get(glob); + if (!re) { + const pattern = glob + .replace(/\*\*/g, '{{GLOBSTAR}}') + .replace(/\*/g, '[^/]*') + .replace(/{{GLOBSTAR}}/g, '.*') + .replace(/\//g, '\\/'); + re = new RegExp(`^${pattern}$`); + this.globCache.set(glob, re); + } + return re.test(path); } /**