Class: Rigor::CLI::SkillCommand

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

Overview

‘rigor skill` — discover and print the SKILL.md files bundled with the `rigortype` gem.

Rigor ships a small set of Agent Skills under ‘skills/` that walk an AI coding agent through onboarding (`rigor-project-init`), baseline reduction (`rigor-baseline-reduce`), and authoring a plugin (`rigor-plugin-author`). When Rigor is installed via `mise` / `gem install` / etc. the SKILL files live inside the gem checkout — the project being analysed has no copy, so an AI agent has no a priori way to find them.

This command exposes the bundled skills via three subcommands:

  • ‘rigor skill list` — table of name + absolute path.

  • ‘rigor skill print <name>` — short header (paths + how to use)

    followed by the SKILL.md body. This
    is the form AI agents should call;
    the inline body plus the header's
    absolute paths together let the
    agent act with or without a file
    reading tool.
    
  • ‘rigor skill path <name>` — one-line absolute path, suitable

    as input to a Read tool.
    

‘rigor skill` with no subcommand is an alias for `list`.

Constant Summary collapse

USAGE =
<<~USAGE
  Usage: rigor skill <subcommand> [args]

  Subcommands:
    list                  List bundled skills (default when no subcommand given)
    print <name>          Print the SKILL.md body for <name> to stdout, with a header
    path  <name>          Print the absolute path of the SKILL.md file for <name>

  Examples:
    rigor skill list
    rigor skill print rigor-project-init
    rigor skill path  rigor-baseline-reduce
USAGE
SKILLS_ROOT =

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

File.expand_path("../../../skills", __dir__)

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SkillCommand.



51
52
53
54
55
# File 'lib/rigor/cli/skill_command.rb', line 51

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

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rigor/cli/skill_command.rb', line 58

def run
  subcommand = @argv.shift || "list"

  case subcommand
  when "list" then run_list
  when "print" then run_print
  when "path" then run_path
  when "-h", "--help", "help"
    print_usage(@out)
    0
  else
    @err.puts("Unknown subcommand: #{subcommand}")
    print_usage(@err)
    Rigor::CLI::EXIT_USAGE
  end
end