feat(workspace): Add new projects and update architecture
New projects created: - michangarrito (marketplace mobile) - template-saas (SaaS template) - clinica-dental (dental ERP) - clinica-veterinaria (veterinary ERP) Architecture updates: - Move catalog from core/ to shared/ - Add MCP servers structure and templates - Add git management scripts - Update SUBREPOSITORIOS.md with 15 new repos - Update .gitignore for new projects Repository infrastructure: - 4 main repositories - 11 subrepositorios - Gitea remotes configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ff3038f183
commit
cb4c0681d3
28
.gitignore
vendored
28
.gitignore
vendored
@ -181,6 +181,22 @@ backups/
|
|||||||
# Backup de gamilit (submodule migration)
|
# Backup de gamilit (submodule migration)
|
||||||
projects/gamilit.bak.*/
|
projects/gamilit.bak.*/
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# MCP SERVERS - Repositorios independientes
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Los MCP servers internos son repositorios independientes que se clonan
|
||||||
|
# manualmente despues de clonar workspace-v1.
|
||||||
|
# Ver core/mcp-servers/_registry.yml para lista completa e instrucciones.
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
core/mcp-servers/internal/rag-knowledge/
|
||||||
|
core/mcp-servers/internal/scrum-taiga/
|
||||||
|
# Mantener estructura base (README, registry, templates)
|
||||||
|
!core/mcp-servers/README.md
|
||||||
|
!core/mcp-servers/_registry.yml
|
||||||
|
!core/mcp-servers/internal/.gitkeep
|
||||||
|
!core/mcp-servers/external/
|
||||||
|
!core/mcp-servers/templates/
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# SUBREPOSITORIOS - Proyectos con repositorios independientes en Gitea
|
# SUBREPOSITORIOS - Proyectos con repositorios independientes en Gitea
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -189,6 +205,7 @@ projects/gamilit.bak.*/
|
|||||||
#
|
#
|
||||||
# NOTA: gamilit NO se ignora porque es un submodulo Git (ver .gitmodules)
|
# NOTA: gamilit NO se ignora porque es un submodulo Git (ver .gitmodules)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
# ERP Family
|
||||||
projects/erp-suite/
|
projects/erp-suite/
|
||||||
projects/erp-core/
|
projects/erp-core/
|
||||||
projects/erp-construccion/
|
projects/erp-construccion/
|
||||||
@ -196,7 +213,18 @@ projects/erp-clinicas/
|
|||||||
projects/erp-retail/
|
projects/erp-retail/
|
||||||
projects/erp-mecanicas-diesel/
|
projects/erp-mecanicas-diesel/
|
||||||
projects/erp-vidrio-templado/
|
projects/erp-vidrio-templado/
|
||||||
|
|
||||||
|
# Trading & Analytics
|
||||||
projects/trading-platform/
|
projects/trading-platform/
|
||||||
projects/betting-analytics/
|
projects/betting-analytics/
|
||||||
projects/inmobiliaria-analytics/
|
projects/inmobiliaria-analytics/
|
||||||
projects/platform_marketing_content/
|
projects/platform_marketing_content/
|
||||||
|
|
||||||
|
# Nuevos proyectos (2026-01-07)
|
||||||
|
projects/michangarrito/
|
||||||
|
projects/template-saas/
|
||||||
|
projects/clinica-dental/
|
||||||
|
projects/clinica-veterinaria/
|
||||||
|
|
||||||
|
# Gitea token (no commitear)
|
||||||
|
.gitea-token
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Subrepositorios del Workspace
|
# Subrepositorios del Workspace
|
||||||
|
|
||||||
**Fecha:** 2025-01-04
|
**Fecha:** 2026-01-07
|
||||||
**Version:** 1.1
|
**Version:** 1.3
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -97,6 +97,15 @@ Estos proyectos SI pueden tener subrepositorios para sus apps (backend, frontend
|
|||||||
| **inmobiliaria-analytics** | `projects/inmobiliaria-analytics` | `http://72.60.226.4:3000/rckrdmrd/inmobiliaria-analytics.git` |
|
| **inmobiliaria-analytics** | `projects/inmobiliaria-analytics` | `http://72.60.226.4:3000/rckrdmrd/inmobiliaria-analytics.git` |
|
||||||
| **platform_marketing_content** | `projects/platform_marketing_content` | `http://72.60.226.4:3000/rckrdmrd/platform_marketing_content.git` |
|
| **platform_marketing_content** | `projects/platform_marketing_content` | `http://72.60.226.4:3000/rckrdmrd/platform_marketing_content.git` |
|
||||||
|
|
||||||
|
### Proyectos Nuevos (2026-01-07)
|
||||||
|
|
||||||
|
| Proyecto | Path Local | Repositorio | Subrepositorios |
|
||||||
|
|----------|------------|-------------|-----------------|
|
||||||
|
| **michangarrito** | `projects/michangarrito` | `http://72.60.226.4:3000/rckrdmrd/michangarrito.git` | backend, frontend, mobile, database, mcp-server, whatsapp |
|
||||||
|
| **template-saas** | `projects/template-saas` | `http://72.60.226.4:3000/rckrdmrd/template-saas.git` | backend, frontend, database |
|
||||||
|
| **clinica-dental** | `projects/clinica-dental` | `http://72.60.226.4:3000/rckrdmrd/clinica-dental.git` | database |
|
||||||
|
| **clinica-veterinaria** | `projects/clinica-veterinaria` | `http://72.60.226.4:3000/rckrdmrd/clinica-veterinaria.git` | database |
|
||||||
|
|
||||||
### Estructura con Subrepositorios (para proyectos Gitea)
|
### Estructura con Subrepositorios (para proyectos Gitea)
|
||||||
|
|
||||||
Los proyectos en Gitea pueden usar esta estructura de subrepositorios:
|
Los proyectos en Gitea pueden usar esta estructura de subrepositorios:
|
||||||
@ -207,4 +216,93 @@ git -C /home/isem/workspace-v1/projects/gamilit status
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Estado Actual de Repositorios en Gitea
|
||||||
|
|
||||||
|
### Repositorios Existentes (2026-01-04)
|
||||||
|
|
||||||
|
| Repositorio | Tipo | Estado |
|
||||||
|
|-------------|------|--------|
|
||||||
|
| workspace | Principal | Activo |
|
||||||
|
| workspace-v1 | Principal | Activo |
|
||||||
|
| erp-construccion-backend | Subrepositorio | Activo |
|
||||||
|
| erp-construccion-frontend-web | Subrepositorio | Activo |
|
||||||
|
| erp-construccion-frontend-mobile | Subrepositorio | Activo |
|
||||||
|
| erp-construccion-database | Subrepositorio | Activo |
|
||||||
|
| erp-mecanicas-diesel-backend | Subrepositorio | Activo |
|
||||||
|
| erp-mecanicas-diesel-frontend-web | Subrepositorio | Activo |
|
||||||
|
| erp-mecanicas-diesel-database | Subrepositorio | Activo |
|
||||||
|
| erp-core-backend | Subrepositorio | Activo |
|
||||||
|
| erp-core-frontend-web | Subrepositorio | Activo |
|
||||||
|
| erp-core-database | Subrepositorio | Activo |
|
||||||
|
|
||||||
|
### Repositorios Creados (2026-01-07)
|
||||||
|
|
||||||
|
Los siguientes repositorios fueron creados via API:
|
||||||
|
|
||||||
|
| Repositorio | Tipo | Estado |
|
||||||
|
|-------------|------|--------|
|
||||||
|
| michangarrito | Principal | ✅ Creado |
|
||||||
|
| michangarrito-backend | Subrepositorio | ✅ Creado |
|
||||||
|
| michangarrito-frontend | Subrepositorio | ✅ Creado |
|
||||||
|
| michangarrito-mobile | Subrepositorio | ✅ Creado |
|
||||||
|
| michangarrito-database | Subrepositorio | ✅ Creado |
|
||||||
|
| michangarrito-mcp-server | Subrepositorio | ✅ Creado |
|
||||||
|
| michangarrito-whatsapp | Subrepositorio | ✅ Creado |
|
||||||
|
| template-saas | Principal | ✅ Creado |
|
||||||
|
| template-saas-backend | Subrepositorio | ✅ Creado |
|
||||||
|
| template-saas-frontend | Subrepositorio | ✅ Creado |
|
||||||
|
| template-saas-database | Subrepositorio | ✅ Creado |
|
||||||
|
| clinica-dental | Principal | ✅ Creado |
|
||||||
|
| clinica-dental-database | Subrepositorio | ✅ Creado |
|
||||||
|
| clinica-veterinaria | Principal | ✅ Creado |
|
||||||
|
| clinica-veterinaria-database | Subrepositorio | ✅ Creado |
|
||||||
|
|
||||||
|
### Repositorios Pendientes de Crear
|
||||||
|
|
||||||
|
Los siguientes repositorios principales necesitan crearse via API o web de Gitea:
|
||||||
|
|
||||||
|
- erp-suite (principal)
|
||||||
|
- erp-core (principal)
|
||||||
|
- erp-construccion (principal)
|
||||||
|
- erp-clinicas (principal)
|
||||||
|
- erp-retail (principal)
|
||||||
|
- erp-mecanicas-diesel (principal)
|
||||||
|
- erp-vidrio-templado (principal)
|
||||||
|
- trading-platform (principal)
|
||||||
|
- betting-analytics (principal)
|
||||||
|
- inmobiliaria-analytics (principal)
|
||||||
|
- platform-marketing-content (principal)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scripts de Gestion
|
||||||
|
|
||||||
|
### Crear repositorios en Gitea
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Requiere token de API de Gitea
|
||||||
|
./scripts/create-gitea-repos-api.sh <GITEA_TOKEN>
|
||||||
|
|
||||||
|
# Para obtener el token:
|
||||||
|
# 1. Ir a http://72.60.226.4:3000/rckrdmrd
|
||||||
|
# 2. Settings -> Applications -> Generate New Token
|
||||||
|
# 3. Dar permisos de 'repo' y 'write:repository'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Push de todos los proyectos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Despues de crear los repositorios
|
||||||
|
./scripts/push-all-projects.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configurar repositorios locales
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configura remotes en cada proyecto
|
||||||
|
./scripts/create-gitea-repos.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
*Generado por NEXUS v3.4 - Sistema de Orquestacion*
|
*Generado por NEXUS v3.4 - Sistema de Orquestacion*
|
||||||
|
|||||||
@ -155,7 +155,7 @@ repositories:
|
|||||||
shared-libs:
|
shared-libs:
|
||||||
type: "shared"
|
type: "shared"
|
||||||
description: "Librerias compartidas"
|
description: "Librerias compartidas"
|
||||||
path: "shared/libs/"
|
path: "shared/catalog/"
|
||||||
status: "planned"
|
status: "planned"
|
||||||
packages:
|
packages:
|
||||||
- "@workspace/auth"
|
- "@workspace/auth"
|
||||||
|
|||||||
186
core/README.md
186
core/README.md
@ -1,119 +1,127 @@
|
|||||||
# Core - Núcleo de la Fábrica de Software
|
# Core - Arquitectura del Workspace
|
||||||
|
|
||||||
## Descripción
|
**Version:** 2.0.0
|
||||||
|
**Actualizado:** 2026-01-04
|
||||||
|
|
||||||
El directorio `core/` contiene todo lo que se comparte a nivel de **fábrica**, no de proyecto individual:
|
## Descripcion
|
||||||
|
|
||||||
- Sistema de orquestación de agentes
|
El directorio `core/` contiene la **arquitectura central del workspace**: sistema de orquestacion, MCP servers, y herramientas de ambiente. NO contiene codigo de aplicacion ni recursos compartidos (esos estan en `shared/`).
|
||||||
- Módulos de código reutilizables
|
|
||||||
- Estándares técnicos y de negocio
|
|
||||||
- Directivas globales para agentes/subagentes
|
|
||||||
- Constantes y tipos universales
|
|
||||||
|
|
||||||
## Estructura
|
## Estructura
|
||||||
|
|
||||||
```
|
```
|
||||||
core/
|
core/
|
||||||
├── modules/ # Código compartido ejecutable
|
├── README.md # Este archivo
|
||||||
│ ├── utils/ # Utilidades universales ✅
|
|
||||||
│ │ ├── date.util.ts # Manipulación de fechas
|
|
||||||
│ │ ├── string.util.ts # Manipulación de strings
|
|
||||||
│ │ ├── validation.util.ts # Validaciones
|
|
||||||
│ │ └── index.ts
|
|
||||||
│ ├── auth/ # Autenticación (por implementar)
|
|
||||||
│ ├── billing/ # Facturación
|
|
||||||
│ ├── notifications/ # Notificaciones
|
|
||||||
│ ├── payments/ # Pagos
|
|
||||||
│ └── multitenant/ # Multi-tenancy
|
|
||||||
│
|
│
|
||||||
├── constants/ # Constantes globales ✅
|
├── mcp-servers/ # MCP Servers para el workspace
|
||||||
│ ├── enums.constants.ts # Enums universales
|
│ ├── internal/ # Servidores MCP internos
|
||||||
│ ├── regex.constants.ts # Patrones regex
|
│ ├── external/ # Referencias a servidores externos
|
||||||
│ └── index.ts
|
│ ├── templates/ # Templates para crear nuevos MCP servers
|
||||||
|
│ └── _registry.yml # Registro de servidores disponibles
|
||||||
│
|
│
|
||||||
├── types/ # Tipos TypeScript compartidos ✅
|
├── orchestration/ # Sistema NEXUS/SIMCO de orquestacion
|
||||||
│ ├── api.types.ts # Tipos de API
|
│ ├── agents/ # Perfiles de agentes
|
||||||
│ ├── common.types.ts # Tipos comunes
|
│ │ ├── perfiles/ # Perfiles ligeros SIMCO
|
||||||
│ └── index.ts
|
│ │ └── legacy/ # Prompts legacy (referencia)
|
||||||
|
│ ├── directivas/ # Directivas por operacion
|
||||||
|
│ │ ├── simco/ # Sistema SIMCO
|
||||||
|
│ │ ├── legacy/ # Directivas legacy
|
||||||
|
│ │ └── _MAP.md
|
||||||
|
│ ├── referencias/ # ALIASES.yml y referencias
|
||||||
|
│ ├── templates/ # Templates de documentacion
|
||||||
|
│ ├── auditorias/ # Auditorias arquitectonicas
|
||||||
|
│ ├── impactos/ # Matrices de impacto
|
||||||
|
│ ├── inventarios/ # Inventarios de deployment
|
||||||
|
│ ├── procesos/ # Guias de procesos
|
||||||
|
│ ├── deployment/ # Arquitectura de deployment
|
||||||
|
│ ├── claude/ # Configuraciones Claude
|
||||||
|
│ └── _historico/ # Documentos archivados
|
||||||
│
|
│
|
||||||
├── catalog/ # Documentación de funcionalidades
|
└── devtools/ # Herramientas de ambiente
|
||||||
│ ├── auth/
|
└── environment/ # Configuracion de ambientes
|
||||||
│ ├── notifications/
|
├── scripts/ # Scripts de setup
|
||||||
│ └── ...
|
├── templates/ # Templates .env
|
||||||
│
|
└── DEV-ENVIRONMENT-REGISTRY.yml
|
||||||
├── orchestration/ # Sistema de agentes NEXUS
|
|
||||||
│ ├── agents/
|
|
||||||
│ ├── directivas/
|
|
||||||
│ ├── templates/
|
|
||||||
│ └── referencias/
|
|
||||||
│
|
|
||||||
└── standards/ # Estándares técnicos globales
|
|
||||||
├── CODING-STANDARDS.md
|
|
||||||
├── TESTING-STANDARDS.md
|
|
||||||
└── ...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Que NO esta en core/
|
||||||
|
|
||||||
|
Los siguientes elementos fueron movidos a `shared/`:
|
||||||
|
|
||||||
|
| Elemento | Nueva ubicacion |
|
||||||
|
|----------|-----------------|
|
||||||
|
| catalog/ | `shared/catalog/` |
|
||||||
|
| modules/ | `shared/modules/` |
|
||||||
|
| constants/ | `shared/constants/` |
|
||||||
|
| types/ | `shared/types/` |
|
||||||
|
| standards/ | `shared/knowledge-base/standards/` |
|
||||||
|
|
||||||
## Uso
|
## Uso
|
||||||
|
|
||||||
### Importar Utilidades
|
### MCP Servers
|
||||||
|
|
||||||
```typescript
|
```bash
|
||||||
// En cualquier proyecto del workspace
|
# Ver servidores disponibles
|
||||||
import { formatDate, slugify, isEmail } from '@core/modules/utils';
|
cat core/mcp-servers/_registry.yml
|
||||||
|
|
||||||
// O importar específico
|
# Crear nuevo servidor MCP interno
|
||||||
import { formatToISO, addDays } from '@core/modules/utils/date.util';
|
cp -r core/mcp-servers/templates/TEMPLATE-MCP-INTERNO core/mcp-servers/internal/mi-servidor
|
||||||
```
|
```
|
||||||
|
|
||||||
### Importar Constantes
|
### Sistema de Orquestacion
|
||||||
|
|
||||||
```typescript
|
Los agentes cargan automaticamente las directivas de `core/orchestration/directivas/` al inicializar.
|
||||||
import { UserStatus, PaymentStatus } from '@core/constants';
|
|
||||||
import { EMAIL_REGEX, UUID_REGEX } from '@core/constants/regex.constants';
|
```markdown
|
||||||
|
# Inicializacion de agente
|
||||||
|
1. Leer core/orchestration/directivas/simco/_INDEX.md
|
||||||
|
2. Leer core/orchestration/directivas/principios/*.md
|
||||||
|
3. Cargar perfil desde core/orchestration/agents/perfiles/
|
||||||
|
4. Leer ALIASES.yml para navegacion
|
||||||
```
|
```
|
||||||
|
|
||||||
### Importar Tipos
|
### Herramientas de Ambiente
|
||||||
|
|
||||||
```typescript
|
```bash
|
||||||
import { ApiResponse, PaginatedResponse } from '@core/types';
|
# Validar ambiente de un proyecto
|
||||||
import { BaseEntity, Address } from '@core/types/common.types';
|
./core/devtools/environment/scripts/validate-environment.sh /path/to/project
|
||||||
|
|
||||||
|
# Setup de ambiente
|
||||||
|
./core/devtools/environment/scripts/setup-project-env.sh /path/to/project
|
||||||
```
|
```
|
||||||
|
|
||||||
## Módulos Disponibles
|
## Relacion con otras carpetas
|
||||||
|
|
||||||
### Utils (`@core/modules/utils`)
|
```
|
||||||
|
workspace-v1/
|
||||||
|
├── core/ # ARQUITECTURA (este directorio)
|
||||||
|
│ └── orchestration/ # Sistema SIMCO/NEXUS
|
||||||
|
│
|
||||||
|
├── shared/ # RECURSOS COMPARTIDOS
|
||||||
|
│ ├── catalog/ # Funcionalidades reutilizables
|
||||||
|
│ ├── modules/ # Codigo ejecutable
|
||||||
|
│ ├── constants/ # Constantes globales
|
||||||
|
│ ├── types/ # Tipos TypeScript
|
||||||
|
│ └── knowledge-base/ # Documentacion
|
||||||
|
│
|
||||||
|
├── control-plane/ # GOVERNANCE
|
||||||
|
│ ├── registries/ # Puertos, dominios, BDs
|
||||||
|
│ ├── manifests/ # Configuraciones de repos
|
||||||
|
│ └── devtools/ # CI/CD, Docker
|
||||||
|
│
|
||||||
|
├── orchestration/ # DIRECTIVAS A NIVEL WORKSPACE (hereda de core/)
|
||||||
|
│
|
||||||
|
└── projects/ # PROYECTOS DE PRODUCTO
|
||||||
|
```
|
||||||
|
|
||||||
| Archivo | Funciones | Descripción |
|
## Ver Tambien
|
||||||
|---------|-----------|-------------|
|
|
||||||
| `date.util.ts` | formatDate, addDays, diffInDays, etc. | Manipulación de fechas |
|
|
||||||
| `string.util.ts` | slugify, capitalize, truncate, etc. | Manipulación de strings |
|
|
||||||
| `validation.util.ts` | isEmail, isUUID, isStrongPassword, etc. | Validaciones |
|
|
||||||
|
|
||||||
### Constants (`@core/constants`)
|
- [Sistema de Orquestacion](orchestration/README.md)
|
||||||
|
- [MCP Servers](mcp-servers/README.md)
|
||||||
|
- [Recursos Compartidos](../shared/README.md)
|
||||||
|
- [Catalogo de Funcionalidades](../shared/catalog/README.md)
|
||||||
|
|
||||||
| Archivo | Contenido |
|
---
|
||||||
|---------|-----------|
|
|
||||||
| `enums.constants.ts` | UserStatus, PaymentStatus, NotificationType, etc. |
|
|
||||||
| `regex.constants.ts` | EMAIL_REGEX, UUID_REGEX, PHONE_REGEX, etc. |
|
|
||||||
|
|
||||||
### Types (`@core/types`)
|
**Mantenido por:** Tech-Leader
|
||||||
|
**Ultima actualizacion:** 2026-01-04
|
||||||
| Archivo | Tipos |
|
|
||||||
|---------|-------|
|
|
||||||
| `api.types.ts` | ApiResponse, PaginatedResponse, ErrorCodes |
|
|
||||||
| `common.types.ts` | BaseEntity, Address, Money, Result |
|
|
||||||
|
|
||||||
## Proyectos que Usan Core
|
|
||||||
|
|
||||||
- **Gamilit** - Plataforma educativa de gamificación
|
|
||||||
- **Trading Platform** - OrbiQuant IA trading
|
|
||||||
- **ERP Suite** - Sistema ERP multi-vertical
|
|
||||||
|
|
||||||
## Sistema de Orquestación
|
|
||||||
Los agentes cargan automáticamente las directivas de `core/orchestration/directivas/` al inicializar.
|
|
||||||
|
|
||||||
## Ver También
|
|
||||||
|
|
||||||
- [Sistema de Orquestación](orchestration/README.md)
|
|
||||||
- [Catálogo de Funcionalidades](catalog/README.md)
|
|
||||||
- [Plan de Organización](../PLAN-ORGANIZACION-WORKSPACE.md)
|
|
||||||
|
|||||||
228
core/mcp-servers/README.md
Normal file
228
core/mcp-servers/README.md
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
# MCP Servers
|
||||||
|
|
||||||
|
**Version:** 1.0.0
|
||||||
|
**Fecha:** 2026-01-04
|
||||||
|
**Sistema:** NEXUS v3.4 + SIMCO
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Proposito
|
||||||
|
|
||||||
|
Esta carpeta contiene la infraestructura para MCP (Model Context Protocol) servers del workspace. Los MCP servers proporcionan herramientas especializadas para agentes de IA.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Estructura
|
||||||
|
|
||||||
|
```
|
||||||
|
mcp-servers/
|
||||||
|
├── README.md # Este archivo
|
||||||
|
├── _registry.yml # Registro central de MCP servers
|
||||||
|
│
|
||||||
|
├── internal/ # MCP servers desarrollados internamente
|
||||||
|
│ ├── .gitkeep
|
||||||
|
│ ├── rag-knowledge/ # [REPO INDEPENDIENTE] Sistema RAG
|
||||||
|
│ └── scrum-taiga/ # [REPO INDEPENDIENTE] Integracion Taiga
|
||||||
|
│
|
||||||
|
├── external/ # MCP servers de terceros
|
||||||
|
│ ├── .gitkeep
|
||||||
|
│ └── _sources.yml # Fuentes confiables
|
||||||
|
│
|
||||||
|
└── templates/ # Templates para nuevos MCP
|
||||||
|
└── TEMPLATE-MCP-INTERNO/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Arquitectura: Repositorios Independientes
|
||||||
|
|
||||||
|
Los MCP servers internos son **repositorios independientes** (NO submodules):
|
||||||
|
|
||||||
|
| Caracteristica | Valor |
|
||||||
|
|----------------|-------|
|
||||||
|
| Versionado | Independiente del workspace |
|
||||||
|
| Dependencias | Propias (node_modules excluidos) |
|
||||||
|
| Desarrollo | Ciclo de vida propio |
|
||||||
|
| Clonacion | Manual despues de workspace |
|
||||||
|
|
||||||
|
### Por que NO son submodules?
|
||||||
|
|
||||||
|
1. **Flexibilidad:** Pueden actualizarse sin afectar workspace
|
||||||
|
2. **Desarrollo independiente:** Equipos pueden trabajar en paralelo
|
||||||
|
3. **Reutilizacion:** Pueden usarse en otros contextos
|
||||||
|
4. **Simplicidad:** Sin complejidad de submodules anidados
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## MCP Servers Disponibles
|
||||||
|
|
||||||
|
### Internos (Desarrollo Propio)
|
||||||
|
|
||||||
|
| MCP Server | Descripcion | Prioridad | Estado |
|
||||||
|
|------------|-------------|-----------|--------|
|
||||||
|
| **rag-knowledge** | Sistema RAG como fuente de verdad | MAXIMA | Planificado |
|
||||||
|
| **scrum-taiga** | Integracion con Taiga SCRUM | ALTA | Planificado |
|
||||||
|
|
||||||
|
### Externos (Terceros)
|
||||||
|
|
||||||
|
Ver `external/_sources.yml` para fuentes confiables de MCP servers externos.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Instalacion
|
||||||
|
|
||||||
|
### 1. Requisitos Previos
|
||||||
|
|
||||||
|
- workspace-v1 clonado
|
||||||
|
- SSH configurado para Gitea (ver `orchestration/referencias/REPOSITORY-STRUCTURE.md`)
|
||||||
|
- Node.js >= 18
|
||||||
|
|
||||||
|
### 2. Clonar MCP Servers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Navegar a carpeta de MCP internos
|
||||||
|
cd /home/isem/workspace-v1/core/mcp-servers/internal
|
||||||
|
|
||||||
|
# Clonar RAG Knowledge Base (recomendado para desarrollo)
|
||||||
|
git clone git@gitea-server:rckrdmrd/mcp-rag-knowledge.git rag-knowledge
|
||||||
|
|
||||||
|
# Clonar SCRUM Taiga (opcional)
|
||||||
|
git clone git@gitea-server:rckrdmrd/mcp-scrum-taiga.git scrum-taiga
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Instalar Dependencias
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# RAG Knowledge
|
||||||
|
cd rag-knowledge
|
||||||
|
npm install
|
||||||
|
cp .env.example .env
|
||||||
|
# Configurar .env con credenciales
|
||||||
|
|
||||||
|
# SCRUM Taiga
|
||||||
|
cd ../scrum-taiga
|
||||||
|
npm install
|
||||||
|
cp .env.example .env
|
||||||
|
# Configurar .env con credenciales Taiga
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Verificar Instalacion
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Desde workspace-v1
|
||||||
|
cd /home/isem/workspace-v1
|
||||||
|
|
||||||
|
# Verificar estructura
|
||||||
|
ls -la core/mcp-servers/internal/
|
||||||
|
|
||||||
|
# Verificar que MCP servers responden
|
||||||
|
cd core/mcp-servers/internal/rag-knowledge
|
||||||
|
npm run health-check
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Desarrollo de Nuevos MCP
|
||||||
|
|
||||||
|
### Usar Template
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Copiar template
|
||||||
|
cp -r templates/TEMPLATE-MCP-INTERNO nuevo-mcp-server
|
||||||
|
|
||||||
|
# Personalizar
|
||||||
|
cd nuevo-mcp-server
|
||||||
|
# Editar package.json, README.md, etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Directivas a Seguir
|
||||||
|
|
||||||
|
| Directiva | Proposito |
|
||||||
|
|-----------|-----------|
|
||||||
|
| @SIMCO_MCP | Desarrollo de MCP servers |
|
||||||
|
| @SIMCO_MCP_IMPORT | Importacion de MCP externos |
|
||||||
|
| @SIMCO_RAG | Interaccion con sistema RAG |
|
||||||
|
|
||||||
|
### Registrar en _registry.yml
|
||||||
|
|
||||||
|
Despues de crear un nuevo MCP server, agregarlo a `_registry.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
mcp_servers:
|
||||||
|
internal:
|
||||||
|
nuevo-mcp:
|
||||||
|
name: "Nombre del MCP"
|
||||||
|
description: "Descripcion"
|
||||||
|
status: "development"
|
||||||
|
repository:
|
||||||
|
url: "git@gitea-server:rckrdmrd/mcp-nuevo.git"
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Perfiles de Agentes Relacionados
|
||||||
|
|
||||||
|
| Perfil | Responsabilidad |
|
||||||
|
|--------|-----------------|
|
||||||
|
| @PERFIL_MCP_ARCHITECT | Diseno e integracion de MCP |
|
||||||
|
| @PERFIL_MCP_DEVELOPER | Desarrollo de MCP internos |
|
||||||
|
| @PERFIL_MCP_INTEGRATOR | Importacion de MCP externos |
|
||||||
|
| @PERFIL_RAG_ENGINEER | Mantenimiento del RAG |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Aliases Utiles
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
@MCP_SERVERS: "core/mcp-servers/"
|
||||||
|
@MCP_REGISTRY: "core/mcp-servers/_registry.yml"
|
||||||
|
@MCP_RAG: "core/mcp-servers/internal/rag-knowledge/"
|
||||||
|
@MCP_TAIGA: "core/mcp-servers/internal/scrum-taiga/"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### MCP server no clonado
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar SSH
|
||||||
|
ssh -T gitea-server
|
||||||
|
|
||||||
|
# Si falla, verificar ~/.ssh/config
|
||||||
|
cat ~/.ssh/config | grep gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dependencias faltantes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Reinstalar
|
||||||
|
cd core/mcp-servers/internal/rag-knowledge
|
||||||
|
rm -rf node_modules
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Variables de entorno
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar .env existe
|
||||||
|
ls -la .env
|
||||||
|
|
||||||
|
# Verificar variables requeridas
|
||||||
|
cat .env.example
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Referencias
|
||||||
|
|
||||||
|
- `_registry.yml` - Registro completo de MCP servers
|
||||||
|
- `orchestration/directivas/simco/SIMCO-MCP.md` - Directiva de desarrollo
|
||||||
|
- `orchestration/referencias/REPOSITORY-STRUCTURE.md` - Estructura de repos
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Mantenido por:** @PERFIL_MCP_ARCHITECT
|
||||||
|
**Sistema:** NEXUS v3.4 + SIMCO
|
||||||
172
core/mcp-servers/_registry.yml
Normal file
172
core/mcp-servers/_registry.yml
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
# MCP Servers Registry
|
||||||
|
# ====================
|
||||||
|
# Registro central de todos los MCP servers del workspace
|
||||||
|
#
|
||||||
|
# Version: 1.0.0
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
# Sistema: NEXUS v3.4 + SIMCO
|
||||||
|
|
||||||
|
version: "1.0.0"
|
||||||
|
last_updated: "2026-01-04"
|
||||||
|
maintainer: "@PERFIL_MCP_ARCHITECT"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MCP SERVERS INTERNOS
|
||||||
|
# ============================================================================
|
||||||
|
# Desarrollados internamente para necesidades especificas del workspace
|
||||||
|
# Cada uno es un repositorio independiente que se clona manualmente
|
||||||
|
|
||||||
|
mcp_servers:
|
||||||
|
internal:
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# RAG Knowledge Base - PRIORIDAD MAXIMA
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
rag-knowledge:
|
||||||
|
name: "RAG Knowledge Base"
|
||||||
|
description: |
|
||||||
|
Sistema RAG (Retrieval-Augmented Generation) como fuente de verdad
|
||||||
|
del workspace. Proporciona busqueda semantica sobre documentacion,
|
||||||
|
directivas, perfiles y codigo.
|
||||||
|
status: "planned"
|
||||||
|
priority: "maxima"
|
||||||
|
|
||||||
|
repository:
|
||||||
|
type: "gitea"
|
||||||
|
url: "git@gitea-server:rckrdmrd/mcp-rag-knowledge.git"
|
||||||
|
https: "http://72.60.226.4:3000/rckrdmrd/mcp-rag-knowledge"
|
||||||
|
|
||||||
|
clone_path: "core/mcp-servers/internal/rag-knowledge"
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
runtime:
|
||||||
|
- "Node.js >= 18"
|
||||||
|
- "TypeScript >= 5.0"
|
||||||
|
database:
|
||||||
|
- "PostgreSQL >= 15"
|
||||||
|
- "pgvector extension"
|
||||||
|
external_apis:
|
||||||
|
- "OpenAI API (embeddings)"
|
||||||
|
|
||||||
|
tools_provided:
|
||||||
|
- rag_query_context
|
||||||
|
- rag_get_directive
|
||||||
|
- rag_get_agent_profile
|
||||||
|
- rag_trace_reference
|
||||||
|
- rag_get_relations
|
||||||
|
- rag_find_code
|
||||||
|
- rag_explain_impact
|
||||||
|
- rag_index_document
|
||||||
|
- rag_sync_category
|
||||||
|
- rag_get_sync_status
|
||||||
|
- rag_validate_coverage
|
||||||
|
- rag_report_feedback
|
||||||
|
|
||||||
|
documentation:
|
||||||
|
architecture: "docs/ARCHITECTURE.md"
|
||||||
|
deployment: "docs/DEPLOYMENT.md"
|
||||||
|
usage: "docs/USAGE.md"
|
||||||
|
tools_spec: "docs/MCP-TOOLS-SPEC.md"
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# SCRUM Taiga Integration - PRIORIDAD ALTA
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
scrum-taiga:
|
||||||
|
name: "SCRUM Taiga Integration"
|
||||||
|
description: |
|
||||||
|
Integracion con Taiga para gestion de proyectos SCRUM.
|
||||||
|
Permite sincronizar EPICs, User Stories y Tasks entre
|
||||||
|
el workspace y Taiga.
|
||||||
|
status: "planned"
|
||||||
|
priority: "alta"
|
||||||
|
|
||||||
|
repository:
|
||||||
|
type: "gitea"
|
||||||
|
url: "git@gitea-server:rckrdmrd/mcp-scrum-taiga.git"
|
||||||
|
https: "http://72.60.226.4:3000/rckrdmrd/mcp-scrum-taiga"
|
||||||
|
|
||||||
|
clone_path: "core/mcp-servers/internal/scrum-taiga"
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
runtime:
|
||||||
|
- "Node.js >= 18"
|
||||||
|
- "TypeScript >= 5.0"
|
||||||
|
external_apis:
|
||||||
|
- "Taiga API"
|
||||||
|
|
||||||
|
tools_provided:
|
||||||
|
- taiga_get_project
|
||||||
|
- taiga_list_epics
|
||||||
|
- taiga_create_epic
|
||||||
|
- taiga_list_user_stories
|
||||||
|
- taiga_create_user_story
|
||||||
|
- taiga_list_tasks
|
||||||
|
- taiga_create_task
|
||||||
|
- taiga_update_status
|
||||||
|
- taiga_sync_sprint
|
||||||
|
|
||||||
|
documentation:
|
||||||
|
architecture: "docs/ARCHITECTURE.md"
|
||||||
|
deployment: "docs/DEPLOYMENT.md"
|
||||||
|
usage: "docs/USAGE.md"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MCP SERVERS EXTERNOS
|
||||||
|
# ============================================================================
|
||||||
|
# MCP servers de terceros evaluados y aprobados para uso
|
||||||
|
|
||||||
|
external:
|
||||||
|
# Lista de MCP servers externos pendientes de evaluacion
|
||||||
|
pending_evaluation: []
|
||||||
|
|
||||||
|
# MCP servers externos aprobados
|
||||||
|
approved: []
|
||||||
|
|
||||||
|
# Fuentes confiables para buscar MCP servers
|
||||||
|
trusted_sources:
|
||||||
|
- name: "Anthropic Official"
|
||||||
|
url: "https://github.com/anthropics"
|
||||||
|
priority: 1
|
||||||
|
- name: "MCP Community"
|
||||||
|
url: "https://github.com/modelcontextprotocol"
|
||||||
|
priority: 2
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# INSTRUCCIONES DE CLONACION
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
clone_instructions: |
|
||||||
|
# Despues de clonar workspace-v1, clonar los MCP servers necesarios:
|
||||||
|
|
||||||
|
# 1. Navegar a la carpeta de MCP internos
|
||||||
|
cd /home/isem/workspace-v1/core/mcp-servers/internal
|
||||||
|
|
||||||
|
# 2. Clonar RAG Knowledge Base (recomendado)
|
||||||
|
git clone git@gitea-server:rckrdmrd/mcp-rag-knowledge.git rag-knowledge
|
||||||
|
cd rag-knowledge && npm install && cd ..
|
||||||
|
|
||||||
|
# 3. Clonar SCRUM Taiga (opcional)
|
||||||
|
git clone git@gitea-server:rckrdmrd/mcp-scrum-taiga.git scrum-taiga
|
||||||
|
cd scrum-taiga && npm install && cd ..
|
||||||
|
|
||||||
|
# 4. Verificar instalacion
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# VALIDACION
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
validation:
|
||||||
|
required_for_development:
|
||||||
|
- rag-knowledge
|
||||||
|
optional:
|
||||||
|
- scrum-taiga
|
||||||
|
|
||||||
|
check_command: |
|
||||||
|
# Verificar que MCP servers estan clonados
|
||||||
|
for mcp in rag-knowledge scrum-taiga; do
|
||||||
|
if [ -d "core/mcp-servers/internal/$mcp" ]; then
|
||||||
|
echo "OK: $mcp"
|
||||||
|
else
|
||||||
|
echo "MISSING: $mcp (clone con: git clone git@gitea-server:rckrdmrd/mcp-$mcp.git)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
2
core/mcp-servers/external/.gitkeep
vendored
Normal file
2
core/mcp-servers/external/.gitkeep
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Esta carpeta contiene MCP servers externos evaluados e instalados
|
||||||
|
# Ver _sources.yml para fuentes confiables
|
||||||
125
core/mcp-servers/external/_sources.yml
vendored
Normal file
125
core/mcp-servers/external/_sources.yml
vendored
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
# MCP External Sources
|
||||||
|
# ====================
|
||||||
|
# Fuentes confiables para MCP servers externos
|
||||||
|
#
|
||||||
|
# Version: 1.0.0
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
|
||||||
|
version: "1.0.0"
|
||||||
|
last_updated: "2026-01-04"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# FUENTES CONFIABLES
|
||||||
|
# ============================================================================
|
||||||
|
# Lista de repositorios/organizaciones confiables para MCP servers
|
||||||
|
|
||||||
|
trusted_sources:
|
||||||
|
# Nivel 1: Oficial (maxima confianza)
|
||||||
|
official:
|
||||||
|
- name: "Anthropic Official"
|
||||||
|
url: "https://github.com/anthropics"
|
||||||
|
description: "MCP servers oficiales de Anthropic"
|
||||||
|
trust_level: "official"
|
||||||
|
auto_approve: true
|
||||||
|
|
||||||
|
- name: "Model Context Protocol"
|
||||||
|
url: "https://github.com/modelcontextprotocol"
|
||||||
|
description: "Repositorio oficial del protocolo MCP"
|
||||||
|
trust_level: "official"
|
||||||
|
auto_approve: true
|
||||||
|
|
||||||
|
# Nivel 2: Comunidad Verificada (alta confianza)
|
||||||
|
community_verified:
|
||||||
|
- name: "MCP Community Servers"
|
||||||
|
url: "https://github.com/mcp-community"
|
||||||
|
description: "Servidores MCP de la comunidad verificados"
|
||||||
|
trust_level: "verified"
|
||||||
|
auto_approve: false
|
||||||
|
requires_review: true
|
||||||
|
|
||||||
|
# Nivel 3: Terceros (requiere evaluacion completa)
|
||||||
|
third_party: []
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# PROCESO DE EVALUACION
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
evaluation_process:
|
||||||
|
steps:
|
||||||
|
1_identify:
|
||||||
|
description: "Identificar MCP server de interes"
|
||||||
|
actions:
|
||||||
|
- Verificar fuente en trusted_sources
|
||||||
|
- Revisar repositorio y documentacion
|
||||||
|
- Verificar actividad y mantenimiento
|
||||||
|
|
||||||
|
2_security_review:
|
||||||
|
description: "Revision de seguridad"
|
||||||
|
actions:
|
||||||
|
- Revisar dependencias (npm audit)
|
||||||
|
- Buscar vulnerabilidades conocidas
|
||||||
|
- Verificar permisos requeridos
|
||||||
|
- Revisar codigo fuente si es necesario
|
||||||
|
|
||||||
|
3_functionality_test:
|
||||||
|
description: "Prueba de funcionalidad"
|
||||||
|
actions:
|
||||||
|
- Instalar en ambiente de prueba
|
||||||
|
- Ejecutar tests incluidos
|
||||||
|
- Verificar herramientas funcionan
|
||||||
|
- Documentar comportamiento
|
||||||
|
|
||||||
|
4_approval:
|
||||||
|
description: "Aprobacion final"
|
||||||
|
actions:
|
||||||
|
- Documentar en _registry.yml
|
||||||
|
- Agregar a external/installed/
|
||||||
|
- Actualizar documentacion
|
||||||
|
|
||||||
|
criteria:
|
||||||
|
mandatory:
|
||||||
|
- "Codigo fuente disponible"
|
||||||
|
- "Sin vulnerabilidades criticas"
|
||||||
|
- "Documentacion adecuada"
|
||||||
|
- "Tests incluidos"
|
||||||
|
recommended:
|
||||||
|
- "Mantenimiento activo (< 6 meses)"
|
||||||
|
- "Mas de 10 estrellas en GitHub"
|
||||||
|
- "Issues respondidos"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MCP SERVERS EXTERNOS INSTALADOS
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
installed: []
|
||||||
|
# Formato cuando se instale uno:
|
||||||
|
# - name: "nombre-del-mcp"
|
||||||
|
# source: "url del repo"
|
||||||
|
# version: "1.0.0"
|
||||||
|
# installed_date: "2026-01-04"
|
||||||
|
# installed_by: "@PERFIL_MCP_INTEGRATOR"
|
||||||
|
# location: "external/installed/nombre-del-mcp"
|
||||||
|
# review_notes: "Notas de la evaluacion"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MCP SERVERS PENDIENTES DE EVALUACION
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
pending_evaluation: []
|
||||||
|
# Formato:
|
||||||
|
# - name: "nombre"
|
||||||
|
# source: "url"
|
||||||
|
# requested_by: "quien lo solicito"
|
||||||
|
# requested_date: "fecha"
|
||||||
|
# reason: "por que se necesita"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MCP SERVERS RECHAZADOS
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
rejected: []
|
||||||
|
# Formato:
|
||||||
|
# - name: "nombre"
|
||||||
|
# source: "url"
|
||||||
|
# rejected_date: "fecha"
|
||||||
|
# reason: "razon del rechazo"
|
||||||
3
core/mcp-servers/internal/.gitkeep
Normal file
3
core/mcp-servers/internal/.gitkeep
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Esta carpeta contiene MCP servers internos como repositorios independientes
|
||||||
|
# Cada MCP server se clona manualmente despues de clonar workspace-v1
|
||||||
|
# Ver _registry.yml para lista de MCP servers disponibles
|
||||||
1
core/mcp-servers/templates/.gitkeep
Normal file
1
core/mcp-servers/templates/.gitkeep
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Esta carpeta contiene templates para crear nuevos MCP servers
|
||||||
16
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/.env.example
Normal file
16
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/.env.example
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# ============================================================================
|
||||||
|
# MCP Server Configuration
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Server
|
||||||
|
PORT=3100
|
||||||
|
NODE_ENV=development
|
||||||
|
|
||||||
|
# Database (PostgreSQL with pgvector)
|
||||||
|
DATABASE_URL=postgresql://user:password@localhost:5432/mcp_db
|
||||||
|
|
||||||
|
# OpenAI (for embeddings)
|
||||||
|
OPENAI_API_KEY=sk-your-api-key-here
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
LOG_LEVEL=info
|
||||||
35
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/.gitignore
vendored
Normal file
35
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Build
|
||||||
|
dist/
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
coverage/
|
||||||
|
.nyc_output/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Temp
|
||||||
|
tmp/
|
||||||
|
temp/
|
||||||
|
.cache/
|
||||||
121
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/README.md
Normal file
121
core/mcp-servers/templates/TEMPLATE-MCP-INTERNO/README.md
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# {NOMBRE_MCP}
|
||||||
|
|
||||||
|
**Version:** 0.1.0
|
||||||
|
**Fecha:** {FECHA}
|
||||||
|
**Sistema:** NEXUS v3.4 + SIMCO
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Descripcion
|
||||||
|
|
||||||
|
{DESCRIPCION_DEL_MCP}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Instalacion
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clonar (desde workspace-v1/core/mcp-servers/internal/)
|
||||||
|
git clone git@gitea-server:rckrdmrd/mcp-{nombre}.git {nombre}
|
||||||
|
cd {nombre}
|
||||||
|
|
||||||
|
# Instalar dependencias
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Configurar
|
||||||
|
cp .env.example .env
|
||||||
|
# Editar .env con credenciales
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuracion
|
||||||
|
|
||||||
|
### Variables de Entorno
|
||||||
|
|
||||||
|
| Variable | Descripcion | Requerido |
|
||||||
|
|----------|-------------|-----------|
|
||||||
|
| `DATABASE_URL` | URL de PostgreSQL | Si |
|
||||||
|
| `OPENAI_API_KEY` | API key de OpenAI | Si |
|
||||||
|
|
||||||
|
### Archivo .env.example
|
||||||
|
|
||||||
|
```env
|
||||||
|
# Database
|
||||||
|
DATABASE_URL=postgresql://user:pass@localhost:5432/db
|
||||||
|
|
||||||
|
# OpenAI (para embeddings)
|
||||||
|
OPENAI_API_KEY=sk-...
|
||||||
|
|
||||||
|
# Server
|
||||||
|
PORT=3100
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Uso
|
||||||
|
|
||||||
|
### Iniciar Servidor
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
### Desarrollo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Herramientas MCP Disponibles
|
||||||
|
|
||||||
|
| Herramienta | Descripcion |
|
||||||
|
|-------------|-------------|
|
||||||
|
| `{tool_1}` | {descripcion} |
|
||||||
|
| `{tool_2}` | {descripcion} |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Estructura
|
||||||
|
|
||||||
|
```
|
||||||
|
{nombre}/
|
||||||
|
├── README.md
|
||||||
|
├── package.json
|
||||||
|
├── tsconfig.json
|
||||||
|
├── .env.example
|
||||||
|
├── .gitignore
|
||||||
|
├── docs/
|
||||||
|
│ ├── ARCHITECTURE.md
|
||||||
|
│ ├── DEPLOYMENT.md
|
||||||
|
│ └── USAGE.md
|
||||||
|
├── orchestration/
|
||||||
|
│ └── 00-guidelines/
|
||||||
|
│ └── CONTEXTO-PROYECTO.md
|
||||||
|
├── src/
|
||||||
|
│ ├── index.ts
|
||||||
|
│ ├── tools/
|
||||||
|
│ └── services/
|
||||||
|
├── config/
|
||||||
|
└── tests/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Referencias
|
||||||
|
|
||||||
|
- Directiva: @SIMCO_MCP
|
||||||
|
- Perfil: @PERFIL_MCP_DEVELOPER
|
||||||
|
- Registry: core/mcp-servers/_registry.yml
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Mantenido por:** @PERFIL_MCP_DEVELOPER
|
||||||
@ -0,0 +1 @@
|
|||||||
|
# Configuration files directory
|
||||||
@ -0,0 +1,318 @@
|
|||||||
|
# ============================================================================
|
||||||
|
# CHUNKING-STRATEGIES.yml
|
||||||
|
# Estrategias de Chunking para Sistema RAG
|
||||||
|
# ============================================================================
|
||||||
|
# Version: 1.0.0
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
# EPIC: EPIC-013
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# CONFIGURACION GLOBAL
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
global:
|
||||||
|
# Modelo de embeddings a usar
|
||||||
|
embedding_model: "text-embedding-ada-002"
|
||||||
|
embedding_dimensions: 1536
|
||||||
|
|
||||||
|
# Limites generales
|
||||||
|
max_chunk_size: 1500 # Caracteres maximos por chunk
|
||||||
|
min_chunk_size: 100 # Caracteres minimos (evitar chunks muy pequeños)
|
||||||
|
chunk_overlap: 200 # Overlap entre chunks consecutivos
|
||||||
|
|
||||||
|
# Separadores de chunk (en orden de prioridad)
|
||||||
|
separators:
|
||||||
|
- "\n## " # Heading nivel 2
|
||||||
|
- "\n### " # Heading nivel 3
|
||||||
|
- "\n#### " # Heading nivel 4
|
||||||
|
- "\n\n" # Parrafo
|
||||||
|
- "\n" # Linea
|
||||||
|
- ". " # Oracion
|
||||||
|
- " " # Palabra (ultimo recurso)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# ESTRATEGIAS POR TIPO DE DOCUMENTO
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
strategies:
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# DIRECTIVAS SIMCO
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
directiva:
|
||||||
|
description: "Documentos de directivas del sistema SIMCO"
|
||||||
|
file_patterns:
|
||||||
|
- "orchestration/directivas/**/*.md"
|
||||||
|
- "**/SIMCO-*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "semantic" # semantic | fixed | paragraph
|
||||||
|
preserve_headings: true # Mantener jerarquia de headings en cada chunk
|
||||||
|
max_chunk_size: 1200 # Directivas son densos, chunks mas pequenos
|
||||||
|
include_frontmatter: true # Incluir frontmatter en primer chunk
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "version"
|
||||||
|
pattern: "Version:\\s*([\\d.]+)"
|
||||||
|
- field: "priority"
|
||||||
|
pattern: "Prioridad:\\s*(\\w+)"
|
||||||
|
- field: "applies_to"
|
||||||
|
pattern: "Aplica a:\\s*(.+)"
|
||||||
|
|
||||||
|
heading_weights:
|
||||||
|
"RESUMEN EJECUTIVO": 1.5 # Boost para secciones importantes
|
||||||
|
"PRINCIPIO FUNDAMENTAL": 1.5
|
||||||
|
"CHECKLIST": 1.3
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# PERFILES DE AGENTES
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
perfil:
|
||||||
|
description: "Perfiles de agentes del sistema NEXUS"
|
||||||
|
file_patterns:
|
||||||
|
- "orchestration/perfiles/**/*.md"
|
||||||
|
- "**/PERFIL-*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "semantic"
|
||||||
|
preserve_headings: true
|
||||||
|
max_chunk_size: 1000 # Perfiles necesitan precision alta
|
||||||
|
include_frontmatter: true
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "agent_id"
|
||||||
|
pattern: "@(PERFIL_[A-Z_]+)"
|
||||||
|
- field: "system"
|
||||||
|
pattern: "Sistema:\\s*(\\w+)"
|
||||||
|
- field: "context_level"
|
||||||
|
pattern: "Contexto:\\s*(\\w+)"
|
||||||
|
|
||||||
|
special_sections:
|
||||||
|
- name: "DIRECTIVAS APLICABLES"
|
||||||
|
extract_as: "applicable_directives"
|
||||||
|
is_list: true
|
||||||
|
- name: "HERRAMIENTAS MCP"
|
||||||
|
extract_as: "mcp_tools"
|
||||||
|
is_list: true
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# TEMPLATES
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
template:
|
||||||
|
description: "Templates y plantillas del workspace"
|
||||||
|
file_patterns:
|
||||||
|
- "**/templates/**/*"
|
||||||
|
- "**/TEMPLATE-*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "fixed" # Templates se dividen por tamano fijo
|
||||||
|
preserve_code_blocks: true # No cortar bloques de codigo
|
||||||
|
max_chunk_size: 2000 # Templates pueden ser mas largos
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "template_type"
|
||||||
|
pattern: "Tipo:\\s*(\\w+)"
|
||||||
|
- field: "usage"
|
||||||
|
pattern: "Uso:\\s*(.+)"
|
||||||
|
|
||||||
|
special_handling:
|
||||||
|
- pattern: "```"
|
||||||
|
action: "preserve_block" # Mantener bloques de codigo intactos
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# CODIGO FUENTE
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
code:
|
||||||
|
description: "Archivos de codigo fuente"
|
||||||
|
file_patterns:
|
||||||
|
- "**/*.ts"
|
||||||
|
- "**/*.tsx"
|
||||||
|
- "**/*.js"
|
||||||
|
- "**/*.jsx"
|
||||||
|
- "**/*.sql"
|
||||||
|
- "**/*.py"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "ast" # Usar Abstract Syntax Tree
|
||||||
|
preserve_functions: true # No cortar funciones a la mitad
|
||||||
|
include_context: true # Incluir imports y contexto
|
||||||
|
max_chunk_size: 2500 # Codigo puede necesitar mas contexto
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "language"
|
||||||
|
from: "file_extension"
|
||||||
|
- field: "exports"
|
||||||
|
pattern: "export\\s+(function|class|const|type)\\s+(\\w+)"
|
||||||
|
- field: "imports"
|
||||||
|
pattern: "import\\s+.*from\\s+['\"](.+)['\"]"
|
||||||
|
|
||||||
|
special_sections:
|
||||||
|
- type: "function"
|
||||||
|
extract_signature: true
|
||||||
|
extract_jsdoc: true
|
||||||
|
- type: "class"
|
||||||
|
extract_signature: true
|
||||||
|
include_methods: true
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# ESPECIFICACIONES
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
spec:
|
||||||
|
description: "Documentos de especificacion tecnica"
|
||||||
|
file_patterns:
|
||||||
|
- "**/specs/**/*.md"
|
||||||
|
- "**/SPEC-*.md"
|
||||||
|
- "**/DDL-*.sql"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "semantic"
|
||||||
|
preserve_headings: true
|
||||||
|
preserve_code_blocks: true
|
||||||
|
max_chunk_size: 1800
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "spec_type"
|
||||||
|
pattern: "Tipo:\\s*(\\w+)"
|
||||||
|
- field: "version"
|
||||||
|
pattern: "Version:\\s*([\\d.]+)"
|
||||||
|
|
||||||
|
special_handling:
|
||||||
|
- pattern: "CREATE TABLE"
|
||||||
|
action: "preserve_statement"
|
||||||
|
- pattern: "CREATE FUNCTION"
|
||||||
|
action: "preserve_statement"
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# GUIAS Y DOCUMENTACION
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
guide:
|
||||||
|
description: "Guias de uso y documentacion general"
|
||||||
|
file_patterns:
|
||||||
|
- "**/docs/**/*.md"
|
||||||
|
- "**/README.md"
|
||||||
|
- "**/USAGE.md"
|
||||||
|
- "**/GUIDE-*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "paragraph" # Por parrafos naturales
|
||||||
|
preserve_headings: true
|
||||||
|
preserve_code_blocks: true
|
||||||
|
max_chunk_size: 1500
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "doc_type"
|
||||||
|
from: "filename"
|
||||||
|
- field: "project"
|
||||||
|
from: "path_segment"
|
||||||
|
segment_index: 1
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# EPICS Y TAREAS
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
epic:
|
||||||
|
description: "Documentos de EPICs y planificacion"
|
||||||
|
file_patterns:
|
||||||
|
- "**/EPIC-*.md"
|
||||||
|
- "**/epics/**/*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "semantic"
|
||||||
|
preserve_headings: true
|
||||||
|
max_chunk_size: 1200
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "epic_id"
|
||||||
|
pattern: "EPIC-(\\d+)"
|
||||||
|
- field: "status"
|
||||||
|
pattern: "Estado:\\s*(\\w+)"
|
||||||
|
- field: "priority"
|
||||||
|
pattern: "Prioridad:\\s*(\\w+)"
|
||||||
|
|
||||||
|
special_sections:
|
||||||
|
- name: "TAREAS"
|
||||||
|
extract_as: "tasks"
|
||||||
|
is_list: true
|
||||||
|
- name: "DEPENDENCIAS"
|
||||||
|
extract_as: "dependencies"
|
||||||
|
is_list: true
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# TRAZAS DE SESION
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
traza:
|
||||||
|
description: "Trazas de sesiones de agentes"
|
||||||
|
file_patterns:
|
||||||
|
- "**/trazas/TRAZA-*.md"
|
||||||
|
|
||||||
|
chunking:
|
||||||
|
method: "fixed"
|
||||||
|
max_chunk_size: 2000 # Trazas son largas
|
||||||
|
preserve_code_blocks: true
|
||||||
|
|
||||||
|
metadata_extraction:
|
||||||
|
- field: "session_id"
|
||||||
|
pattern: "TRAZA-(\\d+)"
|
||||||
|
- field: "agent"
|
||||||
|
pattern: "Agente:\\s*@(\\w+)"
|
||||||
|
- field: "date"
|
||||||
|
pattern: "Fecha:\\s*([\\d-]+)"
|
||||||
|
|
||||||
|
indexing:
|
||||||
|
priority: "low" # Trazas tienen menor prioridad
|
||||||
|
retention_days: 90 # Mantener por 90 dias
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# PROCESAMIENTO ESPECIAL
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
preprocessing:
|
||||||
|
# Limpiar antes de chunking
|
||||||
|
cleanup:
|
||||||
|
- remove_html_comments: true
|
||||||
|
- normalize_whitespace: true
|
||||||
|
- convert_tabs_to_spaces: true
|
||||||
|
|
||||||
|
# Frontmatter YAML
|
||||||
|
frontmatter:
|
||||||
|
extract: true
|
||||||
|
include_in_first_chunk: true
|
||||||
|
fields_to_index:
|
||||||
|
- "title"
|
||||||
|
- "version"
|
||||||
|
- "applicable_agents"
|
||||||
|
- "priority"
|
||||||
|
|
||||||
|
postprocessing:
|
||||||
|
# Agregar contexto a cada chunk
|
||||||
|
add_context:
|
||||||
|
- document_title: true
|
||||||
|
- heading_path: true
|
||||||
|
- document_category: true
|
||||||
|
|
||||||
|
# Validacion
|
||||||
|
validation:
|
||||||
|
- min_length: 50
|
||||||
|
- max_length: 3000
|
||||||
|
- require_content: true
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# CONFIGURACION DE EMBEDDINGS
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
embeddings:
|
||||||
|
# Proveedor
|
||||||
|
provider: "openai"
|
||||||
|
model: "text-embedding-ada-002"
|
||||||
|
dimensions: 1536
|
||||||
|
|
||||||
|
# Batching
|
||||||
|
batch_size: 100
|
||||||
|
max_retries: 3
|
||||||
|
retry_delay_ms: 1000
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
cache:
|
||||||
|
enabled: true
|
||||||
|
ttl_hours: 168 # 7 dias
|
||||||
|
storage: "postgres"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# FIN DE CONFIGURACION
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
@ -0,0 +1,359 @@
|
|||||||
|
# ============================================================================
|
||||||
|
# PATH-MAPPINGS.yml
|
||||||
|
# Mapeo de Rutas del Workspace a Categorias RAG
|
||||||
|
# ============================================================================
|
||||||
|
# Version: 1.0.0
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
# EPIC: EPIC-013
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# CONFIGURACION BASE
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
base:
|
||||||
|
workspace_root: "/home/isem/workspace-v1"
|
||||||
|
|
||||||
|
# Categorias principales del sistema RAG
|
||||||
|
categories:
|
||||||
|
- orchestration # Sistema de orquestacion (directivas, perfiles, trazas)
|
||||||
|
- core # Componentes core (MCP servers, utilidades)
|
||||||
|
- knowledge-base # Base de conocimiento (documentacion, snippets)
|
||||||
|
- projects # Proyectos activos (gamilit, erp-core, etc)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# MAPEOS DE RUTAS
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
mappings:
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# ORCHESTRATION - Sistema de Orquestacion
|
||||||
|
# ==========================================================================
|
||||||
|
orchestration:
|
||||||
|
base_path: "orchestration/"
|
||||||
|
description: "Sistema NEXUS de orquestacion de agentes"
|
||||||
|
priority: "maxima"
|
||||||
|
|
||||||
|
subcategories:
|
||||||
|
# Directivas SIMCO
|
||||||
|
directivas:
|
||||||
|
paths:
|
||||||
|
- "orchestration/directivas/**/*.md"
|
||||||
|
document_type: "directiva"
|
||||||
|
applicable_agents: ["*"]
|
||||||
|
index_priority: 1
|
||||||
|
|
||||||
|
# Perfiles de agentes
|
||||||
|
perfiles:
|
||||||
|
paths:
|
||||||
|
- "orchestration/perfiles/**/*.md"
|
||||||
|
document_type: "perfil"
|
||||||
|
applicable_agents: ["*"]
|
||||||
|
index_priority: 1
|
||||||
|
|
||||||
|
# Templates de orquestacion
|
||||||
|
templates:
|
||||||
|
paths:
|
||||||
|
- "orchestration/templates/**/*"
|
||||||
|
document_type: "template"
|
||||||
|
applicable_agents: ["PERFIL_ARCHITECT", "PERFIL_DEVELOPER"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Trazas de sesiones
|
||||||
|
trazas:
|
||||||
|
paths:
|
||||||
|
- "orchestration/trazas/**/*.md"
|
||||||
|
document_type: "traza"
|
||||||
|
applicable_agents: ["PERFIL_ANALYST"]
|
||||||
|
index_priority: 3
|
||||||
|
retention_days: 90
|
||||||
|
|
||||||
|
# Referencias
|
||||||
|
referencias:
|
||||||
|
paths:
|
||||||
|
- "orchestration/referencias/**/*.md"
|
||||||
|
document_type: "reference"
|
||||||
|
applicable_agents: ["*"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# EPICs
|
||||||
|
epics:
|
||||||
|
paths:
|
||||||
|
- "orchestration/epics/**/*.md"
|
||||||
|
document_type: "epic"
|
||||||
|
applicable_agents: ["PERFIL_SCRUM_MANAGER", "PERFIL_ARCHITECT"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# CORE - Componentes Core del Workspace
|
||||||
|
# ==========================================================================
|
||||||
|
core:
|
||||||
|
base_path: "core/"
|
||||||
|
description: "Componentes core compartidos"
|
||||||
|
priority: "alta"
|
||||||
|
|
||||||
|
subcategories:
|
||||||
|
# MCP Servers
|
||||||
|
mcp-servers:
|
||||||
|
paths:
|
||||||
|
- "core/mcp-servers/**/*.md"
|
||||||
|
- "core/mcp-servers/**/*.yml"
|
||||||
|
- "core/mcp-servers/**/*.yaml"
|
||||||
|
- "core/mcp-servers/templates/**/*"
|
||||||
|
document_type: "spec"
|
||||||
|
applicable_agents: ["PERFIL_MCP_ARCHITECT", "PERFIL_MCP_DEVELOPER"]
|
||||||
|
index_priority: 1
|
||||||
|
exclude:
|
||||||
|
- "core/mcp-servers/internal/*/node_modules/**"
|
||||||
|
- "core/mcp-servers/internal/*/.git/**"
|
||||||
|
- "core/mcp-servers/external/installed/**"
|
||||||
|
|
||||||
|
# Utilidades compartidas
|
||||||
|
utils:
|
||||||
|
paths:
|
||||||
|
- "core/utils/**/*"
|
||||||
|
document_type: "code"
|
||||||
|
applicable_agents: ["PERFIL_DEVELOPER"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
scripts:
|
||||||
|
paths:
|
||||||
|
- "core/scripts/**/*"
|
||||||
|
document_type: "code"
|
||||||
|
applicable_agents: ["PERFIL_DEVOPS"]
|
||||||
|
index_priority: 3
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# KNOWLEDGE-BASE - Base de Conocimiento
|
||||||
|
# ==========================================================================
|
||||||
|
knowledge-base:
|
||||||
|
base_path: "knowledge-base/"
|
||||||
|
description: "Documentacion y recursos de referencia"
|
||||||
|
priority: "alta"
|
||||||
|
|
||||||
|
subcategories:
|
||||||
|
# Documentacion tecnica
|
||||||
|
technical:
|
||||||
|
paths:
|
||||||
|
- "knowledge-base/technical/**/*.md"
|
||||||
|
document_type: "guide"
|
||||||
|
applicable_agents: ["*"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Snippets de codigo
|
||||||
|
snippets:
|
||||||
|
paths:
|
||||||
|
- "knowledge-base/snippets/**/*"
|
||||||
|
document_type: "code"
|
||||||
|
applicable_agents: ["PERFIL_DEVELOPER"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Mejores practicas
|
||||||
|
best-practices:
|
||||||
|
paths:
|
||||||
|
- "knowledge-base/best-practices/**/*.md"
|
||||||
|
document_type: "guide"
|
||||||
|
applicable_agents: ["*"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Patrones de diseno
|
||||||
|
patterns:
|
||||||
|
paths:
|
||||||
|
- "knowledge-base/patterns/**/*.md"
|
||||||
|
document_type: "guide"
|
||||||
|
applicable_agents: ["PERFIL_ARCHITECT", "PERFIL_DEVELOPER"]
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# PROJECTS - Proyectos Activos
|
||||||
|
# ==========================================================================
|
||||||
|
projects:
|
||||||
|
base_path: "projects/"
|
||||||
|
description: "Proyectos en desarrollo activo"
|
||||||
|
priority: "alta"
|
||||||
|
|
||||||
|
# Proyectos especificos
|
||||||
|
project_mappings:
|
||||||
|
|
||||||
|
# Gamilit - Sistema educativo
|
||||||
|
gamilit:
|
||||||
|
paths:
|
||||||
|
- "projects/gamilit/orchestration/**/*.md"
|
||||||
|
- "projects/gamilit/docs/**/*.md"
|
||||||
|
- "projects/gamilit/apps/*/README.md"
|
||||||
|
document_type: "spec"
|
||||||
|
project: "gamilit"
|
||||||
|
applicable_agents:
|
||||||
|
- "PERFIL_ARCHITECT"
|
||||||
|
- "PERFIL_BACKEND_DEVELOPER"
|
||||||
|
- "PERFIL_FRONTEND_DEVELOPER"
|
||||||
|
index_priority: 1
|
||||||
|
exclude:
|
||||||
|
- "projects/gamilit/**/node_modules/**"
|
||||||
|
- "projects/gamilit/**/dist/**"
|
||||||
|
- "projects/gamilit/**/.git/**"
|
||||||
|
|
||||||
|
# ERP Core - Sistema ERP
|
||||||
|
erp-core:
|
||||||
|
paths:
|
||||||
|
- "projects/erp-core/orchestration/**/*.md"
|
||||||
|
- "projects/erp-core/docs/**/*.md"
|
||||||
|
document_type: "spec"
|
||||||
|
project: "erp-core"
|
||||||
|
applicable_agents:
|
||||||
|
- "PERFIL_ARCHITECT"
|
||||||
|
- "PERFIL_DEVELOPER"
|
||||||
|
index_priority: 2
|
||||||
|
|
||||||
|
# Template de proyecto (para nuevos proyectos)
|
||||||
|
_template:
|
||||||
|
paths:
|
||||||
|
- "projects/*/orchestration/**/*.md"
|
||||||
|
- "projects/*/docs/**/*.md"
|
||||||
|
document_type: "spec"
|
||||||
|
index_priority: 3
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# EXCLUSIONES GLOBALES
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
global_exclusions:
|
||||||
|
# Carpetas de dependencias
|
||||||
|
- "**/node_modules/**"
|
||||||
|
- "**/.npm/**"
|
||||||
|
- "**/vendor/**"
|
||||||
|
|
||||||
|
# Carpetas de build
|
||||||
|
- "**/dist/**"
|
||||||
|
- "**/build/**"
|
||||||
|
- "**/.next/**"
|
||||||
|
- "**/coverage/**"
|
||||||
|
|
||||||
|
# Control de versiones
|
||||||
|
- "**/.git/**"
|
||||||
|
- "**/.svn/**"
|
||||||
|
|
||||||
|
# Cache y temporales
|
||||||
|
- "**/.cache/**"
|
||||||
|
- "**/tmp/**"
|
||||||
|
- "**/.tmp/**"
|
||||||
|
- "**/temp/**"
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
- "**/logs/**"
|
||||||
|
- "**/*.log"
|
||||||
|
|
||||||
|
# IDE y editores
|
||||||
|
- "**/.idea/**"
|
||||||
|
- "**/.vscode/**"
|
||||||
|
- "**/*.swp"
|
||||||
|
- "**/*.swo"
|
||||||
|
|
||||||
|
# Archivos binarios
|
||||||
|
- "**/*.png"
|
||||||
|
- "**/*.jpg"
|
||||||
|
- "**/*.jpeg"
|
||||||
|
- "**/*.gif"
|
||||||
|
- "**/*.ico"
|
||||||
|
- "**/*.pdf"
|
||||||
|
- "**/*.zip"
|
||||||
|
- "**/*.tar.gz"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# REGLAS DE DETECCION DE TIPO
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
type_detection:
|
||||||
|
# Por nombre de archivo
|
||||||
|
by_filename:
|
||||||
|
- pattern: "SIMCO-*.md"
|
||||||
|
type: "directiva"
|
||||||
|
- pattern: "PERFIL-*.md"
|
||||||
|
type: "perfil"
|
||||||
|
- pattern: "TEMPLATE-*.md"
|
||||||
|
type: "template"
|
||||||
|
- pattern: "EPIC-*.md"
|
||||||
|
type: "epic"
|
||||||
|
- pattern: "TRAZA-*.md"
|
||||||
|
type: "traza"
|
||||||
|
- pattern: "DDL-*.sql"
|
||||||
|
type: "spec"
|
||||||
|
- pattern: "README.md"
|
||||||
|
type: "guide"
|
||||||
|
- pattern: "*.test.ts"
|
||||||
|
type: "test"
|
||||||
|
|
||||||
|
# Por extension
|
||||||
|
by_extension:
|
||||||
|
- extension: ".md"
|
||||||
|
default_type: "guide"
|
||||||
|
- extension: ".ts"
|
||||||
|
type: "code"
|
||||||
|
- extension: ".tsx"
|
||||||
|
type: "code"
|
||||||
|
- extension: ".sql"
|
||||||
|
type: "spec"
|
||||||
|
- extension: ".yml"
|
||||||
|
type: "config"
|
||||||
|
- extension: ".yaml"
|
||||||
|
type: "config"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# RELACIONES AUTOMATICAS
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
auto_relations:
|
||||||
|
# Detectar referencias entre documentos
|
||||||
|
reference_patterns:
|
||||||
|
- pattern: "@(SIMCO[/_][A-Z-]+)"
|
||||||
|
relation_type: "references"
|
||||||
|
target_category: "orchestration"
|
||||||
|
|
||||||
|
- pattern: "@(PERFIL_[A-Z_]+)"
|
||||||
|
relation_type: "references"
|
||||||
|
target_category: "orchestration"
|
||||||
|
|
||||||
|
- pattern: "EPIC-(\\d+)"
|
||||||
|
relation_type: "references"
|
||||||
|
target_category: "orchestration"
|
||||||
|
|
||||||
|
- pattern: "MEJ-(\\d+)-(\\d+)"
|
||||||
|
relation_type: "implements"
|
||||||
|
target_category: "orchestration"
|
||||||
|
|
||||||
|
# Detectar imports en codigo
|
||||||
|
code_imports:
|
||||||
|
- pattern: "from ['\"](.+)['\"]"
|
||||||
|
relation_type: "imports"
|
||||||
|
resolve_path: true
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# SINCRONIZACION
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
sync:
|
||||||
|
# Frecuencia de sincronizacion por categoria
|
||||||
|
schedules:
|
||||||
|
orchestration:
|
||||||
|
frequency: "realtime" # Sincronizar inmediatamente al cambiar
|
||||||
|
|
||||||
|
core:
|
||||||
|
frequency: "hourly" # Cada hora
|
||||||
|
|
||||||
|
knowledge-base:
|
||||||
|
frequency: "daily" # Diariamente
|
||||||
|
|
||||||
|
projects:
|
||||||
|
frequency: "on_demand" # Solo cuando se solicite
|
||||||
|
|
||||||
|
# Hooks de sincronizacion
|
||||||
|
hooks:
|
||||||
|
pre_sync:
|
||||||
|
- validate_frontmatter: true
|
||||||
|
- check_file_size: true
|
||||||
|
- max_file_size_mb: 5
|
||||||
|
|
||||||
|
post_sync:
|
||||||
|
- update_relations: true
|
||||||
|
- validate_coverage: true
|
||||||
|
- notify_if_errors: true
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# FIN DE CONFIGURACION
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
# Arquitectura: MCP {NOMBRE}
|
||||||
|
|
||||||
|
**Version:** 0.1.0
|
||||||
|
**Fecha:** {FECHA}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Vision General
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────┐
|
||||||
|
│ Claude / Agente │
|
||||||
|
└───────────────────────────┬─────────────────────────────┘
|
||||||
|
│ MCP Protocol
|
||||||
|
v
|
||||||
|
┌─────────────────────────────────────────────────────────┐
|
||||||
|
│ MCP Server {NOMBRE} │
|
||||||
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
||||||
|
│ │ Tools │ │ Services │ │ Config │ │
|
||||||
|
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
||||||
|
└───────────────────────────┬─────────────────────────────┘
|
||||||
|
│
|
||||||
|
v
|
||||||
|
┌─────────────────────────────────────────────────────────┐
|
||||||
|
│ PostgreSQL + pgvector │
|
||||||
|
└─────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Componentes
|
||||||
|
|
||||||
|
### 2.1 Tools Layer
|
||||||
|
|
||||||
|
Herramientas expuestas via MCP Protocol:
|
||||||
|
|
||||||
|
| Tool | Descripcion |
|
||||||
|
|------|-------------|
|
||||||
|
| `{tool_1}` | {desc} |
|
||||||
|
| `{tool_2}` | {desc} |
|
||||||
|
|
||||||
|
### 2.2 Services Layer
|
||||||
|
|
||||||
|
Logica de negocio:
|
||||||
|
|
||||||
|
| Service | Responsabilidad |
|
||||||
|
|---------|-----------------|
|
||||||
|
| `{Service1}` | {resp} |
|
||||||
|
| `{Service2}` | {resp} |
|
||||||
|
|
||||||
|
### 2.3 Data Layer
|
||||||
|
|
||||||
|
Acceso a datos:
|
||||||
|
|
||||||
|
- PostgreSQL para almacenamiento persistente
|
||||||
|
- pgvector para busqueda semantica
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Flujo de Datos
|
||||||
|
|
||||||
|
```
|
||||||
|
Request (Tool Call)
|
||||||
|
│
|
||||||
|
v
|
||||||
|
Validate Input
|
||||||
|
│
|
||||||
|
v
|
||||||
|
Service Logic
|
||||||
|
│
|
||||||
|
v
|
||||||
|
Database Query
|
||||||
|
│
|
||||||
|
v
|
||||||
|
Format Response
|
||||||
|
│
|
||||||
|
v
|
||||||
|
Response (Tool Result)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Tecnologias
|
||||||
|
|
||||||
|
| Componente | Tecnologia |
|
||||||
|
|------------|------------|
|
||||||
|
| Runtime | Node.js 18+ |
|
||||||
|
| Lenguaje | TypeScript 5+ |
|
||||||
|
| Database | PostgreSQL 15+ |
|
||||||
|
| Vector Search | pgvector |
|
||||||
|
| HTTP | Express |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Seguridad
|
||||||
|
|
||||||
|
- Variables sensibles en .env (no versionado)
|
||||||
|
- Validacion de entrada en cada tool
|
||||||
|
- Conexion a DB via SSL en produccion
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Documento generado:** {FECHA}
|
||||||
@ -0,0 +1,432 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- DDL-RAG-SCHEMA.sql
|
||||||
|
-- Schema de Base de Datos para Sistema RAG
|
||||||
|
-- ============================================================================
|
||||||
|
-- Version: 1.0.0
|
||||||
|
-- Fecha: 2026-01-04
|
||||||
|
-- Database: PostgreSQL 15+ con extension pgvector
|
||||||
|
-- EPIC: EPIC-013
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- EXTENSIONES REQUERIDAS
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
CREATE EXTENSION IF NOT EXISTS vector; -- Para embeddings y busqueda semantica
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pg_trgm; -- Para busqueda fuzzy de texto
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TABLA: documents
|
||||||
|
-- ============================================================================
|
||||||
|
-- Almacena documentos indexados del workspace
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS documents (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
|
||||||
|
-- Identificacion
|
||||||
|
path TEXT NOT NULL UNIQUE, -- Ruta relativa al workspace
|
||||||
|
title TEXT NOT NULL, -- Titulo del documento
|
||||||
|
|
||||||
|
-- Clasificacion
|
||||||
|
category TEXT NOT NULL, -- orchestration, core, knowledge-base, projects
|
||||||
|
subcategory TEXT, -- directivas, perfiles, templates, etc.
|
||||||
|
document_type TEXT NOT NULL, -- directiva, perfil, template, spec, code, guide
|
||||||
|
project TEXT, -- Proyecto especifico (gamilit, erp-core, etc.)
|
||||||
|
|
||||||
|
-- Contenido
|
||||||
|
content TEXT NOT NULL, -- Contenido completo del documento
|
||||||
|
content_hash TEXT NOT NULL, -- Hash para detectar cambios
|
||||||
|
|
||||||
|
-- Metadata
|
||||||
|
applicable_agents TEXT[] DEFAULT '{}', -- Agentes que deben conocer este doc
|
||||||
|
metadata JSONB DEFAULT '{}', -- Metadata adicional flexible
|
||||||
|
frontmatter JSONB, -- Frontmatter parseado (si existe)
|
||||||
|
|
||||||
|
-- Timestamps
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
|
||||||
|
-- Soft delete
|
||||||
|
is_deleted BOOLEAN DEFAULT FALSE,
|
||||||
|
deleted_at TIMESTAMPTZ
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Indices para documents
|
||||||
|
CREATE INDEX idx_documents_path ON documents(path);
|
||||||
|
CREATE INDEX idx_documents_category ON documents(category);
|
||||||
|
CREATE INDEX idx_documents_type ON documents(document_type);
|
||||||
|
CREATE INDEX idx_documents_project ON documents(project);
|
||||||
|
CREATE INDEX idx_documents_agents ON documents USING GIN(applicable_agents);
|
||||||
|
CREATE INDEX idx_documents_deleted ON documents(is_deleted) WHERE is_deleted = FALSE;
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TABLA: document_chunks
|
||||||
|
-- ============================================================================
|
||||||
|
-- Chunks de documentos con embeddings para busqueda semantica
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS document_chunks (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
document_id UUID REFERENCES documents(id) ON DELETE CASCADE,
|
||||||
|
|
||||||
|
-- Posicion
|
||||||
|
chunk_index INTEGER NOT NULL, -- Orden del chunk en el documento
|
||||||
|
|
||||||
|
-- Contenido
|
||||||
|
content TEXT NOT NULL, -- Contenido del chunk
|
||||||
|
heading_path TEXT[] DEFAULT '{}', -- Jerarquia de headings (## Seccion > ### Subseccion)
|
||||||
|
|
||||||
|
-- Ubicacion en archivo original
|
||||||
|
line_start INTEGER, -- Linea de inicio
|
||||||
|
line_end INTEGER, -- Linea de fin
|
||||||
|
|
||||||
|
-- Embedding
|
||||||
|
embedding vector(1536), -- Vector de embedding (OpenAI ada-002)
|
||||||
|
|
||||||
|
-- Timestamps
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
|
||||||
|
-- Constraint de unicidad
|
||||||
|
UNIQUE(document_id, chunk_index)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Indice IVFFlat para busqueda por similitud coseno
|
||||||
|
-- lists = 100 es un buen balance para ~10k-100k chunks
|
||||||
|
CREATE INDEX idx_chunks_embedding ON document_chunks
|
||||||
|
USING ivfflat (embedding vector_cosine_ops)
|
||||||
|
WITH (lists = 100);
|
||||||
|
|
||||||
|
CREATE INDEX idx_chunks_document ON document_chunks(document_id);
|
||||||
|
CREATE INDEX idx_chunks_heading ON document_chunks USING GIN(heading_path);
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TABLA: document_relations
|
||||||
|
-- ============================================================================
|
||||||
|
-- Relaciones entre documentos (grafo de dependencias)
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS document_relations (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
|
||||||
|
-- Documentos relacionados
|
||||||
|
source_document_id UUID REFERENCES documents(id) ON DELETE CASCADE,
|
||||||
|
target_document_id UUID REFERENCES documents(id) ON DELETE CASCADE,
|
||||||
|
|
||||||
|
-- Tipo de relacion
|
||||||
|
relation_type TEXT NOT NULL, -- references, extends, implements, uses, etc.
|
||||||
|
context TEXT, -- Contexto adicional de la relacion
|
||||||
|
|
||||||
|
-- Metadata
|
||||||
|
auto_detected BOOLEAN DEFAULT FALSE, -- True si fue detectado automaticamente
|
||||||
|
|
||||||
|
-- Timestamps
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
|
||||||
|
-- Constraint para evitar duplicados
|
||||||
|
UNIQUE(source_document_id, target_document_id, relation_type)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Indices para relaciones
|
||||||
|
CREATE INDEX idx_relations_source ON document_relations(source_document_id);
|
||||||
|
CREATE INDEX idx_relations_target ON document_relations(target_document_id);
|
||||||
|
CREATE INDEX idx_relations_type ON document_relations(relation_type);
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TABLA: code_references
|
||||||
|
-- ============================================================================
|
||||||
|
-- Referencias a codigo encontradas en documentos
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS code_references (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
document_id UUID REFERENCES documents(id) ON DELETE CASCADE,
|
||||||
|
|
||||||
|
-- Identificacion del codigo
|
||||||
|
code_path TEXT NOT NULL, -- Ruta al archivo de codigo
|
||||||
|
code_name TEXT NOT NULL, -- Nombre (funcion, clase, etc.)
|
||||||
|
code_type TEXT NOT NULL, -- function, class, interface, const, type
|
||||||
|
|
||||||
|
-- Metadata
|
||||||
|
language TEXT, -- typescript, javascript, sql, etc.
|
||||||
|
line_start INTEGER, -- Linea de inicio en codigo
|
||||||
|
line_end INTEGER, -- Linea de fin
|
||||||
|
context TEXT, -- Contexto de la referencia
|
||||||
|
|
||||||
|
-- Timestamps
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Indices para referencias de codigo
|
||||||
|
CREATE INDEX idx_code_refs_document ON code_references(document_id);
|
||||||
|
CREATE INDEX idx_code_refs_path ON code_references(code_path);
|
||||||
|
CREATE INDEX idx_code_refs_name ON code_references(code_name);
|
||||||
|
CREATE INDEX idx_code_refs_type ON code_references(code_type);
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TABLA: sync_log
|
||||||
|
-- ============================================================================
|
||||||
|
-- Log de sincronizacion para tracking
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS sync_log (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
|
||||||
|
-- Operacion
|
||||||
|
operation TEXT NOT NULL, -- index, update, delete, sync_category
|
||||||
|
document_path TEXT, -- Ruta del documento (si aplica)
|
||||||
|
category TEXT, -- Categoria (si aplica)
|
||||||
|
|
||||||
|
-- Resultado
|
||||||
|
status TEXT NOT NULL, -- success, error, skipped
|
||||||
|
message TEXT, -- Mensaje de resultado
|
||||||
|
chunks_processed INTEGER DEFAULT 0, -- Chunks procesados
|
||||||
|
duration_ms INTEGER, -- Duracion en milisegundos
|
||||||
|
|
||||||
|
-- Timestamps
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_sync_log_created ON sync_log(created_at DESC);
|
||||||
|
CREATE INDEX idx_sync_log_status ON sync_log(status);
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- FUNCIONES DE BUSQUEDA
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- Busqueda semantica principal
|
||||||
|
CREATE OR REPLACE FUNCTION search_knowledge(
|
||||||
|
query_embedding vector(1536),
|
||||||
|
p_category TEXT DEFAULT NULL,
|
||||||
|
p_document_type TEXT DEFAULT NULL,
|
||||||
|
p_project TEXT DEFAULT NULL,
|
||||||
|
p_agent TEXT DEFAULT NULL,
|
||||||
|
p_threshold FLOAT DEFAULT 0.7,
|
||||||
|
p_limit INTEGER DEFAULT 10
|
||||||
|
)
|
||||||
|
RETURNS TABLE (
|
||||||
|
document_id UUID,
|
||||||
|
chunk_id UUID,
|
||||||
|
path TEXT,
|
||||||
|
title TEXT,
|
||||||
|
category TEXT,
|
||||||
|
document_type TEXT,
|
||||||
|
chunk_content TEXT,
|
||||||
|
heading_path TEXT[],
|
||||||
|
line_start INTEGER,
|
||||||
|
line_end INTEGER,
|
||||||
|
similarity FLOAT,
|
||||||
|
applicable_agents TEXT[]
|
||||||
|
)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT
|
||||||
|
d.id as document_id,
|
||||||
|
c.id as chunk_id,
|
||||||
|
d.path,
|
||||||
|
d.title,
|
||||||
|
d.category,
|
||||||
|
d.document_type,
|
||||||
|
c.content as chunk_content,
|
||||||
|
c.heading_path,
|
||||||
|
c.line_start,
|
||||||
|
c.line_end,
|
||||||
|
1 - (c.embedding <=> query_embedding) as similarity,
|
||||||
|
d.applicable_agents
|
||||||
|
FROM document_chunks c
|
||||||
|
JOIN documents d ON d.id = c.document_id
|
||||||
|
WHERE
|
||||||
|
d.is_deleted = FALSE
|
||||||
|
AND (p_category IS NULL OR d.category = p_category)
|
||||||
|
AND (p_document_type IS NULL OR d.document_type = p_document_type)
|
||||||
|
AND (p_project IS NULL OR d.project = p_project)
|
||||||
|
AND (p_agent IS NULL OR p_agent = ANY(d.applicable_agents))
|
||||||
|
AND 1 - (c.embedding <=> query_embedding) > p_threshold
|
||||||
|
ORDER BY c.embedding <=> query_embedding
|
||||||
|
LIMIT p_limit;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
-- Obtener documentos relacionados (recursivo)
|
||||||
|
CREATE OR REPLACE FUNCTION get_related_documents(
|
||||||
|
p_document_id UUID,
|
||||||
|
p_relation_types TEXT[] DEFAULT NULL,
|
||||||
|
p_depth INTEGER DEFAULT 1
|
||||||
|
)
|
||||||
|
RETURNS TABLE (
|
||||||
|
document_id UUID,
|
||||||
|
path TEXT,
|
||||||
|
title TEXT,
|
||||||
|
relation_type TEXT,
|
||||||
|
relation_depth INTEGER,
|
||||||
|
relation_context TEXT
|
||||||
|
)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
RETURN QUERY
|
||||||
|
WITH RECURSIVE related AS (
|
||||||
|
-- Nivel 0: documento inicial
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.path,
|
||||||
|
d.title,
|
||||||
|
NULL::TEXT as rel_type,
|
||||||
|
0 as depth,
|
||||||
|
NULL::TEXT as context
|
||||||
|
FROM documents d
|
||||||
|
WHERE d.id = p_document_id
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
-- Niveles siguientes
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.path,
|
||||||
|
d.title,
|
||||||
|
r.relation_type,
|
||||||
|
related.depth + 1,
|
||||||
|
r.context
|
||||||
|
FROM related
|
||||||
|
JOIN document_relations r ON r.source_document_id = related.id
|
||||||
|
JOIN documents d ON d.id = r.target_document_id
|
||||||
|
WHERE
|
||||||
|
related.depth < p_depth
|
||||||
|
AND d.is_deleted = FALSE
|
||||||
|
AND (p_relation_types IS NULL OR r.relation_type = ANY(p_relation_types))
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
related.id as document_id,
|
||||||
|
related.path,
|
||||||
|
related.title,
|
||||||
|
related.rel_type as relation_type,
|
||||||
|
related.depth as relation_depth,
|
||||||
|
related.context as relation_context
|
||||||
|
FROM related
|
||||||
|
WHERE related.depth > 0
|
||||||
|
ORDER BY related.depth, related.title;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
-- Trazar referencia (para evitar alucinaciones)
|
||||||
|
CREATE OR REPLACE FUNCTION trace_reference(
|
||||||
|
p_query TEXT,
|
||||||
|
p_embedding vector(1536)
|
||||||
|
)
|
||||||
|
RETURNS TABLE (
|
||||||
|
source_type TEXT,
|
||||||
|
source_path TEXT,
|
||||||
|
source_title TEXT,
|
||||||
|
line_reference TEXT,
|
||||||
|
content_snippet TEXT,
|
||||||
|
confidence FLOAT,
|
||||||
|
related_documents JSONB
|
||||||
|
)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
RETURN QUERY
|
||||||
|
WITH best_matches AS (
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.path,
|
||||||
|
d.title,
|
||||||
|
d.category as src_type,
|
||||||
|
c.line_start,
|
||||||
|
c.line_end,
|
||||||
|
c.content,
|
||||||
|
1 - (c.embedding <=> p_embedding) as sim
|
||||||
|
FROM document_chunks c
|
||||||
|
JOIN documents d ON d.id = c.document_id
|
||||||
|
WHERE
|
||||||
|
d.is_deleted = FALSE
|
||||||
|
AND 1 - (c.embedding <=> p_embedding) > 0.75
|
||||||
|
ORDER BY c.embedding <=> p_embedding
|
||||||
|
LIMIT 5
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
bm.src_type as source_type,
|
||||||
|
bm.path as source_path,
|
||||||
|
bm.title as source_title,
|
||||||
|
bm.path || ':' || bm.line_start || '-' || bm.line_end as line_reference,
|
||||||
|
LEFT(bm.content, 500) as content_snippet,
|
||||||
|
bm.sim as confidence,
|
||||||
|
(
|
||||||
|
SELECT jsonb_agg(jsonb_build_object(
|
||||||
|
'path', d.path,
|
||||||
|
'title', d.title,
|
||||||
|
'relation', r.relation_type
|
||||||
|
))
|
||||||
|
FROM document_relations r
|
||||||
|
JOIN documents d ON d.id = r.target_document_id
|
||||||
|
WHERE r.source_document_id = bm.id
|
||||||
|
LIMIT 5
|
||||||
|
) as related_documents
|
||||||
|
FROM best_matches bm;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- TRIGGERS
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- Actualizar updated_at automaticamente
|
||||||
|
CREATE OR REPLACE FUNCTION update_updated_at()
|
||||||
|
RETURNS TRIGGER AS $$
|
||||||
|
BEGIN
|
||||||
|
NEW.updated_at = NOW();
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
CREATE TRIGGER trigger_documents_updated_at
|
||||||
|
BEFORE UPDATE ON documents
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION update_updated_at();
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- VISTAS UTILES
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- Vista de documentos con estadisticas
|
||||||
|
CREATE OR REPLACE VIEW v_document_stats AS
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.path,
|
||||||
|
d.title,
|
||||||
|
d.category,
|
||||||
|
d.document_type,
|
||||||
|
d.project,
|
||||||
|
COUNT(c.id) as chunk_count,
|
||||||
|
d.created_at,
|
||||||
|
d.updated_at
|
||||||
|
FROM documents d
|
||||||
|
LEFT JOIN document_chunks c ON c.document_id = d.id
|
||||||
|
WHERE d.is_deleted = FALSE
|
||||||
|
GROUP BY d.id;
|
||||||
|
|
||||||
|
-- Vista de estado de sincronizacion por categoria
|
||||||
|
CREATE OR REPLACE VIEW v_sync_status AS
|
||||||
|
SELECT
|
||||||
|
category,
|
||||||
|
COUNT(*) as total_documents,
|
||||||
|
MAX(updated_at) as last_updated,
|
||||||
|
COUNT(CASE WHEN updated_at < NOW() - INTERVAL '1 hour' THEN 1 END) as stale_count
|
||||||
|
FROM documents
|
||||||
|
WHERE is_deleted = FALSE
|
||||||
|
GROUP BY category;
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- COMENTARIOS
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
COMMENT ON TABLE documents IS 'Documentos indexados del workspace para busqueda RAG';
|
||||||
|
COMMENT ON TABLE document_chunks IS 'Chunks de documentos con embeddings para busqueda semantica';
|
||||||
|
COMMENT ON TABLE document_relations IS 'Grafo de relaciones entre documentos';
|
||||||
|
COMMENT ON TABLE code_references IS 'Referencias a codigo encontradas en documentos';
|
||||||
|
COMMENT ON TABLE sync_log IS 'Log de operaciones de sincronizacion';
|
||||||
|
|
||||||
|
COMMENT ON FUNCTION search_knowledge IS 'Busqueda semantica principal con filtros';
|
||||||
|
COMMENT ON FUNCTION get_related_documents IS 'Obtiene grafo de documentos relacionados recursivamente';
|
||||||
|
COMMENT ON FUNCTION trace_reference IS 'Verifica origen de informacion para evitar alucinaciones';
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- FIN DEL SCHEMA
|
||||||
|
-- ============================================================================
|
||||||
@ -0,0 +1,687 @@
|
|||||||
|
# MCP-TOOLS-SPEC: Especificación de Herramientas RAG
|
||||||
|
|
||||||
|
**Version:** 1.0.0
|
||||||
|
**Fecha:** 2026-01-04
|
||||||
|
**MCP Server:** mcp-rag-knowledge
|
||||||
|
**EPIC:** EPIC-013
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## RESUMEN
|
||||||
|
|
||||||
|
Este documento especifica las 12 herramientas MCP del sistema RAG para consulta y gestión del conocimiento del workspace.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HERRAMIENTAS DE CONSULTA SEMÁNTICA
|
||||||
|
|
||||||
|
### 1. rag_query_context
|
||||||
|
|
||||||
|
**Descripción:** Busqueda semántica principal sobre el conocimiento del workspace.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| query | string | Sí | Pregunta o consulta en lenguaje natural |
|
||||||
|
| category | string | No | Filtrar por categoría (orchestration, core, knowledge-base, projects) |
|
||||||
|
| document_type | string | No | Filtrar por tipo (directiva, perfil, template, code, spec, guide) |
|
||||||
|
| project | string | No | Filtrar por proyecto específico |
|
||||||
|
| agent | string | No | Filtrar documentos aplicables a un agente específico |
|
||||||
|
| threshold | float | No | Umbral mínimo de similitud (default: 0.7) |
|
||||||
|
| limit | integer | No | Máximo de resultados (default: 10) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface QueryResult {
|
||||||
|
results: Array<{
|
||||||
|
document_id: string;
|
||||||
|
chunk_id: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
category: string;
|
||||||
|
document_type: string;
|
||||||
|
content: string;
|
||||||
|
heading_path: string[];
|
||||||
|
line_start: number;
|
||||||
|
line_end: number;
|
||||||
|
similarity: number;
|
||||||
|
applicable_agents: string[];
|
||||||
|
}>;
|
||||||
|
query_time_ms: number;
|
||||||
|
total_matches: number;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const result = await rag_query_context({
|
||||||
|
query: "¿Cómo se debe documentar un cambio según SIMCO?",
|
||||||
|
category: "orchestration",
|
||||||
|
threshold: 0.75,
|
||||||
|
limit: 5
|
||||||
|
});
|
||||||
|
|
||||||
|
// Resultado esperado:
|
||||||
|
// {
|
||||||
|
// results: [{
|
||||||
|
// path: "orchestration/directivas/simco/SIMCO-DOCUMENTAR.md",
|
||||||
|
// title: "SIMCO-DOCUMENTAR",
|
||||||
|
// similarity: 0.89,
|
||||||
|
// content: "## Proceso de Documentación...",
|
||||||
|
// line_start: 45,
|
||||||
|
// line_end: 78
|
||||||
|
// }],
|
||||||
|
// query_time_ms: 120,
|
||||||
|
// total_matches: 3
|
||||||
|
// }
|
||||||
|
```
|
||||||
|
|
||||||
|
**Errores Comunes:**
|
||||||
|
|
||||||
|
| Código | Mensaje | Solución |
|
||||||
|
|--------|---------|----------|
|
||||||
|
| 400 | "Query too short" | Proporcionar query de al menos 3 palabras |
|
||||||
|
| 404 | "No results found" | Reducir threshold o generalizar query |
|
||||||
|
| 503 | "Embedding service unavailable" | Reintentar después de unos segundos |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. rag_get_directive
|
||||||
|
|
||||||
|
**Descripción:** Obtiene una directiva SIMCO específica por su identificador.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| directive_id | string | Sí | Identificador de la directiva (ej: "SIMCO-TAREA") |
|
||||||
|
| include_relations | boolean | No | Incluir documentos relacionados (default: false) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface DirectiveResult {
|
||||||
|
found: boolean;
|
||||||
|
directive: {
|
||||||
|
id: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
version: string;
|
||||||
|
priority: string;
|
||||||
|
applies_to: string;
|
||||||
|
content: string;
|
||||||
|
sections: Array<{
|
||||||
|
heading: string;
|
||||||
|
content: string;
|
||||||
|
line_start: number;
|
||||||
|
line_end: number;
|
||||||
|
}>;
|
||||||
|
checklist: string[];
|
||||||
|
};
|
||||||
|
relations?: Array<{
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
relation_type: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const directive = await rag_get_directive({
|
||||||
|
directive_id: "SIMCO-RAG",
|
||||||
|
include_relations: true
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. rag_get_agent_profile
|
||||||
|
|
||||||
|
**Descripción:** Carga el perfil completo de un agente para inicialización.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| agent_id | string | Sí | Identificador del agente (ej: "PERFIL_BACKEND_DEVELOPER") |
|
||||||
|
| include_directives | boolean | No | Incluir directivas aplicables (default: true) |
|
||||||
|
| include_tools | boolean | No | Incluir herramientas MCP disponibles (default: true) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface AgentProfileResult {
|
||||||
|
found: boolean;
|
||||||
|
profile: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
system: string;
|
||||||
|
context_level: string;
|
||||||
|
responsibilities: string[];
|
||||||
|
applicable_directives: string[];
|
||||||
|
mcp_tools: string[];
|
||||||
|
constraints: string[];
|
||||||
|
full_content: string;
|
||||||
|
};
|
||||||
|
directives?: DirectiveResult[];
|
||||||
|
tools?: ToolSpec[];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const profile = await rag_get_agent_profile({
|
||||||
|
agent_id: "PERFIL_MCP_DEVELOPER",
|
||||||
|
include_directives: true,
|
||||||
|
include_tools: true
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HERRAMIENTAS DE TRAZABILIDAD
|
||||||
|
|
||||||
|
### 4. rag_trace_reference
|
||||||
|
|
||||||
|
**Descripción:** Verifica el origen de una afirmación para prevenir alucinaciones.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| claim | string | Sí | Afirmación a verificar |
|
||||||
|
| context | string | No | Contexto adicional para la búsqueda |
|
||||||
|
| min_confidence | float | No | Confianza mínima requerida (default: 0.75) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface TraceResult {
|
||||||
|
verified: boolean;
|
||||||
|
sources: Array<{
|
||||||
|
source_type: string;
|
||||||
|
source_path: string;
|
||||||
|
source_title: string;
|
||||||
|
line_reference: string; // formato: "path:line_start-line_end"
|
||||||
|
content_snippet: string;
|
||||||
|
confidence: number;
|
||||||
|
related_documents: Array<{
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
relation: string;
|
||||||
|
}>;
|
||||||
|
}>;
|
||||||
|
recommendation: "cite" | "verify" | "cannot_confirm";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const trace = await rag_trace_reference({
|
||||||
|
claim: "Las directivas SIMCO son obligatorias para todos los agentes",
|
||||||
|
min_confidence: 0.8
|
||||||
|
});
|
||||||
|
|
||||||
|
// Si verified = true, usar las fuentes para citar
|
||||||
|
// Si verified = false, indicar que no se puede confirmar
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. rag_get_relations
|
||||||
|
|
||||||
|
**Descripción:** Obtiene el grafo de relaciones de un documento.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| document_path | string | Sí | Ruta del documento |
|
||||||
|
| relation_types | string[] | No | Filtrar por tipos de relación |
|
||||||
|
| depth | integer | No | Profundidad de recursión (default: 1, max: 3) |
|
||||||
|
| direction | string | No | "outgoing" \| "incoming" \| "both" (default: "both") |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface RelationsResult {
|
||||||
|
document: {
|
||||||
|
id: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
};
|
||||||
|
relations: Array<{
|
||||||
|
document_id: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
relation_type: string;
|
||||||
|
relation_depth: number;
|
||||||
|
direction: "outgoing" | "incoming";
|
||||||
|
context: string;
|
||||||
|
}>;
|
||||||
|
graph_summary: {
|
||||||
|
total_relations: number;
|
||||||
|
by_type: Record<string, number>;
|
||||||
|
max_depth_reached: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Tipos de Relación:**
|
||||||
|
|
||||||
|
| Tipo | Descripción |
|
||||||
|
|------|-------------|
|
||||||
|
| references | Documento A menciona/cita a documento B |
|
||||||
|
| extends | Documento A extiende/amplía documento B |
|
||||||
|
| implements | Documento A implementa especificación B |
|
||||||
|
| uses | Documento A usa/depende de documento B |
|
||||||
|
| supersedes | Documento A reemplaza documento B |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 6. rag_find_code
|
||||||
|
|
||||||
|
**Descripción:** Busca referencias de código en el workspace.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| name | string | No | Nombre de función/clase/tipo a buscar |
|
||||||
|
| code_type | string | No | Tipo: function, class, interface, const, type |
|
||||||
|
| language | string | No | Lenguaje: typescript, javascript, sql, python |
|
||||||
|
| path_pattern | string | No | Patrón glob para filtrar rutas |
|
||||||
|
| include_context | boolean | No | Incluir código circundante (default: true) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface CodeSearchResult {
|
||||||
|
matches: Array<{
|
||||||
|
path: string;
|
||||||
|
name: string;
|
||||||
|
code_type: string;
|
||||||
|
language: string;
|
||||||
|
line_start: number;
|
||||||
|
line_end: number;
|
||||||
|
signature: string;
|
||||||
|
documentation: string;
|
||||||
|
code_snippet: string;
|
||||||
|
related_documents: string[]; // Documentos que referencian este código
|
||||||
|
}>;
|
||||||
|
total_matches: number;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const code = await rag_find_code({
|
||||||
|
name: "validateParams",
|
||||||
|
code_type: "function",
|
||||||
|
language: "typescript"
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. rag_explain_impact
|
||||||
|
|
||||||
|
**Descripción:** Analiza el impacto de modificar un documento.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| document_path | string | Sí | Ruta del documento a analizar |
|
||||||
|
| change_type | string | Sí | "create" \| "modify" \| "delete" |
|
||||||
|
| affected_sections | string[] | No | Secciones específicas afectadas |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ImpactAnalysis {
|
||||||
|
document: {
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
category: string;
|
||||||
|
document_type: string;
|
||||||
|
};
|
||||||
|
impact: {
|
||||||
|
direct_dependents: Array<{
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
relation_type: string;
|
||||||
|
impact_level: "high" | "medium" | "low";
|
||||||
|
}>;
|
||||||
|
indirect_dependents: Array<{
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
distance: number;
|
||||||
|
impact_level: "high" | "medium" | "low";
|
||||||
|
}>;
|
||||||
|
agents_affected: string[];
|
||||||
|
risk_level: "critical" | "high" | "medium" | "low";
|
||||||
|
propagation_order: string[]; // Orden sugerido para actualizar
|
||||||
|
};
|
||||||
|
recommendations: string[];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const impact = await rag_explain_impact({
|
||||||
|
document_path: "orchestration/directivas/simco/SIMCO-TAREA.md",
|
||||||
|
change_type: "modify",
|
||||||
|
affected_sections: ["PRINCIPIO FUNDAMENTAL"]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Antes de hacer cambios significativos, revisar:
|
||||||
|
// - impact.risk_level
|
||||||
|
// - impact.agents_affected
|
||||||
|
// - impact.propagation_order
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HERRAMIENTAS DE INDEXACIÓN
|
||||||
|
|
||||||
|
### 8. rag_index_document
|
||||||
|
|
||||||
|
**Descripción:** Indexa o re-indexa un documento en el sistema RAG.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| path | string | Sí | Ruta del documento a indexar |
|
||||||
|
| force | boolean | No | Forzar re-indexación aunque no haya cambios (default: false) |
|
||||||
|
| extract_relations | boolean | No | Detectar y crear relaciones automáticamente (default: true) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface IndexResult {
|
||||||
|
success: boolean;
|
||||||
|
document: {
|
||||||
|
id: string;
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
category: string;
|
||||||
|
document_type: string;
|
||||||
|
};
|
||||||
|
indexing: {
|
||||||
|
chunks_created: number;
|
||||||
|
relations_detected: number;
|
||||||
|
code_references_found: number;
|
||||||
|
processing_time_ms: number;
|
||||||
|
};
|
||||||
|
status: "created" | "updated" | "unchanged" | "error";
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Después de crear o modificar un documento
|
||||||
|
const result = await rag_index_document({
|
||||||
|
path: "orchestration/directivas/simco/SIMCO-NUEVA.md",
|
||||||
|
extract_relations: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
console.log(`Indexado: ${result.indexing.chunks_created} chunks`);
|
||||||
|
} else {
|
||||||
|
console.error(`Error: ${result.error}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 9. rag_sync_category
|
||||||
|
|
||||||
|
**Descripción:** Sincroniza todos los documentos de una categoría.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| category | string | Sí | Categoría a sincronizar |
|
||||||
|
| subcategory | string | No | Subcategoría específica |
|
||||||
|
| force | boolean | No | Forzar re-indexación completa (default: false) |
|
||||||
|
| dry_run | boolean | No | Solo simular, no hacer cambios (default: false) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface SyncResult {
|
||||||
|
category: string;
|
||||||
|
subcategory?: string;
|
||||||
|
summary: {
|
||||||
|
total_files: number;
|
||||||
|
indexed: number;
|
||||||
|
updated: number;
|
||||||
|
unchanged: number;
|
||||||
|
deleted: number;
|
||||||
|
errors: number;
|
||||||
|
};
|
||||||
|
details: Array<{
|
||||||
|
path: string;
|
||||||
|
status: "indexed" | "updated" | "unchanged" | "deleted" | "error";
|
||||||
|
chunks: number;
|
||||||
|
error?: string;
|
||||||
|
}>;
|
||||||
|
duration_ms: number;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Sincronizar todas las directivas
|
||||||
|
const sync = await rag_sync_category({
|
||||||
|
category: "orchestration",
|
||||||
|
subcategory: "directivas",
|
||||||
|
dry_run: false
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Sincronizado: ${sync.summary.indexed} nuevos, ${sync.summary.updated} actualizados`);
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 10. rag_get_sync_status
|
||||||
|
|
||||||
|
**Descripción:** Obtiene el estado de sincronización del sistema.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| category | string | No | Filtrar por categoría |
|
||||||
|
| include_stale | boolean | No | Incluir documentos desactualizados (default: true) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface SyncStatus {
|
||||||
|
overall: {
|
||||||
|
total_documents: number;
|
||||||
|
total_chunks: number;
|
||||||
|
last_sync: string; // ISO timestamp
|
||||||
|
health: "healthy" | "degraded" | "unhealthy";
|
||||||
|
};
|
||||||
|
by_category: Array<{
|
||||||
|
category: string;
|
||||||
|
total_documents: number;
|
||||||
|
last_updated: string;
|
||||||
|
stale_count: number;
|
||||||
|
stale_documents?: string[];
|
||||||
|
}>;
|
||||||
|
pending_sync: Array<{
|
||||||
|
path: string;
|
||||||
|
reason: "new" | "modified" | "deleted";
|
||||||
|
detected_at: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HERRAMIENTAS DE VALIDACIÓN
|
||||||
|
|
||||||
|
### 11. rag_validate_coverage
|
||||||
|
|
||||||
|
**Descripción:** Verifica la cobertura de indexación del workspace.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| category | string | No | Categoría a validar (todas si no se especifica) |
|
||||||
|
| report_missing | boolean | No | Incluir lista de archivos no indexados (default: true) |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface CoverageReport {
|
||||||
|
summary: {
|
||||||
|
total_files_expected: number;
|
||||||
|
total_files_indexed: number;
|
||||||
|
coverage_percentage: number;
|
||||||
|
health: "complete" | "partial" | "incomplete";
|
||||||
|
};
|
||||||
|
by_category: Array<{
|
||||||
|
category: string;
|
||||||
|
expected: number;
|
||||||
|
indexed: number;
|
||||||
|
coverage: number;
|
||||||
|
}>;
|
||||||
|
missing: Array<{
|
||||||
|
path: string;
|
||||||
|
category: string;
|
||||||
|
reason: "not_indexed" | "outdated" | "excluded";
|
||||||
|
}>;
|
||||||
|
recommendations: string[];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const coverage = await rag_validate_coverage({
|
||||||
|
category: "orchestration",
|
||||||
|
report_missing: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (coverage.summary.coverage_percentage < 100) {
|
||||||
|
console.log("Documentos faltantes:", coverage.missing);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 12. rag_report_feedback
|
||||||
|
|
||||||
|
**Descripción:** Reporta problemas de calidad en el sistema RAG.
|
||||||
|
|
||||||
|
**Parámetros:**
|
||||||
|
|
||||||
|
| Nombre | Tipo | Requerido | Descripción |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| feedback_type | string | Sí | "missing_info" \| "incorrect_info" \| "outdated" \| "low_relevance" |
|
||||||
|
| query | string | Sí | Query que generó el problema |
|
||||||
|
| context | string | No | Contexto adicional del problema |
|
||||||
|
| document_path | string | No | Documento específico afectado |
|
||||||
|
| expected_result | string | No | Qué se esperaba encontrar |
|
||||||
|
|
||||||
|
**Retorno:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface FeedbackResult {
|
||||||
|
feedback_id: string;
|
||||||
|
received: boolean;
|
||||||
|
suggested_actions: Array<{
|
||||||
|
action: string;
|
||||||
|
priority: "high" | "medium" | "low";
|
||||||
|
automated: boolean;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ejemplo:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Cuando una búsqueda no encuentra lo esperado
|
||||||
|
const feedback = await rag_report_feedback({
|
||||||
|
feedback_type: "missing_info",
|
||||||
|
query: "¿Cómo configurar hooks en NEXUS?",
|
||||||
|
expected_result: "Debería encontrar SIMCO-HOOKS pero no está indexado",
|
||||||
|
document_path: "orchestration/directivas/simco/SIMCO-HOOKS.md"
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SCHEMAS JSON PARA REGISTRO MCP
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// schemas/tools.ts
|
||||||
|
export const toolSchemas = {
|
||||||
|
rag_query_context: {
|
||||||
|
name: "rag_query_context",
|
||||||
|
description: "Búsqueda semántica en el conocimiento del workspace",
|
||||||
|
parameters: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
query: { type: "string", description: "Consulta en lenguaje natural" },
|
||||||
|
category: { type: "string", enum: ["orchestration", "core", "knowledge-base", "projects"] },
|
||||||
|
document_type: { type: "string", enum: ["directiva", "perfil", "template", "code", "spec", "guide"] },
|
||||||
|
project: { type: "string" },
|
||||||
|
agent: { type: "string" },
|
||||||
|
threshold: { type: "number", default: 0.7 },
|
||||||
|
limit: { type: "integer", default: 10 }
|
||||||
|
},
|
||||||
|
required: ["query"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// ... resto de schemas
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## NOTAS DE IMPLEMENTACIÓN
|
||||||
|
|
||||||
|
### Manejo de Errores
|
||||||
|
|
||||||
|
Todas las herramientas deben manejar:
|
||||||
|
|
||||||
|
1. **Errores de conexión:** Reintentar con backoff exponencial
|
||||||
|
2. **Errores de embedding:** Cachear embeddings para evitar recálculos
|
||||||
|
3. **Documentos no encontrados:** Retornar resultado vacío, no error
|
||||||
|
|
||||||
|
### Rate Limiting
|
||||||
|
|
||||||
|
- Embeddings: Máximo 100 requests/minuto a OpenAI
|
||||||
|
- Queries: Sin límite interno (depende de PostgreSQL)
|
||||||
|
- Sync: Máximo 1 sync completo por minuto
|
||||||
|
|
||||||
|
### Caché
|
||||||
|
|
||||||
|
- Embeddings: Cache de 7 días en PostgreSQL
|
||||||
|
- Queries: Cache de 5 minutos para queries idénticos
|
||||||
|
- Perfiles: Cache en memoria durante sesión
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Version:** 1.0.0 | **EPIC:** EPIC-013 | **Sistema:** SIMCO
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
# CONTEXTO-PROYECTO: MCP {NOMBRE}
|
||||||
|
|
||||||
|
**Version:** 0.1.0
|
||||||
|
**Fecha:** {FECHA}
|
||||||
|
**Sistema:** NEXUS v3.4 + SIMCO
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## IDENTIFICACION
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
proyecto: "mcp-{nombre}"
|
||||||
|
tipo: "mcp-server-interno"
|
||||||
|
estado: "development"
|
||||||
|
prioridad: "{alta|maxima}"
|
||||||
|
|
||||||
|
ubicacion:
|
||||||
|
workspace: "/home/isem/workspace-v1"
|
||||||
|
proyecto: "core/mcp-servers/internal/{nombre}"
|
||||||
|
repositorio: "git@gitea-server:rckrdmrd/mcp-{nombre}.git"
|
||||||
|
|
||||||
|
stack:
|
||||||
|
runtime: "Node.js >= 18"
|
||||||
|
lenguaje: "TypeScript"
|
||||||
|
database: "PostgreSQL + pgvector"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## PROPOSITO
|
||||||
|
|
||||||
|
{DESCRIPCION_DETALLADA_DEL_PROPOSITO}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HERRAMIENTAS MCP
|
||||||
|
|
||||||
|
| Herramienta | Descripcion | Estado |
|
||||||
|
|-------------|-------------|--------|
|
||||||
|
| `{tool_1}` | {descripcion} | planned |
|
||||||
|
| `{tool_2}` | {descripcion} | planned |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DEPENDENCIAS
|
||||||
|
|
||||||
|
### Externas
|
||||||
|
- PostgreSQL >= 15 con extension pgvector
|
||||||
|
- OpenAI API (para embeddings)
|
||||||
|
|
||||||
|
### Del Workspace
|
||||||
|
- Acceso a documentacion en orchestration/
|
||||||
|
- Acceso a knowledge-base/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DIRECTIVAS APLICABLES
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
siempre:
|
||||||
|
- @SIMCO_MCP
|
||||||
|
- @PRINCIPIO_CAPVED
|
||||||
|
- @PRINCIPIO_DOC_PRIMERO
|
||||||
|
|
||||||
|
operaciones:
|
||||||
|
crear_herramienta: [@SIMCO_CREAR]
|
||||||
|
modificar: [@SIMCO_MODIFICAR]
|
||||||
|
validar: [@SIMCO_VALIDAR]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## PERFILES RELACIONADOS
|
||||||
|
|
||||||
|
| Perfil | Responsabilidad |
|
||||||
|
|--------|-----------------|
|
||||||
|
| @PERFIL_MCP_DEVELOPER | Desarrollo de este MCP |
|
||||||
|
| @PERFIL_RAG_ENGINEER | Integracion con RAG |
|
||||||
|
| @PERFIL_MCP_ARCHITECT | Diseno y arquitectura |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Contexto generado:** {FECHA}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"name": "mcp-{nombre}",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "{DESCRIPCION}",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"start": "node dist/index.js",
|
||||||
|
"dev": "ts-node-dev --respawn src/index.ts",
|
||||||
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
|
"test:coverage": "jest --coverage",
|
||||||
|
"lint": "eslint src/**/*.ts",
|
||||||
|
"lint:fix": "eslint src/**/*.ts --fix",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"health-check": "curl -s http://localhost:${PORT:-3100}/health || echo 'Server not running'"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"mcp",
|
||||||
|
"model-context-protocol",
|
||||||
|
"anthropic",
|
||||||
|
"claude"
|
||||||
|
],
|
||||||
|
"author": "workspace-v1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@anthropic-ai/sdk": "^0.25.0",
|
||||||
|
"dotenv": "^16.3.1",
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"pg": "^8.11.3",
|
||||||
|
"pgvector": "^0.1.8"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/express": "^4.17.21",
|
||||||
|
"@types/jest": "^29.5.11",
|
||||||
|
"@types/node": "^20.10.0",
|
||||||
|
"@types/pg": "^8.10.9",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.13.0",
|
||||||
|
"@typescript-eslint/parser": "^6.13.0",
|
||||||
|
"eslint": "^8.54.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
|
"ts-node-dev": "^2.0.0",
|
||||||
|
"typescript": "^5.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* MCP Server: {NOMBRE}
|
||||||
|
*
|
||||||
|
* {DESCRIPCION}
|
||||||
|
*
|
||||||
|
* @version 0.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
import express from 'express';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
// Load environment variables
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const PORT = process.env.PORT || 3100;
|
||||||
|
|
||||||
|
// Middleware
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
// Health check endpoint
|
||||||
|
app.get('/health', (req, res) => {
|
||||||
|
res.json({
|
||||||
|
status: 'ok',
|
||||||
|
service: 'mcp-{nombre}',
|
||||||
|
version: '0.1.0',
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// MCP Tools endpoint
|
||||||
|
app.post('/tools/:toolName', async (req, res) => {
|
||||||
|
const { toolName } = req.params;
|
||||||
|
const { parameters } = req.body;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// TODO: Implement tool routing
|
||||||
|
const result = await handleTool(toolName, parameters);
|
||||||
|
res.json({ success: true, result });
|
||||||
|
} catch (error) {
|
||||||
|
res.status(500).json({
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Tool handler
|
||||||
|
async function handleTool(toolName: string, parameters: unknown): Promise<unknown> {
|
||||||
|
switch (toolName) {
|
||||||
|
// TODO: Add tool cases
|
||||||
|
default:
|
||||||
|
throw new Error(`Unknown tool: ${toolName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start server
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`MCP Server {nombre} running on port ${PORT}`);
|
||||||
|
console.log(`Health check: http://localhost:${PORT}/health`);
|
||||||
|
});
|
||||||
@ -0,0 +1 @@
|
|||||||
|
# Tests directory
|
||||||
@ -27,7 +27,7 @@ Este directorio contiene el **Sistema NEXUS** de orquestación de agentes IA par
|
|||||||
### Acceso Rápido
|
### Acceso Rápido
|
||||||
|
|
||||||
```
|
```
|
||||||
core/catalog/ # 🆕 CATÁLOGO DE FUNCIONALIDADES (CONSULTAR PRIMERO)
|
shared/catalog/ # 🆕 CATÁLOGO DE FUNCIONALIDADES (CONSULTAR PRIMERO)
|
||||||
├── CATALOG-INDEX.yml # Índice máquina-readable
|
├── CATALOG-INDEX.yml # Índice máquina-readable
|
||||||
├── auth/ # Autenticación y autorización
|
├── auth/ # Autenticación y autorización
|
||||||
├── session-management/ # Gestión de sesiones
|
├── session-management/ # Gestión de sesiones
|
||||||
@ -102,8 +102,8 @@ referencias/
|
|||||||
@TPL_CAPVED: templates/TEMPLATE-TAREA-CAPVED.md
|
@TPL_CAPVED: templates/TEMPLATE-TAREA-CAPVED.md
|
||||||
|
|
||||||
# CATÁLOGO DE FUNCIONALIDADES (CONSULTAR PRIMERO)
|
# CATÁLOGO DE FUNCIONALIDADES (CONSULTAR PRIMERO)
|
||||||
@CATALOG: core/catalog/
|
@CATALOG: shared/catalog/
|
||||||
@CATALOG_INDEX: core/catalog/CATALOG-INDEX.yml
|
@CATALOG_INDEX: shared/catalog/CATALOG-INDEX.yml
|
||||||
|
|
||||||
# Operaciones
|
# Operaciones
|
||||||
@REUTILIZAR: directivas/simco/SIMCO-REUTILIZAR.md
|
@REUTILIZAR: directivas/simco/SIMCO-REUTILIZAR.md
|
||||||
|
|||||||
@ -46,7 +46,7 @@ core/orchestration/
|
|||||||
│ ├── SIMCO-BACKEND.md
|
│ ├── SIMCO-BACKEND.md
|
||||||
│ └── ...
|
│ └── ...
|
||||||
│
|
│
|
||||||
└── core/catalog/ # 🆕 CATÁLOGO DE FUNCIONALIDADES
|
└── shared/catalog/ # 🆕 CATÁLOGO DE FUNCIONALIDADES
|
||||||
├── CATALOG-INDEX.yml # Índice para búsqueda
|
├── CATALOG-INDEX.yml # Índice para búsqueda
|
||||||
├── auth/
|
├── auth/
|
||||||
├── session-management/
|
├── session-management/
|
||||||
@ -138,7 +138,7 @@ Los archivos `INIT-NEXUS-*.md` siguen siendo útiles como:
|
|||||||
|
|
||||||
- **Índice SIMCO:** core/orchestration/directivas/simco/_INDEX.md
|
- **Índice SIMCO:** core/orchestration/directivas/simco/_INDEX.md
|
||||||
- **Perfiles de Agentes:** core/orchestration/agents/perfiles/
|
- **Perfiles de Agentes:** core/orchestration/agents/perfiles/
|
||||||
- **Catálogo:** core/catalog/
|
- **Catálogo:** shared/catalog/
|
||||||
- **Aliases:** core/orchestration/referencias/ALIASES.yml
|
- **Aliases:** core/orchestration/referencias/ALIASES.yml
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@ -33,7 +33,7 @@ core/orchestration/
|
|||||||
│ ├── SIMCO-MODIFICAR.md
|
│ ├── SIMCO-MODIFICAR.md
|
||||||
│ └── SIMCO-{DOMINIO}.md
|
│ └── SIMCO-{DOMINIO}.md
|
||||||
│
|
│
|
||||||
└── core/catalog/ # Funcionalidades reutilizables
|
└── shared/catalog/ # Funcionalidades reutilizables
|
||||||
├── auth/
|
├── auth/
|
||||||
├── notifications/
|
├── notifications/
|
||||||
└── ...
|
└── ...
|
||||||
|
|||||||
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
**ID:** @PERFIL_KB_MANAGER
|
**ID:** @PERFIL_KB_MANAGER
|
||||||
**Nombre:** Knowledge-Base Manager
|
**Nombre:** Knowledge-Base Manager
|
||||||
**Version:** 1.0.0
|
**Version:** 1.1.0
|
||||||
**Sistema:** NEXUS v3.4 + SIMCO + CAPVED
|
**Sistema:** NEXUS v3.4 + SIMCO + CAPVED
|
||||||
**Creado:** 2026-01-04
|
**Creado:** 2026-01-04
|
||||||
|
**Actualizado:** 2026-01-04
|
||||||
**EPIC:** EPIC-012
|
**EPIC:** EPIC-012
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -12,7 +13,7 @@
|
|||||||
## ROL
|
## ROL
|
||||||
|
|
||||||
Gestor de la base de conocimiento compartida del workspace, responsable de:
|
Gestor de la base de conocimiento compartida del workspace, responsable de:
|
||||||
- Coordinar mejoras en `core/catalog/` y `shared/knowledge-base/`
|
- Coordinar mejoras en `shared/catalog/` y `shared/knowledge-base/`
|
||||||
- Analizar mejoras propagables siguiendo proceso CAPVED
|
- Analizar mejoras propagables siguiendo proceso CAPVED
|
||||||
- Detectar dependencias internas entre modulos
|
- Detectar dependencias internas entre modulos
|
||||||
- Generar tareas SCRUM formales para propagacion
|
- Generar tareas SCRUM formales para propagacion
|
||||||
@ -30,7 +31,7 @@ Gestor de la base de conocimiento compartida del workspace, responsable de:
|
|||||||
- C: Contexto del modulo afectado
|
- C: Contexto del modulo afectado
|
||||||
- A: Analisis de impacto en KB y proyectos consumidores
|
- A: Analisis de impacto en KB y proyectos consumidores
|
||||||
- P: Plan de propagacion por niveles
|
- P: Plan de propagacion por niveles
|
||||||
3. **Actualizar core/catalog** si la mejora aplica a modulos base
|
3. **Actualizar shared/catalog** si la mejora aplica a modulos base
|
||||||
4. **Actualizar shared/knowledge-base** con cambios sincronizados
|
4. **Actualizar shared/knowledge-base** con cambios sincronizados
|
||||||
5. **Generar tareas SCRUM** para proyectos afectados usando `generate-scrum-tasks.sh`
|
5. **Generar tareas SCRUM** para proyectos afectados usando `generate-scrum-tasks.sh`
|
||||||
6. **Coordinar con @PERFIL_PROJECT_AGENT** para ejecucion en proyectos
|
6. **Coordinar con @PERFIL_PROJECT_AGENT** para ejecucion en proyectos
|
||||||
@ -101,7 +102,7 @@ Scripts disponibles en `devtools/scripts/propagation/`:
|
|||||||
|
|
|
|
||||||
v
|
v
|
||||||
4. ACTUALIZAR NIVEL 0 (si aplica)
|
4. ACTUALIZAR NIVEL 0 (si aplica)
|
||||||
Actualizar modulo en core/catalog/
|
Actualizar modulo en shared/catalog/
|
||||||
Validar: Documentacion actualizada
|
Validar: Documentacion actualizada
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
@ -169,6 +170,9 @@ Scripts disponibles en `devtools/scripts/propagation/`:
|
|||||||
| @PERFIL_DOCUMENTATION | Colabora en documentacion de cambios | Seccion en TASK |
|
| @PERFIL_DOCUMENTATION | Colabora en documentacion de cambios | Seccion en TASK |
|
||||||
| @PERFIL_INTEGRATION_VALIDATOR | Valida integracion final | Checklist de validacion |
|
| @PERFIL_INTEGRATION_VALIDATOR | Valida integracion final | Checklist de validacion |
|
||||||
| @PERFIL_TECH_LEADER | Escala decisiones arquitecturales | Issue/Reunion |
|
| @PERFIL_TECH_LEADER | Escala decisiones arquitecturales | Issue/Reunion |
|
||||||
|
| @PERFIL_PROPAGATION_TRACKER | Tracking de estado de propagaciones | TRAZABILIDAD-PROPAGACION.yml |
|
||||||
|
| @PERFIL_PRODUCTION_MANAGER | Sincroniza cambios con produccion | Registro/Alerta |
|
||||||
|
| @PERFIL_SECRETS_MANAGER | Coordina cambios de secretos | Protocolo seguro |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -233,6 +237,13 @@ formato: "Comentario en tarea o seccion EJECUCION"
|
|||||||
- USAGE.md: `shared/knowledge-base/propagacion/USAGE.md`
|
- USAGE.md: `shared/knowledge-base/propagacion/USAGE.md`
|
||||||
- USAGE-ORQUESTACION.md: `shared/knowledge-base/propagacion/USAGE-ORQUESTACION.md`
|
- USAGE-ORQUESTACION.md: `shared/knowledge-base/propagacion/USAGE-ORQUESTACION.md`
|
||||||
|
|
||||||
|
### Perfiles Relacionados
|
||||||
|
|
||||||
|
- @PERFIL_PROPAGATION_TRACKER: `orchestration/agents/perfiles/PERFIL-PROPAGATION-TRACKER.md`
|
||||||
|
- @PERFIL_PRODUCTION_MANAGER: `orchestration/agents/perfiles/PERFIL-PRODUCTION-MANAGER.md`
|
||||||
|
- @PERFIL_SECRETS_MANAGER: `orchestration/agents/perfiles/PERFIL-SECRETS-MANAGER.md`
|
||||||
|
- @PERFIL_MONITORING_AGENT: `orchestration/agents/perfiles/PERFIL-MONITORING-AGENT.md`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Perfil creado por:** EPIC-012
|
**Perfil creado por:** EPIC-012
|
||||||
|
|||||||
@ -45,7 +45,7 @@ grep "Versión:" /home/isem/workspace/core/orchestration/README.md | head -1
|
|||||||
|
|
||||||
**Cambios realizados:**
|
**Cambios realizados:**
|
||||||
- 131 archivos en `core/orchestration/` corregidos
|
- 131 archivos en `core/orchestration/` corregidos
|
||||||
- 11 archivos en `core/catalog/_reference/` corregidos
|
- 11 archivos en `shared/catalog/_reference/` corregidos
|
||||||
- Archivos de catalog raíz (*.yml, *.md) corregidos
|
- Archivos de catalog raíz (*.yml, *.md) corregidos
|
||||||
|
|
||||||
**Verificación:**
|
**Verificación:**
|
||||||
@ -162,7 +162,7 @@ grep -n "Versión:" ~/workspace/core/orchestration/README.md | head -1
|
|||||||
find ~/workspace/core/orchestration -perm 600 -type f | wc -l # Debe ser 0
|
find ~/workspace/core/orchestration -perm 600 -type f | wc -l # Debe ser 0
|
||||||
|
|
||||||
# Verificar _reference/ poblados
|
# Verificar _reference/ poblados
|
||||||
find ~/workspace/core/catalog -name "*.reference.ts" | wc -l # Debe ser 11
|
find ~/workspace/shared/catalog -name "*.reference.ts" | wc -l # Debe ser 11
|
||||||
|
|
||||||
# Verificar UserIdConversionService exportado
|
# Verificar UserIdConversionService exportado
|
||||||
grep "UserIdConversionService" ~/workspace/projects/gamilit/apps/backend/src/shared/services/index.ts
|
grep "UserIdConversionService" ~/workspace/projects/gamilit/apps/backend/src/shared/services/index.ts
|
||||||
|
|||||||
@ -236,7 +236,7 @@ Sprint 0 P0 - Completado
|
|||||||
# ERP-Suite shared-libs
|
# ERP-Suite shared-libs
|
||||||
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/core/entities/
|
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/core/entities/
|
||||||
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/core/middleware/
|
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/core/middleware/
|
||||||
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/core/constants/
|
ls -la ~/workspace/projects/erp-suite/apps/shared-libs/shared/constants/
|
||||||
|
|
||||||
# Betting Analytics
|
# Betting Analytics
|
||||||
ls -la ~/workspace/projects/betting-analytics/apps/backend/src/
|
ls -la ~/workspace/projects/betting-analytics/apps/backend/src/
|
||||||
|
|||||||
@ -78,7 +78,7 @@ core:
|
|||||||
contenido: Directivas, principios, agentes, templates
|
contenido: Directivas, principios, agentes, templates
|
||||||
prioridad: P0
|
prioridad: P0
|
||||||
|
|
||||||
- nombre: core/catalog
|
- nombre: shared/catalog
|
||||||
nivel: 0 (Global)
|
nivel: 0 (Global)
|
||||||
contenido: Funcionalidades reutilizables
|
contenido: Funcionalidades reutilizables
|
||||||
prioridad: P0
|
prioridad: P0
|
||||||
@ -334,7 +334,7 @@ herramientas:
|
|||||||
secuencia:
|
secuencia:
|
||||||
1_core:
|
1_core:
|
||||||
- core/orchestration/directivas/ (principios base)
|
- core/orchestration/directivas/ (principios base)
|
||||||
- core/catalog/ (funcionalidades compartidas)
|
- shared/catalog/ (funcionalidades compartidas)
|
||||||
prioridad: PRIMERO (establecer baseline)
|
prioridad: PRIMERO (establecer baseline)
|
||||||
|
|
||||||
2_proyectos_maduros:
|
2_proyectos_maduros:
|
||||||
@ -698,7 +698,7 @@ protocolo:
|
|||||||
orden_ejecucion:
|
orden_ejecucion:
|
||||||
fase_6a_core:
|
fase_6a_core:
|
||||||
- Correcciones en core/orchestration
|
- Correcciones en core/orchestration
|
||||||
- Correcciones en core/catalog
|
- Correcciones en shared/catalog
|
||||||
razon: Base para proyectos
|
razon: Base para proyectos
|
||||||
|
|
||||||
fase_6b_proyectos_referencia:
|
fase_6b_proyectos_referencia:
|
||||||
|
|||||||
@ -849,7 +849,7 @@ P0 Completado
|
|||||||
[ ] core/orchestration versión unificada 3.3
|
[ ] core/orchestration versión unificada 3.3
|
||||||
[ ] core/orchestration permisos 644
|
[ ] core/orchestration permisos 644
|
||||||
[ ] core/orchestration 6 principios documentados
|
[ ] core/orchestration 6 principios documentados
|
||||||
[ ] core/catalog _reference/ poblados (8 funcionalidades)
|
[ ] shared/catalog _reference/ poblados (8 funcionalidades)
|
||||||
[ ] gamilit UserIdConversionService creado
|
[ ] gamilit UserIdConversionService creado
|
||||||
[ ] gamilit Repository Factory implementado
|
[ ] gamilit Repository Factory implementado
|
||||||
[ ] gamilit God classes divididas (al menos 2)
|
[ ] gamilit God classes divididas (al menos 2)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Se completó el análisis exhaustivo de **6 áreas** del workspace:
|
|||||||
| Área | Estado | Score | Hallazgos P0 | P1 | P2 |
|
| Área | Estado | Score | Hallazgos P0 | P1 | P2 |
|
||||||
|------|--------|-------|--------------|----|----|
|
|------|--------|-------|--------------|----|----|
|
||||||
| **core/orchestration** | 🟡 Necesita mejoras | 7/10 | 3 | 5 | 3 |
|
| **core/orchestration** | 🟡 Necesita mejoras | 7/10 | 3 | 5 | 3 |
|
||||||
| **core/catalog** | 🟡 Necesita mejoras | 8/10 | 1 | 4 | 6 |
|
| **shared/catalog** | 🟡 Necesita mejoras | 8/10 | 1 | 4 | 6 |
|
||||||
| **gamilit** | 🟡 Deuda técnica | 6.5/10 | 4 | 6 | 10 |
|
| **gamilit** | 🟡 Deuda técnica | 6.5/10 | 4 | 6 | 10 |
|
||||||
| **trading-platform** | 🟡 MVP en progreso | 6/10 | 5 | 5 | 4 |
|
| **trading-platform** | 🟡 MVP en progreso | 6/10 | 5 | 5 | 4 |
|
||||||
| **erp-suite** | 🟡 Duplicación crítica | 5/10 | 3 | 4 | 3 |
|
| **erp-suite** | 🟡 Duplicación crítica | 5/10 | 3 | 4 | 3 |
|
||||||
@ -123,7 +123,7 @@ Se completó el análisis exhaustivo de **6 áreas** del workspace:
|
|||||||
| Proyecto | Docs | ADRs | Inventarios | Propagación |
|
| Proyecto | Docs | ADRs | Inventarios | Propagación |
|
||||||
|----------|------|------|-------------|-------------|
|
|----------|------|------|-------------|-------------|
|
||||||
| core/orchestration | ✅ 177 MD | ✅ Sistema | ✅ YAML | 🟡 Parcial |
|
| core/orchestration | ✅ 177 MD | ✅ Sistema | ✅ YAML | 🟡 Parcial |
|
||||||
| core/catalog | ✅ 8 funciones | N/A | ✅ Tracking | ✅ OK |
|
| shared/catalog | ✅ 8 funciones | N/A | ✅ Tracking | ✅ OK |
|
||||||
| gamilit | ✅ 17 carpetas | ✅ 20 ADRs | ✅ Completos | ✅ OK |
|
| gamilit | ✅ 17 carpetas | ✅ 20 ADRs | ✅ Completos | ✅ OK |
|
||||||
| trading-platform | ✅ 264 docs | ✅ 14 ADRs | ✅ Completos | ✅ OK |
|
| trading-platform | ✅ 264 docs | ✅ 14 ADRs | ✅ Completos | ✅ OK |
|
||||||
| erp-suite | ✅ 449+ docs | ⚠️ Parcial | 🟡 Parcial | 🟡 Parcial |
|
| erp-suite | ✅ 449+ docs | ⚠️ Parcial | 🟡 Parcial | 🟡 Parcial |
|
||||||
@ -134,7 +134,7 @@ Se completó el análisis exhaustivo de **6 áreas** del workspace:
|
|||||||
|
|
||||||
## CÓDIGO DUPLICADO ENTRE PROYECTOS
|
## CÓDIGO DUPLICADO ENTRE PROYECTOS
|
||||||
|
|
||||||
### Candidatos para core/catalog
|
### Candidatos para shared/catalog
|
||||||
|
|
||||||
| Funcionalidad | Proyectos | Estado | Acción |
|
| Funcionalidad | Proyectos | Estado | Acción |
|
||||||
|---------------|-----------|--------|--------|
|
|---------------|-----------|--------|--------|
|
||||||
@ -183,7 +183,7 @@ Se completó el análisis exhaustivo de **6 áreas** del workspace:
|
|||||||
|
|
||||||
| # | Acción | Proyectos | Esfuerzo |
|
| # | Acción | Proyectos | Esfuerzo |
|
||||||
|---|--------|-----------|----------|
|
|---|--------|-----------|----------|
|
||||||
| 1 | Poblar `_reference/` en core/catalog | catalog | 8h |
|
| 1 | Poblar `_reference/` en shared/catalog | catalog | 8h |
|
||||||
| 2 | Sincronizar versionado orchestration a 3.3 | core | 2h |
|
| 2 | Sincronizar versionado orchestration a 3.3 | core | 2h |
|
||||||
| 3 | Cambiar permisos 600→644 en orchestration | core | 1h |
|
| 3 | Cambiar permisos 600→644 en orchestration | core | 1h |
|
||||||
| 4 | Crear UserIdConversionService en gamilit | gamilit | 4h |
|
| 4 | Crear UserIdConversionService en gamilit | gamilit | 4h |
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
┌─────────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────────┐
|
||||||
│ │
|
│ │
|
||||||
│ NUNCA referenciar un proyecto desde otro proyecto. │
|
│ NUNCA referenciar un proyecto desde otro proyecto. │
|
||||||
│ SIEMPRE usar core/catalog/ o core/orchestration/ como fuente. │
|
│ SIEMPRE usar shared/catalog/ o core/orchestration/ como fuente. │
|
||||||
│ │
|
│ │
|
||||||
└─────────────────────────────────────────────────────────────────────┘
|
└─────────────────────────────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
| Tipo | Ejemplo | Uso Correcto |
|
| Tipo | Ejemplo | Uso Correcto |
|
||||||
|------|---------|--------------|
|
|------|---------|--------------|
|
||||||
| **Core Catalog** | `core/catalog/auth/` | Componentes reutilizables |
|
| **Core Catalog** | `shared/catalog/auth/` | Componentes reutilizables |
|
||||||
| **Core Orchestration** | `core/orchestration/directivas/` | Directivas y templates |
|
| **Core Orchestration** | `core/orchestration/directivas/` | Directivas y templates |
|
||||||
| **Subproyecto Interno** | `erp-suite/apps/erp-core/` | Solo desde la misma suite |
|
| **Subproyecto Interno** | `erp-suite/apps/erp-core/` | Solo desde la misma suite |
|
||||||
| **Ejemplos Ilustrativos** | `ejemplos: "gamilit, trading"` | Solo como ilustración marcada |
|
| **Ejemplos Ilustrativos** | `ejemplos: "gamilit, trading"` | Solo como ilustración marcada |
|
||||||
@ -70,7 +70,7 @@
|
|||||||
JERARQUÍA_VÁLIDA:
|
JERARQUÍA_VÁLIDA:
|
||||||
|
|
||||||
Nivel_0_Core:
|
Nivel_0_Core:
|
||||||
- core/catalog/ # Funcionalidades reutilizables
|
- shared/catalog/ # Funcionalidades reutilizables
|
||||||
- core/orchestration/ # Directivas y templates
|
- core/orchestration/ # Directivas y templates
|
||||||
- core/devtools/ # Herramientas de desarrollo
|
- core/devtools/ # Herramientas de desarrollo
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ ANTES:
|
|||||||
DESPUÉS:
|
DESPUÉS:
|
||||||
# ELIMINAR la línea completamente
|
# ELIMINAR la línea completamente
|
||||||
# O cambiar a:
|
# O cambiar a:
|
||||||
| Catálogo global | `/home/isem/workspace/core/catalog/` |
|
| Catálogo global | `/home/isem/workspace/shared/catalog/` |
|
||||||
```
|
```
|
||||||
|
|
||||||
### Caso 2: Ruta a Otro Proyecto
|
### Caso 2: Ruta a Otro Proyecto
|
||||||
@ -140,7 +140,7 @@ ANTES:
|
|||||||
- Patrones auth: `projects/gamilit/apps/backend/src/auth/`
|
- Patrones auth: `projects/gamilit/apps/backend/src/auth/`
|
||||||
|
|
||||||
DESPUÉS:
|
DESPUÉS:
|
||||||
- Patrones auth: `core/catalog/auth/`
|
- Patrones auth: `shared/catalog/auth/`
|
||||||
```
|
```
|
||||||
|
|
||||||
### Caso 3: Lista de Proyectos de Referencia
|
### Caso 3: Lista de Proyectos de Referencia
|
||||||
@ -153,11 +153,11 @@ ANTES:
|
|||||||
|
|
||||||
DESPUÉS:
|
DESPUÉS:
|
||||||
## Patrones de Referencia (desde Catálogo)
|
## Patrones de Referencia (desde Catálogo)
|
||||||
> **Nota:** Usar siempre core/catalog/ para componentes reutilizables.
|
> **Nota:** Usar siempre shared/catalog/ para componentes reutilizables.
|
||||||
|
|
||||||
| Patrón | Catálogo |
|
| Patrón | Catálogo |
|
||||||
| Auth | core/catalog/auth/ |
|
| Auth | shared/catalog/auth/ |
|
||||||
| RLS | core/catalog/multi-tenancy/ |
|
| RLS | shared/catalog/multi-tenancy/ |
|
||||||
```
|
```
|
||||||
|
|
||||||
### Caso 4: Directiva con Header de Proyecto
|
### Caso 4: Directiva con Header de Proyecto
|
||||||
@ -247,7 +247,7 @@ VALIDACIÓN_ADICIONAL:
|
|||||||
```yaml
|
```yaml
|
||||||
CONTEXTO_A_PASAR:
|
CONTEXTO_A_PASAR:
|
||||||
referencias_permitidas:
|
referencias_permitidas:
|
||||||
- core/catalog/
|
- shared/catalog/
|
||||||
- core/orchestration/
|
- core/orchestration/
|
||||||
- {proyecto_actual}/ # Solo interno
|
- {proyecto_actual}/ # Solo interno
|
||||||
referencias_prohibidas:
|
referencias_prohibidas:
|
||||||
@ -295,7 +295,7 @@ echo "=== Fin de Auditoría ==="
|
|||||||
## REFERENCIAS
|
## REFERENCIAS
|
||||||
|
|
||||||
- **Principio relacionado:** `PRINCIPIO-ANTI-DUPLICACION.md`
|
- **Principio relacionado:** `PRINCIPIO-ANTI-DUPLICACION.md`
|
||||||
- **Catálogo global:** `core/catalog/`
|
- **Catálogo global:** `shared/catalog/`
|
||||||
- **Templates:** `core/orchestration/templates/`
|
- **Templates:** `core/orchestration/templates/`
|
||||||
- **Índice SIMCO:** `core/orchestration/directivas/simco/_INDEX.md`
|
- **Índice SIMCO:** `core/orchestration/directivas/simco/_INDEX.md`
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
**ANTES de implementar funcionalidades comunes**, verificar si existe código probado:
|
**ANTES de implementar funcionalidades comunes**, verificar si existe código probado:
|
||||||
|
|
||||||
```
|
```
|
||||||
core/catalog/ # FUNCIONALIDADES REUTILIZABLES
|
shared/catalog/ # FUNCIONALIDADES REUTILIZABLES
|
||||||
├── CATALOG-INDEX.yml # Índice para búsqueda rápida
|
├── CATALOG-INDEX.yml # Índice para búsqueda rápida
|
||||||
├── auth/ # Autenticación y autorización
|
├── auth/ # Autenticación y autorización
|
||||||
├── session-management/ # Gestión de sesiones
|
├── session-management/ # Gestión de sesiones
|
||||||
|
|||||||
@ -361,7 +361,7 @@ Ver: @NIVELES_PROP (`shared/knowledge-base/propagacion/NIVELES-PROPAGACION.yml`)
|
|||||||
|
|
||||||
| Nivel | Nombre | Contenido |
|
| Nivel | Nombre | Contenido |
|
||||||
|-------|--------|-----------|
|
|-------|--------|-----------|
|
||||||
| 0 | Core Catalog | core/catalog/ |
|
| 0 | Core Catalog | shared/catalog/ |
|
||||||
| 1 | Knowledge-Base | shared/knowledge-base/ |
|
| 1 | Knowledge-Base | shared/knowledge-base/ |
|
||||||
| 2 | Proyectos Base | erp-core, gamilit, trading-platform |
|
| 2 | Proyectos Base | erp-core, gamilit, trading-platform |
|
||||||
| 3 | Proyectos Hoja | Verticales ERP, otros |
|
| 3 | Proyectos Hoja | Verticales ERP, otros |
|
||||||
|
|||||||
@ -28,16 +28,16 @@ global:
|
|||||||
# ═══════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════
|
||||||
# CATÁLOGO DE FUNCIONALIDADES REUTILIZABLES (CONSULTAR PRIMERO)
|
# CATÁLOGO DE FUNCIONALIDADES REUTILIZABLES (CONSULTAR PRIMERO)
|
||||||
# ═══════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════
|
||||||
"@CATALOG": "core/catalog/"
|
"@CATALOG": "shared/catalog/"
|
||||||
"@CATALOG_INDEX": "core/catalog/CATALOG-INDEX.yml"
|
"@CATALOG_INDEX": "shared/catalog/CATALOG-INDEX.yml"
|
||||||
"@CATALOG_AUTH": "core/catalog/auth/"
|
"@CATALOG_AUTH": "shared/catalog/auth/"
|
||||||
"@CATALOG_SESSION": "core/catalog/session-management/"
|
"@CATALOG_SESSION": "shared/catalog/session-management/"
|
||||||
"@CATALOG_RATELIMIT": "core/catalog/rate-limiting/"
|
"@CATALOG_RATELIMIT": "shared/catalog/rate-limiting/"
|
||||||
"@CATALOG_NOTIFY": "core/catalog/notifications/"
|
"@CATALOG_NOTIFY": "shared/catalog/notifications/"
|
||||||
"@CATALOG_TENANT": "core/catalog/multi-tenancy/"
|
"@CATALOG_TENANT": "shared/catalog/multi-tenancy/"
|
||||||
"@CATALOG_FLAGS": "core/catalog/feature-flags/"
|
"@CATALOG_FLAGS": "shared/catalog/feature-flags/"
|
||||||
"@CATALOG_WS": "core/catalog/websocket/"
|
"@CATALOG_WS": "shared/catalog/websocket/"
|
||||||
"@CATALOG_PAYMENTS": "core/catalog/payments/"
|
"@CATALOG_PAYMENTS": "shared/catalog/payments/"
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════
|
||||||
# CAPVED - CICLO DE VIDA DE TAREAS (🆕 v2.0)
|
# CAPVED - CICLO DE VIDA DE TAREAS (🆕 v2.0)
|
||||||
@ -222,8 +222,8 @@ niveles:
|
|||||||
# ═══════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════
|
||||||
"@CORE": "core/"
|
"@CORE": "core/"
|
||||||
"@CORE_ORCH": "core/orchestration/"
|
"@CORE_ORCH": "core/orchestration/"
|
||||||
"@CORE_CATALOG": "core/catalog/"
|
"@CORE_CATALOG": "shared/catalog/"
|
||||||
"@CORE_MODULES": "core/modules/"
|
"@CORE_MODULES": "shared/modules/"
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════
|
||||||
# NIVEL 2: PROYECTOS (alias dinámicos)
|
# NIVEL 2: PROYECTOS (alias dinámicos)
|
||||||
|
|||||||
121
scripts/add_yaml.sh
Normal file
121
scripts/add_yaml.sh
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to add YAML front-matter to markdown files
|
||||||
|
#
|
||||||
|
|
||||||
|
DOCS_PATH="/home/isem/workspace-v1/projects/trading-platform/docs"
|
||||||
|
PROCESSED=0
|
||||||
|
SKIPPED=0
|
||||||
|
|
||||||
|
add_yaml_to_file() {
|
||||||
|
local file="$1"
|
||||||
|
local first_line=$(head -1 "$file")
|
||||||
|
|
||||||
|
# Skip if already has YAML
|
||||||
|
if [ "$first_line" = "---" ]; then
|
||||||
|
((SKIPPED++))
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local filename=$(basename "$file")
|
||||||
|
local dirname=$(dirname "$file")
|
||||||
|
local parent_dir=$(basename "$dirname")
|
||||||
|
local content=$(cat "$file")
|
||||||
|
|
||||||
|
# Extract title from first H1
|
||||||
|
local title=$(echo "$content" | grep -m 1 "^# " | sed 's/^# //' | sed 's/:.*$//')
|
||||||
|
|
||||||
|
# Extract epic from path
|
||||||
|
local epic=$(echo "$file" | grep -o 'OQI-[0-9]*' | head -1)
|
||||||
|
|
||||||
|
# Determine file type and create YAML
|
||||||
|
local yaml=""
|
||||||
|
|
||||||
|
if [[ "$filename" == RF-* ]]; then
|
||||||
|
local file_id=$(echo "$filename" | sed 's/\.md$//' | grep -o '^RF-[A-Z]*-[0-9]*')
|
||||||
|
yaml="---
|
||||||
|
id: \"$file_id\"
|
||||||
|
title: \"$title\"
|
||||||
|
type: \"Requirement\"
|
||||||
|
status: \"Done\"
|
||||||
|
priority: \"Alta\"
|
||||||
|
epic: \"$epic\"
|
||||||
|
project: \"trading-platform\"
|
||||||
|
version: \"1.0.0\"
|
||||||
|
created_date: \"2025-12-05\"
|
||||||
|
updated_date: \"2026-01-04\"
|
||||||
|
---
|
||||||
|
|
||||||
|
"
|
||||||
|
elif [[ "$filename" == ET-* ]]; then
|
||||||
|
local file_id=$(echo "$filename" | sed 's/\.md$//' | grep -o '^ET-[A-Z]*-[0-9]*')
|
||||||
|
yaml="---
|
||||||
|
id: \"$file_id\"
|
||||||
|
title: \"$title\"
|
||||||
|
type: \"Technical Specification\"
|
||||||
|
status: \"Done\"
|
||||||
|
priority: \"Alta\"
|
||||||
|
epic: \"$epic\"
|
||||||
|
project: \"trading-platform\"
|
||||||
|
version: \"1.0.0\"
|
||||||
|
created_date: \"2025-12-05\"
|
||||||
|
updated_date: \"2026-01-04\"
|
||||||
|
---
|
||||||
|
|
||||||
|
"
|
||||||
|
elif [[ "$filename" == US-* ]]; then
|
||||||
|
local file_id=$(echo "$filename" | sed 's/\.md$//' | grep -o '^US-[A-Z]*-[0-9]*')
|
||||||
|
yaml="---
|
||||||
|
id: \"$file_id\"
|
||||||
|
title: \"$title\"
|
||||||
|
type: \"User Story\"
|
||||||
|
status: \"Done\"
|
||||||
|
priority: \"Media\"
|
||||||
|
epic: \"$epic\"
|
||||||
|
project: \"trading-platform\"
|
||||||
|
story_points: 3
|
||||||
|
created_date: \"2025-12-05\"
|
||||||
|
updated_date: \"2026-01-04\"
|
||||||
|
---
|
||||||
|
|
||||||
|
"
|
||||||
|
elif [[ "$filename" == "_MAP.md" ]]; then
|
||||||
|
yaml="---
|
||||||
|
id: \"MAP-$parent_dir\"
|
||||||
|
title: \"Mapa de $parent_dir\"
|
||||||
|
type: \"Index\"
|
||||||
|
project: \"trading-platform\"
|
||||||
|
updated_date: \"2026-01-04\"
|
||||||
|
---
|
||||||
|
|
||||||
|
"
|
||||||
|
else
|
||||||
|
local file_id=$(echo "$filename" | sed 's/\.md$//')
|
||||||
|
yaml="---
|
||||||
|
id: \"$file_id\"
|
||||||
|
title: \"$title\"
|
||||||
|
type: \"Documentation\"
|
||||||
|
project: \"trading-platform\"
|
||||||
|
version: \"1.0.0\"
|
||||||
|
updated_date: \"2026-01-04\"
|
||||||
|
---
|
||||||
|
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write new content
|
||||||
|
echo -n "$yaml$content" > "$file"
|
||||||
|
|
||||||
|
((PROCESSED++))
|
||||||
|
echo "PROCESSED: ${file#$DOCS_PATH/}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process all markdown files
|
||||||
|
find "$DOCS_PATH" -name "*.md" -type f | while read file; do
|
||||||
|
add_yaml_to_file "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== SUMMARY ==="
|
||||||
|
echo "Processed: $PROCESSED"
|
||||||
|
echo "Skipped: $SKIPPED"
|
||||||
149
scripts/add_yaml_frontmatter.py
Normal file
149
scripts/add_yaml_frontmatter.py
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Script to add YAML front-matter to markdown files in trading-platform/docs
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
docs_path = '/home/isem/workspace-v1/projects/trading-platform/docs'
|
||||||
|
|
||||||
|
def get_epic_from_path(path):
|
||||||
|
"""Extract epic code from path like OQI-001, OQI-002, etc."""
|
||||||
|
match = re.search(r'OQI-(\d+)', path)
|
||||||
|
if match:
|
||||||
|
return f"OQI-{match.group(1)}"
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def get_title_from_content(content, filename):
|
||||||
|
"""Extract title from first H1 header or filename"""
|
||||||
|
lines = content.split('\n')
|
||||||
|
for line in lines:
|
||||||
|
if line.startswith('# '):
|
||||||
|
title = line[2:].strip()
|
||||||
|
if ':' in title:
|
||||||
|
return title.split(':', 1)[1].strip()
|
||||||
|
return title
|
||||||
|
return filename.replace('.md', '').replace('-', ' ')
|
||||||
|
|
||||||
|
def create_yaml_frontmatter(file_type, file_id, title, epic):
|
||||||
|
"""Create YAML front-matter based on file type"""
|
||||||
|
if file_type == 'RF':
|
||||||
|
return f'''---
|
||||||
|
id: "{file_id}"
|
||||||
|
title: "{title}"
|
||||||
|
type: "Requirement"
|
||||||
|
status: "Done"
|
||||||
|
priority: "Alta"
|
||||||
|
epic: "{epic}"
|
||||||
|
project: "trading-platform"
|
||||||
|
version: "1.0.0"
|
||||||
|
created_date: "2025-12-05"
|
||||||
|
updated_date: "2026-01-04"
|
||||||
|
---
|
||||||
|
|
||||||
|
'''
|
||||||
|
elif file_type == 'ET':
|
||||||
|
return f'''---
|
||||||
|
id: "{file_id}"
|
||||||
|
title: "{title}"
|
||||||
|
type: "Technical Specification"
|
||||||
|
status: "Done"
|
||||||
|
priority: "Alta"
|
||||||
|
epic: "{epic}"
|
||||||
|
project: "trading-platform"
|
||||||
|
version: "1.0.0"
|
||||||
|
created_date: "2025-12-05"
|
||||||
|
updated_date: "2026-01-04"
|
||||||
|
---
|
||||||
|
|
||||||
|
'''
|
||||||
|
elif file_type == 'US':
|
||||||
|
return f'''---
|
||||||
|
id: "{file_id}"
|
||||||
|
title: "{title}"
|
||||||
|
type: "User Story"
|
||||||
|
status: "Done"
|
||||||
|
priority: "Media"
|
||||||
|
epic: "{epic}"
|
||||||
|
project: "trading-platform"
|
||||||
|
story_points: 3
|
||||||
|
created_date: "2025-12-05"
|
||||||
|
updated_date: "2026-01-04"
|
||||||
|
---
|
||||||
|
|
||||||
|
'''
|
||||||
|
elif file_type == 'MAP':
|
||||||
|
return f'''---
|
||||||
|
id: "MAP-{file_id}"
|
||||||
|
title: "Mapa de {file_id}"
|
||||||
|
type: "Index"
|
||||||
|
project: "trading-platform"
|
||||||
|
updated_date: "2026-01-04"
|
||||||
|
---
|
||||||
|
|
||||||
|
'''
|
||||||
|
else:
|
||||||
|
return f'''---
|
||||||
|
id: "{file_id}"
|
||||||
|
title: "{title}"
|
||||||
|
type: "Documentation"
|
||||||
|
project: "trading-platform"
|
||||||
|
version: "1.0.0"
|
||||||
|
updated_date: "2026-01-04"
|
||||||
|
---
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
def process_file(filepath):
|
||||||
|
"""Add YAML front-matter to file if missing"""
|
||||||
|
with open(filepath, 'r', encoding='utf-8') as f:
|
||||||
|
content = f.read()
|
||||||
|
if content.strip().startswith('---'):
|
||||||
|
return False
|
||||||
|
filename = os.path.basename(filepath)
|
||||||
|
if filename.startswith('RF-'):
|
||||||
|
file_type = 'RF'
|
||||||
|
match = re.match(r'(RF-[A-Z]+-\d+)', filename)
|
||||||
|
file_id = match.group(1) if match else filename.replace('.md', '')
|
||||||
|
elif filename.startswith('ET-'):
|
||||||
|
file_type = 'ET'
|
||||||
|
match = re.match(r'(ET-[A-Z]+-\d+)', filename)
|
||||||
|
file_id = match.group(1) if match else filename.replace('.md', '')
|
||||||
|
elif filename.startswith('US-'):
|
||||||
|
file_type = 'US'
|
||||||
|
match = re.match(r'(US-[A-Z]+-\d+)', filename)
|
||||||
|
file_id = match.group(1) if match else filename.replace('.md', '')
|
||||||
|
elif filename == '_MAP.md':
|
||||||
|
file_type = 'MAP'
|
||||||
|
file_id = os.path.basename(os.path.dirname(filepath))
|
||||||
|
else:
|
||||||
|
file_type = 'OTHER'
|
||||||
|
file_id = filename.replace('.md', '')
|
||||||
|
epic = get_epic_from_path(filepath)
|
||||||
|
title = get_title_from_content(content, filename)
|
||||||
|
yaml_header = create_yaml_frontmatter(file_type, file_id, title, epic)
|
||||||
|
new_content = yaml_header + content
|
||||||
|
with open(filepath, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(new_content)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def main():
|
||||||
|
processed = 0
|
||||||
|
skipped = 0
|
||||||
|
for root, dirs, files in os.walk(docs_path):
|
||||||
|
for filename in files:
|
||||||
|
if filename.endswith('.md'):
|
||||||
|
filepath = os.path.join(root, filename)
|
||||||
|
if process_file(filepath):
|
||||||
|
processed += 1
|
||||||
|
print(f"PROCESSED: {os.path.relpath(filepath, docs_path)}")
|
||||||
|
else:
|
||||||
|
skipped += 1
|
||||||
|
print(f"\n=== SUMMARY ===")
|
||||||
|
print(f"Processed (added YAML): {processed}")
|
||||||
|
print(f"Skipped (already had YAML): {skipped}")
|
||||||
|
print(f"Total: {processed + skipped}")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
147
scripts/create-gitea-repos-api.sh
Executable file
147
scripts/create-gitea-repos-api.sh
Executable file
@ -0,0 +1,147 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =============================================================================
|
||||||
|
# Script: Crear repositorios en Gitea via API
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
# Uso: ./create-gitea-repos-api.sh <GITEA_TOKEN>
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
GITEA_URL="http://72.60.226.4:3000"
|
||||||
|
GITEA_USER="rckrdmrd"
|
||||||
|
|
||||||
|
# Colores
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
# Verificar token
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo -e "${RED}Error: Se requiere token de API${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "Uso: $0 <GITEA_TOKEN>"
|
||||||
|
echo ""
|
||||||
|
echo "Para obtener el token:"
|
||||||
|
echo " 1. Ir a ${GITEA_URL}/${GITEA_USER}"
|
||||||
|
echo " 2. Settings -> Applications -> Generate New Token"
|
||||||
|
echo " 3. Dar permisos de 'repo' y 'write:repository'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
GITEA_TOKEN="$1"
|
||||||
|
|
||||||
|
echo -e "${GREEN}=== Creando repositorios en Gitea via API ===${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Funcion para crear repositorio
|
||||||
|
create_repo() {
|
||||||
|
local repo_name=$1
|
||||||
|
local description=$2
|
||||||
|
|
||||||
|
echo -ne "${YELLOW}Creando: $repo_name... ${NC}"
|
||||||
|
|
||||||
|
# Verificar si existe
|
||||||
|
exists=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${GITEA_USER}/${repo_name}" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}")
|
||||||
|
|
||||||
|
if [ "$exists" = "200" ]; then
|
||||||
|
echo -e "${GREEN}Ya existe${NC}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crear repositorio
|
||||||
|
response=$(curl -s -X POST \
|
||||||
|
"${GITEA_URL}/api/v1/user/repos" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"name\": \"${repo_name}\",
|
||||||
|
\"description\": \"${description}\",
|
||||||
|
\"private\": false,
|
||||||
|
\"auto_init\": false
|
||||||
|
}")
|
||||||
|
|
||||||
|
# Verificar resultado
|
||||||
|
if echo "$response" | grep -q "\"name\":\"${repo_name}\""; then
|
||||||
|
echo -e "${GREEN}Creado${NC}"
|
||||||
|
else
|
||||||
|
error=$(echo "$response" | python3 -c "import json,sys; print(json.load(sys.stdin).get('message', 'Unknown error'))" 2>/dev/null)
|
||||||
|
echo -e "${RED}Error: $error${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# REPOSITORIOS PRINCIPALES DE PROYECTOS
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
echo "--- Repositorios Principales ---"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ERP Suite
|
||||||
|
create_repo "erp-suite" "ERP Suite - Sistema multi-vertical"
|
||||||
|
|
||||||
|
# ERP Core
|
||||||
|
create_repo "erp-core" "ERP Core - Modulos base compartidos"
|
||||||
|
|
||||||
|
# ERP Verticales
|
||||||
|
create_repo "erp-construccion" "ERP para empresas de construccion"
|
||||||
|
create_repo "erp-clinicas" "ERP para clinicas medicas"
|
||||||
|
create_repo "erp-retail" "ERP para retail"
|
||||||
|
create_repo "erp-mecanicas-diesel" "ERP para mecanicas diesel"
|
||||||
|
create_repo "erp-vidrio-templado" "ERP para fabricas de vidrio templado"
|
||||||
|
|
||||||
|
# Otros proyectos
|
||||||
|
create_repo "trading-platform" "Plataforma de trading y educacion financiera"
|
||||||
|
create_repo "betting-analytics" "Analytics para apuestas deportivas"
|
||||||
|
create_repo "inmobiliaria-analytics" "Analytics inmobiliario"
|
||||||
|
create_repo "platform-marketing-content" "Plataforma de marketing de contenido"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "--- Subrepositorios ERP Retail ---"
|
||||||
|
echo ""
|
||||||
|
create_repo "erp-retail-backend" "ERP Retail - Backend API"
|
||||||
|
create_repo "erp-retail-frontend-web" "ERP Retail - Frontend Web"
|
||||||
|
create_repo "erp-retail-database" "ERP Retail - Database Scripts"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "--- Subrepositorios Trading Platform ---"
|
||||||
|
echo ""
|
||||||
|
create_repo "trading-platform-backend" "Trading Platform - Backend API"
|
||||||
|
create_repo "trading-platform-frontend" "Trading Platform - Frontend Web"
|
||||||
|
create_repo "trading-platform-database" "Trading Platform - Database Scripts"
|
||||||
|
create_repo "trading-platform-ml-engine" "Trading Platform - ML Engine"
|
||||||
|
create_repo "trading-platform-data-service" "Trading Platform - Data Service"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "--- Subrepositorios Betting Analytics ---"
|
||||||
|
echo ""
|
||||||
|
create_repo "betting-analytics-backend" "Betting Analytics - Backend API"
|
||||||
|
create_repo "betting-analytics-frontend" "Betting Analytics - Frontend Web"
|
||||||
|
create_repo "betting-analytics-database" "Betting Analytics - Database Scripts"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "--- Subrepositorios Inmobiliaria Analytics ---"
|
||||||
|
echo ""
|
||||||
|
create_repo "inmobiliaria-analytics-backend" "Inmobiliaria Analytics - Backend API"
|
||||||
|
create_repo "inmobiliaria-analytics-frontend" "Inmobiliaria Analytics - Frontend Web"
|
||||||
|
create_repo "inmobiliaria-analytics-database" "Inmobiliaria Analytics - Database Scripts"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "--- Subrepositorios Platform Marketing Content ---"
|
||||||
|
echo ""
|
||||||
|
create_repo "platform-marketing-content-backend" "Platform Marketing Content - Backend API"
|
||||||
|
create_repo "platform-marketing-content-frontend" "Platform Marketing Content - Frontend Web"
|
||||||
|
create_repo "platform-marketing-content-database" "Platform Marketing Content - Database Scripts"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}=== Proceso completado ===${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "Para hacer push de cada proyecto:"
|
||||||
|
echo " cd /home/isem/workspace-v1/projects/[PROYECTO]"
|
||||||
|
echo " git push -u origin main"
|
||||||
|
echo ""
|
||||||
|
echo "Subrepositorios configurados:"
|
||||||
|
echo " - erp-construccion: backend, frontend, database (YA PUSHED)"
|
||||||
|
echo " - erp-core: backend, frontend, database (YA PUSHED)"
|
||||||
|
echo " - erp-mecanicas-diesel: backend, frontend, database (YA PUSHED)"
|
||||||
|
echo ""
|
||||||
111
scripts/create-gitea-repos.sh
Executable file
111
scripts/create-gitea-repos.sh
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =============================================================================
|
||||||
|
# Script: Crear repositorios en Gitea para proyectos del workspace
|
||||||
|
# Fecha: 2025-01-04
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
GITEA_URL="http://72.60.226.4:3000"
|
||||||
|
GITEA_USER="rckrdmrd"
|
||||||
|
SSH_HOST="gitea-server"
|
||||||
|
|
||||||
|
# Colores
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo -e "${GREEN}=== Creando repositorios en Gitea ===${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Función para crear repositorio via API (requiere token)
|
||||||
|
# Por ahora usamos git init y push
|
||||||
|
create_repo() {
|
||||||
|
local repo_name=$1
|
||||||
|
local description=$2
|
||||||
|
local local_path=$3
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Creando: $repo_name${NC}"
|
||||||
|
|
||||||
|
if [ -n "$local_path" ] && [ -d "$local_path" ]; then
|
||||||
|
cd "$local_path"
|
||||||
|
|
||||||
|
# Verificar si ya tiene .git
|
||||||
|
if [ -d ".git" ]; then
|
||||||
|
echo " Ya tiene .git, verificando remote..."
|
||||||
|
existing_remote=$(git remote get-url origin 2>/dev/null)
|
||||||
|
if [ -n "$existing_remote" ]; then
|
||||||
|
echo " Remote existente: $existing_remote"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
git init
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configurar remote
|
||||||
|
git remote add origin git@${SSH_HOST}:${GITEA_USER}/${repo_name}.git 2>/dev/null || \
|
||||||
|
git remote set-url origin git@${SSH_HOST}:${GITEA_USER}/${repo_name}.git
|
||||||
|
|
||||||
|
echo -e " ${GREEN}Configurado: git@${SSH_HOST}:${GITEA_USER}/${repo_name}.git${NC}"
|
||||||
|
else
|
||||||
|
echo -e " ${RED}Path no existe: $local_path${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# REPOSITORIOS PRINCIPALES (proyectos completos)
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
echo "--- Repositorios Principales ---"
|
||||||
|
|
||||||
|
# erp-construccion (subrepos ya existen)
|
||||||
|
create_repo "erp-construccion" "ERP para construccion - proyecto principal" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-construccion"
|
||||||
|
|
||||||
|
# erp-core (subrepos ya existen)
|
||||||
|
create_repo "erp-core" "ERP Core - modulos base compartidos" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-core"
|
||||||
|
|
||||||
|
# erp-mecanicas-diesel (subrepos ya existen)
|
||||||
|
create_repo "erp-mecanicas-diesel" "ERP para mecanicas diesel" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-mecanicas-diesel"
|
||||||
|
|
||||||
|
# erp-suite
|
||||||
|
create_repo "erp-suite" "ERP Suite - multi-vertical" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-suite"
|
||||||
|
|
||||||
|
# erp-clinicas
|
||||||
|
create_repo "erp-clinicas" "ERP para clinicas medicas" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-clinicas"
|
||||||
|
|
||||||
|
# erp-retail
|
||||||
|
create_repo "erp-retail" "ERP para retail" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-retail"
|
||||||
|
|
||||||
|
# erp-vidrio-templado
|
||||||
|
create_repo "erp-vidrio-templado" "ERP para vidrio templado" \
|
||||||
|
"/home/isem/workspace-v1/projects/erp-vidrio-templado"
|
||||||
|
|
||||||
|
# trading-platform
|
||||||
|
create_repo "trading-platform" "Plataforma de trading" \
|
||||||
|
"/home/isem/workspace-v1/projects/trading-platform"
|
||||||
|
|
||||||
|
# betting-analytics
|
||||||
|
create_repo "betting-analytics" "Analytics para apuestas deportivas" \
|
||||||
|
"/home/isem/workspace-v1/projects/betting-analytics"
|
||||||
|
|
||||||
|
# inmobiliaria-analytics
|
||||||
|
create_repo "inmobiliaria-analytics" "Analytics inmobiliario" \
|
||||||
|
"/home/isem/workspace-v1/projects/inmobiliaria-analytics"
|
||||||
|
|
||||||
|
# platform_marketing_content
|
||||||
|
create_repo "platform-marketing-content" "Plataforma de marketing y contenido" \
|
||||||
|
"/home/isem/workspace-v1/projects/platform_marketing_content"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}=== Repositorios principales configurados ===${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "Para crear los repositorios en Gitea, ejecuta desde cada proyecto:"
|
||||||
|
echo " git push -u origin main"
|
||||||
|
echo ""
|
||||||
|
echo "O crea los repositorios vacios primero en:"
|
||||||
|
echo " ${GITEA_URL}/${GITEA_USER}"
|
||||||
215
scripts/fix_yaml_frontmatter.py
Normal file
215
scripts/fix_yaml_frontmatter.py
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Script para agregar YAML front-matter a archivos markdown que no lo tienen.
|
||||||
|
Soporta múltiples proyectos del workspace.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from datetime import datetime
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def extract_title_from_content(content: str, filename: str) -> str:
|
||||||
|
"""Extrae título del primer H1 o usa el nombre del archivo."""
|
||||||
|
match = re.search(r'^#\s+(.+)$', content, re.MULTILINE)
|
||||||
|
if match:
|
||||||
|
return match.group(1).strip()
|
||||||
|
# Fallback: usar nombre de archivo
|
||||||
|
name = Path(filename).stem
|
||||||
|
return name.replace('-', ' ').replace('_', ' ').title()
|
||||||
|
|
||||||
|
def determine_file_type(filepath: str, filename: str) -> str:
|
||||||
|
"""Determina el tipo de documento basado en path y nombre."""
|
||||||
|
filepath_lower = filepath.lower()
|
||||||
|
filename_lower = filename.lower()
|
||||||
|
|
||||||
|
# Por prefijo de archivo
|
||||||
|
if filename_lower.startswith('rf-'):
|
||||||
|
return 'Requirement'
|
||||||
|
elif filename_lower.startswith('us-'):
|
||||||
|
return 'User Story'
|
||||||
|
elif filename_lower.startswith('et-'):
|
||||||
|
return 'Technical Specification'
|
||||||
|
elif filename_lower.startswith('adr-'):
|
||||||
|
return 'ADR'
|
||||||
|
elif filename_lower.startswith('epic-'):
|
||||||
|
return 'Epic'
|
||||||
|
elif filename_lower.startswith('pmc-') or filename_lower.startswith('oqi-'):
|
||||||
|
return 'Module Definition'
|
||||||
|
|
||||||
|
# Por nombre específico
|
||||||
|
if '_map' in filename_lower or '_index' in filename_lower:
|
||||||
|
return 'Index'
|
||||||
|
elif 'readme' in filename_lower:
|
||||||
|
return 'README'
|
||||||
|
elif 'vision' in filename_lower:
|
||||||
|
return 'Vision'
|
||||||
|
elif 'arquitectura' in filename_lower or 'architecture' in filename_lower:
|
||||||
|
return 'Architecture'
|
||||||
|
elif 'roadmap' in filename_lower:
|
||||||
|
return 'Roadmap'
|
||||||
|
elif 'guia' in filename_lower or 'guide' in filename_lower:
|
||||||
|
return 'Guide'
|
||||||
|
elif 'glosario' in filename_lower:
|
||||||
|
return 'Glossary'
|
||||||
|
elif 'board' in filename_lower:
|
||||||
|
return 'Planning'
|
||||||
|
elif 'definition-of' in filename_lower:
|
||||||
|
return 'Process'
|
||||||
|
elif 'auditoria' in filename_lower:
|
||||||
|
return 'Audit'
|
||||||
|
elif 'analisis' in filename_lower:
|
||||||
|
return 'Analysis'
|
||||||
|
elif 'modelo' in filename_lower or 'esquema' in filename_lower:
|
||||||
|
return 'Model'
|
||||||
|
elif 'api' in filename_lower:
|
||||||
|
return 'API Documentation'
|
||||||
|
|
||||||
|
# Por carpeta
|
||||||
|
if '/requerimientos/' in filepath_lower or '/requirements/' in filepath_lower:
|
||||||
|
return 'Requirement'
|
||||||
|
elif '/historias-usuario/' in filepath_lower or '/user-stories/' in filepath_lower:
|
||||||
|
return 'User Story'
|
||||||
|
elif '/especificaciones/' in filepath_lower:
|
||||||
|
return 'Technical Specification'
|
||||||
|
elif '/adr/' in filepath_lower or '97-adr' in filepath_lower:
|
||||||
|
return 'ADR'
|
||||||
|
elif '/planning/' in filepath_lower:
|
||||||
|
return 'Planning'
|
||||||
|
elif '/guias/' in filepath_lower or '/guides/' in filepath_lower:
|
||||||
|
return 'Guide'
|
||||||
|
|
||||||
|
return 'Documentation'
|
||||||
|
|
||||||
|
def extract_epic_from_path(filepath: str) -> str:
|
||||||
|
"""Extrae el epic/módulo del path si existe."""
|
||||||
|
# Buscar patrones como OQI-001, PMC-001, EPIC-001, etc.
|
||||||
|
match = re.search(r'(OQI-\d+|PMC-\d+|EPIC-\d+|BA-\d+|IA-\d+)', filepath, re.IGNORECASE)
|
||||||
|
if match:
|
||||||
|
return match.group(1).upper()
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def generate_id(filename: str) -> str:
|
||||||
|
"""Genera un ID único basado en el nombre del archivo."""
|
||||||
|
name = Path(filename).stem
|
||||||
|
return name.upper().replace(' ', '-')
|
||||||
|
|
||||||
|
def determine_status(doc_type: str) -> str:
|
||||||
|
"""Determina el status por defecto según el tipo."""
|
||||||
|
if doc_type in ['Requirement', 'User Story', 'Technical Specification']:
|
||||||
|
return 'Draft'
|
||||||
|
elif doc_type in ['Vision', 'Architecture', 'Guide']:
|
||||||
|
return 'Active'
|
||||||
|
return 'Draft'
|
||||||
|
|
||||||
|
def has_yaml_frontmatter(content: str) -> bool:
|
||||||
|
"""Verifica si el contenido ya tiene YAML front-matter."""
|
||||||
|
return content.strip().startswith('---')
|
||||||
|
|
||||||
|
def add_yaml_frontmatter(filepath: str, project_name: str) -> bool:
|
||||||
|
"""Agrega YAML front-matter a un archivo si no lo tiene."""
|
||||||
|
try:
|
||||||
|
with open(filepath, 'r', encoding='utf-8') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
if has_yaml_frontmatter(content):
|
||||||
|
return False
|
||||||
|
|
||||||
|
filename = os.path.basename(filepath)
|
||||||
|
title = extract_title_from_content(content, filename)
|
||||||
|
doc_type = determine_file_type(filepath, filename)
|
||||||
|
doc_id = generate_id(filename)
|
||||||
|
epic = extract_epic_from_path(filepath)
|
||||||
|
status = determine_status(doc_type)
|
||||||
|
today = datetime.now().strftime('%Y-%m-%d')
|
||||||
|
|
||||||
|
# Construir YAML
|
||||||
|
yaml_lines = [
|
||||||
|
'---',
|
||||||
|
f'id: "{doc_id}"',
|
||||||
|
f'title: "{title}"',
|
||||||
|
f'type: "{doc_type}"',
|
||||||
|
]
|
||||||
|
|
||||||
|
if epic:
|
||||||
|
yaml_lines.append(f'epic: "{epic}"')
|
||||||
|
|
||||||
|
yaml_lines.extend([
|
||||||
|
f'status: "{status}"',
|
||||||
|
f'project: "{project_name}"',
|
||||||
|
f'version: "1.0.0"',
|
||||||
|
f'created_date: "{today}"',
|
||||||
|
f'updated_date: "{today}"',
|
||||||
|
'---',
|
||||||
|
''
|
||||||
|
])
|
||||||
|
|
||||||
|
yaml_header = '\n'.join(yaml_lines)
|
||||||
|
new_content = yaml_header + content
|
||||||
|
|
||||||
|
with open(filepath, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(new_content)
|
||||||
|
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error procesando {filepath}: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
def process_project(docs_path: str, project_name: str):
|
||||||
|
"""Procesa todos los archivos .md de un proyecto."""
|
||||||
|
processed = 0
|
||||||
|
skipped = 0
|
||||||
|
errors = 0
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(docs_path):
|
||||||
|
for filename in files:
|
||||||
|
if filename.endswith('.md'):
|
||||||
|
filepath = os.path.join(root, filename)
|
||||||
|
try:
|
||||||
|
with open(filepath, 'r', encoding='utf-8') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
if has_yaml_frontmatter(content):
|
||||||
|
skipped += 1
|
||||||
|
else:
|
||||||
|
if add_yaml_frontmatter(filepath, project_name):
|
||||||
|
processed += 1
|
||||||
|
print(f"✓ {filepath}")
|
||||||
|
else:
|
||||||
|
errors += 1
|
||||||
|
except Exception as e:
|
||||||
|
errors += 1
|
||||||
|
print(f"✗ {filepath}: {e}")
|
||||||
|
|
||||||
|
return processed, skipped, errors
|
||||||
|
|
||||||
|
def main():
|
||||||
|
base_path = '/home/isem/workspace-v1/projects'
|
||||||
|
|
||||||
|
projects = [
|
||||||
|
('platform_marketing_content', 'platform_marketing_content'),
|
||||||
|
('trading-platform', 'trading-platform'),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_processed = 0
|
||||||
|
total_skipped = 0
|
||||||
|
total_errors = 0
|
||||||
|
|
||||||
|
for folder, project_name in projects:
|
||||||
|
docs_path = os.path.join(base_path, folder, 'docs')
|
||||||
|
if os.path.exists(docs_path):
|
||||||
|
print(f"\n=== Procesando: {project_name} ===")
|
||||||
|
processed, skipped, errors = process_project(docs_path, project_name)
|
||||||
|
print(f" Processed: {processed}, Skipped: {skipped}, Errors: {errors}")
|
||||||
|
total_processed += processed
|
||||||
|
total_skipped += skipped
|
||||||
|
total_errors += errors
|
||||||
|
else:
|
||||||
|
print(f"No existe: {docs_path}")
|
||||||
|
|
||||||
|
print(f"\n=== TOTAL ===")
|
||||||
|
print(f"Processed: {total_processed}")
|
||||||
|
print(f"Skipped: {total_skipped}")
|
||||||
|
print(f"Errors: {total_errors}")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
64
scripts/push-all-projects.sh
Executable file
64
scripts/push-all-projects.sh
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =============================================================================
|
||||||
|
# Script: Push todos los proyectos a Gitea
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
# Prerrequisito: Ejecutar create-gitea-repos-api.sh primero
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
WORKSPACE="/home/isem/workspace-v1"
|
||||||
|
|
||||||
|
# Colores
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo -e "${GREEN}=== Push de proyectos a Gitea ===${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Proyectos a procesar
|
||||||
|
PROJECTS=(
|
||||||
|
"erp-construccion"
|
||||||
|
"erp-core"
|
||||||
|
"erp-mecanicas-diesel"
|
||||||
|
"erp-suite"
|
||||||
|
"erp-clinicas"
|
||||||
|
"erp-retail"
|
||||||
|
"erp-vidrio-templado"
|
||||||
|
"trading-platform"
|
||||||
|
"betting-analytics"
|
||||||
|
"inmobiliaria-analytics"
|
||||||
|
"platform_marketing_content"
|
||||||
|
)
|
||||||
|
|
||||||
|
for proj in "${PROJECTS[@]}"; do
|
||||||
|
echo -ne "${YELLOW}Pushing: $proj... ${NC}"
|
||||||
|
|
||||||
|
proj_path="${WORKSPACE}/projects/${proj}"
|
||||||
|
|
||||||
|
if [ ! -d "$proj_path/.git" ]; then
|
||||||
|
echo -e "${RED}Sin .git${NC}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$proj_path"
|
||||||
|
|
||||||
|
# Intentar push
|
||||||
|
result=$(git push -u origin main 2>&1)
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}OK${NC}"
|
||||||
|
else
|
||||||
|
if echo "$result" | grep -q "Everything up-to-date"; then
|
||||||
|
echo -e "${GREEN}Ya sincronizado${NC}"
|
||||||
|
elif echo "$result" | grep -q "repository not found\|does not exist"; then
|
||||||
|
echo -e "${RED}Repo no existe en Gitea${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error${NC}"
|
||||||
|
echo " $result" | head -2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}=== Proceso completado ===${NC}"
|
||||||
177
shared/README.md
Normal file
177
shared/README.md
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
# Shared - Recursos Compartidos
|
||||||
|
|
||||||
|
**Version:** 2.0.0
|
||||||
|
**Actualizado:** 2026-01-04
|
||||||
|
|
||||||
|
## Descripcion
|
||||||
|
|
||||||
|
El directorio `shared/` contiene todos los **recursos compartidos** del workspace: codigo reutilizable, catalogo de funcionalidades, tipos, constantes, y base de conocimiento con documentacion.
|
||||||
|
|
||||||
|
## Estructura
|
||||||
|
|
||||||
|
```
|
||||||
|
shared/
|
||||||
|
├── README.md # Este archivo
|
||||||
|
│
|
||||||
|
├── catalog/ # Catalogo de funcionalidades reutilizables
|
||||||
|
│ ├── auth/ # Autenticacion JWT + Passport
|
||||||
|
│ ├── session-management/ # Gestion de sesiones
|
||||||
|
│ ├── rate-limiting/ # Limitacion de tasa
|
||||||
|
│ ├── notifications/ # Sistema de notificaciones
|
||||||
|
│ ├── multi-tenancy/ # Soporte multi-tenant con RLS
|
||||||
|
│ ├── feature-flags/ # Feature flags dinamicos
|
||||||
|
│ ├── websocket/ # Comunicacion WebSocket
|
||||||
|
│ ├── payments/ # Integracion con Stripe
|
||||||
|
│ ├── audit-logs/ # Logs de auditoria
|
||||||
|
│ ├── portales/ # Portales multi-tenant
|
||||||
|
│ ├── template-saas/ # Template SaaS completo
|
||||||
|
│ ├── CATALOG-INDEX.yml # Indice maestro
|
||||||
|
│ └── README.md
|
||||||
|
│
|
||||||
|
├── modules/ # Codigo ejecutable compartido
|
||||||
|
│ ├── utils/ # Utilidades (date, string, validation)
|
||||||
|
│ ├── auth/ # Modulo de autenticacion
|
||||||
|
│ ├── billing/ # Modulo de facturacion
|
||||||
|
│ ├── notifications/ # Modulo de notificaciones
|
||||||
|
│ ├── payments/ # Modulo de pagos
|
||||||
|
│ ├── multitenant/ # Modulo multi-tenancy
|
||||||
|
│ └── package.json
|
||||||
|
│
|
||||||
|
├── constants/ # Constantes globales TypeScript
|
||||||
|
│ ├── enums.constants.ts # Enums universales
|
||||||
|
│ ├── regex.constants.ts # Patrones regex
|
||||||
|
│ └── index.ts
|
||||||
|
│
|
||||||
|
├── types/ # Tipos TypeScript compartidos
|
||||||
|
│ ├── api.types.ts # Tipos de API
|
||||||
|
│ ├── common.types.ts # Tipos comunes
|
||||||
|
│ └── index.ts
|
||||||
|
│
|
||||||
|
└── knowledge-base/ # Base de conocimiento
|
||||||
|
├── modules/ # Documentacion de modulos
|
||||||
|
├── platforms/ # Plataformas base (SaaS, ERP, etc.)
|
||||||
|
├── projects/ # Proyectos de referencia
|
||||||
|
├── standards/ # Estandares tecnicos
|
||||||
|
├── architecture/ # Patrones arquitectonicos
|
||||||
|
├── patterns/ # Patrones de desarrollo
|
||||||
|
├── propagacion/ # Sistema de propagacion
|
||||||
|
├── templates/ # Templates
|
||||||
|
├── reference/ # Referencias legacy
|
||||||
|
├── CATALOGO-MODULOS.yml # Catalogo de 37 modulos
|
||||||
|
├── TRAZABILIDAD-PROYECTOS.yml
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Uso
|
||||||
|
|
||||||
|
### Catalogo de Funcionalidades
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Buscar funcionalidad disponible
|
||||||
|
cat shared/catalog/CATALOG-INDEX.yml
|
||||||
|
|
||||||
|
# Consultar implementacion especifica
|
||||||
|
cat shared/catalog/auth/README.md
|
||||||
|
cat shared/catalog/auth/IMPLEMENTATION.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### Importar Modulos
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Utilidades
|
||||||
|
import { formatDate, slugify, isEmail } from '@shared/modules/utils';
|
||||||
|
|
||||||
|
// Constantes
|
||||||
|
import { UserStatus, PaymentStatus } from '@shared/constants';
|
||||||
|
import { EMAIL_REGEX, UUID_REGEX } from '@shared/constants/regex.constants';
|
||||||
|
|
||||||
|
// Tipos
|
||||||
|
import { ApiResponse, PaginatedResponse } from '@shared/types';
|
||||||
|
import { BaseEntity, Address } from '@shared/types/common.types';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Knowledge Base
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ver catalogo de modulos
|
||||||
|
cat shared/knowledge-base/CATALOGO-MODULOS.yml
|
||||||
|
|
||||||
|
# Ver trazabilidad de proyectos
|
||||||
|
cat shared/knowledge-base/TRAZABILIDAD-PROYECTOS.yml
|
||||||
|
|
||||||
|
# Consultar documentacion de modulo
|
||||||
|
cat shared/knowledge-base/modules/authentication/_INDEX.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Catalogo
|
||||||
|
@CATALOG: shared/catalog/
|
||||||
|
@CATALOG_INDEX: shared/catalog/CATALOG-INDEX.yml
|
||||||
|
@CATALOG_AUTH: shared/catalog/auth/
|
||||||
|
@CATALOG_SESSION: shared/catalog/session-management/
|
||||||
|
@CATALOG_RATELIMIT: shared/catalog/rate-limiting/
|
||||||
|
@CATALOG_NOTIFY: shared/catalog/notifications/
|
||||||
|
@CATALOG_TENANT: shared/catalog/multi-tenancy/
|
||||||
|
@CATALOG_FLAGS: shared/catalog/feature-flags/
|
||||||
|
@CATALOG_WS: shared/catalog/websocket/
|
||||||
|
@CATALOG_PAYMENTS: shared/catalog/payments/
|
||||||
|
|
||||||
|
# Modulos
|
||||||
|
@MODULES: shared/modules/
|
||||||
|
@MOD_UTILS: shared/modules/utils/
|
||||||
|
@MOD_AUTH: shared/modules/auth/
|
||||||
|
@MOD_NOTIFY: shared/modules/notifications/
|
||||||
|
@MOD_PAYMENTS: shared/modules/payments/
|
||||||
|
@MOD_BILLING: shared/modules/billing/
|
||||||
|
@MOD_TENANT: shared/modules/multitenant/
|
||||||
|
|
||||||
|
# Tipos y Constantes
|
||||||
|
@CONSTANTS: shared/constants/
|
||||||
|
@TYPES: shared/types/
|
||||||
|
|
||||||
|
# Knowledge Base
|
||||||
|
@KB: shared/knowledge-base/
|
||||||
|
@KB_MODULES: shared/knowledge-base/modules/
|
||||||
|
@KB_PLATFORMS: shared/knowledge-base/platforms/
|
||||||
|
@KB_PROJECTS: shared/knowledge-base/projects/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Funcionalidades del Catalogo
|
||||||
|
|
||||||
|
| Funcionalidad | Estado | Origen | Stack |
|
||||||
|
|---------------|--------|--------|-------|
|
||||||
|
| auth | Production-Ready | Gamilit | NestJS + JWT + Passport |
|
||||||
|
| session-management | Production-Ready | Gamilit | NestJS + TypeORM |
|
||||||
|
| rate-limiting | Production-Ready | Gamilit | NestJS + @nestjs/throttler |
|
||||||
|
| notifications | Production-Ready | Gamilit | NestJS + Email/Push |
|
||||||
|
| multi-tenancy | Production-Ready | Gamilit | NestJS + PostgreSQL RLS |
|
||||||
|
| feature-flags | Production-Ready | Gamilit | NestJS + TypeORM |
|
||||||
|
| websocket | Production-Ready | Trading | NestJS + Socket.io |
|
||||||
|
| payments | Production-Ready | Trading | NestJS + Stripe |
|
||||||
|
| audit-logs | Documentando | ERP | NestJS + TypeORM |
|
||||||
|
| portales | Documentando | PMC | NestJS + Multi-tenant |
|
||||||
|
| template-saas | Documentando | Workspace | Full-stack |
|
||||||
|
|
||||||
|
## Relacion con Proyectos
|
||||||
|
|
||||||
|
Los proyectos en `projects/` pueden importar recursos de `shared/`:
|
||||||
|
|
||||||
|
```
|
||||||
|
projects/gamilit/ → usa shared/catalog/auth, shared/modules/utils
|
||||||
|
projects/erp-core/ → usa shared/catalog/multi-tenancy
|
||||||
|
projects/trading-platform/ → usa shared/catalog/websocket, payments
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ver Tambien
|
||||||
|
|
||||||
|
- [Catalogo de Funcionalidades](catalog/README.md)
|
||||||
|
- [Knowledge Base](knowledge-base/README.md)
|
||||||
|
- [Core (Arquitectura)](../core/README.md)
|
||||||
|
- [Control Plane (Governance)](../control-plane/README.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Mantenido por:** Architecture-Analyst
|
||||||
|
**Ultima actualizacion:** 2026-01-04
|
||||||
@ -28,7 +28,7 @@ funcionalidades:
|
|||||||
|
|
||||||
auth:
|
auth:
|
||||||
nombre: "Autenticación y Autorización"
|
nombre: "Autenticación y Autorización"
|
||||||
path: "core/catalog/auth/"
|
path: "shared/catalog/auth/"
|
||||||
alias: "@CATALOG_AUTH"
|
alias: "@CATALOG_AUTH"
|
||||||
estado: "production-ready" # production-ready | documentando | pendiente
|
estado: "production-ready" # production-ready | documentando | pendiente
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -68,7 +68,7 @@ funcionalidades:
|
|||||||
|
|
||||||
session-management:
|
session-management:
|
||||||
nombre: "Gestión de Sesiones"
|
nombre: "Gestión de Sesiones"
|
||||||
path: "core/catalog/session-management/"
|
path: "shared/catalog/session-management/"
|
||||||
alias: "@CATALOG_SESSION"
|
alias: "@CATALOG_SESSION"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -98,7 +98,7 @@ funcionalidades:
|
|||||||
|
|
||||||
rate-limiting:
|
rate-limiting:
|
||||||
nombre: "Limitación de Tasa (Rate Limiting)"
|
nombre: "Limitación de Tasa (Rate Limiting)"
|
||||||
path: "core/catalog/rate-limiting/"
|
path: "shared/catalog/rate-limiting/"
|
||||||
alias: "@CATALOG_RATELIMIT"
|
alias: "@CATALOG_RATELIMIT"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -129,7 +129,7 @@ funcionalidades:
|
|||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
nombre: "Sistema de Notificaciones"
|
nombre: "Sistema de Notificaciones"
|
||||||
path: "core/catalog/notifications/"
|
path: "shared/catalog/notifications/"
|
||||||
alias: "@CATALOG_NOTIFY"
|
alias: "@CATALOG_NOTIFY"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -165,7 +165,7 @@ funcionalidades:
|
|||||||
|
|
||||||
websocket:
|
websocket:
|
||||||
nombre: "Comunicación WebSocket"
|
nombre: "Comunicación WebSocket"
|
||||||
path: "core/catalog/websocket/"
|
path: "shared/catalog/websocket/"
|
||||||
alias: "@CATALOG_WS"
|
alias: "@CATALOG_WS"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/trading-platform"
|
origen: "projects/trading-platform"
|
||||||
@ -199,7 +199,7 @@ funcionalidades:
|
|||||||
|
|
||||||
multi-tenancy:
|
multi-tenancy:
|
||||||
nombre: "Soporte Multi-Tenant"
|
nombre: "Soporte Multi-Tenant"
|
||||||
path: "core/catalog/multi-tenancy/"
|
path: "shared/catalog/multi-tenancy/"
|
||||||
alias: "@CATALOG_TENANT"
|
alias: "@CATALOG_TENANT"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -233,7 +233,7 @@ funcionalidades:
|
|||||||
|
|
||||||
feature-flags:
|
feature-flags:
|
||||||
nombre: "Feature Flags Dinámicos"
|
nombre: "Feature Flags Dinámicos"
|
||||||
path: "core/catalog/feature-flags/"
|
path: "shared/catalog/feature-flags/"
|
||||||
alias: "@CATALOG_FLAGS"
|
alias: "@CATALOG_FLAGS"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit"
|
origen: "projects/gamilit"
|
||||||
@ -268,7 +268,7 @@ funcionalidades:
|
|||||||
|
|
||||||
payments:
|
payments:
|
||||||
nombre: "Integración de Pagos"
|
nombre: "Integración de Pagos"
|
||||||
path: "core/catalog/payments/"
|
path: "shared/catalog/payments/"
|
||||||
alias: "@CATALOG_PAYMENTS"
|
alias: "@CATALOG_PAYMENTS"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/trading-platform"
|
origen: "projects/trading-platform"
|
||||||
@ -304,7 +304,7 @@ funcionalidades:
|
|||||||
|
|
||||||
template-saas:
|
template-saas:
|
||||||
nombre: "Template SaaS Multi-tenant"
|
nombre: "Template SaaS Multi-tenant"
|
||||||
path: "core/catalog/template-saas/"
|
path: "shared/catalog/template-saas/"
|
||||||
alias: "@CATALOG_SAAS"
|
alias: "@CATALOG_SAAS"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/erp-core, projects/gamilit"
|
origen: "projects/erp-core, projects/gamilit"
|
||||||
@ -342,7 +342,7 @@ funcionalidades:
|
|||||||
|
|
||||||
portales:
|
portales:
|
||||||
nombre: "Portales y Dashboards"
|
nombre: "Portales y Dashboards"
|
||||||
path: "core/catalog/portales/"
|
path: "shared/catalog/portales/"
|
||||||
alias: "@CATALOG_PORTALES"
|
alias: "@CATALOG_PORTALES"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit, projects/trading-platform"
|
origen: "projects/gamilit, projects/trading-platform"
|
||||||
@ -379,7 +379,7 @@ funcionalidades:
|
|||||||
|
|
||||||
audit-logs:
|
audit-logs:
|
||||||
nombre: "Sistema de Auditoria"
|
nombre: "Sistema de Auditoria"
|
||||||
path: "core/catalog/audit-logs/"
|
path: "shared/catalog/audit-logs/"
|
||||||
alias: "@CATALOG_AUDIT"
|
alias: "@CATALOG_AUDIT"
|
||||||
estado: "production-ready"
|
estado: "production-ready"
|
||||||
origen: "projects/gamilit, projects/erp-core"
|
origen: "projects/gamilit, projects/erp-core"
|
||||||
@ -419,7 +419,7 @@ funcionalidades:
|
|||||||
# ─────────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────────
|
||||||
#
|
#
|
||||||
# Para buscar funcionalidad por keyword:
|
# Para buscar funcionalidad por keyword:
|
||||||
# grep -i "{keyword}" core/catalog/CATALOG-INDEX.yml
|
# grep -i "{keyword}" shared/catalog/CATALOG-INDEX.yml
|
||||||
#
|
#
|
||||||
# Ejemplos:
|
# Ejemplos:
|
||||||
# grep -i "login" → auth
|
# grep -i "login" → auth
|
||||||
@ -469,7 +469,7 @@ instrucciones:
|
|||||||
- Considerar agregar al catálogo después
|
- Considerar agregar al catálogo después
|
||||||
|
|
||||||
que_hacer_si_encuentra: |
|
que_hacer_si_encuentra: |
|
||||||
1. Ir a: core/catalog/{funcionalidad}/
|
1. Ir a: shared/catalog/{funcionalidad}/
|
||||||
2. Leer: README.md (descripción y trade-offs)
|
2. Leer: README.md (descripción y trade-offs)
|
||||||
3. Seguir: IMPLEMENTATION.md (pasos)
|
3. Seguir: IMPLEMENTATION.md (pasos)
|
||||||
4. Copiar: _reference/ (código base)
|
4. Copiar: _reference/ (código base)
|
||||||
@ -30,7 +30,7 @@ Este catálogo centraliza **código funcional probado y documentado** que puede
|
|||||||
## ESTRUCTURA DEL CATÁLOGO
|
## ESTRUCTURA DEL CATÁLOGO
|
||||||
|
|
||||||
```
|
```
|
||||||
core/catalog/
|
shared/catalog/
|
||||||
├── README.md ← ESTÁS AQUÍ
|
├── README.md ← ESTÁS AQUÍ
|
||||||
├── CATALOG-INDEX.yml # Índice máquina-readable
|
├── CATALOG-INDEX.yml # Índice máquina-readable
|
||||||
│
|
│
|
||||||
@ -103,16 +103,16 @@ core/catalog/
|
|||||||
### Alias Disponibles
|
### Alias Disponibles
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@CATALOG: core/catalog/
|
@CATALOG: shared/catalog/
|
||||||
@CATALOG_INDEX: core/catalog/CATALOG-INDEX.yml
|
@CATALOG_INDEX: shared/catalog/CATALOG-INDEX.yml
|
||||||
@CATALOG_AUTH: core/catalog/auth/
|
@CATALOG_AUTH: shared/catalog/auth/
|
||||||
@CATALOG_SESSION: core/catalog/session-management/
|
@CATALOG_SESSION: shared/catalog/session-management/
|
||||||
@CATALOG_RATELIMIT: core/catalog/rate-limiting/
|
@CATALOG_RATELIMIT: shared/catalog/rate-limiting/
|
||||||
@CATALOG_NOTIFY: core/catalog/notifications/
|
@CATALOG_NOTIFY: shared/catalog/notifications/
|
||||||
@CATALOG_TENANT: core/catalog/multi-tenancy/
|
@CATALOG_TENANT: shared/catalog/multi-tenancy/
|
||||||
@CATALOG_FLAGS: core/catalog/feature-flags/
|
@CATALOG_FLAGS: shared/catalog/feature-flags/
|
||||||
@CATALOG_WS: core/catalog/websocket/
|
@CATALOG_WS: shared/catalog/websocket/
|
||||||
@CATALOG_PAYMENTS: core/catalog/payments/
|
@CATALOG_PAYMENTS: shared/catalog/payments/
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -251,7 +251,7 @@ Una funcionalidad DEBE agregarse al catálogo si cumple **TODOS** estos criterio
|
|||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
PASO 1: PREPARAR ESTRUCTURA
|
PASO 1: PREPARAR ESTRUCTURA
|
||||||
[ ] Crear directorio: core/catalog/{nombre-en-kebab-case}/
|
[ ] Crear directorio: shared/catalog/{nombre-en-kebab-case}/
|
||||||
[ ] Crear README.md vacío
|
[ ] Crear README.md vacío
|
||||||
[ ] Crear IMPLEMENTATION.md vacío
|
[ ] Crear IMPLEMENTATION.md vacío
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ PASO 4: ACTUALIZAR ÍNDICES (OBLIGATORIO)
|
|||||||
PASO 5: ACTUALIZAR ALIASES (OBLIGATORIO)
|
PASO 5: ACTUALIZAR ALIASES (OBLIGATORIO)
|
||||||
[ ] Editar core/orchestration/referencias/ALIASES.yml:
|
[ ] Editar core/orchestration/referencias/ALIASES.yml:
|
||||||
- Agregar alias @CATALOG_{NOMBRE}
|
- Agregar alias @CATALOG_{NOMBRE}
|
||||||
- Ejemplo: @CATALOG_AUDIT: "core/catalog/audit-logs/"
|
- Ejemplo: @CATALOG_AUDIT: "shared/catalog/audit-logs/"
|
||||||
|
|
||||||
PASO 6: VALIDAR
|
PASO 6: VALIDAR
|
||||||
[ ] Verificar que grep encuentra la funcionalidad en CATALOG-INDEX.yml
|
[ ] Verificar que grep encuentra la funcionalidad en CATALOG-INDEX.yml
|
||||||
@ -5,7 +5,7 @@
|
|||||||
* Estos son los enums "universales" que aplican a múltiples proyectos.
|
* Estos son los enums "universales" que aplican a múltiples proyectos.
|
||||||
* Los enums específicos de cada proyecto deben estar en su propio repositorio.
|
* Los enums específicos de cada proyecto deben estar en su propio repositorio.
|
||||||
*
|
*
|
||||||
* @module @core/constants/enums
|
* @module @shared/constants/enums
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Universal constants shared across all projects in the workspace.
|
* Universal constants shared across all projects in the workspace.
|
||||||
*
|
*
|
||||||
* @module @core/constants
|
* @module @shared/constants
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Regex patterns compartidos entre todos los proyectos del workspace.
|
* Regex patterns compartidos entre todos los proyectos del workspace.
|
||||||
*
|
*
|
||||||
* @module @core/constants/regex
|
* @module @shared/constants/regex
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -138,14 +138,14 @@ El Knowledge Base es parte del ecosistema NEXUS:
|
|||||||
```
|
```
|
||||||
workspace-v1/
|
workspace-v1/
|
||||||
├── orchestration/ # Sistema de directivas SIMCO
|
├── orchestration/ # Sistema de directivas SIMCO
|
||||||
├── core/catalog/ # Codigo de catalogo (legacy)
|
├── shared/catalog/ # Codigo de catalogo (legacy)
|
||||||
├── shared/knowledge-base/ # ESTE DIRECTORIO
|
├── shared/knowledge-base/ # ESTE DIRECTORIO
|
||||||
└── projects/ # Proyectos de produccion
|
└── projects/ # Proyectos de produccion
|
||||||
```
|
```
|
||||||
|
|
||||||
### Relacion con core/catalog
|
### Relacion con shared/catalog
|
||||||
|
|
||||||
- **core/catalog/**: Codigo legacy, referencia
|
- **shared/catalog/**: Codigo legacy, referencia
|
||||||
- **shared/knowledge-base/modules/**: Modulos documentados y versionados
|
- **shared/knowledge-base/modules/**: Modulos documentados y versionados
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
139
shared/knowledge-base/TRAZABILIDAD-PROPAGACION.yml
Normal file
139
shared/knowledge-base/TRAZABILIDAD-PROPAGACION.yml
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
# TRAZABILIDAD DE PROPAGACIÓN
|
||||||
|
# Sistema: SIMCO - NEXUS v4.0
|
||||||
|
# Propósito: Tracking de propagaciones entre proyectos y KB
|
||||||
|
# Versión: 1.0.0
|
||||||
|
# Fecha: 2026-01-04
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# REGISTRO DE PROPAGACIONES
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
propagaciones:
|
||||||
|
# Ejemplo de entrada:
|
||||||
|
# - id: "PROP-2026-01-001"
|
||||||
|
# fecha: "2026-01-04"
|
||||||
|
# tipo: "bug_fix"
|
||||||
|
# origen:
|
||||||
|
# proyecto: "gamilit"
|
||||||
|
# archivo: "src/utils/validation.ts"
|
||||||
|
# tarea: "HU-123"
|
||||||
|
# descripcion: "Corrección de validación de emails"
|
||||||
|
# destinos:
|
||||||
|
# - proyecto: "erp-core"
|
||||||
|
# estado: "completado"
|
||||||
|
# fecha_aplicado: "2026-01-04"
|
||||||
|
# - proyecto: "knowledge-base"
|
||||||
|
# ubicacion: "patterns/validation/"
|
||||||
|
# estado: "completado"
|
||||||
|
# estado_general: "completado"
|
||||||
|
# notas: ""
|
||||||
|
|
||||||
|
# Agregar nuevas propagaciones aquí:
|
||||||
|
- id: "PROP-TEMPLATE"
|
||||||
|
fecha: "{YYYY-MM-DD}"
|
||||||
|
tipo: "{security_fix | bug_fix | feature | refactor | docs}"
|
||||||
|
|
||||||
|
origen:
|
||||||
|
proyecto: "{nombre_proyecto}"
|
||||||
|
archivo: "{ruta/archivo}"
|
||||||
|
tarea: "{HU-XXX}"
|
||||||
|
descripcion_cambio: "{qué se cambió}"
|
||||||
|
|
||||||
|
destinos:
|
||||||
|
- proyecto: "{nombre_destino}"
|
||||||
|
tipo_destino: "{proyecto | kb | catalog}"
|
||||||
|
ubicacion: "{ruta si aplica}"
|
||||||
|
estado: "{pendiente | en_progreso | completado | fallido}"
|
||||||
|
fecha_aplicado: ""
|
||||||
|
verificado: false
|
||||||
|
notas: ""
|
||||||
|
|
||||||
|
estado_general: "{pendiente | en_progreso | completado | parcial | fallido}"
|
||||||
|
|
||||||
|
migration_guide:
|
||||||
|
requerido: false
|
||||||
|
ubicacion: ""
|
||||||
|
|
||||||
|
verificacion:
|
||||||
|
tests_pasados: false
|
||||||
|
build_pasado: false
|
||||||
|
revisado_por: ""
|
||||||
|
|
||||||
|
notas: ""
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# ÍNDICE POR PROYECTO ORIGEN
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
indice_por_origen:
|
||||||
|
gamilit: []
|
||||||
|
trading-platform: []
|
||||||
|
betting-analytics: []
|
||||||
|
inmobiliaria-analytics: []
|
||||||
|
platform_marketing_content: []
|
||||||
|
erp-suite: []
|
||||||
|
erp-core: []
|
||||||
|
erp-clinicas: []
|
||||||
|
erp-construccion: []
|
||||||
|
erp-mecanicas-diesel: []
|
||||||
|
erp-retail: []
|
||||||
|
erp-vidrio-templado: []
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# ÍNDICE POR DESTINO
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
indice_por_destino:
|
||||||
|
knowledge-base:
|
||||||
|
patterns: []
|
||||||
|
lessons-learned: []
|
||||||
|
reference: []
|
||||||
|
antipatterns: []
|
||||||
|
|
||||||
|
catalog:
|
||||||
|
components: []
|
||||||
|
utils: []
|
||||||
|
hooks: []
|
||||||
|
services: []
|
||||||
|
|
||||||
|
proyectos:
|
||||||
|
gamilit: []
|
||||||
|
trading-platform: []
|
||||||
|
erp-core: []
|
||||||
|
# ... otros proyectos
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# ESTADÍSTICAS
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
estadisticas:
|
||||||
|
total_propagaciones: 0
|
||||||
|
por_tipo:
|
||||||
|
security_fix: 0
|
||||||
|
bug_fix: 0
|
||||||
|
feature: 0
|
||||||
|
refactor: 0
|
||||||
|
docs: 0
|
||||||
|
|
||||||
|
por_estado:
|
||||||
|
completadas: 0
|
||||||
|
en_progreso: 0
|
||||||
|
pendientes: 0
|
||||||
|
fallidas: 0
|
||||||
|
|
||||||
|
sla:
|
||||||
|
security_cumplido: 0
|
||||||
|
security_incumplido: 0
|
||||||
|
bug_cumplido: 0
|
||||||
|
bug_incumplido: 0
|
||||||
|
|
||||||
|
ultima_actualizacion: "2026-01-04"
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
# ALERTAS PENDIENTES
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
alertas:
|
||||||
|
security_pendientes: [] # IDs de propagaciones security pendientes
|
||||||
|
sla_en_riesgo: [] # IDs próximos a vencer SLA
|
||||||
|
fallidas_sin_resolver: [] # IDs fallidos sin resolución
|
||||||
@ -187,7 +187,7 @@ describe('Tenant Isolation', () => {
|
|||||||
|
|
||||||
## Referencias
|
## Referencias
|
||||||
|
|
||||||
- `core/catalog/multi-tenancy/` - Modulo del catalogo
|
- `shared/catalog/multi-tenancy/` - Modulo del catalogo
|
||||||
- `projects/erp-core/database/ddl/` - Ejemplos de DDL
|
- `projects/erp-core/database/ddl/` - Ejemplos de DDL
|
||||||
- PostgreSQL RLS Documentation
|
- PostgreSQL RLS Documentation
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Migracion del workspace original a workspace-v1 con nueva estructura de:
|
|||||||
|
|
||||||
**Problema:** Codigo duplicado entre proyectos.
|
**Problema:** Codigo duplicado entre proyectos.
|
||||||
|
|
||||||
**Solucion:** Expandir `core/catalog/` con:
|
**Solucion:** Expandir `shared/catalog/` con:
|
||||||
- README.md (descripcion, trade-offs)
|
- README.md (descripcion, trade-offs)
|
||||||
- IMPLEMENTATION.md (guia paso a paso)
|
- IMPLEMENTATION.md (guia paso a paso)
|
||||||
- _reference/ (codigo ejemplo)
|
- _reference/ (codigo ejemplo)
|
||||||
|
|||||||
@ -234,7 +234,7 @@ ORDER BY schemaname, tablename;
|
|||||||
## Referencias
|
## Referencias
|
||||||
|
|
||||||
- `architecture/PATRON-MULTI-TENANT.md`
|
- `architecture/PATRON-MULTI-TENANT.md`
|
||||||
- `core/catalog/multi-tenancy/`
|
- `shared/catalog/multi-tenancy/`
|
||||||
- PostgreSQL RLS Documentation
|
- PostgreSQL RLS Documentation
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
ERP Core es la **base generica reutilizable** que proporciona el 60-70% del codigo compartido para todas las verticales del ERP Suite. Es una adaptacion de los patrones de Odoo al stack TypeScript/Node.js/React.
|
ERP Core es la **base generica reutilizable** que proporciona el 60-70% del codigo compartido para todas las verticales del ERP Suite. Es una adaptacion de los patrones de Odoo al stack TypeScript/Node.js/React.
|
||||||
|
|
||||||
|
**Modelo de Negocio:** Plataforma SaaS multi-tenant con facturacion per-seat, integraciones de pago fisico y digital, chatbot IA conversacional, y aplicaciones moviles por perfil de trabajador.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Proposito
|
## Proposito
|
||||||
@ -18,6 +20,10 @@ Desarrollar ERPs verticales desde cero es costoso y repetitivo. El 60-70% de la
|
|||||||
- Productos e inventario
|
- Productos e inventario
|
||||||
- Ventas y compras
|
- Ventas y compras
|
||||||
- Contabilidad basica
|
- Contabilidad basica
|
||||||
|
- **Plataforma SaaS con suscripciones**
|
||||||
|
- **Procesamiento de pagos (online y terminales)**
|
||||||
|
- **Asistente IA conversacional**
|
||||||
|
- **Apps moviles con control de asistencia**
|
||||||
|
|
||||||
### Solucion
|
### Solucion
|
||||||
|
|
||||||
@ -26,6 +32,9 @@ ERP Core provee esta funcionalidad comun de forma:
|
|||||||
- **Extensible:** Las verticales pueden extender sin modificar
|
- **Extensible:** Las verticales pueden extender sin modificar
|
||||||
- **Multi-tenant:** Aislamiento por tenant desde el diseno
|
- **Multi-tenant:** Aislamiento por tenant desde el diseno
|
||||||
- **Documentado:** Documentacion antes de desarrollo
|
- **Documentado:** Documentacion antes de desarrollo
|
||||||
|
- **SaaS-Ready:** Billing, suscripciones y feature flags incluidos
|
||||||
|
- **IA-First:** Chatbot inteligente con MCP Server y RAG
|
||||||
|
- **Mobile-First:** Apps nativas por perfil con biometricos
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -92,23 +101,49 @@ ERP Core provee esta funcionalidad comun de forma:
|
|||||||
|
|
||||||
## Modulos Core (MGN-*)
|
## Modulos Core (MGN-*)
|
||||||
|
|
||||||
| Codigo | Modulo | Descripcion | Prioridad | Estado |
|
### Fase Foundation (P0) - Modulos Base
|
||||||
|--------|--------|-------------|-----------|--------|
|
|
||||||
| MGN-001 | auth | Autenticacion JWT, OAuth, sessions | P0 | En desarrollo |
|
| Codigo | Modulo | Descripcion | Estado |
|
||||||
| MGN-002 | users | Gestion de usuarios CRUD | P0 | En desarrollo |
|
|--------|--------|-------------|--------|
|
||||||
| MGN-003 | roles | Roles y permisos (RBAC) | P0 | Planificado |
|
| MGN-001 | auth | Autenticacion JWT, OAuth, sessions, MFA | En desarrollo |
|
||||||
| MGN-004 | tenants | Multi-tenancy, aislamiento | P0 | Planificado |
|
| MGN-002 | users | Gestion de usuarios CRUD, perfiles | En desarrollo |
|
||||||
| MGN-005 | catalogs | Catalogos maestros genericos | P1 | Planificado |
|
| MGN-003 | roles | Roles y permisos (RBAC), feature flags | Planificado |
|
||||||
| MGN-006 | settings | Configuracion del sistema | P1 | Planificado |
|
| MGN-004 | tenants | Multi-tenancy, aislamiento RLS | Planificado |
|
||||||
| MGN-007 | audit | Auditoria y logs | P1 | Planificado |
|
|
||||||
| MGN-008 | notifications | Sistema de notificaciones | P2 | Planificado |
|
### Fase Core Business (P1) - Modulos de Negocio
|
||||||
| MGN-009 | reports | Reportes genericos | P2 | Planificado |
|
|
||||||
| MGN-010 | financial | Contabilidad basica | P1 | Planificado |
|
| Codigo | Modulo | Descripcion | Estado |
|
||||||
| MGN-011 | inventory | Inventario basico | P1 | Planificado |
|
|--------|--------|-------------|--------|
|
||||||
| MGN-012 | purchasing | Compras basicas | P1 | Planificado |
|
| MGN-005 | catalogs | Catalogos maestros genericos | Planificado |
|
||||||
| MGN-013 | sales | Ventas basicas | P1 | Planificado |
|
| MGN-006 | settings | Configuracion del sistema | Planificado |
|
||||||
| MGN-014 | crm | CRM basico | P2 | Planificado |
|
| MGN-007 | audit | Auditoria y logs | Planificado |
|
||||||
| MGN-015 | projects | Proyectos genericos | P2 | Planificado |
|
| MGN-008 | notifications | Sistema de notificaciones (email, push, in-app) | Planificado |
|
||||||
|
| MGN-009 | reports | Reportes genericos y dashboards | Planificado |
|
||||||
|
| MGN-010 | financial | Contabilidad basica, asientos | Planificado |
|
||||||
|
| MGN-011 | inventory | Inventario basico, stock | Planificado |
|
||||||
|
| MGN-012 | purchasing | Compras basicas, ordenes | Planificado |
|
||||||
|
| MGN-013 | sales | Ventas basicas, facturacion | Planificado |
|
||||||
|
| MGN-014 | crm | CRM basico, leads, oportunidades | Planificado |
|
||||||
|
| MGN-015 | projects | Proyectos genericos, tareas | Planificado |
|
||||||
|
|
||||||
|
### Fase SaaS Platform (P2) - Monetizacion e Integraciones
|
||||||
|
|
||||||
|
| Codigo | Modulo | Descripcion | Estado |
|
||||||
|
|--------|--------|-------------|--------|
|
||||||
|
| MGN-016 | billing | Suscripciones SaaS, per-seat pricing, cupones | Backlog |
|
||||||
|
| MGN-017 | payments | Stripe + terminales (MercadoPago, Clip) | Backlog |
|
||||||
|
| MGN-018 | whatsapp | WhatsApp Business Cloud API, chatbots | Backlog |
|
||||||
|
| MGN-019 | ai-agents | MCP Server, RAG, pgvector, knowledge bases | Backlog |
|
||||||
|
| MGN-020 | onboarding | Wizard de onboarding, setup inicial | Backlog |
|
||||||
|
| MGN-021 | ai-tokens | Sistema de tokens IA, paquetes, consumo | Backlog |
|
||||||
|
|
||||||
|
### Fase Mobile (P3) - Aplicaciones Moviles
|
||||||
|
|
||||||
|
| Codigo | Modulo | Descripcion | Estado |
|
||||||
|
|--------|--------|-------------|--------|
|
||||||
|
| MGN-022 | mobile-core | Core React Native: auth, sync, biometrics | Backlog |
|
||||||
|
| MGN-023 | time-attendance | Checador biometrico + GPS, entradas/salidas | Backlog |
|
||||||
|
| MGN-024 | worker-profiles | Perfiles de trabajador, modulos por rol | Backlog |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -144,6 +179,275 @@ ERP Core provee esta funcionalidad comun de forma:
|
|||||||
| RLS | - | Row-Level Security |
|
| RLS | - | Row-Level Security |
|
||||||
| uuid-ossp | - | Generacion UUIDs |
|
| uuid-ossp | - | Generacion UUIDs |
|
||||||
| pg_trgm | - | Busqueda fuzzy |
|
| pg_trgm | - | Busqueda fuzzy |
|
||||||
|
| pgvector | 0.5+ | Embeddings para IA |
|
||||||
|
|
||||||
|
### Mobile
|
||||||
|
| Tecnologia | Version | Proposito |
|
||||||
|
|------------|---------|-----------|
|
||||||
|
| React Native | 0.73+ | Framework mobile |
|
||||||
|
| Expo | 50+ | Build y deployment |
|
||||||
|
| WatermelonDB | 0.27+ | SQLite offline |
|
||||||
|
| react-native-biometrics | 3.x | Huella y Face ID |
|
||||||
|
| react-native-camera | 4.x | Fotos geolocalizadas |
|
||||||
|
|
||||||
|
### Integraciones
|
||||||
|
| Tecnologia | Proposito |
|
||||||
|
|------------|-----------|
|
||||||
|
| Stripe | Suscripciones y pagos online |
|
||||||
|
| MercadoPago | Terminales POS fisicas |
|
||||||
|
| Clip | Terminales POS alternativas |
|
||||||
|
| WhatsApp Cloud API | Mensajeria y chatbot |
|
||||||
|
| OpenRouter/OpenAI | LLM para chatbot IA |
|
||||||
|
| Firebase | Push notifications |
|
||||||
|
| AWS Rekognition | Reconocimiento facial |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Plataforma SaaS
|
||||||
|
|
||||||
|
### Modelo de Monetizacion
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ MODELO PER-SEAT │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ Plan Starter │ $99 USD/mes │ 5 usuarios │ Core │
|
||||||
|
│ Plan Growth │ $249 USD/mes │ 25 usuarios │ + Reports │
|
||||||
|
│ Plan Enterprise │ Custom │ Ilimitados │ + IA + WA │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ Usuario extra: $12-15 USD/mes segun plan │
|
||||||
|
│ Tokens IA: Paquetes recargables ($29-299) │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Feature Flags por Plan
|
||||||
|
|
||||||
|
| Feature | Starter | Growth | Enterprise |
|
||||||
|
|---------|---------|--------|------------|
|
||||||
|
| Modulos Core (Auth, Users, Tenants) | ✅ | ✅ | ✅ |
|
||||||
|
| Catalogs, Inventory, Sales | ✅ | ✅ | ✅ |
|
||||||
|
| Reports Avanzados | ❌ | ✅ | ✅ |
|
||||||
|
| CRM Completo | ❌ | ✅ | ✅ |
|
||||||
|
| WhatsApp Business | ❌ | ❌ | ✅ |
|
||||||
|
| Chatbot IA | ❌ | ❌ | ✅ |
|
||||||
|
| Apps Moviles | ❌ | ✅ | ✅ |
|
||||||
|
| Checador Biometrico | ❌ | ✅ | ✅ |
|
||||||
|
| Soporte Prioritario | ❌ | ❌ | ✅ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Integraciones de Pago
|
||||||
|
|
||||||
|
### Arquitectura de Pagos
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ PAYMENT GATEWAY │
|
||||||
|
├────────────────────┬────────────────────┬───────────────────┤
|
||||||
|
│ STRIPE │ MERCADOPAGO │ CLIP │
|
||||||
|
│ (Suscripciones) │ (Terminal POS) │ (Terminal POS) │
|
||||||
|
├────────────────────┴────────────────────┴───────────────────┤
|
||||||
|
│ - OAuth 2.0 │ - OAuth 2.0 │ - API Keys │
|
||||||
|
│ - Webhooks │ - Webhooks │ - Polling │
|
||||||
|
│ - Customer Portal │ - Terminales │ - Terminales │
|
||||||
|
│ - Invoicing │ - QR Payments │ - Refunds │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Casos de Uso
|
||||||
|
|
||||||
|
1. **Cobro de Suscripcion SaaS:** Stripe (tarjeta guardada, recurrente)
|
||||||
|
2. **Cobro en Punto de Venta:** MercadoPago/Clip (terminal fisica)
|
||||||
|
3. **Cobro a Cliente Final:** Link de pago (MercadoPago)
|
||||||
|
4. **Reembolsos:** Parciales o totales por cualquier proveedor
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Chatbot IA (Arquitectura MCP)
|
||||||
|
|
||||||
|
### Modelo MCP Server (Model Context Protocol)
|
||||||
|
|
||||||
|
Basado en el patron de michangarrito, implementamos un chatbot agnostico a proveedores de LLM:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ CANALES DE ENTRADA │
|
||||||
|
│ WhatsApp │ Chat Web │ App Movil │
|
||||||
|
└─────────┬────────────────┬────────────────┬─────────────────┘
|
||||||
|
│ │ │
|
||||||
|
└────────────────┼────────────────┘
|
||||||
|
│
|
||||||
|
┌──────▼──────┐
|
||||||
|
│ MCP SERVER │
|
||||||
|
│ (Gateway) │
|
||||||
|
└──────┬──────┘
|
||||||
|
│
|
||||||
|
┌─────────────────┼─────────────────┐
|
||||||
|
│ │ │
|
||||||
|
┌────▼────┐ ┌─────▼─────┐ ┌────▼────┐
|
||||||
|
│OpenRouter│ │ Anthropic │ │ Ollama │
|
||||||
|
│(Default) │ │ (Claude) │ │ (Local) │
|
||||||
|
└─────────┘ └───────────┘ └─────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Componentes del MCP Server
|
||||||
|
|
||||||
|
| Componente | Proposito |
|
||||||
|
|------------|-----------|
|
||||||
|
| **Providers** | Adaptadores para OpenRouter, OpenAI, Anthropic, Ollama |
|
||||||
|
| **Tools** | Funciones que el LLM puede invocar (ventas, inventario, etc.) |
|
||||||
|
| **Prompts** | System prompts por rol (admin, vendedor, cliente) |
|
||||||
|
| **RAG Service** | Busqueda en knowledge bases con pgvector |
|
||||||
|
| **Token Counter** | Tracking de consumo de tokens por usuario |
|
||||||
|
|
||||||
|
### Tools Disponibles para el LLM
|
||||||
|
|
||||||
|
| Tool | Modulo | Descripcion |
|
||||||
|
|------|--------|-------------|
|
||||||
|
| `get_sales_summary` | Sales | Resumen de ventas por periodo |
|
||||||
|
| `check_inventory` | Inventory | Consulta de stock |
|
||||||
|
| `get_customer_info` | CRM | Informacion de cliente |
|
||||||
|
| `create_order` | Sales | Crear orden de venta |
|
||||||
|
| `get_pending_invoices` | Financial | Facturas pendientes |
|
||||||
|
| `schedule_appointment` | CRM | Agendar cita |
|
||||||
|
| `generate_report` | Reports | Generar reporte |
|
||||||
|
|
||||||
|
### Sistema de Tokens IA
|
||||||
|
|
||||||
|
```
|
||||||
|
Consumo por operacion:
|
||||||
|
- Consulta simple: ~500 tokens
|
||||||
|
- Consulta con RAG: ~1,500 tokens
|
||||||
|
- Generacion de reporte: ~3,000 tokens
|
||||||
|
|
||||||
|
Paquetes recargables:
|
||||||
|
- Basico: $29 → 1,000 tokens
|
||||||
|
- Plus: $69 → 3,000 tokens
|
||||||
|
- Pro: $149 → 8,000 tokens
|
||||||
|
- Enterprise: $299 → 20,000 tokens
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Apps Moviles por Perfil
|
||||||
|
|
||||||
|
### Arquitectura Mobile
|
||||||
|
|
||||||
|
```
|
||||||
|
apps/mobile/
|
||||||
|
├── packages/
|
||||||
|
│ ├── core/ # Auth, API, Storage compartido
|
||||||
|
│ ├── biometrics/ # Facial, Fingerprint
|
||||||
|
│ ├── camera/ # Fotos geolocalizadas
|
||||||
|
│ ├── sync/ # Sincronizacion offline
|
||||||
|
│ ├── location/ # GPS tracking
|
||||||
|
│ └── ui/ # Componentes compartidos
|
||||||
|
├── apps/
|
||||||
|
│ ├── admin/ # App Administrador
|
||||||
|
│ ├── worker/ # App Trabajador (generica)
|
||||||
|
│ ├── warehouse/ # App Almacenista
|
||||||
|
│ ├── sales/ # App Vendedor
|
||||||
|
│ ├── field/ # App Campo (instaladores, tecnicos)
|
||||||
|
│ └── customer/ # App Cliente Portal
|
||||||
|
└── package.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### Perfiles de Trabajador y Modulos
|
||||||
|
|
||||||
|
| Perfil | Modulos Disponibles | Biometrico |
|
||||||
|
|--------|---------------------|------------|
|
||||||
|
| **Administrador** | Todos los modulos | Opcional |
|
||||||
|
| **Gerente** | Reports, Sales, Inventory, HR | Opcional |
|
||||||
|
| **Vendedor** | POS, Inventory, CRM, Quotes | Opcional |
|
||||||
|
| **Almacenista** | Inventory, Purchases, Transfers | Requerido |
|
||||||
|
| **Operador** | Production, Quality, Orders | Requerido |
|
||||||
|
| **Tecnico/Instalador** | Work Orders, Photos, Signatures | Requerido |
|
||||||
|
| **Cliente** | Portal, Orders, Documents | Opcional |
|
||||||
|
|
||||||
|
### Caracteristicas por App
|
||||||
|
|
||||||
|
| Caracteristica | Admin | Worker | Warehouse | Field |
|
||||||
|
|----------------|-------|--------|-----------|-------|
|
||||||
|
| Login JWT | ✅ | ✅ | ✅ | ✅ |
|
||||||
|
| Check-in/out Biometrico | ❌ | ✅ | ✅ | ✅ |
|
||||||
|
| Geolocalizacion | ❌ | ✅ | ❌ | ✅ |
|
||||||
|
| Modo Offline | ✅ | ✅ | ✅ | ✅ |
|
||||||
|
| Fotos con GPS | ❌ | ❌ | ✅ | ✅ |
|
||||||
|
| Push Notifications | ✅ | ✅ | ✅ | ✅ |
|
||||||
|
| Dashboard | ✅ | ❌ | ❌ | ❌ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sistema de Checador (Time & Attendance)
|
||||||
|
|
||||||
|
### Funcionalidades del Checador
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ CHECADOR BIOMETRICO │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ ┌─────────────────┐ ┌─────────────────┐ │
|
||||||
|
│ │ Reconocimiento │ │ Huella │ │
|
||||||
|
│ │ Facial │ │ Dactilar │ │
|
||||||
|
│ │ (Liveness) │ │ (Nativo) │ │
|
||||||
|
│ └────────┬────────┘ └────────┬────────┘ │
|
||||||
|
│ │ │ │
|
||||||
|
│ └──────────┬───────────┘ │
|
||||||
|
│ │ │
|
||||||
|
│ ┌───────▼───────┐ │
|
||||||
|
│ │ Validacion │ │
|
||||||
|
│ │ de Ubicacion │ │
|
||||||
|
│ │ (Geocerca) │ │
|
||||||
|
│ └───────┬───────┘ │
|
||||||
|
│ │ │
|
||||||
|
│ ┌───────▼───────┐ │
|
||||||
|
│ │ Registro de │ │
|
||||||
|
│ │ Entrada/Salida│ │
|
||||||
|
│ └───────────────┘ │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reglas de Negocio del Checador
|
||||||
|
|
||||||
|
1. **Validacion Biometrica:**
|
||||||
|
- Reconocimiento facial con liveness detection (anti-spoofing)
|
||||||
|
- Huella dactilar nativa del dispositivo
|
||||||
|
- Fallback a PIN si biometrico falla
|
||||||
|
|
||||||
|
2. **Validacion de Ubicacion:**
|
||||||
|
- Geocercas configurables por ubicacion de trabajo
|
||||||
|
- Radio de tolerancia configurable (50-500m)
|
||||||
|
- Registro de coordenadas GPS en cada check
|
||||||
|
|
||||||
|
3. **Tipos de Registro:**
|
||||||
|
- Check-in (entrada)
|
||||||
|
- Check-out (salida)
|
||||||
|
- Break start/end (descansos)
|
||||||
|
- Overtime start/end (horas extra)
|
||||||
|
|
||||||
|
4. **Reportes:**
|
||||||
|
- Asistencia diaria/semanal/mensual
|
||||||
|
- Retardos y faltas
|
||||||
|
- Horas trabajadas vs esperadas
|
||||||
|
- Incidencias (check fuera de geocerca)
|
||||||
|
|
||||||
|
### Flujo de Check-in
|
||||||
|
|
||||||
|
```
|
||||||
|
1. Usuario abre app mobile
|
||||||
|
2. App verifica si esta en geocerca permitida
|
||||||
|
3. Si OK, solicita biometrico (facial o huella)
|
||||||
|
4. Valida identidad con liveness detection
|
||||||
|
5. Registra entrada con:
|
||||||
|
- user_id
|
||||||
|
- timestamp
|
||||||
|
- coordenadas GPS
|
||||||
|
- tipo de check (in/out)
|
||||||
|
- metodo biometrico usado
|
||||||
|
- foto (opcional)
|
||||||
|
6. Sincroniza con backend
|
||||||
|
7. Muestra confirmacion al usuario
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -168,28 +472,40 @@ Un lugar para cada dato. Sincronizacion automatica.
|
|||||||
|
|
||||||
## Entregables por Fase
|
## Entregables por Fase
|
||||||
|
|
||||||
### Fase 1: Foundation (Actual)
|
### Fase 1: Foundation (En Progreso)
|
||||||
- [ ] MGN-001 Auth completo
|
- [ ] MGN-001 Auth completo (JWT, OAuth, MFA)
|
||||||
- [ ] MGN-002 Users completo
|
- [ ] MGN-002 Users completo (CRUD, perfiles)
|
||||||
- [ ] MGN-003 Roles completo
|
- [ ] MGN-003 Roles completo (RBAC, feature flags)
|
||||||
- [ ] MGN-004 Tenants completo
|
- [ ] MGN-004 Tenants completo (RLS, aislamiento)
|
||||||
- [ ] Documentacion de todos los modulos
|
- [ ] Documentacion de todos los modulos
|
||||||
|
|
||||||
### Fase 2: Core Business
|
### Fase 2: Core Business
|
||||||
- [ ] MGN-005 Catalogs
|
- [ ] MGN-005 Catalogs
|
||||||
- [ ] MGN-010 Financial basico
|
|
||||||
- [ ] MGN-011 Inventory
|
|
||||||
- [ ] MGN-012 Purchasing
|
|
||||||
- [ ] MGN-013 Sales
|
|
||||||
|
|
||||||
### Fase 3: Extended
|
|
||||||
- [ ] MGN-006 Settings
|
- [ ] MGN-006 Settings
|
||||||
- [ ] MGN-007 Audit
|
- [ ] MGN-007 Audit
|
||||||
- [ ] MGN-008 Notifications
|
- [ ] MGN-008 Notifications
|
||||||
- [ ] MGN-009 Reports
|
- [ ] MGN-009 Reports
|
||||||
|
- [ ] MGN-010 Financial basico
|
||||||
|
- [ ] MGN-011 Inventory
|
||||||
|
- [ ] MGN-012 Purchasing
|
||||||
|
- [ ] MGN-013 Sales
|
||||||
- [ ] MGN-014 CRM
|
- [ ] MGN-014 CRM
|
||||||
- [ ] MGN-015 Projects
|
- [ ] MGN-015 Projects
|
||||||
|
|
||||||
|
### Fase 3: SaaS Platform
|
||||||
|
- [ ] MGN-016 Billing (suscripciones per-seat)
|
||||||
|
- [ ] MGN-017 Payments (Stripe + MercadoPago + Clip)
|
||||||
|
- [ ] MGN-018 WhatsApp Business
|
||||||
|
- [ ] MGN-019 AI Agents (MCP Server + RAG)
|
||||||
|
- [ ] MGN-020 Onboarding
|
||||||
|
- [ ] MGN-021 AI Tokens
|
||||||
|
|
||||||
|
### Fase 4: Mobile Platform
|
||||||
|
- [ ] MGN-022 Mobile Core (React Native base)
|
||||||
|
- [ ] MGN-023 Time & Attendance (Checador)
|
||||||
|
- [ ] MGN-024 Worker Profiles (perfiles por rol)
|
||||||
|
- [ ] Apps por vertical (Construccion, Vidrio, Retail, etc.)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Referencias
|
## Referencias
|
||||||
@ -199,7 +515,7 @@ Un lugar para cada dato. Sincronizacion automatica.
|
|||||||
| Directivas | `orchestration/directivas/` |
|
| Directivas | `orchestration/directivas/` |
|
||||||
| Patrones Odoo | `orchestration/directivas/DIRECTIVA-PATRONES-ODOO.md` |
|
| Patrones Odoo | `orchestration/directivas/DIRECTIVA-PATRONES-ODOO.md` |
|
||||||
| Templates | `orchestration/templates/` |
|
| Templates | `orchestration/templates/` |
|
||||||
| Catálogo central | `core/catalog/` *(patrones reutilizables)* |
|
| Catálogo central | `shared/catalog/` *(patrones reutilizables)* |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -211,7 +527,22 @@ Un lugar para cada dato. Sincronizacion automatica.
|
|||||||
| Documentacion | 100% antes de desarrollo |
|
| Documentacion | 100% antes de desarrollo |
|
||||||
| Reutilizacion en verticales | >60% |
|
| Reutilizacion en verticales | >60% |
|
||||||
| Tiempo de setup nueva vertical | <1 semana |
|
| Tiempo de setup nueva vertical | <1 semana |
|
||||||
|
| MRR por tenant (promedio) | $150-300 USD |
|
||||||
|
| Churn rate mensual | <5% |
|
||||||
|
| NPS de usuarios | >40 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Ultima actualizacion: Diciembre 2025*
|
## Resumen de Modulos
|
||||||
|
|
||||||
|
| Fase | Modulos | Story Points Est. | Estado |
|
||||||
|
|------|---------|-------------------|--------|
|
||||||
|
| Foundation | MGN-001 a MGN-004 | 205 SP | En progreso |
|
||||||
|
| Core Business | MGN-005 a MGN-015 | 192 SP | Planificado |
|
||||||
|
| SaaS Platform | MGN-016 a MGN-021 | 230 SP | Backlog |
|
||||||
|
| Mobile Platform | MGN-022 a MGN-024 + Apps | 150 SP | Backlog |
|
||||||
|
| **Total** | **24 modulos** | **~777 SP** | - |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Ultima actualizacion: Enero 2026*
|
||||||
|
|||||||
@ -347,7 +347,7 @@ import { validateLoginDto } from '@modules/auth/dtos/login.dto';
|
|||||||
"@config/*": ["config/*"],
|
"@config/*": ["config/*"],
|
||||||
"@database/*": ["database/*"],
|
"@database/*": ["database/*"],
|
||||||
"@modules/*": ["modules/*"],
|
"@modules/*": ["modules/*"],
|
||||||
"@core/*": ["modules/core/*"],
|
"@shared/*": ["modules/core/*"],
|
||||||
"@accounting/*": ["modules/accounting/*"],
|
"@accounting/*": ["modules/accounting/*"],
|
||||||
"@budgets/*": ["modules/budgets/*"],
|
"@budgets/*": ["modules/budgets/*"],
|
||||||
"@purchasing/*": ["modules/purchasing/*"]
|
"@purchasing/*": ["modules/purchasing/*"]
|
||||||
|
|||||||
@ -77,7 +77,7 @@ import {
|
|||||||
Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany,
|
Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany,
|
||||||
JoinColumn, CreateDateColumn, UpdateDateColumn, Index
|
JoinColumn, CreateDateColumn, UpdateDateColumn, Index
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { TenantEntity } from '@core/entities/tenant.entity';
|
import { TenantEntity } from '@shared/entities/tenant.entity';
|
||||||
import { Country } from './country.entity';
|
import { Country } from './country.entity';
|
||||||
import { State } from './state.entity';
|
import { State } from './state.entity';
|
||||||
import { Currency } from './currency.entity';
|
import { Currency } from './currency.entity';
|
||||||
@ -286,7 +286,7 @@ import {
|
|||||||
Entity, PrimaryGeneratedColumn, Column, ManyToOne,
|
Entity, PrimaryGeneratedColumn, Column, ManyToOne,
|
||||||
JoinColumn, CreateDateColumn, UpdateDateColumn
|
JoinColumn, CreateDateColumn, UpdateDateColumn
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { TenantEntity } from '@core/entities/tenant.entity';
|
import { TenantEntity } from '@shared/entities/tenant.entity';
|
||||||
import { UomCategory } from './uom-category.entity';
|
import { UomCategory } from './uom-category.entity';
|
||||||
|
|
||||||
export enum UomType {
|
export enum UomType {
|
||||||
@ -465,7 +465,7 @@ export class CreateContactDto {
|
|||||||
// dto/contacts/contact-query.dto.ts
|
// dto/contacts/contact-query.dto.ts
|
||||||
import { IsOptional, IsEnum, IsString, IsBoolean, IsArray } from 'class-validator';
|
import { IsOptional, IsEnum, IsString, IsBoolean, IsArray } from 'class-validator';
|
||||||
import { Transform, Type } from 'class-transformer';
|
import { Transform, Type } from 'class-transformer';
|
||||||
import { PaginationDto } from '@core/dto/pagination.dto';
|
import { PaginationDto } from '@shared/dto/pagination.dto';
|
||||||
import { ContactType, ContactRole } from '../entities/contact.entity';
|
import { ContactType, ContactRole } from '../entities/contact.entity';
|
||||||
|
|
||||||
export class ContactQueryDto extends PaginationDto {
|
export class ContactQueryDto extends PaginationDto {
|
||||||
@ -522,8 +522,8 @@ import { ContactTag } from '../entities/contact-tag.entity';
|
|||||||
import { CreateContactDto } from '../dto/contacts/create-contact.dto';
|
import { CreateContactDto } from '../dto/contacts/create-contact.dto';
|
||||||
import { UpdateContactDto } from '../dto/contacts/update-contact.dto';
|
import { UpdateContactDto } from '../dto/contacts/update-contact.dto';
|
||||||
import { ContactQueryDto } from '../dto/contacts/contact-query.dto';
|
import { ContactQueryDto } from '../dto/contacts/contact-query.dto';
|
||||||
import { TenantContext } from '@core/decorators/tenant.decorator';
|
import { TenantContext } from '@shared/decorators/tenant.decorator';
|
||||||
import { PaginatedResult } from '@core/interfaces/pagination.interface';
|
import { PaginatedResult } from '@shared/interfaces/pagination.interface';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ContactsService {
|
export class ContactsService {
|
||||||
@ -764,7 +764,7 @@ import { Repository, LessThanOrEqual } from 'typeorm';
|
|||||||
import { CurrencyRate } from '../entities/currency-rate.entity';
|
import { CurrencyRate } from '../entities/currency-rate.entity';
|
||||||
import { Currency } from '../entities/currency.entity';
|
import { Currency } from '../entities/currency.entity';
|
||||||
import { CreateRateDto } from '../dto/currencies/create-rate.dto';
|
import { CreateRateDto } from '../dto/currencies/create-rate.dto';
|
||||||
import { TenantContext } from '@core/decorators/tenant.decorator';
|
import { TenantContext } from '@shared/decorators/tenant.decorator';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CurrencyRatesService {
|
export class CurrencyRatesService {
|
||||||
@ -876,7 +876,7 @@ import { Repository } from 'typeorm';
|
|||||||
import { Uom, UomType } from '../entities/uom.entity';
|
import { Uom, UomType } from '../entities/uom.entity';
|
||||||
import { UomCategory } from '../entities/uom-category.entity';
|
import { UomCategory } from '../entities/uom-category.entity';
|
||||||
import { CreateUomDto } from '../dto/uom/create-uom.dto';
|
import { CreateUomDto } from '../dto/uom/create-uom.dto';
|
||||||
import { TenantContext } from '@core/decorators/tenant.decorator';
|
import { TenantContext } from '@shared/decorators/tenant.decorator';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UomService {
|
export class UomService {
|
||||||
@ -1003,7 +1003,7 @@ import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
|||||||
import { JwtAuthGuard } from '@modules/auth/guards/jwt-auth.guard';
|
import { JwtAuthGuard } from '@modules/auth/guards/jwt-auth.guard';
|
||||||
import { RbacGuard } from '@modules/rbac/guards/rbac.guard';
|
import { RbacGuard } from '@modules/rbac/guards/rbac.guard';
|
||||||
import { Permissions } from '@modules/rbac/decorators/permissions.decorator';
|
import { Permissions } from '@modules/rbac/decorators/permissions.decorator';
|
||||||
import { TenantId } from '@core/decorators/tenant.decorator';
|
import { TenantId } from '@shared/decorators/tenant.decorator';
|
||||||
import { ContactsService } from '../services/contacts.service';
|
import { ContactsService } from '../services/contacts.service';
|
||||||
import { CreateContactDto } from '../dto/contacts/create-contact.dto';
|
import { CreateContactDto } from '../dto/contacts/create-contact.dto';
|
||||||
import { UpdateContactDto } from '../dto/contacts/update-contact.dto';
|
import { UpdateContactDto } from '../dto/contacts/update-contact.dto';
|
||||||
@ -1104,7 +1104,7 @@ import {
|
|||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { JwtAuthGuard } from '@modules/auth/guards/jwt-auth.guard';
|
import { JwtAuthGuard } from '@modules/auth/guards/jwt-auth.guard';
|
||||||
import { TenantId } from '@core/decorators/tenant.decorator';
|
import { TenantId } from '@shared/decorators/tenant.decorator';
|
||||||
import { CurrenciesService } from '../services/currencies.service';
|
import { CurrenciesService } from '../services/currencies.service';
|
||||||
import { CurrencyRatesService } from '../services/currency-rates.service';
|
import { CurrencyRatesService } from '../services/currency-rates.service';
|
||||||
import { CreateRateDto } from '../dto/currencies/create-rate.dto';
|
import { CreateRateDto } from '../dto/currencies/create-rate.dto';
|
||||||
|
|||||||
@ -283,7 +283,7 @@ import { create } from 'zustand';
|
|||||||
import { devtools } from 'zustand/middleware';
|
import { devtools } from 'zustand/middleware';
|
||||||
import { Contact, ContactFilters, CreateContactDto } from '../types/contact.types';
|
import { Contact, ContactFilters, CreateContactDto } from '../types/contact.types';
|
||||||
import { contactsService } from '../services/contacts.service';
|
import { contactsService } from '../services/contacts.service';
|
||||||
import { PaginatedResult } from '@core/types/pagination';
|
import { PaginatedResult } from '@shared/types/pagination';
|
||||||
|
|
||||||
interface ContactsState {
|
interface ContactsState {
|
||||||
// Data
|
// Data
|
||||||
|
|||||||
@ -303,7 +303,7 @@ CREATE TRIGGER trg_update_blocked_state
|
|||||||
```typescript
|
```typescript
|
||||||
// src/modules/projects/domain/entities/task-dependency.entity.ts
|
// src/modules/projects/domain/entities/task-dependency.entity.ts
|
||||||
|
|
||||||
import { Entity, AggregateRoot } from '@core/domain';
|
import { Entity, AggregateRoot } from '@shared/domain';
|
||||||
|
|
||||||
export enum DependencyType {
|
export enum DependencyType {
|
||||||
FINISH_TO_START = 'finish_to_start',
|
FINISH_TO_START = 'finish_to_start',
|
||||||
|
|||||||
@ -5,30 +5,175 @@
|
|||||||
| Campo | Valor |
|
| Campo | Valor |
|
||||||
|-------|-------|
|
|-------|-------|
|
||||||
| **ID** | EPIC-MGN-019 |
|
| **ID** | EPIC-MGN-019 |
|
||||||
| **Nombre** | AI Agents (RAG + Tools) |
|
| **Nombre** | AI Agents (MCP Server + RAG + Tools) |
|
||||||
| **Modulo** | ai-agents |
|
| **Modulo** | ai-agents |
|
||||||
| **Fase** | Fase 4 - SaaS Platform |
|
| **Fase** | Fase 4 - SaaS Platform |
|
||||||
| **Prioridad** | P3 |
|
| **Prioridad** | P2 |
|
||||||
| **Estado** | Backlog |
|
| **Estado** | Backlog |
|
||||||
| **Story Points** | 55 |
|
| **Story Points** | 68 |
|
||||||
| **Sprint(s)** | Sprint 26-30 |
|
| **Sprint(s)** | Sprint 26-30 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Descripcion
|
## Descripcion
|
||||||
|
|
||||||
Sistema de agentes inteligentes con RAG (Retrieval Augmented Generation) usando pgvector para embeddings. Permite crear agentes configurables por tenant, knowledge bases con documentos, definicion de tools/funciones, conversaciones con historial y ejecucion de tools en tiempo real.
|
Sistema de agentes inteligentes basado en **MCP Server (Model Context Protocol)** con RAG (Retrieval Augmented Generation) usando pgvector para embeddings. Implementa un gateway agnostico a proveedores de LLM (OpenRouter, OpenAI, Anthropic, Ollama) siguiendo el patron de michangarrito. Permite crear agentes configurables por tenant, knowledge bases con documentos, definicion de tools/funciones, conversaciones con historial y ejecucion de tools en tiempo real a traves de multiples canales (WhatsApp, Chat Web, App Movil).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Objetivo de Negocio
|
## Objetivo de Negocio
|
||||||
|
|
||||||
Proveer agentes AI que:
|
Proveer agentes AI que:
|
||||||
- Automaticen atencion al cliente
|
- Automaticen atencion al cliente via WhatsApp, chat web y app movil
|
||||||
- Respondan preguntas basadas en documentacion
|
- Respondan preguntas basadas en documentacion (RAG)
|
||||||
- Ejecuten acciones en el sistema
|
- Ejecuten acciones en el sistema (tools)
|
||||||
- Escalen soporte sin aumentar personal
|
- Escalen soporte sin aumentar personal
|
||||||
- Mejoren experiencia del usuario
|
- Mejoren experiencia del usuario
|
||||||
|
- Generen reportes y consultas de datos conversacionalmente
|
||||||
|
- Sean agnosticos al proveedor de LLM (OpenRouter, OpenAI, Anthropic, Ollama)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Arquitectura MCP Server (Model Context Protocol)
|
||||||
|
|
||||||
|
### Vision General
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ CANALES DE ENTRADA │
|
||||||
|
│ WhatsApp Cloud API │ Chat Web │ App Movil │
|
||||||
|
└────────────┬──────────────────┬──────────────┬──────────────┘
|
||||||
|
│ │ │
|
||||||
|
└──────────────────┼──────────────┘
|
||||||
|
│
|
||||||
|
┌──────▼──────┐
|
||||||
|
│ MCP SERVER │
|
||||||
|
│ Gateway │
|
||||||
|
└──────┬──────┘
|
||||||
|
│
|
||||||
|
┌─────────────────┼─────────────────┐
|
||||||
|
│ │ │
|
||||||
|
┌────▼────┐ ┌─────▼─────┐ ┌────▼────┐
|
||||||
|
│OpenRouter│ │ Anthropic │ │ Ollama │
|
||||||
|
│(Default) │ │ (Claude) │ │ (Local) │
|
||||||
|
└─────────┘ └───────────┘ └─────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Componentes del MCP Server
|
||||||
|
|
||||||
|
```
|
||||||
|
apps/backend/src/modules/mcp-server/
|
||||||
|
├── providers/ # Adaptadores LLM
|
||||||
|
│ ├── base.provider.ts # Interface comun
|
||||||
|
│ ├── openrouter.provider.ts # OpenRouter (default)
|
||||||
|
│ ├── openai.provider.ts # OpenAI directo
|
||||||
|
│ ├── anthropic.provider.ts # Anthropic Claude
|
||||||
|
│ └── ollama.provider.ts # Ollama local
|
||||||
|
│
|
||||||
|
├── tools/ # Herramientas disponibles
|
||||||
|
│ ├── sales.tools.ts # get_sales, create_order
|
||||||
|
│ ├── inventory.tools.ts # check_stock, get_alerts
|
||||||
|
│ ├── crm.tools.ts # get_customer, create_lead
|
||||||
|
│ ├── financial.tools.ts # get_invoices, get_balance
|
||||||
|
│ ├── reports.tools.ts # generate_report
|
||||||
|
│ └── hr.tools.ts # get_attendance, get_employee
|
||||||
|
│
|
||||||
|
├── prompts/ # System prompts por rol
|
||||||
|
│ ├── base.prompt.ts # Prompt base
|
||||||
|
│ ├── sales.prompt.ts # Vendedor
|
||||||
|
│ ├── manager.prompt.ts # Gerente
|
||||||
|
│ ├── support.prompt.ts # Soporte
|
||||||
|
│ └── customer.prompt.ts # Cliente externo
|
||||||
|
│
|
||||||
|
├── rag/ # Retrieval Augmented Generation
|
||||||
|
│ ├── embedding.service.ts # Generacion de embeddings
|
||||||
|
│ ├── chunker.service.ts # Particion de documentos
|
||||||
|
│ └── retriever.service.ts # Busqueda en pgvector
|
||||||
|
│
|
||||||
|
├── handlers/ # Procesamiento
|
||||||
|
│ ├── message.handler.ts # Procesa mensaje entrante
|
||||||
|
│ └── tool-call.handler.ts # Ejecuta tools invocadas
|
||||||
|
│
|
||||||
|
├── mcp.module.ts
|
||||||
|
└── mcp.service.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### Flujo de Procesamiento
|
||||||
|
|
||||||
|
```
|
||||||
|
1. MENSAJE ENTRANTE (WhatsApp/Chat/App)
|
||||||
|
"¿Cuanto vendimos esta semana?"
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
2. MESSAGE HANDLER
|
||||||
|
- Identifica tenant y usuario
|
||||||
|
- Carga historial de conversacion (Redis)
|
||||||
|
- Obtiene contexto del usuario (rol, permisos)
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
3. RAG SERVICE (si aplica)
|
||||||
|
- Genera embedding de la pregunta
|
||||||
|
- Busca chunks similares en pgvector
|
||||||
|
- Obtiene top K documentos relevantes
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
4. PROMPT BUILDER
|
||||||
|
- Selecciona system prompt por rol
|
||||||
|
- Inyecta contexto de RAG
|
||||||
|
- Inyecta historial de conversacion
|
||||||
|
- Lista tools disponibles segun permisos
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
5. LLM PROVIDER
|
||||||
|
- Envia al provider configurado (OpenRouter/OpenAI/etc)
|
||||||
|
- Recibe respuesta + tool_calls
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
6. TOOL CALL HANDLER (si hay tool_calls)
|
||||||
|
- Valida parametros
|
||||||
|
- Ejecuta tool contra Backend API
|
||||||
|
- Retorna resultado al LLM
|
||||||
|
- LLM genera respuesta final
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
7. RESPONSE
|
||||||
|
- Guarda en historial
|
||||||
|
- Registra consumo de tokens
|
||||||
|
- Envia respuesta al canal de origen
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tools Disponibles por Modulo
|
||||||
|
|
||||||
|
| Tool | Modulo | Parametros | Descripcion |
|
||||||
|
|------|--------|------------|-------------|
|
||||||
|
| `get_sales_summary` | Sales | periodo, filtros | Resumen de ventas |
|
||||||
|
| `get_top_products` | Sales | periodo, limit | Productos mas vendidos |
|
||||||
|
| `create_quote` | Sales | cliente, items | Crear cotizacion |
|
||||||
|
| `check_inventory` | Inventory | product_id, warehouse | Consultar stock |
|
||||||
|
| `get_stock_alerts` | Inventory | - | Productos con stock bajo |
|
||||||
|
| `get_customer_info` | CRM | customer_id | Info de cliente |
|
||||||
|
| `create_lead` | CRM | name, phone, source | Crear lead |
|
||||||
|
| `get_pending_invoices` | Financial | customer_id, days | Facturas vencidas |
|
||||||
|
| `get_balance` | Financial | account_id | Saldo de cuenta |
|
||||||
|
| `generate_report` | Reports | type, periodo | Generar reporte PDF |
|
||||||
|
| `get_attendance` | HR | employee_id, fecha | Asistencia de empleado |
|
||||||
|
| `schedule_meeting` | CRM | participants, datetime | Agendar reunion |
|
||||||
|
|
||||||
|
### Configuracion de Providers
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// .env configuration
|
||||||
|
LLM_PROVIDER=openrouter // openrouter | openai | anthropic | ollama
|
||||||
|
LLM_API_KEY=sk-xxx
|
||||||
|
LLM_MODEL=anthropic/claude-3-haiku // Modelo a usar
|
||||||
|
LLM_BASE_URL=https://openrouter.ai/api/v1
|
||||||
|
LLM_MAX_TOKENS=4096
|
||||||
|
LLM_TEMPERATURE=0.7
|
||||||
|
|
||||||
|
// Fallback chain
|
||||||
|
LLM_FALLBACK_PROVIDER=ollama // Si falla el principal
|
||||||
|
LLM_FALLBACK_MODEL=llama3
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -148,3 +293,5 @@ Proveer agentes AI que:
|
|||||||
|
|
||||||
**Creada por:** Requirements-Analyst
|
**Creada por:** Requirements-Analyst
|
||||||
**Fecha:** 2025-12-05
|
**Fecha:** 2025-12-05
|
||||||
|
**Actualizada por:** Orquestador
|
||||||
|
**Ultima actualizacion:** 2026-01-04 (Arquitectura MCP Server agregada)
|
||||||
|
|||||||
@ -1,23 +1,24 @@
|
|||||||
# EPICA: EPIC-MGN-019 - Apps Moviles por Perfil
|
# EPICA: EPIC-MGN-019B - Apps Moviles por Perfil
|
||||||
|
|
||||||
## Metadata
|
## Metadata
|
||||||
|
|
||||||
| Campo | Valor |
|
| Campo | Valor |
|
||||||
|-------|-------|
|
|-------|-------|
|
||||||
| **ID** | EPIC-MGN-019 |
|
| **ID** | EPIC-MGN-019B |
|
||||||
| **Nombre** | Apps Moviles por Perfil de Usuario |
|
| **Nombre** | Apps Moviles por Perfil de Usuario |
|
||||||
| **Modulo** | mobile |
|
| **Modulo** | mobile |
|
||||||
| **Fase** | Fase 5 - Mobile Platform |
|
| **Fase** | Fase 4 - Mobile Platform |
|
||||||
| **Prioridad** | P1 |
|
| **Prioridad** | P1 |
|
||||||
| **Estado** | Backlog |
|
| **Estado** | Backlog |
|
||||||
| **Story Points** | 89 |
|
| **Story Points** | 110 |
|
||||||
| **Sprint(s)** | Sprint 29-36 |
|
| **Sprint(s)** | Sprint 29-40 |
|
||||||
|
| **Relacionado** | MGN-022 (Mobile Core), MGN-023 (Time & Attendance), MGN-024 (Worker Profiles) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Descripcion
|
## Descripcion
|
||||||
|
|
||||||
Desarrollo de apps moviles React Native para diferentes perfiles de usuario en cada vertical. Incluye funcionalidades biometricas (reconocimiento facial, huella), modo offline, y sincronizacion con backend.
|
Desarrollo de apps moviles React Native para diferentes perfiles de usuario en cada vertical. Cada perfil de trabajador tiene acceso a modulos y herramientas especificos segun su rol. Incluye funcionalidades biometricas (reconocimiento facial, huella), modo offline con sincronizacion, checador integrado, y sistema de perfiles dinamicos que determina que modulos y herramientas estan disponibles para cada usuario.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -25,8 +26,97 @@ Desarrollo de apps moviles React Native para diferentes perfiles de usuario en c
|
|||||||
|
|
||||||
- Digitalizar operaciones en campo
|
- Digitalizar operaciones en campo
|
||||||
- Capturar datos en tiempo real
|
- Capturar datos en tiempo real
|
||||||
- Validar asistencia con biometricos
|
- Validar asistencia con biometricos (checador)
|
||||||
- Aumentar productividad de usuarios moviles
|
- Aumentar productividad de usuarios moviles
|
||||||
|
- Proporcionar herramientas especificas por perfil de trabajador
|
||||||
|
- Permitir trabajo offline con sincronizacion automatica
|
||||||
|
- Integrar chatbot IA para consultas rapidas
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sistema de Perfiles de Trabajador
|
||||||
|
|
||||||
|
### Arquitectura de Perfiles
|
||||||
|
|
||||||
|
Cada usuario tiene asignado uno o mas perfiles que determinan:
|
||||||
|
1. **Modulos accesibles:** Que secciones de la app puede ver
|
||||||
|
2. **Acciones permitidas:** Que operaciones puede realizar
|
||||||
|
3. **Biometrico requerido:** Si necesita validacion biometrica
|
||||||
|
4. **Checador integrado:** Si debe registrar entradas/salidas
|
||||||
|
5. **Geocerca:** Si esta restringido a ubicaciones especificas
|
||||||
|
|
||||||
|
### Perfiles Disponibles
|
||||||
|
|
||||||
|
| Perfil | Codigo | Modulos | Biometrico | Checador |
|
||||||
|
|--------|--------|---------|------------|----------|
|
||||||
|
| **Administrador** | ADMIN | Todos | Opcional | No |
|
||||||
|
| **Gerente** | MANAGER | Reports, Sales, Inventory, HR, CRM | Opcional | No |
|
||||||
|
| **Vendedor** | SALES | POS, Inventory, CRM, Quotes, Customers | Opcional | Configurable |
|
||||||
|
| **Almacenista** | WAREHOUSE | Inventory, Purchases, Transfers, Receiving | Requerido | Si |
|
||||||
|
| **Operador** | OPERATOR | Production, Quality, Work Orders | Requerido | Si |
|
||||||
|
| **Tecnico/Instalador** | FIELD | Work Orders, Photos, Signatures, GPS | Requerido | Si + GPS |
|
||||||
|
| **Repartidor** | DELIVERY | Deliveries, Routes, POD, GPS | Requerido | Si + GPS |
|
||||||
|
| **Cliente Portal** | CUSTOMER | Orders, Documents, Tickets, Payments | Opcional | No |
|
||||||
|
|
||||||
|
### Modulos por Perfil
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ MODULOS DISPONIBLES │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
||||||
|
│ │ CHECADOR │ │ POS │ │ INVENTARIO │ │
|
||||||
|
│ │ Check-in/out │ │ Punto venta │ │ Stock/Transf │ │
|
||||||
|
│ │ Biometrico │ │ Cobros │ │ Conteos │ │
|
||||||
|
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
||||||
|
│ │
|
||||||
|
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
||||||
|
│ │ ORDENES │ │ FOTOS │ │ REPORTES │ │
|
||||||
|
│ │ Work orders │ │ Geolocalizad │ │ Dashboards │ │
|
||||||
|
│ │ Asignaciones │ │ Evidencias │ │ KPIs │ │
|
||||||
|
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
||||||
|
│ │
|
||||||
|
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
||||||
|
│ │ CHATBOT │ │ ENTREGAS │ │ CLIENTES │ │
|
||||||
|
│ │ Asistente IA │ │ Rutas │ │ CRM basico │ │
|
||||||
|
│ │ Consultas │ │ POD/Firmas │ │ Historial │ │
|
||||||
|
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
||||||
|
│ │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuracion de Perfiles (Backend)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Ejemplo de configuracion de perfil
|
||||||
|
{
|
||||||
|
"code": "WAREHOUSE",
|
||||||
|
"name": "Almacenista",
|
||||||
|
"modules": [
|
||||||
|
{ "id": "checador", "required": true },
|
||||||
|
{ "id": "inventory", "required": true },
|
||||||
|
{ "id": "purchases", "required": false },
|
||||||
|
{ "id": "transfers", "required": true },
|
||||||
|
{ "id": "receiving", "required": true },
|
||||||
|
{ "id": "chatbot", "required": false }
|
||||||
|
],
|
||||||
|
"biometric": {
|
||||||
|
"required": true,
|
||||||
|
"methods": ["fingerprint", "facial"],
|
||||||
|
"fallback_pin": true
|
||||||
|
},
|
||||||
|
"attendance": {
|
||||||
|
"required": true,
|
||||||
|
"geofence_required": true,
|
||||||
|
"photo_required": false
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"inventory.view", "inventory.count", "inventory.transfer",
|
||||||
|
"purchases.receive", "checador.check_in", "checador.check_out"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -157,3 +247,5 @@ apps/mobile/
|
|||||||
|
|
||||||
**Creado por:** Requirements-Analyst
|
**Creado por:** Requirements-Analyst
|
||||||
**Fecha:** 2025-12-05
|
**Fecha:** 2025-12-05
|
||||||
|
**Actualizado por:** Orquestador
|
||||||
|
**Ultima actualizacion:** 2026-01-04 (Sistema de perfiles de trabajador detallado)
|
||||||
|
|||||||
@ -0,0 +1,355 @@
|
|||||||
|
# EPICA: EPIC-MGN-023 - Time & Attendance (Checador)
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
|
||||||
|
| Campo | Valor |
|
||||||
|
|-------|-------|
|
||||||
|
| **ID** | EPIC-MGN-023 |
|
||||||
|
| **Nombre** | Time & Attendance - Checador Biometrico con GPS |
|
||||||
|
| **Modulo** | time-attendance |
|
||||||
|
| **Fase** | Fase 4 - Mobile Platform |
|
||||||
|
| **Prioridad** | P1 |
|
||||||
|
| **Estado** | Backlog |
|
||||||
|
| **Story Points** | 55 |
|
||||||
|
| **Sprint(s)** | Sprint 37-40 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Descripcion
|
||||||
|
|
||||||
|
Sistema de control de asistencia (Time & Attendance) con validacion biometrica (reconocimiento facial y huella dactilar) y geolocalizacion. Permite registrar entradas, salidas, descansos y horas extra con validacion de ubicacion mediante geocercas configurables por sitio de trabajo.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Objetivo de Negocio
|
||||||
|
|
||||||
|
Proveer un sistema de checador que:
|
||||||
|
- Elimine el fraude en registro de asistencia (buddy punching)
|
||||||
|
- Valide que el trabajador este fisicamente en el sitio
|
||||||
|
- Automatice el calculo de horas trabajadas
|
||||||
|
- Genere reportes de asistencia en tiempo real
|
||||||
|
- Integre con nomina para calculo automatico
|
||||||
|
- Funcione offline con sincronizacion posterior
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Stakeholders
|
||||||
|
|
||||||
|
| Rol | Nombre/Equipo | Responsabilidad |
|
||||||
|
|-----|---------------|-----------------|
|
||||||
|
| Product Owner | Equipo Producto | Definicion de reglas de negocio |
|
||||||
|
| Tech Lead | Equipo Mobile | Arquitectura biometrica y GPS |
|
||||||
|
| RRHH | Recursos Humanos | Definicion de politicas de asistencia |
|
||||||
|
| Supervisor | Operaciones | Validacion de incidencias |
|
||||||
|
| Trabajador | Usuario final | Uso diario del checador |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Historias de Usuario
|
||||||
|
|
||||||
|
| ID | Historia | Prioridad | SP | Estado |
|
||||||
|
|----|----------|-----------|-----|--------|
|
||||||
|
| US-MGN023-001 | Como admin, quiero configurar geocercas por ubicacion de trabajo | P0 | 5 | Backlog |
|
||||||
|
| US-MGN023-002 | Como admin, quiero definir horarios de trabajo por empleado/grupo | P0 | 5 | Backlog |
|
||||||
|
| US-MGN023-003 | Como trabajador, quiero hacer check-in con reconocimiento facial | P0 | 8 | Backlog |
|
||||||
|
| US-MGN023-004 | Como trabajador, quiero hacer check-in con huella dactilar | P0 | 5 | Backlog |
|
||||||
|
| US-MGN023-005 | Como trabajador, quiero hacer check-out al terminar mi jornada | P0 | 3 | Backlog |
|
||||||
|
| US-MGN023-006 | Como trabajador, quiero registrar inicio/fin de descanso | P1 | 3 | Backlog |
|
||||||
|
| US-MGN023-007 | Como trabajador, quiero registrar horas extra | P1 | 3 | Backlog |
|
||||||
|
| US-MGN023-008 | Como supervisor, quiero ver asistencia en tiempo real de mi equipo | P0 | 5 | Backlog |
|
||||||
|
| US-MGN023-009 | Como supervisor, quiero aprobar/rechazar incidencias | P1 | 5 | Backlog |
|
||||||
|
| US-MGN023-010 | Como admin, quiero generar reportes de asistencia | P0 | 5 | Backlog |
|
||||||
|
| US-MGN023-011 | Como trabajador, quiero que mi check funcione sin internet | P0 | 8 | Backlog |
|
||||||
|
|
||||||
|
**Total Story Points:** 55 SP
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Criterios de Aceptacion de la Epica
|
||||||
|
|
||||||
|
**Funcionales:**
|
||||||
|
- [ ] Geocercas configurables (poligonos o circulos) por ubicacion
|
||||||
|
- [ ] Radio de tolerancia configurable (50-500m)
|
||||||
|
- [ ] Reconocimiento facial con liveness detection (anti-spoofing)
|
||||||
|
- [ ] Huella dactilar usando biometrico nativo del dispositivo
|
||||||
|
- [ ] Fallback a PIN si biometrico no disponible
|
||||||
|
- [ ] Registro de coordenadas GPS en cada check
|
||||||
|
- [ ] Foto opcional al momento del check
|
||||||
|
- [ ] Tipos de check: entrada, salida, descanso_inicio, descanso_fin, extra_inicio, extra_fin
|
||||||
|
- [ ] Calculo automatico de horas trabajadas
|
||||||
|
- [ ] Deteccion de retardos segun horario configurado
|
||||||
|
- [ ] Modo offline con sincronizacion al recuperar conexion
|
||||||
|
- [ ] Resolucion de conflictos de sincronizacion
|
||||||
|
|
||||||
|
**No Funcionales:**
|
||||||
|
- [ ] Tiempo de reconocimiento facial < 2 segundos
|
||||||
|
- [ ] Precision de GPS < 10 metros
|
||||||
|
- [ ] Almacenamiento offline de hasta 7 dias de checks
|
||||||
|
- [ ] Sincronizacion automatica en background
|
||||||
|
- [ ] Bateria: bajo consumo de GPS (sampling inteligente)
|
||||||
|
- [ ] Seguridad: datos biometricos nunca salen del dispositivo
|
||||||
|
|
||||||
|
**Tecnicos:**
|
||||||
|
- [ ] Cobertura de tests > 80%
|
||||||
|
- [ ] Integracion con AWS Rekognition o Azure Face
|
||||||
|
- [ ] Soporte Android 9+ e iOS 14+
|
||||||
|
- [ ] WatermelonDB para persistencia offline
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Arquitectura Tecnica
|
||||||
|
|
||||||
|
### Flujo de Check-in
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
|
│ FLUJO DE CHECK-IN │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ 1. Usuario abre app │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 2. Obtener ubicacion GPS │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 3. Validar geocerca ─────────────────┐ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ (Dentro) │ (Fuera) │
|
||||||
|
│ ▼ ▼ │
|
||||||
|
│ 4. Solicitar biometrico Mostrar error │
|
||||||
|
│ (Facial o Huella) "Fuera de ubicacion" │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 5. Validar identidad │
|
||||||
|
│ (Liveness detection) │
|
||||||
|
│ │ │
|
||||||
|
│ │ (OK) │
|
||||||
|
│ ▼ │
|
||||||
|
│ 6. Capturar foto (opcional) │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 7. Crear registro local │
|
||||||
|
│ (WatermelonDB) │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 8. Sincronizar con backend │
|
||||||
|
│ (si hay conexion) │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ │
|
||||||
|
│ 9. Mostrar confirmacion │
|
||||||
|
│ │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Modelo de Datos
|
||||||
|
|
||||||
|
```
|
||||||
|
┌────────────────────┐ ┌────────────────────┐
|
||||||
|
│ work_locations │ │ work_schedules │
|
||||||
|
├────────────────────┤ ├────────────────────┤
|
||||||
|
│ id │ │ id │
|
||||||
|
│ tenant_id │ │ tenant_id │
|
||||||
|
│ name │ │ name │
|
||||||
|
│ address │ │ work_location_id │
|
||||||
|
│ geofence_type │◄─────│ monday_start │
|
||||||
|
│ geofence_polygon │ │ monday_end │
|
||||||
|
│ geofence_radius │ │ tuesday_start... │
|
||||||
|
│ tolerance_meters │ │ break_duration_min │
|
||||||
|
│ is_active │ │ is_active │
|
||||||
|
└────────────────────┘ └────────────────────┘
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
▼ ▼
|
||||||
|
┌────────────────────────────────────────────────┐
|
||||||
|
│ time_attendance_records │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ id │
|
||||||
|
│ tenant_id │
|
||||||
|
│ user_id │
|
||||||
|
│ work_location_id │
|
||||||
|
│ work_schedule_id │
|
||||||
|
│ check_type (in/out/break_start/break_end/...) │
|
||||||
|
│ check_timestamp │
|
||||||
|
│ latitude │
|
||||||
|
│ longitude │
|
||||||
|
│ accuracy_meters │
|
||||||
|
│ biometric_method (facial/fingerprint/pin) │
|
||||||
|
│ photo_url │
|
||||||
|
│ device_id │
|
||||||
|
│ is_synced │
|
||||||
|
│ sync_timestamp │
|
||||||
|
│ is_valid │
|
||||||
|
│ validation_notes │
|
||||||
|
│ created_at │
|
||||||
|
└────────────────────────────────────────────────┘
|
||||||
|
│
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌────────────────────────────────────────────────┐
|
||||||
|
│ attendance_incidents │
|
||||||
|
├────────────────────────────────────────────────┤
|
||||||
|
│ id │
|
||||||
|
│ tenant_id │
|
||||||
|
│ user_id │
|
||||||
|
│ incident_date │
|
||||||
|
│ incident_type (late/early_leave/absent/...) │
|
||||||
|
│ expected_time │
|
||||||
|
│ actual_time │
|
||||||
|
│ difference_minutes │
|
||||||
|
│ status (pending/approved/rejected) │
|
||||||
|
│ supervisor_id │
|
||||||
|
│ supervisor_notes │
|
||||||
|
│ created_at │
|
||||||
|
└────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dependencias
|
||||||
|
|
||||||
|
**Esta epica depende de:**
|
||||||
|
| Epica/Modulo | Estado | Bloqueante |
|
||||||
|
|--------------|--------|------------|
|
||||||
|
| EPIC-MGN-001 Auth | Ready | Si |
|
||||||
|
| EPIC-MGN-002 Users | Ready | Si |
|
||||||
|
| EPIC-MGN-004 Tenants | Ready | Si |
|
||||||
|
| EPIC-MGN-022 Mobile Core | Backlog | Si |
|
||||||
|
| AWS Rekognition / Azure Face | External | Si |
|
||||||
|
| Google Maps / Mapbox | External | Si (geocercas) |
|
||||||
|
|
||||||
|
**Esta epica bloquea:**
|
||||||
|
| Epica/Modulo | Razon |
|
||||||
|
|--------------|-------|
|
||||||
|
| Integracion con Nomina | Calculo de horas trabajadas |
|
||||||
|
| HR Analytics | Metricas de asistencia |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Desglose Tecnico
|
||||||
|
|
||||||
|
**Database:**
|
||||||
|
- [ ] Schema: `hr`
|
||||||
|
- [ ] Tablas: 5 (work_locations, work_schedules, schedule_assignments, time_attendance_records, attendance_incidents)
|
||||||
|
- [ ] Funciones: calculate_worked_hours, detect_incidents
|
||||||
|
- [ ] Triggers: auto_create_incident (retardos, faltas)
|
||||||
|
- [ ] Indices: Por user_id, check_timestamp, work_location_id
|
||||||
|
- [ ] RLS Policies: Si (por tenant)
|
||||||
|
|
||||||
|
**Backend:**
|
||||||
|
- [ ] Modulo: `time-attendance`
|
||||||
|
- [ ] Services: AttendanceService, GeofenceService, IncidentService, ReportService
|
||||||
|
- [ ] Controllers: AttendanceController, LocationsController, SchedulesController, IncidentsController
|
||||||
|
- [ ] Endpoints: 20+ (check in/out, locations CRUD, schedules CRUD, incidents, reports)
|
||||||
|
- [ ] Jobs: DailyIncidentDetectorJob, AttendanceSummaryJob
|
||||||
|
- [ ] Tests: 40+
|
||||||
|
|
||||||
|
**Mobile (React Native):**
|
||||||
|
- [ ] Screens: 5 (CheckIn, CheckHistory, LocationMap, IncidentsList, Settings)
|
||||||
|
- [ ] Components: BiometricPrompt, GeofenceValidator, SyncIndicator, CheckConfirmation
|
||||||
|
- [ ] Hooks: useGeolocation, useBiometrics, useOfflineSync
|
||||||
|
- [ ] Storage: WatermelonDB schemas para offline
|
||||||
|
- [ ] Services: AttendanceSync, LocationTracker
|
||||||
|
|
||||||
|
**Frontend (Admin):**
|
||||||
|
- [ ] Paginas: 6 (Locations, Schedules, Attendance, Incidents, Reports, Settings)
|
||||||
|
- [ ] Componentes: GeofenceEditor, ScheduleCalendar, AttendanceTable, IncidentApproval
|
||||||
|
- [ ] Stores: 1 (attendanceStore)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Reportes
|
||||||
|
|
||||||
|
| Reporte | Descripcion | Frecuencia |
|
||||||
|
|---------|-------------|------------|
|
||||||
|
| Asistencia Diaria | Lista de checks por dia | Diario |
|
||||||
|
| Resumen Semanal | Horas trabajadas por empleado | Semanal |
|
||||||
|
| Incidencias Pendientes | Retardos/faltas sin aprobar | Diario |
|
||||||
|
| Comparativo Horarios | Esperado vs Real | Mensual |
|
||||||
|
| Costo de Horas Extra | Horas extra por departamento | Quincenal |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Integraciones
|
||||||
|
|
||||||
|
### Reconocimiento Facial
|
||||||
|
|
||||||
|
| Proveedor | Pros | Contras |
|
||||||
|
|-----------|------|---------|
|
||||||
|
| AWS Rekognition | Alta precision, liveness detection | Costo por uso |
|
||||||
|
| Azure Face | Buena precision, anti-spoofing | Requiere Azure |
|
||||||
|
| Google Vision | Integracion con Firebase | Menos features |
|
||||||
|
| On-device (ML Kit) | Sin costo de API, privacidad | Menor precision |
|
||||||
|
|
||||||
|
**Recomendacion:** AWS Rekognition con fallback a ML Kit on-device.
|
||||||
|
|
||||||
|
### Geofencing
|
||||||
|
|
||||||
|
| Proveedor | Uso |
|
||||||
|
|-----------|-----|
|
||||||
|
| Google Maps | Geocoding, visualizacion de mapas |
|
||||||
|
| Mapbox | Alternativa a Google Maps |
|
||||||
|
| react-native-geofencing | Deteccion de entrada/salida |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Riesgos
|
||||||
|
|
||||||
|
| Riesgo | Probabilidad | Impacto | Mitigacion |
|
||||||
|
|--------|--------------|---------|------------|
|
||||||
|
| GPS impreciso en interiores | Alta | Medio | Tolerancia configurable, WiFi positioning |
|
||||||
|
| Fallo en reconocimiento facial | Media | Alto | Fallback a huella y PIN |
|
||||||
|
| Sincronizacion fallida | Media | Alto | Retry automatico, alertas |
|
||||||
|
| Bateria agotada rapidamente | Media | Medio | Sampling inteligente de GPS |
|
||||||
|
| Spoofing de foto | Baja | Critico | Liveness detection obligatorio |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Definition of Ready (DoR)
|
||||||
|
|
||||||
|
- [x] Historias de usuario definidas
|
||||||
|
- [x] Criterios de aceptacion claros
|
||||||
|
- [x] Dependencias identificadas
|
||||||
|
- [x] Estimacion completada
|
||||||
|
- [ ] Cuenta AWS/Azure para biometricos
|
||||||
|
- [ ] API Key de Google Maps/Mapbox
|
||||||
|
- [ ] Politicas de asistencia definidas por RRHH
|
||||||
|
- [x] Sin bloqueadores activos
|
||||||
|
|
||||||
|
## Definition of Done (DoD)
|
||||||
|
|
||||||
|
- [ ] Codigo implementado y revisado
|
||||||
|
- [ ] Tests pasando (unit, integration, e2e)
|
||||||
|
- [ ] Check-in/out funcionando con facial
|
||||||
|
- [ ] Check-in/out funcionando con huella
|
||||||
|
- [ ] Geocercas validando correctamente
|
||||||
|
- [ ] Modo offline funcionando
|
||||||
|
- [ ] Sincronizacion automatica
|
||||||
|
- [ ] Reportes generandose
|
||||||
|
- [ ] Documentacion actualizada
|
||||||
|
- [ ] Inventarios actualizados
|
||||||
|
- [ ] Demo realizada
|
||||||
|
- [ ] Product Owner aprobo
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Documentacion Relacionada
|
||||||
|
|
||||||
|
- Vision General: `docs/00-vision-general/VISION-ERP-CORE.md`
|
||||||
|
- Requerimientos: `docs/03-requerimientos/RF-time-attendance/`
|
||||||
|
- User Stories: `docs/05-user-stories/mgn-023/`
|
||||||
|
- DDL Spec: `docs/04-modelado/database-design/DDL-SPEC-hr_attendance.md`
|
||||||
|
- Mobile Core: `EPIC-MGN-022-mobile-core.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Historial
|
||||||
|
|
||||||
|
| Fecha | Cambio | Autor |
|
||||||
|
|-------|--------|-------|
|
||||||
|
| 2026-01-04 | Creacion de epica | Orquestador |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Creada por:** Orquestador
|
||||||
|
**Fecha:** 2026-01-04
|
||||||
|
**Ultima actualizacion:** 2026-01-04
|
||||||
@ -113,16 +113,26 @@ Crear el **ERP Genérico** como base reutilizable (60-70%) para los 3 ERPs espec
|
|||||||
| **MGN-013** | Portal de Usuarios | portal |
|
| **MGN-013** | Portal de Usuarios | portal |
|
||||||
| **MGN-014** | Mensajería y Notificaciones | mail |
|
| **MGN-014** | Mensajería y Notificaciones | mail |
|
||||||
|
|
||||||
### Fase SaaS Platform (4 módulos - Prioridad P3)
|
### Fase SaaS Platform (6 módulos - Prioridad P2)
|
||||||
|
|
||||||
| Código | Nombre | Descripción |
|
| Código | Nombre | Descripción |
|
||||||
|--------|--------|-------------|
|
|--------|--------|-------------|
|
||||||
| **MGN-016** | Billing SaaS | Per-seat pricing, suscripciones, feature flags |
|
| **MGN-016** | Billing SaaS | Per-seat pricing, suscripciones, feature flags |
|
||||||
| **MGN-017** | Payments POS | MercadoPago, Clip, terminales de pago |
|
| **MGN-017** | Payments | Stripe (suscripciones) + MercadoPago/Clip (terminales POS) |
|
||||||
| **MGN-018** | WhatsApp Business | Cloud API, chatbots, campañas |
|
| **MGN-018** | WhatsApp Business | Cloud API, chatbots, campañas |
|
||||||
| **MGN-019** | AI Agents | RAG, pgvector, knowledge bases, tools |
|
| **MGN-019** | AI Agents | MCP Server, RAG, pgvector, knowledge bases, tools |
|
||||||
|
| **MGN-020** | Onboarding | Wizard de setup inicial, configuración guiada |
|
||||||
|
| **MGN-021** | AI Tokens | Sistema de tokens IA, paquetes recargables |
|
||||||
|
|
||||||
**Total:** 19 módulos (14 core + 1 projects + 4 SaaS)
|
### Fase Mobile Platform (3 módulos - Prioridad P1)
|
||||||
|
|
||||||
|
| Código | Nombre | Descripción |
|
||||||
|
|--------|--------|-------------|
|
||||||
|
| **MGN-022** | Mobile Core | React Native base: auth, sync, biometrics |
|
||||||
|
| **MGN-023** | Time & Attendance | Checador biométrico + GPS, entradas/salidas |
|
||||||
|
| **MGN-024** | Worker Profiles | Perfiles de trabajador, módulos por rol |
|
||||||
|
|
||||||
|
**Total:** 24 módulos (14 core + 6 SaaS + 3 mobile + apps por vertical)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -354,7 +364,42 @@ Ver directiva: `/workspace/core/orchestration/directivas/DIRECTIVA-ESTRUCTURA-DO
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Última actualización:** 2025-12-05
|
**Última actualización:** 2026-01-04
|
||||||
**Coordinador:** Architecture-Analyst
|
**Coordinador:** Architecture-Analyst / Orquestador
|
||||||
**Estado:** 📋 Fase 2 - Modelado en progreso
|
**Estado:** 📋 Fase 2 - Modelado en progreso
|
||||||
**Próximo paso:** Completar especificaciones técnicas de módulos SaaS
|
**Próximo paso:** Implementar módulos SaaS Platform y Mobile Platform
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## NUEVAS CARACTERÍSTICAS (Enero 2026)
|
||||||
|
|
||||||
|
Se han agregado las siguientes características a la visión del proyecto:
|
||||||
|
|
||||||
|
### Plataforma SaaS Completa
|
||||||
|
- Modelo de monetización per-seat con 3 planes (Starter, Growth, Enterprise)
|
||||||
|
- Feature flags por plan para controlar acceso a módulos
|
||||||
|
|
||||||
|
### Integraciones de Pago
|
||||||
|
- **Stripe:** Suscripciones recurrentes, webhooks, customer portal
|
||||||
|
- **MercadoPago:** Terminales POS físicas, QR, links de pago
|
||||||
|
- **Clip:** Terminales POS alternativas
|
||||||
|
|
||||||
|
### Chatbot IA (MCP Server)
|
||||||
|
- Arquitectura agnóstica a proveedores LLM (OpenRouter, OpenAI, Anthropic, Ollama)
|
||||||
|
- RAG con pgvector para knowledge bases
|
||||||
|
- Tools que ejecutan acciones en el sistema
|
||||||
|
- Integración con WhatsApp, Chat Web y App Móvil
|
||||||
|
|
||||||
|
### Apps Móviles por Perfil
|
||||||
|
- React Native con Expo
|
||||||
|
- Perfiles de trabajador con módulos específicos
|
||||||
|
- Biométricos (facial y huella)
|
||||||
|
- Modo offline con sincronización
|
||||||
|
|
||||||
|
### Sistema de Checador (Time & Attendance)
|
||||||
|
- Validación biométrica con liveness detection
|
||||||
|
- Geocercas configurables por ubicación
|
||||||
|
- Registro de entradas/salidas/descansos
|
||||||
|
- Reportes de asistencia
|
||||||
|
|
||||||
|
Ver detalles completos en: [VISION-ERP-CORE.md](00-vision-general/VISION-ERP-CORE.md)
|
||||||
|
|||||||
@ -37,11 +37,11 @@ Los siguientes patrones fueron extraidos de gamilit al catalogo:
|
|||||||
|
|
||||||
| Patron | Ubicacion Catalogo |
|
| Patron | Ubicacion Catalogo |
|
||||||
|--------|-------------------|
|
|--------|-------------------|
|
||||||
| Auth + Sessions | `core/catalog/auth/` |
|
| Auth + Sessions | `shared/catalog/auth/` |
|
||||||
| Multi-tenancy | `core/catalog/multi-tenancy/` |
|
| Multi-tenancy | `shared/catalog/multi-tenancy/` |
|
||||||
| Notifications | `core/catalog/notifications/` |
|
| Notifications | `shared/catalog/notifications/` |
|
||||||
| Rate Limiting | `core/catalog/rate-limiting/` |
|
| Rate Limiting | `shared/catalog/rate-limiting/` |
|
||||||
| Feature Flags | `core/catalog/feature-flags/` |
|
| Feature Flags | `shared/catalog/feature-flags/` |
|
||||||
|
|
||||||
## Lecciones Aprendidas
|
## Lecciones Aprendidas
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ Los siguientes patrones fueron extraidos de gamilit al catalogo:
|
|||||||
|
|
||||||
- Proyecto: `projects/gamilit/`
|
- Proyecto: `projects/gamilit/`
|
||||||
- Legacy: `shared/knowledge-base/reference/erp-inmobiliaria-legacy/gamilit/`
|
- Legacy: `shared/knowledge-base/reference/erp-inmobiliaria-legacy/gamilit/`
|
||||||
- Catalogo: `core/catalog/` (modulos extraidos)
|
- Catalogo: `shared/catalog/` (modulos extraidos)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user