pumuki-ast-hooks 5.5.48 → 5.5.50

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.
@@ -9,131 +9,8 @@
9
9
 
10
10
  ---
11
11
 
12
- ## 📊 Executive Summary
13
- - **Current status:** ⚠️ Acción requerida (0 critical, 0 high, 33 medium, 515 low)
14
- - **Progress:** 673 548 violaciones (-125 tras correcciones y exclusiones afinadas)
15
- - **Branch:** `develop`
16
- - **Start date:** 2026-01-05**Overall ETA:** 2026-01-15
17
- - **Goal:** Mantener CRITICAL/HIGH en 0 y reducir MEDIUM/LOW priorizando impacto.
18
- - **Risks:**
19
- 1) Cambiar severities no elimina violaciones existentes, solo previene nuevas; 2) Mantener estabilidad de librería; 3) Evitar regressions en AST analysis.
20
-
21
- ### 🔧 Fix Aplicado: Detección de God Classes Masivas (2026-01-05)
22
-
23
- **Problema identificado:** Los archivos masivos de la propia librería (`ast-backend.js` 2061 líneas, `ast-core.js` 613 líneas, `ast-intelligence.js` 715 líneas, `audit-orchestrator.sh` 1188 líneas) NO estaban siendo detectados como God classes debido a exclusiones explícitas en el código.
24
-
25
- **Causas raíz:**
26
- 1. Exclusiones en `ast-backend.js` líneas 212-215 que saltaban archivos `/ast-[^/]+\.js$/`
27
- 2. Umbral absoluto `isAbsoluteGod` demasiado restrictivo (requería >600 líneas Y >30 métodos Y >80 complejidad)
28
- 3. Archivos shell no analizados por AST
29
-
30
- **Solución implementada:**
31
- - ✅ Eliminadas exclusiones en `ast-backend.js` (líneas 206-215)
32
- - ✅ Ajustado umbral híbrido: `>1000 líneas = God class automática`, `>500 líneas + complejidad = God class`
33
- - ✅ Añadida detección de God scripts en `text-scanner.js` para archivos `.sh/.bash/.zsh`
34
-
35
- **Resultado:**
36
- - God classes detectadas: 8 → **15** (+7)
37
- - Shell scripts detectados: 0 → **2** (god_script + large_script)
38
- - Total CRITICAL: 8 → **25**
39
-
40
- **Quick references:**
41
- - [Violations report](../.violations-by-priority.md)
42
- - [AST summary JSON](../ast-summary.json)
43
- - [Arquitectura](../ARCHITECTURE.md)
44
-
45
- ---
46
-
47
- ## 📅 Visual Timeline (estimated dates)
48
- ```mermaid
49
- gantt
50
- title Violations Resolution Phases
51
- dateFormat YYYY-MM-DD
52
- section Phase 1: BLOCKERS (CRITICAL + HIGH)
53
- Resolve CRITICAL :active, crit1, 2026-01-05, 3d
54
- Resolve HIGH :done, high1, after crit1, 1d
55
-
56
- section Phase 2: MEDIUM
57
- MEDIUM refactoring : med1, after high1, 7d
58
-
59
- section Phase 3: LOW
60
- Optimizations and documentation : low1, after med1, 5d
61
- ```
62
-
63
- ---
64
-
65
- ## 🔴 Phase 1: BLOCKER Violations (CRITICAL + HIGH)
66
- | Status | Severity | Count | Owner | DOD (Definition of Done) | Source |
67
- |--------|-----------|-------|-------------|--------------------------|--------|
68
- | ✅ | CRITICAL | 0 | Backend | Mantener CRITICAL en 0 | Audit 2026-01-06 13:56 |
69
- | ✅ | HIGH | 0 | Backend | Mantener HIGH en 0 | Audit 2026-01-06 13:56 |
70
-
71
- **CRITICAL/HIGH actuales:** Ninguna. Mantener vigilancia en nuevas reglas.
72
-
73
- **Fixes previos destacados:**
74
- - Detección de god classes y god scripts en analizadores/shell.
75
- - Ajustes de severidad para falsas alarmas (mocks en tests, custom_exceptions info, env_separation info, audit_logging info).
76
-
77
- ---
78
-
79
- ## 🟠 Phase 2: MEDIUM Violations (33)
80
- | Status | Violation | Count | Owner | DOD | Doc |
81
- |--------|-----------|-------|-------------|-----|-----|
82
- | ⏳ | MEDIUM | 33 | Backend | Reducir MEDIUM priorizando reglas de testing y observabilidad | [Medium violations](../docs/medium-violations.md) |
83
-
84
- **Top MEDIUM violations:**
85
- - `backend.error.custom_exceptions`: 108 violaciones
86
- - `backend.config.missing_env_separation`: 112 violaciones
87
- - `backend.metrics.missing_prometheus`: 79 violaciones
88
- - `backend.reliability.missing_bulkhead`: 57 violaciones
89
- - `backend.testing.mocks`: 40 violaciones
90
-
91
- ---
92
-
93
- ## 🔵 Phase 3: LOW Violations (602)
94
- | Status | Violation | Count | Owner | DOD | Doc |
95
- |--------|-----------|-------|-------------|-----|-----|
96
- | ⏳ | LOW | 602 | Backend | Reducir LOW con foco en patrones de desarrollo y documentación | [Low violations](../docs/low-violations.md) |
97
-
98
- ---
99
-
100
- ## 🎯 Top violations (by impact/prioridad actual)
101
- | Priority | Violation | Count | Notes |
102
- |----------|-----------|-------|------|
103
- | P0 | backend.config.missing_env_separation | 112 | Configuración sin separación por entorno |
104
- | P0 | backend.error.custom_exceptions | 108 | Excepciones personalizadas sin estructura |
105
- | P0 | backend.event.handler | 86 | Event handlers sin idempotencia garantizada |
106
- | P0 | backend.metrics.missing_prometheus | 79 | Métricas de aplicación faltantes |
107
- | P1 | backend.reliability.missing_bulkhead | 57 | Patrón de resiliencia faltante |
108
- | P1 | backend.testing.mocks | 40 | Uso de mocks en tests |
109
- | P1 | backend.observability.missing_prometheus | 37 | Métricas de observabilidad |
110
- | P1 | backend.auth.missing_cors | 25 | CORS no configurado |
111
- | P1 | backend.security.missing_audit_logging | 22 | Logging de auditoría faltante |
112
- | P1 | shell.maintainability.large_script | 1 | Script extenso en infraestructura |
113
-
114
- ---
115
-
116
- ## 📈 Progress Metrics
117
- | Phase | Total | Completed | % |
118
- |------|-------|------------|---|
119
- | BLOCKERS (CRITICAL + HIGH) | 0 | 0 | 0% |
120
- | MEDIUM | 33 | 0 | 0% |
121
- | LOW | 515 | 0 | 0% |
122
- | **TOTAL** | **548** | **0** | **0%** |
123
-
124
- **Updated risks:**
125
- 1) MEDIUM/LOW pueden requerir cambios más invasivos en la arquitectura; 2) Mantener compatibilidad backward en librería; 3) Evitar impacto en performance de análisis AST.
126
-
127
- **Collaborative notes:**
128
- - Actual scan (audit 2026-01-05 23:35): 645 violaciones (1 CRIT, 1 HIGH, 41 MED, 602 LOW) - reducidas de 673 (-28 total).
129
- - Falsos positivos corregidos: backend.security.plain_password, backend.performance.n_plus_one, backend.error.exposes, backend.error.empty_catch.
130
- - God scripts de infraestructura excluidos: audit-orchestrator, git-wrapper, gitflow-enforcer (-4 CRITICAL).
131
- - Analyzers/detectors/scanners/parsers excluidos de god classes: iOS/Android/Frontend analyzers, SourceKittenParser (-10 CRITICAL).
132
- - Services de infraestructura excluidos de god classes: EvidenceMonitor.js (-1 CRITICAL).
133
- - N+1 queries en infraestructura AST excluidos (-1 CRITICAL).
134
- - Archivos principales AST excluidos de god classes: ast-ios.js, ast-frontend.js, ast-backend.js, ast-android.js, text-scanner.js (sin cambios en conteo CRITICAL/HIGH).
135
- - MEDIUM violations reducidas de 47 a 41 (-6) como efecto secundario de las correcciones.
136
- - CRITICAL restantes: 1 (no identificado tras múltiples intentos de análisis y correcciones).
137
- - HIGH restantes: 1 (no identificado tras múltiples intentos de análisis y correcciones).
138
- - Foco siguiente: MEDIUM violations restantes (custom_exceptions, env_separation, prometheus).
139
- - Mantener `bash scripts/hooks-system/bin/update-evidence.sh --auto` tras fixes.
12
+ ## Tasks (by severity)
13
+ - 🔴 **CRITICAL** 11
14
+ - 🟠 **HIGH** 0
15
+ - ⏳ � **MEDIUM** — 34
16
+ - **LOW**501
@@ -42,6 +42,7 @@ function getGitStatus(projectDir: string): GitStatus | null {
42
42
  hasUncommittedChanges: lines.length > 0
43
43
  };
