mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
BIG REFACTORING: Making everything scalable, maintanable, modularized, code quality, separation of concerns, etc.
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
"""
|
||||
Documenter Agent Factories
|
||||
|
||||
Factory functions for creating documenter agents for each team.
|
||||
"""
|
||||
|
||||
from roboco.agents.documenter import DocumenterAgent
|
||||
from roboco.agents.factories._base import load_blueprint_prompt, make_slug
|
||||
from roboco.models import AgentRole, Team
|
||||
from roboco.models.agents import AgentConfig
|
||||
|
||||
# Blueprint paths for each team
|
||||
_BLUEPRINTS = {
|
||||
Team.BACKEND: "agents/blueprints/backend/be-documenter.md",
|
||||
Team.FRONTEND: "agents/blueprints/frontend/fe-documenter.md",
|
||||
Team.UX_UI: "agents/blueprints/ux_ui/ux-documenter.md",
|
||||
}
|
||||
|
||||
# Default prompts for each team
|
||||
_DEFAULT_PROMPTS = {
|
||||
Team.BACKEND: "You are a backend documenter.",
|
||||
Team.FRONTEND: "You are a frontend documenter.",
|
||||
Team.UX_UI: "You are a UX/UI documenter.",
|
||||
}
|
||||
|
||||
# Default capabilities for each team
|
||||
_CAPABILITIES = {
|
||||
Team.BACKEND: ["documentation", "file_management"],
|
||||
Team.FRONTEND: ["documentation", "storybook", "file_management"],
|
||||
Team.UX_UI: ["documentation", "design_system_docs"],
|
||||
}
|
||||
|
||||
|
||||
def _create_documenter(
|
||||
name: str,
|
||||
team: Team,
|
||||
system_prompt: str | None = None,
|
||||
) -> DocumenterAgent:
|
||||
"""
|
||||
Internal factory for creating a documenter agent.
|
||||
|
||||
Args:
|
||||
name: Agent display name
|
||||
team: Team assignment
|
||||
system_prompt: Optional custom system prompt
|
||||
|
||||
Returns:
|
||||
Configured DocumenterAgent instance
|
||||
"""
|
||||
if system_prompt is None:
|
||||
system_prompt = load_blueprint_prompt(
|
||||
_BLUEPRINTS[team],
|
||||
_DEFAULT_PROMPTS[team],
|
||||
)
|
||||
|
||||
config = AgentConfig(
|
||||
name=name,
|
||||
slug=make_slug(name),
|
||||
role=AgentRole.DOCUMENTER,
|
||||
team=team,
|
||||
system_prompt=system_prompt,
|
||||
capabilities=_CAPABILITIES[team],
|
||||
)
|
||||
|
||||
return DocumenterAgent(config)
|
||||
|
||||
|
||||
def create_backend_documenter(
|
||||
name: str = "BE-Documenter",
|
||||
system_prompt: str | None = None,
|
||||
) -> DocumenterAgent:
|
||||
"""Factory function to create a backend documenter agent."""
|
||||
return _create_documenter(name, Team.BACKEND, system_prompt)
|
||||
|
||||
|
||||
def create_frontend_documenter(
|
||||
name: str = "FE-Documenter",
|
||||
system_prompt: str | None = None,
|
||||
) -> DocumenterAgent:
|
||||
"""Factory function to create a frontend documenter agent."""
|
||||
return _create_documenter(name, Team.FRONTEND, system_prompt)
|
||||
|
||||
|
||||
def create_ux_documenter(
|
||||
name: str = "UX-Documenter",
|
||||
system_prompt: str | None = None,
|
||||
) -> DocumenterAgent:
|
||||
"""Factory function to create a UX/UI documenter agent."""
|
||||
return _create_documenter(name, Team.UX_UI, system_prompt)
|
||||
Reference in New Issue
Block a user