Class: OllamaAgent::State::ASTSummarizer

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

Overview

Prism-based structural summaries for re-entry packets (bounded semantic context).

Defined Under Namespace

Classes: SummaryVisitor

Instance Method Summary collapse

Constructor Details

#initialize(workspace_root:) ⇒ ASTSummarizer

Returns a new instance of ASTSummarizer.



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

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

Instance Method Details

#summarize(file_paths:, touched_methods: []) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/ollama_agent/state/ast_summarizer.rb', line 13

def summarize(file_paths:, touched_methods: [])
  touched = Array(touched_methods).map(&:to_s).uniq
  files = {}
  Array(file_paths).each do |raw_path|
    rel = relativize(raw_path)
    files[rel] = summarize_one(rel, touched)
  end
  { files: files }
end