Class: Reviewer::Capabilities

Inherits:
Object
  • Object
show all
Defined in:
lib/reviewer/capabilities.rb

Overview

Provides machine-readable output describing available tools and usage patterns. Designed for AI agents and automation tools to discover and use Reviewer correctly.

Examples:

puts Reviewer::Capabilities.new.to_json

Constant Summary collapse

KEYWORDS =
{
  staged: 'Files staged for commit',
  unstaged: 'Files with unstaged changes',
  modified: 'All changed files',
  untracked: 'New files not yet tracked'
}.freeze
SCENARIOS =
{
  before_commit: 'rvw staged',
  during_development: 'rvw modified',
  full_review: 'rvw'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tools:) ⇒ Capabilities

Creates a capabilities report for machine-readable tool discovery

Parameters:

  • tools (Tools)

    the tools collection to report on



18
19
20
# File 'lib/reviewer/capabilities.rb', line 18

def initialize(tools:)
  @tools = tools
end

Instance Attribute Details

#toolsObject (readonly)

Returns the value of attribute tools.



12
13
14
# File 'lib/reviewer/capabilities.rb', line 12

def tools
  @tools
end

Instance Method Details

#to_hHash

Convert capabilities to a hash representation

Returns:

  • (Hash)

    structured capabilities data



38
39
40
41
42
43
44
45
# File 'lib/reviewer/capabilities.rb', line 38

def to_h
  {
    version: VERSION,
    tools: tools_data,
    keywords: KEYWORDS,
    scenarios: SCENARIOS
  }
end

#to_json(*_args) ⇒ String

Convert capabilities to formatted JSON string

Returns:

  • (String)

    JSON representation of capabilities



50
51
52
# File 'lib/reviewer/capabilities.rb', line 50

def to_json(*_args)
  JSON.pretty_generate(to_h)
end