pumuki-ast-hooks 5.3.19 → 5.3.21

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.
Files changed (46) hide show
  1. package/docs/RELEASE_NOTES.md +35 -0
  2. package/docs/VIOLATIONS_RESOLUTION_PLAN.md +64 -60
  3. package/package.json +9 -3
  4. package/scripts/hooks-system/.AI_TOKEN_STATUS.txt +1 -1
  5. package/scripts/hooks-system/.audit-reports/notifications.log +935 -0
  6. package/scripts/hooks-system/.audit-reports/token-monitor.log +2809 -0
  7. package/scripts/hooks-system/application/CompositionRoot.js +38 -22
  8. package/scripts/hooks-system/application/services/DynamicRulesLoader.js +2 -1
  9. package/scripts/hooks-system/application/services/GitTreeState.js +2 -1
  10. package/scripts/hooks-system/application/services/PlaybookRunner.js +1 -1
  11. package/scripts/hooks-system/application/services/RealtimeGuardService.js +71 -14
  12. package/scripts/hooks-system/application/services/guard/GuardAutoManagerService.js +31 -2
  13. package/scripts/hooks-system/application/services/guard/GuardConfig.js +17 -9
  14. package/scripts/hooks-system/application/services/guard/GuardHeartbeatMonitor.js +6 -9
  15. package/scripts/hooks-system/application/services/guard/GuardProcessManager.js +23 -0
  16. package/scripts/hooks-system/application/services/installation/GitEnvironmentService.js +1 -1
  17. package/scripts/hooks-system/application/services/installation/HookInstaller.js +62 -5
  18. package/scripts/hooks-system/application/services/installation/McpConfigurator.js +2 -1
  19. package/scripts/hooks-system/application/services/logging/AuditLogger.js +0 -4
  20. package/scripts/hooks-system/application/services/logging/UnifiedLogger.js +13 -4
  21. package/scripts/hooks-system/application/services/monitoring/EvidenceMonitorService.js +4 -3
  22. package/scripts/hooks-system/application/services/token/TokenMetricsService.js +2 -1
  23. package/scripts/hooks-system/bin/cli.js +15 -1
  24. package/scripts/hooks-system/bin/guard-env.sh +18 -38
  25. package/scripts/hooks-system/bin/guard-supervisor.js +5 -515
  26. package/scripts/hooks-system/bin/session-loader.sh +3 -262
  27. package/scripts/hooks-system/bin/start-guards.sh +21 -184
  28. package/scripts/hooks-system/bin/update-evidence.sh +10 -1161
  29. package/scripts/hooks-system/config/project.config.json +1 -1
  30. package/scripts/hooks-system/domain/events/index.js +32 -6
  31. package/scripts/hooks-system/domain/exceptions/index.js +87 -0
  32. package/scripts/hooks-system/infrastructure/ast/android/analyzers/AndroidAnalysisOrchestrator.js +3 -2
  33. package/scripts/hooks-system/infrastructure/ast/ast-core.js +12 -20
  34. package/scripts/hooks-system/infrastructure/ast/ast-intelligence.js +8 -18
  35. package/scripts/hooks-system/infrastructure/ast/backend/analyzers/BackendPatternDetector.js +2 -1
  36. package/scripts/hooks-system/infrastructure/ast/backend/ast-backend.js +10 -8
  37. package/scripts/hooks-system/infrastructure/ast/frontend/ast-frontend.js +196 -196
  38. package/scripts/hooks-system/infrastructure/ast/ios/analyzers/iOSASTIntelligentAnalyzer.js +3 -2
  39. package/scripts/hooks-system/infrastructure/config/config.js +5 -0
  40. package/scripts/hooks-system/infrastructure/hooks/skill-activation-prompt.js +3 -2
  41. package/scripts/hooks-system/infrastructure/logging/UnifiedLoggerFactory.js +5 -4
  42. package/scripts/hooks-system/infrastructure/mcp/ast-intelligence-automation.js +88 -0
  43. package/scripts/hooks-system/infrastructure/orchestration/intelligent-audit.js +17 -16
  44. package/scripts/hooks-system/infrastructure/telemetry/metric-scope.js +98 -0
  45. package/scripts/hooks-system/infrastructure/telemetry/metrics-server.js +3 -2
  46. package/scripts/hooks-system/infrastructure/validators/enforce-english-literals.js +6 -8
