aidp 0.12.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/lib/aidp/analyze/json_file_storage.rb +21 -21
  4. data/lib/aidp/cli/enhanced_input.rb +114 -0
  5. data/lib/aidp/cli/first_run_wizard.rb +28 -309
  6. data/lib/aidp/cli/issue_importer.rb +359 -0
  7. data/lib/aidp/cli/mcp_dashboard.rb +3 -3
  8. data/lib/aidp/cli/terminal_io.rb +26 -0
  9. data/lib/aidp/cli.rb +155 -7
  10. data/lib/aidp/daemon/process_manager.rb +146 -0
  11. data/lib/aidp/daemon/runner.rb +232 -0
  12. data/lib/aidp/execute/async_work_loop_runner.rb +216 -0
  13. data/lib/aidp/execute/future_work_backlog.rb +411 -0
  14. data/lib/aidp/execute/guard_policy.rb +246 -0
  15. data/lib/aidp/execute/instruction_queue.rb +131 -0
  16. data/lib/aidp/execute/interactive_repl.rb +335 -0
  17. data/lib/aidp/execute/repl_macros.rb +651 -0
  18. data/lib/aidp/execute/steps.rb +8 -0
  19. data/lib/aidp/execute/work_loop_runner.rb +322 -36
  20. data/lib/aidp/execute/work_loop_state.rb +162 -0
  21. data/lib/aidp/harness/condition_detector.rb +6 -6
  22. data/lib/aidp/harness/config_loader.rb +23 -23
  23. data/lib/aidp/harness/config_manager.rb +61 -61
  24. data/lib/aidp/harness/config_schema.rb +88 -0
  25. data/lib/aidp/harness/config_validator.rb +9 -9
  26. data/lib/aidp/harness/configuration.rb +76 -29
  27. data/lib/aidp/harness/error_handler.rb +13 -13
  28. data/lib/aidp/harness/provider_config.rb +79 -79
  29. data/lib/aidp/harness/provider_factory.rb +40 -40
  30. data/lib/aidp/harness/provider_info.rb +37 -20
  31. data/lib/aidp/harness/provider_manager.rb +58 -53
  32. data/lib/aidp/harness/provider_type_checker.rb +6 -6
  33. data/lib/aidp/harness/runner.rb +7 -7
  34. data/lib/aidp/harness/status_display.rb +33 -46
  35. data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +4 -1
  36. data/lib/aidp/harness/ui/job_monitor.rb +7 -7
  37. data/lib/aidp/harness/user_interface.rb +43 -43
  38. data/lib/aidp/init/doc_generator.rb +256 -0
  39. data/lib/aidp/init/project_analyzer.rb +343 -0
  40. data/lib/aidp/init/runner.rb +83 -0
  41. data/lib/aidp/init.rb +5 -0
  42. data/lib/aidp/logger.rb +279 -0
  43. data/lib/aidp/providers/anthropic.rb +100 -26
  44. data/lib/aidp/providers/base.rb +13 -0
  45. data/lib/aidp/providers/codex.rb +28 -27
  46. data/lib/aidp/providers/cursor.rb +141 -34
  47. data/lib/aidp/providers/github_copilot.rb +26 -26
  48. data/lib/aidp/providers/macos_ui.rb +2 -18
  49. data/lib/aidp/providers/opencode.rb +26 -26
  50. data/lib/aidp/setup/wizard.rb +777 -0
  51. data/lib/aidp/tooling_detector.rb +115 -0
  52. data/lib/aidp/version.rb +1 -1
  53. data/lib/aidp/watch/build_processor.rb +282 -0
  54. data/lib/aidp/watch/plan_generator.rb +166 -0
  55. data/lib/aidp/watch/plan_processor.rb +83 -0
  56. data/lib/aidp/watch/repository_client.rb +243 -0
  57. data/lib/aidp/watch/runner.rb +93 -0
  58. data/lib/aidp/watch/state_store.rb +105 -0
  59. data/lib/aidp/watch.rb +9 -0
  60. data/lib/aidp/workflows/guided_agent.rb +344 -23
  61. data/lib/aidp.rb +14 -0
  62. data/templates/implementation/simple_task.md +36 -0
  63. metadata +27 -1
@@ -65,13 +65,13 @@ module Aidp
65
65
 
66
66
  # Get provider models configuration
67
67
  def provider_models(provider_name)
68
- provider_config(provider_name)[:models] || get_default_models_for_provider(provider_name)
68
+ provider_config(provider_name)[:models] || default_models_for_provider(provider_name)
69
69
  end
