aidp 0.23.0 → 0.24.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aidp/cli.rb +3 -0
  3. data/lib/aidp/execute/work_loop_runner.rb +252 -45
  4. data/lib/aidp/execute/work_loop_unit_scheduler.rb +27 -2
  5. data/lib/aidp/harness/condition_detector.rb +42 -8
  6. data/lib/aidp/harness/config_manager.rb +7 -0
  7. data/lib/aidp/harness/config_schema.rb +25 -0
  8. data/lib/aidp/harness/configuration.rb +69 -6
  9. data/lib/aidp/harness/error_handler.rb +117 -44
  10. data/lib/aidp/harness/provider_manager.rb +64 -0
  11. data/lib/aidp/harness/provider_metrics.rb +138 -0
  12. data/lib/aidp/harness/runner.rb +90 -29
  13. data/lib/aidp/harness/simple_user_interface.rb +4 -0
  14. data/lib/aidp/harness/state/ui_state.rb +0 -10
  15. data/lib/aidp/harness/state_manager.rb +1 -15
  16. data/lib/aidp/harness/test_runner.rb +39 -2
  17. data/lib/aidp/logger.rb +34 -4
  18. data/lib/aidp/providers/adapter.rb +241 -0
  19. data/lib/aidp/providers/anthropic.rb +75 -7
  20. data/lib/aidp/providers/base.rb +29 -1
  21. data/lib/aidp/providers/capability_registry.rb +205 -0
  22. data/lib/aidp/providers/codex.rb +14 -0
  23. data/lib/aidp/providers/error_taxonomy.rb +195 -0
  24. data/lib/aidp/providers/gemini.rb +3 -2
  25. data/lib/aidp/setup/provider_registry.rb +107 -0
  26. data/lib/aidp/setup/wizard.rb +115 -31
  27. data/lib/aidp/version.rb +1 -1
  28. data/lib/aidp/watch/build_processor.rb +263 -23
  29. data/lib/aidp/watch/repository_client.rb +4 -4
  30. data/lib/aidp/watch/runner.rb +37 -5
  31. data/lib/aidp/workflows/guided_agent.rb +53 -0
  32. data/lib/aidp/worktree.rb +67 -10
  33. data/templates/work_loop/decide_whats_next.md +21 -0
  34. data/templates/work_loop/diagnose_failures.md +21 -0
  35. metadata +10 -3
  36. /data/{bin → exe}/aidp +0 -0
data/lib/aidp/worktree.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "fileutils"
4
4
  require "json"
5
+ require "open3"
5
6
  require_relative "workstream_state"
6
7
 
7
8
  module Aidp
@@ -32,16 +33,14 @@ module Aidp
32
33
  raise WorktreeExists, "Worktree already exists at #{worktree_path}"
33
34
  end
34
35
 
35
- # Create the worktree
36
- cmd = ["git", "worktree", "add", "-b", branch, worktree_path]
37
- cmd << base_branch if base_branch
38
-
39
- Dir.chdir(project_dir) do
40
- success = system(*cmd, out: File::NULL, err: File::NULL)
41
- unless success
42
- raise Error, "Failed to create worktree: #{$?.exitstatus}"
43
- end
44
- end
36
+ branch_exists = branch_exists?(project_dir, branch)
37
+ run_worktree_add!(
38
+ project_dir: project_dir,
39
+ branch: branch,
40
+ branch_exists: branch_exists,
41
+ worktree_path: worktree_path,
42
+ base_branch: base_branch
43
+ )
45
44
 
46
45
  # Initialize .aidp directory in the worktree
47
46
  ensure_aidp_dir(worktree_path)
@@ -203,6 +202,64 @@ module Aidp
203
202
  def registry_file_path(project_dir)
204
203
  File.join(project_dir, ".aidp", "worktrees.json")
205
204
  end
205
+
206
+ def branch_exists?(project_dir, branch)
207
+ Dir.chdir(project_dir) do
208
+ system("git", "show-ref", "--verify", "--quiet", "refs/heads/#{branch}")
209
+ end
210
+ end
211
+
212
+ def run_worktree_add!(project_dir:, branch:, branch_exists:, worktree_path:, base_branch:)
213
+ prune_attempted = false
214
+
215
+ loop do
216
+ cmd = build_worktree_command(branch_exists: branch_exists, branch: branch, worktree_path: worktree_path, base_branch: base_branch)
217
+ stdout, stderr, status = Dir.chdir(project_dir) { Open3.capture3(*cmd) }
218
+
219
+ return if status.success?
220
+
221
+ error_output = stderr.strip.empty? ? stdout.strip : stderr.strip
222
+
223
+ if !branch_exists && branch_already_exists?(error_output, branch)
224
+ Aidp.log_debug("worktree", "branch_exists_retry", branch: branch)
225
+ branch_exists = true
226
+ next
227
+ end
228
+
229
+ if !prune_attempted && missing_registered_worktree?(error_output)
230
+ Aidp.log_debug("worktree", "prune_missing_worktree", branch: branch, path: worktree_path)
231
+ Dir.chdir(project_dir) { Open3.capture3("git", "worktree", "prune") }
232
+ prune_attempted = true
233
+ next
234
+ end
235
+
236
+ raise Error, "Failed to create worktree (status=#{status.exitstatus}): #{error_output}"
237
+ end
238
+ end
239
+
240
+ def build_worktree_command(branch_exists:, branch:, worktree_path:, base_branch:)
241
+ if branch_exists
242
+ ["git", "worktree", "add", worktree_path, branch]
243
+ else
244
+ cmd = ["git", "worktree", "add", "-b", branch, worktree_path]
245
+ cmd << base_branch if base_branch
246
+ cmd
247
+ end
248
+ end
249
+
250
+ def branch_already_exists?(error_output, branch)
251
+ return false if error_output.nil? || error_output.empty?
252
+
253
+ normalized = error_output.downcase
254
+ normalized.include?("branch '#{branch.downcase}' already exists") ||
255
+ normalized.include?("a branch named '#{branch.downcase}' already exists")
256
+ end
257
+
258
+ def missing_registered_worktree?(error_output)
259
+ return false if error_output.nil? || error_output.empty?
260
+
261
+ error_output.downcase.include?("missing but already registered worktree")
262
+ end
206
263
  end
