Class: Aidp::Harness::UI::SpinnerGroup
- Inherits:
-
Base
- Object
- Base
- Aidp::Harness::UI::SpinnerGroup
show all
- Defined in:
- lib/aidp/harness/ui/spinner_group.rb
Overview
Handles concurrent operations using CLI UI spinner groups
Defined Under Namespace
Classes: ExecutionError, InvalidOperationError, SpinnerGroupError
Instance Method Summary
collapse
Constructor Details
#initialize(ui_components = {}) ⇒ SpinnerGroup
Returns a new instance of SpinnerGroup.
17
18
19
20
21
22
|
# File 'lib/aidp/harness/ui/spinner_group.rb', line 17
def initialize(ui_components = {})
super()
@spinner_class = ui_components[:spinner_class] || TTY::Spinner
@formatter = ui_components[:formatter] || SpinnerGroupFormatter.new
@spinners = {}
end
|
Instance Method Details
#run_analysis_tasks(tasks) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/aidp/harness/ui/spinner_group.rb', line 60
def run_analysis_tasks(tasks)
validate_tasks(tasks)
operations = convert_tasks_to_operations(tasks)
run_concurrent_operations(operations)
rescue => e
raise ExecutionError, "Failed to run analysis tasks: #{e.message}"
end
|
#run_concurrent_operations(operations) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/aidp/harness/ui/spinner_group.rb', line 24
def run_concurrent_operations(operations)
validate_operations(operations)
operations.each do |operation|
spinner = @spinner_class.new(
"#{operation[:name]}...",
format: :dots,
success_mark: "✓",
error_mark: "✗"
)
@spinners[operation[:id]] = spinner
spinner.start
end
operations.each do |operation|
operation[:block].call
@spinners[operation[:id]].success(operation[:name])
rescue => e
@spinners[operation[:id]].error(operation[:name])
raise e
end
rescue => e
raise ExecutionError, "Failed to run concurrent operations: #{e.message}"
end
|
#run_provider_operations(provider_operations) ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/aidp/harness/ui/spinner_group.rb', line 69
def run_provider_operations(provider_operations)
validate_provider_operations(provider_operations)
operations = convert_provider_operations(provider_operations)
run_concurrent_operations(operations)
rescue => e
raise ExecutionError, "Failed to run provider operations: #{e.message}"
end
|
#run_workflow_steps(steps) ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/aidp/harness/ui/spinner_group.rb', line 51
def run_workflow_steps(steps)
validate_steps(steps)
operations = convert_steps_to_operations(steps)
run_concurrent_operations(operations)
rescue => e
raise ExecutionError, "Failed to run workflow steps: #{e.message}"
end
|