Skip to content

Bug: gradle TOML filter match_command regex never matches bare gradle or gradlew #2708

Description

@guyoron1

Description

The match_command regex in src/filters/gradle.toml is structurally broken and never activates for bare gradle or gradlew invocations — only ./gradle and ./gradlew work.

Current regex

^(gradle|gradlew|\\./)gradlew?\\b

The alternation group (gradle|gradlew|\\./)captures the entire command name, then expects another gradlew? suffix immediately after. This creates impossible matches:

Input Group captures Then needs Full match attempt Result
gradle build gradle gradlew? gradlegradle or gradlegradlew NO MATCH
gradlew build gradlew gradlew? gradlewgradle or gradlewgradlew NO MATCH
./gradle build ./ gradlew? ./gradle MATCH
./gradlew build ./ gradlew? ./gradlew MATCH

Only the ./ prefix case works because it's the only branch where the suffix gradlew? makes sense.

Expected behavior

All four forms should match: gradle, gradlew, ./gradle, ./gradlew.

Impact

The gradle filter never activates for direct gradle or gradlew invocations, meaning users get unfiltered output with zero token savings for all Gradle commands unless they use the ./ prefix form.

Fix

Change the regex to make ./ optional and capture the command name in one group:

^(\\./)?(gradlew?)\\b

This correctly matches all four forms.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions