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:
@@ -12,6 +12,7 @@ from .registry import AgentRegistry
|
||||
@dataclass
|
||||
class InstallationConfig:
|
||||
"""Configuration for agent installation."""
|
||||
|
||||
target_dir: Path
|
||||
claude_config_path: Optional[Path] = None
|
||||
makefile_path: Optional[Path] = None
|
||||
@@ -26,9 +27,7 @@ class AgentInstaller:
|
||||
self.registry = registry
|
||||
|
||||
def install_agents(
|
||||
self,
|
||||
agent_names: List[str],
|
||||
config: InstallationConfig
|
||||
self, agent_names: List[str], config: InstallationConfig
|
||||
) -> Dict[str, str]:
|
||||
"""Install agents into a project.
|
||||
|
||||
@@ -89,9 +88,7 @@ class AgentInstaller:
|
||||
return sorted(installed)
|
||||
|
||||
def update_agents(
|
||||
self,
|
||||
project_dir: Path,
|
||||
agent_names: Optional[List[str]] = None
|
||||
self, project_dir: Path, agent_names: Optional[List[str]] = None
|
||||
) -> Dict[str, str]:
|
||||
"""Update installed agents to latest versions."""
|
||||
if agent_names is None:
|
||||
@@ -101,9 +98,7 @@ class AgentInstaller:
|
||||
return self.install_agents(agent_names, config)
|
||||
|
||||
def remove_agents(
|
||||
self,
|
||||
agent_names: List[str],
|
||||
project_dir: Path
|
||||
self, agent_names: List[str], project_dir: Path
|
||||
) -> Dict[str, str]:
|
||||
"""Remove agents from a project."""
|
||||
results = {}
|
||||
@@ -162,7 +157,10 @@ class AgentInstaller:
|
||||
counter = 0
|
||||
while backup_dir.exists():
|
||||
counter += 1
|
||||
backup_dir = agents_dir.parent / f"agents_backup_{timestamp}_{microseconds}_{counter}"
|
||||
backup_dir = (
|
||||
agents_dir.parent
|
||||
/ f"agents_backup_{timestamp}_{microseconds}_{counter}"
|
||||
)
|
||||
|
||||
shutil.copytree(agents_dir, backup_dir)
|
||||
print(f"Created backup at: {backup_dir}")
|
||||
@@ -173,22 +171,22 @@ class AgentInstaller:
|
||||
# Read existing config
|
||||
config = {}
|
||||
if config_path.exists():
|
||||
with open(config_path, 'r') as f:
|
||||
with open(config_path, "r") as f:
|
||||
config = json.load(f)
|
||||
|
||||
# Ensure agents section exists
|
||||
if 'agents' not in config:
|
||||
config['agents'] = {}
|
||||
if "agents" not in config:
|
||||
config["agents"] = {}
|
||||
|
||||
# Add agent references
|
||||
for agent_name in agent_names:
|
||||
config['agents'][agent_name] = {
|
||||
config["agents"][agent_name] = {
|
||||
"path": f"agents/agent-{agent_name}.md",
|
||||
"enabled": True
|
||||
"enabled": True,
|
||||
}
|
||||
|
||||
# Write updated config
|
||||
with open(config_path, 'w') as f:
|
||||
with open(config_path, "w") as f:
|
||||
json.dump(config, f, indent=2)
|
||||
|
||||
print(f"Updated Claude configuration: {config_path}")
|
||||
@@ -200,7 +198,7 @@ class AgentInstaller:
|
||||
"""Update Makefile with agent-specific targets."""
|
||||
try:
|
||||
# Read existing Makefile
|
||||
with open(makefile_path, 'r') as f:
|
||||
with open(makefile_path, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# Add agent management targets if not present
|
||||
@@ -224,7 +222,7 @@ agents-validate:
|
||||
content += agent_targets
|
||||
|
||||
# Write updated Makefile
|
||||
with open(makefile_path, 'w') as f:
|
||||
with open(makefile_path, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"Updated Makefile: {makefile_path}")
|
||||
@@ -238,7 +236,9 @@ agents-validate:
|
||||
claude_md = project_dir / "CLAUDE.md"
|
||||
|
||||
agent_section = "## Installed Agents\n\n"
|
||||
agent_section += "This project includes the following specialized agents:\n\n"
|
||||
agent_section += (
|
||||
"This project includes the following specialized agents:\n\n"
|
||||
)
|
||||
|
||||
# Group agents by category
|
||||
categories = {}
|
||||
@@ -257,34 +257,37 @@ agents-validate:
|
||||
agent_section += f"- **{agent.name}**: {agent.description}\n"
|
||||
agent_section += "\n"
|
||||
|
||||
agent_section += ("Use these agents by referencing them in your "
|
||||
"Claude Code interactions.\n\n")
|
||||
agent_section += (
|
||||
"Use these agents by referencing them in your "
|
||||
"Claude Code interactions.\n\n"
|
||||
)
|
||||
|
||||
# Update or create CLAUDE.md
|
||||
if claude_md.exists():
|
||||
with open(claude_md, 'r') as f:
|
||||
with open(claude_md, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# Replace existing agent section or append
|
||||
if "## Installed Agents" in content:
|
||||
import re
|
||||
|
||||
content = re.sub(
|
||||
r'## Installed Agents.*?(?=##|\Z)',
|
||||
r"## Installed Agents.*?(?=##|\Z)",
|
||||
agent_section,
|
||||
content,
|
||||
flags=re.DOTALL
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
else:
|
||||
content += "\n" + agent_section
|
||||
|
||||
with open(claude_md, 'w') as f:
|
||||
with open(claude_md, "w") as f:
|
||||
f.write(content)
|
||||
else:
|
||||
# Create new CLAUDE.md
|
||||
header = "# Claude Code Configuration\n\n"
|
||||
header += "This file contains Claude Code configuration and agent information.\n\n"
|
||||
|
||||
with open(claude_md, 'w') as f:
|
||||
with open(claude_md, "w") as f:
|
||||
f.write(header + agent_section)
|
||||
|
||||
print(f"Updated documentation: {claude_md}")
|
||||
@@ -304,7 +307,7 @@ class ProjectInitializer:
|
||||
project_dir: Path,
|
||||
template: str = "python-basic",
|
||||
agent_names: Optional[List[str]] = None,
|
||||
project_name: Optional[str] = None
|
||||
project_name: Optional[str] = None,
|
||||
) -> Dict[str, str]:
|
||||
"""Initialize a new project with agents and structure."""
|
||||
results = {}
|
||||
@@ -325,7 +328,7 @@ class ProjectInitializer:
|
||||
config = InstallationConfig(
|
||||
target_dir=project_dir,
|
||||
claude_config_path=project_dir / "CLAUDE.md",
|
||||
makefile_path=project_dir / "Makefile"
|
||||
makefile_path=project_dir / "Makefile",
|
||||
)
|
||||
|
||||
installer = AgentInstaller(self.registry)
|
||||
@@ -337,12 +340,16 @@ class ProjectInitializer:
|
||||
|
||||
return results
|
||||
|
||||
def _create_project_structure(self, project_dir: Path, project_name: str, template: str):
|
||||
def _create_project_structure(
|
||||
self, project_dir: Path, project_name: str, template: str
|
||||
):
|
||||
"""Create basic project structure based on template."""
|
||||
# Create directories
|
||||
dirs_to_create = ["src", "tests", "docs"]
|
||||
if template.startswith("python"):
|
||||
dirs_to_create.extend([f"src/{project_name.replace('-', '_')}", ".github/workflows"])
|
||||
dirs_to_create.extend(
|
||||
[f"src/{project_name.replace('-', '_')}", ".github/workflows"]
|
||||
)
|
||||
|
||||
for dir_name in dirs_to_create:
|
||||
(project_dir / dir_name).mkdir(parents=True, exist_ok=True)
|
||||
@@ -501,7 +508,7 @@ python_functions = ["test_*"]
|
||||
|
||||
def _create_init_py(self, project_dir: Path, project_name: str):
|
||||
"""Create package __init__.py file."""
|
||||
package_name = project_name.replace('-', '_')
|
||||
package_name = project_name.replace("-", "_")
|
||||
init_content = f'''"""
|
||||
{project_name} - A Python project with Kaizen Agentic agents.
|
||||
"""
|
||||
@@ -512,7 +519,7 @@ __version__ = "0.1.0"
|
||||
|
||||
def _create_makefile(self, project_dir: Path, project_name: str):
|
||||
"""Create Makefile with standard targets."""
|
||||
package_name = project_name.replace('-', '_')
|
||||
package_name = project_name.replace("-", "_")
|
||||
makefile_content = f"""# {project_name} - Makefile for development workflow
|
||||
# Generated by Kaizen Agentic
|
||||
|
||||
|
||||
Reference in New Issue
Block a user