Class: RosettAi::Retrofit::Parsers::CursorParser
- Inherits:
-
BaseParser
- Object
- BaseParser
- RosettAi::Retrofit::Parsers::CursorParser
- Defined in:
- lib/rosett_ai/retrofit/parsers/cursor_parser.rb
Overview
Retrofit parser for Cursor configuration files.
Discovers and parses .cursor/settings.json and .cursorrules into Rosett-AI YAML structure.
Constant Summary collapse
- KNOWN_KEYS =
Returns Configuration keys recognized by this parser.
[ 'rules', 'model', 'temperature', 'maxTokens', 'contextFiles', 'ignoreFiles' ].freeze
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.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 32 def discover paths = [] project_root = Pathname.new(ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd)) settings = project_root.join('.cursor', 'settings.json') paths << settings if settings.exist? && safe_path?(settings) rules = project_root.join('.cursorrules') paths << rules if rules.exist? && safe_path?(rules) paths end |
#engine_name ⇒ String
Return the engine identifier string.
26 27 28 |
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 26 def engine_name 'cursor' end |
#parse(path) ⇒ Hash
Parse a native config file into rosett-ai format.
49 50 51 52 53 54 55 56 57 |
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 49 def parse(path) validate_path!(path) if path.extname == '.json' parse_json(path) else parse_rules(path) end end |