Module: Rigor::ModuleGraph::CLI

Defined in:
lib/rigor/module_graph/cli.rb

Overview

Entry point for the rigor-module-graph executable.

Subcommands:

collect [PATHS...]   Run `rigor check` and write edges JSONL
dot     [FILE]       Render edges JSONL as Graphviz DOT
mermaid [FILE]       Render edges JSONL as Mermaid
cycles  [FILE]       Detect cycles and print them

Every reader subcommand takes the path to an edges file, or reads stdin if no path is given. Each reader supports --kind and --confidence filters so a noisy graph can be pruned without touching the JSONL on disk.

Defined Under Namespace

Modules: EdgeFilters Classes: ClassDiagramCmd, Collect, CollectError, Cycles, Render, RigorRunner, StatsCmd, View

Constant Summary collapse

DEFAULT_EDGES_PATH =
".rigor/module_graph/edges.jsonl"
DEFAULT_NODES_PATH =
".rigor/module_graph/nodes.jsonl"
SOURCE_FAMILY =
"plugin.module-graph"
EDGE_RULE =
"edge"
NODE_RULE =
"node"
USAGE =
"Usage: rigor-module-graph [command] [options] [paths]\n\nDefault (no command): same as `view` \u2014 analyse the current\ndirectory, write an HTML report, and open it in a browser.\n\nCommands:\n  view          [PATHS...]   Analyse, write HTML, open in a browser\n  collect       [PATHS...]   Run `rigor check` and write edges + nodes JSONL\n  dot           [FILE]       Render edges JSONL as Graphviz DOT\n  mermaid       [FILE]       Render edges JSONL as Mermaid flowchart\n  class-diagram [FILE]       Render edges + nodes as Mermaid classDiagram (UML)\n  cycles        [FILE]       Detect cycles in edges JSONL\n  stats         [FILE]       Per-namespace fan-in / fan-out report\n\nRun `rigor-module-graph <command> --help` for command-specific options.\n"

Class Method Summary collapse

Class Method Details

.run(argv, stdout: $stdout, stderr: $stderr, stdin: $stdin) ⇒ Object



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
# File 'lib/rigor/module_graph/cli.rb', line 47

def run(argv, stdout: $stdout, stderr: $stderr, stdin: $stdin)
  argv = argv.dup
  command = argv.shift
  case command
  when nil
    View.new(stdout: stdout, stderr: stderr).run([])
  when "view"
    View.new(stdout: stdout, stderr: stderr).run(argv)
  when "collect"
    Collect.new(stdout: stdout, stderr: stderr).run(argv)
  when "dot"
    Render.new(:dot, stdout: stdout, stderr: stderr, stdin: stdin).run(argv)
  when "mermaid"
    Render.new(:mermaid, stdout: stdout, stderr: stderr, stdin: stdin).run(argv)
  when "cycles"
    Cycles.new(stdout: stdout, stderr: stderr, stdin: stdin).run(argv)
  when "stats"
    StatsCmd.new(stdout: stdout, stderr: stderr, stdin: stdin).run(argv)
  when "class-diagram"
    ClassDiagramCmd.new(stdout: stdout, stderr: stderr, stdin: stdin).run(argv)
  when "-h", "--help", "help"
    stdout.puts USAGE
    0
  when "version", "-v", "--version"
    stdout.puts "rigor-module-graph #{Rigor::ModuleGraph::VERSION}"
    0
  else
    stderr.puts "rigor-module-graph: unknown command #{command.inspect}"
    stderr.puts USAGE
    2
  end
end