diff --git a/orchestration/BOOTLOADER.md b/orchestration/BOOTLOADER.md new file mode 100644 index 00000000..cd1bd017 --- /dev/null +++ b/orchestration/BOOTLOADER.md @@ -0,0 +1,202 @@ +# BOOTLOADER - Template SaaS + +**Sistema:** NEXUS v4.0 - Protocolo de Arranque Local +**Proyecto:** Template SaaS +**Tipo:** PROVIDER +**Version:** 1.0.0 +**Fecha:** 2026-01-24 + +--- + +## 1. Proposito + +Este BOOTLOADER define la secuencia de arranque especifica para Template SaaS. +Como proyecto PROVIDER, este template exporta patrones a otros proyectos. + +--- + +## 2. Secuencia de Arranque (5 Pasos) + +``` +┌─────────────────────────────────────────────────────────────────────────┐ +│ BOOTLOADER TEMPLATE-SAAS - 5 PASOS │ +├─────────────────────────────────────────────────────────────────────────┤ +│ │ +│ PASO 1: Cargar L0 (Sistema - Workspace) │ +│ ════════════════════════════════════════ │ +│ ├── Leer workspace-v2/CLAUDE.md │ +│ ├── Verificar aliases del workspace disponibles │ +│ └── Tokens: ~4000 │ +│ │ │ +│ ▼ │ +│ PASO 2: Cargar L1 (Proyecto - Template SaaS) │ +│ ════════════════════════════════════════ │ +│ ├── Leer .claude/README.md (instrucciones locales) │ +│ ├── Leer orchestration/CONTEXT-MAP.yml (variables resueltas) │ +│ ├── Leer orchestration/_inheritance.yml (modelo de herencia) │ +│ └── Tokens: ~2500 │ +│ │ │ +│ ▼ │ +│ PASO 3: Determinar Dominio │ +│ ════════════════════════════════════════ │ +│ ├── Clasificar tarea (DDL, Backend, Frontend, Docs) │ +│ ├── Cargar SIMCO del dominio │ +│ └── Cargar inventario del dominio │ +│ │ │ +│ ▼ │ +│ PASO 4: Verificar Estado │ +│ ════════════════════════════════════════ │ +│ ├── git fetch origin && git status │ +│ ├── Verificar si hay trabajo en progreso │ +│ └── Verificar consumidores afectados (erp-core, erp-suite) │ +│ │ │ +│ ▼ │ +│ PASO 5: Iniciar Tarea │ +│ ════════════════════════════════════════ │ +│ ├── Crear carpeta de tarea si no existe │ +│ ├── Ejecutar FASE C de CAPVED │ +│ └── Evaluar propagacion a consumidores │ +│ │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +--- + +## 3. Archivos a Cargar por Paso + +### PASO 1: L0 Sistema (~4000 tokens) +```yaml +obligatorio: + - path: "../../CLAUDE.md" + proposito: "Instrucciones del workspace" + tokens: 4000 +``` + +### PASO 2: L1 Proyecto (~2500 tokens) +```yaml +obligatorio: + - path: ".claude/README.md" + proposito: "Instrucciones locales Template SaaS" + tokens: 500 + + - path: ".claude/constants/CONSTANTS-PROJECT.yml" + proposito: "Constantes del proyecto" + tokens: 400 + + - path: "orchestration/CONTEXT-MAP.yml" + proposito: "Variables y aliases resueltos" + tokens: 800 + + - path: "orchestration/_inheritance.yml" + proposito: "Modelo de herencia PROVIDER" + tokens: 400 + + - path: "orchestration/inventarios/MASTER_INVENTORY.yml" + proposito: "Estado de artefactos" + tokens: 400 +``` + +### PASO 3: L2 Operacion (variable, ~2500 tokens) +```yaml +por_dominio: + DDL: + - "workspace-v2/orchestration/directivas/simco/SIMCO-DDL.md" + - "orchestration/inventarios/DATABASE_INVENTORY.yml" + + Backend: + - "workspace-v2/orchestration/directivas/simco/SIMCO-BACKEND.md" + - "orchestration/inventarios/BACKEND_INVENTORY.yml" + + Frontend: + - "workspace-v2/orchestration/directivas/simco/SIMCO-FRONTEND.md" + - "orchestration/inventarios/FRONTEND_INVENTORY.yml" +``` + +--- + +## 4. Rol PROVIDER + +Template SaaS es un proyecto **PROVIDER**: + +```yaml +exporta_a: + - erp-core # Hereda patrones SaaS base + - erp-suite # Hereda arquitectura multitenancy + +patrones_canonicos: + - multitenancy (schema-per-tenant) + - feature_flags + - subscriptions + - rate_limiting + - audit_logging + +regla_propagacion: | + Cambios en patrones SaaS DEBEN propagarse a consumidores. + Usar @PROPAGATE-CODE para codigo. + Usar @PROPAGATE-DOC para documentacion. +``` + +--- + +## 5. Variables Pre-Resueltas + +```yaml +# Paths principales +PROJECT_ROOT: projects/template-saas +BACKEND_ROOT: projects/template-saas/backend +FRONTEND_ROOT: projects/template-saas/frontend +DATABASE_ROOT: projects/template-saas/database + +# Base de datos +DB_NAME: template_saas_db +DB_USER: template_saas_user +DB_PASSWORD: saas_dev_2026 +DB_PORT: 5432 + +# Schemas +SCHEMAS: + - public + - tenants + - subscriptions +``` + +--- + +## 6. Checklist de Arranque + +### Al Iniciar Sesion en Template SaaS + +- [ ] PASO 1: workspace-v2/CLAUDE.md leido +- [ ] PASO 2: .claude/README.md leido +- [ ] PASO 2: CONTEXT-MAP.yml cargado +- [ ] PASO 2: _inheritance.yml verificado +- [ ] PASO 3: Dominio identificado +- [ ] PASO 3: SIMCO del dominio cargado +- [ ] PASO 4: git fetch ejecutado +- [ ] PASO 4: Consumidores identificados +- [ ] PASO 5: Propagacion evaluada + +### Presupuesto de Tokens + +| Nivel | Tokens | Descripcion | +|-------|--------|-------------| +| L0 Sistema | 4,000 | Workspace CLAUDE.md | +| L1 Proyecto | 2,500 | Template SaaS local | +| L2 Operacion | 2,500 | SIMCO + inventario | +| L3 Tarea | 8,000 | Contexto especifico | +| **Total base** | **9,000** | Sin tarea | +| **Total maximo** | **17,000** | Con tarea | + +--- + +## 7. Referencias + +- **BOOTLOADER Global:** `workspace-v2/orchestration/directivas/simco/SIMCO-BOOTLOADER.md` +- **CONTEXT-MAP:** `orchestration/CONTEXT-MAP.yml` +- **Herencia:** `orchestration/_inheritance.yml` +- **README Local:** `.claude/README.md` + +--- + +*BOOTLOADER Template SaaS v1.0.0 - Sistema NEXUS v4.0* +*Tipo: PROVIDER - Exporta a erp-core, erp-suite*