Module: Ace::LLM::Providers::CLI::Atoms::ExecutionContext

Defined in:
lib/ace/llm/providers/cli/atoms/execution_context.rb

Overview

Resolves filesystem execution context for CLI-backed providers.

Class Method Summary collapse

Class Method Details

.resolve_working_dir(working_dir: nil, subprocess_env: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ace/llm/providers/cli/atoms/execution_context.rb', line 12

def resolve_working_dir(working_dir: nil, subprocess_env: nil)
  explicit = working_dir.to_s.strip
  return File.expand_path(explicit) unless explicit.empty?

  env = subprocess_env.respond_to?(:to_h) ? subprocess_env.to_h : {}
  project_root = env["PROJECT_ROOT_PATH"] || env[:PROJECT_ROOT_PATH]
  project_root = project_root.to_s.strip
  return File.expand_path(project_root) unless project_root.empty?

  Dir.pwd
end