Class: RosettAi::Retrofit::Parsers::AgentsMdParser

Inherits:
BaseParser
  • Object
show all
Defined in:
lib/rosett_ai/retrofit/parsers/agents_md_parser.rb

Overview

Retrofit parser for AGENTS.md files.

Discovers and parses AGENTS.md in the project root into a structured Rosett-AI YAML representation.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Methods inherited from BaseParser

#available?

Instance Method Details

#discoverObject



21
22
23
24
25
26
27
28
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 21

def discover
  project_root = Pathname.new(ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd))
  agents_md = project_root.join('AGENTS.md')

  return [agents_md] if agents_md.exist? && safe_path?(agents_md)

  []
end

#engine_nameObject



17
18
19
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 17

def engine_name
  'agents_md'
end

#parse(path) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 30

def parse(path)
  validate_path!(path)
  content = File.read(path)

  {
    data: { 'agents_md_content' => content },
    unknown_keys: [],
    source_file: path.to_s,
    scope: 'project'
  }
end