Class: VSM::Meta::Tools::ExplainTool

Inherits:
Base show all
Defined in:
lib/vsm/meta/tools.rb

Instance Attribute Summary

Attributes inherited from Base

#draft_store, #root, #snapshot_cache

Attributes inherited from ToolCapsule

#governance

Instance Method Summary collapse

Methods inherited from Base

#execution_mode, #initialize

Methods included from ActsAsTool

included, #tool_descriptor

Constructor Details

This class inherits a constructor from VSM::Meta::Tools::Base

Instance Method Details

#run(args) ⇒ Object



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/vsm/meta/tools.rb', line 191

def run(args)
  target = args["tool"].to_s.strip
  raise "tool name required" if target.empty?

  entry = tool_index[target]
  raise "unknown tool: #{target}" unless entry

  descriptor = entry[:tool] || {}
  run_source = source_for(entry, "run")

  {
    tool: {
      name: descriptor[:name] || entry[:name],
      capsule_path: entry[:path],
      class: entry[:class],
      description: descriptor[:description],
      schema: descriptor[:schema]
    },
    code: run_source,
    source_locations: entry[:source_locations],
    parent_roles: roles_summary(snapshot[:roles])
  }
end