Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions setup/commands/check_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def execute(self) -> int:
"""
try:
from setup.validation import validate_orchestration_environment, check_critical_files

logger.info("Running orchestration checks...")

# Handle specific check types
Expand All @@ -67,10 +67,10 @@ def execute(self) -> int:
else:
logger.error("Orchestration environment validation failed")
return 1

# Default: run all checks
success = validate_orchestration_environment()

if success:
logger.info("Orchestration checks passed successfully!")
return 0
Expand Down
4 changes: 2 additions & 2 deletions setup/commands/cleanup_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def execute(self) -> int:
try:
from setup.utils import process_manager
logger.info("Starting manual cleanup...")

# Perform process cleanup
process_manager.cleanup()

logger.info("Manual cleanup completed successfully!")
return 0

Expand Down
18 changes: 9 additions & 9 deletions setup/commands/command_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class CommandFactory:
"""
Factory class for creating command instances.

This factory maps command names to their corresponding command classes
and creates instances with the provided arguments.
"""
Expand All @@ -36,25 +36,25 @@ def __init__(self):
def create_command(self, command_name: str, args: Namespace) -> Optional[Command]:
"""
Create a command instance based on the command name.

Args:
command_name: Name of the command to create
args: Parsed command-line arguments

Returns:
Command instance or None if command is not found
"""
command_class = self._commands.get(command_name)
if command_class is None:
return None

command = command_class(args)
return command

def get_available_commands(self) -> list:
"""
Get a list of available command names.

Returns:
List of available command names
"""
Expand All @@ -63,17 +63,17 @@ def get_available_commands(self) -> list:
def get_command_description(self, command_name: str) -> str:
"""
Get the description of a command.

Args:
command_name: Name of the command

Returns:
Description of the command or empty string if not found
"""
command_class = self._commands.get(command_name)
if command_class is None:
return ""

# Create a temporary instance to get the description
try:
command = command_class()
Expand All @@ -89,7 +89,7 @@ def get_command_description(self, command_name: str) -> str:
def get_command_factory() -> CommandFactory:
"""
Get the global command factory instance.

Returns:
CommandFactory instance
"""
Expand Down
10 changes: 5 additions & 5 deletions setup/commands/command_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
class Command(ABC):
"""
Abstract base class for commands.

All commands should inherit from this class and implement the required methods.
"""

def __init__(self, args: Namespace = None):
"""
Initialize the command with arguments.

Args:
args: Parsed command-line arguments
"""
Expand All @@ -29,7 +29,7 @@ def __init__(self, args: Namespace = None):
def get_description(self) -> str:
"""
Get the command description.

Returns:
Command description
"""
Expand All @@ -39,7 +39,7 @@ def get_description(self) -> str:
def validate_args(self) -> bool:
"""
Validate command arguments.

Returns:
True if arguments are valid, False otherwise
"""
Expand All @@ -49,7 +49,7 @@ def validate_args(self) -> bool:
def execute(self) -> int:
"""
Execute the command.

Returns:
Exit code (0 for success, non-zero for failure)
"""
Expand Down
4 changes: 2 additions & 2 deletions setup/commands/run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def execute(self) -> int:
try:
from setup.services import start_services, validate_services
from setup.launch import prepare_environment

logger.info("Starting EmailIntelligence application...")

# Prepare the environment
prepare_environment(self.args)

Expand Down
4 changes: 2 additions & 2 deletions setup/commands/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def execute(self) -> int:
"""
try:
from setup.test_stages import handle_test_stage

logger.info("Running tests...")

# Execute test stage
handle_test_stage(self.args)

Expand Down
10 changes: 5 additions & 5 deletions setup/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
class Container:
"""
Simple dependency injection container.

This class manages the creation and lifecycle of application services.
"""

def __init__(self):
self._services = {}
self._singletons = {}

def register(self, name: str, service: Any, singleton: bool = False):
"""Register a service with the container."""
if singleton:
self._singletons[name] = service
else:
self._services[name] = service

def get(self, name: str) -> Any:
"""Get a service from the container."""
if name in self._singletons:
return self._singletons[name]
return self._services.get(name)

