Class: RubynCode::IDE::Handlers::ReviewHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyn_code/ide/handlers/review_handler.rb

Overview

Handles the “review” JSON-RPC request.

Delegates to the existing ReviewPr tool, running it in a background thread. Emits review/finding notifications as findings are extracted from the review output.

Constant Summary collapse

SEVERITY_PATTERN =

Extract structured findings from the raw review text. Looks for severity markers like [critical], [warning], etc.

/\[(critical|warning|suggestion|nitpick)\]/i

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ ReviewHandler

Returns a new instance of ReviewHandler.



12
13
14
# File 'lib/rubyn_code/ide/handlers/review_handler.rb', line 12

def initialize(server)
  @server = server
end

Instance Method Details

#call(params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubyn_code/ide/handlers/review_handler.rb', line 16

def call(params)
  base_branch = params['baseBranch'] || 'main'
  focus       = params['focus'] || 'all'
  session_id  = params['sessionId'] || SecureRandom.uuid

  Thread.new do
    run_review(session_id, base_branch, focus)
  end

  { 'accepted' => true, 'sessionId' => session_id }
end