siesa-agents 2.1.53 → 2.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ # Protocolo de Git: Creación de Ramas y Commits - SiesaTeams
2
+
3
+ Este documento establece el flujo obligatorio para la creación de ramas y el estándar de mensajes de commit para asegurar el cumplimiento de la gobernanza.
4
+
5
+ ---
6
+
7
+ ## 1. Validación de Rama Padre (Feature)
8
+ Para cualquier desarrollo de funcionalidad (**feature**), la rama de origen debe ser estrictamente `develop`.
9
+
10
+ **Procedimiento del Agente:**
11
+ 1. Validar que se encuentra en: `develop`.
12
+ 2. Ejecutar: `git checkout develop && git pull origin develop`.
13
+ 3. Confirmar que no hay cambios pendientes antes de ramificar.
14
+
15
+ ---
16
+
17
+ ## 2. Nomenclatura de la Rama
18
+ La estructura del nombre debe seguir el formato:
19
+ `rama-padre-team-owner-rq-descripcion`.
20
+
21
+ **Parámetros Sugeridos:**
22
+ * **Rama Padre:** `develop`.
23
+ * **Team:** (Debe coincidir con un prefijo válido, ej: `legacy-erp-nomina`).
24
+ * **Owner:** `gaduranb` (Basado en el correo corporativo gaduranb@siesa.com).
25
+ * **RQ:** Número de requerimiento asignado.
26
+ * **Descripción:** Breve, en minúsculas y con guiones.
27
+
28
+ **Ejemplo de comando:**
29
+ `git checkout -b develop-legacy-erp-nomina-gaduranb-rq1234-nueva-interfaz`.
30
+
31
+ ---
32
+
33
+ ## 3. Estándar de Mensajes de Commit
34
+ Se adopta el formato de **Conventional Commits** para mejorar la legibilidad y automatización.
35
+
36
+ | Tipo | Formato del Mensaje | Uso |
37
+ | :--- | :--- | :--- |
38
+ | **Feature** | `feat: descripción clara del cambio` | Nuevas funcionalidades. |
39
+ | **Fix** | `fix: descripción del error corregido` | Corrección de errores (bugs). |
40
+
41
+ **Ejemplos:**
42
+ * `git commit -m "feat: implementar validación de identidad mediante SSO"`.
43
+ * `git commit -m "fix: corregir cálculo de nómina en rama legacy"`.
44
+
45
+ ---
46
+
47
+ ## 4. Reglas de Oro de Gobernanza
48
+ * **Todo en Minúsculas:** Los nombres de ramas y repositorios no deben contener mayúsculas.
49
+ * **Protección de Ramas:** `main` y `develop` están protegidas; el push directo está prohibido.
50
+ * **Nota:** Esta automatización solo podrá crear las ramas como se indica y realizar push a las mismas en caso de ser necesario.
@@ -131,9 +131,14 @@ Use MCP to install Shadcn components instead of creating manually.
131
131
 
132
132
  **Default**: Always use Vite + TanStack Router with TypeScript.
133
133
 
134
- **Microfrontends**: Use Vite + Module Federation for distributed architecture.
135
-
136
- **Reasoning**: Vite provides faster builds, TanStack Router offers type-safe routing, and the combination is prepared for microfrontends with Module Federation.
134
+ **Microfrontends**:
135
+ - **DEFAULT**: Vite + Single-SPA (`vite-plugin-single-spa` + `single-spa-react`) para todos los módulos de negocio
136
+ - **EXCEPCIÓN**: Vite + Module Federation SOLO para módulos transversales/compartidos explícitamente marcados por el ingeniero
137
+
138
+ **Reasoning**:
139
+ - Single-SPA proporciona aislamiento completo (CSS, JS, lifecycle), mejor hot reload, y error boundaries built-in
140
+ - Module Federation solo se usa cuando hay necesidad explícita de compartir código entre MFEs
141
+ - Ver `vite-config-standard.md` para configuración detallada
137
142
 
138
143
  ## Backend Architecture
139
144
 
@@ -92,7 +92,32 @@ Este documento define los estándares de desarrollo frontend para aplicaciones e
92
92
  | Escenario | Framework | Razón |
93
93
  |-----------|-----------|-------|
94
94
  | **Default** | Vite + TanStack Router | Mejor DX, type-safety, preparado para microfrontends |
95
- | **Microfrontends** | Vite + Module Federation | Arquitectura distribuida |
95
+ | **MFE (Default)** | Vite + Single-SPA | Aislamiento completo, CSS lifecycle, error boundaries built-in |
96
+ | **Módulo Federable** | Vite + Module Federation | SOLO para módulos transversales explícitamente marcados |
97
+
98
+ ### 2.3 Regla Crítica: Single-SPA vs Module Federation
99
+
100
+ > ⚠️ **IMPORTANTE**: Por defecto, todos los microfrontends usan **Single-SPA**. Module Federation se usa **SOLO** cuando el ingeniero define explícitamente que un módulo debe ser compartido/federable.
101
+
102
+ | Tipo | Tecnología | Uso |
103
+ |------|------------|-----|
104
+ | **MFE de Negocio** | `vite-plugin-single-spa` + `single-spa-react` | ✅ DEFAULT - finance, hr, inventory, etc. |
105
+ | **Módulo Compartido** | `@module-federation/vite` | ⚠️ SOLO cuando explícitamente requerido |
106
+
107
+ **Dependencias Single-SPA (DEFAULT):**
108
+ ```bash
109
+ npm install single-spa-react
110
+ npm install vite-plugin-single-spa --save-dev
111
+ ```
112
+
113
+ **Beneficios de Single-SPA:**
114
+ - CSS isolation automático via `cssLifecycleFactory`
115
+ - Error boundaries built-in
116
+ - Lifecycle completo (bootstrap, mount, unmount)
117
+ - Mejor hot reload
118
+ - Menor complejidad de configuración
119
+
120
+ Ver `vite-config-standard.md` para configuración detallada.
96
121
 
