Fix linting violations for v1.0.0 release preparation
- Apply black formatting to all Python files - Fix various flake8 violations in agent system code - Clean up imports and whitespace issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from enum import Enum
|
||||
|
||||
class AgentCategory(Enum):
|
||||
"""Categories of agents for organization."""
|
||||
|
||||
PROJECT_MANAGEMENT = "project-management"
|
||||
DEVELOPMENT_PROCESS = "development-process"
|
||||
CODE_QUALITY = "code-quality"
|
||||
@@ -21,6 +22,7 @@ class AgentCategory(Enum):
|
||||
@dataclass
|
||||
class AgentDefinition:
|
||||
"""Represents an agent definition with metadata."""
|
||||
|
||||
name: str
|
||||
description: str
|
||||
file_path: Path
|
||||
@@ -31,11 +33,11 @@ class AgentDefinition:
|
||||
@classmethod
|
||||
def from_file(cls, file_path: Path) -> "AgentDefinition":
|
||||
"""Create AgentDefinition from a markdown file."""
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Extract YAML frontmatter
|
||||
frontmatter_match = re.match(r'^---\n(.*?)\n---\n', content, re.DOTALL)
|
||||
frontmatter_match = re.match(r"^---\n(.*?)\n---\n", content, re.DOTALL)
|
||||
if not frontmatter_match:
|
||||
raise ValueError(f"No YAML frontmatter found in {file_path}")
|
||||
|
||||
@@ -45,15 +47,15 @@ class AgentDefinition:
|
||||
dependencies = cls._extract_dependencies(content, frontmatter)
|
||||
|
||||
# Determine category from name or content
|
||||
category = cls._determine_category(frontmatter['name'], content)
|
||||
category = cls._determine_category(frontmatter["name"], content)
|
||||
|
||||
return cls(
|
||||
name=frontmatter['name'],
|
||||
description=frontmatter['description'],
|
||||
name=frontmatter["name"],
|
||||
description=frontmatter["description"],
|
||||
file_path=file_path,
|
||||
category=category,
|
||||
dependencies=dependencies,
|
||||
model=frontmatter.get('model')
|
||||
model=frontmatter.get("model"),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@@ -62,42 +64,42 @@ class AgentDefinition:
|
||||
dependencies = set()
|
||||
|
||||
# Check frontmatter for explicit dependencies
|
||||
for key in ['dependencies', 'depends_on', 'requires']:
|
||||
for key in ["dependencies", "depends_on", "requires"]:
|
||||
if key in frontmatter:
|
||||
deps = frontmatter[key]
|
||||
if isinstance(deps, list):
|
||||
dependencies.update(deps)
|
||||
elif isinstance(deps, str):
|
||||
# Handle comma-separated string
|
||||
dependencies.update([d.strip() for d in deps.split(',')])
|
||||
dependencies.update([d.strip() for d in deps.split(",")])
|
||||
|
||||
# Look for explicit dependencies in content
|
||||
dep_patterns = [
|
||||
r'depends_on:\s*\[(.*?)\]',
|
||||
r'requires:\s*\[(.*?)\]',
|
||||
r'dependencies:\s*\[(.*?)\]',
|
||||
r"depends_on:\s*\[(.*?)\]",
|
||||
r"requires:\s*\[(.*?)\]",
|
||||
r"dependencies:\s*\[(.*?)\]",
|
||||
]
|
||||
|
||||
for pattern in dep_patterns:
|
||||
matches = re.findall(pattern, content, re.IGNORECASE)
|
||||
for match in matches:
|
||||
if isinstance(match, str):
|
||||
deps = [d.strip().strip('"\'') for d in match.split(',')]
|
||||
deps = [d.strip().strip("\"'") for d in match.split(",")]
|
||||
dependencies.update(deps)
|
||||
|
||||
# Look for specific agent references in content (more precise)
|
||||
# Only look for full agent names like "todo-keeper agent" or "uses changelog-keeper"
|
||||
agent_patterns = [
|
||||
r'uses?\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))',
|
||||
r'depends?\s+on\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))',
|
||||
r'requires?\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))',
|
||||
r"uses?\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))",
|
||||
r"depends?\s+on\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))",
|
||||
r"requires?\s+(\w+(?:-\w+)*-(?:keeper|agent|workflow|helper|manager))",
|
||||
]
|
||||
|
||||
for pattern in agent_patterns:
|
||||
matches = re.findall(pattern, content.lower())
|
||||
for match in matches:
|
||||
if match not in ['optimization', 'agentic', 'driven', 'assisted']:
|
||||
dependencies.add(match.replace('-', '_'))
|
||||
if match not in ["optimization", "agentic", "driven", "assisted"]:
|
||||
dependencies.add(match.replace("-", "_"))
|
||||
|
||||
return dependencies
|
||||
|
||||
@@ -107,28 +109,33 @@ class AgentDefinition:
|
||||
name_lower = name.lower()
|
||||
|
||||
# Project management agents
|
||||
project_keywords = ['todo', 'changelog', 'contributing', 'project']
|
||||
project_keywords = ["todo", "changelog", "contributing", "project"]
|
||||
if any(keyword in name_lower for keyword in project_keywords):
|
||||
return AgentCategory.PROJECT_MANAGEMENT
|
||||
|
||||
# Testing agents
|
||||
if any(keyword in name_lower for keyword in ['test', 'tdd']):
|
||||
if any(keyword in name_lower for keyword in ["test", "tdd"]):
|
||||
return AgentCategory.TESTING
|
||||
|
||||
# Code quality agents
|
||||
if any(keyword in name_lower for keyword in ['refactor', 'optimization', 'code']):
|
||||
if any(
|
||||
keyword in name_lower for keyword in ["refactor", "optimization", "code"]
|
||||
):
|
||||
return AgentCategory.CODE_QUALITY
|
||||
|
||||
# Documentation agents
|
||||
if any(keyword in name_lower for keyword in ['documentation', 'claude']):
|
||||
if any(keyword in name_lower for keyword in ["documentation", "claude"]):
|
||||
return AgentCategory.DOCUMENTATION
|
||||
|
||||
# Infrastructure agents
|
||||
if any(keyword in name_lower for keyword in ['setup', 'repository', 'tooling']):
|
||||
if any(keyword in name_lower for keyword in ["setup", "repository", "tooling"]):
|
||||
return AgentCategory.INFRASTRUCTURE
|
||||
|
||||
# Development process agents
|
||||
if any(keyword in name_lower for keyword in ['workflow', 'requirements', 'maintenance']):
|
||||
if any(
|
||||
keyword in name_lower
|
||||
for keyword in ["workflow", "requirements", "maintenance"]
|
||||
):
|
||||
return AgentCategory.DEVELOPMENT_PROCESS
|
||||
|
||||
# Default fallback
|
||||
@@ -159,7 +166,9 @@ class AgentRegistry:
|
||||
"""Get agent definition by name."""
|
||||
return self._agents.get(name)
|
||||
|
||||
def list_agents(self, category: Optional[AgentCategory] = None) -> List[AgentDefinition]:
|
||||
def list_agents(
|
||||
self, category: Optional[AgentCategory] = None
|
||||
) -> List[AgentDefinition]:
|
||||
"""List all agents, optionally filtered by category."""
|
||||
agents = list(self._agents.values())
|
||||
if category:
|
||||
@@ -232,7 +241,9 @@ class AgentRegistry:
|
||||
|
||||
return errors
|
||||
|
||||
def _has_circular_dependency(self, agent_name: str, visited: Optional[Set[str]] = None) -> bool:
|
||||
def _has_circular_dependency(
|
||||
self, agent_name: str, visited: Optional[Set[str]] = None
|
||||
) -> bool:
|
||||
"""Check if an agent has circular dependencies."""
|
||||
if visited is None:
|
||||
visited = set()
|
||||
@@ -255,18 +266,14 @@ class AgentRegistry:
|
||||
def get_agent_templates(self) -> Dict[str, List[str]]:
|
||||
"""Get predefined agent templates for different project types."""
|
||||
return {
|
||||
"python-basic": [
|
||||
"setupRepository",
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
],
|
||||
"python-basic": ["setupRepository", "keepaTodofile", "keepaChangelog"],
|
||||
"python-web": [
|
||||
"setupRepository",
|
||||
"tdd-workflow",
|
||||
"code-refactoring",
|
||||
"keepaTodofile",
|
||||
"keepaChangelog",
|
||||
"keepaContributingfile"
|
||||
"keepaContributingfile",
|
||||
],
|
||||
"python-cli": [
|
||||
"setupRepository",
|
||||
@@ -274,7 +281,7 @@ class AgentRegistry:
|
||||
"testing-efficiency",
|
||||
"claude-documentation",
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
"keepaChangelog",
|
||||
],
|
||||
"python-data": [
|
||||
"setupRepository",
|
||||
@@ -282,9 +289,7 @@ class AgentRegistry:
|
||||
"testing-efficiency",
|
||||
"requirements-engineering",
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
"keepaChangelog",
|
||||
],
|
||||
"comprehensive": [
|
||||
agent.name for agent in self.list_agents()
|
||||
]
|
||||
"comprehensive": [agent.name for agent in self.list_agents()],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user