From 75de8b89cfbdd03dcda493af9665b4e2cda5fc00 Mon Sep 17 00:00:00 2001 From: Dorian Scheidt Date: Tue, 28 Apr 2026 11:29:33 -0500 Subject: [PATCH] [parse] allow Next.js route-group parentheses Patterns like src/app/(nonauth)/forgot/**/* (Next.js route groups) were rejected with "unexpected character '('". Permit ( and ) in isPatternChar, matching the existing brackets exception (dbad96a). --- parse.go | 2 +- parse_test.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/parse.go b/parse.go index 4d33150..dedc19a 100644 --- a/parse.go +++ b/parse.go @@ -175,7 +175,7 @@ func isAlphanumeric(ch rune) bool { // isPatternChar matches characters that are allowed in patterns func isPatternChar(ch rune) bool { switch ch { - case '*', '?', '.', '/', '@', '_', '+', '-', '\\': + case '*', '?', '.', '/', '@', '_', '+', '-', '\\', '(', ')': return true } return isAlphanumeric(ch) diff --git a/parse_test.go b/parse_test.go index 8f4ac8f..9a2d283 100644 --- a/parse_test.go +++ b/parse_test.go @@ -208,6 +208,15 @@ func TestParseRule(t *testing.T) { trailingComment: "", }}, }, + { + name: "pattern with parentheses (Next.js route groups)", + rule: "src/app/(nonauth)/forgot/**/* @user", + expected: []Rule{{ + SourceLine: 1, + pattern: mustBuildPattern(t, "src/app/(nonauth)/forgot/**/*"), + Owners: []string{"@user"}, + }}, + }, // Error cases