70
70
 
71
71
  # Get default model for provider
72
72
  def default_model(provider_name)
73
73
  models = provider_models(provider_name)
74
- models.first || get_default_model_for_provider(provider_name)
74
+ models.first || default_model_for_provider(provider_name)
75
75
  end
76
76
 
77
77
  # Get model configuration for provider
@@ -92,7 +92,7 @@ module Aidp
92
92
 
93
93
  # Get model-specific timeout
94
94
  def model_timeout(provider_name, model_name)
95
- model_config(provider_name, model_name)[:timeout] || get_default_timeout_for_provider(provider_name)
95
+ model_config(provider_name, model_name)[:timeout] || default_timeout_for_provider(provider_name)
96
96
  end
97
97
 
98
98
  # Get provider weights for load balancing
@@ -107,47 +107,47 @@ module Aidp
107
107
 
108
108
  # Get circuit breaker configuration
109
109
  def circuit_breaker_config
110
- harness_config[:circuit_breaker] || get_default_circuit_breaker_config
110
+ harness_config[:circuit_breaker] || default_circuit_breaker_config
111
111
  end
112
112
 
113
113
  # Get retry configuration
114
114
  def retry_config
115
- harness_config[:retry] || get_default_retry_config
115
+ harness_config[:retry] || default_retry_config
116
116
  end
117
117
 
118
118
  # Get rate limit configuration
119
119
  def rate_limit_config
120
- harness_config[:rate_limit] || get_default_rate_limit_config
120
+ harness_config[:rate_limit] || default_rate_limit_config
121
121
  end
122
122
 
123
123
  # Get load balancing configuration
124
124
  def load_balancing_config
125
- harness_config[:load_balancing] || get_default_load_balancing_config
125
+ harness_config[:load_balancing] || default_load_balancing_config
126
126
  end
127
127
 
128
128
  # Get model switching configuration
129
129
  def model_switching_config
130
- harness_config[:model_switching] || get_default_model_switching_config
130
+ harness_config[:model_switching] || default_model_switching_config
131
131
  end
132
132
 
133
133
  # Get provider health check configuration
134
134
  def health_check_config
135
- harness_config[:health_check] || get_default_health_check_config
135
+ harness_config[:health_check] || default_health_check_config
136
136
  end
137
137
 
138
138
  # Get metrics configuration
139
139
  def metrics_config
140
- harness_config[:metrics] || get_default_metrics_config
140
+ harness_config[:metrics] || default_metrics_config
141
141
  end
142
142
 
143
143
  # Get session configuration
144
144
  def session_config
145
- harness_config[:session] || get_default_session_config
145
+ harness_config[:session] || default_session_config
146
146
  end
147
147
 
148
148
  # Get work loop configuration
149
149
  def work_loop_config
150
- harness_config[:work_loop] || get_default_work_loop_config
150
+ harness_config[:work_loop] || default_work_loop_config
151
151
  end
152
152
 
153
153
  # Check if work loops are enabled
@@ -170,6 +170,41 @@ module Aidp
170
170
  work_loop_config[:lint_commands] || []
171
171
  end
172
172
 
173
+ # Get guards configuration
174
+ def guards_config
175
+ work_loop_config[:guards] || default_guards_config
176
+ end
177
+
178
+ # Check if guards are enabled
179
+ def guards_enabled?
180
+ guards_config[:enabled] == true
181
+ end
182
+
183
+ # Get include file patterns for guards
184
+ def guards_include_files
185
+ guards_config[:include_files] || []
186
+ end
187
+
188
+ # Get exclude file patterns for guards
189
+ def guards_exclude_files
190
+ guards_config[:exclude_files] || []
191
+ end
192
+
193
+ # Get files requiring confirmation for guards
194
+ def guards_confirm_files
195
+ guards_config[:confirm_files] || []
196
+ end
197
+
198
+ # Get max lines per commit for guards
199
+ def guards_max_lines_per_commit
200
+ guards_config[:max_lines_per_commit]
201
+ end
202
+
203
+ # Check if guards are bypassed
204
+ def guards_bypass?
205
+ guards_config[:bypass] == true
206
+ end
207
+
173
208
  # Get provider priority
174
209
  def provider_priority(provider_name)
175
210
  provider_config(provider_name)[:priority] || 0
@@ -217,12 +252,12 @@ module Aidp
217
252
 
218
253
  # Get logging configuration
219
254
  def logging_config
220
- harness_config[:logging] || get_default_logging_config
255
+ harness_config[:logging] || default_logging_config
221
256
  end
222
257
 
