Class: Aidp::Analyze::TreeSitterScan
- Inherits:
-
Object
- Object
- Aidp::Analyze::TreeSitterScan
- Includes:
- MessageDisplay
- Defined in:
- lib/aidp/analyze/tree_sitter_scan.rb
Constant Summary
Constants included from MessageDisplay
Instance Method Summary collapse
-
#initialize(root: Dir.pwd, kb_dir: ".aidp/kb", langs: %w[ruby],, threads: Etc.nprocessors, prompt: TTY::Prompt.new) ⇒ TreeSitterScan
constructor
A new instance of TreeSitterScan.
- #run ⇒ Object
Methods included from MessageDisplay
#display_message, #in_test_environment?, included, #message_display_prompt, #suppress_display_message?
Constructor Details
#initialize(root: Dir.pwd, kb_dir: ".aidp/kb", langs: %w[ruby],, threads: Etc.nprocessors, prompt: TTY::Prompt.new) ⇒ TreeSitterScan
17 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/tree_sitter_scan.rb', line 17 def initialize(root: Dir.pwd, kb_dir: ".aidp/kb", langs: %w[ruby], threads: Etc.nprocessors, prompt: TTY::Prompt.new) @root = File.(root) @kb_dir = File.(kb_dir, @root) @langs = Array(langs) @threads = threads @prompt = prompt @grammar_loader = TreeSitterGrammarLoader.new(@root, prompt: @prompt) # Data structures to accumulate analysis results @symbols = [] @imports = [] @calls = [] @metrics = [] @seams = [] @hotspots = [] @tests = [] @cycles = [] # Cache for parsed files @cache = {} @cache_file = File.join(@kb_dir, ".cache") end |
Instance Method Details
#run ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/aidp/analyze/tree_sitter_scan.rb', line 40 def run ("๐ Starting Tree-sitter static analysis...", type: :highlight) ("๐ Root: #{@root}", type: :info) ("๐๏ธ KB Directory: #{@kb_dir}", type: :info) ("๐ Languages: #{@langs.join(", ")}", type: :info) ("๐งต Threads: #{@threads}", type: :info) files = discover_files ("๐ Found #{files.length} files to analyze", type: :info) prepare_kb_dir load_cache parallel_parse(files) write_kb_files ("โ Tree-sitter analysis complete!", type: :success) ("๐ Generated KB files in #{@kb_dir}", type: :success) end |