def has(self, name: str) -> bool:
"""Check if a service is registered."""
return name in self._services or name in self._singletons
Expand Down
46 changes: 23 additions & 23 deletions setup/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,22 +419,22 @@ def check_critical_files() -> bool:
"scripts/cleanup_orchestration.sh",
"scripts/sync_setup_worktrees.sh",
"scripts/reverse_sync_orchestration.sh",

# Git hooks
"scripts/hooks/pre-commit",
"scripts/hooks/post-commit",
"scripts/hooks/post-commit-setup-sync",
"scripts/hooks/post-merge",
"scripts/hooks/post-checkout",
"scripts/hooks/post-push",

# Shared libraries
"scripts/lib/common.sh",
"scripts/lib/error_handling.sh",
"scripts/lib/git_utils.sh",
"scripts/lib/logging.sh",
"scripts/lib/validation.sh",

# Setup files
"setup/launch.py",
"setup/pyproject.toml",
Expand All @@ -443,22 +443,22 @@ def check_critical_files() -> bool:
"setup/setup_environment_system.sh",
"setup/setup_environment_wsl.sh",
"setup/setup_python.sh",

# Configuration files
".flake8",
".pylintrc",
".gitignore",
".gitattributes",

# Root wrapper
"launch.py",

# Deployment files
"deployment/deploy.py",
"deployment/test_stages.py",
"deployment/docker-compose.yml",
]

# Critical directories that must exist
critical_directories = [
"scripts/",
Expand All @@ -468,7 +468,7 @@ def check_critical_files() -> bool:
"deployment/",
"docs/",
]

# Orchestration documentation files
orchestration_docs = [
"docs/orchestration_summary.md",
Expand All @@ -480,28 +480,28 @@ def check_critical_files() -> bool:
"docs/current_orchestration_docs/",
"docs/guides/",
]

missing_files = []
missing_dirs = []

# Check for missing critical files
for file_path in critical_files:
full_path = ROOT_DIR / file_path
if not full_path.exists():
missing_files.append(file_path)

# Check for missing critical directories
for dir_path in critical_directories:
full_path = ROOT_DIR / dir_path
if not full_path.exists():
missing_dirs.append(dir_path)

# Check for missing orchestration documentation
for doc_path in orchestration_docs:
full_path = ROOT_DIR / doc_path
if not full_path.exists():
missing_files.append(doc_path)

if missing_files or missing_dirs:
if missing_files:
logger.error("Missing critical files:")
Expand All @@ -513,23 +513,23 @@ def check_critical_files() -> bool:
logger.error(f" - {dir_path}")
logger.error("Please restore these critical files for proper orchestration functionality.")
return False

logger.info("All critical files are present.")
return True


def validate_orchestration_environment() -> bool:
"""Run comprehensive validation for the orchestration-tools branch."""
logger.info("Running orchestration environment validation...")

# Check for merge conflicts first
if not check_for_merge_conflicts():
return False

# Check critical files
if not check_critical_files():
return False

logger.info("Orchestration environment validation passed.")
return True

Expand Down Expand Up @@ -1413,7 +1413,7 @@ def _execute_command(command_name: str, args) -> int:
# Handle check command directly in orchestration-tools branch
if command_name == "check":
return _execute_check_command(args)

# For other commands, use command pattern if available
if COMMAND_PATTERN_AVAILABLE:
factory = get_command_factory()
Expand All @@ -1435,24 +1435,24 @@ def _execute_command(command_name: str, args) -> int:
def _execute_check_command(args) -> int:
"""Execute the check command for orchestration validation."""
logger.info("Running orchestration checks...")

success = True

# Run critical files check if requested
if args.critical_files or (not args.env):
if not check_critical_files():
success = False

# Run environment validation if requested
if args.env:
if not validate_orchestration_environment():
success = False

# If no specific check was requested, run all checks
if not args.critical_files and not args.env:
if not validate_orchestration_environment():
success = False

if success:
logger.info("All orchestration checks passed!")
return 0
Expand Down
Loading
Loading