Class: RosettAi::Retrofit::Parsers::AgentsMdParser
- Inherits:
-
BaseParser
- Object
- BaseParser
- RosettAi::Retrofit::Parsers::AgentsMdParser
- 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.
Instance Method Summary collapse
Methods inherited from BaseParser
Instance Method Details
#discover ⇒ Object
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_name ⇒ Object
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 |