Class: Aidp::Harness::CompletionChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/harness/completion_checker.rb

Overview

Checks completion criteria for the workflow

Instance Method Summary collapse

Constructor Details

#initialize(project_dir, workflow_type = :exploration, command_executor: Aidp::ShellExecutor.new) ⇒ CompletionChecker

Returns a new instance of CompletionChecker.



9
10
11
12
13
14
# File 'lib/aidp/harness/completion_checker.rb', line 9

def initialize(project_dir, workflow_type = :exploration, command_executor: Aidp::ShellExecutor.new)
  @project_dir = project_dir
  @workflow_type = workflow_type
  @command_executor = command_executor
  @completion_results = {}
end

Instance Method Details

#all_criteria_met? ⇒ Boolean

Check if all completion criteria are met

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
# File 'lib/aidp/harness/completion_checker.rb', line 17

def all_criteria_met?
  criteria = completion_criteria

  criteria.all? do |criterion, checker|
    result = send(checker)
    @completion_results[criterion] = result
    result
  end
end

#completion_criteria ⇒ Object

Get completion criteria based on workflow type



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/aidp/harness/completion_checker.rb', line 28

def completion_criteria
  base_criteria = {
    steps_completed: :all_steps_completed?,
    tests_passing: :tests_passing?,
    linting_clean: :linting_clean?
  }

  if @workflow_type == :full
    base_criteria.merge({
      build_successful: :build_successful?,
      documentation_complete: :documentation_complete?
    })
  else
    base_criteria
  end
end

#completion_status ⇒ Object

Get completion status report



46
47
48
49
50
51
52
53
54
# File 'lib/aidp/harness/completion_checker.rb', line 46

def completion_status
  all_criteria_met? # This populates @completion_results

  {
    all_complete: @completion_results.values.all?,
    criteria: @completion_results,
    summary: generate_summary
  }
end