223
258
  # Get fallback configuration
224
259
  def fallback_config
225
- harness_config[:fallback] || get_default_fallback_config
260
+ harness_config[:fallback] || default_fallback_config
226
261
  end
227
262
 
228
263
  # Check if configuration file exists
@@ -341,7 +376,7 @@ module Aidp
341
376
  end
342
377
 
343
378
  # Default configuration methods
344
- def get_default_models_for_provider(provider_name)
379
+ def default_models_for_provider(provider_name)
345
380
  case provider_name
346
381
  when "anthropic"
347
382
  ["anthropic-3-5-sonnet-20241022", "anthropic-3-5-haiku-20241022", "anthropic-3-opus-20240229"]
@@ -352,7 +387,7 @@ module Aidp
352
387
  end
353
388
  end
354
389
 
355
- def get_default_model_for_provider(provider_name)
390
+ def default_model_for_provider(provider_name)
356
391
  case provider_name
357
392
  when "anthropic"
358
393
  "anthropic-3-5-sonnet-20241022"
@@ -363,11 +398,11 @@ module Aidp
363
398
  end
364
399
  end
365
400
 
366
- def get_default_timeout_for_provider(provider_name)
401
+ def default_timeout_for_provider(provider_name)
367
402
  300 # 5 minutes - default timeout for all providers
368
403
  end
369
404
 
370
- def get_default_circuit_breaker_config
405
+ def default_circuit_breaker_config
371
406
  {
372
407
  enabled: true,
373
408
  failure_threshold: 5,
@@ -376,7 +411,7 @@ module Aidp
376
411
  }
377
412
  end
378
413
 
379
- def get_default_retry_config
414
+ def default_retry_config
380
415
  {
381
416
  enabled: true,
382
417
  max_attempts: 3,
@@ -387,7 +422,7 @@ module Aidp
387
422
  }
388
423
  end
389
424
 
390
- def get_default_rate_limit_config
425
+ def default_rate_limit_config
391
426
  {
392
427
  enabled: true,
393
428
  default_reset_time: 3600, # 1 hour
@@ -396,7 +431,7 @@ module Aidp
396
431
  }
397
432
  end
398
433
 
399
- def get_default_load_balancing_config
434
+ def default_load_balancing_config
400
435
  {
401
436
  enabled: true,
402
437
  strategy: "weighted_round_robin", # weighted_round_robin, least_connections, random
@@ -405,7 +440,7 @@ module Aidp
405
440
  }
406
441
  end
407
442
 
408
- def get_default_model_switching_config
443
+ def default_model_switching_config
409
444
  {
410
445
  enabled: true,
411
446
  auto_switch_on_error: true,
@@ -414,7 +449,7 @@ module Aidp
414
449
  }
415
450
  end
416
451
 
417
- def get_default_health_check_config
452
+ def default_health_check_config
418
453
  {
419
454
  enabled: true,
420
455
  interval: 60, # 1 minute
@@ -424,7 +459,7 @@ module Aidp
424
459
  }
425
460
  end
426
461
 
427
- def get_default_metrics_config
462
+ def default_metrics_config
428
463
  {
429
464
  enabled: true,
430
465
  retention_days: 30,
@@ -433,7 +468,7 @@ module Aidp
433
468
  }
434
469
  end
435
470
 
436
- def get_default_session_config
471
+ def default_session_config
437
472
  {
438
473
  enabled: true,
439
474
  timeout: 1800, # 30 minutes
@@ -442,16 +477,28 @@ module Aidp
442
477
  }
443
478
  end
444
479
 
445
- def get_default_work_loop_config
480
+ def default_work_loop_config
446
481
  {
447
482
  enabled: true,
448
483
  max_iterations: 50,
449
484
  test_commands: [],
450
- lint_commands: []
485
+ lint_commands: [],
486
+ guards: default_guards_config
487
+ }
488
+ end
489
+
490
+ def default_guards_config
491
+ {
492
+ enabled: false,
493
+ include_files: [],
494
+ exclude_files: [],
495
+ confirm_files: [],
496
+ max_lines_per_commit: nil,
497
+ bypass: false
451
498
  }
452
499
  end
453
500
 
454
- def get_default_logging_config
501
+ def default_logging_config
455
502
  {
456
503
  log_level: :info,
457
504
  retention_days: 30,
@@ -463,7 +510,7 @@ module Aidp
463
510
  }
464
511
  end
465
512
 
