Class: RubynCode::CLI::App

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyn_code/cli/app.rb

Overview

rubocop:disable Metrics/ClassLength -- CLI dispatch requires many small methods

Constant Summary collapse

HELP_TEXT =
"rubyn-code - Ruby & Rails Agentic Coding Assistant\n\nUsage:\n  rubyn-code                    Start interactive REPL\n  rubyn-code -p \"prompt\"        Run a single prompt and exit\n  rubyn-code --resume [ID]      Resume a previous session\n  rubyn-code --setup            Pin rubyn-code to bypass rbenv/rvm\n  rubyn-code --auth             Authenticate with Claude\n  rubyn-code --install-skills NAME  Install a skill pack from the registry\n  rubyn-code --ide              Start IDE server (VS Code extension)\n  rubyn-code --permission-mode MODE  Set permission mode (default, accept_edits, plan_only, auto, dont_ask, bypass)\n  rubyn-code --version          Show version\n  rubyn-code --help             Show this help\n\nDaemon Mode:\n  rubyn-code daemon             Start autonomous daemon (GOLEM)\n  rubyn-code daemon --name NAME Agent name (default: golem-<random>)\n  rubyn-code daemon --role ROLE Agent role description\n  rubyn-code daemon --max-runs N     Max tasks before shutdown (default: 100)\n  rubyn-code daemon --max-cost N     Max USD spend before shutdown (default: 10.0)\n  rubyn-code daemon --idle-timeout N Seconds idle before shutdown (default: 60)\n  rubyn-code daemon --poll-interval N Seconds between polls (default: 5)\n\nInteractive Commands:\n  /help          Show available commands\n  /quit          Exit\n  /compact       Compress context\n  /cost          Show usage costs\n  /tasks         List tasks\n  /skill [name]  Load or list skills\n  /skills        List installed and community skill packs\n  /install-skills Install skill packs from rubyn.ai\n  /remove-skills  Remove an installed skill pack\n\nEnvironment:\n  Config:  ~/.rubyn-code/config.yml\n  Data:    ~/.rubyn-code/rubyn_code.db\n  Tokens:  ~/.rubyn-code/tokens.yml\n"
SIMPLE_FLAGS =
{
  '--version' => :version, '-v' => :version,
  '--help' => :help, '-h' => :help,
  '--auth' => :auth, '--setup' => :setup
}.freeze
BOOLEAN_FLAGS =
{ '--yolo' => :yolo, '--debug' => :debug, '--skip-setup' => :skip_setup, '--ide' => :ide }.freeze
VALUE_FLAGS =
{ '--permission-mode' => :permission_mode, '--dir' => :workspace_dir }.freeze
DAEMON_INT_FLAGS =
{ '--max-runs' => :max_runs, '--idle-timeout' => :idle_timeout,
'--poll-interval' => :poll_interval }.freeze
DAEMON_STR_FLAGS =
{ '--name' => :agent_name, '--role' => :role }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ App

Returns a new instance of App.



10
11
12
13
# File 'lib/rubyn_code/cli/app.rb', line 10

def initialize(argv)
  @argv = argv
  @options = parse_options(argv)
end

Class Method Details

.start(argv) ⇒ Object



6
7
8
# File 'lib/rubyn_code/cli/app.rb', line 6

def self.start(argv)
  new(argv).run
end

Instance Method Details

#run ⇒ Object



15
16
17
18
# File 'lib/rubyn_code/cli/app.rb', line 15

def run
  RubynCode::Debug.enable! if @options[:debug]
  dispatch_command(@options[:command])
end