Class: EnhanceSwarm::ProjectAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/enhance_swarm/project_analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_root = Dir.pwd) ⇒ ProjectAnalyzer

Returns a new instance of ProjectAnalyzer.



12
13
14
15
# File 'lib/enhance_swarm/project_analyzer.rb', line 12

def initialize(project_root = Dir.pwd)
  @project_root = Pathname.new(project_root)
  @analysis_results = {}
end

Instance Attribute Details

#analysis_resultsObject (readonly)

Returns the value of attribute analysis_results.



10
11
12
# File 'lib/enhance_swarm/project_analyzer.rb', line 10

def analysis_results
  @analysis_results
end

#project_rootObject (readonly)

Returns the value of attribute project_root.



10
11
12
# File 'lib/enhance_swarm/project_analyzer.rb', line 10

def project_root
  @project_root
end

Instance Method Details

#analyzeObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/enhance_swarm/project_analyzer.rb', line 17

def analyze
  Logger.info("Analyzing project at: #{@project_root}")
  
  @analysis_results = {
    project_type: detect_project_type,
    technology_stack: detect_technology_stack,
    documentation: analyze_documentation,
    testing_framework: detect_testing_framework,
    build_system: detect_build_system,
    deployment: detect_deployment_config,
    database: detect_database,
    frontend_framework: detect_frontend_framework,
    project_structure: analyze_project_structure,
    git_info: analyze_git_info,
    package_managers: detect_package_managers,
    ci_cd: detect_ci_cd,
    containerization: detect_containerization,
    recommended_agents: recommend_agents,
    smart_commands: generate_smart_commands
  }
  
  Logger.info("Project analysis completed. Type: #{@analysis_results[:project_type]}")
  @analysis_results
end

#generate_smart_defaultsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/enhance_swarm/project_analyzer.rb', line 42

def generate_smart_defaults
  return {} unless @analysis_results.any?

  {
    project_name: detect_project_name,
    project_description: generate_project_description,
    technology_stack: @analysis_results[:technology_stack],
    test_command: @analysis_results[:smart_commands][:test],
    lint_command: @analysis_results[:smart_commands][:lint],
    build_command: @analysis_results[:smart_commands][:build],
    start_command: @analysis_results[:smart_commands][:start],
    max_concurrent_agents: recommend_agent_count,
    preferred_agents: @analysis_results[:recommended_agents],
    documentation_path: @analysis_results[:documentation][:primary_path],
    has_documentation: @analysis_results[:documentation][:has_docs]
  }
end