Class: RosettAi::Retrofit::Parsers::ClaudeParser
- Inherits:
-
BaseParser
- Object
- BaseParser
- RosettAi::Retrofit::Parsers::ClaudeParser
- Defined in:
- lib/rosett_ai/retrofit/parsers/claude_parser.rb
Overview
Retrofit parser for Claude Code configuration files.
Discovers and parses ~/.claude/settings.json and project-level .claude/settings.json into Rosett-AI YAML structure.
Constant Summary collapse
- KNOWN_KEYS =
[ 'permissions', 'allowedTools', 'deniedTools', 'trustedTools', 'env', 'hooks', 'mcpServers', 'customApiKeyResponses', 'contextProviders', 'preferences' ].freeze
Instance Method Summary collapse
Methods inherited from BaseParser
Instance Method Details
#discover ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rosett_ai/retrofit/parsers/claude_parser.rb', line 27 def discover paths = [] global = Pathname.new(Dir.home).join('.claude', 'settings.json') paths << global if global.exist? && safe_path?(global) local = Pathname.new(ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd)).join('.claude', 'settings.json') paths << local if local.exist? && safe_path?(local) && local != global paths end |
#engine_name ⇒ Object
23 24 25 |
# File 'lib/rosett_ai/retrofit/parsers/claude_parser.rb', line 23 def engine_name 'claude' end |
#parse(path) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rosett_ai/retrofit/parsers/claude_parser.rb', line 38 def parse(path) validate_path!(path) content = File.read(path) data = JSON.parse(content) unknown_keys = data.keys.reject { |key| KNOWN_KEYS.include?(key) } { data: data, unknown_keys: unknown_keys.map { |key| sanitize(key) }, source_file: path.to_s, scope: detect_scope(path) } end |