You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nested or escaped braces in rule, include and exclude patterns are split wrongly (**/*.{ts,{js,jsx}} drops .ts) #2097
Not relevant (pattern matching runs before any LLM call)
Bug Description
expandBraces in internal/config/rules/system_rules.go splits a pattern at its first { and its first } before calling doublestar.Match. It is used by rules, include and exclude in rule.json and by the built-in path_rule_map. Two kinds of patterns break:
Nested groups.**/*.{ts,{js,jsx}} becomes **/*.ts}, **/*.{js} and **/*.jsx}, so only .js files match; .ts and .jsx files silently get no rule, are not included, or are not excluded.
Escaped braces.pages/\{id\}.ts (a literal {id} file name, as in file-based routing) is split as if it were a group and never matches pages/{id}.ts.
doublestar already reads both forms correctly when given the whole pattern.
The same split happens in IsUserExcluded, matchProjectRuleEntry and SystemRule.Resolve.
Expected Behavior
Brace groups match the same files as doublestar.Match on the unsplit pattern: web/app.ts, web/app.js and web/App.jsx for **/*.{ts,{js,jsx}}, and pages/{id}.ts for pages/\{id\}.ts.
Logs / Error Output
n/a
AI/LLM Disclosure
I didn't use AI/LLM to assist or generate the content above.
Additional Context
AI disclosure: used Claude Code (Claude Opus 5.5) while inspecting the codebase and writing this change. A PR with the fix is opened right after this issue.
Activity