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:
2025-10-19 08:03:45 +02:00
parent 38965c1d4a
commit 873120c2d3
7 changed files with 89 additions and 58 deletions

View File

@@ -150,15 +150,23 @@ class AgentInstaller:
def _create_backup(self, agents_dir: Path):
"""Create a backup of the existing agents directory."""
backup_dir = agents_dir.parent / f"agents_backup_{self._get_timestamp()}"
import datetime
import time
# Add microseconds to avoid collisions in tests
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
microseconds = int(time.time() * 1000000) % 1000000
backup_dir = agents_dir.parent / f"agents_backup_{timestamp}_{microseconds}"
# Ensure unique backup directory
counter = 0
while backup_dir.exists():
counter += 1
backup_dir = agents_dir.parent / f"agents_backup_{timestamp}_{microseconds}_{counter}"
shutil.copytree(agents_dir, backup_dir)
print(f"Created backup at: {backup_dir}")
def _get_timestamp(self) -> str:
"""Get current timestamp for backup naming."""
import datetime
return datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
def _update_claude_config(self, agent_names: List[str], config_path: Path):
"""Update Claude Code configuration with agent references."""
try:
@@ -198,20 +206,20 @@ class AgentInstaller:
# Add agent management targets if not present
agent_targets = """
# Agent Management Targets
list-agents:
agents-list:
\t@echo "Installed agents:"
\t@ls agents/ 2>/dev/null | grep agent- | sed 's/agent-//g' | sed 's/.md//g' || echo "No agents installed"
update-agents:
agents-update:
\t@echo "Updating agents..."
\t@kaizen-agentic update
validate-agents:
agents-validate:
\t@echo "Validating agents..."
\t@kaizen-agentic validate agents/
"""
if "list-agents:" not in content:
if "agents-list:" not in content:
content += agent_targets
# Write updated Makefile