Class: Rigor::CLI::PluginsCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/rigor/cli/plugins_command.rb

Overview

rigor plugins — reports the activation status of every plugin entry in .rigor.yml so users (and the rigor-project-init SKILL, CI gates, rigor init) can verify their plugin configuration is actually doing what they think.

The command is read-only and idempotent: it loads the project's .rigor.yml (same discovery as rigor check), runs Plugin::Loader.load to attempt instantiation, then prints a table of:

  • load status (loaded / load-error with reason);
  • resolved manifest id, version, description;
  • signature_paths: (absolute paths + per-dir .rbs count);
  • every manifest-declared extension surface (open_receivers: / owns_receivers: / produces: / consumes: / block_as_methods: / heredoc_templates: / trait_registries: / type_node_resolvers: / hkt_registrations: / hkt_definitions: / protocol_contracts: / source_rbs_synthesizer:);
  • the ADR-37 narrow extension protocols read off the plugin class — node_rule node types, dynamic_return receivers, narrowing_facts methods.

--capabilities switches to a focused catalogue of just the narrow-protocol gate values + produced/consumed facts (ADR-37 § "Machine-readable capability catalogue") — the AI-legibility surface that lets an agent enumerate what every plugin does.

Output formats: text (default, human-readable table) and json (for tooling — SKILLs, CI gates, editor integrations).

Exit codes:

  • 0 — every configured plugin loaded.
  • 1 — at least one plugin failed to load AND --strict was passed. Without --strict the command always exits 0; load errors are reported but not treated as a gate failure (matching rigor triage's advisory shape).

Future expansion (not in this slice):

  • Per-plugin diagnostic counts (would require running the full analysis pipeline; out of scope for an inspection command).
  • Verification that signature_paths actually merged into the RBS environment without conflict (requires constructing the Environment, which is heavier than the loader-only pass this slice does).

Constant Summary collapse

USAGE =

rubocop:disable Metrics/ClassLength

"Usage: rigor plugins [options]"

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Rigor::CLI::Command

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rigor/cli/plugins_command.rb', line 64

def run
  options = parse_options
  config_path = options.fetch(:config) || Configuration.discover
  configuration = Configuration.load(options.fetch(:config))
  rows = build_rows(configuration)

  renderer = PluginsRenderer.new(rows: rows, configuration_path: config_path)
  @out.puts(render(renderer, options))

  any_load_errors = rows.any? { |row| row.fetch(:status) == :load_error }
  return 1 if any_load_errors && options.fetch(:strict)

  0
end