Class: RailVerdict::CLI
- Inherits:
-
Object
- Object
- RailVerdict::CLI
- Defined in:
- lib/rail_verdict/cli.rb
Constant Summary collapse
- EXIT_OK =
0- EXIT_POLICY_FAIL =
1- EXIT_NO_GATE =
2- EXIT_INTERRUPTED =
130- FORMATS =
%w[console json sarif].freeze
- DEFAULT_CONFIG_PATH =
".railverdict.yml"- USAGE =
<<~USAGE Usage: railverdict <command> [options] Commands: init Write the default .railverdict.yml configuration doctor Report configuration and analyzer observations check Run verification and print the gate result pr Summarize one changed-scope verification for review baseline create Deferred boundary; Phase 3 owns baseline writes findings Print normalized findings from the evidence run explain Explain a finding with optional AI investigate Investigate top findings with optional AI repair Build a deterministic repair packet for a finding receipt Create or verify a Verification Receipt handoff Create or verify a Verification Handoff (evidence reuse) mcp MCP adapter (serve) Global options: --help Show this usage --version Show the railverdict version USAGE
Instance Method Summary collapse
-
#initialize(stdout: $stdout, stderr: $stderr, working_directory: Dir.pwd) ⇒ CLI
constructor
A new instance of CLI.
- #run(argv) ⇒ Object
Constructor Details
#initialize(stdout: $stdout, stderr: $stderr, working_directory: Dir.pwd) ⇒ CLI
Returns a new instance of CLI.
40 41 42 43 44 |
# File 'lib/rail_verdict/cli.rb', line 40 def initialize(stdout: $stdout, stderr: $stderr, working_directory: Dir.pwd) @stdout = stdout @stderr = stderr @working_directory = working_directory end |
Instance Method Details
#run(argv) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rail_verdict/cli.rb', line 46 def run(argv) command = argv.first case command when nil, "-h", "--help", "help" @stdout.puts USAGE EXIT_OK when "--version", "-V" @stdout.puts "railverdict #{RailVerdict::VERSION}" EXIT_OK when "init" command_init(argv.drop(1)) when "doctor" command_doctor(argv.drop(1)) when "check" command_check(argv.drop(1)) when "pr" command_pr(argv.drop(1)) when "baseline" command_baseline(argv.drop(1)) when "findings" command_findings(argv.drop(1)) when "explain" command_explain(argv.drop(1)) when "investigate" command_investigate(argv.drop(1)) when "repair" command_repair(argv.drop(1)) when "receipt" command_receipt(argv.drop(1)) when "handoff" command_handoff(argv.drop(1)) when "mcp" command_mcp(argv.drop(1)) else @stderr.puts "railverdict: unknown command: #{command}" @stderr.puts USAGE EXIT_NO_GATE end rescue RailVerdict::UsageError => error @stderr.puts "railverdict: #{error.}" @stderr.puts USAGE EXIT_NO_GATE end |