From bdcf05fd5f65fe0f6d32c070c1a3b31592e2a456 Mon Sep 17 00:00:00 2001 From: Amolith Date: Sun, 5 Apr 2026 17:26:52 -0600 Subject: [PATCH] handoff: Fix lint in file-pattern extraction - Remove useless regex escape on closing paren - Replace while/exec loop with for/matchAll to avoid assignment in expression and implicit-any let - Change trailing boundary group from consuming to lookahead so adjacent files separated by a single space are no longer skipped --- packages/handoff/src/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/handoff/src/index.ts b/packages/handoff/src/index.ts index 30c912f227f5631949ee153740b478522430c0f0..1d0261f873bce9bb028e72f2c3393acf5ccfa2e9 100644 --- a/packages/handoff/src/index.ts +++ b/packages/handoff/src/index.ts @@ -174,10 +174,11 @@ function extractCandidateFiles(entries: SessionEntry[], conversationText: string } } - // Secondary: file-like patterns from conversation text - const filePattern = /(?:^|\s)([a-zA-Z0-9._\-/]+\.[a-zA-Z0-9]+)(?:\s|$|[,;:\)])/gm; - let match; - while ((match = filePattern.exec(conversationText)) !== null) { + // Secondary: file-like patterns from conversation text. + // Trailing lookahead so the boundary isn't consumed — otherwise adjacent + // files separated by a single space (e.g. "file1.txt file2.txt") get skipped. + const filePattern = /(?:^|\s)([a-zA-Z0-9._\-/]+\.[a-zA-Z0-9]+)(?=\s|$|[,;:)])/gm; + for (const match of conversationText.matchAll(filePattern)) { const candidate = match[1]; if (candidate && !candidate.startsWith(".") && candidate.length > 2) { files.add(candidate);