44
44
  } catch (err) {
45
+ console.error(`[git-status-monitor] Failed to read git status: ${(err as Error).message}`);
45
46
  return null;
46
47
  }
47
48
  }
@@ -79,6 +80,7 @@ function detectPlatformFromFiles(projectDir: string): string[] {
79
80
  }
80
81
  }
81
82
  } catch (err) {
83
+ console.error(`[git-status-monitor] Failed to detect platforms from files: ${(err as Error).message}`);
82
84
  }
83
85
 
84
86
  return platforms.length > 0 ? platforms : ['frontend', 'backend', 'ios', 'android'];
@@ -134,6 +136,7 @@ async function main() {
134
136
  sound: 'Ping'
135
137
  });
136
138
  } catch (err) {
139
+ console.error(`[git-status-monitor] Notification failed (staged): ${(err as Error).message}`);
137
140
  }
138
141
  } else if (totalChanges > 10) {
139
142
  try {
@@ -144,11 +147,13 @@ async function main() {
144
147
  sound: 'Glass'
145
148
  });
146
149
  } catch (err) {
150
+ console.error(`[git-status-monitor] Notification failed (unstaged): ${(err as Error).message}`);
147
151
  }
148
152
  }
149
153
 
150
154
  process.exit(0);
151
155
  } catch (err) {
156
+ console.error(`[git-status-monitor] Unexpected error: ${(err as Error).message}`);
152
157
  process.exit(0);
153
158
  }
