#!/bin/bash # DSS MVP1 Setup Script # Configures DSS for dss.overbits.luz.uy set -e # Exit on error echo "๐Ÿš€ DSS MVP1 Setup for dss.overbits.luz.uy" echo "==========================================" echo "" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Check if running as overbits user if [ "$USER" != "overbits" ]; then echo -e "${YELLOW}โš ๏ธ Warning: This script is designed for user 'overbits'${NC}" echo -e " Current user: $USER" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi # 1. Check dependencies echo "๐Ÿ“ฆ Checking dependencies..." python3 -m dss.settings check-deps || { echo -e "${RED}โŒ Dependency check failed${NC}" echo " Installing Python dependencies..." pip install -r requirements.txt echo " Installing Node dependencies..." npm install } # 2. Create necessary directories echo "" echo "๐Ÿ“ Creating directories..." mkdir -p ~/.dss/{cache,logs,backups} mkdir -p dist/tokens mkdir -p components echo -e "${GREEN}โœ… Directories created${NC}" # 3. Check for API keys echo "" echo "๐Ÿ”‘ Checking API keys..." if [ ! -f .env ]; then echo -e "${YELLOW}โš ๏ธ .env file not found - already created${NC}" fi # Check if keys are configured if grep -q "^ANTHROPIC_API_KEY=$" .env 2>/dev/null; then echo -e "${YELLOW}โš ๏ธ ANTHROPIC_API_KEY not set in .env${NC}" echo " Get your key from: https://console.anthropic.com/settings/keys" fi if grep -q "^FIGMA_TOKEN=$" .env 2>/dev/null; then echo -e "${YELLOW}โš ๏ธ FIGMA_TOKEN not set in .env${NC}" echo " Get your token from: https://www.figma.com/developers/api#access-tokens" fi if grep -q "^JWT_SECRET=$" .env 2>/dev/null; then echo -e "${YELLOW}โš ๏ธ JWT_SECRET not set in .env${NC}" echo " Generate with: openssl rand -hex 32" read -p "Generate JWT_SECRET now? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then JWT_SECRET=$(openssl rand -hex 32) sed -i "s/^JWT_SECRET=$/JWT_SECRET=$JWT_SECRET/" .env echo -e "${GREEN}โœ… JWT_SECRET generated and saved to .env${NC}" fi fi # 4. Run tests echo "" read -p "Run tests to verify setup? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "๐Ÿงช Running tests..." python3 -m dss.settings test || { echo -e "${RED}โŒ Tests failed${NC}" echo " Check the output above for errors" exit 1 } echo -e "${GREEN}โœ… All tests passed!${NC}" fi # 5. System info echo "" echo "๐Ÿ“Š System Information:" python3 -m dss.settings info # 6. Final instructions echo "" echo "==========================================" echo -e "${GREEN}โœ… Setup Complete!${NC}" echo "" echo "Next steps:" echo " 1. Add your API keys to .env:" echo " - ANTHROPIC_API_KEY (https://console.anthropic.com/settings/keys)" echo " - FIGMA_TOKEN (https://www.figma.com/developers/api#access-tokens)" echo "" echo " 2. Configure your Figma file:" echo " - Add FIGMA_FILE_KEY to .env" echo " - Format: figma.com/file/{FILE_KEY}/..." echo "" echo " 3. Start the server:" echo " python3 -m uvicorn dss.api.server:app --host 0.0.0.0 --port 3456" echo "" echo " 4. Visit: https://dss.overbits.luz.uy" echo "" echo "Commands:" echo " python3 -m dss.settings test # Run tests" echo " python3 -m dss.settings reset # Reset to fresh state" echo " python3 -m dss.settings info # Show system info" echo "" echo "See SETTINGS.md for full documentation" echo "=========================================="