Module: OllamaAgent::AgentRootResolver
- Defined in:
- lib/ollama_agent/agent_root_resolver.rb
Overview
Resolves and normalizes the agent workspace root from explicit config or ENV.
Class Method Summary collapse
-
.resolve(explicit, env: ENV, cwd: Dir.pwd) ⇒ String
Absolute path (best-effort realpath when the path exists).
Class Method Details
.resolve(explicit, env: ENV, cwd: Dir.pwd) ⇒ String
Returns absolute path (best-effort realpath when the path exists).
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ollama_agent/agent_root_resolver.rb', line 12 def resolve(explicit, env: ENV, cwd: Dir.pwd) raw = explicit raw = env.fetch("OLLAMA_AGENT_ROOT", nil) if raw.nil? || raw.to_s.strip.empty? raw = cwd if raw.nil? || raw.to_s.strip.empty? = File.(raw.to_s, cwd) File.realpath() rescue Errno::ENOENT, Errno::ELOOP, Errno::EACCES, Errno::ENOTDIR end |