workspace-v1/devtools/scripts/epic-008/adapt-simco.sh
rckrdmrd 66161b1566 feat: Workspace-v1 complete migration with NEXUS v3.4
Sistema NEXUS v3.4 migrado con:

Estructura principal:
- core/orchestration: Sistema SIMCO + CAPVED (27 directivas, 28 perfiles)
- core/catalog: Catalogo de funcionalidades reutilizables
- shared/knowledge-base: Base de conocimiento compartida
- devtools/scripts: Herramientas de desarrollo
- control-plane/registries: Control de servicios y CI/CD
- orchestration/: Configuracion de orquestacion de agentes

Proyectos incluidos (11):
- gamilit (submodule -> GitHub)
- trading-platform (OrbiquanTIA)
- erp-suite con 5 verticales:
  - erp-core, construccion, vidrio-templado
  - mecanicas-diesel, retail, clinicas
- betting-analytics
- inmobiliaria-analytics
- platform_marketing_content
- pos-micro, erp-basico

Configuracion:
- .gitignore completo para Node.js/Python/Docker
- gamilit como submodule (git@github.com:rckrdmrd/gamilit-workspace.git)
- Sistema de puertos estandarizado (3005-3199)

Generated with NEXUS v3.4 Migration System
EPIC-010: Configuracion Git y Repositorios
2026-01-04 03:37:42 -06:00

299 lines
8.0 KiB
Bash
Executable File

