Class: Aidp::Analyze::KBInspector

Inherits:
Object
  • Object
show all
Includes:
MessageDisplay
Defined in:
lib/aidp/analyze/kb_inspector.rb

Constant Summary

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP

Instance Method Summary collapse

Methods included from MessageDisplay

#display_message, #in_test_environment?, included, #message_display_prompt, #suppress_display_message?

Constructor Details

#initialize(kb_dir = ".aidp/kb", prompt: TTY::Prompt.new) ⇒ KBInspector

Returns a new instance of KBInspector.



12
13
14
15
16
# File 'lib/aidp/analyze/kb_inspector.rb', line 12

def initialize(kb_dir = ".aidp/kb", prompt: TTY::Prompt.new)
  @kb_dir = File.expand_path(kb_dir)
  @prompt = prompt
  @data = load_kb_data
end

Instance Method Details

#generate_graph(type, format: "dot", output: nil) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/aidp/analyze/kb_inspector.rb', line 40

def generate_graph(type, format: "dot", output: nil)
  case type
  when "imports"
    generate_import_graph(format, output)
  when "calls"
    generate_call_graph(format, output)
  when "cycles"
    generate_cycle_graph(format, output)
  else
    display_message("Unknown graph type: #{type}", type: :error)
    display_message("Available types: imports, calls, cycles", type: :info)
  end
end

#show(type, format: "summary") ⇒ Object



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

def show(type, format: "summary")
  case type
  when "seams"
    show_seams(format)
  when "hotspots"
    show_hotspots(format)
  when "cycles"
    show_cycles(format)
  when "apis"
    show_apis(format)
  when "symbols"
    show_symbols(format)
  when "imports"
    show_imports(format)
  when "summary"
    show_summary(format)
  else
    display_message("Unknown KB type: #{type}", type: :error)
    display_message("Available types: seams, hotspots, cycles, apis, symbols, imports, summary", type: :info)
  end
end