register-component.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. #############################################################################
  3. # Component Registration Script - SIMPLIFIED VERSION
  4. # Just preserves the manually created registry.json
  5. # Auto-scanning can be added later after more testing
  6. #############################################################################
  7. set -e
  8. # Colors
  9. GREEN='\033[0;32m'
  10. CYAN='\033[0;36m'
  11. BOLD='\033[1m'
  12. NC='\033[0m'
  13. echo -e "${CYAN}${BOLD}"
  14. echo "╔════════════════════════════════════════════════════════════════╗"
  15. echo "║ ║"
  16. echo "║ Component Registration Script ║"
  17. echo "║ ║"
  18. echo "╚════════════════════════════════════════════════════════════════╝"
  19. echo -e "${NC}"
  20. echo ""
  21. echo "ℹ️ This script currently preserves the manually maintained registry.json"
  22. echo "ℹ️ Auto-scanning feature will be added in a future update"
  23. echo ""
  24. if [ ! -f "registry.json" ]; then
  25. echo "❌ Error: registry.json not found"
  26. exit 1
  27. fi
  28. if ! command -v jq &> /dev/null; then
  29. echo "❌ Error: jq is required but not installed"
  30. exit 1
  31. fi
  32. if ! jq empty registry.json 2>/dev/null; then
  33. echo "❌ Error: registry.json is not valid JSON"
  34. exit 1
  35. fi
  36. # Update the lastUpdated timestamp
  37. jq '.metadata.lastUpdated = (now | strftime("%Y-%m-%d"))' registry.json > registry.json.tmp
  38. mv registry.json.tmp registry.json
  39. echo -e "${GREEN}✓${NC} Registry validated successfully"
  40. echo ""
  41. echo "Registry Statistics:"
  42. echo " Agents: $(jq '.components.agents | length' registry.json)"
  43. echo " Subagents: $(jq '.components.subagents | length' registry.json)"
  44. echo " Commands: $(jq '.components.commands | length' registry.json)"
  45. echo " Tools: $(jq '.components.tools | length' registry.json)"
  46. echo " Plugins: $(jq '.components.plugins | length' registry.json)"
  47. echo " Contexts: $(jq '.components.contexts | length' registry.json)"
  48. echo ""
  49. echo -e "${GREEN}✓${NC} Done!"