Module: OllamaAgent::State::GitChangedPaths

Defined in:
lib/ollama_agent/state/git_changed_paths.rb

Overview

Lists paths from git status –porcelain (no shell interpolation).

Class Method Summary collapse

Class Method Details

.list(workspace_root) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ollama_agent/state/git_changed_paths.rb', line 9

def list(workspace_root)
  git_dir = File.join(workspace_root, ".git")
  return [] unless File.directory?(git_dir)

  out = IO.popen(["git", "-C", workspace_root, "status", "--porcelain"], &:read)
  out.to_s.split("\n").filter_map do |line|
    next if line.strip.empty?

    line[3..]&.strip
  end.compact.uniq
end