Class: RubynCode::CLI::Commands::Base
- Inherits:
-
Object
- Object
- RubynCode::CLI::Commands::Base
- Defined in:
- lib/rubyn_code/cli/commands/base.rb
Overview
Abstract base class for all slash commands.
Subclasses must implement:
- self.command_name → String (e.g. '/doctor')
- self.description → String (one-liner for /help)
- execute(args, ctx) → void
Optionally override:
- self.aliases → Array<String> (e.g. ['/q', '/exit'])
- self.hidden? → Boolean (hide from /help listing)
Direct Known Subclasses
Budget, Clear, Compact, ContextInfo, Cost, Diff, Doctor, Help, Mcp, Model, NewSession, Plan, Provider, Quit, Resume, Review, Skill, Spawn, Tasks, Tokens, Undo, Version
Class Method Summary collapse
- .aliases ⇒ Object
-
.all_names ⇒ Array<String>
All names this command responds to (primary + aliases).
- .command_name ⇒ Object
- .description ⇒ Object
- .hidden? ⇒ Boolean
Instance Method Summary collapse
-
#execute(args, ctx) ⇒ void
Execute the command.
Class Method Details
.aliases ⇒ Object
26 27 28 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 26 def aliases [].freeze end |
.all_names ⇒ Array<String>
All names this command responds to (primary + aliases).
37 38 39 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 37 def all_names [command_name, *aliases].freeze end |
.command_name ⇒ Object
18 19 20 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 18 def command_name raise NotImplementedError, "#{name} must define self.command_name" end |
.description ⇒ Object
22 23 24 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 22 def description raise NotImplementedError, "#{name} must define self.description" end |
.hidden? ⇒ Boolean
30 31 32 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 30 def hidden? false end |
Instance Method Details
#execute(args, ctx) ⇒ void
This method returns an undefined value.
Execute the command.
47 48 49 |
# File 'lib/rubyn_code/cli/commands/base.rb', line 47 def execute(args, ctx) raise NotImplementedError, "#{self.class.name}#execute must be implemented" end |