@@ -34,6 +34,41 @@ npm run install-hooks
34
34
 
35
35
  ---
36
36
 
37
+ # Release Notes - v5.3.20
38
+
39
+ **Release Date**: December 31, 2025
40
+ **Type**: Patch Release (compatible with 5.3.x)
41
+ **Compatibility**: Fully backward compatible with 5.3.x
42
+
43
+ ---
44
+
45
+ ## 🎯 Overview
46
+ - Removed runtime side-effects in the library: Express/CORS stripped from entry point; `dotenv.config()` removed from config.
47
+ - Fixed syntax in `ast-backend.js` (test block) to ensure lint/parse correctness.
48
+ - Published npm `pumuki-ast-hooks@5.3.20` (tag `latest`).
49
+
50
+ ---
51
+
52
+ ## 🐛 Bug Fixes
53
+
54
+ ### Fixed: Runtime side-effects
55
+ - **Issue**: Library had runtime side-effects due to Express/CORS and `dotenv.config()`.
56
+ - **Resolution**: Removed Express/CORS from entry point and `dotenv.config()` from config.
57
+ - **Impact**: Library no longer has runtime side-effects.
58
+
59
+ ### Fixed: Syntax in `ast-backend.js`
60
+ - **Issue**: Syntax error in `ast-backend.js` (test block) caused lint/parse issues.
61
+ - **Resolution**: Fixed syntax in `ast-backend.js` (test block).
62
+ - **Impact**: `ast-backend.js` now lint/parse correct.
63
+
64
+ ---
65
+
66
+ ## 📚 Documentation
67
+ - CHANGELOG updated with 5.3.20.
68
+ - Installation notes reviewed for safe npm consumption.
69
+
70
+ ---
71
+
37
72
  # Release Notes - v5.3.9
38
73
 
39
74
  **Release Date**: December 29, 2025
@@ -1,93 +1,97 @@
1
- # 🚀 Plan de Resolución de Violaciones - ast-intelligence-hooks
1
+ # 🚀 Violations Resolution Plan - ast-intelligence-hooks
2
2
 
3
- ## 🧭 Leyenda de Estado (viva)
4
- - ✅ **Hecho** (tarea completada exitosamente)
5
- - 🚧 **En construcción** (tarea en progreso)
6
- - ⏳ **Pendiente** (tarea aún no iniciada)
7
- - ❌ **Bloqueada** (tarea impedida por dependencias o problemas externos)
8
- - 🔄 **Revisión** (tarea completada pero pendiente de verificación o ajustes)
3
+ ## 🧭 Status Legend (living)
4
+ - ✅ **Done** (task completed successfully)
5
+ - 🚧 **In progress** (task currently being worked on)
6
+ - ⏳ **Pending** (task not started yet)
7
+ - ❌ **Blocked** (task blocked by dependencies or external issues)
8
+ - 🔄 **Review** (completed but pending verification/adjustments)
9
9
 
10
10
  ---
11
11
 
12
- ## 📊 Resumen Ejecutivo
13
- - **Estado actual:** ⚠️ Acción requerida (91 críticas, 0 altas, 30 medias, 14 bajas)
14
- - **Branch:** `fix/audit-staged-severity-case-insensitive`
15
- - **Fecha de inicio:** 30/12/2025 — **ETA general:** 15/01/2026
16
- - **Objetivo:** Reducir a 0 las CRÍTICAS/HIGH y bajar el total < 20 antes de permitir commits sin bypass.
17
- - **Riesgos:**
18
- 1) Complejidad al refactorizar excepciones; 2) Dependencias entre módulos/config; 3) Tiempo limitado para instrumentación (Prometheus / audit logging).
12
+ ## 📊 Executive Summary
13
+ - **Current status:** ⚠️ Action required (211 critical, 5 high, 122 medium, 185 low)
14
+ - **Branch:** `feature/add-prometheus-metrics`
15
+ - **Start date:** 2025-12-30 — **Overall ETA:** 2026-01-15
16
+ - **Goal:** Reduce CRITICAL/HIGH to 0 and bring total < 20 before allowing commits without bypass.
17
+ - **Risks:**
18
+ 1) Exception refactor complexity; 2) Cross-module/config dependencies; 3) Limited time for instrumentation (Prometheus / audit logging).
19
19
 
