# FASE 3: PLAN DE ESTANDARIZACION DE DOCUMENTACION # ERP Core - Plan de Accion Detallado --- ## METADATOS | Campo | Valor | |-------|-------| | **Fase** | 3 - Planeacion basada en Analisis | | **Proyecto** | ERP Core | | **Fecha** | 2026-01-10 | | **Orquestador** | PERFIL-ORQUESTADOR | | **Metodologia** | CAPVED + SIMCO v3.8 | | **Estado** | COMPLETADO | | **Documento Anterior** | F2-ANALISIS-DETALLADO-DOCUMENTACION-2026-01-10.md | --- ## 1. RESUMEN DEL PLAN ### 1.1 Objetivos 1. Corregir errores criticos en inventarios YAML 2. Actualizar especificaciones tecnicas desactualizadas 3. Crear documentacion faltante para modulos verticales 4. Estandarizar nomenclatura de archivos y directorios 5. Sincronizar inventarios con estado actual del codigo ### 1.2 Metricas Meta | Metrica | Actual | Meta | Incremento | |---------|--------|------|------------| | Completitud Global | 62% | 95% | +33% | | Sync Codigo-Docs | 40% | 90% | +50% | | Nomenclatura | 77% | 95% | +18% | | Inventarios | 70% | 100% | +30% | ### 1.3 Esfuerzo Total Estimado ``` PRIORIDAD P0 (Criticos): 62-70 horas PRIORIDAD P1 (Altos): 40-45 horas PRIORIDAD P2 (Medios): 19-20 horas ──────────────────────────────────────── TOTAL: 121-135 horas ``` --- ## 2. PLAN DE EJECUCION POR PRIORIDAD ### 2.1 SPRINT 1: CORRECCIONES CRITICAS (P0) **Duracion estimada:** 3-4 dias **Esfuerzo:** 62-70 horas **Perfiles:** DOCUMENTATION, DOCUMENTATION-MAINTAINER #### BLOQUE A: Correcciones Inventarios (8 horas) | Tarea | ID | Archivo | Accion | Esfuerzo | Perfil | |-------|-----|---------|--------|----------|--------| | A1 | GAP-P0-004 | MASTER_INVENTORY.yml | Corregir estructura YAML lineas 1054-1102 | 1h | DOC-MAINT | | A2 | GAP-P0-013 | BACKEND_INVENTORY.yml | Agregar MGN-005 a MGN-010 | 4h | DOC | | A3 | GAP-P0-014 | FRONTEND_INVENTORY.yml | Agregar MGN-005 a MGN-009 | 4h | DOC | | A4 | GAP-P0-015 | DEPENDENCY_GRAPH.yml | Actualizar (36 dias desactualizado) | 2h | DOC | | A5 | GAP-P1-005 | TRACEABILITY_MATRIX.yml | Actualizar metricas y test_coverage | 2h | DOC | **Orden de ejecucion:** A1 → A4 → A5 → A2 → A3 #### BLOQUE B: Actualizacion ET Existentes (14 horas) | Tarea | ID | Archivo | Servicios a Documentar | Esfuerzo | Perfil | |-------|-----|---------|------------------------|----------|--------| | B1 | GAP-P0-002 | ET-auth-backend.md | mfa, trusted-devices, email-verification, permission-cache, apiKeys, oauth | 6h | DOC | | B2 | GAP-P0-003 | ET-FIN-backend.md | invoices, payments, payment-methods, payment-terms, journal-entries, reconcile-models, taxes, incoterms | 8h | DOC | **Detalle B1 - ET-auth-backend.md:** ```yaml servicios_a_agregar: - nombre: mfa.service.ts entidades: [user-mfa.entity.ts, mfa-audit-log.entity.ts] endpoints: [POST /mfa/setup, POST /mfa/verify, POST /mfa/disable] tests: 45 - nombre: trusted-devices.service.ts entidades: [trusted-device.entity.ts] endpoints: [GET /devices, DELETE /devices/:id] tests: 41 - nombre: email-verification.service.ts entidades: [email-verification-token.entity.ts, verification-code.entity.ts] endpoints: [POST /verify-email, POST /resend-verification] tests: 32 - nombre: permission-cache.service.ts entidades: [] endpoints: [] tests: 37 - nombre: apiKeys.service.ts entidades: [api-key.entity.ts] endpoints: [POST /api-keys, GET /api-keys, DELETE /api-keys/:id] tests: - - nombre: oauth.service.ts entidades: [oauth-provider.entity.ts, oauth-state.entity.ts, oauth-user-link.entity.ts] endpoints: [GET /oauth/:provider, GET /oauth/:provider/callback] tests: 32 servicios_a_eliminar: - password.service.ts (no existe) - blacklist.service.ts (no existe) ``` **Detalle B2 - ET-FIN-backend.md:** ```yaml servicios_a_agregar: - nombre: invoices.service.ts entidades: [invoice.entity.ts, invoice-line.entity.ts] endpoints: [CRUD /invoices] - nombre: payments.service.ts entidades: [payment.entity.ts, payment-invoice.entity.ts] endpoints: [CRUD /payments, POST /payments/:id/reconcile] tests: 36 - nombre: payment-methods.service.ts entidades: [payment-method.entity.ts] endpoints: [CRUD /payment-methods] - nombre: payment-terms.service.ts entidades: [payment-term.entity.ts, payment-term-line.entity.ts] endpoints: [CRUD /payment-terms] - nombre: journal-entries.service.ts entidades: [journal-entry.entity.ts, journal-entry-line.entity.ts] endpoints: [CRUD /journal-entries, POST /journal-entries/:id/post] - nombre: reconcile-models.service.ts entidades: [reconcile-model.entity.ts, reconcile-model-line.entity.ts] endpoints: [CRUD /reconcile-models] - nombre: taxes.service.ts entidades: [tax.entity.ts] endpoints: [CRUD /taxes] - nombre: incoterms.service.ts entidades: [incoterm.entity.ts] endpoints: [CRUD /incoterms] ``` #### BLOQUE C: Creacion ET Modulos Verticales (40-48 horas) | Tarea | ID | Modulo | Servicios | Esfuerzo | Perfil | |-------|-----|--------|-----------|----------|--------| | C1 | GAP-P0-005 | MGN-011 Sales | customer-groups, sales-teams, orders, quotations, pricelists | 5h | DOC | | C2 | GAP-P0-006 | MGN-012 Purchases | purchases, rfqs | 3h | DOC | | C3 | GAP-P0-007 | MGN-013 Inventory | locations, warehouses, pickings, valuation, adjustments, products, lots, stock-quants, package-types | 8h | DOC | | C4 | GAP-P0-008 | MGN-014 HR | leaves, contracts, skills, departments, employees, payslips, expenses | 6h | DOC | | C5 | GAP-P0-009 | MGN-015 CRM | stages, leads, tags, opportunities | 4h | DOC | | C6 | GAP-P0-010 | MGN-016 Projects | timesheets, projects, tasks | 3h | DOC | | C7 | GAP-P0-011 | MGN-017 Partners | partners, ranking | 2h | DOC | | C8 | GAP-P0-012 | MGN-018 Companies | companies | 1h | DOC | **Estructura a crear por modulo:** ``` docs/03-fase-vertical/MGN-0XX-{modulo}/ ├── README.md ├── _MAP.md ├── requerimientos/ │ ├── RF-{MOD}-001.md │ └── INDICE-RF-{MOD}.md ├── especificaciones/ │ ├── ET-{MOD}-backend.md │ └── ET-{MOD}-frontend.md ├── historias-usuario/ │ └── BACKLOG-{MOD}.md └── implementacion/ └── TRACEABILITY.yml ``` **Contenido minimo ET-*-backend.md:** ```yaml estructura: - Metadatos (version, fecha, estado) - Servicios (lista completa con metodos) - Entidades TypeORM (campos, relaciones) - DTOs (CreateDto, UpdateDto, ResponseDto) - Controllers (endpoints REST) - Guards/Middlewares aplicables - Tests existentes - Dependencias entre modulos ``` --- ### 2.2 SPRINT 2: ESTANDARIZACION (P1) **Duracion estimada:** 2-3 dias **Esfuerzo:** 40-45 horas **Perfiles:** DOCUMENTATION-MAINTAINER, CODE-REVIEWER #### BLOQUE D: Nomenclatura (12 horas) | Tarea | ID | Descripcion | Archivos | Esfuerzo | Perfil | |-------|-----|-------------|----------|----------|--------| | D1 | GAP-P1-001 | Renombrar archivos FASE-X | 30 archivos | 2h | DOC-MAINT | | D2 | GAP-P1-002 | Normalizar ET a UPPERCASE | 8 archivos | 0.5h | DOC-MAINT | | D3 | GAP-P1-003 | Estandarizar DDL-SPEC | 25 archivos | 3h | DOC-MAINT | | D4 | GAP-P1-008 | Numerar directorios | 59 directorios | 3h | DOC-MAINT | | D5 | GAP-P1-012 | Prefijos archivos restantes | 96 archivos | 4h | DOC-MAINT | **Mapeo de renombrado D1:** ``` FASE-1-PLAN-COMPARACION-ODOO.md → PLAN-COMPARACION-ODOO-2025-12-XX.md FASE-2-ANALISIS-DETALLADO-DOC-VS-DEV.md → ANALISIS-DOC-VS-DEV-2025-12-XX.md FASE-3-PLAN-CORRECCIONES-ODOO.md → PLAN-CORRECCIONES-ODOO-2025-12-XX.md FASE-4-VALIDACION-DEPENDENCIAS.md → VALIDACION-DEPENDENCIAS-2025-12-XX.md FASE-5-REFINAMIENTO-PLAN.md → PLAN-REFINADO-FASE5-2025-12-XX.md FASE-6-REPORTE-EJECUCION.md → REPORTE-EJECUCION-FASE6-2025-12-XX.md ... ``` **Mapeo de renombrado D2:** ``` ET-auth-backend.md → ET-AUTH-BACKEND.md ET-rbac-backend.md → ET-RBAC-BACKEND.md ET-tenants-backend.md → ET-TENANTS-BACKEND.md ET-users-backend.md → ET-USERS-BACKEND.md hr-domain.md → ET-BACKEND-HR.md ``` **Patron DDL-SPEC D3:** ``` DDL-SPEC-core_auth.md → ET-DATABASE-AUTH-DDL.md DDL-SPEC-core_users.md → ET-DATABASE-USERS-DDL.md DDL-SPEC-billing.md → ET-DATABASE-BILLING-DDL.md ... ``` **Numeracion directorios D4:** ``` orchestration/agentes/ → orchestration/06-agentes/ orchestration/analisis/ → orchestration/07-analisis-historico/ orchestration/directivas/ → orchestration/08-directivas/ orchestration/prompts/ → orchestration/09-prompts/ orchestration/sessions/ → orchestration/10-sessions/ orchestration/trazas/ → orchestration/11-trazas/ orchestration/environment/ → orchestration/12-environment/ orchestration/estados/ → orchestration/13-estados/ orchestration/propagacion/ → orchestration/14-propagacion/ ``` #### BLOQUE E: Estructura (8 horas) | Tarea | ID | Descripcion | Esfuerzo | Perfil | |-------|-----|-------------|----------|--------| | E1 | GAP-P1-004 | Organizar 16 archivos huerfanos | 1h | DOC-MAINT | | E2 | GAP-P1-009 | Crear _MAP.md por fase | 1h | DOC | | E3 | GAP-P0-001 | Completar estructura modulos verticales | 4h | DOC | | E4 | GAP-P1-011 | Sincronizar conteos inventarios | 2h | DOC | **Reorganizacion E1:** ``` docs/ ├── 00-planning/ (NUEVO) │ ├── PLAN-DOCUMENTACION-ERP-GENERICO.md │ ├── PLAN-DESARROLLO-FRONTEND.md │ ├── PLAN-EXPANSION-BACKEND.md │ ├── PLAN-MAESTRO-MIGRACION-CONSOLIDACION.md │ ├── SPRINT-PLAN-FASE-1.md │ ├── LANZAR-FASE-0.md │ ├── INSTRUCCIONES-AGENTE-ARQUITECTURA.md │ └── FRONTEND-PRIORITY-MATRIX.md │ ├── 00-reports/ (NUEVO) │ ├── CORRECCION-GAP-001-REPORTE.md │ ├── CORRECCION-GAP-002-REPORTE.md │ ├── REPORTE-ALINEACION-DDL-SPECS.md │ ├── REPORTE-REVALIDACION-TECNICA-COMPLETA.md │ └── RESUMEN-EJECUTIVO-REVALIDACION.md ``` #### BLOQUE F: Tests y Sincronizacion (20 horas) | Tarea | ID | Descripcion | Modulos | Esfuerzo | Perfil | |-------|-----|-------------|---------|----------|--------| | F1 | GAP-P1-006 | Implementar tests faltantes | companies, reports, crm | 12h | TESTING | | F2 | GAP-P1-007 | Implementar tests faltantes | projects, notifications | 8h | TESTING | | F3 | GAP-P1-010 | Verificar DDL vs Entidades ORM | Todos | 4h | DB-AUDITOR | --- ### 2.3 SPRINT 3: MEJORAS (P2) **Duracion estimada:** 1-2 dias **Esfuerzo:** 19-20 horas **Perfiles:** DOCUMENTATION, ARCHITECTURE-ANALYST #### BLOQUE G: Mejoras Adicionales | Tarea | ID | Descripcion | Esfuerzo | Perfil | |-------|-----|-------------|----------|--------| | G1 | GAP-P2-001 | Documentar integraciones externas (Stripe, OAuth, etc.) | 4h | DOC | | G2 | GAP-P2-002 | Prefijo REF- para archivos referencia | 0.5h | DOC-MAINT | | G3 | GAP-P2-003 | Crear indices tematicos adicionales | 2h | DOC | | G4 | GAP-P2-004 | Crear script validacion cruzada inventarios | 3h | DEVOPS | | G5 | GAP-P2-005 | Documentar DTOs en ET existentes | 6h | DOC | | G6 | GAP-P2-006 | Crear mapa visual dependencias | 2h | ARCH-ANALYST | | G7 | GAP-P2-007 | Estandarizar campo updated_by en inventarios | 1h | DOC-MAINT | | G8 | GAP-P2-008 | Crear CONVENCIONES.md de nomenclatura | 1h | DOC | --- ## 3. CRONOGRAMA DE EJECUCION ``` SPRINT 1 (P0): Correcciones Criticas ├── Dia 1: Bloques A (Inventarios) ├── Dia 2: Bloque B (ET existentes) ├── Dia 3: Bloque C1-C4 (ET verticales) └── Dia 4: Bloque C5-C8 (ET verticales) SPRINT 2 (P1): Estandarizacion ├── Dia 5: Bloque D (Nomenclatura) ├── Dia 6: Bloque E (Estructura) └── Dia 7: Bloque F (Tests/Sync) SPRINT 3 (P2): Mejoras ├── Dia 8: Bloque G1-G4 └── Dia 9: Bloque G5-G8 ``` --- ## 4. ASIGNACION DE PERFILES ### 4.1 Matriz de Responsabilidad | Perfil | Bloques Asignados | Tareas | Horas | |--------|-------------------|--------|-------| | PERFIL-DOCUMENTATION | A2-A5, B1-B2, C1-C8, E2-E4, G1, G3, G5 | 18 | 70h | | PERFIL-DOCUMENTATION-MAINTAINER | A1, D1-D5, E1, G2, G7, G8 | 9 | 18h | | PERFIL-TESTING | F1-F2 | 2 | 20h | | PERFIL-DATABASE-AUDITOR | F3 | 1 | 4h | | PERFIL-DEVOPS | G4 | 1 | 3h | | PERFIL-ARCHITECTURE-ANALYST | G6 | 1 | 2h | ### 4.2 Delegacion de Tareas ```yaml delegacion_paralela: batch_1: # Dia 1 - perfil: DOCUMENTATION-MAINTAINER tarea: A1 (MASTER_INVENTORY.yml) - perfil: DOCUMENTATION tarea: A4 (DEPENDENCY_GRAPH.yml) batch_2: # Dia 2 - perfil: DOCUMENTATION tarea: B1 (ET-auth-backend.md) - perfil: DOCUMENTATION tarea: B2 (ET-FIN-backend.md) batch_3: # Dia 3-4 - perfil: DOCUMENTATION tareas: [C1, C2, C3, C4] - perfil: DOCUMENTATION tareas: [C5, C6, C7, C8] ``` --- ## 5. CHECKLISTS DE VALIDACION ### 5.1 Checklist Sprint 1 ```markdown ## Bloque A - Inventarios - [ ] A1: MASTER_INVENTORY.yml sin errores YAML - [ ] A2: BACKEND_INVENTORY.yml tiene MGN-005 a MGN-010 - [ ] A3: FRONTEND_INVENTORY.yml tiene MGN-005 a MGN-009 - [ ] A4: DEPENDENCY_GRAPH.yml actualizado a 2026-01-10 - [ ] A5: TRACEABILITY_MATRIX.yml con test_coverage correcto ## Bloque B - ET Existentes - [ ] B1: ET-auth-backend.md tiene 6 servicios nuevos - [ ] B1: ET-auth-backend.md NO tiene password.service, blacklist.service - [ ] B2: ET-FIN-backend.md tiene 8 servicios nuevos ## Bloque C - ET Verticales - [ ] C1: MGN-011 Sales tiene ET completa - [ ] C2: MGN-012 Purchases tiene ET completa - [ ] C3: MGN-013 Inventory tiene ET completa - [ ] C4: MGN-014 HR tiene ET completa - [ ] C5: MGN-015 CRM tiene ET completa - [ ] C6: MGN-016 Projects tiene ET completa - [ ] C7: MGN-017 Partners tiene ET completa - [ ] C8: MGN-018 Companies tiene ET completa ``` ### 5.2 Checklist Sprint 2 ```markdown ## Bloque D - Nomenclatura - [ ] D1: 0 archivos con prefijo FASE-X - [ ] D2: Todos los ET en UPPERCASE - [ ] D3: DDL-SPEC estandarizado a ET-DATABASE-* - [ ] D4: Todos directorios con prefijo numerico - [ ] D5: 0 archivos MD sin prefijo valido ## Bloque E - Estructura - [ ] E1: 0 archivos huerfanos en raiz docs/ - [ ] E2: _MAP.md existe en 01-fase-foundation/, 02-fase-core-business/, 03-fase-vertical/ - [ ] E3: Todos modulos verticales con estructura completa - [ ] E4: Conteos consistentes entre inventarios ## Bloque F - Tests/Sync - [ ] F1: companies, reports, crm tienen tests - [ ] F2: projects, notifications tienen tests - [ ] F3: Reporte DDL vs ORM sin discrepancias criticas ``` ### 5.3 Checklist Sprint 3 ```markdown ## Bloque G - Mejoras - [ ] G1: Documentacion integraciones: Stripe, OAuth, Email, WebSocket - [ ] G2: Archivos referencia con prefijo REF- - [ ] G3: Indices tematicos creados - [ ] G4: Script validate-inventories.sh funcional - [ ] G5: DTOs documentados en ET principales - [ ] G6: Mapa visual de dependencias creado - [ ] G7: Campo updated_by consistente - [ ] G8: CONVENCIONES.md creado ``` --- ## 6. RIESGOS Y MITIGACIONES | Riesgo | Probabilidad | Impacto | Mitigacion | |--------|--------------|---------|------------| | Archivos con referencias cruzadas | Media | Alto | Validar dependencias antes de renombrar | | Codigo depende de rutas de docs | Baja | Alto | Verificar imports/referencias en codigo | | Inventarios con datos incorrectos | Media | Medio | Validar contra codigo fuente | | Estructura inconsistente post-cambio | Media | Medio | Ejecutar validacion post-ejecucion | --- ## 7. CRITERIOS DE EXITO ### 7.1 Metricas de Completitud | Metrica | Actual | Meta Sprint 1 | Meta Final | |---------|--------|---------------|------------| | Modulos con ET | 10/18 | 18/18 | 18/18 | | Inventarios validos | 5/6 | 6/6 | 6/6 | | Nomenclatura conforme | 77% | 85% | 95% | | Sync Codigo-Docs | 40% | 70% | 90% | ### 7.2 Criterios de Aceptacion 1. **Sprint 1:** Todos los gaps P0 resueltos 2. **Sprint 2:** Nomenclatura y estructura estandarizadas 3. **Sprint 3:** Mejoras adicionales implementadas 4. **General:** Validacion automatizada pasa sin errores --- ## 8. ENTREGABLES ### 8.1 Por Sprint | Sprint | Entregables | |--------|-------------| | Sprint 1 | 6 inventarios actualizados, 10 ET actualizadas/creadas | | Sprint 2 | ~195 archivos renombrados, estructura reorganizada | | Sprint 3 | 4 documentos nuevos, 1 script validacion | ### 8.2 Documentos Finales ``` orchestration/analisis/ ├── F1-ANALISIS-INICIAL-DOCUMENTACION-2026-01-10.md ├── F2-ANALISIS-DETALLADO-DOCUMENTACION-2026-01-10.md ├── F3-PLAN-ESTANDARIZACION-DOCUMENTACION-2026-01-10.md ├── F4-VALIDACION-PLAN-2026-01-10.md (proximo) ├── F5-DEPENDENCIAS-DOCUMENTACION-2026-01-10.md (proximo) ├── F6-PLAN-REFINADO-2026-01-10.md (proximo) ├── F7-REPORTE-EJECUCION-2026-01-10.md (proximo) └── F8-VALIDACION-FINAL-2026-01-10.md (proximo) ``` --- ## 9. PROXIMOS PASOS 1. **FASE 4:** Validar este plan contra el analisis detallado 2. **FASE 5:** Analizar dependencias entre archivos a modificar 3. **FASE 6:** Refinar plan basado en dependencias 4. **FASE 7:** Ejecutar plan 5. **FASE 8:** Validar ejecucion --- ## 10. APROBACION | Rol | Estado | Fecha | |-----|--------|-------| | Orquestador | COMPLETADO | 2026-01-10 | | Usuario | PENDIENTE | - | --- *Plan generado siguiendo CAPVED + SIMCO v3.8* *Esfuerzo total estimado: 121-135 horas* *Proximo paso: FASE 4 - Validacion de Planeacion*