Class: SolidAgent::AgentManifest::Parsers::BaseParser
- Inherits:
-
Object
- Object
- SolidAgent::AgentManifest::Parsers::BaseParser
- Defined in:
- lib/solid_agent/agent_manifest/parsers/base_parser.rb
Overview
BaseParser provides common functionality for all format parsers.
Subclasses should implement:
- .parse_string(content) - Parse content string into a Manifest
- .format_name - Return the format identifier symbol
Direct Known Subclasses
AgentMdParser, CrewAIParser, DotpromptParser, GitHubPromptParser
Constant Summary collapse
- FRONTMATTER_REGEX =
/\A---\s*\n(.*?)\n---\s*\n(.*)\z/m
Class Method Summary collapse
-
.format_name ⇒ Symbol
Get the format name for this parser.
-
.parse(path) ⇒ Manifest
Parse a file into a Manifest.
-
.parse_string(content) ⇒ Manifest
Parse content string into a Manifest.
Class Method Details
.format_name ⇒ Symbol
Get the format name for this parser
49 50 51 |
# File 'lib/solid_agent/agent_manifest/parsers/base_parser.rb', line 49 def format_name raise NotImplementedError, "#{self}.format_name must be implemented by subclass" end |
.parse(path) ⇒ Manifest
Parse a file into a Manifest
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/solid_agent/agent_manifest/parsers/base_parser.rb', line 20 def parse(path) content = File.read(path, encoding: "UTF-8") manifest = parse_string(content) # Handle array results (e.g., CrewAI with multiple agents) if manifest.is_a?(Array) manifest.each do |m| m.source_path = path m.source_format = format_name end else manifest.source_path = path manifest.source_format = format_name end manifest end |
.parse_string(content) ⇒ Manifest
Parse content string into a Manifest
42 43 44 |
# File 'lib/solid_agent/agent_manifest/parsers/base_parser.rb', line 42 def parse_string(content) raise NotImplementedError, "#{self}.parse_string must be implemented by subclass" end |