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
-
#discover ⇒ Array<String>
Discover native config files for this engine.
-
#engine_name ⇒ String
Return the engine identifier string.
-
#parse(path) ⇒ Hash
Parse a native config file into rosett-ai format.
Methods inherited from BaseParser
Instance Method Details
#discover ⇒ Array<String>
Discover native config files for this engine.
25 26 27 28 29 30 31 32 |
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 25 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 ⇒ String
Return the engine identifier string.
19 20 21 |
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 19 def engine_name 'agents_md' end |
#parse(path) ⇒ Hash
Parse a native config file into rosett-ai format.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rosett_ai/retrofit/parsers/agents_md_parser.rb', line 38 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 |