class Rails::Command::Base

def default_command_root

would return rails/test.
For a Rails::Command::TestCommand placed in rails/command/test_command.rb

one folder above the command file.
Default file root to place extra files a command might need, placed
def default_command_root
  path = File.expand_path(relative_command_path, __dir__)
  path if File.exist?(path)
end