-
Notifications
You must be signed in to change notification settings - Fork 0
/
complete-integration.sh
178 lines (149 loc) · 4.51 KB
/
complete-integration.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
# Colores para output
GREEN="\033[0;32m"
BLUE="\033[0;34m"
RED="\033[0;31m"
YELLOW="\033[1;33m"
NC="\033[0m"
# Configuración
PROJECT_NAME="aet-security"
echo -e "${BLUE}=== Integrando AET Security Platform - Versión Completa ===${NC}"
# Crear estructura de directorios completa
create_directory_structure() {
echo -e "\n${YELLOW}Creando estructura de directorios...${NC}"
mkdir -p $PROJECT_NAME/{src,docs,scripts,extension}
# Estructura src
mkdir -p $PROJECT_NAME/src/{core,security,monitoring,ai,financial,user,mobile,support,components}
mkdir -p $PROJECT_NAME/src/components/{ui,forms,charts,monitoring}
mkdir -p $PROJECT_NAME/src/deployment
# Estructura docs
mkdir -p $PROJECT_NAME/docs/{legal,security,api,technical}
}
# Convertir y mover archivos
convert_and_move_files() {
echo -e "\n${YELLOW}Moviendo archivos a sus ubicaciones correctas...${NC}"
# Array de mapeo de archivos [origen:destino]
declare -A file_mappings=(
["access-control-system.txt"]="src/security/AccessControl.ts"
["aeg-ecosystem.ts"]="src/core/Ecosystem.ts"
["aeg-guard.ts"]="src/security/Guard.ts"
# ... [Lista completa de mapeos]
)
for source in "${!file_mappings[@]}"; do
target="${file_mappings[$source]}"
if [ -f "$source" ]; then
mkdir -p "$PROJECT_NAME/$(dirname "$target")"
cp "$source" "$PROJECT_NAME/$target"
echo -e "${GREEN}✓ Movido: $source → $target${NC}"
else
echo -e "${RED}✗ No encontrado: $source${NC}"
fi
done
}
# Actualizar imports y referencias
update_references() {
echo -e "\n${YELLOW}Actualizando referencias...${NC}"
find $PROJECT_NAME/src -type f -name "*.ts" -o -name "*.tsx" | while read -r file; do
sed -i '' 's/@aet\/core/..\/core/g' "$file"
sed -i '' 's/@aet\/quantum-ai/..\/ai\/quantum/g' "$file"
echo -e "${GREEN}✓ Referencias actualizadas: $file${NC}"
done
}
# Configurar dependencias
setup_dependencies() {
echo -e "\n${YELLOW}Configurando dependencias...${NC}"
cd $PROJECT_NAME
cat > package.json << EOL
{
"name": "aet-security",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint src",
"test": "vitest"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.2",
"@tanstack/react-query": "^4.29.12",
"lucide-react": "^0.263.1",
"tailwindcss": "^3.3.3",
"zustand": "^4.3.8",
"date-fns": "^2.30.0"
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"typescript": "^5.0.2",
"vite": "^4.4.5",
"vitest": "^0.34.1"
}
}
EOL
npm install
}
# Verificar integridad
verify_integration() {
echo -e "\n${YELLOW}Verificando integridad de la integración...${NC}"
# Lista de archivos críticos que deben existir
critical_files=(
"src/core/MasterControl.ts"
"src/security/AccessControl.ts"
"src/ai/QuantumCore.ts"
"src/components/SecurityPlatform.tsx"
)
for file in "${critical_files[@]}"; do
if [ -f "$PROJECT_NAME/$file" ]; then
echo -e "${GREEN}✓ Verificado: $file${NC}"
else
echo -e "${RED}✗ Falta archivo crítico: $file${NC}"
exit 1
fi
done
}
# Configurar scripts de desarrollo
setup_scripts() {
echo -e "\n${YELLOW}Configurando scripts de desarrollo...${NC}"
cd $PROJECT_NAME
mkdir -p scripts
# Script de desarrollo
cat > scripts/dev.sh << EOL
#!/bin/bash
npm run dev
EOL
# Script de build
cat > scripts/build.sh << EOL
#!/bin/bash
npm run build
EOL
# Script de despliegue
cat > scripts/deploy.sh << EOL
#!/bin/bash
npm run build
npx wrangler pages deploy dist --project-name=aet-security
EOL
chmod +x scripts/*.sh
}
# Función principal
main() {
create_directory_structure
convert_and_move_files
update_references
setup_dependencies
verify_integration
setup_scripts
echo -e "\n${GREEN}¡Integración completada exitosamente!${NC}"
echo -e "Para iniciar el desarrollo:"
echo -e "1. cd $PROJECT_NAME"
echo -e "2. ./scripts/dev.sh"
}
# Manejo de errores
trap 'echo -e "\n${RED}Error: La integración falló. Revisa los logs para más detalles.${NC}"; exit 1' ERR
# Ejecutar
main