Class: Aidp::Planning::Generators::IterationPlanGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/planning/generators/iteration_plan_generator.rb

Overview

Generates next iteration plan based on user feedback Creates actionable tasks to address feedback and improve product Uses Zero Framework Cognition (ZFC) for priority and task generation

Instance Method Summary collapse

Constructor Details

#initialize(ai_decision_engine:, wbs_generator: nil, config: nil) ⇒ IterationPlanGenerator

Returns a new instance of IterationPlanGenerator.



12
13
14
15
16
# File 'lib/aidp/planning/generators/iteration_plan_generator.rb', line 12

def initialize(ai_decision_engine:, wbs_generator: nil, config: nil)
  @ai_decision_engine = ai_decision_engine
  @wbs_generator = wbs_generator
  @config = config || Aidp::Config.agile_config
end

Instance Method Details

#format_as_markdown(plan) ⇒ String

Format iteration plan as markdown

Parameters:

  • plan (Hash)

    Iteration plan structure

Returns:

  • (String)

    Markdown formatted iteration plan



53
54
55
56
57
58
59
60
61
62
63
64
65
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/aidp/planning/generators/iteration_plan_generator.rb', line 53

def format_as_markdown(plan)
  Aidp.log_debug("iteration_plan_generator", "format_as_markdown")

  output = ["# Next Iteration Plan", ""]
  output << "**Generated:** #{plan[:metadata][:generated_at]}"
  output << "**Improvements:** #{plan[:metadata][:improvement_count]}"
  output << "**New Features:** #{plan[:metadata][:new_feature_count]}"
  output << "**Total Tasks:** #{plan[:metadata][:task_count]}"
  output << ""

  output << "## Overview"
  output << ""
  output << plan[:overview]
  output << ""

  output << "## Iteration Goals"
  output << ""
  plan[:goals].each_with_index do |goal, idx|
    output << "#{idx + 1}. #{goal}"
  end
  output << ""

  output << "## Feature Improvements"
  output << ""
  output << "Based on user feedback, these existing features will be improved:"
  output << ""
  plan[:improvements].each_with_index do |improvement, idx|
    output << "### #{idx + 1}. #{improvement[:feature_name]}"
    output << ""
    output << "**Current Issue:** #{improvement[:issue]}"
    output << ""
    output << "**Proposed Improvement:** #{improvement[:improvement]}"
    output << ""
    output << "**User Impact:** #{improvement[:impact]}"
    output << ""
    output << "**Effort:** #{improvement[:effort]}"
    output << ""
    output << "**Priority:** #{improvement[:priority]}"
    output << ""
  end

  output << "## New Features"
  output << ""
  output << "New features to be added based on user requests:"
  output << ""
  plan[:new_features].each_with_index do |feature, idx|
    output << "### #{idx + 1}. #{feature[:name]}"
    output << ""
    output << feature[:description]
    output << ""
    output << "**Rationale:** #{feature[:rationale]}"
    output << ""
    output << "**Acceptance Criteria:**"
    (feature[:acceptance_criteria] || []).each do |criterion|
      output << "- #{criterion}"
    end
    output << ""
    output << "**Effort:** #{feature[:effort]}"
    output << ""
  end

  output << "## Bug Fixes"
  output << ""
  plan[:bug_fixes].each_with_index do |bug, idx|
    output << "#{idx + 1}. **#{bug[:title]}** (Priority: #{bug[:priority]})"
    output << "   - Description: #{bug[:description]}"
    output << "   - Affected Users: #{bug[:affected_users]}"
    output << ""
  end

  output << "## Technical Debt"
  output << ""
  output << "Technical improvements to be addressed:"
  output << ""
  plan[:technical_debt].each do |debt|
    output << "- **#{debt[:title]}:** #{debt[:description]} (Effort: #{debt[:effort]})"
  end
  output << ""

  output << "## Task Breakdown"
  output << ""
  plan[:tasks].each_with_index do |task, idx|
    output << "### Task #{idx + 1}: #{task[:name]}"
    output << ""
    output << "**Description:** #{task[:description]}"
    output << ""
    output << "**Category:** #{task[:category]}"
    output << ""
    output << "**Priority:** #{task[:priority]}"
    output << ""
    output << "**Estimated Effort:** #{task[:effort]}"
    output << ""
    output << "**Dependencies:** #{task[:dependencies]&.join(", ") || "None"}"
    output << ""
    output << "**Success Criteria:**"
    (task[:success_criteria] || []).each do |criterion|
      output << "- #{criterion}"
    end
    output << ""
  end

  output << "## Success Metrics"
  output << ""
  output << "How we'll measure success of this iteration:"
  output << ""
  plan[:success_metrics].each do |metric|
    output << "- **#{metric[:name]}:** #{metric[:target]}"
    output << ""
  end

  output << "## Risks and Mitigation"
  output << ""
  plan[:risks].each_with_index do |risk, idx|
    output << "#{idx + 1}. **#{risk[:title]}**"
    output << "   - Probability: #{risk[:probability]}"
    output << "   - Impact: #{risk[:impact]}"
    output << "   - Mitigation: #{risk[:mitigation]}"
    output << ""
  end

  output << "## Timeline"
  output << ""
  plan[:timeline].each do |phase|
    output << "- **#{phase[:phase]}:** #{phase[:duration]} (#{phase[:activities]})"
  end
  output << ""

  output.join("\n")
end

#generate(feedback_analysis:, current_mvp: nil) ⇒ Hash

Generate iteration plan from feedback analysis

Parameters:

  • feedback_analysis (Hash)

    Analyzed feedback data

  • current_mvp (Hash) (defaults to: nil)

    Current MVP scope (optional)

Returns:

  • (Hash)

    Iteration plan structure



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/aidp/planning/generators/iteration_plan_generator.rb', line 22

def generate(feedback_analysis:, current_mvp: nil)
  Aidp.log_debug("iteration_plan_generator", "generate",
    recommendations: feedback_analysis[:recommendations]&.size || 0)

  # Use AI to generate iteration plan
  iteration_plan = generate_plan_with_ai(feedback_analysis, current_mvp)

  {
    overview: iteration_plan[:overview],
    goals: iteration_plan[:goals],
    improvements: iteration_plan[:improvements],
    new_features: iteration_plan[:new_features],
    bug_fixes: iteration_plan[:bug_fixes],
    technical_debt: iteration_plan[:technical_debt],
    tasks: iteration_plan[:tasks],
    success_metrics: iteration_plan[:success_metrics],
    risks: iteration_plan[:risks],
    timeline: iteration_plan[:timeline],
    metadata: {
      generated_at: Time.now.iso8601,
      improvement_count: iteration_plan[:improvements]&.size || 0,
      new_feature_count: iteration_plan[:new_features]&.size || 0,
      task_count: iteration_plan[:tasks]&.size || 0,
      based_on_feedback: !feedback_analysis.nil?
    }
  }
end