Class: RosettAi::Provenance::Tracker
- Inherits:
-
Object
- Object
- RosettAi::Provenance::Tracker
- Defined in:
- lib/rosett_ai/provenance/tracker.rb
Overview
MCP-facing facade for provenance operations.
Delegates to Store for the actual provenance logic, providing the simplified interface expected by Mcp::Tools::ProvenanceTool.
Instance Method Summary collapse
-
#find_by_commit(commit) ⇒ Hash?
Finds provenance entries for a specific commit.
-
#find_by_file(file) ⇒ Array<Hash>
Finds provenance entries referencing a file.
-
#initialize(root: Dir.pwd) ⇒ Tracker
constructor
A new instance of Tracker.
-
#log(role: nil) ⇒ Array<Hash>
Returns provenance log, optionally filtered by role.
-
#validate ⇒ Hash
Validates all provenance entries and hash chain integrity.
Constructor Details
Instance Method Details
#find_by_commit(commit) ⇒ Hash?
Finds provenance entries for a specific commit.
35 36 37 38 |
# File 'lib/rosett_ai/provenance/tracker.rb', line 35 def find_by_commit(commit) entries = @store.entries_for_commit(commit) entries.first end |
#find_by_file(file) ⇒ Array<Hash>
Finds provenance entries referencing a file.
44 45 46 |
# File 'lib/rosett_ai/provenance/tracker.rb', line 44 def find_by_file(file) @store.entries_for_file(file) end |
#log(role: nil) ⇒ Array<Hash>
Returns provenance log, optionally filtered by role.
52 53 54 55 56 57 58 59 |
# File 'lib/rosett_ai/provenance/tracker.rb', line 52 def log(role: nil) return [] unless @store.exist? entries = @store.read['entries'] || [] return entries unless role entries.select { |e| e['role'] == role } end |
#validate ⇒ Hash
Validates all provenance entries and hash chain integrity.
24 25 26 27 28 29 |
# File 'lib/rosett_ai/provenance/tracker.rb', line 24 def validate errors = [] errors << 'Provenance file not found' unless @store.exist? errors.concat(@store.verify_chain) if @store.exist? { errors: errors } end |