Class: Aidp::WorkstreamCleanup

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

Overview

Service for interactively cleaning up inactive workstreams Displays comprehensive status and prompts user for deletion decisions

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Constructor Details

#initialize(project_dir: Dir.pwd, prompt: TTY::Prompt.new) ⇒ WorkstreamCleanup

Returns a new instance of WorkstreamCleanup.



14
15
16
17
# File 'lib/aidp/workstream_cleanup.rb', line 14

def initialize(project_dir: Dir.pwd, prompt: TTY::Prompt.new)
  @project_dir = project_dir
  @prompt = prompt
end

Instance Method Details

#runObject

Run interactive cleanup workflow



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/aidp/workstream_cleanup.rb', line 20

def run
  Aidp.log_debug("workstream_cleanup", "start", project_dir: @project_dir)

  workstreams = Aidp::Worktree.list(project_dir: @project_dir)

  if workstreams.empty?
    @prompt.say("No workstreams found.")
    Aidp.log_debug("workstream_cleanup", "no_workstreams")
    return
  end

  @prompt.say("Found #{workstreams.size} workstream(s)\n")

  workstreams.each do |ws|
    process_workstream(ws)
  end

  @prompt.say("\n✓ Cleanup complete")
  Aidp.log_debug("workstream_cleanup", "complete")
end