#!/bin/bash
# adapt-simco.sh - EPIC-008
# Adapta archivos SIMCO de un proyecto a nuevos estandares
# Version: 1.0.0
PROJECT=$1
PROJECT_PATH="/home/isem/workspace-v1/projects/$PROJECT"
GUIDELINES="$PROJECT_PATH/orchestration/00-guidelines"
DOCS="$PROJECT_PATH/docs"
# Colores
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Validar argumento
if [ -z "$PROJECT" ]; then
echo -e "${RED}ERROR: Uso: $0 <proyecto>${NC}"
echo "Ejemplo: $0 gamilit"
exit 1
fi
# Validar proyecto existe
if [ ! -d "$PROJECT_PATH" ]; then
echo -e "${RED}ERROR: Proyecto '$PROJECT' no existe${NC}"
exit 1
fi
echo "=== ADAPTACION SIMCO: $PROJECT ==="
echo ""
# Crear directorios si no existen
mkdir -p "$GUIDELINES"
mkdir -p "$DOCS"
CHANGES=0
DATE=$(date +%Y-%m-%d)
# Contar archivos actuales
docs_count=$(find "$DOCS" -type f 2>/dev/null | wc -l)
orch_count=$(find "$PROJECT_PATH/orchestration" -type f 2>/dev/null | wc -l)
# 1. Crear _MAP.md si no existe
echo "Verificando docs/_MAP.md..."
if [ ! -f "$DOCS/_MAP.md" ]; then
echo -e " ${YELLOW}Creando _MAP.md...${NC}"
cat > "$DOCS/_MAP.md" << EOF
# Mapa de Documentacion: $PROJECT
**Proyecto:** $PROJECT
**Actualizado:** $DATE
**Generado por:** EPIC-008 adapt-simco.sh
---
## Estructura de Documentacion
\`\`\`
docs/
├── _MAP.md # Este archivo (indice de navegacion)
├── 00-overview/ # Vision general del proyecto
├── 01-architecture/ # Arquitectura y decisiones (ADRs)
├── 02-specs/ # Especificaciones tecnicas
├── 03-api/ # Documentacion de APIs
├── 04-guides/ # Guias de desarrollo
└── 99-finiquito/ # Entregables cliente (si aplica)
\`\`\`
## Navegacion Rapida
| Seccion | Descripcion | Estado |
|---------|-------------|--------|
| Overview | Vision general | - |
| Architecture | Decisiones arquitectonicas | - |
| Specs | Especificaciones tecnicas | - |
| API | Documentacion de endpoints | - |
| Guides | Guias de desarrollo | - |
## Estadisticas
- Total archivos en docs/: $docs_count
- Fecha de adaptacion: $DATE
---
**Nota:** Este archivo fue generado automaticamente por EPIC-008.
Actualizar manualmente con la estructura real del proyecto.
EOF
echo -e " ${GREEN}CREADO: docs/_MAP.md${NC}"
CHANGES=$((CHANGES + 1))
else
echo -e " ${GREEN}OK: _MAP.md ya existe${NC}"
fi
# 2. Verificar/Crear HERENCIA-SIMCO.md
echo "Verificando HERENCIA-SIMCO.md..."
if [ ! -f "$GUIDELINES/HERENCIA-SIMCO.md" ]; then
echo -e " ${YELLOW}Creando HERENCIA-SIMCO.md...${NC}"
cat > "$GUIDELINES/HERENCIA-SIMCO.md" << EOF
# HERENCIA SIMCO: $PROJECT
**Proyecto:** $PROJECT
**Tipo:** STANDALONE
**Version:** 1.0.0
**Fecha Adaptacion:** $DATE
---
## CADENA DE HERENCIA
\`\`\`
NIVEL 0: ../../orchestration/ <- Workspace Root
└── NIVEL 1: Este proyecto ($PROJECT)
\`\`\`
## ARCHIVOS HEREDADOS (NO COPIAR)
Los siguientes recursos se heredan del nivel superior y NO deben copiarse localmente:
| Tipo | Ubicacion Relativa | Alias |
|------|-------------------|-------|
| Directivas SIMCO | ../../orchestration/directivas/simco/ | @SIMCO/* |
| Principios | ../../orchestration/directivas/principios/ | @PRINCIPIOS/* |
| Templates | ../../orchestration/templates/ | @TEMPLATES/* |
| Perfiles | ../../orchestration/agents/perfiles/ | @PERFILES/* |
| Aliases | ../../orchestration/referencias/ALIASES.yml | @ALIASES |
## CONTEXT REQUIREMENTS
\`\`\`yaml
CCA_VERSION: "1.0.0"
REQUIRED_CONTEXT:
always:
- "@HERENCIA -> orchestration/00-guidelines/HERENCIA-SIMCO.md"
- "@CONTEXTO -> orchestration/00-guidelines/CONTEXTO-PROYECTO.md"
on_code_task:
- "@SPECS -> docs/"
- "@ARCHITECTURE -> docs/01-architecture/"
on_docs_task:
- "@MAP -> docs/_MAP.md"
\`\`\`
## EXTENSIONES LOCALES
Este proyecto puede EXTENDER (no reemplazar) las directivas del workspace:
| Archivo Local | Proposito |
|---------------|-----------|
| orchestration/directivas/*.md | Directivas especificas del proyecto |
| orchestration/templates/*.md | Templates locales |
## VARIABLES CCA
\`\`\`yaml
PROJECT_NAME: "$PROJECT"
PROJECT_ROOT: "./"
DOCS_ROOT: "./docs"
ORCHESTRATION_ROOT: "./orchestration"
PARENT_ORCHESTRATION: "../../orchestration"
WORKSPACE_ROOT: "/home/isem/workspace-v1"
\`\`\`
---
**Generado por:** EPIC-008 adapt-simco.sh
**Fecha:** $DATE
EOF
echo -e " ${GREEN}CREADO: HERENCIA-SIMCO.md${NC}"
CHANGES=$((CHANGES + 1))
else
echo -e " ${GREEN}OK: HERENCIA-SIMCO.md ya existe${NC}"
# Verificar si tiene rutas absolutas antiguas
if grep -q "/home/isem/workspace/" "$GUIDELINES/HERENCIA-SIMCO.md" 2>/dev/null | grep -v "workspace-v1"; then
echo -e " ${YELLOW}ADVERTENCIA: Puede contener rutas absolutas antiguas${NC}"
fi
fi
# 3. Verificar/Crear CONTEXTO-PROYECTO.md
echo "Verificando CONTEXTO-PROYECTO.md..."
if [ ! -f "$GUIDELINES/CONTEXTO-PROYECTO.md" ]; then
echo -e " ${YELLOW}Creando CONTEXTO-PROYECTO.md...${NC}"
cat > "$GUIDELINES/CONTEXTO-PROYECTO.md" << EOF
# CONTEXTO PROYECTO: $PROJECT
**Proyecto:** $PROJECT
**Fecha:** $DATE
**Generado por:** EPIC-008 adapt-simco.sh
---
## Variables de Proyecto
\`\`\`yaml
PROJECT_NAME: "$PROJECT"
PROJECT_ROOT: "/home/isem/workspace-v1/projects/$PROJECT"
DOCS_ROOT: "/home/isem/workspace-v1/projects/$PROJECT/docs"
ORCHESTRATION_ROOT: "/home/isem/workspace-v1/projects/$PROJECT/orchestration"
\`\`\`
## Stack Tecnologico
| Componente | Tecnologia | Version |
|------------|------------|---------|
| Backend | NestJS | - |
| Frontend | React + Vite | - |
| Database | PostgreSQL | - |
| ORM | Prisma/TypeORM | - |
## Estado del Proyecto
| Metrica | Valor |
|---------|-------|
| Archivos en docs/ | $docs_count |
| Archivos en orchestration/ | $orch_count |
| Fase | Desarrollo |
| Sprint actual | - |
## Dependencias
- workspace-v1/orchestration/ (herencia SIMCO)
- workspace-v1/core/modules/ (modulos compartidos)
---
**Nota:** Actualizar este archivo con informacion especifica del proyecto.
EOF
echo -e " ${GREEN}CREADO: CONTEXTO-PROYECTO.md${NC}"
CHANGES=$((CHANGES + 1))
else
echo -e " ${GREEN}OK: CONTEXTO-PROYECTO.md ya existe${NC}"
fi
# 4. Verificar/Crear PROJECT-STATUS.md
echo "Verificando PROJECT-STATUS.md..."
if [ ! -f "$GUIDELINES/PROJECT-STATUS.md" ]; then
echo -e " ${YELLOW}Creando PROJECT-STATUS.md...${NC}"
cat > "$GUIDELINES/PROJECT-STATUS.md" << EOF
# PROJECT STATUS: $PROJECT
**Ultima actualizacion:** $DATE
**Estado general:** Activo
---
## Metricas Rapidas
| Metrica | Valor |
|---------|-------|
| Archivos docs/ | $docs_count |
| Archivos orchestration/ | $orch_count |
| Estado SIMCO | Adaptado |
## Migracion EPIC-008
- [x] Migracion desde workspace-v1-bckp (EPIC-004/005)
- [x] Adaptacion SIMCO (EPIC-008)
- [x] docs/_MAP.md creado
- [x] PROJECT-STATUS.md creado
- [x] HERENCIA-SIMCO.md verificado
- [x] CONTEXTO-PROYECTO.md verificado
## Historial de Cambios
| Fecha | Cambio | EPIC |
|-------|--------|------|
| $DATE | Adaptacion SIMCO completada | EPIC-008 |
---
**Generado por:** EPIC-008 adapt-simco.sh
EOF
echo -e " ${GREEN}CREADO: PROJECT-STATUS.md${NC}"
CHANGES=$((CHANGES + 1))
else
echo -e " ${GREEN}OK: PROJECT-STATUS.md ya existe${NC}"
fi
# Resumen
echo ""
echo "=== RESUMEN ==="
echo "Archivos creados/actualizados: $CHANGES"
echo ""
if [ "$CHANGES" -gt 0 ]; then
echo -e "${GREEN}Adaptacion completada para: $PROJECT${NC}"
else
echo -e "${BLUE}Proyecto ya estaba adaptado: $PROJECT${NC}"
fi
# Verificar estado final
echo ""
echo "Estado final SIMCO:"
[ -f "$DOCS/_MAP.md" ] && echo -e " _MAP.md: ${GREEN}OK${NC}" || echo -e " _MAP.md: ${RED}FALTA${NC}"
[ -f "$GUIDELINES/HERENCIA-SIMCO.md" ] && echo -e " HERENCIA-SIMCO.md: ${GREEN}OK${NC}" || echo -e " HERENCIA-SIMCO.md: ${RED}FALTA${NC}"
[ -f "$GUIDELINES/CONTEXTO-PROYECTO.md" ] && echo -e " CONTEXTO-PROYECTO.md: ${GREEN}OK${NC}" || echo -e " CONTEXTO-PROYECTO.md: ${RED}FALTA${NC}"
[ -f "$GUIDELINES/PROJECT-STATUS.md" ] && echo -e " PROJECT-STATUS.md: ${GREEN}OK${NC}" || echo -e " PROJECT-STATUS.md: ${RED}FALTA${NC}"