Class: Textus::Read::Capabilities
- Inherits:
-
Object
- Object
- Textus::Read::Capabilities
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/read/capabilities.rb
Overview
A machine-readable projection of the contract surface: every verb, the transports it reaches, and its full argument schema — sourced from the same Contract DSL the CLI/MCP/boot already project from (ADR 0039/0063).
Integrators assert their docs against this in CI so they can’t drift (#161 F4 — patrick-nexus docs claimed “MCP exposes 3 verbs” while ~20 are surfaced). It also makes the per-surface ‘dry_run` default asymmetry (#161 F6) self-documenting: each arg carries both `default` (agent wire) and `cli_default` (CLI), so the divergence is visible, not folklore.
Pure contract introspection — it reads no store data; ‘container` is accepted only for the uniform use-case constructor.
Instance Method Summary collapse
- #call(verb: nil) ⇒ Object
-
#initialize(container: nil, call: nil) ⇒ Capabilities
constructor
A new instance of Capabilities.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, summary, surfaces, verb, view
Constructor Details
#initialize(container: nil, call: nil) ⇒ Capabilities
Returns a new instance of Capabilities.
24 |
# File 'lib/textus/read/capabilities.rb', line 24 def initialize(container: nil, call: nil); end |
Instance Method Details
#call(verb: nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/textus/read/capabilities.rb', line 26 def call(verb: nil) klasses = Textus::Dispatcher::VERBS.values.select { |k| contract?(k) } rows = klasses.map { |k| project(k.contract) } rows.select! { |r| r["verb"] == verb } if verb { "verbs" => rows.sort_by { |r| r["verb"] } } end |