Class: Rigor::CLI::TraceCommand
- Defined in:
- lib/rigor/cli/trace_command.rb
Overview
Executes the ‘rigor trace` command: re-runs the inference engine over one file under Inference::FlowTracer and replays the recorded event stream — scope binds, union formation, method dispatch, and (with `–verbose`) every expression enter/result —as a step-through terminal animation. A teaching probe: it shows HOW Rigor arrives at a type, where `rigor type-of` shows only the answer.
The tracer is observational; this command never changes what ‘rigor check` would infer for the same file.
Constant Summary collapse
- USAGE =
"Usage: rigor trace [options] FILE"- DEFAULT_KINDS =
Default frame kinds: the three teachable moments. :enter/:result add one frame per literal and drown the signal; ‘–verbose` opts into them.
%i[bind union dispatch].freeze
- VERBOSE_KINDS =
(%i[enter result] + DEFAULT_KINDS).freeze
Instance Method Summary collapse
-
#run ⇒ Integer
CLI exit status.
Methods inherited from Command
Constructor Details
This class inherits a constructor from Rigor::CLI::Command
Instance Method Details
#run ⇒ Integer
Returns CLI exit status.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rigor/cli/trace_command.rb', line 37 def run = file = @argv.first if file.nil? || @argv.size != 1 @err.puts(USAGE) return CLI::EXIT_USAGE end return 1 unless file_exists?(file) execute(file: file, options: ) end |