Class: Space::Architect::SessionSync::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/space_architect/session_sync/runner.rb

Overview

One sync pass: scans the pi + claude session roots, decides upload/skip per the frozen cursor rules, uploads via the injected client, and persists the updated cursor (unless dry_run).

Constant Summary collapse

RECENT_MTIME_SECONDS =
60

Instance Method Summary collapse

Constructor Details

#initialize(client:, state_path:, pi_root:, claude_root:, now: -> { Time.now }, dry_run: false) ⇒ Runner

Returns a new instance of Runner.



14
15
16
17
18
19
20
21
# File 'lib/space_architect/session_sync/runner.rb', line 14

def initialize(client:, state_path:, pi_root:, claude_root:, now: -> { Time.now }, dry_run: false)
  @client = client
  @state_path = state_path
  @pi_root = pi_root
  @claude_root = claude_root
  @now = now
  @dry_run = dry_run
end

Instance Method Details

#callObject



23
24
25
26
27
28
# File 'lib/space_architect/session_sync/runner.rb', line 23

def call
  cursor = Cursor.load(@state_path)
  results = files.map { |path, session_id| process(path, session_id, cursor) }
  Cursor.write(@state_path, cursor) unless @dry_run
  results
end