Class: Aidp::Planning::Builders::ProjectPlanBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/planning/builders/project_plan_builder.rb

Overview

Orchestrates generation of complete project plan Coordinates all planning components (parsing, generating, mapping)

Instance Method Summary collapse

Constructor Details

#initialize(ai_decision_engine:, config: nil, document_parser: nil, wbs_generator: nil, gantt_generator: nil, persona_mapper: nil) ⇒ ProjectPlanBuilder

Returns a new instance of ProjectPlanBuilder.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/aidp/planning/builders/project_plan_builder.rb', line 15

def initialize(
  ai_decision_engine:,
  config: nil,
  document_parser: nil,
  wbs_generator: nil,
  gantt_generator: nil,
  persona_mapper: nil
)
  @ai_decision_engine = ai_decision_engine
  @config = config || Aidp::Config.waterfall_config
  @document_parser = document_parser || Parsers::DocumentParser.new(ai_decision_engine: ai_decision_engine)
  @wbs_generator = wbs_generator || Generators::WBSGenerator.new(config: @config)
  @gantt_generator = gantt_generator || Generators::GanttGenerator.new(config: @config)
  @persona_mapper = persona_mapper || Mappers::PersonaMapper.new(ai_decision_engine: ai_decision_engine, config: @config)
end

Instance Method Details

#assemble_project_plan(components) ⇒ String

Assemble complete project plan document

Parameters:

  • components (Hash)

    All plan components

Returns:

  • (String)

    Complete PROJECT_PLAN.md content



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/aidp/planning/builders/project_plan_builder.rb', line 66

def assemble_project_plan(components)
  Aidp.log_debug("project_plan_builder", "assemble_project_plan")

  output = ["# Project Plan", ""]
  output << "Generated: #{Time.now.iso8601}"
  output << ""

  # Executive Summary
  output << "## Executive Summary"
  output << ""
  output << "This document provides a comprehensive project plan including:"
  output << "- Work Breakdown Structure (WBS)"
  output << "- Gantt Chart with Critical Path"
  output << "- Task Dependencies and Milestones"
  output << "- Persona/Agent Assignments"
  output << ""

  # WBS Section
  output << "## Work Breakdown Structure"
  output << ""
  output << components[:wbs_markdown]
  output << ""

  # Gantt Chart Section
  output << "## Timeline and Gantt Chart"
  output << ""
  output << "```mermaid"
  output << components[:gantt_mermaid]
  output << "```"
  output << ""

  # Critical Path
  output << "## Critical Path"
  output << ""
  output << "The following tasks form the critical path (longest sequence):"
  output << ""
  components[:critical_path].each_with_index do |task_id, idx|
    output << "#{idx + 1}. #{task_id}"
  end
  output << ""

  # Persona Assignments
  output << "## Persona Assignments"
  output << ""
  output << "Tasks are assigned to the following personas:"
  output << ""
  persona_summary = summarize_persona_assignments(components[:persona_assignments])
  output << persona_summary
  output << ""

  # Metadata
  output << "## Metadata"
  output << ""
  output << "- **Total Phases:** #{components[:wbs][:metadata][:phase_count]}"
  output << "- **Total Tasks:** #{components[:wbs][:metadata][:total_tasks]}"
  output << "- **Critical Path Length:** #{components[:gantt][:metadata][:critical_path_length]} tasks"
  output << "- **Personas Used:** #{components[:persona_assignments][:metadata][:personas_used].size}"
  output << ""

  output.join("\n")
end

#build_from_ingestion(docs_path) ⇒ Hash

Build project plan from existing documentation (ingestion path)

Parameters:

  • docs_path (String)

    Path to existing documentation

Returns:

  • (Hash)

    Complete project plan



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/aidp/planning/builders/project_plan_builder.rb', line 34

def build_from_ingestion(docs_path)
  Aidp.log_debug("project_plan_builder", "build_from_ingestion", path: docs_path)

  # Parse existing docs
  parsed_docs = @document_parser.parse_directory(docs_path)
  Aidp.log_debug("project_plan_builder", "parsed_docs", count: parsed_docs.size)

  # Extract PRD and design docs
  prd = parsed_docs.find { |d| d[:type] == :prd }
  tech_design = parsed_docs.find { |d| d[:type] == :design }

  # Generate plan components
  build_plan_components(prd, tech_design)
end

#build_from_scratch(requirements) ⇒ Hash

Build project plan from scratch (generation path)

Parameters:

  • requirements (Hash)

    User-provided requirements

Returns:

  • (Hash)

    Complete project plan



52
53
54
55
56
57
58
59
60
61
# File 'lib/aidp/planning/builders/project_plan_builder.rb', line 52

def build_from_scratch(requirements)
  Aidp.log_debug("project_plan_builder", "build_from_scratch")

  # In production, this would use AI to generate PRD and design docs
  # For now, we'll create minimal structure from requirements
  prd = structure_requirements_as_prd(requirements)
  tech_design = nil # Will be generated by AI templates

  build_plan_components(prd, tech_design)
end