aidp 0.7.0 ā 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +60 -214
- data/bin/aidp +1 -1
- data/lib/aidp/analysis/kb_inspector.rb +38 -23
- data/lib/aidp/analysis/seams.rb +2 -31
- data/lib/aidp/analysis/tree_sitter_grammar_loader.rb +0 -13
- data/lib/aidp/analysis/tree_sitter_scan.rb +3 -20
- data/lib/aidp/analyze/error_handler.rb +2 -75
- data/lib/aidp/analyze/json_file_storage.rb +292 -0
- data/lib/aidp/analyze/progress.rb +12 -0
- data/lib/aidp/analyze/progress_visualizer.rb +12 -17
- data/lib/aidp/analyze/ruby_maat_integration.rb +13 -31
- data/lib/aidp/analyze/runner.rb +256 -87
- data/lib/aidp/cli/jobs_command.rb +100 -432
- data/lib/aidp/cli.rb +309 -239
- data/lib/aidp/config.rb +298 -10
- data/lib/aidp/debug_logger.rb +195 -0
- data/lib/aidp/debug_mixin.rb +187 -0
- data/lib/aidp/execute/progress.rb +9 -0
- data/lib/aidp/execute/runner.rb +221 -40
- data/lib/aidp/execute/steps.rb +17 -7
- data/lib/aidp/execute/workflow_selector.rb +211 -0
- data/lib/aidp/harness/completion_checker.rb +268 -0
- data/lib/aidp/harness/condition_detector.rb +1526 -0
- data/lib/aidp/harness/config_loader.rb +373 -0
- data/lib/aidp/harness/config_manager.rb +382 -0
- data/lib/aidp/harness/config_schema.rb +1006 -0
- data/lib/aidp/harness/config_validator.rb +355 -0
- data/lib/aidp/harness/configuration.rb +477 -0
- data/lib/aidp/harness/enhanced_runner.rb +494 -0
- data/lib/aidp/harness/error_handler.rb +616 -0
- data/lib/aidp/harness/provider_config.rb +423 -0
- data/lib/aidp/harness/provider_factory.rb +306 -0
- data/lib/aidp/harness/provider_manager.rb +1269 -0
- data/lib/aidp/harness/provider_type_checker.rb +88 -0
- data/lib/aidp/harness/runner.rb +411 -0
- data/lib/aidp/harness/state/errors.rb +28 -0
- data/lib/aidp/harness/state/metrics.rb +219 -0
- data/lib/aidp/harness/state/persistence.rb +128 -0
- data/lib/aidp/harness/state/provider_state.rb +132 -0
- data/lib/aidp/harness/state/ui_state.rb +68 -0
- data/lib/aidp/harness/state/workflow_state.rb +123 -0
- data/lib/aidp/harness/state_manager.rb +586 -0
- data/lib/aidp/harness/status_display.rb +888 -0
- data/lib/aidp/harness/ui/base.rb +16 -0
- data/lib/aidp/harness/ui/enhanced_tui.rb +545 -0
- data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +252 -0
- data/lib/aidp/harness/ui/error_handler.rb +132 -0
- data/lib/aidp/harness/ui/frame_manager.rb +361 -0
- data/lib/aidp/harness/ui/job_monitor.rb +500 -0
- data/lib/aidp/harness/ui/navigation/main_menu.rb +311 -0
- data/lib/aidp/harness/ui/navigation/menu_formatter.rb +120 -0
- data/lib/aidp/harness/ui/navigation/menu_item.rb +142 -0
- data/lib/aidp/harness/ui/navigation/menu_state.rb +139 -0
- data/lib/aidp/harness/ui/navigation/submenu.rb +202 -0
- data/lib/aidp/harness/ui/navigation/workflow_selector.rb +176 -0
- data/lib/aidp/harness/ui/progress_display.rb +280 -0
- data/lib/aidp/harness/ui/question_collector.rb +141 -0
- data/lib/aidp/harness/ui/spinner_group.rb +184 -0
- data/lib/aidp/harness/ui/spinner_helper.rb +152 -0
- data/lib/aidp/harness/ui/status_manager.rb +312 -0
- data/lib/aidp/harness/ui/status_widget.rb +280 -0
- data/lib/aidp/harness/ui/workflow_controller.rb +312 -0
- data/lib/aidp/harness/user_interface.rb +2381 -0
- data/lib/aidp/provider_manager.rb +131 -7
- data/lib/aidp/providers/anthropic.rb +28 -103
- data/lib/aidp/providers/base.rb +170 -0
- data/lib/aidp/providers/cursor.rb +52 -181
- data/lib/aidp/providers/gemini.rb +24 -107
- data/lib/aidp/providers/macos_ui.rb +99 -5
- data/lib/aidp/providers/opencode.rb +194 -0
- data/lib/aidp/storage/csv_storage.rb +172 -0
- data/lib/aidp/storage/file_manager.rb +214 -0
- data/lib/aidp/storage/json_storage.rb +140 -0
- data/lib/aidp/version.rb +1 -1
- data/lib/aidp.rb +54 -39
- data/templates/COMMON/AGENT_BASE.md +11 -0
- data/templates/EXECUTE/00_PRD.md +4 -4
- data/templates/EXECUTE/02_ARCHITECTURE.md +5 -4
- data/templates/EXECUTE/07_TEST_PLAN.md +4 -1
- data/templates/EXECUTE/08_TASKS.md +4 -4
- data/templates/EXECUTE/10_IMPLEMENTATION_AGENT.md +4 -4
- data/templates/README.md +279 -0
- data/templates/aidp-development.yml.example +373 -0
- data/templates/aidp-minimal.yml.example +48 -0
- data/templates/aidp-production.yml.example +475 -0
- data/templates/aidp.yml.example +598 -0
- metadata +93 -69
- data/lib/aidp/analyze/agent_personas.rb +0 -71
- data/lib/aidp/analyze/agent_tool_executor.rb +0 -439
- data/lib/aidp/analyze/data_retention_manager.rb +0 -421
- data/lib/aidp/analyze/database.rb +0 -260
- data/lib/aidp/analyze/dependencies.rb +0 -335
- data/lib/aidp/analyze/export_manager.rb +0 -418
- data/lib/aidp/analyze/focus_guidance.rb +0 -517
- data/lib/aidp/analyze/incremental_analyzer.rb +0 -533
- data/lib/aidp/analyze/language_analysis_strategies.rb +0 -897
- data/lib/aidp/analyze/large_analysis_progress.rb +0 -499
- data/lib/aidp/analyze/memory_manager.rb +0 -339
- data/lib/aidp/analyze/metrics_storage.rb +0 -336
- data/lib/aidp/analyze/parallel_processor.rb +0 -454
- data/lib/aidp/analyze/performance_optimizer.rb +0 -691
- data/lib/aidp/analyze/repository_chunker.rb +0 -697
- data/lib/aidp/analyze/static_analysis_detector.rb +0 -577
- data/lib/aidp/analyze/storage.rb +0 -655
- data/lib/aidp/analyze/tool_configuration.rb +0 -441
- data/lib/aidp/analyze/tool_modernization.rb +0 -750
- data/lib/aidp/database/pg_adapter.rb +0 -148
- data/lib/aidp/database_config.rb +0 -69
- data/lib/aidp/database_connection.rb +0 -72
- data/lib/aidp/job_manager.rb +0 -41
- data/lib/aidp/jobs/base_job.rb +0 -45
- data/lib/aidp/jobs/provider_execution_job.rb +0 -83
- data/lib/aidp/project_detector.rb +0 -117
- data/lib/aidp/providers/agent_supervisor.rb +0 -348
- data/lib/aidp/providers/supervised_base.rb +0 -317
- data/lib/aidp/providers/supervised_cursor.rb +0 -22
- data/lib/aidp/sync.rb +0 -13
- data/lib/aidp/workspace.rb +0 -19
@@ -1,517 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "prioritizer"
|
4
|
-
require_relative "ruby_maat_integration"
|
5
|
-
require_relative "feature_analyzer"
|
6
|
-
|
7
|
-
module Aidp
|
8
|
-
module Analyze
|
9
|
-
class FocusGuidance
|
10
|
-
def initialize(project_dir = Dir.pwd)
|
11
|
-
@project_dir = project_dir
|
12
|
-
@prioritizer = AnalysisPrioritizer.new(project_dir)
|
13
|
-
@code_maat = RubyMaatIntegration.new(project_dir)
|
14
|
-
@feature_analyzer = FeatureAnalyzer.new(project_dir)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Generate comprehensive focus area recommendations
|
18
|
-
def generate_focus_recommendations
|
19
|
-
# Get all analysis data
|
20
|
-
code_maat_data = @code_maat.run_comprehensive_analysis
|
21
|
-
features = @feature_analyzer.detect_features
|
22
|
-
@prioritizer.generate_prioritized_recommendations
|
23
|
-
|
24
|
-
{
|
25
|
-
high_priority_areas: generate_high_priority_areas(code_maat_data, features),
|
26
|
-
medium_priority_areas: generate_medium_priority_areas(code_maat_data, features),
|
27
|
-
low_priority_areas: generate_low_priority_areas(code_maat_data, features),
|
28
|
-
focus_strategies: generate_focus_strategies(code_maat_data, features),
|
29
|
-
interactive_questions: generate_interactive_questions(code_maat_data, features)
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# Interactive focus area selection
|
34
|
-
def interactive_focus_selection
|
35
|
-
puts "\nšÆ Interactive Focus Area Selection"
|
36
|
-
puts "=================================="
|
37
|
-
|
38
|
-
recommendations = generate_focus_recommendations
|
39
|
-
|
40
|
-
# Display high priority areas
|
41
|
-
display_priority_areas("HIGH PRIORITY", recommendations[:high_priority_areas])
|
42
|
-
|
43
|
-
# Display medium priority areas
|
44
|
-
display_priority_areas("MEDIUM PRIORITY", recommendations[:medium_priority_areas])
|
45
|
-
|
46
|
-
# Display low priority areas
|
47
|
-
display_priority_areas("LOW PRIORITY", recommendations[:low_priority_areas])
|
48
|
-
|
49
|
-
# Interactive selection
|
50
|
-
selected_areas = collect_user_selections(recommendations)
|
51
|
-
|
52
|
-
# Generate focused analysis plan
|
53
|
-
generate_focused_plan(selected_areas, recommendations)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Get focus areas based on ruby-maat analysis
|
57
|
-
def get_code_maat_focus_areas
|
58
|
-
@code_maat.run_comprehensive_analysis
|
59
|
-
|
60
|
-
focus_areas = []
|
61
|
-
|
62
|
-
# High churn areas
|
63
|
-
high_churn_files = @code_maat.get_high_churn_files(10)
|
64
|
-
if high_churn_files.any?
|
65
|
-
focus_areas << {
|
66
|
-
type: "high_churn",
|
67
|
-
title: "High Churn Areas",
|
68
|
-
description: "Files with frequent changes indicating potential technical debt",
|
69
|
-
files: high_churn_files.first(5),
|
70
|
-
priority: "high",
|
71
|
-
rationale: "High churn indicates areas that may need refactoring or stabilization"
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
# Knowledge silos
|
76
|
-
knowledge_silos = @code_maat.get_knowledge_silos
|
77
|
-
if knowledge_silos.any?
|
78
|
-
focus_areas << {
|
79
|
-
type: "knowledge_silo",
|
80
|
-
title: "Knowledge Silos",
|
81
|
-
description: "Files with single author indicating potential knowledge concentration",
|
82
|
-
files: knowledge_silos.first(5),
|
83
|
-
priority: "high",
|
84
|
-
rationale: "Knowledge silos create risk if the author leaves or becomes unavailable"
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
# Tight coupling
|
89
|
-
tightly_coupled = @code_maat.get_tightly_coupled_files(5)
|
90
|
-
if tightly_coupled.any?
|
91
|
-
focus_areas << {
|
92
|
-
type: "tight_coupling",
|
93
|
-
title: "Tightly Coupled Files",
|
94
|
-
description: "Files with high coupling indicating potential architectural issues",
|
95
|
-
couplings: tightly_coupled.first(5),
|
96
|
-
priority: "medium",
|
97
|
-
rationale: "Tight coupling makes the codebase harder to maintain and modify"
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
focus_areas
|
102
|
-
end
|
103
|
-
|
104
|
-
# Get focus areas based on feature analysis
|
105
|
-
def get_feature_focus_areas
|
106
|
-
features = @feature_analyzer.detect_features
|
107
|
-
|
108
|
-
focus_areas = []
|
109
|
-
|
110
|
-
# Complex features
|
111
|
-
complex_features = features.select { |f| f[:complexity] > 7 }
|
112
|
-
if complex_features.any?
|
113
|
-
focus_areas << {
|
114
|
-
type: "complex_features",
|
115
|
-
title: "Complex Features",
|
116
|
-
description: "Features with high complexity that may need simplification",
|
117
|
-
features: complex_features.first(5),
|
118
|
-
priority: "high",
|
119
|
-
rationale: "Complex features are harder to understand, test, and maintain"
|
120
|
-
}
|
121
|
-
end
|
122
|
-
|
123
|
-
# Large features
|
124
|
-
large_features = features.select { |f| f[:size]&.> 1000 }
|
125
|
-
if large_features.any?
|
126
|
-
focus_areas << {
|
127
|
-
type: "large_features",
|
128
|
-
title: "Large Features",
|
129
|
-
description: "Features with large code size that may benefit from decomposition",
|
130
|
-
features: large_features.first(5),
|
131
|
-
priority: "medium",
|
132
|
-
rationale: "Large features may violate single responsibility principle"
|
133
|
-
}
|
134
|
-
end
|
135
|
-
|
136
|
-
# Features with technical debt indicators
|
137
|
-
debt_features = features.select { |f| f[:technical_debt]&.> 5 }
|
138
|
-
if debt_features.any?
|
139
|
-
focus_areas << {
|
140
|
-
type: "technical_debt",
|
141
|
-
title: "Technical Debt Hotspots",
|
142
|
-
description: "Features with indicators of technical debt",
|
143
|
-
features: debt_features.first(5),
|
144
|
-
priority: "high",
|
145
|
-
rationale: "Technical debt accumulates and makes future development harder"
|
146
|
-
}
|
147
|
-
end
|
148
|
-
|
149
|
-
focus_areas
|
150
|
-
end
|
151
|
-
|
152
|
-
# Generate analysis strategy recommendations
|
153
|
-
def generate_analysis_strategies
|
154
|
-
code_maat_data = @code_maat.run_comprehensive_analysis
|
155
|
-
@feature_analyzer.detect_features
|
156
|
-
|
157
|
-
strategies = []
|
158
|
-
|
159
|
-
# Strategy based on codebase size
|
160
|
-
total_files = code_maat_data[:churn][:total_files]
|
161
|
-
if total_files > 100
|
162
|
-
strategies << {
|
163
|
-
type: "large_codebase",
|
164
|
-
title: "Large Codebase Strategy",
|
165
|
-
description: "Incremental analysis with focus on high-impact areas",
|
166
|
-
approach: "Analyze in phases, starting with highest priority areas",
|
167
|
-
estimated_effort: "2-4 weeks",
|
168
|
-
recommendations: [
|
169
|
-
"Start with repository analysis to establish baseline",
|
170
|
-
"Focus on high-churn and knowledge silo areas first",
|
171
|
-
"Use chunking for large analysis tasks",
|
172
|
-
"Prioritize based on business impact"
|
173
|
-
]
|
174
|
-
}
|
175
|
-
end
|
176
|
-
|
177
|
-
# Strategy based on knowledge silos
|
178
|
-
knowledge_silos = code_maat_data[:authorship][:files_with_single_author]
|
179
|
-
if knowledge_silos > total_files * 0.3
|
180
|
-
strategies << {
|
181
|
-
type: "knowledge_silos",
|
182
|
-
title: "Knowledge Transfer Strategy",
|
183
|
-
description: "Focus on reducing knowledge concentration risk",
|
184
|
-
approach: "Document and share knowledge, implement pair programming",
|
185
|
-
estimated_effort: "1-2 weeks",
|
186
|
-
recommendations: [
|
187
|
-
"Document knowledge silo areas thoroughly",
|
188
|
-
"Implement pair programming for critical areas",
|
189
|
-
"Create knowledge sharing sessions",
|
190
|
-
"Consider job rotation for critical knowledge holders"
|
191
|
-
]
|
192
|
-
}
|
193
|
-
end
|
194
|
-
|
195
|
-
# Strategy based on coupling
|
196
|
-
if code_maat_data[:coupling][:average_coupling] > 5
|
197
|
-
strategies << {
|
198
|
-
type: "coupling_reduction",
|
199
|
-
title: "Coupling Reduction Strategy",
|
200
|
-
description: "Focus on reducing tight coupling between components",
|
201
|
-
approach: "Refactor to improve modularity and reduce dependencies",
|
202
|
-
estimated_effort: "2-3 weeks",
|
203
|
-
recommendations: [
|
204
|
-
"Identify coupling hotspots",
|
205
|
-
"Refactor tightly coupled components",
|
206
|
-
"Introduce interfaces and abstractions",
|
207
|
-
"Implement dependency injection where appropriate"
|
208
|
-
]
|
209
|
-
}
|
210
|
-
end
|
211
|
-
|
212
|
-
strategies
|
213
|
-
end
|
214
|
-
|
215
|
-
private
|
216
|
-
|
217
|
-
def generate_high_priority_areas(code_maat_data, features)
|
218
|
-
areas = []
|
219
|
-
|
220
|
-
# High churn + knowledge silos
|
221
|
-
high_churn_silos = @prioritizer.get_high_priority_targets.select { |t| t[:type] == "knowledge_silo" }
|
222
|
-
if high_churn_silos.any?
|
223
|
-
areas << {
|
224
|
-
type: "critical_risk",
|
225
|
-
title: "Critical Risk Areas",
|
226
|
-
description: "High churn files with single authors - immediate attention required",
|
227
|
-
items: high_churn_silos.first(3),
|
228
|
-
impact: "high",
|
229
|
-
effort: "medium",
|
230
|
-
urgency: "immediate"
|
231
|
-
}
|
232
|
-
end
|
233
|
-
|
234
|
-
# Tight coupling
|
235
|
-
tight_coupling = @prioritizer.get_high_priority_targets.select { |t| t[:type] == "tight_coupling" }
|
236
|
-
if tight_coupling.any?
|
237
|
-
areas << {
|
238
|
-
type: "architectural_risk",
|
239
|
-
title: "Architectural Risk Areas",
|
240
|
-
description: "Tightly coupled files that may cause cascading changes",
|
241
|
-
items: tight_coupling.first(3),
|
242
|
-
impact: "high",
|
243
|
-
effort: "high",
|
244
|
-
urgency: "high"
|
245
|
-
}
|
246
|
-
end
|
247
|
-
|
248
|
-
areas
|
249
|
-
end
|
250
|
-
|
251
|
-
def generate_medium_priority_areas(code_maat_data, features)
|
252
|
-
areas = []
|
253
|
-
|
254
|
-
# Coordination issues
|
255
|
-
coordination_issues = @prioritizer.get_medium_priority_targets.select { |t| t[:type] == "coordination_issue" }
|
256
|
-
if coordination_issues.any?
|
257
|
-
areas << {
|
258
|
-
type: "coordination_risk",
|
259
|
-
title: "Coordination Risk Areas",
|
260
|
-
description: "High churn files with multiple authors - potential coordination issues",
|
261
|
-
items: coordination_issues.first(3),
|
262
|
-
impact: "medium",
|
263
|
-
effort: "medium",
|
264
|
-
urgency: "medium"
|
265
|
-
}
|
266
|
-
end
|
267
|
-
|
268
|
-
# Medium churn areas
|
269
|
-
medium_churn = @prioritizer.get_medium_priority_targets.select { |t| t[:type] == "medium_churn" }
|
270
|
-
if medium_churn.any?
|
271
|
-
areas << {
|
272
|
-
type: "monitoring_areas",
|
273
|
-
title: "Monitoring Areas",
|
274
|
-
description: "Medium churn files that should be monitored for increasing complexity",
|
275
|
-
items: medium_churn.first(3),
|
276
|
-
impact: "medium",
|
277
|
-
effort: "low",
|
278
|
-
urgency: "low"
|
279
|
-
}
|
280
|
-
end
|
281
|
-
|
282
|
-
areas
|
283
|
-
end
|
284
|
-
|
285
|
-
def generate_low_priority_areas(code_maat_data, features)
|
286
|
-
areas = []
|
287
|
-
|
288
|
-
# Stable areas
|
289
|
-
stable_areas = @prioritizer.get_low_priority_targets.select { |t| t[:type] == "low_churn" }
|
290
|
-
if stable_areas.any?
|
291
|
-
areas << {
|
292
|
-
type: "stable_areas",
|
293
|
-
title: "Stable Areas",
|
294
|
-
description: "Low churn files that are stable and may not need immediate attention",
|
295
|
-
items: stable_areas.first(3),
|
296
|
-
impact: "low",
|
297
|
-
effort: "low",
|
298
|
-
urgency: "none"
|
299
|
-
}
|
300
|
-
end
|
301
|
-
|
302
|
-
areas
|
303
|
-
end
|
304
|
-
|
305
|
-
def generate_focus_strategies(code_maat_data, features)
|
306
|
-
strategies = []
|
307
|
-
|
308
|
-
# Risk-based strategy
|
309
|
-
strategies << {
|
310
|
-
type: "risk_based",
|
311
|
-
title: "Risk-Based Focus",
|
312
|
-
description: "Focus on areas with highest risk (knowledge silos, high churn)",
|
313
|
-
priority_order: %w[critical_risk architectural_risk coordination_risk],
|
314
|
-
rationale: "Address highest risks first to reduce project vulnerability"
|
315
|
-
}
|
316
|
-
|
317
|
-
# Impact-based strategy
|
318
|
-
strategies << {
|
319
|
-
type: "impact_based",
|
320
|
-
title: "Impact-Based Focus",
|
321
|
-
description: "Focus on areas with highest business impact",
|
322
|
-
priority_order: %w[high_impact medium_impact low_impact],
|
323
|
-
rationale: "Maximize business value by focusing on high-impact areas"
|
324
|
-
}
|
325
|
-
|
326
|
-
# Effort-based strategy
|
327
|
-
strategies << {
|
328
|
-
type: "effort_based",
|
329
|
-
title: "Effort-Based Focus",
|
330
|
-
description: "Focus on areas with lowest effort for quick wins",
|
331
|
-
priority_order: %w[low_effort medium_effort high_effort],
|
332
|
-
rationale: "Quick wins build momentum and demonstrate value quickly"
|
333
|
-
}
|
334
|
-
|
335
|
-
strategies
|
336
|
-
end
|
337
|
-
|
338
|
-
def generate_interactive_questions(code_maat_data, features)
|
339
|
-
questions = []
|
340
|
-
|
341
|
-
# Business context questions
|
342
|
-
questions << {
|
343
|
-
type: "business_context",
|
344
|
-
question: "What are the most critical business functions that must be maintained?",
|
345
|
-
purpose: "Identify business-critical areas for prioritization",
|
346
|
-
options: ["User-facing features", "Data processing", "Integration points", "Security components"]
|
347
|
-
}
|
348
|
-
|
349
|
-
# Risk tolerance questions
|
350
|
-
questions << {
|
351
|
-
type: "risk_tolerance",
|
352
|
-
question: "What is your tolerance for technical risk?",
|
353
|
-
purpose: "Determine how aggressive to be with refactoring",
|
354
|
-
options: ["Conservative - minimize risk", "Balanced - moderate risk", "Aggressive - accept higher risk"]
|
355
|
-
}
|
356
|
-
|
357
|
-
# Timeline questions
|
358
|
-
questions << {
|
359
|
-
type: "timeline",
|
360
|
-
question: "What is your timeline for addressing technical debt?",
|
361
|
-
purpose: "Determine analysis scope and depth",
|
362
|
-
options: ["Immediate - critical issues only", "Short-term - 1-3 months", "Long-term - 3-12 months"]
|
363
|
-
}
|
364
|
-
|
365
|
-
# Resource questions
|
366
|
-
questions << {
|
367
|
-
type: "resources",
|
368
|
-
question: "What resources are available for analysis and refactoring?",
|
369
|
-
purpose: "Determine analysis approach and scope",
|
370
|
-
options: ["Limited - focus on highest impact", "Moderate - balanced approach",
|
371
|
-
"Extensive - comprehensive analysis"]
|
372
|
-
}
|
373
|
-
|
374
|
-
questions
|
375
|
-
end
|
376
|
-
|
377
|
-
def display_priority_areas(priority_level, areas)
|
378
|
-
puts "\n#{priority_level} AREAS"
|
379
|
-
puts "=" * priority_level.length
|
380
|
-
|
381
|
-
if areas.empty?
|
382
|
-
puts "No #{priority_level.downcase} areas identified."
|
383
|
-
return
|
384
|
-
end
|
385
|
-
|
386
|
-
areas.each_with_index do |area, index|
|
387
|
-
puts "\n#{index + 1}. #{area[:title]}"
|
388
|
-
puts " Description: #{area[:description]}"
|
389
|
-
puts " Impact: #{area[:impact].upcase} | Effort: #{area[:effort].upcase} | Urgency: #{area[:urgency].upcase}"
|
390
|
-
|
391
|
-
next unless area[:items]&.any?
|
392
|
-
|
393
|
-
puts " Key items:"
|
394
|
-
area[:items].first(3).each do |item|
|
395
|
-
if item[:file]
|
396
|
-
puts " - #{item[:file]} (#{item[:changes]} changes)"
|
397
|
-
elsif item[:file1] && item[:file2]
|
398
|
-
puts " - #{item[:file1]} ā #{item[:file2]} (#{item[:shared_changes]} shared changes)"
|
399
|
-
end
|
400
|
-
end
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
def collect_user_selections(recommendations)
|
405
|
-
puts "\nšÆ FOCUS AREA SELECTION"
|
406
|
-
puts "======================"
|
407
|
-
|
408
|
-
selected_areas = []
|
409
|
-
|
410
|
-
# Collect high priority selections
|
411
|
-
if recommendations[:high_priority_areas].any?
|
412
|
-
puts "\nSelect HIGH PRIORITY areas to focus on (comma-separated numbers, or 'all'):"
|
413
|
-
high_selections = get_user_input
|
414
|
-
selected_areas.concat(parse_selections(high_selections, recommendations[:high_priority_areas]))
|
415
|
-
end
|
416
|
-
|
417
|
-
# Collect medium priority selections
|
418
|
-
if recommendations[:medium_priority_areas].any?
|
419
|
-
puts "\nSelect MEDIUM PRIORITY areas to focus on (comma-separated numbers, or 'all'):"
|
420
|
-
medium_selections = get_user_input
|
421
|
-
selected_areas.concat(parse_selections(medium_selections, recommendations[:medium_priority_areas]))
|
422
|
-
end
|
423
|
-
|
424
|
-
# Collect low priority selections
|
425
|
-
if recommendations[:low_priority_areas].any?
|
426
|
-
puts "\nSelect LOW PRIORITY areas to focus on (comma-separated numbers, or 'all'):"
|
427
|
-
low_selections = get_user_input
|
428
|
-
selected_areas.concat(parse_selections(low_selections, recommendations[:low_priority_areas]))
|
429
|
-
end
|
430
|
-
|
431
|
-
selected_areas
|
432
|
-
end
|
433
|
-
|
434
|
-
def get_user_input
|
435
|
-
print "> "
|
436
|
-
gets.chomp.strip
|
437
|
-
end
|
438
|
-
|
439
|
-
def parse_selections(input, areas)
|
440
|
-
return [] if input.empty? || input.casecmp("none").zero?
|
441
|
-
return areas if input.casecmp("all").zero?
|
442
|
-
|
443
|
-
selections = []
|
444
|
-
input.split(",").each do |num|
|
445
|
-
index = num.strip.to_i - 1
|
446
|
-
selections << areas[index] if index >= 0 && index < areas.length
|
447
|
-
end
|
448
|
-
|
449
|
-
selections
|
450
|
-
end
|
451
|
-
|
452
|
-
def generate_focused_plan(selected_areas, recommendations)
|
453
|
-
puts "\nš FOCUSED ANALYSIS PLAN"
|
454
|
-
puts "========================"
|
455
|
-
|
456
|
-
if selected_areas.empty?
|
457
|
-
puts "No focus areas selected. Running comprehensive analysis."
|
458
|
-
return
|
459
|
-
end
|
460
|
-
|
461
|
-
puts "\nSelected focus areas:"
|
462
|
-
selected_areas.each_with_index do |area, index|
|
463
|
-
puts "#{index + 1}. #{area[:title]} (#{area[:type]})"
|
464
|
-
end
|
465
|
-
|
466
|
-
puts "\nRecommended analysis approach:"
|
467
|
-
puts "1. Start with repository analysis for baseline"
|
468
|
-
puts "2. Focus analysis on selected areas"
|
469
|
-
puts "3. Generate targeted recommendations"
|
470
|
-
puts "4. Create action plan for each focus area"
|
471
|
-
|
472
|
-
# Save focus plan
|
473
|
-
save_focus_plan(selected_areas)
|
474
|
-
end
|
475
|
-
|
476
|
-
def save_focus_plan(selected_areas)
|
477
|
-
plan_file = File.join(@project_dir, "focus_analysis_plan.md")
|
478
|
-
|
479
|
-
plan_content = <<~PLAN
|
480
|
-
# Focus Analysis Plan
|
481
|
-
|
482
|
-
Generated on: #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}
|
483
|
-
Project: #{File.basename(@project_dir)}
|
484
|
-
|
485
|
-
## Selected Focus Areas
|
486
|
-
|
487
|
-
#{selected_areas.map.with_index { |area, i| "#{i + 1}. **#{area[:title]}** (#{area[:type]})" }.join("\n")}
|
488
|
-
|
489
|
-
## Analysis Strategy
|
490
|
-
|
491
|
-
### Phase 1: Baseline Analysis
|
492
|
-
- Repository analysis to establish current state
|
493
|
-
- Ruby-maat analysis for historical patterns
|
494
|
-
- Feature analysis for current structure
|
495
|
-
|
496
|
-
### Phase 2: Focused Analysis
|
497
|
-
#{selected_areas.map { |area| "- #{area[:title]} analysis" }.join("\n")}
|
498
|
-
|
499
|
-
### Phase 3: Recommendations
|
500
|
-
- Generate targeted recommendations for each focus area
|
501
|
-
- Create action plan with priorities and timelines
|
502
|
-
- Define success metrics for each area
|
503
|
-
|
504
|
-
## Next Steps
|
505
|
-
|
506
|
-
1. Run `aidp analyze repository` to establish baseline
|
507
|
-
2. Run focused analysis on selected areas
|
508
|
-
3. Review and approve analysis results
|
509
|
-
4. Implement recommended improvements
|
510
|
-
PLAN
|
511
|
-
|
512
|
-
File.write(plan_file, plan_content)
|
513
|
-
puts "\nFocus plan saved to: #{plan_file}"
|
514
|
-
end
|
515
|
-
end
|
516
|
-
end
|
517
|
-
end
|