pumuki 6.3.330 → 6.3.332

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.
@@ -641,7 +641,7 @@ const hasTrackForMemoryLeaksPattern = (content: string): boolean =>
641
641
  const IOS_CRITICAL_TEST_QUALITY_RULE_ID = 'skills.ios.critical-test-quality';
642
642
 
643
643
  const hasIosTestQualityScope = (facts: ReadonlyArray<Fact>): boolean =>
644
- collectIosTestFileContents(facts).some((testFile) => isXCTestSource(testFile.content));
644
+ collectIosTestFileContents(facts).length > 0;
645
645
 
646
646
  const appendUniqueRuleId = (
647
647
  ruleIds: ReadonlyArray<string>,
@@ -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.332",
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": {
@@ -248,6 +248,7 @@ const formatPlatformName = (platform: string | null): string =>
248
248
  const extractSkillsContractPlatform = (message: string): string | null =>
249
249
  message.match(/\bplatforms?=([a-z0-9_,.-]+)/i)?.[1]?.split(',')[0]?.trim()
250
250
  ?? message.match(/\b(ios|android|frontend|backend)\(missing_critical_rule_ids=/i)?.[1]?.trim()
251
+ ?? message.match(/\bskills\.(ios|android|frontend|backend)\./i)?.[1]?.trim()
251
252
  ?? message.match(/\bfor\s+(ios|android|frontend|backend)\s*:/i)?.[1]?.trim()
252
253
  ?? null;
253
254
 
@@ -261,6 +262,9 @@ const extractSkillsContractRules = (message: string): string | null => {
261
262
  const SKILLS_CONTRACT_REMEDIATION =
262
263
  'Actualiza o reconcilia el contrato de skills de Pumuki y vuelve a intentar el commit. Si ya estás en la última versión, es un bug del motor de Pumuki y debe corregirse allí antes de cerrar el commit.';
263
264
 
265
+ const SKILLS_CONTRACT_DIALOG_REMEDIATION =
266
+ 'Corrige el contrato de skills indicado arriba y vuelve a intentar el commit.';
267
+
264
268
  const WORKTREE_HYGIENE_REMEDIATION =
265
269
  'Reduce el worktree pendiente a un slice atómico: stagea solo la tarea activa o guarda el resto en stash nombrado, y reejecuta PRE_WRITE.';
266
270
 
@@ -409,7 +413,7 @@ export const buildBlockedDialogPayload = (params: {
409
413
  : hasOnlyBddScenarioMissingCauses(params.event.blockingCauses)
410
414
  ? 'Crea el fichero .feature esperado para la slice activa o corrige la referencia de tarea. Después vuelve a intentar el commit.'
411
415
  : hasOnlySkillsContractCauses(params.event.blockingCauses)
412
- ? SKILLS_CONTRACT_REMEDIATION
416
+ ? SKILLS_CONTRACT_DIALOG_REMEDIATION
413
417
  : params.event.blockingCauses && params.event.blockingCauses.length > 0
414
418
  ? 'Corrige las violaciones listadas y vuelve a intentar el commit.'
415
419
  : resolveBlockedRemediation(params.event, causeCode);
@@ -67,6 +67,7 @@ const formatPlatformName = (platform: string | null): string =>
67
67
  const extractSkillsContractPlatform = (message: string): string | null =>
68
68
  message.match(/\bplatforms?=([a-z0-9_,.-]+)/i)?.[1]?.split(',')[0]?.trim()
69
69
  ?? message.match(/\b(ios|android|frontend|backend)\(missing_critical_rule_ids=/i)?.[1]?.trim()
70
+ ?? message.match(/\bskills\.(ios|android|frontend|backend)\./i)?.[1]?.trim()
70
71
  ?? message.match(/\bfor\s+(ios|android|frontend|backend)\s*:/i)?.[1]?.trim()
71
72
  ?? null;
72
73