Repository navigation
Conversation
ast-grep dispatches on the first positional only, so a later path named like test/scan/new no longer disables filtering for an implicit run.
Yahiro025
force-pushed
the
Yahiro025/fix-ast-grep-path-subcommand-4162
branch
from
September 21, 2026 02:54
ebcc031 to
4de52c2
Compare
📊 Automated PR Analysis
SummaryFixes ast-grep's implicit-run filter gate so it only inspects the first positional argument to decide whether a real subcommand (test/scan/new/etc.) was invoked, rather than scanning all positionals. Previously, a path argument later on the command line that happened to match a subcommand name (e.g., a directory named 'test') would incorrectly disable output filtering for an implicit run. Review Checklist
Linked issues: #4162 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Author
|
CLA is signed now (CLA Assistant shows all committers authorized). Ready for review whenever you have a chance. |
Reconcile with the grammar tables now read off the ast-grep binary (rtk-ai#4150). With `-c/--config` the only option that can put a value ahead of a subcommand, the first free positional is reliably the subcommand slot, which is the precondition rtk-ai#4162 set for looking at it alone. - Doc comment: state why checking only the first positional is safe. - test_a_subcommand_behind_any_flag_is_still_a_subcommand: drop the `--color always <sub>` cases. `--color` is a `run` option that ast-grep rejects ahead of a subcommand, so it is not a global option and the line is not valid ast-grep input.
openbotgit
Bot
force-pushed
the
Yahiro025/fix-ast-grep-path-subcommand-4162
branch
from
November 6, 2026 02:13
9a03927 to
d1eeb2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtk ast-grepso a path argument named like a subcommand (test/,scan/,new/, …) no longer disables output filtering on implicit-runinvocations.filters_this_invocationnow treats only the first free positional as a possible subcommand (matching ast-grep’s own dispatch), instead of using.any()over all positionals.OTHER_SUBCOMMANDScontents alone (orthogonal to fix(ast-grep): route subcommands by the grammar ast-grep actually has #4150).Fixes #4162
Test plan
src/cmds/system/ast_grep_cmd.rs: implicit-run with later path namedtest/scan/newstill filters; real first-positional subcommands still disable filtering; explicitrunwith path args still filterscargo test --bin rtk cmds::system::ast_grep_cmd::(16 passed)cargo fmt --all && cargo clippy --all-targets && cargo testast-grepon PATH, comparertk ast-grep -p '…' src testvsrtk ast-grep run -p '…' src test(both should be filtered)