154
159
  }
@@ -24,6 +24,7 @@ export function sendMacOSNotification(options: NotificationOptions): void {
24
24
  try {
25
25
  execSync(`osascript -e '${script}'`, { stdio: 'ignore' });
26
26
  } catch (err) {
27
+ console.error(`[notify-macos] Failed to send notification: ${(err as Error).message}`);
27
28
  }
28
29
  }
29
30
 
@@ -235,6 +235,7 @@ async function main() {
235
235
  sound: 'Basso'
236
236
  });
237
237
  } catch (err) {
238
+ process.stderr.write(`Notification failed: ${err instanceof Error ? err.message : String(err)}\n`);
238
239
  }
239
240
  process.stderr.write(`${validation.error || ''}\n`);
240
241
  process.exit(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.48",
3
+ "version": "5.5.50",
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": {
@@ -134,4 +134,4 @@
134
134
  "./skills": "./skills/skill-rules.json",
135
135
  "./hooks": "./hooks/index.js"
136
136
  }
137
- }
137
+ }
@@ -42,3 +42,71 @@
42
42
  {"timestamp":1767729940607,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
43
43
  {"timestamp":1767729940607,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
44
44
  {"timestamp":1767729940607,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
45
+ {"timestamp":1767733906067,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
46
+ {"timestamp":1767733906068,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
47
+ {"timestamp":1767733906068,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
48
+ {"timestamp":1767733906068,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
49
+ {"timestamp":1767736064942,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
50
+ {"timestamp":1767736064942,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
51
+ {"timestamp":1767736064942,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
52
+ {"timestamp":1767736064942,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
53
+ {"timestamp":1767736302382,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
54
+ {"timestamp":1767736302382,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
55
+ {"timestamp":1767736302382,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
56
+ {"timestamp":1767736302382,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
57
+ {"timestamp":1767737160652,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
58
+ {"timestamp":1767737160652,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
59
+ {"timestamp":1767737160652,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
60
+ {"timestamp":1767737160652,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
61
+ {"timestamp":1767737286027,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
62
+ {"timestamp":1767737286027,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
63
+ {"timestamp":1767737286027,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
64
+ {"timestamp":1767737286027,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
65
+ {"timestamp":1767737360415,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
66
+ {"timestamp":1767737360415,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
67
+ {"timestamp":1767737360415,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
68
+ {"timestamp":1767737360415,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
69
+ {"timestamp":1767737582187,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
70
+ {"timestamp":1767737582188,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
71
+ {"timestamp":1767737582188,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
72
+ {"timestamp":1767737582188,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
73
+ {"timestamp":1767737730369,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
74
+ {"timestamp":1767737730369,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
75
+ {"timestamp":1767737730369,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
76
+ {"timestamp":1767737730369,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
77
+ {"timestamp":1767738078809,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
78
+ {"timestamp":1767738078809,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
79
+ {"timestamp":1767738078809,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
80
+ {"timestamp":1767738078809,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
81
+ {"timestamp":1767738286461,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
82
+ {"timestamp":1767738286461,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
83
+ {"timestamp":1767738286461,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
84
+ {"timestamp":1767738286461,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
85
+ {"timestamp":1767738456212,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
86
+ {"timestamp":1767738456212,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
87
+ {"timestamp":1767738456212,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
88
+ {"timestamp":1767738456212,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
89
+ {"timestamp":1767738461405,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
90
+ {"timestamp":1767738461406,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
91
+ {"timestamp":1767738461406,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
92
+ {"timestamp":1767738461406,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
93
+ {"timestamp":1767739376705,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
94
+ {"timestamp":1767739376706,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
95
+ {"timestamp":1767739376706,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
96
+ {"timestamp":1767739376706,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
97
+ {"timestamp":1767739502661,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
98
+ {"timestamp":1767739502662,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
99
+ {"timestamp":1767739502662,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
100
+ {"timestamp":1767739502662,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
101
+ {"timestamp":1767739777882,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
102
+ {"timestamp":1767739777882,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
103
+ {"timestamp":1767739777882,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
104
+ {"timestamp":1767739777882,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
105
+ {"timestamp":1767772854432,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
106
+ {"timestamp":1767772854432,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
107
+ {"timestamp":1767772854432,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
108
+ {"timestamp":1767772854432,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
109
+ {"timestamp":1767772971939,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
110
+ {"timestamp":1767772971939,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
111
+ {"timestamp":1767772971939,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
112
+ {"timestamp":1767772971939,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
@@ -3,9 +3,11 @@ const AuditLogger = require('../logging/AuditLogger');
3
3
 
4
4
  class GuardConfig {
5
5
  constructor(env = envHelper) {
6
-
7
- this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });const getNumber = (name, def) =>
6
+ this.auditLogger = new AuditLogger({ repoRoot: process.cwd() });
7
+
8
+ const getNumber = (name, def) =>
8
9
  typeof env.getNumber === 'function' ? env.getNumber(name, def) : Number(env[name] || def);
10
+
9
11
  const getBool = (name, def) =>
10
12
  typeof env.getBool === 'function' ? env.getBool(name, def) : (env[name] !== 'false');
11
13
 
@@ -128,6 +128,20 @@ if [[ "$CURRENT_BRANCH" == "main" ]] || [[ "$CURRENT_BRANCH" == "master" ]] || [
128
128
  exit 1
129
129
  fi
130
130
 
131
+ # Enforce Git Flow checks (strict) before allowing commit
132
+ ENFORCER_SCRIPT="scripts/hooks-system/infrastructure/shell/gitflow/gitflow-enforcer.sh"
133
+ if [[ -f "$ENFORCER_SCRIPT" ]]; then
134
+ echo ""
135
+ echo "🔍 Running Git Flow checks (strict)..."
136
+ echo ""
137
+ if ! GITFLOW_STRICT_CHECK=true bash "$ENFORCER_SCRIPT" check; then
138
+ echo ""
139
+ echo "🚨 COMMIT BLOCKED: Git Flow checks failed"
140
+ echo ""
141
+ exit 1
142
+ fi
143
+ fi
144
+
131
145
  # Check if there are staged files
132
146
  STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null | grep -E '\\.(ts|tsx|js|jsx|swift|kt)$' || true)
133
147
  if [ -z "$STAGED_FILES" ]; then
@@ -263,10 +277,14 @@ fi
263
277
  # Run gitflow-enforcer if available (optional validation)
264
278
  ENFORCER_SCRIPT="scripts/hooks-system/infrastructure/shell/gitflow/gitflow-enforcer.sh"
265
279
  if [[ -f "$ENFORCER_SCRIPT" ]]; then
266
- if ! bash "$ENFORCER_SCRIPT" check 2>/dev/null; then
280
+ echo ""
281
+ echo "🔍 Running Git Flow checks (strict)..."
282
+ echo ""
283
+ if ! GITFLOW_STRICT_CHECK=true bash "$ENFORCER_SCRIPT" check; then
267
284
  echo ""
268
- echo "⚠️ Git Flow check completed with warnings (non-blocking)"
285
+ echo "🚨 PUSH BLOCKED: Git Flow checks failed"
269
286
  echo ""
287
+ exit 1
270
288
  fi
271
289
  fi
272
290
 
@@ -45,6 +45,18 @@ function getRepoRoot() {
45
45
  */
46
46
  function shouldIgnore(file) {
47
47
  const p = file.replace(/\\/g, "/");
48
+ try {
49
+ const configPaths = loadExclusions()?.exclusions?.paths;
50
+ if (configPaths && typeof configPaths === 'object') {
51
+ for (const [key, enabled] of Object.entries(configPaths)) {
52
+ if (enabled && p.includes(key)) return true;
53
+ }
54
+ }
55
+ } catch (error) {
56
+ if (process.env.DEBUG) {
57
+ console.debug(`[ast-core] Failed to load exclusions for shouldIgnore: ${error.message || String(error)}`);
58
+ }
59
+ }
48
60
  if (p.includes("node_modules/")) return true;
49
61
  if (p.includes("/.next/")) return true;
50
62
  if (p.includes("/dist/")) return true;
@@ -125,7 +137,7 @@ let exclusionsConfig = null;
125
137
  function loadExclusions() {
126
138
  if (exclusionsConfig) return exclusionsConfig;
127
139
  try {
128
- const configPath = path.join(__dirname, '../../config/ast-exclusions.json');
140
+ const configPath = path.join(getRepoRoot(), 'config', 'ast-exclusions.json');
129
141
  if (fs.existsSync(configPath)) {
130
142
  exclusionsConfig = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
131
143
  }
@@ -22,7 +22,7 @@ function formatLocalTimestamp(date = new Date()) {
22
22
  }
23
23
 
24
24
  const astModulesPath = __dirname;
25
- const { createProject, platformOf, mapToLevel } = require(path.join(astModulesPath, "ast-core"));
25
+ const { createProject, platformOf, mapToLevel, shouldIgnore: coreShouldIgnore } = require(path.join(astModulesPath, "ast-core"));
26
26
  const MacOSNotificationAdapter = require(path.join(__dirname, '../adapters/MacOSNotificationAdapter'));
27
27
  const { runBackendIntelligence } = require(path.join(astModulesPath, "backend/ast-backend"));
28
28
  const { runFrontendIntelligence } = require(path.join(astModulesPath, "frontend/ast-frontend"));
@@ -138,8 +138,6 @@ function runProjectHardcodedThresholdAudit(root, allFiles, findings) {
138
138
  if (p.includes('/build/')) return true;
139
139
  if (p.includes('/coverage/')) return true;
140
140
  if (p.includes('/.audit_tmp/')) return true;
141
- if (p.includes('/infrastructure/ast/')) return true;
142
- if (p.includes('/scripts/hooks-system/')) return true;
143
141
  return false;
144
142
  };
145
143
 
@@ -706,6 +704,7 @@ function listSourceFiles(root) {
706
704
  */
707
705
  function shouldIgnore(file) {
708
706
  const p = file.replace(/\\/g, "/");
707
+ if (typeof coreShouldIgnore === 'function' && coreShouldIgnore(p)) return true;
709
708
  if (p.includes("node_modules/")) return true;
710
709
  if (p.includes("/.cursor/")) return true;
711
710
  if (/\.bak/i.test(p)) return true;
@@ -126,13 +126,10 @@ function runBackendIntelligence(project, findings, platform) {
126
126
  return;
127
127
  }
128
128
  // NO excluir archivos AST - la librería debe auto-auditarse
129
- if (isTestFile(filePath)) return;
130
-
131
129
  sf.getDescendantsOfKind(SyntaxKind.ClassDeclaration).forEach((cls) => {
132
130
  const className = cls.getName() || '';
133
131
  const isValueObject = /Metrics|ValueObject|VO$|Dto$|Entity$/.test(className);
134
- const isTestClass = /Spec$|Test$|Mock/.test(className);
135
- if (isValueObject || isTestClass) return;
132
+ if (isValueObject) return;
136
133
 
137
134
  const methodsCount = cls.getMethods().length;
138
135
  const propertiesCount = cls.getProperties().length;
@@ -7,8 +7,7 @@ function analyzeGodClasses(sourceFile, findings, { SyntaxKind, pushFinding, godC
7
7
  sourceFile.getDescendantsOfKind(SyntaxKind.ClassDeclaration).forEach((cls) => {
8
8
  const className = cls.getName() || '';
9
9
  const isValueObject = /Metrics|ValueObject|VO$|Dto$|Entity$/.test(className);
10
- const isTestClass = /Spec$|Test$|Mock/.test(className);
11
- if (isValueObject || isTestClass) return;
10
+ if (isValueObject) return;
12
11
 
13
12
  const methodsCount = cls.getMethods().length;
14
13
  const propertiesCount = cls.getProperties().length;