Class: Aidp::Planning::Generators::MVPScopeGenerator

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

Overview

Generates MVP scope definition using AI to analyze features Determines must-have vs nice-to-have features for MVP Uses Zero Framework Cognition (ZFC) - NO heuristics, pure AI decisions

Instance Method Summary collapse

Constructor Details

#initialize(ai_decision_engine:, prompt: nil, config: nil) ⇒ MVPScopeGenerator

Returns a new instance of MVPScopeGenerator.



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

def initialize(ai_decision_engine:, prompt: nil, config: nil)
  @ai_decision_engine = ai_decision_engine
  @prompt = prompt || TTY::Prompt.new
  @config = config || Aidp::Config.agile_config
end

Instance Method Details

#format_as_markdown(mvp_scope) ⇒ String

Format MVP scope as markdown

Parameters:

  • mvp_scope (Hash)

    MVP scope structure

Returns:

  • (String)

    Markdown formatted MVP scope



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
# File 'lib/aidp/planning/generators/mvp_scope_generator.rb', line 53

def format_as_markdown(mvp_scope)
  Aidp.log_debug("mvp_scope_generator", "format_as_markdown")

  output = ["# MVP Scope Definition", ""]
  output << "**Generated:** #{mvp_scope[:metadata][:generated_at]}"
  output << "**MVP Features:** #{mvp_scope[:metadata][:mvp_feature_count]}"
  output << "**Deferred Features:** #{mvp_scope[:metadata][:deferred_feature_count]}"
  output << ""

  output << "## Overview"
  output << ""
  output << "This document defines the Minimum Viable Product (MVP) scope, distinguishing between must-have features for initial release and nice-to-have features that can be deferred to later iterations."
  output << ""

  output << "## User Priorities"
  output << ""
  mvp_scope[:metadata][:user_priorities].each_with_index do |priority, idx|
    output << "#{idx + 1}. #{priority}"
  end
  output << ""

  output << "## MVP Features (Must-Have)"
  output << ""
  output << "These features are essential for the MVP and must be included in the first release:"
  output << ""
  mvp_scope[:mvp_features].each_with_index do |feature, idx|
    output << "### #{idx + 1}. #{feature[:name]}"
    output << ""
    output << feature[:description] if feature[:description]
    output << ""
    output << "**Rationale:** #{feature[:rationale]}" if feature[:rationale]
    output << ""
    output << "**Acceptance Criteria:**"
    (feature[:acceptance_criteria] || []).each do |criterion|
      output << "- #{criterion}"
    end
    output << ""
  end

  output << "## Deferred Features (Nice-to-Have)"
  output << ""
  output << "These features can be implemented in future iterations:"
  output << ""
  mvp_scope[:deferred_features].each_with_index do |feature, idx|
    output << "### #{idx + 1}. #{feature[:name]}"
    output << ""
    output << feature[:description] if feature[:description]
    output << ""
    output << "**Deferral Reason:** #{feature[:deferral_reason]}" if feature[:deferral_reason]
    output << ""
  end

  output << "## Out of Scope"
  output << ""
  output << "These items are explicitly out of scope for the MVP:"
  output << ""
  mvp_scope[:out_of_scope].each do |item|
    output << "- #{item}"
  end
  output << ""

  output << "## Success Criteria"
  output << ""
  output << "The MVP will be considered successful if:"
  output << ""
  mvp_scope[:success_criteria].each do |criterion|
    output << "- #{criterion}"
  end
  output << ""

  output << "## Assumptions"
  output << ""
  mvp_scope[:assumptions].each do |assumption|
    output << "- #{assumption}"
  end
  output << ""

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

  output.join("\n")
end

#generate(prd:, user_priorities: nil) ⇒ Hash

Generate MVP scope from PRD and user priorities

Parameters:

  • prd (Hash)

    Parsed PRD document

  • user_priorities (Array<String>) (defaults to: nil)

    User-specified priorities (optional)

Returns:

  • (Hash)

    MVP scope with must-have and nice-to-have features



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/mvp_scope_generator.rb', line 22

def generate(prd:, user_priorities: nil)
  Aidp.log_debug("mvp_scope_generator", "generate", has_prd: !prd.nil?)

  # Collect user priorities if not provided
  priorities = user_priorities || collect_user_priorities(prd)

  Aidp.log_debug("mvp_scope_generator", "analyzing_features", priority_count: priorities.size)

  # Use AI to analyze features and determine MVP viability
  mvp_analysis = analyze_features_with_ai(prd, priorities)

  {
    mvp_features: mvp_analysis[:must_have],
    deferred_features: mvp_analysis[:nice_to_have],
    out_of_scope: mvp_analysis[:out_of_scope],
    success_criteria: mvp_analysis[:success_criteria],
    assumptions: mvp_analysis[:assumptions],
    risks: mvp_analysis[:risks],
    metadata: {
      generated_at: Time.now.iso8601,
      mvp_feature_count: mvp_analysis[:must_have].size,
      deferred_feature_count: mvp_analysis[:nice_to_have].size,
      out_of_scope_count: mvp_analysis[:out_of_scope].size,
      user_priorities: priorities
    }
  }
end