Class: EnhanceSwarm::TaskManager
- Inherits:
-
Object
- Object
- EnhanceSwarm::TaskManager
- Defined in:
- lib/enhance_swarm/task_manager.rb
Instance Method Summary collapse
- #find_task(task_id) ⇒ Object
-
#initialize ⇒ TaskManager
constructor
A new instance of TaskManager.
- #list_tasks(state = 'all') ⇒ Object
- #move_task(task_id, state) ⇒ Object
- #next_priority_task ⇒ Object
Constructor Details
#initialize ⇒ TaskManager
Returns a new instance of TaskManager.
8 9 10 |
# File 'lib/enhance_swarm/task_manager.rb', line 8 def initialize @config = EnhanceSwarm.configuration end |
Instance Method Details
#find_task(task_id) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/enhance_swarm/task_manager.rb', line 22 def find_task(task_id) if swarm_tasks_available? show_swarm_task(task_id) else find_file_task(task_id) end end |
#list_tasks(state = 'all') ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/enhance_swarm/task_manager.rb', line 44 def list_tasks(state = 'all') if swarm_tasks_available? list_swarm_tasks(state) else list_file_tasks(state) end end |
#move_task(task_id, state) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/enhance_swarm/task_manager.rb', line 30 def move_task(task_id, state) if swarm_tasks_available? begin CommandExecutor.execute(@config.task_command, 'move', task_id.to_s, state.to_s) rescue CommandExecutor::CommandError => e puts "Failed to move task: #{e.message}".colorize(:red) false end else puts 'Task management not configured. Please set up swarm-tasks.'.colorize(:yellow) false end end |
#next_priority_task ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/enhance_swarm/task_manager.rb', line 12 def next_priority_task # Try to use swarm-tasks if available if swarm_tasks_available? list_swarm_tasks('backlog').first else # Fallback to simple file-based tasks find_next_file_task end end |