pumuki-ast-hooks 5.5.48 → 5.5.49
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
|
-
##
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- **
|
|
16
|
-
-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki-ast-hooks",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.49",
|
|
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,63 @@
|
|
|
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"}
|
|
@@ -235,6 +235,28 @@ function toRepoRelativePath(filePath) {
|
|
|
235
235
|
return normalized;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
function isAuditTmpPath(repoRelativePath) {
|
|
239
|
+
const normalized = normalizePathForMatch(repoRelativePath);
|
|
240
|
+
return normalized.startsWith('.audit_tmp/') || normalized.includes('/.audit_tmp/');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function isViolationInStagedFiles(violationPath, stagedSet) {
|
|
244
|
+
if (!violationPath) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const repoRelative = toRepoRelativePath(violationPath);
|
|
249
|
+
if (!repoRelative) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (isAuditTmpPath(repoRelative)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return stagedSet.has(repoRelative);
|
|
258
|
+
}
|
|
259
|
+
|
|
238
260
|
function resolveAuditTmpDir() {
|
|
239
261
|
const configured = (env.get('AUDIT_TMP', '') || '').trim();
|
|
240
262
|
if (configured.length > 0) {
|
|
@@ -273,18 +295,7 @@ async function runIntelligentAudit() {
|
|
|
273
295
|
|
|
274
296
|
const stagedViolations = rawViolations.filter(v => {
|
|
275
297
|
const violationPath = toRepoRelativePath(v.filePath || v.file || '');
|
|
276
|
-
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
if (stagedSet.has(violationPath)) {
|
|
280
|
-
return true;
|
|
281
|
-
}
|
|
282
|
-
for (const sf of stagedSet) {
|
|
283
|
-
if (sf && (violationPath === sf || violationPath.endsWith('/' + sf) || violationPath.includes('/' + sf))) {
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return false;
|
|
298
|
+
return isViolationInStagedFiles(violationPath, stagedSet);
|
|
288
299
|
});
|
|
289
300
|
|
|
290
301
|
console.log(`[Intelligent Audit] Gate scope: STAGING (${stagedFiles.length} files)`);
|
|
@@ -683,4 +694,4 @@ if (require.main === module) {
|
|
|
683
694
|
});
|
|
684
695
|
}
|
|
685
696
|
|
|
686
|
-
module.exports = { runIntelligentAudit };
|
|
697
|
+
module.exports = { runIntelligentAudit, isViolationInStagedFiles, toRepoRelativePath };
|