WP-0001 complete: v1.1.0 lazy registry and install performance
Lazy-load agent registry (frontmatter index, parse on demand), copy agents by path during install, fix Makefile template tab lint issue, add registry performance tests, bump to 1.1.0, document CLI reinstall after pull.
This commit is contained in:
@@ -47,16 +47,16 @@ class AgentInstaller:
|
||||
if config.create_backup and agents_dir.exists():
|
||||
self._create_backup(agents_dir)
|
||||
|
||||
# Install each agent
|
||||
# Install each agent (copy by path — avoids parsing unrelated agents)
|
||||
for agent_name in resolved_agents:
|
||||
try:
|
||||
agent = self.registry.get_agent(agent_name)
|
||||
if not agent:
|
||||
source_path = self.registry.get_agent_path(agent_name)
|
||||
if not source_path:
|
||||
results[agent_name] = "ERROR: Agent not found"
|
||||
continue
|
||||
|
||||
target_path = agents_dir / f"agent-{agent_name}.md"
|
||||
shutil.copy2(agent.file_path, target_path)
|
||||
shutil.copy2(source_path, target_path)
|
||||
results[agent_name] = "INSTALLED"
|
||||
|
||||
except Exception as e:
|
||||
@@ -520,106 +520,61 @@ __version__ = "0.1.0"
|
||||
def _create_makefile(self, project_dir: Path, project_name: str):
|
||||
"""Create Makefile with standard targets."""
|
||||
package_name = project_name.replace("-", "_")
|
||||
makefile_content = f"""# {project_name} - Makefile for development workflow
|
||||
# Generated by Kaizen Agentic
|
||||
|
||||
.PHONY: help setup-complete setup-python setup-tools test lint format clean agents-status agents-update
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " setup-complete - Complete development environment setup"
|
||||
@echo " setup-python - Set up Python virtual environment and dependencies"
|
||||
@echo " setup-tools - Install development tools"
|
||||
@echo " test - Run test suite"
|
||||
@echo " lint - Run code quality checks"
|
||||
@echo " format - Format code with black"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " agents-status - Show installed agents status"
|
||||
@echo " agents-update - Update agents to latest versions"
|
||||
|
||||
# Virtual environment detection
|
||||
VENV := .venv
|
||||
PYTHON := $(VENV)/bin/python
|
||||
PIP := $(VENV)/bin/pip
|
||||
|
||||
# Complete setup
|
||||
setup-complete: setup-python setup-tools
|
||||
@echo "✅ Development environment setup complete!"
|
||||
@echo "Next steps:"
|
||||
@echo " source $(VENV)/bin/activate # Activate virtual environment"
|
||||
@echo " make test # Run tests"
|
||||
@echo " make lint # Check code quality"
|
||||
|
||||
# Python environment setup
|
||||
setup-python: $(VENV)/bin/activate
|
||||
|
||||
$(VENV)/bin/activate: pyproject.toml
|
||||
python3 -m venv $(VENV)
|
||||
$(PIP) install --upgrade pip
|
||||
$(PIP) install -e ".[dev]"
|
||||
touch $(VENV)/bin/activate
|
||||
|
||||
# Development tools setup
|
||||
setup-tools: $(VENV)/bin/activate
|
||||
@echo "Development tools installed via pyproject.toml"
|
||||
|
||||
# Testing
|
||||
test: $(VENV)/bin/activate
|
||||
$(PYTHON) -m pytest tests/ -v
|
||||
|
||||
test-coverage: $(VENV)/bin/activate
|
||||
$(PYTHON) -m pytest tests/ --cov=src/{package_name} --cov-report=html --cov-report=term-missing
|
||||
|
||||
# Code quality
|
||||
lint: $(VENV)/bin/activate
|
||||
$(PYTHON) -m flake8 src/ tests/
|
||||
$(PYTHON) -m mypy src/
|
||||
|
||||
format: $(VENV)/bin/activate
|
||||
$(PYTHON) -m black src/ tests/
|
||||
|
||||
format-check: $(VENV)/bin/activate
|
||||
$(PYTHON) -m black --check src/ tests/
|
||||
|
||||
# Cleanup
|
||||
clean:
|
||||
rm -rf build/
|
||||
rm -rf dist/
|
||||
rm -rf *.egg-info/
|
||||
rm -rf .pytest_cache/
|
||||
rm -rf .coverage
|
||||
rm -rf htmlcov/
|
||||
find . -type d -name __pycache__ -exec rm -rf {{}} +
|
||||
find . -type f -name "*.pyc" -delete
|
||||
|
||||
# Agent management
|
||||
agents-status:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic status; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-update:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic update; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-list:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic list; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-validate:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic validate; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
"""
|
||||
(project_dir / "Makefile").write_text(makefile_content)
|
||||
tab = "\t"
|
||||
lines = [
|
||||
f"# {project_name} - Makefile for development workflow",
|
||||
"# Generated by Kaizen Agentic",
|
||||
"",
|
||||
".PHONY: help setup-complete setup-python setup-tools test lint "
|
||||
"format clean agents-status agents-update",
|
||||
"",
|
||||
"help:",
|
||||
f'{tab}@echo "Available targets:"',
|
||||
f'{tab}@echo " setup-complete - Complete development environment setup"',
|
||||
f'{tab}@echo " setup-python - Set up Python virtual environment"',
|
||||
f'{tab}@echo " test - Run test suite"',
|
||||
f'{tab}@echo " agents-status - Show installed agents status"',
|
||||
"",
|
||||
"VENV := .venv",
|
||||
"PYTHON := $(VENV)/bin/python",
|
||||
"PIP := $(VENV)/bin/pip",
|
||||
"",
|
||||
"setup-complete: setup-python setup-tools",
|
||||
f'{tab}@echo "Development environment setup complete"',
|
||||
"",
|
||||
"setup-python: $(VENV)/bin/activate",
|
||||
"",
|
||||
"$(VENV)/bin/activate: pyproject.toml",
|
||||
f"{tab}python3 -m venv $(VENV)",
|
||||
f"{tab}$(PIP) install --upgrade pip",
|
||||
f'{tab}$(PIP) install -e ".[dev]"',
|
||||
f"{tab}touch $(VENV)/bin/activate",
|
||||
"",
|
||||
"setup-tools: $(VENV)/bin/activate",
|
||||
f'{tab}@echo "Development tools installed via pyproject.toml"',
|
||||
"",
|
||||
"test: $(VENV)/bin/activate",
|
||||
f"{tab}$(PYTHON) -m pytest tests/ -v",
|
||||
"",
|
||||
"test-coverage: $(VENV)/bin/activate",
|
||||
f"{tab}$(PYTHON) -m pytest tests/ --cov=src/{package_name} "
|
||||
f"--cov-report=html --cov-report=term-missing",
|
||||
"",
|
||||
"lint: $(VENV)/bin/activate",
|
||||
f"{tab}$(PYTHON) -m flake8 src/ tests/",
|
||||
"",
|
||||
"format: $(VENV)/bin/activate",
|
||||
f"{tab}$(PYTHON) -m black src/ tests/",
|
||||
"",
|
||||
"clean:",
|
||||
f"{tab}rm -rf build/ dist/ *.egg-info/ .pytest_cache/ .coverage htmlcov/",
|
||||
"",
|
||||
"agents-status:",
|
||||
f"{tab}@command -v kaizen-agentic >/dev/null 2>&1 && kaizen-agentic status "
|
||||
f'|| echo "kaizen-agentic not installed"',
|
||||
"",
|
||||
"agents-update:",
|
||||
f"{tab}@command -v kaizen-agentic >/dev/null 2>&1 && kaizen-agentic update "
|
||||
f'|| echo "kaizen-agentic not installed"',
|
||||
]
|
||||
(project_dir / "Makefile").write_text("\n".join(lines) + "\n")
|
||||
|
||||
Reference in New Issue
Block a user