pumuki 6.3.307 → 6.3.308

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.
@@ -13,16 +13,90 @@ export {
13
13
  resolveBlockedRemediation,
14
14
  } from './framework-menu-system-notifications-remediation';
15
15
 
16
+ type BlockedCause = NonNullable<
17
+ Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>['blockingCauses']
18
+ >[number];
19
+
20
+ const isSkillCause = (cause: BlockedCause): boolean => {
21
+ const ruleId = cause.ruleId ?? '';
22
+ const code = cause.code ?? '';
23
+ return ruleId.startsWith('skills.') || code.startsWith('SKILLS_');
24
+ };
25
+
26
+ const formatCauseLocation = (cause: BlockedCause): string => {
27
+ if (!cause.file) {
28
+ return 'sin fichero';
29
+ }
30
+ const baseFile = cause.file.split('/').filter(Boolean).pop() ?? cause.file;
31
+ const lineMatch = cause.message.match(/\blines?=([0-9][0-9,\-\s]*)\b/i);
32
+ if (!lineMatch?.[1]) {
33
+ return baseFile;
34
+ }
35
+ return `${baseFile}:${lineMatch[1].replace(/\s+/g, '')}`;
36
+ };
37
+
38
+ const formatCauseRule = (cause: BlockedCause): string => cause.ruleId ?? cause.code;
39
+
40
+ export const resolvePrioritizedBlockingCauses = (
41
+ causes: Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>['blockingCauses']
42
+ ): ReadonlyArray<BlockedCause> => {
43
+ if (!causes || causes.length === 0) {
44
+ return [];
45
+ }
46
+ return [...causes].sort((left, right) => {
47
+ const leftSkill = isSkillCause(left);
48
+ const rightSkill = isSkillCause(right);
49
+ if (leftSkill !== rightSkill) {
50
+ return leftSkill ? -1 : 1;
51
+ }
52
+ return 0;
53
+ });
54
+ };
55
+
56
+ const buildBlockingCausesSummary = (
57
+ causes: Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>['blockingCauses']
58
+ ): string | null => {
59
+ const prioritized = resolvePrioritizedBlockingCauses(causes);
60
+ if (prioritized.length === 0) {
61
+ return null;
62
+ }
63
+ const first = prioritized[0];
64
+ if (!first) {
65
+ return null;
66
+ }
67
+ const prefix = isSkillCause(first) ? 'Skill violada' : 'Causa bloqueante';
68
+ const overflow = prioritized.length > 1 ? ` (+${prioritized.length - 1} más)` : '';
69
+ return `${prefix}: ${formatCauseRule(first)} · ${formatCauseLocation(first)}${overflow}`;
70
+ };
71
+
72
+ const buildBlockingCausesRemediation = (
73
+ causes: Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>['blockingCauses']
74
+ ): string | null => {
75
+ const prioritized = resolvePrioritizedBlockingCauses(causes);
76
+ if (prioritized.length === 0) {
77
+ return null;
78
+ }
79
+ const first = prioritized[0];
80
+ if (!first) {
81
+ return null;
82
+ }
83
+ const remediation =
84
+ first.remediation ??
85
+ 'Corrige la violación indicada con regla, fichero y línea, y vuelve a ejecutar el gate.';
86
+ return `${remediation} Revisa el reporte completo para el resto de causas bloqueantes.`;
87
+ };
88
+
16
89
  export const buildGateBlockedPayload = (
17
90
  event: Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>,
18
91
  projectPrefix: string
19
92
  ): SystemNotificationPayload => {
20
93
  const causeCode = event.causeCode ?? 'GATE_BLOCKED';
21
94
  const causeSummary = truncateNotificationText(
22
- resolveBlockedCauseSummary(event, causeCode),
95
+ buildBlockingCausesSummary(event.blockingCauses) ?? resolveBlockedCauseSummary(event, causeCode),
23
96
  72
24
97
  );
25
- const remediation = resolveBlockedRemediation(event, causeCode);
98
+ const remediation =
99
+ buildBlockingCausesRemediation(event.blockingCauses) ?? resolveBlockedRemediation(event, causeCode);
26
100
  return {
27
101
  title: '🔴 Pumuki bloqueado',
28
102
  subtitle: `${projectPrefix}${event.stage} · ${causeSummary}`,
@@ -27,6 +27,7 @@ export {
27
27
  } from './framework-menu-system-notifications-payloads-audit';
28
28
  export {
29
29
  buildGateBlockedPayload,
30
+ resolvePrioritizedBlockingCauses,
30
31
  } from './framework-menu-system-notifications-payloads-blocked';
31
32
  export {
32
33
  buildEvidenceStalePayload,
package/skills.lock.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "1.0",
3
3
  "compilerVersion": "1.0.0",
4
- "generatedAt": "2026-05-19T20:42:51.075Z",
4
+ "generatedAt": "2026-05-19T21:32:21.704Z",
5
5
  "bundles": [
6
6
  {
7
7
  "name": "android-guidelines",