466
- def get_default_fallback_config
513
+ def default_fallback_config
467
514
  {
468
515
  strategies: {
469
516
  rate_limit: {
@@ -53,7 +53,7 @@ module Aidp
53
53
  @error_history << error_info
54
54
 
55
55
  # Get retry strategy for this error type
56
- strategy = get_retry_strategy(error_info[:error_type])
56
+ strategy = retry_strategy(error_info[:error_type])
57
57
 
58
58
  # Check if we should retry
59
59
  if should_retry?(error_info, strategy)
@@ -97,17 +97,17 @@ module Aidp
97
97
  attempt += 1
98
98
  return yield
99
99
  rescue => error
100
- current_provider = get_current_provider_safely
100
+ current_provider = current_provider_safely
101
101
 
102
102
  if attempt < max_attempts
103
103
  error_info = {
104
104
  error: error,
105
105
  provider: current_provider,
106
- model: get_current_model_safely,
106
+ model: current_model_safely,
107
107
  error_type: @error_classifier.classify_error(error)
108
108
  }
109
109
 
110
- strategy = get_retry_strategy(error_info[:error_type])
110
+ strategy = retry_strategy(error_info[:error_type])
111
111
  if should_retry?(error_info, strategy)
112
112
  delay = @backoff_calculator.calculate_delay(attempt, strategy[:backoff_strategy] || :exponential, 1, 10)
113
113
  debug_log("🔁 Retry attempt #{attempt} for #{current_provider}", level: :info, data: {delay: delay, error_type: error_info[:error_type]})
@@ -120,11 +120,11 @@ module Aidp
120
120
  debug_log("🚫 Exhausted retries for provider, attempting recovery", level: :warn, data: {provider: current_provider, attempt: attempt, max_attempts: max_attempts})
121
121
  handle_error(error, {
122
122
  provider: current_provider,
123
- model: get_current_model_safely,
123
+ model: current_model_safely,
124
124
  exhausted_retries: true
125
125
  })
126
126
 
127
- new_provider = get_current_provider_safely
127
+ new_provider = current_provider_safely
128
128
  if new_provider != current_provider && !providers_tried.include?(new_provider)
129
129
  providers_tried << current_provider
130
130
  # Reset retry counts for the new provider
@@ -233,7 +233,7 @@ module Aidp
233
233
  end
234
234
 
235
235
  # Get retry strategy for error type
236
- def get_retry_strategy(error_type)
236
+ def retry_strategy(error_type)
237
237
  @retry_strategies[error_type] || @retry_strategies[:default]
238
238
  end
239
239
 
@@ -270,7 +270,7 @@ module Aidp
270
270
  end
271
271
 
272
272
  # Get retry status for a provider/model
273
- def get_retry_status(provider, model = nil)
273
+ def retry_status(provider, model = nil)
274
274
  keys = if model
275
275
  @retry_counts.keys.select { |k| k.start_with?("#{provider}:#{model}:") }
276
276
  else
@@ -282,7 +282,7 @@ module Aidp
282
282
  error_type = key.split(":").last
283
283
  status[error_type] = {
284
284
  retry_count: @retry_counts[key],
285
- max_retries: get_retry_strategy(error_type.to_sym)[:max_retries]
285
+ max_retries: retry_strategy(error_type.to_sym)[:max_retries]
286
286
  }
287
287
  end
288
288
 
@@ -290,7 +290,7 @@ module Aidp
290
290
  end
291
291
 
292
292
  # Get error history
293
- def get_error_history(time_range = nil)
293
+ def error_history(time_range = nil)
294
294
  if time_range
295
295
  @error_history.select { |e| time_range.include?(e[:timestamp]) }
296
296
  else
@@ -304,7 +304,7 @@ module Aidp
304
304
  end
305
305
 
306
306
  # Get circuit breaker status
307
- def get_circuit_breaker_status
307
+ def circuit_breaker_status
308
308
  @circuit_breakers.transform_values do |cb|
309
309
  {
310
310
  open: cb[:open],
@@ -667,7 +667,7 @@ module Aidp
667
667
  end
668
668
 
669
669
  # Safe access to provider manager methods that may not exist
670
- def get_current_provider_safely
670
+ def current_provider_safely
671
671
  return "unknown" unless @provider_manager
672
672
  return "unknown" unless @provider_manager.respond_to?(:current_provider)
673
673
 
@@ -677,7 +677,7 @@ module Aidp
677
677
  "unknown"
678
678
  end
679
679
 
680
- def get_current_model_safely
680
+ def current_model_safely
681
681
  return "unknown" unless @provider_manager
682
682
  return "unknown" unless @provider_manager.respond_to?(:current_model)
683
683