Class: RubyCoded::Tools::ListDirectoryTool
- Defined in:
- lib/ruby_coded/tools/list_directory_tool.rb
Overview
List files and directories at the given path relative to the project root
Constant Summary collapse
- IGNORED_DIRS =
%w[ .git node_modules vendor/bundle tmp log .bundle .cache coverage .yardoc pkg dist build ].freeze
Constants inherited from BaseTool
BaseTool::CONFIRM_RISK, BaseTool::DANGEROUS_RISK, BaseTool::SAFE_RISK
Instance Method Summary collapse
Methods inherited from BaseTool
Constructor Details
This class inherits a constructor from RubyCoded::Tools::BaseTool
Instance Method Details
#execute(path:, include_hidden: false) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/ruby_coded/tools/list_directory_tool.rb', line 24 def execute(path:, include_hidden: false) full_path = validate_path!(path) return full_path if full_path.is_a?(Hash) return { error: "Directory not found: #{path}" } unless File.exist?(full_path) return { error: "Not a directory: #{path}" } unless File.directory?(full_path) list_entries(full_path, include_hidden) end |