Class: Rigor::CLI::EffectsSnapshotCommand

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

Overview

ADR-103 WD7 — the snapshot verbs of rigor effects: update, check, diff and explain.

rigor effects update                  # write .rigor-effects.yml; commit it
rigor effects check                   # 0 fresh, 1 drift — the CI gate
rigor effects diff --baseline PATH    # the same comparison, never gating
rigor effects explain --symbol KEY    # the shortest edge path behind a reach change

None of them emits a diagnostic or enters rigor check's stream: drift between two observations by the same tool is 100 % precise, and whether it matters is the reviewer's judgment — which is exactly what makes it a review artefact rather than a finding (ADR-102).

The verbs take no paths. The report does (rigor effects lib/foo.rb), because a report is a view; a snapshot is a record of the whole project, and one written over a subset would read as a project where every other method vanished. The analysed set is always the configured paths:.

Constant Summary collapse

VERBS =
%w[update check diff explain].freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of EffectsSnapshotCommand.



47
48
49
50
# File 'lib/rigor/cli/effects_snapshot_command.rb', line 47

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

Instance Method Details

#runInteger

Returns 0 fresh / written, 1 on drift under check, 64 on a usage error.

Returns:

  • (Integer)

    0 fresh / written, 1 on drift under check, 64 on a usage error.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rigor/cli/effects_snapshot_command.rb', line 53

def run
  options = parse_options
  return usage_error("unsupported format: #{options.fetch(:format)}") unless
    FORMATS.include?(options[:format])
  return usage_error("rigor effects #{@verb} takes no paths; it records the configured paths:") unless
    @argv.empty?

  execute(options)
rescue OptionParser::ParseError => e
  usage_error(e.message)
end