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:
@@ -17,10 +17,12 @@ def cli():
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--category',
|
||||
type=click.Choice([c.value for c in AgentCategory]),
|
||||
help='Filter by category')
|
||||
@click.option('--verbose', '-v', is_flag=True, help='Show detailed information')
|
||||
@click.option(
|
||||
"--category",
|
||||
type=click.Choice([c.value for c in AgentCategory]),
|
||||
help="Filter by category",
|
||||
)
|
||||
@click.option("--verbose", "-v", is_flag=True, help="Show detailed information")
|
||||
def list(category: Optional[str], verbose: bool):
|
||||
"""List available agents."""
|
||||
registry = _get_registry()
|
||||
@@ -34,7 +36,9 @@ def list(category: Optional[str], verbose: bool):
|
||||
if verbose:
|
||||
categories = registry.get_categories()
|
||||
for cat, agents in categories.items():
|
||||
click.echo(f"\n{cat.value.replace('-', ' ').title()} ({len(agents)} agents):")
|
||||
click.echo(
|
||||
f"\n{cat.value.replace('-', ' ').title()} ({len(agents)} agents):"
|
||||
)
|
||||
click.echo("=" * 50)
|
||||
for agent in agents:
|
||||
click.echo(f" • {agent.name}: {agent.description}")
|
||||
@@ -56,10 +60,10 @@ def list(category: Optional[str], verbose: bool):
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('agents', nargs=-1, required=True)
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option('--no-backup', is_flag=True, help='Skip creating backup')
|
||||
@click.option('--no-docs', is_flag=True, help='Skip updating documentation')
|
||||
@click.argument("agents", nargs=-1, required=True)
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.option("--no-backup", is_flag=True, help="Skip creating backup")
|
||||
@click.option("--no-docs", is_flag=True, help="Skip updating documentation")
|
||||
def install(agents: List[str], target: str, no_backup: bool, no_docs: bool):
|
||||
"""Install agents into a project."""
|
||||
registry = _get_registry()
|
||||
@@ -72,7 +76,7 @@ def install(agents: List[str], target: str, no_backup: bool, no_docs: bool):
|
||||
claude_config_path=target_path / "CLAUDE.md",
|
||||
makefile_path=target_path / "Makefile",
|
||||
update_docs=not no_docs,
|
||||
create_backup=not no_backup
|
||||
create_backup=not no_backup,
|
||||
)
|
||||
|
||||
click.echo(f"Installing agents to: {target_path}")
|
||||
@@ -98,8 +102,8 @@ def install(agents: List[str], target: str, no_backup: bool, no_docs: bool):
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.argument('agents', nargs=-1)
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.argument("agents", nargs=-1)
|
||||
def update(target: str, agents: List[str]):
|
||||
"""Update installed agents."""
|
||||
registry = _get_registry()
|
||||
@@ -131,8 +135,8 @@ def update(target: str, agents: List[str]):
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('agents', nargs=-1, required=True)
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.argument("agents", nargs=-1, required=True)
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
def remove(agents: List[str], target: str):
|
||||
"""Remove agents from a project."""
|
||||
registry = _get_registry()
|
||||
@@ -154,11 +158,17 @@ def remove(agents: List[str], target: str):
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('project_name')
|
||||
@click.option('--template', '-t', default='python-basic',
|
||||
help='Project template (python-basic, python-web, python-cli, python-data)')
|
||||
@click.option('--agents', '-a', help='Comma-separated list of agents to install')
|
||||
@click.option('--parent-dir', default='.', help='Parent directory for project (default: current)')
|
||||
@click.argument("project_name")
|
||||
@click.option(
|
||||
"--template",
|
||||
"-t",
|
||||
default="python-basic",
|
||||
help="Project template (python-basic, python-web, python-cli, python-data)",
|
||||
)
|
||||
@click.option("--agents", "-a", help="Comma-separated list of agents to install")
|
||||
@click.option(
|
||||
"--parent-dir", default=".", help="Parent directory for project (default: current)"
|
||||
)
|
||||
def init(project_name: str, template: str, agents: Optional[str], parent_dir: str):
|
||||
"""Initialize a new project with agents."""
|
||||
registry = _get_registry()
|
||||
@@ -173,7 +183,7 @@ def init(project_name: str, template: str, agents: Optional[str], parent_dir: st
|
||||
# Parse agent list
|
||||
agent_list = None
|
||||
if agents:
|
||||
agent_list = [a.strip() for a in agents.split(',')]
|
||||
agent_list = [a.strip() for a in agents.split(",")]
|
||||
|
||||
click.echo(f"Initializing project: {project_name}")
|
||||
click.echo(f"Template: {template}")
|
||||
@@ -204,7 +214,7 @@ def init(project_name: str, template: str, agents: Optional[str], parent_dir: st
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
def validate(target: str):
|
||||
"""Validate agents in a project."""
|
||||
registry = _get_registry()
|
||||
@@ -263,7 +273,7 @@ def templates():
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
def status(target: str):
|
||||
"""Show status of agents in a project."""
|
||||
registry = _get_registry()
|
||||
@@ -321,8 +331,8 @@ def status(target: str):
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option('--detailed', '-d', is_flag=True, help='Show detailed analysis')
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.option("--detailed", "-d", is_flag=True, help="Show detailed analysis")
|
||||
def detect(target: str, detailed: bool):
|
||||
"""Detect existing agent systems in a project."""
|
||||
from .detection import AgentSystemDetector
|
||||
@@ -372,11 +382,13 @@ def detect(target: str, detailed: bool):
|
||||
|
||||
# Show integration strategy
|
||||
if result.integration_strategy:
|
||||
click.echo(f"\n💡 Recommended Integration Strategy: {result.integration_strategy}")
|
||||
click.echo(
|
||||
f"\n💡 Recommended Integration Strategy: {result.integration_strategy}"
|
||||
)
|
||||
|
||||
# Show migration recommendations
|
||||
if result.migration_recommendations:
|
||||
click.echo(f"\n📋 Migration Recommendations:")
|
||||
click.echo("\n📋 Migration Recommendations:")
|
||||
for recommendation in result.migration_recommendations:
|
||||
if recommendation.startswith(" "):
|
||||
click.echo(f" {recommendation}")
|
||||
@@ -384,14 +396,18 @@ def detect(target: str, detailed: bool):
|
||||
click.echo(f" • {recommendation}")
|
||||
|
||||
if not result.detected_systems:
|
||||
click.echo(f"\n✨ This project is ready for Kaizen Agentic installation!")
|
||||
click.echo(f" Run: kaizen-agentic install <agent-names>")
|
||||
click.echo("\n✨ This project is ready for Kaizen Agentic installation!")
|
||||
click.echo(" Run: kaizen-agentic install <agent-names>")
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option('--dry-run', '-n', is_flag=True, help='Show what would be done without executing')
|
||||
@click.option('--auto-resolve', '-a', is_flag=True, help='Automatically resolve simple conflicts')
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.option(
|
||||
"--dry-run", "-n", is_flag=True, help="Show what would be done without executing"
|
||||
)
|
||||
@click.option(
|
||||
"--auto-resolve", "-a", is_flag=True, help="Automatically resolve simple conflicts"
|
||||
)
|
||||
def migrate(target: str, dry_run: bool, auto_resolve: bool):
|
||||
"""Create migration plan for integrating Kaizen agents into existing project."""
|
||||
from .migration import AgentMigrationPlanner, AgentMigrator
|
||||
@@ -408,7 +424,10 @@ def migrate(target: str, dry_run: bool, auto_resolve: bool):
|
||||
planner = AgentMigrationPlanner()
|
||||
integration_plan = planner.create_integration_plan(target_path)
|
||||
|
||||
if not integration_plan.migration_plans and not integration_plan.conflict_resolutions:
|
||||
if (
|
||||
not integration_plan.migration_plans
|
||||
and not integration_plan.conflict_resolutions
|
||||
):
|
||||
click.echo("✨ No migration needed - project is ready for Kaizen agents!")
|
||||
click.echo(" Run: kaizen-agentic install <agent-names>")
|
||||
return
|
||||
@@ -418,12 +437,17 @@ def migrate(target: str, dry_run: bool, auto_resolve: bool):
|
||||
click.echo(f"\n🔄 Migration Plans ({len(integration_plan.migration_plans)}):")
|
||||
for plan in integration_plan.migration_plans:
|
||||
strategy_emoji = {
|
||||
"replace": "🔄", "extend": "🔗", "preserve": "💾",
|
||||
"merge": "🔀", "remove": "🗑️"
|
||||
"replace": "🔄",
|
||||
"extend": "🔗",
|
||||
"preserve": "💾",
|
||||
"merge": "🔀",
|
||||
"remove": "🗑️",
|
||||
}
|
||||
emoji = strategy_emoji.get(plan.strategy.value, "❓")
|
||||
|
||||
click.echo(f" {emoji} {plan.source_agent.name} ({plan.source_agent.type.value})")
|
||||
click.echo(
|
||||
f" {emoji} {plan.source_agent.name} ({plan.source_agent.type.value})"
|
||||
)
|
||||
click.echo(f" Strategy: {plan.strategy.value}")
|
||||
if plan.target_agent:
|
||||
click.echo(f" Target: {plan.target_agent}")
|
||||
@@ -433,7 +457,9 @@ def migrate(target: str, dry_run: bool, auto_resolve: bool):
|
||||
|
||||
# Show conflict resolutions
|
||||
if integration_plan.conflict_resolutions:
|
||||
click.echo(f"\n⚠️ Conflict Resolutions ({len(integration_plan.conflict_resolutions)}):")
|
||||
click.echo(
|
||||
f"\n⚠️ Conflict Resolutions ({len(integration_plan.conflict_resolutions)}):"
|
||||
)
|
||||
for resolution in integration_plan.conflict_resolutions:
|
||||
click.echo(f" • {resolution.agent1} vs {resolution.agent2}")
|
||||
click.echo(f" Resolution: {resolution.resolution.value}")
|
||||
@@ -443,31 +469,35 @@ def migrate(target: str, dry_run: bool, auto_resolve: bool):
|
||||
|
||||
# Show integration order
|
||||
if integration_plan.integration_order:
|
||||
click.echo(f"\n📋 Integration Order:")
|
||||
click.echo("\n📋 Integration Order:")
|
||||
for i, agent_name in enumerate(integration_plan.integration_order, 1):
|
||||
click.echo(f" {i}. {agent_name}")
|
||||
|
||||
# Show post-migration tasks
|
||||
if integration_plan.post_migration_tasks:
|
||||
click.echo(f"\n✅ Post-Migration Tasks:")
|
||||
click.echo("\n✅ Post-Migration Tasks:")
|
||||
for task in integration_plan.post_migration_tasks:
|
||||
click.echo(f" • {task}")
|
||||
|
||||
# Execute migration if requested
|
||||
if not dry_run:
|
||||
click.echo(f"\n🚀 Executing migration...")
|
||||
click.echo("\n🚀 Executing migration...")
|
||||
migrator = AgentMigrator()
|
||||
results = migrator.execute_migration(integration_plan, dry_run=False)
|
||||
|
||||
click.echo(f"\n📊 Migration Results:")
|
||||
click.echo("\n📊 Migration Results:")
|
||||
for agent, result in results.items():
|
||||
status_emoji = "✅" if "ERROR" not in result else "❌"
|
||||
click.echo(f" {status_emoji} {agent}: {result}")
|
||||
|
||||
click.echo(f"\n💾 Backup created at: {integration_plan.backup_directory}")
|
||||
else:
|
||||
click.echo(f"\n🔍 This was a dry run. Use --no-dry-run to execute the migration.")
|
||||
click.echo(f" Backup would be created at: {integration_plan.backup_directory}")
|
||||
click.echo(
|
||||
"\n🔍 This was a dry run. Use --no-dry-run to execute the migration."
|
||||
)
|
||||
click.echo(
|
||||
f" Backup would be created at: {integration_plan.backup_directory}"
|
||||
)
|
||||
|
||||
|
||||
@cli.group()
|
||||
@@ -477,8 +507,8 @@ def extensions():
|
||||
|
||||
|
||||
@extensions.command()
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option('--base-agent', '-b', help='Filter by base agent')
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.option("--base-agent", "-b", help="Filter by base agent")
|
||||
def list_extensions(target: str, base_agent: Optional[str]):
|
||||
"""List installed extensions."""
|
||||
from .extensions import ExtensionManager
|
||||
@@ -510,12 +540,14 @@ def list_extensions(target: str, base_agent: Optional[str]):
|
||||
|
||||
|
||||
@extensions.command()
|
||||
@click.argument('name')
|
||||
@click.argument('base_agent')
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.option('--description', '-d', help='Extension description')
|
||||
@click.option('--template', default='basic', help='Template type (basic, advanced)')
|
||||
def create(name: str, base_agent: str, target: str, description: Optional[str], template: str):
|
||||
@click.argument("name")
|
||||
@click.argument("base_agent")
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.option("--description", "-d", help="Extension description")
|
||||
@click.option("--template", default="basic", help="Template type (basic, advanced)")
|
||||
def create(
|
||||
name: str, base_agent: str, target: str, description: Optional[str], template: str
|
||||
):
|
||||
"""Create a new agent extension."""
|
||||
from .extensions import ExtensionManager, ExtensionType, create_extension_template
|
||||
|
||||
@@ -523,7 +555,9 @@ def create(name: str, base_agent: str, target: str, description: Optional[str],
|
||||
manager = ExtensionManager(target_path)
|
||||
|
||||
# Generate template
|
||||
template_content = create_extension_template(name, base_agent, target_path, template)
|
||||
template_content = create_extension_template(
|
||||
name, base_agent, target_path, template
|
||||
)
|
||||
|
||||
# Save template to file
|
||||
template_dir = target_path / ".kaizen" / "extensions" / name
|
||||
@@ -537,18 +571,20 @@ def create(name: str, base_agent: str, target: str, description: Optional[str],
|
||||
name=name,
|
||||
base_agent=base_agent,
|
||||
extension_type=ExtensionType.FUNCTIONAL_EXTENSION,
|
||||
description=description or f"Custom extension for {base_agent}"
|
||||
description=description or f"Custom extension for {base_agent}",
|
||||
)
|
||||
|
||||
click.echo(f"✅ Created extension: {name}")
|
||||
click.echo(f" Base agent: {base_agent}")
|
||||
click.echo(f" Template saved to: {template_file}")
|
||||
click.echo(f" Edit the configuration and run: kaizen-agentic extensions enable {name}")
|
||||
click.echo(
|
||||
f" Edit the configuration and run: kaizen-agentic extensions enable {name}"
|
||||
)
|
||||
|
||||
|
||||
@extensions.command()
|
||||
@click.argument('name')
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.argument("name")
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
def enable(name: str, target: str):
|
||||
"""Enable an extension."""
|
||||
from .extensions import ExtensionManager
|
||||
@@ -563,8 +599,8 @@ def enable(name: str, target: str):
|
||||
|
||||
|
||||
@extensions.command()
|
||||
@click.argument('name')
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.argument("name")
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
def disable(name: str, target: str):
|
||||
"""Disable an extension."""
|
||||
from .extensions import ExtensionManager
|
||||
@@ -579,9 +615,9 @@ def disable(name: str, target: str):
|
||||
|
||||
|
||||
@extensions.command()
|
||||
@click.argument('name')
|
||||
@click.option('--target', '-t', default='.', help='Target directory (default: current)')
|
||||
@click.confirmation_option(prompt='Are you sure you want to remove this extension?')
|
||||
@click.argument("name")
|
||||
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
|
||||
@click.confirmation_option(prompt="Are you sure you want to remove this extension?")
|
||||
def remove(name: str, target: str):
|
||||
"""Remove an extension."""
|
||||
from .extensions import ExtensionManager
|
||||
@@ -610,6 +646,7 @@ def _get_registry() -> AgentRegistry:
|
||||
# Try to find installed package
|
||||
try:
|
||||
import kaizen_agentic
|
||||
|
||||
package_dir = Path(kaizen_agentic.__file__).parent.parent.parent
|
||||
agents_dir = package_dir / "agents"
|
||||
if not agents_dir.exists():
|
||||
@@ -617,7 +654,9 @@ def _get_registry() -> AgentRegistry:
|
||||
agents_dir = Path(kaizen_agentic.__file__).parent / "data" / "agents"
|
||||
except ImportError:
|
||||
click.echo("Error: Could not find agents directory")
|
||||
click.echo("Make sure you're in a kaizen-agentic project or have the package installed")
|
||||
click.echo(
|
||||
"Make sure you're in a kaizen-agentic project or have the package installed"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if not agents_dir.exists():
|
||||
@@ -627,5 +666,5 @@ def _get_registry() -> AgentRegistry:
|
||||
return AgentRegistry(agents_dir)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
||||
Reference in New Issue
Block a user