97
122
  ### 2.3 Herramientas de Desarrollo
98
123
 
@@ -0,0 +1,535 @@
1
+ # Vite Config - Estándar Microfrontends
2
+
3
+ Guía de configuración estándar para microfrontends usando Single-SPA (default) y Module Federation (solo módulos compartidos).
4
+
5
+ ---
6
+
7
+ ## REGLA CRÍTICA: Single-SPA vs Module Federation
8
+
9
+ | Tipo de Módulo | Tecnología | Cuándo Usar |
10
+ |----------------|------------|-------------|
11
+ | **MFE Estándar** | **Single-SPA** | ✅ DEFAULT - Todos los módulos de negocio (finance, hr, inventory, etc.) |
12
+ | **Módulo Transversal** | **Module Federation** | ⚠️ SOLO cuando el ingeniero define explícitamente que debe ser compartido |
13
+
14
+ ### ¿Cuándo usar Module Federation?
15
+
16
+ Module Federation **SOLO** se usa para módulos que:
17
+ 1. Son **transversales** (usados por múltiples MFEs)
18
+ 2. El ingeniero los marca **explícitamente** como "federable"
19
+ 3. Ejemplos: Componentes compartidos, utilidades comunes, design system
20
+
21
+ ### ¿Cuándo usar Single-SPA?
22
+
23
+ Single-SPA es el **DEFAULT** para:
24
+ 1. Todos los módulos de negocio (finance, hr, inventory, sales, etc.)
25
+ 2. Cualquier MFE que no sea explícitamente marcado como federable
26
+ 3. Widgets independientes
27
+
28
+ ---
29
+
30
+ ## Dependencias Requeridas
31
+
32
+ ### Para MFE Single-SPA (DEFAULT)
33
+
34
+ ```bash
35
+ # Core Single-SPA
36
+ npm install single-spa-react
37
+
38
+ # Vite Plugin (configura automáticamente entry points, externals, CSS)
39
+ npm install vite-plugin-single-spa --save-dev
40
+
41
+ # React (obligatorio)
42
+ npm install react react-dom
43
+ npm install @types/react @types/react-dom --save-dev
44
+
45
+ # Común
46
+ npm install @vitejs/plugin-react --save-dev
47
+ ```
48
+
49
+ ### Para Módulo Federable (SOLO si explícitamente requerido)
50
+
51
+ ```bash
52
+ # Module Federation
53
+ npm install @module-federation/vite --save-dev
54
+
55
+ # TanStack Router (si aplica)
56
+ npm install @tanstack/react-router
57
+
58
+ # Común
59
+ npm install @vitejs/plugin-react --save-dev
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 1. Single-SPA (DEFAULT para todos los MFEs)
65
+
66
+ ### 1.1 Configuración Vite (vite.config.ts)
67
+
68
+ ```typescript
69
+ // modules/{module-name}/vite.config.ts
70
+ import { defineConfig } from 'vite';
71
+ import react from '@vitejs/plugin-react';
72
+ import vitePluginSingleSpa from 'vite-plugin-single-spa';
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ react(),
77
+ vitePluginSingleSpa({
78
+ serverPort: 3001, // Puerto único por módulo
79
+ spaEntryPoints: 'src/spa.tsx', // Entry point Single-SPA
80
+ cssStrategy: 'singleMife', // CSS se inyecta/remueve en mount/unmount
81
+ projectId: '{module-name}-module', // ID único del proyecto
82
+ }),
83
+ ],
84
+ server: {
85
+ port: 3001,
86
+ cors: true,
87
+ },
88
+ base: '/{module-name}/', // Prefijo de rutas
89
+ });
90
+ ```
91
+
92
+ ### 1.2 Entry Point Single-SPA (src/spa.tsx)
93
+
94
+ ```typescript
95
+ // modules/{module-name}/src/spa.tsx
96
+ import React from 'react';
97
+ import ReactDOMClient from 'react-dom/client';
98
+ import singleSpaReact from 'single-spa-react';
99
+ import { cssLifecycleFactory } from 'vite-plugin-single-spa/ex';
100
+ import App from './App';
101
+
102
+ // Props que el App Shell puede pasar al MFE
103
+ export interface CustomProps {
104
+ i18n?: unknown;
105
+ eventBus?: unknown;
106
+ authContext?: unknown;
107
+ }
108
+
109
+ // Error boundary para errores en el MFE
110
+ function ErrorFallback({ error }: { error: Error }) {
111
+ return (
112
+ <div className="flex items-center justify-center min-h-screen bg-red-50">
113
+ <div className="max-w-md p-6 bg-white rounded-lg shadow-lg">
114
+ <h2 className="text-xl font-semibold text-red-600 mb-2">
115
+ Error en módulo
116
+ </h2>
117
+ <p className="text-gray-600 mb-4">{error.message}</p>
118
+ <button
119
+ onClick={() => window.location.reload()}
120
+ className="px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700"
121
+ >
122
+ Recargar
123
+ </button>
124
+ </div>
125
+ </div>
126
+ );
127
+ }
128
+
129
+ // Crear lifecycles con single-spa-react
130
+ const lifecycles = singleSpaReact({
131
+ React,
132
+ ReactDOMClient,
133
+ rootComponent: App,
134
+ errorBoundary: (err: Error) => <ErrorFallback error={err} />,
135
+ // CRÍTICO: Especificar el contenedor del App Shell donde se montará el MFE
136
+ domElementGetter: () => document.getElementById('single-spa-application')!,
137
+ });
138
+
139
+ // CSS lifecycle - inyecta CSS al montar, lo remueve al desmontar
140
+ const cssLc = cssLifecycleFactory('spa');
141
+
142
+ // ⚠️ REGLA CRÍTICA: domElementGetter
143
+ // -------------------------------------
144
+ // El App Shell de Siesa provee un contenedor específico donde se montan los MFEs:
145
+ // <div id="single-spa-application">
146
+ //
147
+ // Sin domElementGetter:
148
+ // - single-spa-react crea un <div> nuevo al final del <body>
149
+ // - El MFE se renderiza FUERA del layout del App Shell
150
+ // - El usuario NO verá el MFE aunque esté montado correctamente
151
+ //
152
+ // Con domElementGetter:
153
+ // - El MFE se monta dentro del contenedor del App Shell
154
+ // - Se integra correctamente con el layout (navegación, estilos)
155
+ // - El usuario ve el MFE en la ubicación correcta
156
+ //
157
+ // TODOS los MFEs Single-SPA deben incluir esta configuración.
158
+
159
+ // Exportar lifecycles combinados (CSS + React)
160
+ export const bootstrap = [cssLc.bootstrap, lifecycles.bootstrap];
161
+ export const mount = [cssLc.mount, lifecycles.mount];
162
+ export const unmount = [cssLc.unmount, lifecycles.unmount];
163
+ ```
164
+
165
+ ### 1.3 Standalone Development (src/main.tsx)
166
+
167
+ ```typescript
168
+ // modules/{module-name}/src/main.tsx
169
+ // Para desarrollo standalone (sin App Shell)
170
+ import React from 'react';
171
+ import ReactDOM from 'react-dom/client';
172
+ import App from './App';
173
+ import './index.css';
174
+
175
+ ReactDOM.createRoot(document.getElementById('root')!).render(
176
+ <React.StrictMode>
177
+ <App />
178
+ </React.StrictMode>
179
+ );
180
+ ```
181
+
182
+ ### 1.4 App Shell - Registro de MFEs Single-SPA
183
+
184
+ ```typescript
185
+ // app-shell/src/microfrontends/register.ts
186
+ import { registerApplication, start } from 'single-spa';
187
+
188
+ // Registrar cada MFE
189
+ registerApplication({
190
+ name: 'finance',
191
+ app: () => System.import('http://localhost:3001/finance/spa.js'),
192
+ activeWhen: ['/finance'],
193
+ customProps: {
194
+ i18n: i18nInstance,
195
+ eventBus: eventBus,
196
+ authContext: authStore.getState(),
197
+ },
198
+ });
199
+
200
+ registerApplication({
201
+ name: 'inventory',
202
+ app: () => System.import('http://localhost:3002/inventory/spa.js'),
203
+ activeWhen: ['/inventory'],
204
+ customProps: {
205
+ i18n: i18nInstance,
206
+ eventBus: eventBus,
207
+ authContext: authStore.getState(),
208
+ },
209
+ });
210
+
211
+ registerApplication({
212
+ name: 'hr',
213
+ app: () => System.import('http://localhost:3003/hr/spa.js'),
214
+ activeWhen: ['/hr'],
215
+ customProps: {
216
+ i18n: i18nInstance,
217
+ eventBus: eventBus,
218
+ authContext: authStore.getState(),
219
+ },
220
+ });
221
+
222
+ // Iniciar Single-SPA
223
+ start();
224
+ ```
225
+
226
+ ### 1.5 Import Map (index.html del App Shell)
227
+
228
+ ```html
229
+ <!-- app-shell/index.html -->
230
+ <script type="systemjs-importmap">
231
+ {
232
+ "imports": {
233
+ "react": "https://cdn.jsdelivr.net/npm/react@18/umd/react.production.min.js",
234
+ "react-dom": "https://cdn.jsdelivr.net/npm/react-dom@18/umd/react-dom.production.min.js",
235
+ "single-spa": "https://cdn.jsdelivr.net/npm/single-spa@6/lib/system/single-spa.min.js"
236
+ }
237
+ }
238
+ </script>
239
+ <script src="https://cdn.jsdelivr.net/npm/systemjs@6/dist/system.min.js"></script>
240
+ ```
241
+
242
+ ---
243
+
244
+ ## 2. Module Federation (SOLO para módulos transversales explícitos)
245
+
246
+ > ⚠️ **IMPORTANTE**: Solo usar Module Federation cuando el ingeniero defina explícitamente que un módulo debe ser compartido/federable.
247
+
248
+ ### 2.1 Exponer un Módulo Federable (Remote)
249
+
250
+ ```typescript
251
+ // shared-components/vite.config.ts
252
+ import { defineConfig } from 'vite';
253
+ import react from '@vitejs/plugin-react';
254
+ import { federation } from '@module-federation/vite';
255
+
256
+ export default defineConfig({
257
+ plugins: [
258
+ react(),
259
+ federation({
260
+ name: 'sharedComponents', // Nombre único del módulo federable
261
+ filename: 'remoteEntry.js',
262
+ exposes: {
263
+ './Button': './src/components/Button.tsx',
264
+ './Modal': './src/components/Modal.tsx',
265
+ './DataTable': './src/components/DataTable.tsx',
266
+ },
267
+ shared: {
268
+ react: { singleton: true, requiredVersion: '^18.3.1' },
269
+ 'react-dom': { singleton: true, requiredVersion: '^18.3.1' },
270
+ 'siesa-ui-kit': { singleton: true },
271
+ },
272
+ }),
273
+ ],
274
+ server: {
275
+ port: 3010,
276
+ strictPort: true,
277
+ cors: true,
278
+ },
279
+ build: {
280
+ modulePreload: false,
281
+ target: 'esnext',
282
+ minify: false,
283
+ cssCodeSplit: false,
284
+ },
285
+ });
286
+ ```
287
+
288
+ ### 2.2 Consumir Módulo Federable desde un MFE
289
+
290
+ ```typescript
291
+ // modules/finance/vite.config.ts (MFE que consume módulos federables)
292
+ import { defineConfig } from 'vite';
293
+ import react from '@vitejs/plugin-react';
294
+ import vitePluginSingleSpa from 'vite-plugin-single-spa';
295
+ import { federation } from '@module-federation/vite';
296
+
297
+ export default defineConfig({
298
+ plugins: [
299
+ react(),
300
+ vitePluginSingleSpa({
301
+ serverPort: 3001,
302
+ spaEntryPoints: 'src/spa.tsx',
303
+ cssStrategy: 'singleMife',
304
+ projectId: 'finance-module',
305
+ }),
306
+ // Solo agregar federation si necesita consumir módulos compartidos
307
+ federation({
308
+ name: 'finance',
309
+ remotes: {
310
+ sharedComponents: {
311
+ type: 'module',
312
+ name: 'sharedComponents',
313
+ entry: 'http://localhost:3010/remoteEntry.js',
314
+ entryGlobalName: 'sharedComponents',
315
+ },
316
+ },
317
+ shared: {
318
+ react: { singleton: true, requiredVersion: '^18.3.1' },
319
+ 'react-dom': { singleton: true, requiredVersion: '^18.3.1' },
320
+ },
321
+ }),
322
+ ],
323
+ server: {
324
+ port: 3001,
325
+ cors: true,
326
+ },
327
+ base: '/finance/',
328
+ });
329
+ ```
330
+
331
+ ### 2.3 Tipos para Módulos Federables
332
+
333
+ ```typescript
334
+ // types/remotes.d.ts
335
+ declare module 'sharedComponents/Button' {
336
+ const Button: React.ComponentType<ButtonProps>;
337
+ export default Button;
338
+ }
339
+
340
+ declare module 'sharedComponents/Modal' {
341
+ const Modal: React.ComponentType<ModalProps>;
342
+ export default Modal;
343
+ }
344
+
345
+ declare module 'sharedComponents/DataTable' {
346
+ const DataTable: React.ComponentType<DataTableProps>;
347
+ export default DataTable;
348
+ }
349
+ ```
350
+
351
+ ---
352
+
353
+ ## 3. Convención de Puertos
354
+
355
+ | Módulo | Puerto | Tipo | Descripción |
356
+ |--------|--------|------|-------------|
357
+ | app-shell | 3000 | Host | Orquestador Single-SPA |
358
+ | finance | 3001 | Single-SPA | Módulo Finanzas |
359
+ | inventory | 3002 | Single-SPA | Módulo Inventario |
360
+ | hr | 3003 | Single-SPA | Módulo RRHH |
361
+ | crm | 3004 | Single-SPA | Módulo CRM |
362
+ | pos | 3005 | Single-SPA | Módulo POS |
363
+ | shared-components | 3010 | Federation | Componentes compartidos (federable) |
364
+ | shared-utils | 3011 | Federation | Utilidades compartidas (federable) |
365
+
366
+ ---
367
+
368
+ ## 4. Routing con TanStack Router
369
+
370
+ ### 4.1 Router del MFE (Single-SPA)
371
+
372
+ > ⚠️ **IMPORTANTE:** Todas las rutas deben tener prefijo único que coincida con `base` en vite.config.ts
373
+
374
+ ```typescript
375
+ // modules/finance/src/router.tsx
376
+ import {
377
+ createRouter,
378
+ createRootRoute,
379
+ createRoute,
380
+ redirect,
381
+ } from '@tanstack/react-router';
382
+ import { MainLayout } from './components/layout/MainLayout';
383
+ import Dashboard from './routes/dashboard';
384
+ import AccountsIndex from './routes/accounts.index';
385
+ import AccountDetail from './routes/accounts.$id';
386
+
387
+ // Root route con layout
388
+ const rootRoute = createRootRoute({
389
+ component: MainLayout,
390
+ });
391
+
392
+ // Ruta índice - redirige al dashboard
393
+ const indexRoute = createRoute({
394
+ getParentRoute: () => rootRoute,
395
+ path: '/',
396
+ beforeLoad: () => {
397
+ throw redirect({ to: '/finance/dashboard' });
398
+ },
399
+ });
400
+
401
+ // Dashboard
402
+ const dashboardRoute = createRoute({
403
+ getParentRoute: () => rootRoute,
404
+ path: '/finance/dashboard',
405
+ component: Dashboard,
406
+ });
407
+
408
+ // Cuentas - listado
409
+ const accountsRoute = createRoute({
410
+ getParentRoute: () => rootRoute,
411
+ path: '/finance/accounts',
412
+ component: AccountsIndex,
413
+ });
414
+
415
+ // Cuentas - detalle
416
+ const accountDetailRoute = createRoute({
417
+ getParentRoute: () => rootRoute,
418
+ path: '/finance/accounts/$id',
419
+ component: AccountDetail,
420
+ });
421
+
422
+ const routeTree = rootRoute.addChildren([
423
+ indexRoute,
424
+ dashboardRoute,
425
+ accountsRoute,
426
+ accountDetailRoute,
427
+ ]);
428
+
429
+ export const router = createRouter({ routeTree });
430
+
431
+ declare module '@tanstack/react-router' {
432
+ interface Register {
433
+ router: typeof router;
434
+ }
435
+ }
436
+ ```
437
+
438
+ ### 4.2 Convención de Prefijos de Rutas
439
+
440
+ | Módulo | Puerto | Base (vite.config) | Prefijo Rutas |
441
+ |--------|--------|---------------------|---------------|
442
+ | app-shell | 3000 | `/` | `/` |
443
+ | finance | 3001 | `/finance/` | `/finance/*` |
444
+ | inventory | 3002 | `/inventory/` | `/inventory/*` |
445
+ | hr | 3003 | `/hr/` | `/hr/*` |
446
+
447
+ ---
448
+
449
+ ## 5. Shared Dependencies (para ambos)
450
+
451
+ ```typescript
452
+ shared: {
453
+ // SIEMPRE singleton para React
454
+ react: { singleton: true, requiredVersion: '^18.3.1' },
455
+ 'react-dom': { singleton: true, requiredVersion: '^18.3.1' },
456
+
457
+ // UI Kit compartido
458
+ 'siesa-ui-kit': { singleton: true },
459
+
460
+ // Router y Query
461
+ '@tanstack/react-router': { singleton: true },
462
+ '@tanstack/react-query': { singleton: true },
463
+
464
+ // State management
465
+ 'zustand': { singleton: true },
466
+
467
+ // i18n
468
+ 'react-i18next': { singleton: true },
469
+ 'i18next': { singleton: true },
470
+ }
471
+ ```
472
+
473
+ ---
474
+
475
+ ## 6. Checklist de Configuración
476
+
477
+ ### MFE Single-SPA (DEFAULT)
478
+
479
+ - [ ] `vite-plugin-single-spa` instalado y configurado
480
+ - [ ] `single-spa-react` instalado
481
+ - [ ] `src/spa.tsx` con lifecycles exportados
482
+ - [ ] `cssLifecycleFactory` configurado para CSS isolation
483
+ - [ ] `errorBoundary` implementado
484
+ - [ ] **`domElementGetter` apuntando a `#single-spa-application`** ⚠️ CRÍTICO
485
+ - [ ] Puerto único configurado
486
+ - [ ] `base` configurado con prefijo (ej: `/finance/`)
487
+ - [ ] Todas las rutas usan el prefijo
488
+ - [ ] `cors: true` en server
489
+ - [ ] `src/main.tsx` para desarrollo standalone
490
+
491
+ ### Módulo Federable (SOLO si explícitamente requerido)
492
+
493
+ - [ ] `@module-federation/vite` instalado
494
+ - [ ] `name` único en federation config
495
+ - [ ] `filename: 'remoteEntry.js'`
496
+ - [ ] `exposes` con componentes/utilidades a compartir
497
+ - [ ] `shared` con React y dependencias como singleton
498
+ - [ ] Puerto único (rango 3010+)
499
+ - [ ] `cors: true` en server
500
+ - [ ] `modulePreload: false` en build
501
+ - [ ] `cssCodeSplit: false` en build
502
+ - [ ] Tipos declarados en consumidores
503
+
504
+ ### App Shell
505
+
506
+ - [ ] `single-spa` instalado
507
+ - [ ] Import map con React y dependencias compartidas
508
+ - [ ] `registerApplication` para cada MFE
509
+ - [ ] `start()` llamado después de registrar
510
+ - [ ] `customProps` con contexto compartido (i18n, auth, eventBus)
511
+ - [ ] **Contenedor `<div id="single-spa-application">` en el layout** ⚠️ CRÍTICO para MFEs
512
+
513
+ ---
514
+
515
+ ## 7. Beneficios de Single-SPA como Default
516
+
517
+ | Aspecto | Single-SPA | Module Federation |
518
+ |---------|------------|-------------------|
519
+ | **Aislamiento** | ✅ Completo (CSS, JS, lifecycle) | ⚠️ Parcial |
520
+ | **Hot Reload** | ✅ Funciona bien | ⚠️ Problemas conocidos |
521
+ | **CSS Isolation** | ✅ `cssLifecycleFactory` automático | ⚠️ Manual |
522
+ | **Error Boundaries** | ✅ Built-in | ⚠️ Manual |
523
+ | **Mount/Unmount** | ✅ Lifecycle completo | ⚠️ Solo lazy load |
524
+ | **Complejidad** | ✅ Baja | ⚠️ Alta |
525
+ | **Sharing código** | ⚠️ Via import maps | ✅ Nativo |
526
+
527
+ ---
528
+
529
+ ## 8. Referencias
530
+
531
+ - [Single-SPA Documentation](https://single-spa.js.org/)
532
+ - [single-spa-react](https://single-spa.js.org/docs/ecosystem-react/)
533
+ - [vite-plugin-single-spa](https://github.com/nickt/vite-plugin-single-spa)
534
+ - [Module Federation](https://module-federation.io/)
535
+ - [Vite Documentation](https://vitejs.dev/)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: 'step-07-commit-push'
3
- description: 'Safely commit and push verified code to the repository'
3
+ description: 'Safely commit and push verified code following centralized GitFlow guidelines'
4
4
 
5
5
  # Path Definitions
6
6
  workflow_path: '{project-root}/_bmad/bmm/workflows/4-implementation/code-review'
@@ -12,24 +12,38 @@ outputFile: '{output_folder}/review-{story_key}.md'
12
12
 
13
13
  # Data References
14
14
  sprint_status_file: '{implementation_artifacts}/sprint-status.yaml'
15
- epicsFile: '{output_folder}/planning-artifacts/epics.md'
15
+
16
+ # Centralized GitFlow Guidelines
17
+ gitFlowGuide: '{project-root}/_bmad/bmm/data/git-flow-siesa.md'
16
18
  ---
17
19
 
18
20
  # Step 7: Commit & Push
19
21
 
20
22
  ## STEP GOAL:
21
- To securely persist the verified and approved code changes to the repository by validating the development branch and performing a git commit and push operation.
23
+
24
+ To securely persist the verified and approved code changes to the repository following the **centralized GitFlow guidelines** defined in `{gitFlowGuide}`.
22
25
 
23
26
  ## MANDATORY EXECUTION RULES:
27
+
28
+ - 📖 **LOAD AND READ** `{gitFlowGuide}` before any Git operation
24
29
  - 🛑 ONLY execute if the story status is explicitly 'done' or 'completed'
25
- - 🌳 Ensure development is on the correct `Feature/{Epic_Name}` branch
26
- - 📝 Commit messages must follow the standard format: "feat: implementation for story {{story_key}}"
30
+ - 🌳 Ensure development branch follows the naming convention from the centralized guide
31
+ - 📝 Commit messages must follow the standard from `{gitFlowGuide}` (Conventional Commits)
27
32
 
28
33
  ## Sequence of Instructions
29
34
 
30
- ### 1. Verification of Status
35
+ ### 1. Load GitFlow Guidelines
36
+
37
+ <action>
38
+ 1. Load and read the entire file at `{gitFlowGuide}`.
39
+ 2. Extract and apply:
40
+ - **Commit Message Format**: From Section 3 (Conventional Commits)
41
+ - **Governance Rules**: From Section 4 (lowercase, protected branches)
42
+ </action>
31
43
 
32
- **Goal**: ensure we are authorized to push code.
44
+ ### 2. Verification of Status
45
+
46
+ **Goal**: Ensure we are authorized to push code.
33
47
 
34
48
  <action>
35
49
  1. Load `{sprint_status_file}`.
@@ -45,58 +59,56 @@ To securely persist the verified and approved code changes to the repository by
45
59
  <action>STOP execution. Do NOT run git commands.</action>
46
60
  </check>
47
61
 
48
- ### 2. Branch Validation
62
+ ### 3. Branch Validation
49
63
 
50
- **Goal**: Ensure code is committed to the correct Epic feature branch.
64
+ **Goal**: Ensure code is committed to the correct branch per GitFlow guidelines.
51
65
 
52
66
  <check if="status == 'done' OR status == 'completed'">
53
67
 
54
68
  <action>
55
- 1. Extract **Epic ID** from `{{story_key}}` (first number, e.g., '1' from '1-2-user-auth').
56
- 2. Load and read `{epicsFile}`.
57
- 3. Find the header matching `### Epic {Epic_ID}:`.
58
- 4. Extract the Epic Name (e.g., "Project Foundation").
59
- 5. Sanitize Epic Name (Pascal/Kebab case, replacing spaces with dashes: "Project-Foundation").
60
- 6. Construct `target_branch` = `Feature/{Sanitized_Epic_Name}`.
69
+ 1. Run `git branch --show-current` to get `current_branch`.
70
+ 2. Validate the branch follows the naming convention from `{gitFlowGuide}`:
71
+ - Pattern: `{parent}-{team}-{owner}-{rq}-{description}`
72
+ - Must be lowercase
73
+ - Must NOT be `main` or `develop` (protected branches)
61
74
  </action>
62
75
 
63
- <action>Run command `git branch --show-current` to get `current_branch`.</action>
64
-
65
- <check if="current_branch != target_branch">
66
- <output>🔄 Switching branches (Current: {{current_branch}} -> Target: {{target_branch}})...</output>
67
-
68
- <action>Check if target branch exists: `git branch --list {{target_branch}}`.</action>
69
-
70
- <if condition="branch exists">
71
- <action>Run `git checkout {{target_branch}}`.</action>
72
- <output>✅ Switched to existing branch: {{target_branch}}</output>
73
- </if>
74
-
75
- <if condition="branch does NOT exist">
76
- <action>Run `git checkout -b {{target_branch}}`.</action>
77
- <output>✨ Created and switched to new branch: {{target_branch}}</output>
78
- </if>
76
+ <check if="current_branch == 'main' OR current_branch == 'develop'">
77
+ <output>
78
+ 🛑 **COMMIT BLOCKED**: Cannot commit directly to protected branch '{{current_branch}}'.
79
+ Per GitFlow guidelines, please switch to your feature branch first.
80
+ </output>
81
+ <action>STOP execution.</action>
79
82
  </check>
80
83
 
81
- <check if="current_branch == target_branch">
82
- <output>✅ Already on correct branch: {{target_branch}}</output>
84
+ <check if="branch naming is valid">
85
+ <output>✅ Branch '{{current_branch}}' follows GitFlow naming convention.</output>
83
86
  </check>
84
87
 
85
88
  </check>
86
89
 
87
- ### 3. Git Operations
90
+ ### 4. Git Operations
88
91
 
89
- **Goal**: Persist changes.
92
+ **Goal**: Persist changes following commit standards from `{gitFlowGuide}`.
90
93
 
91
94
  <check if="status == 'done' OR status == 'completed'">
92
95
 
93
96
  1. **Stage Changes**:
94
97
  <action>Run command `git add .`</action>
95
98
 
96
- 2. **User Confirmation**:
99
+ 2. **Construct Commit Message**:
100
+ <action>
101
+ Per Section 3 of `{gitFlowGuide}`, use Conventional Commits format:
102
+ - For features: `feat: {description}`
103
+ - For fixes: `fix: {description}`
104
+
105
+ Derive type from story context and construct message.
106
+ </action>
107
+
108
+ 3. **User Confirmation**:
97
109
  <output>
98
110
  READY TO COMMIT:
99
- - Branch: {{target_branch}}
111
+ - Branch: {{current_branch}}
100
112
  - Message: "feat: implementation for story {{story_key}}"
101
113
 
102
114
  Do you want to proceed with the commit and push?
@@ -116,43 +128,45 @@ To securely persist the verified and approved code changes to the repository by
116
128
  </if>
117
129
  </logic>
118
130
 
119
- 3. **Commit Changes**:
131
+ 4. **Commit Changes**:
120
132
  <action>Run command `git commit -m "feat: implementation for story {{story_key}}"`</action>
121
133
  <check if="Commit failed (no changes?)">
122
134
  <output>ℹ️ No changes to commit.</output>
123
135
  </check>
124
136
 
125
- 4. **Push to Remote**:
137
+ 5. **Push to Remote**:
126
138
  <action>
127
- 1. Identify current branch (should be {{target_branch}} now): `git branch --show-current`
128
- 2. Push: `git push origin {{target_branch}}`
139
+ 1. Get current branch: `git branch --show-current`
140
+ 2. Push: `git push origin {{current_branch}}`
129
141
  </action>
130
142
 
131
143
  <check if="Push failed">
132
144
  <output>❌ **Push Failed**. Please check your network or permissions and try pushing manually.</output>
133
145
  </check>
134
146
  <check if="Push success">
135
- <output>✅ **Success**: Code pushed to origin.</output>
147
+ <output>✅ **Success**: Code pushed to origin/{{current_branch}}.</output>
136
148
  </check>
137
149
 
138
150
  </check>
139
151
 
140
- ### 4. Final Logging
152
+ ### 5. Final Logging
141
153
 
142
154
  <action>Append to `{outputFile}`:</action>
143
155
  <template-output>
144
156
  ## Repository Sync
145
- - **Branch**: {{target_branch}}
157
+ - **Branch**: {{current_branch}}
146
158
  - **Commit**: [Performed/Skipped]
147
159
  - **Push**: [Performed/Skipped]
160
+ - **GitFlow Compliance**: ✅ Verified against `{gitFlowGuide}`
148
161
  - **Status**: Workflow Completed Successfully
149
162
  </template-output>
150
163
 
151
- ### 5. Workflow Completion
164
+ ### 6. Workflow Completion
152
165
 
153
166
  <output>
154
167
  🎉 **Workflow Completed**
155
168
  The code review cycle for **{{story_key}}** is finished.
169
+ All Git operations followed the centralized GitFlow guidelines.
156
170
  </output>
157
171
 
158
172
  <action>Update frontmatter of `{outputFile}`: `stepsCompleted: [1, 2, 3, 4, 5, 6, 7]`</action>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: 'step-02-check-branch'
3
- description: 'Validate and enforce Git branch naming convention'
3
+ description: 'Validate and enforce Git branch naming convention per centralized GitFlow guidelines'
4
4
 
5
5
  # Path Definitions
6
6
  workflow_path: '{project-root}/_bmad/bmm/workflows/4-implementation/dev-story'
@@ -8,67 +8,101 @@ workflow_path: '{project-root}/_bmad/bmm/workflows/4-implementation/dev-story'
8
8
  # File References
9
9
  thisStepFile: '{workflow_path}/steps/step-02-check-branch.md'
10
10
  nextStepFile: '{workflow_path}/steps/step-03-load-context.md'
11
- epicsFile: '{output_folder}/planning-artifacts/epics.md'
11
+
12
+ # Centralized GitFlow Guidelines
13
+ gitFlowGuide: '{project-root}/_bmad/bmm/data/git-flow-siesa.md'
12
14
  ---
13
15
 
14
16
  # Step 2: Git Branch Validation
15
17
 
16
18
  ## STEP GOAL:
17
19
 
18
- Ensure development occurs on the correct feature branch (`Feature/{Epic_Name}`) corresponding to the selected story's Epic.
20
+ Ensure development occurs on the correct feature branch following the **centralized GitFlow guidelines** defined in `{gitFlowGuide}`.
19
21
 
20
22
  ## MANDATORY EXECUTION RULES:
21
23
 
24
+ - 📖 **LOAD AND READ** `{gitFlowGuide}` before any Git operation
22
25
  - 🛑 NEVER start development on `main` or `develop` directly
23
- - 📖 Read `epics.md` to resolve Epic names
24
- - 🔄 Create or checkout the branch automatically
26
+ - 🔄 Follow the branch naming convention from the centralized guide
25
27
 
26
28
  ## EXECUTION PROTOCOLS:
27
29
 
28
- ### 1. Identify Epic
30
+ ### 1. Load GitFlow Guidelines
31
+
32
+ <action>
33
+ 1. Load and read the entire file at `{gitFlowGuide}`.
34
+ 2. Extract and store the following rules:
35
+ - **Parent Branch**: The required source branch for features (Section 1)
36
+ - **Branch Naming Format**: The naming convention pattern (Section 2)
37
+ - **Commit Standards**: The message format requirements (Section 3)
38
+ - **Governance Rules**: Protection and naming constraints (Section 4)
39
+ </action>
40
+
41
+ ### 2. Validate Parent Branch
42
+
43
+ <action>
44
+ 1. Run `git branch --show-current` to get `current_branch`.
45
+ 2. Per the GitFlow guide, validate that you are on or can branch from `develop`.
46
+ 3. If not on `develop`:
47
+ - Run `git checkout develop && git pull origin develop`
48
+ - Confirm no pending changes before branching
49
+ </action>
50
+
51
+ ### 3. Gather Branch Parameters
52
+
53
+ <action>
54
+ Per the naming format in `{gitFlowGuide}` (`rama-padre-team-owner-rq-descripcion`), gather:
55
+
56
+ 1. **Parent Branch**: `develop` (fixed per guidelines)
57
+ 2. **Team**: Ask user or derive from project context
58
+ 3. **Owner**: Ask user or derive from git config (`git config user.email`)
59
+ 4. **RQ**: Extract from story metadata or ask user for requirement number
60
+ 5. **Description**: Derive from story name, sanitized (lowercase, hyphens)
61
+ </action>
29
62
 
30
- Using the `story_key` identified in Step 1 (e.g., `1-2-user-auth`):
63
+ <output>
64
+ To create the branch, I need the following information per GitFlow guidelines:
65
+ - **Team prefix**: (e.g., `legacy-erp-nomina`, `platform`, etc.)
66
+ - **RQ number**: (requirement/ticket number)
31
67
 
32
- 1. Extract the **Epic ID** (the first number).
33
- * Example: `1-2-user-auth` -> Epic ID = `1`.
34
- 2. Load and read `{epicsFile}`.
35
- 3. Find the Epic section matching this ID (e.g., `### Epic 1: Project Foundation & Configuration`).
36
- 4. Extract the **Epic Name** (e.g., `Project Foundation & Configuration`).
68
+ The owner will be derived from your git config, and the description from the story.
69
+ </output>
37
70
 
38
- ### 2. Construct Branch Name
71
+ ### 4. Construct Branch Name
39
72
 
40
- 1. Sanitize the Epic Name to create a valid Git branch name:
41
- * Replace spaces with dashes `-`.
42
- * Remove special characters.
43
- * Use PascalCase or Kebab-Case as per project standard (Default to `Feature/Epic-Name-Sanitized`).
44
- * Example: `Feature/Project-Foundation-Configuration`.
73
+ <action>
74
+ 1. Build branch name following the pattern from `{gitFlowGuide}`:
75
+ `{parent}-{team}-{owner}-{rq}-{description}`
45
76
 
46
- ### 3. Check Current Branch
77
+ 2. Apply governance rules from Section 4:
78
+ - All lowercase
79
+ - No special characters
80
+ - Hyphens as separators
47
81
 
48
- 1. Run `git branch --show-current`.
49
- 2. Compare current branch with constructed `target_branch`.
82
+ Example: `develop-legacy-erp-nomina-gaduranb-rq1234-nueva-interfaz`
83
+ </action>
50
84
 
51
- ### 4. Enforce Branch
85
+ ### 5. Check and Create/Switch Branch
52
86
 
53
87
  **IF Current Branch == Target Branch:**
54
- - Output: `✅ Already on correct branch: {{target_branch}}`
55
- - Proceed to Next Step.
88
+ - Output: `✅ Already on correct branch: {{target_branch}}`
89
+ - Proceed to Next Step.
56
90
 
57
91
  **IF Current Branch != Target Branch:**
58
- 1. Check if `target_branch` exists: `git branch --list {{target_branch}}`.
59
- 2. **IF Exists:**
60
- * Run `git checkout {{target_branch}}`.
61
- * Output: `🔄 Switched to existing branch: {{target_branch}}`.
62
- 3. **IF Not Exists:**
63
- * Run `git checkout -b {{target_branch}}`.
64
- * Output: `✨ Created and switched to new branch: {{target_branch}}`.
92
+ 1. Check if `target_branch` exists: `git branch --list {{target_branch}}`.
93
+ 2. **IF Exists:**
94
+ - Run `git checkout {{target_branch}}`.
95
+ - Output: `🔄 Switched to existing branch: {{target_branch}}`.
96
+ 3. **IF Not Exists:**
97
+ - Run `git checkout -b {{target_branch}}`.
98
+ - Output: `✨ Created and switched to new branch: {{target_branch}}`.
65
99
 
66
- ### 5. Validation Fallback
100
+ ### 6. Store Branch Context
67
101
 
68
- If `epics.md` is missing or Epic cannot be identified:
69
- 1. Ask user: "Could not detect Epic name for Story {{story_key}}. Please provide the target branch name or Epic name."
70
- 2. Wait for input and create/switch manually.
102
+ <action>
103
+ Store `target_branch` in workflow context for use in subsequent steps (commit, push).
104
+ </action>
71
105
 
72
- ### 6. Next Step
106
+ ### 7. Next Step
73
107
 
74
108
  Load, read entire file, then execute `{nextStepFile}` (`step-03-load-context.md`).
@@ -65,6 +65,7 @@ Check for and load company-specific technology standards:
65
65
  - `frontend-standards.md` - Frontend development patterns
66
66
  - `architecture-patterns.md` - Architectural decision patterns
67
67
  - `technical-preferences-ux.md` - UX/UI preferences
68
+ - `vite-config-standard.md` - Vite Config Standard
68
69
 
69
70
  **Priority Rules:**
70
71
 
@@ -79,7 +80,7 @@ When loading company standards, specifically look for and highlight:
79
80
  - 🔴 **siesa-ui-kit requirement** - Must check siesa-ui-kit before creating components
80
81
  - 🔴 **Spanish UI text** - All user-facing text must be in Spanish
81
82
  - 🔴 **DateTimeOffset** - Use DateTimeOffset not DateTime for PostgreSQL
82
- - Technology stack versions (.NET 10, Vite 6+, etc.)
83
+ - Technology stack versions (.NET 10, Vite 7+, etc.)
83
84
 
84
85
  Report: "✅ Estándares corporativos cargados: {count} archivos con {rules_count} reglas críticas"
85
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siesa-agents",
3
- "version": "2.1.53",
3
+ "version": "2.1.55",
4
4
  "description": "Paquete para instalar y configurar agentes SIESA en tu proyecto",
5
5
  "main": "index.js",
6
6
  "bin": {