Class: Rigor::CLI::DocsCommand

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

Overview

‘rigor docs` — serve the documentation bundled with the `rigortype` gem OFFLINE (ADR-74). The skills (`rigor skill <name>`) already ride in the gem; this is the doc twin, so once Rigor is installed an agent can read the guidance the SKILL-driven UX routes to without the network. The canonical web copy is rigor.typedduck.fail/llms.txt; the gem ships `docs/install.md`, `docs/llms.txt`, and the full user-facing manual and handbook (the drive-Rigor chapters — the contributor-facing ADR / spec / notes corpus stays web-only).

Grammar (mirrors ‘rigor skill`): the positional slot is always a doc name; alternative outputs are flags, so a page named `list` or `path` can never be shadowed by a verb.

  • ‘rigor docs` — print the bundled `llms.txt` index.

  • ‘rigor docs <name>` — print a doc page to stdout.

  • ‘rigor docs –path <name>` — one-line absolute path, for a Read tool.

  • ‘rigor docs –list [<cat>]` — table of name + path (optionally one category).

‘<name>` resolves a category-qualified path (`handbook/03-narrowing`), a prefixed basename (`03-narrowing`), or a short name (`narrowing`, when it is unique across categories).

The pre-v0.3.0 verb spellings ‘rigor docs list` / `rigor docs path <name>` still work but emit a stderr deprecation notice; they are removed in v0.3.0 (see docs/ROADMAP.md § “Scheduled CLI deprecations”).

Constant Summary collapse

USAGE =
<<~USAGE
  Usage: rigor docs [<name>] [--path <name>] [--list [<category>]]

  With no argument, prints the bundled llms.txt offline doc index.

    rigor docs                      Print the offline doc index (llms.txt)
    rigor docs <name>               Print a doc page to stdout
    rigor docs --path <name>        Print the absolute path of a doc
    rigor docs --list [<category>]  List bundled docs (optionally one category)

  Categories: manual, handbook (plus the top-level install guide).
  A page is addressable by its category-qualified path
  (`handbook/03-narrowing`), its prefixed name (`03-narrowing`),
  or its short name (`narrowing`, when unique across categories).

  Examples:
    rigor docs
    rigor docs install
    rigor docs handbook/03-narrowing
    rigor docs editor-integration
    rigor docs --path 17-driving-improvement
    rigor docs --list handbook

  Deprecated (removed in v0.3.0) — use the flags above:
    rigor docs list           ->  rigor docs --list
    rigor docs path <name>    ->  rigor docs --path <name>
USAGE
DOCS_ROOT =

The bundled docs live at ‘<gem_root>/docs/`. From `lib/rigor/cli/docs_command.rb` that is three directories up.

File.expand_path("../../../docs", __dir__)
MANUAL_ROOT =
File.join(DOCS_ROOT, "manual")
HANDBOOK_ROOT =
File.join(DOCS_ROOT, "handbook")
LLMS_INDEX =
File.join(DOCS_ROOT, "llms.txt")
LEGACY_VERB_REMOVAL =

The verb subcommands the flags superseded keep working with a stderr deprecation notice until this version drops them. Each maps to the canonical advice printed and the flag it rewrites to.

"v0.3.0"
LEGACY_VERBS =
{
  "list" => { old: "list",        advice: "--list",        flag: "--list" },
  "path" => { old: "path <name>", advice: "--path <name>", flag: "--path" }
}.freeze

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Rigor::CLI::Command

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/rigor/cli/docs_command.rb', line 80

def run
  rewrite_legacy_verb!

  case @argv.first
  when nil
    run_index
  when "-h", "--help", "help"
    @out.puts(USAGE)
    0
  when "--list"
    @argv.shift
    run_list(@argv.shift)
  when "--path"
    @argv.shift
    run_path(@argv.shift)
  when "--print"
    @argv.shift
    run_print(@argv.shift)
  else
    run_print(@argv.shift)
  end
end