20
- **Referencias rápidas:**
20
+ **Quick references:**
21
21
  - [Violations report](../.violations-by-priority.md)
22
22
  - [AST summary JSON](../.audit-reports/latest_ast_summary.json)
23
23
  - [Arquitectura](../ARCHITECTURE.md)
24
24
 
25
25
  ---
26
26
 
27
- ## 📅 Timeline Visual (fechas estimadas)
27
+ ## 📅 Visual Timeline (estimated dates)
28
28
  ```mermaid
29
29
  gantt
30
- title Fases de Resolución de Violaciones
30
+ title Violations Resolution Phases
31
31
  dateFormat YYYY-MM-DD
32
- section Fase 1: CRÍTICAS
33
- Excepciones personalizadas :active, crit1, 2025-12-30, 4d
34
- Separación de entornos : crit2, after crit1, 3d
35
- Auditoría de seguridad : crit3, after crit2, 3d
36
- Métricas Prometheus : crit4, after crit3, 2d
37
- Patrones de confiabilidad : crit5, after crit4, 2d
32
+ section Phase 1: BLOCKERS (CRITICAL + HIGH)
33
+ Resolve CRITICAL :active, crit1, 2025-12-30, 1d
34
+ Resolve HIGH : high1, after crit1, 2d
38
35
 
39
- section Fase 2: HIGH + MEDIUM
40
- Corrección HIGH : high1, after crit5, 1d
41
- Refactorización MEDIUM : med1, after high1, 5d
36
+ section Phase 2: MEDIUM
37
+ MEDIUM refactoring : med1, after high1, 7d
42
38
 
43
- section Fase 3: LOW
44
- Optimizaciones y documentación : low1, after med1, 5d
39
+ section Phase 3: LOW
40
+ Optimizations and documentation : low1, after med1, 5d
45
41
  ```
46
42
 
47
43
  ---
48
44
 
49
- ## 🔴 Fase 1: Violaciones CRÍTICAS (91)
50
- | Estado | Violación | Cant. | Responsable | DOD (Definition of Done) | Doc |
51
- |--------|-----------|-------|-------------|--------------------------|-----|
52
- | 🚧 | backend.observability.missing_prometheus | 45 | BE | Añadir métricas Prometheus a todos los servicios críticos; endpoints /metrics funcionando | [Prometheus](../docs/metrics-monitoring.md) |
53
- | ⏳ | backend.config.missing_env_separation | 27 | BE | Config por entorno (dev/stg/prod), sin secretos hardcode | [Config entornos](../docs/env-configuration.md) |
54
- | ⏳ | backend.security.missing_audit_logging | 23 | BE | Audit trail en operaciones sensibles + logs estructurados | [Audit logging](../docs/security-auditing.md) |
55
- | ⏳ | backend.error.custom_exceptions | 16 | BE | CustomError base + reemplazo de `Error` genérico en BE; tests pasando | [Guía de excepciones](../docs/error-handling.md) |
56
- | ⏳ | backend.reliability.missing_bulkhead | 10 | BE | Limitadores/aislamiento en puntos críticos + pruebas de carga | [Reliability](../docs/reliability-patterns.md) |
57
- | ⏳ | backend.event.emitter | 4 | BE | try/catch en manejadores de eventos; manejo de errores robusto | [Eventos](../docs/event-handling.md) |
58
- | ⏳ | backend.observability.missing_alerting | 3 | SRE | Alertas en métricas críticas; umbrales definidos | [Alerting](../docs/alerting-system.md) |
59
- | ⏳ | backend.config.missing_validation | 1 | BE | Validación de configuración al inicio | [Config validation](../docs/config-validation.md) |
60
- | ⏳ | backend.config.missing_env_validation | 1 | BE | Validación de variables de entorno requeridas | [Env validation](../docs/env-validation.md) |
61
- | ⏳ | backend.database.raw_sql | 1 | BE | Uso de ORM en lugar de raw SQL | [Database](../docs/database-layer.md) |
45
+ ## 🔴 Phase 1: BLOCKER Violations (CRITICAL + HIGH)
46
+ | Status | Severity | Count | Owner | DOD (Definition of Done) | Source |
47
+ |--------|-----------|-------|-------------|--------------------------|--------|
48
+ | | CRITICAL | 211 | BE | Resolve CRITICAL violations in repository (0 CRITICAL to unblock) | `.audit_tmp/ast-summary.json` / `.violations-by-priority.md` |
49
+ | ⏳ | HIGH | 5 | BE | Resolve HIGH violations in repository (0 HIGH to unblock) | `.audit_tmp/ast-summary.json` / `.violations-by-priority.md` |
62
50
 
