Class: Rralph::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rralph/cli.rb

Instance Method Summary collapse

Instance Method Details

#startObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/rralph/cli.rb', line 48

def start
  runner = Runner.new(
    max_failures: options[:max_failures],
    ai_command: options[:ai_command],
    watch: options[:watch],
    plan_path: options[:plan_path],
    learnings_path: options[:learnings_path],
    todo_path: options[:todo_path],
    skip_commit: options[:skip_commit],
    verbose: options[:verbose]
  )

  runner.run
rescue Rralph::FileNotFound => e
  warn "Error: #{e.message}"
  warn 'Please ensure plan.md, learnings.md, and todo.md exist in the current directory.'
  exit 1
rescue Rralph::GitError => e
  warn "Git Error: #{e.message}"
  exit 1
rescue StandardError => e
  warn "Unexpected error: #{e.message}"
  warn e.backtrace.first(5)
  exit 1
end

#statsObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/rralph/cli.rb', line 93

def stats
  parser = Parser.new(
    plan_path: options[:plan_path],
    learnings_path: options[:learnings_path],
    todo_path: options[:todo_path]
  )

  parser.load_files

  all_tasks = parser.all_tasks
  completed = parser.completed_tasks
  pending = parser.pending_tasks

  puts "Tasks: #{completed.size}/#{all_tasks.size} done"
  puts "Pending: #{pending.size}"
  puts "Learnings: #{parser.learnings_content.lines.size} lines"
rescue Rralph::FileNotFound => e
  warn "Error: #{e.message}"
  exit 1
end

#versionObject



75
76
77
# File 'lib/rralph/cli.rb', line 75

def version
  puts "rralph v#{Rralph::VERSION}"
end