Class: Rigor::CLI::PluginsCommand

Inherits:
Object
  • 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:` / `external_files:` / `type_node_resolvers:` / `hkt_registrations:` / `hkt_definitions:` / `protocol_contracts:` / `source_rbs_synthesizer:`).

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 =
"Usage: rigor plugins [options]"

Instance Method Summary collapse

Constructor Details

#initialize(argv:, out: $stdout, err: $stderr) ⇒ PluginsCommand

Returns a new instance of PluginsCommand.



58
59
60
61
62
# File 'lib/rigor/cli/plugins_command.rb', line 58

def initialize(argv:, out: $stdout, err: $stderr)
  @argv = argv
  @out = out
  @err = err
end

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



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

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(options.fetch(:format) == "json" ? renderer.json : renderer.text)

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

  0
end