CommandCodeAI / CommandCodeAI/command-code

grep tool passes empty file type to ripgrep

Đang mở Phù hợp với người mới
#655 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
4k
Fork
350
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

  1. Run Command Code 1.14.0 on macOS.
  2. Ask Command Code to search project log files for errors.
  3. Command Code invokes the built-in grep tool with a valid project path, glob: "**/*.log", and an error pattern.
  4. Leave the file type empty or unset.
  5. Observe rg: unrecognized file type:.
  6. Setting the type to text produces rg: unrecognized file type: text instead.

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ phần triển khai công cụ grep tích hợp sẵn và entry point xây dựng các đối số ripgrep của nó. Tái hiện vấn đề với một glob và một type chưa được thiết lập, sau đó xác minh rằng không có type rỗng nào được truyền vào và các type không được hỗ trợ nhận được lỗi rõ ràng. Chạy các bài kiểm thử hiện có của công cụ grep, nếu có, và bổ sung độ bao phủ cho cả hai trường hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cli
Lĩnh vực
cli, tooling
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.