Class: Rigor::CLI::PluginCommand
- Defined in:
- lib/rigor/cli/plugin_command.rb
Overview
‘rigor plugin` (singular) — discover and read the plugin source bundled with the `rigortype` gem.
Rigor ships ~30 production plugins under ‘plugins/` and a set of tutorial plugins under `examples/`. When Rigor is installed via `mise` / `gem install` the gem checkout is on disk, so a plugin author (or an AI coding agent following the `rigor-plugin-author` skill) can read a real, working plugin as a worked example —instead of guessing the `Rigor::Plugin::Base` surface from prose. This command outputs the absolute paths so they can be found and read regardless of where the gem landed.
It is deliberately distinct from ‘rigor plugins` (plural), which reports the activation status of the plugins configured in your `.rigor.yml`. This command (singular) browses the plugins bundled in the toolchain. Mnemonic: “plugins” = my config; “plugin” = the catalogue I can learn from.
Subcommands:
-
‘rigor plugin list` — every bundled plugin + example,
name + absolute directory path. -
‘rigor plugin path <name>` — one-line absolute path to the
plugin's directory (Read-tool input). -
‘rigor plugin print <name>` — a header (dir / lib / sig / README
paths) followed by the plugin's main `lib/<name>.rb` source body. -
‘rigor plugin root` — the rigortype gem root and its key
subdirectories (lib/, plugins/, examples/, skills/, sig/), so an author can read the public plugin API (`lib/rigor/plugin.rb`) directly.
‘rigor plugin` with no subcommand is an alias for `list`.
**Docker / cross-filesystem note.** Every path printed is resolved at runtime from this file’s location, so it is correct *on the filesystem where ‘rigor` runs*. If you run `rigor` inside a container but read files from the host (or vice versa), the paths will not resolve — read them from the same environment that ran the command (`rigor plugin print` inlines the body for exactly this case: it works with no file-reading tool at all).
Constant Summary collapse
- USAGE =
<<~USAGE Usage: rigor plugin <subcommand> [args] Browse the plugins bundled in the rigortype toolchain (worked examples for authoring your own). For the activation status of the plugins in your .rigor.yml, use `rigor plugins` (plural). Subcommands: list List bundled + example plugins (default) path <name> Print the absolute directory path of <name> print <name> Print <name>'s main lib source, with a header root Print the gem root + key subdirectories Examples: rigor plugin list rigor plugin path rigor-activerecord rigor plugin print rigor-activesupport-core-ext rigor plugin root USAGE
- GEM_ROOT =
The bundled plugins/examples/source live at ‘<gem_root>/…`. From `lib/rigor/cli/plugin_command.rb` the gem root is three directories up (matching SkillCommand::SKILLS_ROOT).
File.("../../..", __dir__)
- PLUGINS_ROOT =
File.join(GEM_ROOT, "plugins")
- EXAMPLES_ROOT =
File.join(GEM_ROOT, "examples")
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.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/rigor/cli/plugin_command.rb', line 78 def run subcommand = @argv.shift || "list" case subcommand when "list" then run_list when "path" then run_path when "print" then run_print when "root" then run_root when "-h", "--help", "help" @out.puts(USAGE) 0 else @err.puts("Unknown subcommand: #{subcommand}") @err.puts(USAGE) Rigor::CLI::EXIT_USAGE end end |