This commit is contained in:
2026-05-08 23:46:17 +10:00
commit 10c8cfaa0f
71 changed files with 2139 additions and 0 deletions
View File
@@ -0,0 +1,7 @@
# Infrastructure Review Crew Agents Configuration
infra_reviewer:
role: DevOps/Platform Engineer
goal: Review infrastructure as code for correctness, security, and best practices
backstory: You are an experienced DevOps engineer with expertise in infrastructure as code, Kubernetes, Docker, and cloud platforms. You help teams ensure their infrastructure is secure, scalable, and follows best practices.
verbose: true
allow_delegation: false
+16
View File
@@ -0,0 +1,16 @@
# Infrastructure Review Crew Tasks Configuration
infra_review_task:
description: |
Review the infrastructure as code (IaC) in the pull request for correctness, security, and best practices.
PR Title: {pr_title}
PR Description: {pr_description}
Files to review: {files}
Context: {context}
expected_output: |
A detailed infrastructure review report including:
- Summary of infrastructure changes
- Issues found (misconfigurations, security vulnerabilities, etc.)
- Best practices violations (if any)
- Suggestions for improvement
- Overall rating (e.g., Approved, Needs Changes)
agent: infra_reviewer
@@ -0,0 +1,65 @@
from crewai import CrewBase, Agent, Task, Crew
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters
import os
from typing import Dict, Any
class InfraReviewCrew(CrewBase):
"""Infrastructure Review Crew for conducting infrastructure reviews."""
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
def __init__(self):
super().__init__()
# Configure Hadolint MCP server connection
self.hadolint_server_params = StdioServerParameters(
command="python",
args=["/home/armistace/dev/pr_reviewer/mcp_servers/hadolint_mcp.py"],
env=os.environ
)
# Configure Checkov MCP server connection
self.checkov_server_params = StdioServerParameters(
command="python",
args=["/home/armistace/dev/pr_reviewer/mcp_servers/checkov_mcp.py"],
env=os.environ
)
@Agent
def infra_reviewer(self) -> Agent:
"""DevOps/Platform Engineer agent for infrastructure review."""
return Agent(
config=self.agents_config["infra_reviewer"],
tools=[], # Tools will be added via MCP adapter in the task
verbose=True
)
@Task
def infra_review_task(self) -> Task:
"""Task for conducting infrastructure review."""
return Task(
config=self.tasks_config["infra_review_task"],
)
@Crew
def crew(self) -> Crew:
"""Create the Infrastructure Review crew."""
# Create MCP server adapters for Hadolint and Checkov
hadolint_adapter = MCPServerAdapter(self.hadolint_server_params)
checkov_adapter = MCPServerAdapter(self.checkov_server_params)
# Combine tools from both adapters
all_tools = []
if hasattr(hadolint_adapter, 'tools'):
all_tools.extend(hadolint_adapter.tools)
if hasattr(checkov_adapter, 'tools'):
all_tools.extend(checkov_adapter.tools)
return Crew(
agents=[self.infra_reviewer()],
tasks=[self.infra_review_task()],
process="sequential",
verbose=True,
tools=all_tools,
)