Class: RailsAiContext::Tools::GetConcern

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/rails_ai_context/tools/get_concern.rb

Constant Summary

Constants inherited from BaseTool

BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE

Class Method Summary collapse

Methods inherited from BaseTool

abstract!, abstract?, cache_key, cached_context, config, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, inherited, not_found_response, paginate, rails_app, registered_tools, reset_all_caches!, reset_cache!, session_queries, session_record, session_reset!, set_call_params, text_response

Class Method Details

.call(name: nil, type: "all", detail: "standard", server_context: nil) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rails_ai_context/tools/get_concern.rb', line 32

def self.call(name: nil, type: "all", detail: "standard", server_context: nil)
  root = rails_app.root.to_s
  max_size = RailsAiContext.configuration.max_file_size

  concern_dirs = resolve_concern_dirs(root, type)

  if concern_dirs.empty?
    return text_response("No concern directories found. Searched: #{searched_dirs(type).join(', ')}")
  end

  # Specific concern — full detail
  if name
    return show_concern(name, concern_dirs, root, max_size, detail)
  end

  # List all concerns
  list_concerns(concern_dirs, root, max_size)
end