Class: RosettAi::Retrofit::Parsers::CursorParser

Inherits:
BaseParser
  • Object
show all
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.

Author:

  • hugo

  • claude

Constant Summary collapse

KNOWN_KEYS =
[
  'rules', 'model', 'temperature', 'maxTokens', 'contextFiles', 'ignoreFiles'
].freeze

Instance Method Summary collapse

Methods inherited from BaseParser

#available?

Instance Method Details

#discoverObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 27

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_nameObject



23
24
25
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 23

def engine_name
  'cursor'
end

#parse(path) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/rosett_ai/retrofit/parsers/cursor_parser.rb', line 40

def parse(path)
  validate_path!(path)

  if path.extname == '.json'
    parse_json(path)
  else
    parse_rules(path)
  end
end