63
51
  ---
64
52
 
65
- ## 🟠 Fase 2: Violaciones HIGH + MEDIUM (30)
66
- | Estado | Violación | Cant. | Responsable | DOD | Doc |
53
+ ## 🟠 Phase 2: MEDIUM Violations (122)
54
+ | Status | Violation | Count | Owner | DOD | Doc |
67
55
  |--------|-----------|-------|-------------|-----|-----|
68
- | | HIGH | 0 | BE | No aplica (repo JS puro sin TS); se documenta enfoque de seguridad de tipos | [Type safety](../docs/type-safety.md) |
69
- | ⏳ | MEDIUM | 30 | BE | Resolver violaciones de complejidad media restantes | [Medium violations](../docs/medium-violations.md) |
56
+ | | MEDIUM | 122 | BE | Resolve remaining medium-complexity violations | [Medium violations](../docs/medium-violations.md) |
70
57
 
71
58
  ---
72
59
 
73
- ## 🔵 Fase 3: Violaciones LOW (14)
74
- | Estado | Violación | Cant. | Responsable | DOD | Doc |
60
+ ## 🔵 Phase 3: LOW Violations (185)
61
+ | Status | Violation | Count | Owner | DOD | Doc |
75
62
  |--------|-----------|-------|-------------|-----|-----|
76
- | ⏳ | LOW | 14 | BE/FE | Resolver violaciones de baja prioridad restantes | [Low violations](../docs/low-violations.md) |
63
+ | ⏳ | LOW | 185 | BE/FE | Resolve remaining low-priority violations | [Low violations](../docs/low-violations.md) |
77
64
 
78
65
  ---
79
66
 
80
- ## 📈 Métricas de Progreso
81
- | Fase | Total | Completado | % |
82
- |------|-------|------------|---|
83
- | CRÍTICAS | 91 | 0 | 0% |
84
- | HIGH + MEDIUM | 30 | 0 | 0% |
85
- | LOW | 14 | 0 | 0% |
86
- | **TOTAL** | **135** | **0** | **0%** |
67
+ ## 🎯 Top violations (by volume / impact) — to prioritize within MEDIUM/LOW
68
+ | Priority | Violation | Count | Notes |
69
+ |----------|-----------|-------|------|
70
+ | P1 | backend.error.custom_exceptions | 105 | Typically MEDIUM: refactor to CustomError + replace generic `Error` in backend |
71
+ | P1 | backend.config.missing_env_separation | 81 | Typically MEDIUM: environment-specific config separation |
72
+ | P1 | backend.security.missing_audit_logging | 69 | Typically MEDIUM: audit trail for sensitive operations |
73
+ | P2 | backend.metrics.missing_prometheus | 42 | MEDIUM/LOW depending on rule: service instrumentation |
74
+ | P2 | backend.reliability.missing_bulkhead | 41 | MEDIUM/LOW: bulkheads/timeouts in critical paths |
75
+ | P2 | backend.testing.mocks | 40 | MEDIUM: improve testing strategy |
76
+ | P2 | backend.observability.missing_prometheus | 30 | LOW: observability and dashboards |
77
+ | P3 | backend.event.handler | 26 | LOW: try/catch and resilience |
78
+ | P3 | backend.auth.missing_cors | 17 | LOW: CORS/headers |
79
+ | P3 | backend.event.emitter | 14 | LOW: safe event emitters |
87
80
 
