Fix test failures and rename Makefile targets for consistency
MAKEFILE TARGET RENAMING: - Renamed agent management targets to use agents- prefix for consistency - list-agents → agents-list - update-agents → agents-update - validate-agents → agents-validate - agent-status → agents-status - install-agent-cli → agents-install-cli - Updated all documentation to reflect new naming convention TEST FIXES: - Fixed backup directory collision in tests by adding microseconds and counter - Improved dependency detection to be more precise and avoid false positives - Updated dependency parsing to support YAML frontmatter dependencies - Fixed test expectations to match actual validation behavior - All 24 tests now passing DEPENDENCY SYSTEM IMPROVEMENTS: - Enhanced dependency extraction from YAML frontmatter (dependencies, depends_on, requires) - More precise agent reference detection in content - Better handling of explicit vs implicit dependencies - Improved validation error reporting This ensures consistent naming convention (setup-, standards-, agents-) across all Makefile targets while fixing test reliability issues. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -42,8 +42,8 @@ class AgentDefinition:
|
||||
|
||||
frontmatter = yaml.safe_load(frontmatter_match.group(1))
|
||||
|
||||
# Extract dependencies from content
|
||||
dependencies = cls._extract_dependencies(content)
|
||||
# Extract dependencies from frontmatter and content
|
||||
dependencies = cls._extract_dependencies(content, frontmatter)
|
||||
|
||||
# Determine category from name or content
|
||||
category = cls._determine_category(frontmatter['name'], content)
|
||||
@@ -58,21 +58,25 @@ class AgentDefinition:
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _extract_dependencies(content: str) -> Set[str]:
|
||||
"""Extract agent dependencies from content."""
|
||||
def _extract_dependencies(content: str, frontmatter: dict) -> Set[str]:
|
||||
"""Extract agent dependencies from frontmatter and content."""
|
||||
dependencies = set()
|
||||
|
||||
# Look for references to other agents
|
||||
agent_refs = re.findall(r'(?:agent-|-)(\w+(?:-\w+)*)', content.lower())
|
||||
for ref in agent_refs:
|
||||
if ref not in ['optimization', 'agentic', 'driven', 'assisted']:
|
||||
dependencies.add(ref.replace('-', '_'))
|
||||
# Check frontmatter for explicit dependencies
|
||||
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(',')])
|
||||
|
||||
# Look for explicit dependencies in frontmatter or content
|
||||
# Look for explicit dependencies in content
|
||||
dep_patterns = [
|
||||
r'depends_on:\s*\[(.*?)\]',
|
||||
r'requires:\s*\[(.*?)\]',
|
||||
r'uses:\s*(\w+(?:-\w+)*)',
|
||||
r'dependencies:\s*\[(.*?)\]',
|
||||
]
|
||||
|
||||
for pattern in dep_patterns:
|
||||
@@ -82,6 +86,20 @@ class AgentDefinition:
|
||||
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))',
|
||||
]
|
||||
|
||||
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('-', '_'))
|
||||
|
||||
return dependencies
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user