v1.31.0
hookPostToolUse[Bash]informa

quality-alert

Alertar si muchos warnings o deuda tecnica

PostToolUseevento
Bashmatcher
informapolítica
10 stimeout
2026-09-22último cambio

Qué comprueba

La cabecera del fichero no describe el comportamiento (la higiene de fuentes lo señala).

Códigos de salida

ExitSignificado
0siempre (informativo)

Política

Informa: nunca bloquea.

ClaveTipoDefaultQué hace
hooks.policystring"warn"WARN-first por defecto (avisan sin bloquear); 'block' eleva todos los hooks defensivos a bloqueo. Los hooks intrinsecamente BLOCK (bash-guard, protect-files certs/keys, hilo-json-guard) no se degradan nunca.
hooks.blockListarray[]Hooks concretos elevados a BLOCK aunque policy=warn (ej. ['secret-scanner']).

Código fuente

quality-alert.js · 53 líneas
// quality-alert.js - Alertar si muchos warnings o deuda tecnica
// Evento: PostToolUse[Bash] · Exit 0 = siempre (informativo)

'use strict';

const path = require('path');
const h = require(path.join(__dirname, 'lib', 'helpers'));

try {
  const hookData = h.readHookInput();
  const command = h.getToolInput(hookData);
  if (!command) process.exit(0);

  const output = h.getToolOutput(hookData) || '';

  if (!/dotnet\s+build/i.test(command)) process.exit(0);

  const count = (rx) => (output.match(rx) || []).length;
  const nullableWarnings = count(/warning CS86\d{2}/gi);
  const obsoleteWarnings = count(/warning CS0618|warning CS0619/gi);
  const analyzerWarnings = count(/warning IDE\d{4}|warning CA\d{4}/gi);
  const totalWarnings = count(/warning (CS|IDE|CA)\d{4}/gi);

  if (nullableWarnings > 20) {
    console.log(h.txt(`CALIDAD: ${nullableWarnings} warnings de nullable reference types. Considerar activar <Nullable>enable</Nullable> y corregir.`,
                  `QUALITY: ${nullableWarnings} nullable reference type warnings. Consider turning on <Nullable>enable</Nullable> and fixing them.`));
  }
  if (obsoleteWarnings > 5) {
    console.log(h.txt(`CALIDAD: ${obsoleteWarnings} APIs obsoletas detectadas. Planificar actualizacion.`,
                  `QUALITY: ${obsoleteWarnings} obsolete APIs found. Plan the upgrade.`));
  }
  if (analyzerWarnings > 15) {
    console.log(h.txt(`CALIDAD: ${analyzerWarnings} warnings de analyzers. Ejecutar ${h.cmd('clean')} para limpieza sistematica.`,
                  `QUALITY: ${analyzerWarnings} analyzer warnings. Run ${h.cmd('clean')} for a systematic cleanup.`));
  }
  if (totalWarnings > 50) {
    console.log(h.txt(`CALIDAD CRITICA: ${totalWarnings} warnings totales. El proyecto necesita una sesion de limpieza con ${h.cmd('clean')}.`,
                  `QUALITY, CRITICAL: ${totalWarnings} warnings in total. The project needs a cleanup session with ${h.cmd('clean')}.`));
  }

  const todoCount = count(/TODO|HACK|FIXME/g);
  if (todoCount > 0) {
    console.log(h.txt(`DEUDA TECNICA: ${todoCount} TODO/HACK/FIXME encontrados en output del build.`,
                  `TECHNICAL DEBT: ${todoCount} TODO/HACK/FIXME found in the build output.`));
  }

  process.exit(0);
} catch (err) {
  console.error(h.txt(`quality-alert.js: error inesperado, continuando. Detalle: ${err.message}`,
                    `quality-alert.js: unexpected error, continuing. Detail: ${err.message}`));
  process.exit(0);
}

Historial

5 cambios · 2026-09-07 → 2026-09-22. Último cambio: fix(vocabulario): no hay comandos (ADR-077).

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/.claude/hooks/quality-alert.jsCopyright 2026 Hugo Valer Rojas · Apache-2.0