Skip to main content

scripts-activate-all-components

#!/usr/bin/env python3 """โ€‹

title: "Add scripts/core to path for imports" component_type: script version: "1.0.0" audience: contributor status: stable summary: "Activate All Components - REAL RUNTIME ACTIVATION" keywords: ['activate', 'all', 'components', 'testing'] tokens: ~500 created: 2025-12-22 updated: 2025-12-22 script_name: "activate-all-components.py" language: python executable: true usage: "python3 scripts/activate-all-components.py [options]" python_version: "3.10+" dependencies: [] modifies_files: false network_access: false requires_auth: falseโ€‹

Activate All Components - REAL RUNTIME ACTIVATION

Makes components ACTUALLY CALLABLE at runtime. Tests that ComponentActivator can find and load all components.

Part of Phase 5.2: Session Initialization Created: 2025-11-29 """

import sys import json import argparse from pathlib import Path

Add scripts/core to path for imports

sys.path.insert(0, str(Path(file).parent / 'core')) from component_activator import ComponentActivator

def parse_args(): """Parse command line arguments""" parser = argparse.ArgumentParser( description='Activate all CODITECT framework components for runtime use.', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=''' Examples: %(prog)s # Activate all components %(prog)s --quiet # Activate without verbose output %(prog)s --skip-test # Skip functionality test after activation %(prog)s --json # Output results as JSON

This script:

  1. Loads the framework registry and skills registry
  2. Activates all registered components
  3. Verifies critical agents are callable
  4. Compares with activation status file

Part of CODITECT Phase 5.2: Session Initialization ''' ) parser.add_argument('--quiet', '-q', action='store_true', help='Suppress verbose output') parser.add_argument('--skip-test', action='store_true', help='Skip functionality test after activation') parser.add_argument('--json', action='store_true', help='Output results as JSON') parser.add_argument('--framework-root', type=str, default=None, help='Override framework root directory (default: auto-detect)') return parser.parse_args()

def main(): """Activate all CODITECT components with proper framework root resolution""" args = parse_args()

# Resolve framework root from script location (parent of scripts/)
framework_root = Path(args.framework_root) if args.framework_root else Path(__file__).parent.parent

print()
print("=" * 60)
print("๐Ÿš€ CODITECT Component Activation")
print("=" * 60)
print(f"Framework root: {framework_root}")
print()

# Create activator with explicit framework root
print("๐Ÿ“ฆ Initializing ComponentActivator...")
activator = ComponentActivator(framework_root=framework_root)
print(f" Framework root: {activator.framework_root}")
print()

# Load framework registry
framework_registry = framework_root / "config" / "framework-registry.json"
if framework_registry.exists():
print(f"๐Ÿ“– Loading framework registry: {framework_registry.name}")
count = activator.load_registry(framework_registry)
print(f" โœ… Loaded: {count} components")
else:
print(f" โš ๏ธ Framework registry not found: {framework_registry}")
print()

# Load skills registry
skills_registry = framework_root / "skills" / "REGISTRY.json"
if skills_registry.exists():
print(f"๐Ÿ“– Loading skills registry: {skills_registry.name}")
count = activator.load_registry(skills_registry)
print(f" โœ… Loaded: {count} skills")
else:
print(f" โš ๏ธ Skills registry not found: {skills_registry}")
print()

# Activate all components
print("๐Ÿ”„ Activating all components...")
total = activator.activate_all()
print(f" โœ… Activated: {total} components")
print()

# Print summary
activator.print_summary()
print()

# TEST: Verify components are actually callable
print("=" * 60)
print("๐Ÿงช Functionality Test: Component Lookup")
print("=" * 60)
print()

test_agents = [
'codi-documentation-writer',
'orchestrator',
'codebase-locator',
'codebase-analyzer',
'documentation-librarian'
]

print("Testing critical agent lookup:")
all_found = True
for agent_name in test_agents:
agent = activator.get_agent(agent_name)
if agent:
print(f" โœ… {agent_name}")
print(f" Path: {agent.path}")
else:
print(f" โŒ {agent_name}: NOT FOUND")
all_found = False
print()

# Compare with activation status
activation_status_file = framework_root / ".coditect" / "component-activation-status.json"
if activation_status_file.exists():
print("๐Ÿ“Š Comparing with activation status:")
with open(activation_status_file, 'r') as f:
status = json.load(f)

status_activated = status['activation_summary']['activated']
stats = activator.get_statistics()
runtime_loaded = stats['total_active']

print(f" Activation status reports: {status_activated} activated")
print(f" Runtime loaded: {runtime_loaded} components")

if runtime_loaded > status_activated:
print(f" โ„น๏ธ Runtime loaded MORE components (good for testing)")
elif runtime_loaded == status_activated:
print(f" โœ… Perfect match")
else:
print(f" โš ๏ธ Runtime loaded FEWER components")
print()

# Final result
print("=" * 60)
if all_found and total > 0:
print("โœ… Component Activation: SUCCESS")
print()
print(" Components are CALLABLE at runtime")
print(f" Total components loaded: {total}")
print(f" All critical agents verified")
print()
return 0
else:
print("โŒ Component Activation: INCOMPLETE")
print()
if not all_found:
print(" Some critical agents not found")
if total == 0:
print(" No components loaded")
print()
return 1

if name == 'main': sys.exit(main())