pumuki 6.3.330 → 6.3.331

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.
@@ -25,6 +25,14 @@ type AuditSummaryNotificationDependencies = {
25
25
  env: NodeJS.ProcessEnv;
26
26
  };
27
27
 
28
+ type NotificationBlockingCause = {
29
+ code: string;
30
+ message: string;
31
+ ruleId?: string;
32
+ file?: string;
33
+ remediation?: string;
34
+ };
35
+
28
36
  const defaultDependencies: AuditSummaryNotificationDependencies = {
29
37
  readEvidence,
30
38
  emitSystemNotification,
@@ -62,6 +70,38 @@ const normalizeNotificationStage = (stage: string): PumukiNotificationStage => {
62
70
  return 'PRE_COMMIT';
63
71
  };
64
72
 
73
+ const normalizeRuleCode = (ruleId: string): string =>
74
+ ruleId
75
+ .replace(/^skills\./u, 'SKILLS_')
76
+ .replace(/[.-]/gu, '_')
77
+ .toUpperCase();
78
+
79
+ const extractNestedSkillCauseFromWrapper = (cause: NotificationBlockingCause): NotificationBlockingCause => {
80
+ if (cause.ruleId?.startsWith('skills.') || cause.code.startsWith('SKILLS_')) {
81
+ return cause;
82
+ }
83
+ const nested = cause.message.match(/\bBlocking causes:\s*1\)\s*(skills\.[a-z0-9_.-]+)\s+(.+?)$/iu);
84
+ if (!nested?.[1]) {
85
+ return cause;
86
+ }
87
+ const ruleId = nested[1];
88
+ const nestedMessage = nested[2]?.trim() || 'Skill violada.';
89
+ return {
90
+ ...cause,
91
+ code: normalizeRuleCode(ruleId),
92
+ ruleId,
93
+ message: `rule=${ruleId} message=${nestedMessage}`,
94
+ remediation:
95
+ cause.remediation && !/corrige la violaci[oó]n indicada/i.test(cause.remediation)
96
+ ? cause.remediation
97
+ : 'Corrige la violación de la skill indicada en el fichero afectado y vuelve a intentar el commit.',
98
+ };
99
+ };
100
+
101
+ const normalizeNotificationBlockingCause = (
102
+ cause: NotificationBlockingCause
103
+ ): NotificationBlockingCause => extractNestedSkillCauseFromWrapper(cause);
104
+
65
105
  export const shouldEmitAuditSummaryNotificationForStage = (
66
106
  stage: AuditSummaryNotificationStage,
67
107
  env: NodeJS.ProcessEnv = process.env
@@ -87,13 +127,15 @@ export const toAuditSummaryEventFromEvidence = (
87
127
  causeCode: primaryCause.code,
88
128
  causeMessage: formatEvidenceBlockingCause(primaryCause),
89
129
  remediation: primaryCause.remediation ?? 'Corrige la violación indicada y vuelve a intentar el commit.',
90
- blockingCauses: blockingCauses.map((cause) => ({
91
- code: cause.code,
92
- ruleId: cause.ruleId,
93
- file: cause.file,
94
- message: formatEvidenceBlockingCause(cause),
95
- remediation: cause.remediation,
96
- })),
130
+ blockingCauses: blockingCauses.map((cause) =>
131
+ normalizeNotificationBlockingCause({
132
+ code: cause.code,
133
+ ruleId: cause.ruleId,
134
+ file: cause.file,
135
+ message: formatEvidenceBlockingCause(cause),
136
+ remediation: cause.remediation,
137
+ })
138
+ ),
97
139
  };
98
140
  }
99
141
  return {
@@ -125,12 +167,14 @@ export const toAuditSummaryEventFromAiGate = (params: {
125
167
  causeCode: primaryViolation.code,
126
168
  causeMessage: primaryViolation.message,
127
169
  remediation: 'Corrige la violación indicada y vuelve a intentar el commit.',
128
- blockingCauses: params.aiGateResult.violations.map((violation) => ({
129
- code: violation.code,
130
- ruleId: violation.code,
131
- message: violation.message,
132
- remediation: 'Corrige la violación indicada y vuelve a intentar el commit.',
133
- })),
170
+ blockingCauses: params.aiGateResult.violations.map((violation) =>
171
+ normalizeNotificationBlockingCause({
172
+ code: violation.code,
173
+ ruleId: violation.code.startsWith('skills.') ? violation.code : undefined,
174
+ message: violation.message,
175
+ remediation: 'Corrige la violación indicada y vuelve a intentar el commit.',
176
+ })
177
+ ),
134
178
  };
135
179
  }
136
180
  return {
@@ -233,7 +277,7 @@ export const emitGateBlockedNotification = (
233
277
  causeMessage: params.causeMessage,
234
278
  }),
235
279
  remediation: params.remediation,
236
- blockingCauses: params.blockingCauses,
280
+ blockingCauses: params.blockingCauses?.map(normalizeNotificationBlockingCause),
237
281
  },
238
282
  repoRoot: params.repoRoot,
239
283
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.330",
3
+ "version": "6.3.331",
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": {