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,577 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "fileutils"
|
4
|
-
|
5
|
-
module Aidp
|
6
|
-
class StaticAnalysisDetector
|
7
|
-
# Define static analysis tools by language/framework
|
8
|
-
STATIC_ANALYSIS_TOOLS = {
|
9
|
-
"ruby" => {
|
10
|
-
"rubocop" => {
|
11
|
-
name: "RuboCop",
|
12
|
-
description: "Ruby static code analyzer and formatter",
|
13
|
-
config_files: [".rubocop.yml", ".rubocop.yaml", ".rubocop.json"],
|
14
|
-
gem_name: "rubocop",
|
15
|
-
command: "bundle exec rubocop",
|
16
|
-
categories: %w[style quality],
|
17
|
-
priority: "high"
|
18
|
-
},
|
19
|
-
"reek" => {
|
20
|
-
name: "Reek",
|
21
|
-
description: "Code smell detector for Ruby",
|
22
|
-
config_files: [".reek.yml", ".reek.yaml"],
|
23
|
-
gem_name: "reek",
|
24
|
-
command: "bundle exec reek",
|
25
|
-
categories: %w[quality smells],
|
26
|
-
priority: "medium"
|
27
|
-
},
|
28
|
-
"brakeman" => {
|
29
|
-
name: "Brakeman",
|
30
|
-
description: "Security vulnerability scanner for Ruby on Rails",
|
31
|
-
config_files: ["config/brakeman.yml"],
|
32
|
-
gem_name: "brakeman",
|
33
|
-
command: "bundle exec brakeman",
|
34
|
-
categories: %w[security],
|
35
|
-
priority: "high"
|
36
|
-
},
|
37
|
-
"bundler-audit" => {
|
38
|
-
name: "Bundler Audit",
|
39
|
-
description: "Security vulnerability scanner for Ruby gems",
|
40
|
-
gem_name: "bundler-audit",
|
41
|
-
command: "bundle exec bundle-audit",
|
42
|
-
categories: %w[security],
|
43
|
-
priority: "high"
|
44
|
-
},
|
45
|
-
"fasterer" => {
|
46
|
-
name: "Fasterer",
|
47
|
-
description: "Performance optimization suggestions for Ruby",
|
48
|
-
gem_name: "fasterer",
|
49
|
-
command: "bundle exec fasterer",
|
50
|
-
categories: %w[performance],
|
51
|
-
priority: "medium"
|
52
|
-
}
|
53
|
-
},
|
54
|
-
"javascript" => {
|
55
|
-
"eslint" => {
|
56
|
-
name: "ESLint",
|
57
|
-
description: "JavaScript linting utility",
|
58
|
-
config_files: [".eslintrc.js", ".eslintrc.json", ".eslintrc.yml", ".eslintrc.yaml"],
|
59
|
-
package_name: "eslint",
|
60
|
-
command: "npx eslint",
|
61
|
-
categories: %w[style quality],
|
62
|
-
priority: "high"
|
63
|
-
},
|
64
|
-
"prettier" => {
|
65
|
-
name: "Prettier",
|
66
|
-
description: "Code formatter for JavaScript",
|
67
|
-
config_files: [".prettierrc", ".prettierrc.js", ".prettierrc.json"],
|
68
|
-
package_name: "prettier",
|
69
|
-
command: "npx prettier --check",
|
70
|
-
categories: %w[style],
|
71
|
-
priority: "medium"
|
72
|
-
},
|
73
|
-
"sonarqube" => {
|
74
|
-
name: "SonarQube",
|
75
|
-
description: "Code quality and security analysis platform",
|
76
|
-
config_files: ["sonar-project.properties"],
|
77
|
-
categories: %w[quality security],
|
78
|
-
priority: "high"
|
79
|
-
}
|
80
|
-
},
|
81
|
-
"python" => {
|
82
|
-
"flake8" => {
|
83
|
-
name: "Flake8",
|
84
|
-
description: "Python linting utility",
|
85
|
-
config_files: [".flake8", "setup.cfg", "tox.ini"],
|
86
|
-
package_name: "flake8",
|
87
|
-
command: "flake8",
|
88
|
-
categories: %w[style quality],
|
89
|
-
priority: "high"
|
90
|
-
},
|
91
|
-
"pylint" => {
|
92
|
-
name: "Pylint",
|
93
|
-
description: "Python code analysis tool",
|
94
|
-
config_files: [".pylintrc", "pylintrc"],
|
95
|
-
package_name: "pylint",
|
96
|
-
command: "pylint",
|
97
|
-
categories: %w[quality],
|
98
|
-
priority: "medium"
|
99
|
-
},
|
100
|
-
"bandit" => {
|
101
|
-
name: "Bandit",
|
102
|
-
description: "Security linter for Python",
|
103
|
-
config_files: [".bandit"],
|
104
|
-
package_name: "bandit",
|
105
|
-
command: "bandit",
|
106
|
-
categories: %w[security],
|
107
|
-
priority: "high"
|
108
|
-
}
|
109
|
-
},
|
110
|
-
"java" => {
|
111
|
-
"checkstyle" => {
|
112
|
-
name: "Checkstyle",
|
113
|
-
description: "Java code style checker",
|
114
|
-
config_files: ["checkstyle.xml", "config/checkstyle.xml"],
|
115
|
-
categories: %w[style],
|
116
|
-
priority: "medium"
|
117
|
-
},
|
118
|
-
"pmd" => {
|
119
|
-
name: "PMD",
|
120
|
-
description: "Java static code analyzer",
|
121
|
-
config_files: ["pmd.xml", "config/pmd.xml"],
|
122
|
-
categories: %w[quality],
|
123
|
-
priority: "medium"
|
124
|
-
},
|
125
|
-
"spotbugs" => {
|
126
|
-
name: "SpotBugs",
|
127
|
-
description: "Java bug finder",
|
128
|
-
categories: %w[quality bugs],
|
129
|
-
priority: "high"
|
130
|
-
}
|
131
|
-
},
|
132
|
-
"go" => {
|
133
|
-
"golangci-lint" => {
|
134
|
-
name: "golangci-lint",
|
135
|
-
description: "Fast Go linters runner",
|
136
|
-
config_files: [".golangci.yml", ".golangci.yaml"],
|
137
|
-
categories: %w[style quality],
|
138
|
-
priority: "high"
|
139
|
-
},
|
140
|
-
"gosec" => {
|
141
|
-
name: "Gosec",
|
142
|
-
description: "Go security linter",
|
143
|
-
categories: %w[security],
|
144
|
-
priority: "high"
|
145
|
-
}
|
146
|
-
},
|
147
|
-
"rust" => {
|
148
|
-
"clippy" => {
|
149
|
-
name: "Clippy",
|
150
|
-
description: "Rust linter",
|
151
|
-
command: "cargo clippy",
|
152
|
-
categories: %w[style quality],
|
153
|
-
priority: "high"
|
154
|
-
},
|
155
|
-
"cargo-audit" => {
|
156
|
-
name: "Cargo Audit",
|
157
|
-
description: "Rust security vulnerability scanner",
|
158
|
-
command: "cargo audit",
|
159
|
-
categories: %w[security],
|
160
|
-
priority: "high"
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}.freeze
|
164
|
-
|
165
|
-
def initialize(project_dir = Dir.pwd)
|
166
|
-
@project_dir = project_dir
|
167
|
-
end
|
168
|
-
|
169
|
-
# Detect all static analysis tools in the project
|
170
|
-
def detect_static_analysis_tools
|
171
|
-
project_type = detect_project_type
|
172
|
-
language = project_type[:language]
|
173
|
-
|
174
|
-
{
|
175
|
-
installed: detect_installed_tools(language),
|
176
|
-
configured: detect_configured_tools(language),
|
177
|
-
missing: detect_missing_tools(language),
|
178
|
-
recommendations: generate_tool_recommendations(language)
|
179
|
-
}
|
180
|
-
end
|
181
|
-
|
182
|
-
# Detect tools that are installed and available
|
183
|
-
def detect_installed_tools(language)
|
184
|
-
installed_tools = []
|
185
|
-
|
186
|
-
tools = STATIC_ANALYSIS_TOOLS[language] || {}
|
187
|
-
tools.each do |tool_id, tool_info|
|
188
|
-
next unless tool_installed?(tool_id, tool_info)
|
189
|
-
|
190
|
-
installed_tools << {
|
191
|
-
id: tool_id,
|
192
|
-
name: tool_info[:name],
|
193
|
-
description: tool_info[:description],
|
194
|
-
command: tool_info[:command],
|
195
|
-
categories: tool_info[:categories],
|
196
|
-
priority: tool_info[:priority],
|
197
|
-
status: "installed"
|
198
|
-
}
|
199
|
-
end
|
200
|
-
|
201
|
-
installed_tools
|
202
|
-
end
|
203
|
-
|
204
|
-
# Detect tools that have configuration files but may not be installed
|
205
|
-
def detect_configured_tools(language)
|
206
|
-
configured_tools = []
|
207
|
-
|
208
|
-
tools = STATIC_ANALYSIS_TOOLS[language] || {}
|
209
|
-
tools.each do |tool_id, tool_info|
|
210
|
-
next unless tool_configured?(tool_id, tool_info)
|
211
|
-
|
212
|
-
configured_tools << {
|
213
|
-
id: tool_id,
|
214
|
-
name: tool_info[:name],
|
215
|
-
description: tool_info[:description],
|
216
|
-
config_files: tool_info[:config_files],
|
217
|
-
categories: tool_info[:categories],
|
218
|
-
priority: tool_info[:priority],
|
219
|
-
status: "configured"
|
220
|
-
}
|
221
|
-
end
|
222
|
-
|
223
|
-
configured_tools
|
224
|
-
end
|
225
|
-
|
226
|
-
# Detect missing tools that should be installed
|
227
|
-
def detect_missing_tools(language)
|
228
|
-
missing_tools = []
|
229
|
-
|
230
|
-
tools = STATIC_ANALYSIS_TOOLS[language] || {}
|
231
|
-
tools.each do |tool_id, tool_info|
|
232
|
-
next if tool_installed?(tool_id, tool_info) || tool_configured?(tool_id, tool_info)
|
233
|
-
|
234
|
-
missing_tools << {
|
235
|
-
id: tool_id,
|
236
|
-
name: tool_info[:name],
|
237
|
-
description: tool_info[:description],
|
238
|
-
categories: tool_info[:categories],
|
239
|
-
priority: tool_info[:priority],
|
240
|
-
status: "missing"
|
241
|
-
}
|
242
|
-
end
|
243
|
-
|
244
|
-
missing_tools
|
245
|
-
end
|
246
|
-
|
247
|
-
# Generate recommendations for tool installation
|
248
|
-
def generate_tool_recommendations(language)
|
249
|
-
recommendations = []
|
250
|
-
|
251
|
-
# Get missing high-priority tools
|
252
|
-
missing_tools = detect_missing_tools(language)
|
253
|
-
high_priority_missing = missing_tools.select { |tool| tool[:priority] == "high" }
|
254
|
-
|
255
|
-
high_priority_missing.each do |tool|
|
256
|
-
recommendation = generate_installation_recommendation(tool, language)
|
257
|
-
recommendations << recommendation if recommendation
|
258
|
-
end
|
259
|
-
|
260
|
-
# Add general recommendations
|
261
|
-
recommendations.concat(generate_general_recommendations(language))
|
262
|
-
|
263
|
-
recommendations
|
264
|
-
end
|
265
|
-
|
266
|
-
# Check if a tool is installed and available
|
267
|
-
def tool_installed?(tool_id, tool_info)
|
268
|
-
case tool_info[:command]
|
269
|
-
when /^bundle exec/
|
270
|
-
# Ruby tool - check if gem is available
|
271
|
-
gem_name = tool_info[:gem_name]
|
272
|
-
return false unless gem_name
|
273
|
-
|
274
|
-
# Check if gem is in Gemfile
|
275
|
-
gemfile_path = File.join(@project_dir, "Gemfile")
|
276
|
-
return false unless File.exist?(gemfile_path)
|
277
|
-
|
278
|
-
gemfile_content = File.read(gemfile_path)
|
279
|
-
gemfile_content.include?("gem '#{gem_name}'") || gemfile_content.include?("gem \"#{gem_name}\"")
|
280
|
-
when /^npx/
|
281
|
-
# Node.js tool - check if package is available
|
282
|
-
package_name = tool_info[:package_name]
|
283
|
-
return false unless package_name
|
284
|
-
|
285
|
-
package_json_path = File.join(@project_dir, "package.json")
|
286
|
-
return false unless File.exist?(package_json_path)
|
287
|
-
|
288
|
-
package_json_content = File.read(package_json_path)
|
289
|
-
package_json_content.include?("\"#{package_name}\"")
|
290
|
-
when /^cargo/
|
291
|
-
# Rust tool - check if cargo is available
|
292
|
-
system("cargo", "--version", out: File::NULL, err: File::NULL)
|
293
|
-
else
|
294
|
-
# Generic tool - check if command is available
|
295
|
-
command = tool_info[:command]&.split(" ")&.first
|
296
|
-
return false unless command
|
297
|
-
|
298
|
-
system("which", command, out: File::NULL, err: File::NULL)
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
# Check if a tool has configuration files
|
303
|
-
def tool_configured?(tool_id, tool_info)
|
304
|
-
config_files = tool_info[:config_files] || []
|
305
|
-
return false if config_files.empty?
|
306
|
-
|
307
|
-
config_files.any? do |config_file|
|
308
|
-
File.exist?(File.join(@project_dir, config_file))
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
# Detect the primary language/framework of the project
|
313
|
-
def detect_project_type
|
314
|
-
# Check for Ruby project
|
315
|
-
if File.exist?(File.join(@project_dir, "Gemfile"))
|
316
|
-
return {language: "ruby", framework: "rails"} if File.exist?(File.join(@project_dir, "config",
|
317
|
-
"application.rb"))
|
318
|
-
return {language: "ruby", framework: "sinatra"} if File.exist?(File.join(@project_dir, "app.rb"))
|
319
|
-
return {language: "ruby", framework: "gem"} if File.exist?(File.join(@project_dir, "*.gemspec"))
|
320
|
-
|
321
|
-
return {language: "ruby", framework: "unknown"}
|
322
|
-
end
|
323
|
-
|
324
|
-
# Check for JavaScript/Node.js project
|
325
|
-
if File.exist?(File.join(@project_dir, "package.json"))
|
326
|
-
package_json = JSON.parse(File.read(File.join(@project_dir, "package.json")))
|
327
|
-
dependencies = package_json["dependencies"] || {}
|
328
|
-
dev_dependencies = package_json["devDependencies"] || {}
|
329
|
-
|
330
|
-
if dependencies["react"] || dev_dependencies["react"]
|
331
|
-
return {language: "javascript", framework: "react"}
|
332
|
-
elsif dependencies["vue"] || dev_dependencies["vue"]
|
333
|
-
return {language: "javascript", framework: "vue"}
|
334
|
-
elsif dependencies["angular"] || dev_dependencies["angular"]
|
335
|
-
return {language: "javascript", framework: "angular"}
|
336
|
-
else
|
337
|
-
return {language: "javascript", framework: "node"}
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
# Check for Python project
|
342
|
-
if File.exist?(File.join(@project_dir, "requirements.txt")) || File.exist?(File.join(@project_dir, "setup.py"))
|
343
|
-
return {language: "python", framework: "unknown"}
|
344
|
-
end
|
345
|
-
|
346
|
-
# Check for Java project
|
347
|
-
if File.exist?(File.join(@project_dir, "pom.xml")) || File.exist?(File.join(@project_dir, "build.gradle"))
|
348
|
-
return {language: "java", framework: "unknown"}
|
349
|
-
end
|
350
|
-
|
351
|
-
# Check for Go project
|
352
|
-
return {language: "go", framework: "unknown"} if File.exist?(File.join(@project_dir, "go.mod"))
|
353
|
-
|
354
|
-
# Check for Rust project
|
355
|
-
return {language: "rust", framework: "unknown"} if File.exist?(File.join(@project_dir, "Cargo.toml"))
|
356
|
-
|
357
|
-
# Default to unknown
|
358
|
-
{language: "unknown", framework: "unknown"}
|
359
|
-
end
|
360
|
-
|
361
|
-
# Generate installation recommendation for a specific tool
|
362
|
-
def generate_installation_recommendation(tool, language)
|
363
|
-
case language
|
364
|
-
when "ruby"
|
365
|
-
generate_ruby_installation_recommendation(tool)
|
366
|
-
when "javascript"
|
367
|
-
generate_javascript_installation_recommendation(tool)
|
368
|
-
when "python"
|
369
|
-
generate_python_installation_recommendation(tool)
|
370
|
-
when "java"
|
371
|
-
generate_java_installation_recommendation(tool)
|
372
|
-
when "go"
|
373
|
-
generate_go_installation_recommendation(tool)
|
374
|
-
when "rust"
|
375
|
-
generate_rust_installation_recommendation(tool)
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
# Generate general recommendations for the language
|
380
|
-
def generate_general_recommendations(language)
|
381
|
-
recommendations = []
|
382
|
-
|
383
|
-
case language
|
384
|
-
when "ruby"
|
385
|
-
recommendations << {
|
386
|
-
type: "general",
|
387
|
-
title: "Ruby Static Analysis Setup",
|
388
|
-
description: "Consider setting up a comprehensive Ruby static analysis pipeline",
|
389
|
-
steps: [
|
390
|
-
"Add RuboCop for code style and quality",
|
391
|
-
"Add Brakeman for security scanning",
|
392
|
-
"Add Bundler Audit for dependency security",
|
393
|
-
"Configure tools in CI/CD pipeline"
|
394
|
-
],
|
395
|
-
priority: "high"
|
396
|
-
}
|
397
|
-
when "javascript"
|
398
|
-
recommendations << {
|
399
|
-
type: "general",
|
400
|
-
title: "JavaScript Static Analysis Setup",
|
401
|
-
description: "Consider setting up a comprehensive JavaScript static analysis pipeline",
|
402
|
-
steps: [
|
403
|
-
"Add ESLint for code quality",
|
404
|
-
"Add Prettier for code formatting",
|
405
|
-
"Add security scanning tools",
|
406
|
-
"Configure tools in CI/CD pipeline"
|
407
|
-
],
|
408
|
-
priority: "high"
|
409
|
-
}
|
410
|
-
end
|
411
|
-
|
412
|
-
recommendations
|
413
|
-
end
|
414
|
-
|
415
|
-
private
|
416
|
-
|
417
|
-
def generate_ruby_installation_recommendation(tool)
|
418
|
-
case tool[:id]
|
419
|
-
when "rubocop"
|
420
|
-
{
|
421
|
-
type: "installation",
|
422
|
-
tool: tool[:name],
|
423
|
-
description: "Install RuboCop for Ruby code analysis",
|
424
|
-
steps: [
|
425
|
-
"Add 'gem \"rubocop\"' to Gemfile",
|
426
|
-
"Run bundle install",
|
427
|
-
"Initialize configuration: bundle exec rubocop --auto-gen-config",
|
428
|
-
"Run analysis: bundle exec rubocop"
|
429
|
-
],
|
430
|
-
priority: tool[:priority]
|
431
|
-
}
|
432
|
-
when "brakeman"
|
433
|
-
{
|
434
|
-
type: "installation",
|
435
|
-
tool: tool[:name],
|
436
|
-
description: "Install Brakeman for Rails security scanning",
|
437
|
-
steps: [
|
438
|
-
"Add 'gem \"brakeman\"' to Gemfile",
|
439
|
-
"Run bundle install",
|
440
|
-
"Run security scan: bundle exec brakeman"
|
441
|
-
],
|
442
|
-
priority: tool[:priority]
|
443
|
-
}
|
444
|
-
when "bundler-audit"
|
445
|
-
{
|
446
|
-
type: "installation",
|
447
|
-
tool: tool[:name],
|
448
|
-
description: "Install Bundler Audit for gem security scanning",
|
449
|
-
steps: [
|
450
|
-
"Add 'gem \"bundler-audit\"' to Gemfile",
|
451
|
-
"Run bundle install",
|
452
|
-
"Run security audit: bundle exec bundle-audit"
|
453
|
-
],
|
454
|
-
priority: tool[:priority]
|
455
|
-
}
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
def generate_javascript_installation_recommendation(tool)
|
460
|
-
case tool[:id]
|
461
|
-
when "eslint"
|
462
|
-
{
|
463
|
-
type: "installation",
|
464
|
-
tool: tool[:name],
|
465
|
-
description: "Install ESLint for JavaScript linting",
|
466
|
-
steps: [
|
467
|
-
"npm install --save-dev eslint",
|
468
|
-
"npx eslint --init",
|
469
|
-
"Run linting: npx eslint ."
|
470
|
-
],
|
471
|
-
priority: tool[:priority]
|
472
|
-
}
|
473
|
-
when "prettier"
|
474
|
-
{
|
475
|
-
type: "installation",
|
476
|
-
tool: tool[:name],
|
477
|
-
description: "Install Prettier for JavaScript formatting",
|
478
|
-
steps: [
|
479
|
-
"npm install --save-dev prettier",
|
480
|
-
"Create .prettierrc configuration",
|
481
|
-
"Run formatting: npx prettier --write ."
|
482
|
-
],
|
483
|
-
priority: tool[:priority]
|
484
|
-
}
|
485
|
-
end
|
486
|
-
end
|
487
|
-
|
488
|
-
def generate_python_installation_recommendation(tool)
|
489
|
-
case tool[:id]
|
490
|
-
when "flake8"
|
491
|
-
{
|
492
|
-
type: "installation",
|
493
|
-
tool: tool[:name],
|
494
|
-
description: "Install Flake8 for Python linting",
|
495
|
-
steps: [
|
496
|
-
"pip install flake8",
|
497
|
-
"Create .flake8 configuration",
|
498
|
-
"Run linting: flake8 ."
|
499
|
-
],
|
500
|
-
priority: tool[:priority]
|
501
|
-
}
|
502
|
-
when "bandit"
|
503
|
-
{
|
504
|
-
type: "installation",
|
505
|
-
tool: tool[:name],
|
506
|
-
description: "Install Bandit for Python security scanning",
|
507
|
-
steps: [
|
508
|
-
"pip install bandit",
|
509
|
-
"Run security scan: bandit -r ."
|
510
|
-
],
|
511
|
-
priority: tool[:priority]
|
512
|
-
}
|
513
|
-
end
|
514
|
-
end
|
515
|
-
|
516
|
-
def generate_java_installation_recommendation(tool)
|
517
|
-
case tool[:id]
|
518
|
-
when "checkstyle"
|
519
|
-
{
|
520
|
-
type: "installation",
|
521
|
-
tool: tool[:name],
|
522
|
-
description: "Install Checkstyle for Java code style checking",
|
523
|
-
steps: [
|
524
|
-
"Download Checkstyle JAR",
|
525
|
-
"Create checkstyle.xml configuration",
|
526
|
-
"Run analysis: java -jar checkstyle.jar -c checkstyle.xml src/"
|
527
|
-
],
|
528
|
-
priority: tool[:priority]
|
529
|
-
}
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
def generate_go_installation_recommendation(tool)
|
534
|
-
case tool[:id]
|
535
|
-
when "golangci-lint"
|
536
|
-
{
|
537
|
-
type: "installation",
|
538
|
-
tool: tool[:name],
|
539
|
-
description: "Install golangci-lint for Go linting",
|
540
|
-
steps: [
|
541
|
-
"go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest",
|
542
|
-
"Create .golangci.yml configuration",
|
543
|
-
"Run linting: golangci-lint run"
|
544
|
-
],
|
545
|
-
priority: tool[:priority]
|
546
|
-
}
|
547
|
-
end
|
548
|
-
end
|
549
|
-
|
550
|
-
def generate_rust_installation_recommendation(tool)
|
551
|
-
case tool[:id]
|
552
|
-
when "clippy"
|
553
|
-
{
|
554
|
-
type: "installation",
|
555
|
-
tool: tool[:name],
|
556
|
-
description: "Clippy is included with Rust toolchain",
|
557
|
-
steps: [
|
558
|
-
"Run linting: cargo clippy",
|
559
|
-
"Run with warnings as errors: cargo clippy -- -D warnings"
|
560
|
-
],
|
561
|
-
priority: tool[:priority]
|
562
|
-
}
|
563
|
-
when "cargo-audit"
|
564
|
-
{
|
565
|
-
type: "installation",
|
566
|
-
tool: tool[:name],
|
567
|
-
description: "Install cargo-audit for Rust security scanning",
|
568
|
-
steps: [
|
569
|
-
"cargo install cargo-audit",
|
570
|
-
"Run security audit: cargo audit"
|
571
|
-
],
|
572
|
-
priority: tool[:priority]
|
573
|
-
}
|
574
|
-
end
|
575
|
-
end
|
576
|
-
end
|
577
|
-
end
|