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
rtk ast-grep: Windows absolute paths never parse, so the filter degrades to a full passthrough with no savings #4017
MATCH_LINE_RE in src/cmds/system/ast_grep_cmd.rs is ^(?P<file>[^:]+):(?P<line>\d+):(?P<content>.*)$. [^:]+ cannot cross the colon in a Windows drive letter, so a line like
C:\src\a.rs:12:static X: Y = foo();
never matches: after C: the next token must be digits and it is \src\a.rs. ast-grep echoes paths exactly as they were given on the command line (confirmed on Linux: an absolute path argument produces absolute paths in the output), so any invocation naming an absolute path on Windows produces output where no line parses.
Since #3857 this is safe — unparsed_signal() returns the output untouched rather than keeping whichever lines happen to parse — but it means rtk ast-grep does nothing at all for those users: 0% reduction, on exactly the invocation shape an agent is most likely to generate.
Relative-path invocations are unaffected (src\a.rs:12: parses fine). The same applies to any POSIX path containing a colon.
search.rs sidesteps this entirely for grep/rg by forcing --null and parsing ^([^\x00]+)\x00(\d+)([:-]) (search.rs:287). ast-grep has no --null equivalent in plain mode, so the fix probably means anchoring on the last:<digits>: on the line rather than the first, or accepting an optional [A-Za-z]: drive prefix.
Verified: regex behaviour checked directly against all three path shapes; path echoing confirmed with ast-grep 0.45.3 in Docker (node:22-trixie-slim, LC_ALL=C). The Windows leg is inferred from those two facts rather than executed on a Windows runner.
MATCH_LINE_RE in ast_grep_cmd.rs can't parse Windows drive-letter (or colon-containing POSIX) paths, silently degrading rtk ast-grep to a full passthrough with no token savings; fix by anchoring on the last :<digits>: or accepting an optional drive prefix.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/cmds/system/ast_grep_cmd.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
rtk-wshm-sync-bot commentedon Sep 13, 2026
🔍 Automated Triage
bugmediumSummary
MATCH_LINE_RE in ast_grep_cmd.rs can't parse Windows drive-letter (or colon-containing POSIX) paths, silently degrading rtk ast-grep to a full passthrough with no token savings; fix by anchoring on the last
:<digits>:or accepting an optional drive prefix.📁 Relevant files
src/cmds/system/ast_grep_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
fix(ast-grep): parse Windows drive-letter paths