Module: Axn::Core::Naming

Defined in:
lib/axn/core/naming.rb

Defined Under Namespace

Modules: ClassMethods, DescriptionMethod

Constant Summary collapse

ANONYMOUS =
"Anonymous Axn"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/axn/core/naming.rb', line 8

def self.included(base)
  base.class_eval do
    # instance_accessor: false — this is a class-level DSL, not per-instance state.
    class_attribute :_axn_name, :_axn_description, instance_accessor: false, default: nil
    extend ClassMethods
  end

  # `description` is generic enough that an adapter base class (e.g. ::MCP::Tool) is likely to
  # already define its own, differently-scoped one. Only layer axn's on when the name is free —
  # otherwise `extend` would sit above that base class and silently shadow it (PRO-2875).
  if Axn::Core::MethodShadowing.externally_defined?(base, :description)
    Axn.config.logger.debug do
      "[Axn] #{base.name || 'Action'}: skipping axn's class-level `description` DSL (already defined by a non-Axn ancestor)"
    end
  else
    base.extend(DescriptionMethod)
  end
end