workspace-v1/04-fase-proyectos/gamilit/PROMPTS/PROMPT-MIGRATION-AGENT.md
Adrian Flores Cortes 967ab360bb Initial commit: Workspace v1 with 3-layer architecture
Structure:
- control-plane/: Registries, SIMCO directives, CI/CD templates
- projects/: Gamilit, ERP-Suite, Trading-Platform, Betting-Analytics
- shared/: Libs catalog, knowledge-base

Key features:
- Centralized port, domain, database, and service registries
- 23 SIMCO directives + 6 fundamental principles
- NEXUS agent profiles with delegation rules
- Validation scripts for workspace integrity
- Dockerfiles for all services
- Path aliases for quick reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:35:19 -06:00

312 lines
7.4 KiB
Markdown

# PROMPT: MIGRATION AGENT - GAMILIT
**Proyecto:** Gamilit Platform
**Fase:** 4.1 - Migracion de Gamilit
**Version:** 1.0.0
---
## PROMPT DE INICIALIZACION
```markdown
Seras un agente de migracion trabajando en la migracion de Gamilit
al nuevo modelo de repositorio independiente.
## CONTEXTO
El proyecto Gamilit es una plataforma SaaS de gamificacion educativa.
Es el proyecto mas avanzado (60% MVP) y servira como MODELO para migrar
los demas proyectos.
### Ubicacion actual
/home/adrian/Documentos/workspace/projects/gamilit/
### Destino
/home/adrian/Documentos/workspace-v1/repos/gamilit-platform/
### Control Plane
/home/adrian/Documentos/workspace-v1/control-plane/
## TUS TAREAS
### 1. Crear Estructura Base
```bash
# Crear directorios
mkdir -p gamilit-platform/{apps/{backend,frontend,database/{ddl,seeds,migrations}},docker,orchestration,docs,.github/workflows}
# Crear package.json root con workspaces
# Crear README.md
# Crear .gitignore
```
### 2. Crear Service Descriptors
Crear `service.descriptor.yml` en:
- apps/backend/service.descriptor.yml
- apps/frontend/service.descriptor.yml
IMPORTANTE: Los descriptors DEBEN referenciar los registries correctos:
- ports.registry_ref: "projects.gamilit.api" (para backend)
- ports.registry_ref: "projects.gamilit.web" (para frontend)
- database.registry_ref: "gamilit"
Usar el standard definido en:
/home/adrian/Documentos/workspace-v1/02-fase-core-orchestration/ARTEFACTOS/SERVICE-DESCRIPTOR-STANDARD.md
### 3. Migrar Codigo
```bash
# Backend
cp -r workspace/projects/gamilit/backend/* gamilit-platform/apps/backend/
# Frontend
cp -r workspace/projects/gamilit/frontend/* gamilit-platform/apps/frontend/
# Database
cp -r workspace/projects/gamilit/database/* gamilit-platform/apps/database/
```
Despues de copiar:
- Actualizar imports si es necesario
- Actualizar paths en tsconfig.json
- Verificar que no hay referencias hardcodeadas
### 4. Crear Docker Compose
Crear en docker/:
- docker-compose.yml (principal)
- docker-compose.dev.yml (overrides para dev)
- .env.example
REGLAS IMPORTANTES:
- NO usar "ports:", usar "expose:"
- Conectar a redes: gamilit_${ENV:-local} e infra_shared
- Las redes deben ser external: true
- Usar labels de Traefik para routing
### 5. Migrar Orchestration
```bash
cp -r workspace/projects/gamilit/orchestration/* gamilit-platform/orchestration/
```
Actualizar paths en los archivos migrados.
### 6. Validacion
```bash
# 1. Validar service descriptors
python3 -c "import yaml; yaml.safe_load(open('apps/backend/service.descriptor.yml'))"
# 2. Validar build
cd apps/backend && npm install && npm run build
cd apps/frontend && npm install && npm run build
# 3. Validar docker
cd docker && docker-compose config
# 4. Probar localmente
docker-compose up -d
curl http://api.gamilit.localhost/health
```
## REGISTRIES DE REFERENCIA
### ports.registry.yml (extracto)
```yaml
projects:
gamilit:
services:
api:
internal: 3000
protocol: "http"
healthcheck: "/health"
web:
internal: 3001
protocol: "http"
websocket:
internal: 3002
protocol: "ws"
```
### domains.registry.yml (extracto)
```yaml
gamilit:
local:
api: "api.gamilit.localhost"
web: "gamilit.localhost"
development:
api: "api.gamilit.dev.example.com"
web: "gamilit.dev.example.com"
```
### databases.registry.yml (extracto)
```yaml
gamilit:
database: "gamilit_db"
port: 5432
roles:
owner: "gamilit_owner"
runtime: "gamilit_app"
migrator: "gamilit_migrator"
schemas:
- "public"
- "auth"
- "gamification"
```
## RESTRICCIONES
1. NO modificar el workspace actual
2. NO exponer puertos directamente (solo via Traefik)
3. Service descriptors DEBEN referenciar registries existentes
4. Docker networks DEBEN ser external
5. Variables sensibles en .env, NO en compose
## ENTREGABLES
1. Estructura de carpetas completa
2. service.descriptor.yml para backend y frontend
3. Codigo migrado y funcional
4. docker-compose.yml con redes aisladas
5. .env.example documentado
6. orchestration/ migrado
7. Build exitoso
8. Docker compose levanta sin errores
## PROTOCOLO
1. Leer analisis en ANALISIS/
2. Ejecutar tareas de PLANEACION/00-TAREAS.md
3. Documentar progreso en IMPLEMENTACION/00-EJECUCION.md
4. Validar contra VALIDACION/CHECKLIST.md
5. Reportar issues encontrados
```
---
## TEMPLATE: docker-compose.yml
```yaml
# ==============================================================================
# docker-compose.yml - Gamilit Platform
# ==============================================================================
# Uso: docker-compose up -d
# Prerequisitos:
# - Redes creadas (gamilit_local, infra_shared)
# - Traefik corriendo
# - .env configurado
# ==============================================================================
version: "3.8"
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
# ==========================================================================
# BACKEND - gamilit-api
# ==========================================================================
gamilit-api:
build:
context: ../apps/backend
dockerfile: Dockerfile
container_name: gamilit-api
restart: unless-stopped
# IMPORTANTE: usar expose, NO ports
expose:
- "3000"
environment:
- NODE_ENV=${NODE_ENV:-development}
- PORT=3000
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-1d}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# Labels para Traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.gamilit-api.rule=Host(`api.gamilit.localhost`)"
- "traefik.http.routers.gamilit-api.entrypoints=web"
- "traefik.http.services.gamilit-api.loadbalancer.server.port=3000"
networks:
- gamilit_${ENV:-local}
- infra_shared
logging:
<<: *default-logging
# ==========================================================================
# FRONTEND - gamilit-web
# ==========================================================================
gamilit-web:
build:
context: ../apps/frontend
dockerfile: Dockerfile
container_name: gamilit-web
restart: unless-stopped
expose:
- "3001"
environment:
- NODE_ENV=${NODE_ENV:-development}
- REACT_APP_API_URL=${REACT_APP_API_URL:-http://api.gamilit.localhost}
labels:
- "traefik.enable=true"
- "traefik.http.routers.gamilit-web.rule=Host(`gamilit.localhost`)"
- "traefik.http.routers.gamilit-web.entrypoints=web"
- "traefik.http.services.gamilit-web.loadbalancer.server.port=3001"
networks:
- gamilit_${ENV:-local}
- infra_shared
depends_on:
- gamilit-api
logging:
<<: *default-logging
# ==============================================================================
# NETWORKS
# ==============================================================================
networks:
gamilit_${ENV:-local}:
external: true
infra_shared:
external: true
```
---
## NOTAS
- Gamilit es el proyecto MODELO - lo que se defina aqui se replicara
- Tomarse el tiempo para hacerlo bien
- Documentar cualquier decision de diseno
- Cualquier issue encontrado debe documentarse para evitarlo en otros proyectos
---
**Documento generado por:** Tech-Leader