@@ -30,12 +30,12 @@ var allowedGrepInputKeys = map[string]struct{}{
3030 "pattern" : {}, "path" : {}, "glob" : {}, "--glob" : {}, "-g" : {}, "type" : {}, "--type" : {}, "-t" : {}, "output_mode" : {}, "outputMode" : {}, "limit" : {},
3131 "head_limit" : {}, "headLimit" : {}, "offset" : {}, "max_count" : {}, "maxCount" : {}, "-m" : {},
3232 "max_columns" : {}, "maxColumns" : {}, "max-columns" : {}, "--max-columns" : {},
33- "context" : {}, "-C" : {}, "before_context" : {}, "beforeContext" : {}, "-B" : {}, "after_context" : {}, "afterContext" : {}, "-A" : {}, "line_numbers" : {}, "lineNumbers" : {}, "-n" : {},
34- "ignore_case" : {}, "case_insensitive" : {}, "caseInsensitive" : {}, "-i" : {},
35- "fixed_strings" : {}, "fixedStrings" : {}, "-F" : {}, "multiline" : {},
36- "word_regexp" : {}, "wordRegexp" : {}, "word-regexp" : {}, "-w" : {},
37- "invert_match" : {}, "invertMatch" : {}, "invert-match" : {}, "-v" : {},
38- "only_matching" : {}, "onlyMatching" : {}, "only-matching" : {}, "-o" : {},
33+ "context" : {}, "-C" : {}, "before_context" : {}, "beforeContext" : {}, "-B" : {}, "after_context" : {}, "afterContext" : {}, "-A" : {}, "line_numbers" : {}, "lineNumbers" : {}, "line-number" : {}, "--line-number" : {}, " -n" : {},
34+ "ignore_case" : {}, "case_insensitive" : {}, "caseInsensitive" : {}, "ignore-case" : {}, "--ignore-case" : {}, " -i" : {},
35+ "fixed_strings" : {}, "fixedStrings" : {}, "fixed-strings" : {}, "--fixed-strings" : {}, " -F" : {}, "multiline" : {},
36+ "word_regexp" : {}, "wordRegexp" : {}, "word-regexp" : {}, "--word-regexp" : {}, "- w" : {},
37+ "invert_match" : {}, "invertMatch" : {}, "invert-match" : {}, "--invert-match" : {}, "- v" : {},
38+ "only_matching" : {}, "onlyMatching" : {}, "only-matching" : {}, "--only-matching" : {}, "- o" : {},
3939 "files_with_match" : {}, "filesWithMatch" : {}, "files-with-match" : {}, "--files-with-match" : {}, "files_with_matches" : {}, "filesWithMatches" : {}, "files-with-matches" : {}, "--files-with-matches" : {}, "-l" : {},
4040 "files_without_match" : {}, "filesWithoutMatch" : {}, "files-without-match" : {}, "--files-without-match" : {}, "files_without_matches" : {}, "filesWithoutMatches" : {}, "files-without-matches" : {}, "--files-without-matches" : {}, "-L" : {},
4141 "count_matches" : {}, "countMatches" : {}, "count-matches" : {}, "--count-matches" : {},
@@ -49,12 +49,12 @@ var grepSemanticNumberKeys = map[string]struct{}{
4949}
5050
5151var grepSemanticBooleanKeys = map [string ]struct {}{
52- "line_numbers" : {}, "lineNumbers" : {}, "-n" : {},
53- "ignore_case" : {}, "case_insensitive" : {}, "caseInsensitive" : {}, "-i" : {},
54- "fixed_strings" : {}, "fixedStrings" : {}, "-F" : {}, "multiline" : {},
55- "word_regexp" : {}, "wordRegexp" : {}, "word-regexp" : {}, "-w" : {},
56- "invert_match" : {}, "invertMatch" : {}, "invert-match" : {}, "-v" : {},
57- "only_matching" : {}, "onlyMatching" : {}, "only-matching" : {}, "-o" : {},
52+ "line_numbers" : {}, "lineNumbers" : {}, "line-number" : {}, "--line-number" : {}, " -n" : {},
53+ "ignore_case" : {}, "case_insensitive" : {}, "caseInsensitive" : {}, "ignore-case" : {}, "--ignore-case" : {}, " -i" : {},
54+ "fixed_strings" : {}, "fixedStrings" : {}, "fixed-strings" : {}, "--fixed-strings" : {}, " -F" : {}, "multiline" : {},
55+ "word_regexp" : {}, "wordRegexp" : {}, "word-regexp" : {}, "--word-regexp" : {}, "- w" : {},
56+ "invert_match" : {}, "invertMatch" : {}, "invert-match" : {}, "--invert-match" : {}, "- v" : {},
57+ "only_matching" : {}, "onlyMatching" : {}, "only-matching" : {}, "--only-matching" : {}, "- o" : {},
5858 "files_with_match" : {}, "filesWithMatch" : {}, "files-with-match" : {}, "--files-with-match" : {}, "files_with_matches" : {}, "filesWithMatches" : {}, "files-with-matches" : {}, "--files-with-matches" : {}, "-l" : {},
5959 "files_without_match" : {}, "filesWithoutMatch" : {}, "files-without-match" : {}, "--files-without-match" : {}, "files_without_matches" : {}, "filesWithoutMatches" : {}, "files-without-matches" : {}, "--files-without-matches" : {}, "-L" : {},
6060 "count_matches" : {}, "countMatches" : {}, "count-matches" : {}, "--count-matches" : {},
@@ -98,25 +98,34 @@ type grepInput struct {
9898 ShortAfterContext * int `json:"-A,omitempty"`
9999 LineNumbers * bool `json:"line_numbers,omitempty"`
100100 LineNumbersAlt * bool `json:"lineNumbers,omitempty"`
101+ LineNumbersDash * bool `json:"line-number,omitempty"`
102+ LongLineNumbers * bool `json:"--line-number,omitempty"`
101103 ShortLineNumbers * bool `json:"-n,omitempty"`
102104 IgnoreCase bool `json:"ignore_case,omitempty"`
103105 CaseInsensitive bool `json:"case_insensitive,omitempty"`
104106 CaseInsensitiveAlt bool `json:"caseInsensitive,omitempty"`
107+ IgnoreCaseDash bool `json:"ignore-case,omitempty"`
108+ LongIgnoreCase bool `json:"--ignore-case,omitempty"`
105109 ShortIgnoreCase bool `json:"-i,omitempty"`
106110 FixedStrings bool `json:"fixed_strings,omitempty"`
107111 FixedStringsAlt bool `json:"fixedStrings,omitempty"`
112+ FixedStringsDash bool `json:"fixed-strings,omitempty"`
113+ LongFixedStrings bool `json:"--fixed-strings,omitempty"`
108114 ShortFixedStrings bool `json:"-F,omitempty"`
109115 WordRegexp bool `json:"word_regexp,omitempty"`
110116 WordRegexpAlt bool `json:"wordRegexp,omitempty"`
111117 WordRegexpDash bool `json:"word-regexp,omitempty"`
118+ LongWordRegexp bool `json:"--word-regexp,omitempty"`
112119 ShortWordRegexp bool `json:"-w,omitempty"`
113120 InvertMatch bool `json:"invert_match,omitempty"`
114121 InvertMatchAlt bool `json:"invertMatch,omitempty"`
115122 InvertMatchDash bool `json:"invert-match,omitempty"`
123+ LongInvertMatch bool `json:"--invert-match,omitempty"`
116124 ShortInvertMatch bool `json:"-v,omitempty"`
117125 OnlyMatching bool `json:"only_matching,omitempty"`
118126 OnlyMatchingAlt bool `json:"onlyMatching,omitempty"`
119127 OnlyMatchingDash bool `json:"only-matching,omitempty"`
128+ LongOnlyMatching bool `json:"--only-matching,omitempty"`
120129 ShortOnlyMatching bool `json:"-o,omitempty"`
121130 FilesWithMatch bool `json:"files_with_match,omitempty"`
122131 FilesWithMatchAlt bool `json:"filesWithMatch,omitempty"`
@@ -263,25 +272,34 @@ func NewGrepTool() tool.Tool {
263272 "-A" : map [string ]any {"type" : "integer" },
264273 "line_numbers" : map [string ]any {"type" : "boolean" },
265274 "lineNumbers" : map [string ]any {"type" : "boolean" },
275+ "line-number" : map [string ]any {"type" : "boolean" },
276+ "--line-number" : map [string ]any {"type" : "boolean" },
266277 "-n" : map [string ]any {"type" : "boolean" },
267278 "ignore_case" : map [string ]any {"type" : "boolean" },
268279 "case_insensitive" : map [string ]any {"type" : "boolean" },
269280 "caseInsensitive" : map [string ]any {"type" : "boolean" },
281+ "ignore-case" : map [string ]any {"type" : "boolean" },
282+ "--ignore-case" : map [string ]any {"type" : "boolean" },
270283 "-i" : map [string ]any {"type" : "boolean" },
271284 "fixed_strings" : map [string ]any {"type" : "boolean" },
272285 "fixedStrings" : map [string ]any {"type" : "boolean" },
286+ "fixed-strings" : map [string ]any {"type" : "boolean" },
287+ "--fixed-strings" : map [string ]any {"type" : "boolean" },
273288 "-F" : map [string ]any {"type" : "boolean" },
274289 "word_regexp" : map [string ]any {"type" : "boolean" },
275290 "wordRegexp" : map [string ]any {"type" : "boolean" },
276291 "word-regexp" : map [string ]any {"type" : "boolean" },
292+ "--word-regexp" : map [string ]any {"type" : "boolean" },
277293 "-w" : map [string ]any {"type" : "boolean" },
278294 "invert_match" : map [string ]any {"type" : "boolean" },
279295 "invertMatch" : map [string ]any {"type" : "boolean" },
280296 "invert-match" : map [string ]any {"type" : "boolean" },
297+ "--invert-match" : map [string ]any {"type" : "boolean" },
281298 "-v" : map [string ]any {"type" : "boolean" },
282299 "only_matching" : map [string ]any {"type" : "boolean" },
283300 "onlyMatching" : map [string ]any {"type" : "boolean" },
284301 "only-matching" : map [string ]any {"type" : "boolean" },
302+ "--only-matching" : map [string ]any {"type" : "boolean" },
285303 "-o" : map [string ]any {"type" : "boolean" },
286304 "files_with_match" : map [string ]any {
287305 "type" : "boolean" ,
@@ -338,7 +356,7 @@ func NewGrepTool() tool.Tool {
338356 },
339357 },
340358 PromptFunc : func (tool.PromptContext ) (string , error ) {
341- return "Searches text files under path using a regular expression or fixed string. output_mode may be files_with_matches, files_without_matches, content, or count; glob/-g/--glob and type/-t/--type optionally filter file paths. glob accepts whitespace/comma-separated patterns and brace alternation. content mode supports context, before_context, after_context, -C, -B, -A, -n line-number control, offset, head_limit pagination, max_count/-m per-file match limiting, max_columns/--max-columns long-line omission, and only_matching/-o matched-text output. Use files_with_matches or -l to list files with matches, and files_without_match or -L to list files without matches. Count mode supports count_matches/--count-matches for occurrence counts. Use fixed_strings or -F for literal matching, word_regexp or -w for whole-word matches, and invert_match or -v to select non-matching lines. Set no_ignore/--no-ignore to skip .gitignore/.ignore files while still excluding VCS metadata and read-denied paths. Set multiline to allow patterns to span lines with dot matching newlines." , nil
359+ return "Searches text files under path using a regular expression or fixed string. output_mode may be files_with_matches, files_without_matches, content, or count; glob/-g/--glob and type/-t/--type optionally filter file paths. glob accepts whitespace/comma-separated patterns and brace alternation. content mode supports context, before_context, after_context, -C, -B, -A, -n/--line-number line-number control, offset, head_limit pagination, max_count/-m per-file match limiting, max_columns/--max-columns long-line omission, and only_matching/-o/--only-matching matched-text output. Use files_with_matches or -l to list files with matches, and files_without_match or -L to list files without matches. Count mode supports count_matches/--count-matches for occurrence counts. Use fixed_strings/-F/--fixed-strings for literal matching, word_regexp/-w/--word-regexp for whole-word matches, ignore_case/-i/--ignore-case for case-insensitive search, and invert_match/-v/--invert-match to select non-matching lines. Set no_ignore/--no-ignore to skip .gitignore/.ignore files while still excluding VCS metadata and read-denied paths. Set multiline to allow patterns to span lines with dot matching newlines." , nil
342360 },
343361 NormalizeFunc : normalizeGrepRawInput ,
344362 ValidateFunc : validateGrep ,
@@ -1217,23 +1235,44 @@ func grepTypeFilter(input grepInput) string {
12171235}
12181236
12191237func grepCaseInsensitive (input grepInput ) bool {
1220- return input .IgnoreCase || input .CaseInsensitive || input .CaseInsensitiveAlt || input .ShortIgnoreCase
1238+ return input .IgnoreCase ||
1239+ input .CaseInsensitive ||
1240+ input .CaseInsensitiveAlt ||
1241+ input .IgnoreCaseDash ||
1242+ input .LongIgnoreCase ||
1243+ input .ShortIgnoreCase
12211244}
12221245
12231246func grepFixedStrings (input grepInput ) bool {
1224- return input .FixedStrings || input .FixedStringsAlt || input .ShortFixedStrings
1247+ return input .FixedStrings ||
1248+ input .FixedStringsAlt ||
1249+ input .FixedStringsDash ||
1250+ input .LongFixedStrings ||
1251+ input .ShortFixedStrings
12251252}
12261253
12271254func grepWordRegexp (input grepInput ) bool {
1228- return input .WordRegexp || input .WordRegexpAlt || input .WordRegexpDash || input .ShortWordRegexp
1255+ return input .WordRegexp ||
1256+ input .WordRegexpAlt ||
1257+ input .WordRegexpDash ||
1258+ input .LongWordRegexp ||
1259+ input .ShortWordRegexp
12291260}
12301261
12311262func grepInvertMatch (input grepInput ) bool {
1232- return input .InvertMatch || input .InvertMatchAlt || input .InvertMatchDash || input .ShortInvertMatch
1263+ return input .InvertMatch ||
1264+ input .InvertMatchAlt ||
1265+ input .InvertMatchDash ||
1266+ input .LongInvertMatch ||
1267+ input .ShortInvertMatch
12331268}
12341269
12351270func grepOnlyMatching (input grepInput ) bool {
1236- return input .OnlyMatching || input .OnlyMatchingAlt || input .OnlyMatchingDash || input .ShortOnlyMatching
1271+ return input .OnlyMatching ||
1272+ input .OnlyMatchingAlt ||
1273+ input .OnlyMatchingDash ||
1274+ input .LongOnlyMatching ||
1275+ input .ShortOnlyMatching
12371276}
12381277
12391278func grepFilesWithMatches (input grepInput ) bool {
@@ -1278,6 +1317,12 @@ func grepLineNumbers(input grepInput, mode string) bool {
12781317 if input .LineNumbersAlt != nil {
12791318 return * input .LineNumbersAlt
12801319 }
1320+ if input .LineNumbersDash != nil {
1321+ return * input .LineNumbersDash
1322+ }
1323+ if input .LongLineNumbers != nil {
1324+ return * input .LongLineNumbers
1325+ }
12811326 if input .ShortLineNumbers == nil {
12821327 return true
12831328 }
0 commit comments