207
264
  end
208
265
  end
@@ -0,0 +1,21 @@
1
+ # Decide the Next Work Loop Unit
2
+
3
+ You are operating inside the Aidp hybrid work loop. Review the recent deterministic outputs, consider the latest agent summary, and choose the next unit by emitting `NEXT_UNIT: <unit_name>` on its own line.
4
+
5
+ ## Deterministic Outputs
6
+
7
+ {{DETERMINISTIC_OUTPUTS}}
8
+
9
+ ## Previous Agent Summary
10
+
11
+ {{PREVIOUS_AGENT_SUMMARY}}
12
+
13
+ ## Guidance
14
+
15
+ - Pick whichever unit will unblock progress the fastest. Options include deterministic unit names (`run_full_tests`, `run_lint`, etc.), `agentic` to resume coding, or `wait_for_github` if the system must await an external event.
16
+ - Cite concrete evidence from the outputs above when selecting a unit so future readers understand the decision.
17
+ - Keep the rationale tight—two or three sentences max.
18
+
19
+ ## Rationale
20
+
21
+ Provide the reasoning for your `NEXT_UNIT` decision here.
@@ -0,0 +1,21 @@
1
+ # Diagnose Recent Failures
2
+
3
+ You are operating inside the Aidp work loop. Analyze the most recent deterministic failures and decide how to unblock progress. Finish by emitting `NEXT_UNIT: <unit_name>` on its own line.
4
+
5
+ ## Recent Deterministic Outputs
6
+
7
+ {{DETERMINISTIC_OUTPUTS}}
8
+
9
+ ## Previous Agent Summary
10
+
11
+ {{PREVIOUS_AGENT_SUMMARY}}
12
+
13
+ ## Instructions
14
+
15
+ - Identify the concrete failures and hypothesize root causes.
16
+ - Propose the next best action (run another deterministic unit, resume agentic editing, or wait for GitHub updates).
17
+ - Keep the analysis crisp—focus on evidence and required follow-up work.
18
+
19
+ ## Analysis
20
+
21
+ Summarize key findings here, then state your `NEXT_UNIT` decision.
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aidp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Agapinan
8
- bindir: bin
8
+ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
@@ -231,7 +231,7 @@ extra_rdoc_files: []
231
231
  files:
232
232
  - LICENSE
233
233
  - README.md
234
- - bin/aidp
234
+ - exe/aidp
235
235
  - lib/aidp.rb
236
236
  - lib/aidp/analyze/error_handler.rb
237
237
  - lib/aidp/analyze/feature_analyzer.rb
@@ -297,6 +297,7 @@ files:
297
297
  - lib/aidp/harness/provider_factory.rb
298
298
  - lib/aidp/harness/provider_info.rb
299
299
  - lib/aidp/harness/provider_manager.rb
300
+ - lib/aidp/harness/provider_metrics.rb
300
301
  - lib/aidp/harness/provider_type_checker.rb
301
302
  - lib/aidp/harness/runner.rb
302
303
  - lib/aidp/harness/simple_user_interface.rb
@@ -347,10 +348,13 @@ files:
347
348
  - lib/aidp/prompt_optimization/style_guide_indexer.rb
348
349
  - lib/aidp/prompt_optimization/template_indexer.rb
349
350
  - lib/aidp/provider_manager.rb
351
+ - lib/aidp/providers/adapter.rb
350
352
  - lib/aidp/providers/anthropic.rb
351
353
  - lib/aidp/providers/base.rb
354
+ - lib/aidp/providers/capability_registry.rb
352
355
  - lib/aidp/providers/codex.rb
353
356
  - lib/aidp/providers/cursor.rb
357
+ - lib/aidp/providers/error_taxonomy.rb
354
358
  - lib/aidp/providers/gemini.rb
355
359
  - lib/aidp/providers/github_copilot.rb
356
360
  - lib/aidp/providers/opencode.rb
@@ -360,6 +364,7 @@ files:
360
364
  - lib/aidp/setup/devcontainer/generator.rb
361
365
  - lib/aidp/setup/devcontainer/parser.rb
362
366
  - lib/aidp/setup/devcontainer/port_manager.rb
367
+ - lib/aidp/setup/provider_registry.rb
363
368
  - lib/aidp/setup/wizard.rb
364
369
  - lib/aidp/skills.rb
365
370
  - lib/aidp/skills/composer.rb
@@ -438,6 +443,8 @@ files:
438
443
  - templates/skills/product_strategist/SKILL.md
439
444
  - templates/skills/repository_analyst/SKILL.md
440
445
  - templates/skills/test_analyzer/SKILL.md
446
+ - templates/work_loop/decide_whats_next.md
447
+ - templates/work_loop/diagnose_failures.md
441
448
  homepage: https://github.com/viamin/aidp
442
449
  licenses:
443
450
  - MIT
/data/{bin → exe}/aidp RENAMED
File without changes