Class: RailsAiBridge::Tools::SearchCode::RipgrepSearch::CommandBuilder
- Inherits:
-
Object
- Object
- RailsAiBridge::Tools::SearchCode::RipgrepSearch::CommandBuilder
- Defined in:
- lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb
Overview
Builds the CLI command string.
Constant Summary collapse
- SECRET_EXCLUDES =
Extensions and globs that should never be searched (lowercase and uppercase variants).
%w[ *.key *.KEY *.pem *.PEM *.p12 *.P12 *.pfx *.PFX *.crt *.CRT .env .env.* .ENV .ENV.* ].freeze
Instance Method Summary collapse
-
#build ⇒ Array<String>
Builds the full ripgrep command array.
-
#initialize(params) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
Constructor Details
#initialize(params) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
66 67 68 69 70 71 |
# File 'lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb', line 66 def initialize(params) @pattern = params[:pattern] @path = params[:search_path] @file_type = params[:file_type] @max = params[:max_results] end |
Instance Method Details
#build ⇒ Array<String>
Builds the full ripgrep command array.
76 77 78 79 80 81 82 |
# File 'lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb', line 76 def build cmd = ['rg', '--no-heading', '--line-number', '--max-count', @max.to_s] cmd.concat(excluded_path_flags) cmd.concat(secret_exclude_flags) cmd.concat(file_type_filters) cmd.push(@pattern, @path) end |