Class: Reviewer::Capabilities
- Inherits:
-
Object
- Object
- Reviewer::Capabilities
- 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.
Constant Summary collapse
- KEYWORD_DESCRIPTIONS =
Descriptions for the reserved keywords. The keys are derived from Arguments::Keywords::RESERVED rather than restated, so a keyword can never exist in one place and be invisible in the other -- agents are told to use only names this payload lists.
{ 'staged' => 'Files staged for commit', 'unstaged' => 'Files with unstaged changes', 'modified' => 'All changed files', 'untracked' => 'New files not yet tracked', 'failed' => 'Tools whose last executed review failed and have not passed since' }.freeze
- KEYWORDS =
Arguments::Keywords::RESERVED.to_h do |keyword| [keyword.to_sym, KEYWORD_DESCRIPTIONS.fetch(keyword)] end.freeze
- SCENARIOS =
{ before_commit: 'rvw staged', during_development: 'rvw modified', full_review: 'rvw' }.freeze
Instance Attribute Summary collapse
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
-
#initialize(tools:) ⇒ Capabilities
constructor
Creates a capabilities report for machine-readable tool discovery.
-
#to_h ⇒ Hash
Convert capabilities to a hash representation.
-
#to_json(*_args) ⇒ String
Convert capabilities to formatted JSON string.
Constructor Details
#initialize(tools:) ⇒ Capabilities
Creates a capabilities report for machine-readable tool discovery
18 19 20 |
# File 'lib/reviewer/capabilities.rb', line 18 def initialize(tools:) @tools = tools end |
Instance Attribute Details
#tools ⇒ Object (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_h ⇒ Hash
Convert capabilities to a hash representation
47 48 49 50 51 52 53 54 55 |
# File 'lib/reviewer/capabilities.rb', line 47 def to_h { version: VERSION, tools: tools_data, tags: tag_list, keywords: KEYWORDS, scenarios: SCENARIOS } end |
#to_json(*_args) ⇒ String
Convert capabilities to formatted JSON string
60 61 62 |
# File 'lib/reviewer/capabilities.rb', line 60 def to_json(*_args) JSON.pretty_generate(to_h) end |