Class: OllamaAgent::State::Reconciler

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/state/reconciler.rb

Overview

Compares pre/post workspace fingerprints and surfaces git-visible drift.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workspace_root:, fingerprint_calculator:) ⇒ Reconciler

Returns a new instance of Reconciler.



11
12
13
14
# File 'lib/ollama_agent/state/reconciler.rb', line 11

def initialize(workspace_root:, fingerprint_calculator:)
  @workspace_root = workspace_root.to_s
  @fingerprint_calculator = fingerprint_calculator
end

Instance Attribute Details

#fingerprint_calculatorObject (readonly)

Returns the value of attribute fingerprint_calculator.



9
10
11
# File 'lib/ollama_agent/state/reconciler.rb', line 9

def fingerprint_calculator
  @fingerprint_calculator
end

Instance Method Details

#reconcile(pre_fingerprint:, post_state_observer:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ollama_agent/state/reconciler.rb', line 16

def reconcile(pre_fingerprint:, post_state_observer:)
  post_fp = post_state_observer.call.to_s
  pre = pre_fingerprint.to_s
  drifted = pre != post_fp
  changed_files = drifted ? GitChangedPaths.list(@workspace_root) : []
  {
    fingerprint_drifted: drifted,
    changed_files: changed_files,
    conflicts: []
  }
end