88
- **Riesgos actualizados:**
89
- 1) Implementación de Prometheus podría requerir cambios de infra; 2) Revisión de seguridad depende de disponibilidad de equipo; 3) Refactorizaciones pueden impactar tiempos.
81
+ ---
90
82
 
91
- **Comentarios/Notas colaborativas:**
92
- - Añade comentarios bajo cada tabla al cerrar tareas (usa la leyenda para actualizar estados).
93
- - Progreso en métricas Prometheus: añadidas a 27 servicios, pero 45 violaciones restantes indican necesidad de más instrumentación.
83
+ ## 📈 Progress Metrics
84
+ | Phase | Total | Completed | % |
85
+ |------|-------|------------|---|
86
+ | BLOCKERS (CRITICAL + HIGH) | 216 | 0 | 0% |
87
+ | MEDIUM | 122 | 0 | 0% |
88
+ | LOW | 185 | 0 | 0% |
89
+ | **TOTAL** | **523** | **0** | **0%** |
90
+
91
+ **Updated risks:**
92
+ 1) Prometheus implementation may require infra changes; 2) Security review depends on team availability; 3) Refactors may impact timelines.
93
+
94
+ **Collaborative notes:**
95
+ - Add notes under each table when closing tasks (use the legend to update status).
96
+ - Progress on Prometheus metrics: automatic sweep applied over `scripts/hooks-system/application/services/**`; the audit still reports 42 (`backend.metrics.missing_prometheus`) and 30 (`backend.observability.missing_prometheus`) pending.
97
+ - Last scan (31/12/2025 10:39): 451 files, 523 total violations (211 critical, 5 high, 122 medium, 185 low).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.3.19",
3
+ "version": "5.3.21",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "hook-plan-review": "./bin/plan-review.js"
21
21
  },
22
22
  "scripts": {
23
- "install-hooks": "npx ast-install",
23
+ "install-hooks": "node bin/install.js",
24
24
  "check-version": "node bin/check-version.js",
25
25
  "audit": "node bin/ast",
26
26
  "ast": "node bin/ast",
@@ -86,10 +86,16 @@
86
86
  "ts-morph": "^21.0.0"
87
87
  },
88
88
  "devDependencies": {
89
+ "@babel/generator": "^7.28.5",
90
+ "@babel/parser": "^7.28.5",
91
+ "@babel/traverse": "^7.28.5",
89
92
  "@pumuki/ast-intelligence-hooks": "file:pumuki-ast-intelligence-hooks-5.3.1.tgz",
90
93
  "@types/node": "^20.10.0",
91
94
  "eslint": "^9.12.0",
92
95
  "jest": "^30.2.0",
96
+ "jscodeshift": "^17.3.0",
97
+ "pumuki-ast-hooks": "^5.3.19",
98
+ "recast": "^0.23.11",
93
99
  "typescript": "^5.3.0"
94
100
  },
95
101
  "files": [
@@ -116,4 +122,4 @@
116
122
  "./skills": "./skills/skill-rules.json",
117
123
  "./hooks": "./hooks/index.js"
118
124
  }
119
- }
125
+ }
@@ -12,5 +12,5 @@ Source: file
12
12
 
13
13
  ℹ️ Data is stale. Ensure guards are running and refreshing token usage.
14
14
 
15
- Last updated: 2025-12-30T08:58:22.226Z
15
+ Last updated: 2026-01-02T08:34:46.296Z
16
16
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━