Class: Rralph::Runner
- Inherits:
-
Object
- Object
- Rralph::Runner
- Defined in:
- lib/rralph/runner.rb
Instance Attribute Summary collapse
-
#cycle_count ⇒ Object
readonly
Returns the value of attribute cycle_count.
-
#failure_count ⇒ Object
readonly
Returns the value of attribute failure_count.
-
#max_failures ⇒ Object
readonly
Returns the value of attribute max_failures.
Instance Method Summary collapse
-
#initialize(max_failures: 3, ai_command: 'qwen -y -s -o stream-json', watch: false, plan_path: 'plan.md', learnings_path: 'learnings.md', todo_path: 'todo.md', skip_commit: false, verbose: false) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(max_failures: 3, ai_command: 'qwen -y -s -o stream-json', watch: false, plan_path: 'plan.md', learnings_path: 'learnings.md', todo_path: 'todo.md', skip_commit: false, verbose: false) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rralph/runner.rb', line 8 def initialize( max_failures: 3, ai_command: 'qwen -y -s -o stream-json', watch: false, plan_path: 'plan.md', learnings_path: 'learnings.md', todo_path: 'todo.md', skip_commit: false, verbose: false ) @max_failures = max_failures @ai_command = ai_command @watch = watch @plan_path = plan_path @learnings_path = learnings_path @todo_path = todo_path @skip_commit = skip_commit @verbose = verbose @cycle_count = 0 @failure_count = 0 @parser = Parser.new( plan_path: @plan_path, learnings_path: @learnings_path, todo_path: @todo_path ) @file_updater = FileUpdater.new( todo_path: @todo_path, learnings_path: @learnings_path ) @git = Git.new end |
Instance Attribute Details
#cycle_count ⇒ Object (readonly)
Returns the value of attribute cycle_count.
6 7 8 |
# File 'lib/rralph/runner.rb', line 6 def cycle_count @cycle_count end |
#failure_count ⇒ Object (readonly)
Returns the value of attribute failure_count.
6 7 8 |
# File 'lib/rralph/runner.rb', line 6 def failure_count @failure_count end |
#max_failures ⇒ Object (readonly)
Returns the value of attribute max_failures.
6 7 8 |
# File 'lib/rralph/runner.rb', line 6 def max_failures @max_failures end |
Instance Method Details
#run ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rralph/runner.rb', line 42 def run log("Starting rralph with max_failures=#{@max_failures}, ai_command='#{@ai_command}'") raise GitError, 'Not in a git repository. Please initialize git first.' unless @git.in_git_repo? @parser.load_files if todo_empty_or_missing? log('todo.md is empty or missing. Generating todo list from plan...') generate_todo_from_plan return true end unless @parser.has_pending_tasks? log('All tasks completed! Well done!') return true end return run_watch_loop if @watch run_single_cycle end |