Class: RailsAiContext::Tools::GetConcern

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

Constant Summary collapse

SECTION_ORDER =

Model and controller concerns lead because that is where most apps keep most of them; anything else follows in discovery order.

%w[model controller mailer job channel helper].freeze

Constants inherited from BaseTool

BaseTool::DEFAULT_SESSION, BaseTool::MAX_SESSIONS, BaseTool::MAX_SESSION_ID_LENGTH, BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE

Class Method Summary collapse

Methods inherited from BaseTool

abstract!, abstract?, api_only_app?, api_only_note, cache_key, cached_context, config, current_session, #dedupe_put_patch_routes, detail_param?, error_response, evict_oldest_sessions, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, guide_row, inherited, introspection_warnings_note, invalid_detail_note, normalize_detail, not_found_response, paginate, rails_app, rails_env_name, registered_tools, reset_all_caches!, reset_cache!, session_from, session_params, session_queries, session_record, session_reset!, static_tier_banner, static_tier_refusal, text_response, touch_session, unavailable_note, with_session, with_session_for

Methods included from SectionFetch

#fetch_section, usable?

Class Method Details

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rails_ai_context/tools/get_concern.rb', line 43

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