Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(hook-augment): bail on rtk grep -l per maintainer requirement

Jake Abendroth5882be29f785
diff --git a/src/cli/hook_augment.c b/src/cli/hook_augment.c
index f4e55c3d5..9ac8015d4 100644
--- a/src/cli/hook_augment.c
+++ b/src/cli/hook_augment.c
@@ -1086,7 +1086,7 @@ static const char *ha_search_bin_val_flags(ha_bin_t bin, bool rtk_grep) {
case HA_BIN_AG:
return "ABCmpG";
default:
- return rtk_grep ? "ABCmdDl" : "ABCmdD";
+ return "ABCmdD";
}
}
@@ -1196,6 +1196,8 @@ static bool ha_parse_bash_search_pattern(const char *cmd, char *out, size_t out_
e_count++;
} else if (flag == 'f') {
return false;
+ } else if (rtk && bin == HA_BIN_GREP && flag == 'l') {
+ return false;
} else if (strchr(val_flags, flag)) {
if (*f) {
f += strlen(f);
diff --git a/tests/test_cli.c b/tests/test_cli.c
index 9884cccf1..fe2eb39aa 100644
--- a/tests/test_cli.c
+++ b/tests/test_cli.c
@@ -8833,10 +8833,9 @@ TEST(cli_hook_augment_bash_pattern_extractor) {
"env FOO=bar rg CreateStripeCheckout .", out, sizeof(out)));
ASSERT_STR_EQ(out, "CreateStripeCheckout");
- /* rtk -l <N> consumes N and still finds the pattern */
- ASSERT_TRUE(cbm_hook_augment_parse_bash_pattern_for_testing(
+ /* rtk -l <N> shadows grep's -l with a value-taking form — bail out */
+ ASSERT_FALSE(cbm_hook_augment_parse_bash_pattern_for_testing(
"rtk grep -l 80 CreateStripeCheckout .", out, sizeof(out)));
- ASSERT_STR_EQ(out, "CreateStripeCheckout");
/* bail-out cases */
ASSERT_FALSE(cbm_hook_augment_parse_bash_pattern_for_testing("grep -f /path/patterns .", out,