CommandCodeAI / CommandCodeAI/command-code
grep tool passes empty file type to ripgrep
Nessuno ha ancora preso questa issue.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 4k
- Fork
- 350
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I asked Command Code to search my project log files for errors using its built-in search tools. Command Code invoked its grep tool, but the search failed before it searched anything.
What I expected
When I ask Command Code to search matching log files with a pattern such as:
- Glob:
**/*.log - Pattern:
error|exception|failed|failure|fatal|critical|warning|stack trace|traceback
I expect Command Code's search tool to search the matching files. If no file type is selected, the tool should search based on the glob alone.
What happened
Command Code's grep tool returned:
grep: rg: unrecognized file type:
This indicates that the tool is passing an empty type value to ripgrep, effectively invoking something like:
rg --type '' ...
Command Code also tried using type: "text", which returned:
grep: rg: unrecognized file type: text
text is not a registered ripgrep file type.
I did not run grep, rg, or the file search manually. Command Code invoked the search tool as part of handling my request.
How to reproduce
- Run Command Code
1.14.0on macOS. - Ask Command Code to search project log files for errors.
- Command Code invokes the built-in
greptool with a valid project path,glob: "**/*.log", and an error pattern. - Leave the file type empty or unset.
- Observe
rg: unrecognized file type:. - Setting the type to
textproducesrg: unrecognized file type: textinstead.
Environment
- Command Code:
1.14.0 - macOS 26.4, ARM64
- zsh (
/bin/zsh)
Workaround
Command Code worked around the problem by using its glob tool to locate log files and then opening the files individually with read_file. That worked, but it is inconvenient for large or numerous log files and does not provide the normal search/context behavior.
I was asking Command Code to investigate real application failures in the logs, including database connection errors, missing database tables, missing PHP classes, an unknown ActiveRecord property, and audit-log schema errors. I have not included any credentials or tokens that were present in those logs.
Possible fix
The type field should be optional, and an empty value should not be passed to ripgrep. The tool could also validate file types against ripgrep's registered types and return a clear validation error for unsupported values.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dall’implementazione dello strumento grep integrato e dall’entry point che costruisce i suoi argomenti ripgrep. Riproduci il problema con un glob e un type non impostato, quindi verifica che non venga passato alcun type vuoto e che i type non supportati ricevano un errore chiaro. Esegui i test esistenti dello strumento grep, se presenti, e aggiungi la copertura per entrambi i casi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cli
- Ambito
- cli, tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100