module ReactOnRails::GitUtils

def self.worktree_status

def self.worktree_status
  output, status = Open3.capture2e("git", "status", "--porcelain")
  return :clean if status.success? && output.strip.empty?
  # Exit code 128 is git's standard fatal error (e.g., not a git repository)
  return :not_a_git_repository if status.exitstatus == 128
  :dirty
rescue Errno::ENOENT
  # git binary not found despite passing the cli_exists? check
  :git_not_installed
end